@weni/unnnic-system 3.12.2 → 3.12.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/Alert.vue.d.ts +3 -3
- package/dist/components/Alert/Version1dot1.vue.d.ts +1 -1
- package/dist/components/AudioRecorder/AudioHandler.vue.d.ts +92 -18
- package/dist/components/AudioRecorder/AudioRecorder.vue.d.ts +184 -36
- package/dist/components/AvatarIcon/AvatarIcon.vue.d.ts +1 -1
- package/dist/components/Button/Button.vue.d.ts +2 -2
- package/dist/components/Card/AccountCard.vue.d.ts +2 -2
- package/dist/components/Card/Card.vue.d.ts +103 -29
- package/dist/components/Card/CardCompany.vue.d.ts +2 -2
- package/dist/components/Card/CardStatusesContainer.vue.d.ts +93 -19
- package/dist/components/Card/ContentCard.vue.d.ts +1 -1
- package/dist/components/Card/DashCard.vue.d.ts +2 -2
- package/dist/components/Card/DefaultCard.vue.d.ts +1 -1
- package/dist/components/Card/MarketplaceCard.vue.d.ts +1 -1
- package/dist/components/Card/SimpleCard.vue.d.ts +92 -18
- package/dist/components/Card/StatusCard.vue.d.ts +1 -1
- package/dist/components/Card/TitleCard.vue.d.ts +92 -18
- package/dist/components/CardImage/CardImage.vue.d.ts +5 -5
- package/dist/components/CardInformation/CardInformation.vue.d.ts +93 -19
- package/dist/components/CardProject/CardProject.vue.d.ts +2 -2
- package/dist/components/Carousel/Carousel.vue.d.ts +2 -2
- package/dist/components/Carousel/TagCarousel.vue.d.ts +2 -2
- package/dist/components/ChartBar/ChartBar.vue.d.ts +98 -24
- package/dist/components/ChartLine/ChartLine.vue.d.ts +92 -18
- package/dist/components/ChatText/ChatText.vue.d.ts +92 -18
- package/dist/components/ChatsContact/ChatsContact.vue.d.ts +6 -6
- package/dist/components/ChatsMessage/ChatsMessage.vue.d.ts +92 -18
- package/dist/components/ChatsUserAvatar/ChatsUserAvatar.vue.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.vue.d.ts +3 -3
- package/dist/components/DataArea/DataArea.vue.d.ts +92 -18
- package/dist/components/DataTable/index.vue.d.ts +1 -1
- package/dist/components/DataTable/index.vue.d.ts.map +1 -1
- package/dist/components/DateFilter/DateFilter.vue.d.ts +94 -15
- package/dist/components/Drawer/Drawer.vue.d.ts +37 -207
- package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
- package/dist/components/Dropdown/Dropdown.vue.d.ts +1 -1
- package/dist/components/FormElement/FormElement.vue.d.ts +6 -6
- package/dist/components/ImportCard/ImportCard.vue.d.ts +6 -6
- package/dist/components/Input/BaseInput.vue.d.ts +22 -0
- package/dist/components/Input/BaseInput.vue.d.ts.map +1 -1
- package/dist/components/Input/Input.vue.d.ts +93 -14
- package/dist/components/Input/Input.vue.d.ts.map +1 -1
- package/dist/components/Input/TextInput.vue.d.ts +54 -3
- package/dist/components/Input/TextInput.vue.d.ts.map +1 -1
- package/dist/components/InputNext/InputNext.vue.d.ts +4 -4
- package/dist/components/Label/Label.vue.d.ts +1 -1
- package/dist/components/Label/Label.vue.d.ts.map +1 -1
- package/dist/components/Modal/Modal.vue.d.ts +1 -1
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts +209 -35
- package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
- package/dist/components/ModalNext/ModalNext.vue.d.ts +99 -20
- package/dist/components/ModalUpload/ModalUpload.vue.d.ts +12 -12
- package/dist/components/MoodRating/MoodRating.vue.d.ts +92 -18
- package/dist/components/MultiSelect/MultiSelect.vue.d.ts +18 -18
- package/dist/components/Pagination/Pagination.vue.d.ts +6 -6
- package/dist/components/Radio/Radio.vue.d.ts +6 -6
- package/dist/components/Select/index.vue.d.ts +44 -0
- package/dist/components/Select/index.vue.d.ts.map +1 -0
- package/dist/components/SelectSmart/SelectSmart.vue.d.ts +63 -12
- package/dist/components/SelectSmart/SelectSmartMultipleHeader.vue.d.ts +2 -2
- package/dist/components/SelectSmart/SelectSmartOption.vue.d.ts +5 -5
- package/dist/components/SelectTime/index.vue.d.ts +55 -4
- package/dist/components/Slider/Slider.vue.d.ts +92 -18
- package/dist/components/Switch/Switch.vue.d.ts +3 -3
- package/dist/components/Tab/Tab.vue.d.ts +92 -18
- package/dist/components/TableNext/TableBodyCell.vue.d.ts +2 -2
- package/dist/components/TableNext/TablePagination.vue.d.ts +6 -6
- package/dist/components/Tag/DefaultTag.vue.d.ts +1 -1
- package/dist/components/Tag/Tag.vue.d.ts +2 -2
- package/dist/components/TextArea/TextArea.vue.d.ts +8 -8
- package/dist/components/Toast/Toast.vue.d.ts +1 -1
- package/dist/components/Toast/Toast.vue.d.ts.map +1 -1
- package/dist/components/ToolTip/ToolTip.vue.d.ts +92 -18
- package/dist/components/ToolTip/ToolTip.vue.d.ts.map +1 -1
- package/dist/components/Tour/Tour.vue.d.ts +6 -6
- package/dist/components/Tour/TourPopover.vue.d.ts +6 -6
- package/dist/components/UploadArea/UploadArea.vue.d.ts +6 -6
- package/dist/components/ui/dialog/Dialog.vue.d.ts +23 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +43 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +25 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +29 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +23 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +19 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/dialog/index.d.ts +8 -0
- package/dist/components/ui/dialog/index.d.ts.map +1 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +35 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts +19 -0
- package/dist/components/ui/drawer/DrawerClose.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +43 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +23 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +22 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +25 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +8 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +23 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts +19 -0
- package/dist/components/ui/drawer/DrawerTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/drawer/index.d.ts +11 -0
- package/dist/components/ui/drawer/index.d.ts.map +1 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +2 -2
- package/dist/components/ui/popover/PopoverContent.vue.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverOption.vue.d.ts +1 -1
- package/dist/components/ui/popover/PopoverOption.vue.d.ts.map +1 -1
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts.map +1 -1
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts +23 -0
- package/dist/components/ui/tooltip/Tooltip.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts +31 -0
- package/dist/components/ui/tooltip/TooltipContent.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts +19 -0
- package/dist/components/ui/tooltip/TooltipTrigger.vue.d.ts.map +1 -0
- package/dist/components/ui/tooltip/index.d.ts +4 -0
- package/dist/components/ui/tooltip/index.d.ts.map +1 -0
- package/dist/{es-40d7aad6.mjs → es-59933601.mjs} +1 -1
- package/dist/{index-56b50ff8.mjs → index-4fe9253b.mjs} +99820 -96757
- package/dist/lib/layer-manager.d.ts +16 -0
- package/dist/lib/layer-manager.d.ts.map +1 -0
- package/dist/locales/en.json.d.ts +2 -1
- package/dist/locales/es.json.d.ts +2 -1
- package/dist/locales/pt_br.json.d.ts +2 -1
- package/dist/{pt-br-e6e2313f.mjs → pt-br-10db3200.mjs} +1 -1
- package/dist/style.css +1 -1
- package/dist/unnnic.mjs +234 -204
- package/dist/unnnic.umd.js +48 -44
- package/package.json +3 -2
- package/src/assets/scss/scheme-colors.scss +223 -223
- package/src/assets/scss/tailwind.scss +8 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/Checkbox/Checkbox.vue +1 -1
- package/src/components/Drawer/Drawer.vue +190 -269
- package/src/components/Drawer/__tests__/Drawer.spec.js +37 -46
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
- package/src/components/Input/BaseInput.vue +21 -2
- package/src/components/Input/Input.scss +2 -3
- package/src/components/Input/Input.vue +19 -1
- package/src/components/Input/TextInput.vue +58 -22
- package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
- package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
- package/src/components/ModalDialog/ModalDialog.vue +64 -148
- package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +11 -221
- package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
- package/src/components/MultiSelectV2/MultSelectOption.vue +67 -0
- package/src/components/MultiSelectV2/__tests__/MultiSelect.spec.js +556 -0
- package/src/components/MultiSelectV2/__tests__/MultiSelectOption.spec.js +229 -0
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelect.spec.js.snap +121 -0
- package/src/components/MultiSelectV2/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
- package/src/components/MultiSelectV2/index.vue +224 -0
- package/src/components/Select/__tests__/Select.spec.js +422 -0
- package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
- package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
- package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +65 -0
- package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
- package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
- package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
- package/src/components/Select/index.vue +261 -0
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
- package/src/components/Toast/Toast.vue +16 -9
- package/src/components/ToolTip/ToolTip.vue +25 -177
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
- package/src/components/index.ts +60 -4
- package/src/components/ui/dialog/Dialog.vue +19 -0
- package/src/components/ui/dialog/DialogClose.vue +29 -0
- package/src/components/ui/dialog/DialogContent.vue +140 -0
- package/src/components/ui/dialog/DialogFooter.vue +50 -0
- package/src/components/ui/dialog/DialogHeader.vue +83 -0
- package/src/components/ui/dialog/DialogTitle.vue +38 -0
- package/src/components/ui/dialog/DialogTrigger.vue +16 -0
- package/src/components/ui/dialog/index.ts +7 -0
- package/src/components/ui/drawer/Drawer.vue +27 -0
- package/src/components/ui/drawer/DrawerClose.vue +37 -0
- package/src/components/ui/drawer/DrawerContent.vue +111 -0
- package/src/components/ui/drawer/DrawerDescription.vue +40 -0
- package/src/components/ui/drawer/DrawerFooter.vue +38 -0
- package/src/components/ui/drawer/DrawerHeader.vue +57 -0
- package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
- package/src/components/ui/drawer/DrawerTitle.vue +37 -0
- package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
- package/src/components/ui/drawer/index.ts +10 -0
- package/src/components/ui/popover/PopoverContent.vue +4 -2
- package/src/components/ui/popover/PopoverOption.vue +4 -0
- package/src/components/ui/popover/PopoverTrigger.vue +5 -1
- package/src/components/ui/tooltip/Tooltip.vue +21 -0
- package/src/components/ui/tooltip/TooltipContent.vue +74 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +26 -0
- package/src/components/ui/tooltip/index.ts +3 -0
- package/src/lib/layer-manager.ts +84 -0
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +2 -1
- package/src/locales/pt_br.json +2 -1
- package/src/stories/Dialog.stories.js +832 -0
- package/src/stories/Drawer.stories.js +1 -1
- package/src/stories/DrawerNext.stories.js +611 -0
- package/src/stories/LayerManager.docs.mdx +40 -0
- package/src/stories/LayerManager.stories.js +364 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/MultiSelectV2.stories.js +158 -0
- package/src/stories/Select.stories.js +158 -0
|
@@ -1,198 +1,210 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="modelValue"
|
|
2
|
+
<Drawer
|
|
4
3
|
class="unnnic-drawer"
|
|
5
4
|
data-testid="drawer"
|
|
5
|
+
:open="modelValue"
|
|
6
|
+
@update:open="$event ? () => {} : back()"
|
|
6
7
|
>
|
|
7
|
-
<
|
|
8
|
-
v-
|
|
9
|
-
|
|
10
|
-
data-testid="
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
appear
|
|
15
|
-
name="drawer"
|
|
16
|
-
>
|
|
17
|
-
<section
|
|
18
|
-
v-if="showDrawer"
|
|
19
|
-
data-testid="drawer-container"
|
|
20
|
-
:class="[
|
|
8
|
+
<DrawerContent
|
|
9
|
+
v-bind="$attrs"
|
|
10
|
+
:showOverlay="!withoutOverlay"
|
|
11
|
+
data-testid="drawer-container"
|
|
12
|
+
:size="mappedSize"
|
|
13
|
+
:class="
|
|
14
|
+
[
|
|
21
15
|
'unnnic-drawer__container',
|
|
22
16
|
`unnnic-drawer__container--${size}`,
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class="unnnic-drawer__title"
|
|
35
|
-
data-testid="drawer-title"
|
|
36
|
-
>
|
|
37
|
-
{{ title }}
|
|
38
|
-
</h1>
|
|
39
|
-
<p
|
|
40
|
-
v-if="description"
|
|
41
|
-
class="unnnic-drawer__description"
|
|
42
|
-
data-testid="drawer-description"
|
|
43
|
-
>
|
|
44
|
-
{{ description }}
|
|
45
|
-
</p>
|
|
46
|
-
</template>
|
|
47
|
-
</section>
|
|
48
|
-
<UnnnicIcon
|
|
49
|
-
class="unnnic-drawer__close"
|
|
50
|
-
data-testid="close-icon"
|
|
51
|
-
:icon="closeIcon"
|
|
52
|
-
size="avatar-nano"
|
|
53
|
-
clickable
|
|
54
|
-
@click="back"
|
|
17
|
+
props.class,
|
|
18
|
+
]
|
|
19
|
+
.filter(Boolean)
|
|
20
|
+
.join(' ')
|
|
21
|
+
"
|
|
22
|
+
>
|
|
23
|
+
<DrawerHeader class="unnnic-drawer__header">
|
|
24
|
+
<section class="unnnic-drawer__title-container">
|
|
25
|
+
<slot
|
|
26
|
+
v-if="$slots.title"
|
|
27
|
+
name="title"
|
|
55
28
|
/>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
29
|
+
|
|
30
|
+
<template v-else>
|
|
31
|
+
<DrawerTitle
|
|
32
|
+
class="unnnic-drawer__title"
|
|
33
|
+
data-testid="drawer-title"
|
|
34
|
+
>
|
|
35
|
+
{{ title }}
|
|
36
|
+
</DrawerTitle>
|
|
37
|
+
<DrawerDescription
|
|
38
|
+
v-if="description"
|
|
39
|
+
class="unnnic-drawer__description"
|
|
40
|
+
data-testid="drawer-description"
|
|
41
|
+
>
|
|
42
|
+
{{ description }}
|
|
43
|
+
</DrawerDescription>
|
|
44
|
+
</template>
|
|
59
45
|
</section>
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
v-if="primaryButtonText"
|
|
77
|
-
data-testid="primary-button"
|
|
78
|
-
size="large"
|
|
79
|
-
:disabled="disabledPrimaryButton"
|
|
80
|
-
:loading="loadingPrimaryButton"
|
|
81
|
-
:type="primaryButtonType"
|
|
82
|
-
:text="primaryButtonText"
|
|
83
|
-
@click="$emit('primaryButtonClick')"
|
|
84
|
-
/>
|
|
85
|
-
</footer>
|
|
46
|
+
<template #close>
|
|
47
|
+
<DrawerClose>
|
|
48
|
+
<UnnnicButton
|
|
49
|
+
class="unnnic-drawer__close-icon"
|
|
50
|
+
data-testid="close-icon"
|
|
51
|
+
:iconCenter="closeIcon"
|
|
52
|
+
size="small"
|
|
53
|
+
type="tertiary"
|
|
54
|
+
@click="back"
|
|
55
|
+
/>
|
|
56
|
+
</DrawerClose>
|
|
57
|
+
</template>
|
|
58
|
+
</DrawerHeader>
|
|
59
|
+
|
|
60
|
+
<section class="unnnic-drawer__content">
|
|
61
|
+
<slot name="content"></slot>
|
|
86
62
|
</section>
|
|
87
|
-
|
|
88
|
-
|
|
63
|
+
|
|
64
|
+
<DrawerFooter
|
|
65
|
+
v-if="showFooter"
|
|
66
|
+
class="unnnic-drawer__footer"
|
|
67
|
+
data-testid="footer"
|
|
68
|
+
>
|
|
69
|
+
<UnnnicButton
|
|
70
|
+
v-if="secondaryButtonText"
|
|
71
|
+
data-testid="secondary-button"
|
|
72
|
+
size="large"
|
|
73
|
+
type="tertiary"
|
|
74
|
+
:disabled="disabledSecondaryButton"
|
|
75
|
+
:loading="loadingSecondaryButton"
|
|
76
|
+
:text="secondaryButtonText"
|
|
77
|
+
@click="$emit('secondaryButtonClick')"
|
|
78
|
+
/>
|
|
79
|
+
<UnnnicButton
|
|
80
|
+
v-if="primaryButtonText"
|
|
81
|
+
data-testid="primary-button"
|
|
82
|
+
size="large"
|
|
83
|
+
:disabled="disabledPrimaryButton"
|
|
84
|
+
:loading="loadingPrimaryButton"
|
|
85
|
+
:type="primaryButtonType"
|
|
86
|
+
:text="primaryButtonText"
|
|
87
|
+
@click="$emit('primaryButtonClick')"
|
|
88
|
+
/>
|
|
89
|
+
</DrawerFooter>
|
|
90
|
+
</DrawerContent>
|
|
91
|
+
</Drawer>
|
|
89
92
|
</template>
|
|
90
93
|
|
|
91
|
-
<script>
|
|
92
|
-
import
|
|
93
|
-
import UnnnicButton from '../Button/Button.vue';
|
|
94
|
+
<script setup>
|
|
95
|
+
import { computed } from 'vue';
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
import UnnnicButton from '../Button/Button.vue';
|
|
98
|
+
import {
|
|
99
|
+
Drawer,
|
|
100
|
+
DrawerContent,
|
|
101
|
+
DrawerHeader,
|
|
102
|
+
DrawerFooter,
|
|
103
|
+
DrawerClose,
|
|
104
|
+
DrawerTitle,
|
|
105
|
+
DrawerDescription,
|
|
106
|
+
} from '../ui/drawer';
|
|
107
|
+
|
|
108
|
+
defineOptions({
|
|
96
109
|
name: 'UnnnicDrawer',
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
inheritAttrs: false,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const props = defineProps({
|
|
114
|
+
title: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: true,
|
|
100
117
|
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
required: true,
|
|
105
|
-
},
|
|
106
|
-
description: {
|
|
107
|
-
type: String,
|
|
108
|
-
default: '',
|
|
109
|
-
},
|
|
110
|
-
disabledPrimaryButton: {
|
|
111
|
-
type: Boolean,
|
|
112
|
-
default: false,
|
|
113
|
-
},
|
|
114
|
-
disabledSecondaryButton: {
|
|
115
|
-
type: Boolean,
|
|
116
|
-
default: false,
|
|
117
|
-
},
|
|
118
|
-
loadingPrimaryButton: {
|
|
119
|
-
type: Boolean,
|
|
120
|
-
default: false,
|
|
121
|
-
},
|
|
122
|
-
loadingSecondaryButton: {
|
|
123
|
-
type: Boolean,
|
|
124
|
-
default: false,
|
|
125
|
-
},
|
|
126
|
-
primaryButtonText: {
|
|
127
|
-
type: String,
|
|
128
|
-
default: '',
|
|
129
|
-
},
|
|
130
|
-
primaryButtonType: {
|
|
131
|
-
type: String,
|
|
132
|
-
default: 'primary',
|
|
133
|
-
},
|
|
134
|
-
secondaryButtonText: {
|
|
135
|
-
type: String,
|
|
136
|
-
default: '',
|
|
137
|
-
},
|
|
138
|
-
size: {
|
|
139
|
-
type: String,
|
|
140
|
-
default: 'md',
|
|
141
|
-
validator(val) {
|
|
142
|
-
return ['md', 'lg', 'xl', 'gt'].includes(val);
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
wide: {
|
|
146
|
-
type: Boolean,
|
|
147
|
-
default: false,
|
|
148
|
-
},
|
|
149
|
-
modelValue: {
|
|
150
|
-
type: Boolean,
|
|
151
|
-
required: true,
|
|
152
|
-
},
|
|
153
|
-
withoutOverlay: {
|
|
154
|
-
type: Boolean,
|
|
155
|
-
default: false,
|
|
156
|
-
},
|
|
157
|
-
closeIcon: {
|
|
158
|
-
type: String,
|
|
159
|
-
default: 'arrow_back',
|
|
160
|
-
},
|
|
161
|
-
distinctCloseBack: {
|
|
162
|
-
type: Boolean,
|
|
163
|
-
default: false,
|
|
164
|
-
},
|
|
118
|
+
description: {
|
|
119
|
+
type: String,
|
|
120
|
+
default: '',
|
|
165
121
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
showDrawer: true,
|
|
170
|
-
};
|
|
122
|
+
disabledPrimaryButton: {
|
|
123
|
+
type: Boolean,
|
|
124
|
+
default: false,
|
|
171
125
|
},
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
},
|
|
126
|
+
disabledSecondaryButton: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false,
|
|
176
129
|
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
130
|
+
loadingPrimaryButton: {
|
|
131
|
+
type: Boolean,
|
|
132
|
+
default: false,
|
|
133
|
+
},
|
|
134
|
+
loadingSecondaryButton: {
|
|
135
|
+
type: Boolean,
|
|
136
|
+
default: false,
|
|
137
|
+
},
|
|
138
|
+
primaryButtonText: {
|
|
139
|
+
type: String,
|
|
140
|
+
default: '',
|
|
141
|
+
},
|
|
142
|
+
primaryButtonType: {
|
|
143
|
+
type: String,
|
|
144
|
+
default: 'primary',
|
|
145
|
+
},
|
|
146
|
+
secondaryButtonText: {
|
|
147
|
+
type: String,
|
|
148
|
+
default: '',
|
|
149
|
+
},
|
|
150
|
+
size: {
|
|
151
|
+
type: String,
|
|
152
|
+
default: 'md',
|
|
153
|
+
validator(val) {
|
|
154
|
+
return ['md', 'lg', 'xl', 'gt'].includes(val);
|
|
194
155
|
},
|
|
195
156
|
},
|
|
157
|
+
modelValue: {
|
|
158
|
+
type: Boolean,
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
withoutOverlay: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
default: false,
|
|
164
|
+
},
|
|
165
|
+
closeIcon: {
|
|
166
|
+
type: String,
|
|
167
|
+
default: 'arrow_forward',
|
|
168
|
+
},
|
|
169
|
+
distinctCloseBack: {
|
|
170
|
+
type: Boolean,
|
|
171
|
+
default: false,
|
|
172
|
+
},
|
|
173
|
+
class: {
|
|
174
|
+
type: String,
|
|
175
|
+
default: '',
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const emit = defineEmits([
|
|
180
|
+
'primaryButtonClick',
|
|
181
|
+
'secondaryButtonClick',
|
|
182
|
+
'close',
|
|
183
|
+
'back',
|
|
184
|
+
]);
|
|
185
|
+
const showFooter = computed(
|
|
186
|
+
() => !!(props.primaryButtonText || props.secondaryButtonText),
|
|
187
|
+
);
|
|
188
|
+
const mappedSize = computed(() => {
|
|
189
|
+
const sizes = {
|
|
190
|
+
md: 'medium',
|
|
191
|
+
lg: 'large',
|
|
192
|
+
xl: 'extra-large',
|
|
193
|
+
gt: 'giant',
|
|
194
|
+
};
|
|
195
|
+
return sizes[props.size] || 'medium';
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const close = () => {
|
|
199
|
+
emit('close');
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const back = () => {
|
|
203
|
+
if (props.distinctCloseBack) {
|
|
204
|
+
emit('back');
|
|
205
|
+
} else {
|
|
206
|
+
close();
|
|
207
|
+
}
|
|
196
208
|
};
|
|
197
209
|
</script>
|
|
198
210
|
|
|
@@ -204,107 +216,16 @@ export default {
|
|
|
204
216
|
box-sizing: border-box;
|
|
205
217
|
}
|
|
206
218
|
|
|
207
|
-
@keyframes drawerOpen {
|
|
208
|
-
from {
|
|
209
|
-
transform: translateX(100%);
|
|
210
|
-
}
|
|
211
|
-
to {
|
|
212
|
-
transform: translateX(0);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
@keyframes drawerClose {
|
|
217
|
-
from {
|
|
218
|
-
transform: translateX(0);
|
|
219
|
-
}
|
|
220
|
-
to {
|
|
221
|
-
transform: translateX(100%);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.drawer-enter-active,
|
|
226
|
-
.drawer-enter-to {
|
|
227
|
-
animation: drawerOpen 200ms ease-in;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.drawer-leave-active,
|
|
231
|
-
.drawer-leave-to {
|
|
232
|
-
display: none;
|
|
233
|
-
animation: drawerClose 200ms ease-in;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
219
|
.unnnic-drawer {
|
|
237
|
-
width: 100vw;
|
|
238
|
-
height: 100vh;
|
|
239
|
-
position: fixed;
|
|
240
|
-
left: 0;
|
|
241
|
-
top: 0;
|
|
242
220
|
z-index: 8;
|
|
243
221
|
}
|
|
244
222
|
|
|
245
|
-
.unnnic-drawer__overlay {
|
|
246
|
-
z-index: 9;
|
|
247
|
-
background-color: rgba(0, 0, 0, 0.4);
|
|
248
|
-
width: 100%;
|
|
249
|
-
height: 100%;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
223
|
.unnnic-drawer__container {
|
|
253
224
|
z-index: 10;
|
|
254
|
-
top: 0;
|
|
255
|
-
right: 0;
|
|
256
|
-
position: fixed;
|
|
257
|
-
display: flex;
|
|
258
|
-
flex-direction: column;
|
|
259
|
-
font-family: $unnnic-font-family-secondary;
|
|
260
|
-
justify-content: space-between;
|
|
261
|
-
height: 100%;
|
|
262
|
-
background-color: $unnnic-color-neutral-white;
|
|
263
|
-
|
|
264
|
-
&--md {
|
|
265
|
-
width: calc(100% / 3);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
&--lg {
|
|
269
|
-
width: 50%;
|
|
270
|
-
}
|
|
271
225
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
&--gt {
|
|
277
|
-
width: 75%;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
.unnnic-drawer__header {
|
|
226
|
+
.unnnic-drawer__close-icon {
|
|
227
|
+
margin: $unnnic-spacing-nano;
|
|
281
228
|
display: flex;
|
|
282
|
-
justify-content: space-between;
|
|
283
|
-
border-bottom: 1px solid $unnnic-color-neutral-soft;
|
|
284
|
-
padding: $unnnic-spacing-md;
|
|
285
|
-
.unnnic-drawer__title-container {
|
|
286
|
-
.unnnic-drawer__title {
|
|
287
|
-
color: $unnnic-color-neutral-darkest;
|
|
288
|
-
font-family: $unnnic-font-family-secondary;
|
|
289
|
-
font-size: $unnnic-font-size-title-sm;
|
|
290
|
-
font-weight: $unnnic-font-weight-black;
|
|
291
|
-
line-height: $unnnic-line-height-large * 1.75;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
.unnnic-drawer__description {
|
|
295
|
-
color: $unnnic-color-neutral-cloudy;
|
|
296
|
-
font-family: $unnnic-font-family-secondary;
|
|
297
|
-
font-size: $unnnic-font-size-body-gt;
|
|
298
|
-
font-weight: $unnnic-font-weight-regular;
|
|
299
|
-
line-height: $unnnic-line-height-large * 1.375;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.unnnic-drawer__close {
|
|
304
|
-
margin: $unnnic-spacing-nano;
|
|
305
|
-
transform: rotate(180deg);
|
|
306
|
-
display: flex;
|
|
307
|
-
}
|
|
308
229
|
}
|
|
309
230
|
|
|
310
231
|
.unnnic-drawer__content {
|
|
@@ -5,6 +5,19 @@ import Drawer from '../Drawer.vue';
|
|
|
5
5
|
describe('Drawer.vue', () => {
|
|
6
6
|
let wrapper;
|
|
7
7
|
|
|
8
|
+
const templateSlot = { template: `<div><slot /></div>` };
|
|
9
|
+
const globalStubs = {
|
|
10
|
+
UnnnicIcon: true,
|
|
11
|
+
UnnnicButton: true,
|
|
12
|
+
Teleport: templateSlot,
|
|
13
|
+
UnnnicDrawerNext: templateSlot,
|
|
14
|
+
UnnnicDrawerContent: templateSlot,
|
|
15
|
+
UnnnicDrawerFooter: templateSlot,
|
|
16
|
+
UnnnicDrawerClose: templateSlot,
|
|
17
|
+
UnnnicDrawerTitle: templateSlot,
|
|
18
|
+
UnnnicDrawerDescription: templateSlot,
|
|
19
|
+
};
|
|
20
|
+
|
|
8
21
|
beforeEach(() => {
|
|
9
22
|
wrapper = mount(Drawer, {
|
|
10
23
|
props: {
|
|
@@ -15,15 +28,14 @@ describe('Drawer.vue', () => {
|
|
|
15
28
|
secondaryButtonText: 'Secondary Action',
|
|
16
29
|
},
|
|
17
30
|
global: {
|
|
18
|
-
stubs:
|
|
31
|
+
stubs: globalStubs,
|
|
19
32
|
},
|
|
20
33
|
});
|
|
21
34
|
});
|
|
22
35
|
|
|
23
36
|
const element = (id) => wrapper.find(`[data-testid="${id}"]`);
|
|
24
37
|
const component = (id) => wrapper.findComponent(`[data-testid="${id}"]`);
|
|
25
|
-
const
|
|
26
|
-
const overlay = () => element('overlay');
|
|
38
|
+
const drawerRoot = () => wrapper.findComponent({ name: 'UnnnicDrawerNext' });
|
|
27
39
|
const title = () => element('drawer-title');
|
|
28
40
|
const description = () => element('drawer-description');
|
|
29
41
|
const primaryButton = () => component('primary-button');
|
|
@@ -31,6 +43,8 @@ describe('Drawer.vue', () => {
|
|
|
31
43
|
const footer = () => element('footer');
|
|
32
44
|
const closeIcon = () => component('close-icon');
|
|
33
45
|
const drawerContainer = () => element('drawer-container');
|
|
46
|
+
const drawerContentComponent = () =>
|
|
47
|
+
wrapper.findComponent({ name: 'UnnnicDrawerContent' });
|
|
34
48
|
|
|
35
49
|
describe('Component Rendering', () => {
|
|
36
50
|
describe('Component Rendering', () => {
|
|
@@ -39,21 +53,21 @@ describe('Drawer.vue', () => {
|
|
|
39
53
|
});
|
|
40
54
|
|
|
41
55
|
it('should render the drawer when modelValue is true', () => {
|
|
42
|
-
expect(
|
|
56
|
+
expect(drawerRoot().props('open')).toBe(true);
|
|
43
57
|
});
|
|
44
58
|
|
|
45
59
|
it('should not render the drawer when modelValue is false', async () => {
|
|
46
60
|
await wrapper.setProps({ modelValue: false });
|
|
47
|
-
expect(
|
|
61
|
+
expect(drawerRoot().props('open')).toBe(false);
|
|
48
62
|
});
|
|
49
63
|
|
|
50
64
|
it('should render the overlay when withoutOverlay is false', () => {
|
|
51
|
-
expect(
|
|
65
|
+
expect(drawerContentComponent().props('showOverlay')).toBe(true);
|
|
52
66
|
});
|
|
53
67
|
|
|
54
68
|
it('should not render the overlay when withoutOverlay is true', async () => {
|
|
55
69
|
await wrapper.setProps({ withoutOverlay: true });
|
|
56
|
-
expect(
|
|
70
|
+
expect(drawerContentComponent().props('showOverlay')).toBe(false);
|
|
57
71
|
});
|
|
58
72
|
|
|
59
73
|
it('should display the title and description correctly', () => {
|
|
@@ -75,7 +89,11 @@ describe('Drawer.vue', () => {
|
|
|
75
89
|
slots: {
|
|
76
90
|
content: '<div data-testid="slot-content">Slot Content</div>',
|
|
77
91
|
},
|
|
92
|
+
global: {
|
|
93
|
+
stubs: globalStubs,
|
|
94
|
+
},
|
|
78
95
|
});
|
|
96
|
+
|
|
79
97
|
expect(wrapper.find('[data-testid="slot-content"]').exists()).toBe(
|
|
80
98
|
true,
|
|
81
99
|
);
|
|
@@ -93,6 +111,9 @@ describe('Drawer.vue', () => {
|
|
|
93
111
|
slots: {
|
|
94
112
|
title: '<h2 data-testid="custom-title">Custom Title Content</h2>',
|
|
95
113
|
},
|
|
114
|
+
global: {
|
|
115
|
+
stubs: globalStubs,
|
|
116
|
+
},
|
|
96
117
|
});
|
|
97
118
|
|
|
98
119
|
expect(title().exists()).toBe(false);
|
|
@@ -113,6 +134,9 @@ describe('Drawer.vue', () => {
|
|
|
113
134
|
slots: {
|
|
114
135
|
title: '<div data-testid="custom-title">Slot Title</div>',
|
|
115
136
|
},
|
|
137
|
+
global: {
|
|
138
|
+
stubs: globalStubs,
|
|
139
|
+
},
|
|
116
140
|
});
|
|
117
141
|
|
|
118
142
|
expect(title().exists()).toBe(false);
|
|
@@ -164,7 +188,7 @@ describe('Drawer.vue', () => {
|
|
|
164
188
|
});
|
|
165
189
|
});
|
|
166
190
|
|
|
167
|
-
describe('Interactions
|
|
191
|
+
describe('Interactions', () => {
|
|
168
192
|
beforeEach(() => {
|
|
169
193
|
vi.useFakeTimers();
|
|
170
194
|
});
|
|
@@ -174,9 +198,6 @@ describe('Drawer.vue', () => {
|
|
|
174
198
|
|
|
175
199
|
it('should close the drawer when the close icon is clicked', async () => {
|
|
176
200
|
await closeIcon().trigger('click');
|
|
177
|
-
|
|
178
|
-
vi.advanceTimersByTime(200);
|
|
179
|
-
|
|
180
201
|
expect(wrapper.emitted('close')).toBeTruthy();
|
|
181
202
|
});
|
|
182
203
|
|
|
@@ -184,8 +205,6 @@ describe('Drawer.vue', () => {
|
|
|
184
205
|
await wrapper.setProps({ distinctCloseBack: true });
|
|
185
206
|
await closeIcon().trigger('click');
|
|
186
207
|
|
|
187
|
-
vi.advanceTimersByTime(200);
|
|
188
|
-
|
|
189
208
|
expect(wrapper.emitted('back')).toBeTruthy();
|
|
190
209
|
});
|
|
191
210
|
|
|
@@ -193,49 +212,21 @@ describe('Drawer.vue', () => {
|
|
|
193
212
|
await closeIcon().trigger('click');
|
|
194
213
|
expect(wrapper.emitted('back')).toBeUndefined();
|
|
195
214
|
});
|
|
196
|
-
|
|
197
|
-
it('should correctly handle transitions when closing the drawer', async () => {
|
|
198
|
-
await wrapper.vm.close();
|
|
199
|
-
expect(wrapper.vm.showDrawer).toBe(false);
|
|
200
|
-
|
|
201
|
-
setTimeout(() => {
|
|
202
|
-
expect(drawer().exists()).toBe(false);
|
|
203
|
-
}, 200);
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
it('should handle overlay clicks to close the drawer when withoutOverlay is false', async () => {
|
|
207
|
-
expect(overlay().exists()).toBe(true);
|
|
208
|
-
await overlay().trigger('click');
|
|
209
|
-
|
|
210
|
-
vi.advanceTimersByTime(200);
|
|
211
|
-
|
|
212
|
-
expect(wrapper.emitted('close')).toBeTruthy();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it('should execute the callback after 200ms timeout and reset showDrawer', async () => {
|
|
216
|
-
const callbackMock = vi.fn();
|
|
217
|
-
wrapper.vm.transitionClose(callbackMock);
|
|
218
|
-
|
|
219
|
-
expect(wrapper.vm.showDrawer).toBe(false);
|
|
220
|
-
|
|
221
|
-
vi.advanceTimersByTime(200);
|
|
222
|
-
|
|
223
|
-
expect(callbackMock).toHaveBeenCalled();
|
|
224
|
-
expect(wrapper.vm.showDrawer).toBe(true);
|
|
225
|
-
});
|
|
226
215
|
});
|
|
227
216
|
|
|
228
217
|
describe('Props and Computed Properties', () => {
|
|
229
218
|
it('should render the correct size class based on size prop', async () => {
|
|
230
219
|
await wrapper.setProps({ size: 'lg' });
|
|
231
|
-
expect(
|
|
220
|
+
expect(drawerContentComponent().props('class')).toContain(
|
|
232
221
|
'unnnic-drawer__container--lg',
|
|
233
222
|
);
|
|
223
|
+
expect(drawerContentComponent().props('size')).toBe('large');
|
|
234
224
|
|
|
235
225
|
await wrapper.setProps({ size: 'xl' });
|
|
236
|
-
expect(
|
|
226
|
+
expect(drawerContentComponent().props('class')).toContain(
|
|
237
227
|
'unnnic-drawer__container--xl',
|
|
238
228
|
);
|
|
229
|
+
expect(drawerContentComponent().props('size')).toBe('extra-large');
|
|
239
230
|
});
|
|
240
231
|
|
|
241
232
|
it('should display footer if either primaryButtonText or secondaryButtonText is provided', async () => {
|
|
@@ -275,7 +266,7 @@ describe('Drawer.vue', () => {
|
|
|
275
266
|
|
|
276
267
|
it('should use correct icon for close button based on closeIcon prop', async () => {
|
|
277
268
|
await wrapper.setProps({ closeIcon: 'custom_close_icon' });
|
|
278
|
-
expect(closeIcon().props('
|
|
269
|
+
expect(closeIcon().props('iconCenter')).toBe('custom_close_icon');
|
|
279
270
|
});
|
|
280
271
|
|
|
281
272
|
it('should validate all size prop values correctly', () => {
|