diff --git a/content/collections/pages/confirmation-modals.md b/content/collections/pages/confirmation-modals.md new file mode 100644 index 000000000..6f8bba17d --- /dev/null +++ b/content/collections/pages/confirmation-modals.md @@ -0,0 +1,45 @@ +--- +title: Confirmation Modals +id: 88bf3f66-4b80-42c9-8b65-bef712b8f413 +--- + +Statamic ships with a [`` UI component](https://ui.statamic.dev/?path=/docs/overlays-modal--docs) you can use to build custom modals. + +However, if all you need is a confirmation prompt, you can use the `ConfirmationModal` component instead. You should use `v-if` to make it appear. + +``` html + +``` + +## Props + +| Prop | Description | +|------|-------------| +| `title` | Header text | +| `bodyText` | Provide a simple string as a content of the modal. Defaults to `Are you sure?`. | +| `buttonText` | Text for the confirmation button label. Defaults to `Confirm`. | +| `danger` | Boolean for making the modal red. Useful for when you're doing something scary like deletions. | + +## Events + +| Event | Description | +|-------|-------------| +| `confirm` | When the user clicks the confirm button. | +| `cancel` | When the user clicks the cancel button. | + +## Slots + +The default slot replaces the `bodyText` prop. Useful when you need something more complicated than a single paragraph. + +``` html + +

More complicated

+

stuff here.

+
+``` + diff --git a/content/collections/pages/modals.md b/content/collections/pages/modals.md deleted file mode 100644 index d13805f21..000000000 --- a/content/collections/pages/modals.md +++ /dev/null @@ -1,70 +0,0 @@ ---- -title: Modals -id: 88bf3f66-4b80-42c9-8b65-bef712b8f413 ---- -## Modals - -You can create modals using the `` component. - -``` html - -
- Your modal's content. - -
-
-``` - -When a modal is rendered in the DOM, it will be automatically opened. So, to control whether or not it's open, you should add a `v-if` to it. - -When closed, the modal will emit a `closed` event. You should use this event to change the 'open' condition back to `false`. - -You should also add a button somewhere inside your modal to be able to close it. To close it, emit a `closed` event. - -## Confirmation Modals - -There is a prebuilt modal component available to you if you don't need something completely custom. - -Similar to the regular modal, you should use a `v-if` to make it appear. - -``` html - -``` - -### Props - -| Prop | Description | -|------|-------------| -| `title` | Header text | -| `bodyText` | Provide a simple string as a content of the modal. Defaults to `Are you sure?`. | -| `buttonText` | Text for the confirmation button label. Defaults to `Confirm`. | -| `danger` | Boolean for making the modal red. Useful for when you're doing something scary like deletions. | - -### Events - -| Event | Description | -|-------|-------------| -| `confirm` | When the user clicks the confirm button. | -| `cancel` | When the user clicks the cancel button. | - -### Slots - -The default slot replaces the `bodyText` prop. Useful when you need something more complicated than a single paragraph. - - ``` html - -

More complicated

-

stuff here.

-
- ``` - diff --git a/content/collections/pages/stacks.md b/content/collections/pages/stacks.md deleted file mode 100644 index 3b19f8891..000000000 --- a/content/collections/pages/stacks.md +++ /dev/null @@ -1,67 +0,0 @@ ---- -title: Stacks -intro: | - A Stack is a way to add a layer of UX to the Control Panel. -id: c21a18cc-b9a9-4b1a-b1f7-97473f7d82f1 ---- -## Stacks -For example, when editing a related entry while you're already editing another entry would open a second publish form over the top. Once you're done, the layer would close and return you to your original task, without you losing any progress, or needing to navigate away. - -To create a Stack, wrap a block of content with a `` component. - -``` html - - Your stack's content. - -``` - -## Narrow stacks - -To make a stack narrow, add a prop. - -``` html -... -``` - -## Opening a Stack - -When a Stack is rendered in the DOM, it will be automatically opened. So, to control whether or not it's open, you should add a `v-if` to it. - -## Closing a Stack - -You can close a Stack by clicking on a lower stack (or the original layer). Any higher Stacks will also attempt to close. You can also change your `v-if` back to a falsey value. - -When closed, the modal will emit a `closed` event. It's recommended to use this event to perform your closing logic. This will let the Stack nicely animate out instead of abruptly disappearing. The `close` function is available to you in the slot scope. - -``` html - -
- - - - - - - -
-
-``` - -## Preventing Stacks from closing - -Before a Stack is closed, you have the opportunity to cancel it. For instance, if your Stack contains a form, you may want to give a warning about unsaved changes when the user tries to close it. To prevent closing of a Stack, you should pass in a function that returns `false` to stop closing and `true` to allow it. - -``` html - ... -``` -``` js -shouldClose() { - if (confirm('Are you sure?')) { - return true; // let it close - } else { - return false; // prevent it from closing - } -} -``` - -If you prevent your stack from closing, any subsequent Stacks closures will also be prevented. diff --git a/content/collections/pages/vue-2-to-3.md b/content/collections/pages/vue-2-to-3.md index 330310b28..962253800 100644 --- a/content/collections/pages/vue-2-to-3.md +++ b/content/collections/pages/vue-2-to-3.md @@ -578,7 +578,7 @@ import { Input, Textarea, Combobox, Switch } from '@statamic/cms/ui'; // [tl! ++ ## Modals and Stacks -Previously, you had to use `v-if` to control the "open state" of Modals and Stacks. You should now `v-model` the open state instead: +Previously, you had to use `v-if` to control the "open state" of Modals and Stacks. You should now use `v-model` to control the open state instead: ```vue diff --git a/content/trees/collections/pages.yaml b/content/trees/collections/pages.yaml index 27c9c3039..6ec189f13 100644 --- a/content/trees/collections/pages.yaml +++ b/content/trees/collections/pages.yaml @@ -334,8 +334,6 @@ tree: entry: 88bf3f66-4b80-42c9-8b65-bef712b8f413 - entry: 28068f9a-f269-4646-87e4-881e5477558d - - - entry: c21a18cc-b9a9-4b1a-b1f7-97473f7d82f1 - entry: 2d6381b8-dc0a-4a5d-b750-1a9dd7c0bb14 children: diff --git a/content/trees/navigation/extending_docs.yaml b/content/trees/navigation/extending_docs.yaml index 949486ef7..9e6c47dff 100644 --- a/content/trees/navigation/extending_docs.yaml +++ b/content/trees/navigation/extending_docs.yaml @@ -110,9 +110,6 @@ tree: - id: dbea0d9e-6a6a-42fd-83bf-d0d2eae539b6 entry: d84613d5-2b2b-465d-8f02-c71b6d2aadf1 - - - id: 6a3e2a46-90fa-420b-b48b-79ba5ad0ac20 - entry: c21a18cc-b9a9-4b1a-b1f7-97473f7d82f1 - id: 912c7cdd-8c3f-4824-8af5-95ad81f45fb5 entry: b80820bb-c2e8-475f-98bd-8ea0ef9f5339 diff --git a/routes/redirects.php b/routes/redirects.php index 2e5a43e04..0e3e1bacd 100644 --- a/routes/redirects.php +++ b/routes/redirects.php @@ -23,7 +23,7 @@ Route::permanentRedirect('extending/keyboard-shortcuts', '/control-panel/keyboard-shortcuts'); Route::permanentRedirect('extending/lifecycle', '/advanced-topics/lifecycle'); Route::permanentRedirect('extending/markdown', '/frontend/markdown'); -Route::permanentRedirect('extending/modals', '/vue-components/modals'); +Route::permanentRedirect('extending/modals', 'https://ui.statamic.dev/?path=/docs/overlays-modal--docs'); Route::permanentRedirect('extending/modifiers', '/modifiers/modifiers'); Route::permanentRedirect('extending/permissions', '/control-panel/permissions'); Route::permanentRedirect('extending/progress', '/vue-components/progress'); @@ -34,7 +34,7 @@ Route::permanentRedirect('extending/repositories', '/backend-apis/repositories'); Route::permanentRedirect('extending/search', '/frontend/search#digging-deeper'); Route::permanentRedirect('extending/slugs', '/vue-components/slugs'); -Route::permanentRedirect('extending/stacks', '/vue-components/stacks'); +Route::permanentRedirect('extending/stacks', 'https://ui.statamic.dev/?path=/docs/overlays-stack--docs'); Route::permanentRedirect('extending/tags', '/tags/building-a-tag'); Route::permanentRedirect('extending/testing-in-addons', '/addons/testing'); Route::permanentRedirect('extending/toast-notifications', '/control-panel/toast-notifications');