@weni/unnnic-system 3.13.0 → 3.14.0-alpha-teleports.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.
Files changed (88) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +9 -1
  3. package/dist/{es-41fceca9.mjs → es-0d53b5b2.mjs} +1 -1
  4. package/dist/{index-cca96b43.mjs → index-d7070de8.mjs} +29952 -27094
  5. package/dist/index.d.ts +5111 -1770
  6. package/dist/{pt-br-a3088529.mjs → pt-br-bf4e1f97.mjs} +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/unnnic.mjs +232 -204
  9. package/dist/unnnic.umd.js +48 -44
  10. package/package.json +3 -2
  11. package/src/assets/scss/tailwind.scss +8 -0
  12. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  13. package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +2 -1
  14. package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +61 -60
  15. package/src/components/Checkbox/Checkbox.vue +1 -1
  16. package/src/components/CheckboxGroup/CheckboxGroup.vue +5 -7
  17. package/src/components/Chip/Chip.vue +1 -1
  18. package/src/components/DatePicker/DatePicker.vue +10 -1
  19. package/src/components/Drawer/Drawer.vue +180 -270
  20. package/src/components/Drawer/__tests__/Drawer.spec.js +32 -43
  21. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
  22. package/src/components/FormElement/FormElement.vue +87 -96
  23. package/src/components/InputDatePicker/InputDatePicker.vue +68 -73
  24. package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +31 -24
  25. package/src/components/ModalDialog/ModalDialog.vue +63 -154
  26. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +30 -210
  27. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  28. package/src/components/MultiSelect/MultSelectOption.vue +49 -0
  29. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +557 -0
  30. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +229 -0
  31. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +87 -0
  32. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  33. package/src/components/MultiSelect/index.vue +265 -0
  34. package/src/components/Radio/Radio.vue +6 -12
  35. package/src/components/Radio/__test__/Radio.spec.js +1 -3
  36. package/src/components/RadioGroup/RadioGroup.vue +10 -18
  37. package/src/components/Select/__tests__/SelectItem.spec.js +15 -35
  38. package/src/components/Select/index.vue +3 -3
  39. package/src/components/Switch/Switch.vue +3 -10
  40. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  41. package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
  42. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  43. package/src/components/TemplatePreview/types.d.ts +3 -3
  44. package/src/components/Toast/Toast.vue +4 -1
  45. package/src/components/Toast/ToastManager.ts +4 -1
  46. package/src/components/Toast/__tests__/ToastManager.spec.js +10 -6
  47. package/src/components/ToolTip/ToolTip.vue +25 -177
  48. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  49. package/src/components/index.ts +58 -2
  50. package/src/components/ui/dialog/Dialog.vue +19 -0
  51. package/src/components/ui/dialog/DialogClose.vue +29 -0
  52. package/src/components/ui/dialog/DialogContent.vue +140 -0
  53. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  54. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  55. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  56. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  57. package/src/components/ui/dialog/index.ts +7 -0
  58. package/src/components/ui/drawer/Drawer.vue +27 -0
  59. package/src/components/ui/drawer/DrawerClose.vue +31 -0
  60. package/src/components/ui/drawer/DrawerContent.vue +113 -0
  61. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  62. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  63. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  64. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  65. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  66. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  67. package/src/components/ui/drawer/index.ts +10 -0
  68. package/src/components/ui/popover/PopoverContent.vue +7 -4
  69. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  70. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  71. package/src/components/ui/tooltip/TooltipContent.vue +77 -0
  72. package/src/components/ui/tooltip/TooltipTrigger.vue +24 -0
  73. package/src/components/ui/tooltip/index.ts +3 -0
  74. package/src/index.ts +9 -2
  75. package/src/lib/__tests__/teleport-target.spec.ts +73 -0
  76. package/src/lib/layer-manager.ts +64 -0
  77. package/src/lib/teleport-target.ts +46 -0
  78. package/src/stories/Dialog.stories.js +832 -0
  79. package/src/stories/Drawer.stories.js +1 -1
  80. package/src/stories/DrawerNext.stories.js +611 -0
  81. package/src/stories/LayerManager.docs.mdx +40 -0
  82. package/src/stories/LayerManager.stories.js +407 -0
  83. package/src/stories/ModalDialog.mdx +3 -0
  84. package/src/stories/ModalDialog.stories.js +96 -1
  85. package/src/stories/MultiSelect.stories.js +143 -45
  86. package/src/stories/TemplatePreview.stories.js +27 -27
  87. package/src/stories/TemplatePreviewModal.stories.js +31 -31
  88. package/src/components/MultiSelect/MultiSelect.vue +0 -297
@@ -37,7 +37,7 @@ import selectSmart from './SelectSmart/SelectSmart.vue';
37
37
  import select from './Select/index.vue';
38
38
  import selectItem from './Select/SelectItem.vue';
39
39
  // import selectListItem from './SelectListItem/SelectListItem.vue';
40
- import multiSelect from './MultiSelect/MultiSelect.vue';
40
+ import multiSelect from './MultiSelect/index.vue';
41
41
  import alert from './Alert/Alert.vue';
42
42
  // import autocomplete from './Input/Autocomplete.vue';
43
43
  // import autocompleteSelect from './AutocompleteSelect/AutocompleteSelect.vue';
@@ -112,6 +112,20 @@ import {
112
112
  SegmentedControlContent,
113
113
  } from './ui/segmented-control';
114
114
  import PageHeader from './PageHeader/PageHeader.vue';
115
+ import Dialog from './ui/dialog/Dialog.vue';
116
+ import DialogContent from './ui/dialog/DialogContent.vue';
117
+ import DialogFooter from './ui/dialog/DialogFooter.vue';
118
+ import DialogHeader from './ui/dialog/DialogHeader.vue';
119
+ import DialogTitle from './ui/dialog/DialogTitle.vue';
120
+ import DialogTrigger from './ui/dialog/DialogTrigger.vue';
121
+ import DialogClose from './ui/dialog/DialogClose.vue';
122
+ import DrawerNext from './ui/drawer/Drawer.vue';
123
+ import DrawerContent from './ui/drawer/DrawerContent.vue';
124
+ import DrawerHeader from './ui/drawer/DrawerHeader.vue';
125
+ import DrawerFooter from './ui/drawer/DrawerFooter.vue';
126
+ import DrawerClose from './ui/drawer/DrawerClose.vue';
127
+ import DrawerTitle from './ui/drawer/DrawerTitle.vue';
128
+ import DrawerDescription from './ui/drawer/DrawerDescription.vue';
115
129
 
116
130
  type VueComponent = Component;
117
131
 
@@ -159,7 +173,7 @@ export const components: ComponentsMap = {
159
173
  unnnicSelect: select,
160
174
  unnnicSelectItem: selectItem,
161
175
  // unnnicSelectListItem: selectListItem,
162
- unnnicMultiSelect: multiSelect,
176
+ unnnicMultiSelect: multiSelect as VueComponent,
163
177
  unnnicAlert: alert,
164
178
  unnnicCallAlert: callAlert,
165
179
  unnnicCallModal: callModal,
@@ -232,6 +246,20 @@ export const components: ComponentsMap = {
232
246
  unnnicSegmentedControlTrigger: SegmentedControlTrigger,
233
247
  unnnicSegmentedControlContent: SegmentedControlContent,
234
248
  unnnicPageHeader: PageHeader,
249
+ unnnicDialog: Dialog,
250
+ unnnicDialogContent: DialogContent,
251
+ unnnicDialogFooter: DialogFooter,
252
+ unnnicDialogHeader: DialogHeader,
253
+ unnnicDialogTitle: DialogTitle,
254
+ unnnicDialogTrigger: DialogTrigger,
255
+ unnnicDialogClose: DialogClose,
256
+ unnnicDrawerNext: DrawerNext,
257
+ unnnicDrawerContent: DrawerContent,
258
+ unnnicDrawerHeader: DrawerHeader,
259
+ unnnicDrawerFooter: DrawerFooter,
260
+ unnnicDrawerClose: DrawerClose,
261
+ unnnicDrawerTitle: DrawerTitle,
262
+ unnnicDrawerDescription: DrawerDescription,
235
263
  };
236
264
 
237
265
  export const unnnicFontSize = fontSize;
@@ -347,6 +375,20 @@ export const unnnicSegmentedControlList = SegmentedControlList;
347
375
  export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
348
376
  export const unnnicSegmentedControlContent = SegmentedControlContent;
349
377
  export const unnnicPageHeader = PageHeader;
378
+ export const unnnicDialog = Dialog;
379
+ export const unnnicDialogContent = DialogContent;
380
+ export const unnnicDialogFooter = DialogFooter;
381
+ export const unnnicDialogHeader = DialogHeader;
382
+ export const unnnicDialogTitle = DialogTitle;
383
+ export const unnnicDialogTrigger = DialogTrigger;
384
+ export const unnnicDialogClose = DialogClose;
385
+ export const unnnicDrawerNext = DrawerNext;
386
+ export const unnnicDrawerContent = DrawerContent;
387
+ export const unnnicDrawerHeader = DrawerHeader;
388
+ export const unnnicDrawerFooter = DrawerFooter;
389
+ export const unnnicDrawerClose = DrawerClose;
390
+ export const unnnicDrawerTitle = DrawerTitle;
391
+ export const unnnicDrawerDescription = DrawerDescription;
350
392
 
351
393
  export const UnnnicFontSize = fontSize;
352
394
  export const UnnnicFormElement = formElement;
@@ -461,3 +503,17 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
461
503
  export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
462
504
  export const UnnnicSegmentedControlContent = SegmentedControlContent;
463
505
  export const UnnnicPageHeader = PageHeader;
506
+ export const UnnnicDialog = Dialog;
507
+ export const UnnnicDialogContent = DialogContent;
508
+ export const UnnnicDialogFooter = DialogFooter;
509
+ export const UnnnicDialogHeader = DialogHeader;
510
+ export const UnnnicDialogTitle = DialogTitle;
511
+ export const UnnnicDialogTrigger = DialogTrigger;
512
+ export const UnnnicDialogClose = DialogClose;
513
+ export const UnnnicDrawerNext = DrawerNext;
514
+ export const UnnnicDrawerContent = DrawerContent;
515
+ export const UnnnicDrawerHeader = DrawerHeader;
516
+ export const UnnnicDrawerFooter = DrawerFooter;
517
+ export const UnnnicDrawerClose = DrawerClose;
518
+ export const UnnnicDrawerTitle = DrawerTitle;
519
+ export const UnnnicDrawerDescription = DrawerDescription;
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
3
+ import { DialogRoot, useForwardPropsEmits } from 'reka-ui';
4
+
5
+ defineOptions({
6
+ name: 'UnnnicDialog',
7
+ });
8
+
9
+ const props = defineProps<DialogRootProps>();
10
+ const emits = defineEmits<DialogRootEmits>();
11
+
12
+ const forwarded = useForwardPropsEmits(props, emits);
13
+ </script>
14
+
15
+ <template>
16
+ <DialogRoot v-bind="forwarded">
17
+ <slot />
18
+ </DialogRoot>
19
+ </template>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import type { DialogCloseProps } from 'reka-ui';
3
+ import { DialogClose } from 'reka-ui';
4
+
5
+ defineOptions({
6
+ name: 'UnnnicDialogClose',
7
+ });
8
+
9
+ const props = withDefaults(defineProps<DialogCloseProps>(), {
10
+ asChild: true,
11
+ });
12
+ </script>
13
+
14
+ <template>
15
+ <DialogClose
16
+ class="unnnic-dialog-close"
17
+ v-bind="props"
18
+ >
19
+ <slot />
20
+ </DialogClose>
21
+ </template>
22
+
23
+ <style lang="scss" scoped>
24
+ .unnnic-dialog-close {
25
+ > * {
26
+ width: 100%;
27
+ }
28
+ }
29
+ </style>
@@ -0,0 +1,140 @@
1
+ <script setup lang="ts">
2
+ import type { DialogContentEmits, DialogContentProps } from 'reka-ui';
3
+ import type { HTMLAttributes, Component } from 'vue';
4
+ import { computed, h } from 'vue';
5
+ import { reactiveOmit } from '@vueuse/core';
6
+ import {
7
+ DialogContent,
8
+ DialogOverlay,
9
+ DialogPortal,
10
+ useForwardPropsEmits,
11
+ } from 'reka-ui';
12
+ import { cn } from '@/lib/utils';
13
+ import { useLayerZIndex } from '@/lib/layer-manager';
14
+ import { useTeleportTarget } from '@/lib/teleport-target';
15
+
16
+ defineOptions({
17
+ name: 'UnnnicDialogContent',
18
+ });
19
+
20
+ const props = withDefaults(
21
+ defineProps<
22
+ DialogContentProps & {
23
+ parentClass?: HTMLAttributes['class'];
24
+ class?: HTMLAttributes['class'];
25
+ size?: 'small' | 'medium' | 'large';
26
+ }
27
+ >(),
28
+ {
29
+ size: 'medium',
30
+ parentClass: '', // This class should be temporary, to be discontinued with the ModalDialog component
31
+ class: '',
32
+ },
33
+ );
34
+ const emits = defineEmits<DialogContentEmits>();
35
+
36
+ const delegatedProps = reactiveOmit(props, 'class', 'parentClass');
37
+
38
+ const forwarded = useForwardPropsEmits(delegatedProps, emits);
39
+
40
+ const overlayZIndex = useLayerZIndex({ offset: -2 });
41
+ const modalZIndex = useLayerZIndex();
42
+ const portalTarget = useTeleportTarget();
43
+
44
+ const contentClasses = computed(() =>
45
+ cn(
46
+ 'unnnic-dialog-content',
47
+ `unnnic-dialog-content--size-${props.size}`,
48
+ 'duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]',
49
+ props.class,
50
+ ),
51
+ );
52
+
53
+ // This component is used to wrap the DialogContent component in a section if the parentClass is provided
54
+ // This is a temporary solution, to be discontinued with the ModalDialog component
55
+ const ConditionalWrapper: Component = (_, { slots }) => {
56
+ const content = slots.default?.();
57
+ return props.parentClass
58
+ ? h('section', { class: props.parentClass }, content)
59
+ : content;
60
+ };
61
+ </script>
62
+
63
+ <template>
64
+ <DialogPortal :to="portalTarget">
65
+ <DialogOverlay
66
+ class="unnnic-dialog-overlay data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
67
+ :style="{ zIndex: overlayZIndex }"
68
+ />
69
+
70
+ <ConditionalWrapper>
71
+ <DialogContent
72
+ v-bind="forwarded"
73
+ :class="contentClasses"
74
+ :style="{ zIndex: modalZIndex }"
75
+ >
76
+ <slot />
77
+ </DialogContent>
78
+ </ConditionalWrapper>
79
+ </DialogPortal>
80
+ </template>
81
+
82
+ <style lang="scss" scoped>
83
+ @use '@/assets/scss/unnnic' as *;
84
+
85
+ .unnnic-dialog-overlay {
86
+ position: fixed;
87
+ top: 0;
88
+ left: 0;
89
+
90
+ width: 100vw;
91
+ height: 100vh;
92
+ background: rgba(53, 57, 69, 0.5);
93
+ }
94
+
95
+ .unnnic-dialog-content {
96
+ position: fixed;
97
+ top: 50%;
98
+ left: 50%;
99
+
100
+ transform: translate(-50%, -50%);
101
+
102
+ width: 100%;
103
+ max-height: calc(100% - $unnnic-space-20);
104
+
105
+ display: flex;
106
+ flex-direction: column;
107
+
108
+ box-shadow: $unnnic-shadow-2;
109
+ border-radius: $unnnic-radius-4;
110
+ background-color: $unnnic-color-bg-base;
111
+
112
+ &--size-small {
113
+ max-width: 360px;
114
+ }
115
+
116
+ &--size-medium {
117
+ max-width: 560px;
118
+ }
119
+
120
+ &--size-large {
121
+ max-width: 800px;
122
+ }
123
+
124
+ > * {
125
+ &::-webkit-scrollbar {
126
+ width: $unnnic-spacing-inline-nano;
127
+ }
128
+
129
+ &::-webkit-scrollbar-thumb {
130
+ background: $unnnic-color-neutral-cleanest;
131
+ border-radius: $unnnic-border-radius-pill;
132
+ }
133
+
134
+ &::-webkit-scrollbar-track {
135
+ background: $unnnic-color-neutral-soft;
136
+ border-radius: $unnnic-border-radius-pill;
137
+ }
138
+ }
139
+ }
140
+ </style>
@@ -0,0 +1,50 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { cn } from '@/lib/utils';
4
+
5
+ defineOptions({
6
+ name: 'UnnnicDialogFooter',
7
+ });
8
+
9
+ const props = withDefaults(
10
+ defineProps<{ class?: HTMLAttributes['class']; divider?: boolean }>(),
11
+ {
12
+ divider: true,
13
+ },
14
+ );
15
+ </script>
16
+
17
+ <template>
18
+ <footer
19
+ :class="
20
+ cn(
21
+ 'unnnic-dialog-footer',
22
+ { 'unnnic-dialog-footer--with-divider': props.divider },
23
+ props.class,
24
+ )
25
+ "
26
+ >
27
+ <slot />
28
+ </footer>
29
+ </template>
30
+
31
+ <style lang="scss" scoped>
32
+ @use '@/assets/scss/unnnic' as *;
33
+
34
+ .unnnic-dialog-footer {
35
+ display: flex;
36
+ justify-content: center;
37
+ align-items: center;
38
+ gap: $unnnic-space-2;
39
+
40
+ padding: $unnnic-space-6;
41
+
42
+ &--with-divider {
43
+ border-top: 1px solid $unnnic-color-border-soft;
44
+ }
45
+
46
+ > * {
47
+ width: 100%;
48
+ }
49
+ }
50
+ </style>
@@ -0,0 +1,83 @@
1
+ <script setup lang="ts">
2
+ import type { HTMLAttributes } from 'vue';
3
+ import { cn } from '@/lib/utils';
4
+ import UnnnicButton from '@/components/Button/Button.vue';
5
+ import DialogClose from './DialogClose.vue';
6
+ import UnnnicIcon, { SchemeColor } from '@/components/Icon.vue';
7
+
8
+ defineOptions({
9
+ name: 'UnnnicDialogHeader',
10
+ });
11
+
12
+ const props = withDefaults(
13
+ defineProps<{
14
+ class?: HTMLAttributes['class'];
15
+ divider?: boolean;
16
+ type?: 'default' | 'success' | 'warning' | 'attention';
17
+ closeButton?: boolean;
18
+ }>(),
19
+ {
20
+ divider: true,
21
+ closeButton: true,
22
+ type: 'default',
23
+ },
24
+ );
25
+
26
+ const iconsMapper = {
27
+ default: { icon: '', scheme: '' as SchemeColor },
28
+ success: { icon: 'check_circle', scheme: 'aux-green-500' as SchemeColor },
29
+ warning: { icon: 'warning', scheme: 'aux-red-500' as SchemeColor },
30
+ attention: { icon: 'error', scheme: 'aux-yellow-500' as SchemeColor },
31
+ };
32
+ </script>
33
+
34
+ <template>
35
+ <header
36
+ :class="
37
+ cn(
38
+ 'unnnic-dialog-header',
39
+ { 'unnnic-dialog-header--with-divider': props.divider },
40
+ props.class,
41
+ )
42
+ "
43
+ >
44
+ <UnnnicIcon
45
+ v-if="iconsMapper[props.type]?.icon"
46
+ :icon="iconsMapper[props.type]?.icon"
47
+ :scheme="iconsMapper[props.type]?.scheme"
48
+ size="md"
49
+ />
50
+ <slot />
51
+
52
+ <DialogClose
53
+ v-if="props.closeButton"
54
+ class="unnnic-dialog-header__close"
55
+ >
56
+ <UnnnicButton
57
+ type="tertiary"
58
+ iconCenter="close"
59
+ size="small"
60
+ />
61
+ </DialogClose>
62
+ </header>
63
+ </template>
64
+
65
+ <style lang="scss" scoped>
66
+ @use '@/assets/scss/unnnic' as *;
67
+
68
+ .unnnic-dialog-header {
69
+ display: flex;
70
+ align-items: center;
71
+ gap: $unnnic-space-2;
72
+
73
+ padding: $unnnic-space-6;
74
+
75
+ &--with-divider {
76
+ border-bottom: 1px solid $unnnic-color-border-soft;
77
+ }
78
+
79
+ &__close {
80
+ margin-left: auto;
81
+ }
82
+ }
83
+ </style>
@@ -0,0 +1,38 @@
1
+ <script setup lang="ts">
2
+ import type { DialogTitleProps } from 'reka-ui';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DialogTitle, useForwardProps } from 'reka-ui';
6
+ import { cn } from '@/lib/utils';
7
+
8
+ defineOptions({
9
+ name: 'UnnnicDialogTitle',
10
+ });
11
+
12
+ const props = defineProps<
13
+ DialogTitleProps & { class?: HTMLAttributes['class'] }
14
+ >();
15
+
16
+ const delegatedProps = reactiveOmit(props, 'class');
17
+
18
+ const forwardedProps = useForwardProps(delegatedProps);
19
+ </script>
20
+
21
+ <template>
22
+ <DialogTitle
23
+ v-bind="forwardedProps"
24
+ :class="cn('unnnic-dialog-title', props.class)"
25
+ >
26
+ <slot />
27
+ </DialogTitle>
28
+ </template>
29
+
30
+ <style lang="scss" scoped>
31
+ @use '@/assets/scss/unnnic' as *;
32
+
33
+ .unnnic-dialog-title {
34
+ font: $unnnic-font-display-2;
35
+ color: $unnnic-color-fg-emphasized;
36
+ margin: 0;
37
+ }
38
+ </style>
@@ -0,0 +1,16 @@
1
+ <script setup lang="ts">
2
+ import type { DialogTriggerProps } from 'reka-ui';
3
+ import { DialogTrigger } from 'reka-ui';
4
+
5
+ defineOptions({
6
+ name: 'UnnnicDialogTrigger',
7
+ });
8
+
9
+ const props = defineProps<DialogTriggerProps>();
10
+ </script>
11
+
12
+ <template>
13
+ <DialogTrigger v-bind="props">
14
+ <slot />
15
+ </DialogTrigger>
16
+ </template>
@@ -0,0 +1,7 @@
1
+ export { default as Dialog } from './Dialog.vue';
2
+ export { default as DialogClose } from './DialogClose.vue';
3
+ export { default as DialogContent } from './DialogContent.vue';
4
+ export { default as DialogFooter } from './DialogFooter.vue';
5
+ export { default as DialogHeader } from './DialogHeader.vue';
6
+ export { default as DialogTitle } from './DialogTitle.vue';
7
+ export { default as DialogTrigger } from './DialogTrigger.vue';
@@ -0,0 +1,27 @@
1
+ <script lang="ts" setup>
2
+ import type { DrawerRootEmits, DrawerRootProps } from 'vaul-vue';
3
+ import { useForwardPropsEmits } from 'reka-ui';
4
+ import { DrawerRoot } from 'vaul-vue';
5
+
6
+ defineOptions({
7
+ name: 'UnnnicDrawerNext',
8
+ });
9
+
10
+ const props = withDefaults(defineProps<DrawerRootProps>(), {
11
+ shouldScaleBackground: true,
12
+ });
13
+
14
+ const emits = defineEmits<DrawerRootEmits>();
15
+
16
+ const forwarded = useForwardPropsEmits(props, emits);
17
+ </script>
18
+
19
+ <template>
20
+ <DrawerRoot
21
+ v-bind="forwarded"
22
+ direction="right"
23
+ handleOnly
24
+ >
25
+ <slot />
26
+ </DrawerRoot>
27
+ </template>
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ import type { DrawerCloseProps } from 'vaul-vue';
3
+ import { DrawerClose } from 'vaul-vue';
4
+
5
+ defineOptions({
6
+ name: 'UnnnicDrawerClose',
7
+ });
8
+
9
+ const props = withDefaults(defineProps<DrawerCloseProps>(), {
10
+ asChild: true,
11
+ });
12
+ </script>
13
+
14
+ <template>
15
+ <DrawerClose
16
+ v-bind="props"
17
+ class="unnnic-drawer__close"
18
+ >
19
+ <slot />
20
+ </DrawerClose>
21
+ </template>
22
+
23
+ <style lang="scss" scoped>
24
+ @use '@/assets/scss/unnnic' as *;
25
+
26
+ .unnnic-drawer__close {
27
+ > * {
28
+ width: 100%;
29
+ }
30
+ }
31
+ </style>
@@ -0,0 +1,113 @@
1
+ <script lang="ts" setup>
2
+ import type { DialogContentEmits, DialogContentProps } from 'reka-ui';
3
+ import { type HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { useForwardPropsEmits } from 'reka-ui';
6
+ import { DrawerContent, DrawerPortal } from 'vaul-vue';
7
+ import { cn } from '@/lib/utils';
8
+ import { useLayerZIndex } from '@/lib/layer-manager';
9
+ import { useTeleportTarget } from '@/lib/teleport-target';
10
+ import DrawerOverlay from './DrawerOverlay.vue';
11
+
12
+ defineOptions({
13
+ name: 'UnnnicDrawerContent',
14
+ });
15
+
16
+ const props = withDefaults(
17
+ defineProps<
18
+ DialogContentProps & {
19
+ class?: HTMLAttributes['class'];
20
+ size?: 'medium' | 'large' | 'extra-large' | 'giant';
21
+ showOverlay?: boolean;
22
+ }
23
+ >(),
24
+ {
25
+ class: undefined,
26
+ size: 'medium',
27
+ showOverlay: true,
28
+ },
29
+ );
30
+ const emits = defineEmits<DialogContentEmits>();
31
+
32
+ const delegatedProps = reactiveOmit(props, 'class');
33
+ const forwardedProps = useForwardPropsEmits(delegatedProps, emits);
34
+
35
+ const layerZIndex = useLayerZIndex();
36
+ const portalTarget = useTeleportTarget();
37
+ </script>
38
+
39
+ <template>
40
+ <DrawerPortal :to="portalTarget">
41
+ <DrawerOverlay
42
+ v-if="showOverlay"
43
+ :style="{ zIndex: layerZIndex - 2 }"
44
+ />
45
+ <DrawerContent
46
+ v-bind="forwardedProps"
47
+ :class="
48
+ cn(
49
+ 'unnnic-drawer__content',
50
+ `unnnic-drawer__content--${props.size}`,
51
+ props.class,
52
+ )
53
+ "
54
+ :style="{
55
+ '--initial-transform': 'calc(100% + 8px)',
56
+ zIndex: layerZIndex,
57
+ }"
58
+ >
59
+ <slot />
60
+ </DrawerContent>
61
+ </DrawerPortal>
62
+ </template>
63
+
64
+ <style lang="scss" scoped>
65
+ @use '@/assets/scss/unnnic' as *;
66
+
67
+ $drawer-space: $unnnic-space-2;
68
+
69
+ .unnnic-drawer__content {
70
+ -webkit-user-select: unset;
71
+ user-select: unset;
72
+ will-change: unset;
73
+
74
+ &::after {
75
+ display: none;
76
+ }
77
+
78
+ position: fixed;
79
+ top: $drawer-space;
80
+ right: $drawer-space;
81
+
82
+ display: flex;
83
+ flex-direction: column;
84
+
85
+ height: calc(100% - $drawer-space * 2);
86
+
87
+ border-radius: $unnnic-radius-4;
88
+ border: 1px solid $unnnic-color-border-soft;
89
+ background-color: $unnnic-color-bg-base;
90
+
91
+ &--medium {
92
+ width: calc(100% / 3);
93
+ }
94
+
95
+ &--large {
96
+ width: 50%;
97
+ }
98
+
99
+ &--extra-large {
100
+ width: 66%;
101
+ }
102
+
103
+ &--giant {
104
+ width: 75%;
105
+ }
106
+
107
+ &__body {
108
+ overflow-y: auto;
109
+ padding: $unnnic-space-6;
110
+ flex: 1 0 0;
111
+ }
112
+ }
113
+ </style>
@@ -0,0 +1,40 @@
1
+ <script lang="ts" setup>
2
+ import type { DrawerDescriptionProps } from 'vaul-vue';
3
+ import type { HTMLAttributes } from 'vue';
4
+ import { reactiveOmit } from '@vueuse/core';
5
+ import { DrawerDescription } from 'vaul-vue';
6
+ import { cn } from '@/lib/utils';
7
+
8
+ defineOptions({
9
+ name: 'UnnnicDrawerDescription',
10
+ });
11
+
12
+ const props = defineProps<
13
+ DrawerDescriptionProps & { class?: HTMLAttributes['class'] }
14
+ >();
15
+
16
+ const delegatedProps = reactiveOmit(props, 'class');
17
+ </script>
18
+
19
+ <template>
20
+ <DrawerDescription
21
+ v-bind="delegatedProps"
22
+ :class="cn('unnnic-drawer__description', props.class)"
23
+ >
24
+ <slot />
25
+ </DrawerDescription>
26
+ </template>
27
+
28
+ <style lang="scss" scoped>
29
+ @use '@/assets/scss/unnnic' as *;
30
+
31
+ .unnnic-drawer__description {
32
+ margin: 0;
33
+
34
+ font: $unnnic-font-body;
35
+ color: $unnnic-color-fg-base;
36
+
37
+ grid-column: 1 / 3;
38
+ grid-row: 2 / 3;
39
+ }
40
+ </style>