diff --git a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.mdx b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.mdx index d6b9c4b9f2..b41b70aa53 100644 --- a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.mdx +++ b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.mdx @@ -12,6 +12,17 @@ import * as PButtonModalStories from './PButtonModal.stories';

+## Basic + + +
+
+ +## Loading Backdrop + + +
+
## Playground diff --git a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.stories.ts b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.stories.ts index cfbc69028a..e6e49e0da2 100644 --- a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.stories.ts +++ b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.stories.ts @@ -8,6 +8,7 @@ import type { ComponentProps } from 'vue-component-type-helpers'; import PButton from '@/controls/buttons/button/PButton.vue'; import PSelectDropdown from '@/controls/dropdown/select-dropdown/PSelectDropdown.vue'; +import { getMenuItems } from '@/feedbacks/modals/button-modal/mock'; import PButtonModal from '@/feedbacks/modals/button-modal/PButtonModal.vue'; import { getButtonModalArgs, getButtonModalArgTypes, getButtonModalParameters } from '@/feedbacks/modals/button-modal/story-helper'; @@ -54,6 +55,7 @@ const Template: Story = { :hide-footer-confirm-button="hideFooterConfirmButton" :footer-reset-button-visible="footerResetButtonVisible" :loading="loading" + :loading-backdrop="loadingBackdrop" :disabled="disabled" :absolute="absolute" :modal-body-id="modalBodyId" @@ -75,62 +77,7 @@ const Template: Story = { const state = reactive({ modalVisible: props.visible, contents: computed(() => faker.lorem.lines(props.contentsHeight)), - menu: [ - { - type: 'item', label: 'Add', name: 'add', disabled: false, - }, - { - type: 'item', label: 'Hello', name: 'hello', disabled: false, - }, - { type: 'divider' }, - { type: 'header', label: 'this is header' }, - { - type: 'item', label: 'Update', name: 'update', disabled: false, - }, - { - type: 'item', label: 'Delete', name: 'delete', disabled: false, - }, - { type: 'divider' }, - { - type: 'item', label: 'Collect', name: 'collect', disabled: false, - }, - { type: 'divider' }, - { - type: 'item', label: 'Remove', name: 'remove', disabled: true, - }, - ], - items: [ - { type: 'item', label: 'one', name: 'one' }, - { type: 'item', label: 'two', name: 'two' }, - { type: 'item', label: 'three', name: 'three' }, - { type: 'item', label: 'four', name: 'four' }, - { type: 'item', label: 'five', name: 'five' }, - { type: 'item', label: 'six', name: 'six' }, - { type: 'item', label: 'one', name: 'one' }, - { type: 'item', label: 'two', name: 'two' }, - { type: 'item', label: 'three', name: 'three' }, - { type: 'item', label: 'four', name: 'four' }, - { type: 'item', label: 'five', name: 'five' }, - { type: 'item', label: 'six', name: 'six' }, - { type: 'item', label: 'one', name: 'one' }, - { type: 'item', label: 'two', name: 'two' }, - { type: 'item', label: 'three', name: 'three' }, - { type: 'item', label: 'four', name: 'four' }, - { type: 'item', label: 'five', name: 'five' }, - { type: 'item', label: 'six', name: 'six' }, - { type: 'item', label: 'one', name: 'one' }, - { type: 'item', label: 'two', name: 'two' }, - { type: 'item', label: 'three', name: 'three' }, - { type: 'item', label: 'four', name: 'four' }, - { type: 'item', label: 'five', name: 'five' }, - { type: 'item', label: 'six', name: 'six' }, - { type: 'item', label: 'one', name: 'one' }, - { type: 'item', label: 'two', name: 'two' }, - { type: 'item', label: 'three', name: 'three' }, - { type: 'item', label: 'four', name: 'four' }, - { type: 'item', label: 'five', name: 'five' }, - { type: 'item', label: 'six', name: 'six' }, - ], + items: getMenuItems(), }); const launchModal = () => { state.modalVisible = true; @@ -148,6 +95,80 @@ const Template: Story = { }), }; + +export const Basic: Story = { + render: () => ({ + components: { PButtonModal, PButton }, + template: ` +
+ Launch a modal + + + +
+ `, + setup() { + const state = reactive({ + modalVisible: false, + contents: computed(() => faker.lorem.lines(5)), + }); + const handleConfirm = () => { + state.modalVisible = false; + }; + return { + ...toRefs(state), + handleConfirm, + }; + }, + }), +}; + +export const LoadingBackdrop: Story = { + render: () => ({ + components: { PButtonModal, PButton }, + template: ` +
+ Launch a modal + + + +
+ `, + setup() { + const state = reactive({ + modalVisible: false, + contents: computed(() => faker.lorem.lines(5)), + loadingBackdrop: true, + }); + + const launchModal = () => { + state.loadingBackdrop = true; + state.modalVisible = true; + setTimeout(() => { + state.loadingBackdrop = false; + }, 3000); + }; + const handleConfirm = () => { + state.modalVisible = false; + }; + return { + ...toRefs(state), + launchModal, + handleConfirm, + }; + }, + }), +}; + export const Playground: Story = { ...Template, }; diff --git a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.vue b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.vue index 30121132e3..9143975cf4 100644 --- a/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.vue +++ b/packages/mirinae/src/feedbacks/modals/button-modal/PButtonModal.vue @@ -5,10 +5,18 @@ @after-leave="onModalLeave" >