@weni/unnnic-system 3.12.8 → 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 (107) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +9 -1
  3. package/dist/{es-62c1e8d3.mjs → es-0d53b5b2.mjs} +1 -1
  4. package/dist/{index-ef197fd5.mjs → index-d7070de8.mjs} +99880 -96723
  5. package/dist/index.d.ts +5588 -1607
  6. package/dist/{pt-br-198b147b.mjs → pt-br-bf4e1f97.mjs} +1 -1
  7. package/dist/style.css +1 -1
  8. package/dist/unnnic.mjs +233 -203
  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/Input/BaseInput.vue +25 -5
  24. package/src/components/Input/Input.scss +2 -1
  25. package/src/components/Input/Input.vue +24 -1
  26. package/src/components/Input/TextInput.vue +64 -25
  27. package/src/components/Input/__test__/TextInput.spec.js +1 -1
  28. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
  29. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  30. package/src/components/InputDatePicker/InputDatePicker.vue +68 -73
  31. package/src/components/InputDatePicker/__test__/InputDatePicker.spec.js +31 -24
  32. package/src/components/ModalDialog/ModalDialog.vue +63 -154
  33. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +30 -210
  34. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  35. package/src/components/MultiSelect/MultSelectOption.vue +49 -0
  36. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +557 -0
  37. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +229 -0
  38. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +87 -0
  39. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  40. package/src/components/MultiSelect/index.vue +265 -0
  41. package/src/components/Radio/Radio.vue +6 -12
  42. package/src/components/Radio/__test__/Radio.spec.js +1 -3
  43. package/src/components/RadioGroup/RadioGroup.vue +10 -18
  44. package/src/components/Select/__tests__/Select.spec.js +422 -0
  45. package/src/components/Select/__tests__/SelectItem.spec.js +310 -0
  46. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  47. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +71 -0
  48. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  49. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  50. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
  51. package/src/components/Select/index.vue +308 -0
  52. package/src/components/Switch/Switch.vue +3 -10
  53. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  54. package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
  55. package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
  56. package/src/components/TemplatePreview/types.d.ts +3 -3
  57. package/src/components/Toast/Toast.vue +4 -1
  58. package/src/components/Toast/ToastManager.ts +4 -1
  59. package/src/components/Toast/__tests__/ToastManager.spec.js +10 -6
  60. package/src/components/ToolTip/ToolTip.vue +25 -177
  61. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  62. package/src/components/index.ts +62 -6
  63. package/src/components/ui/dialog/Dialog.vue +19 -0
  64. package/src/components/ui/dialog/DialogClose.vue +29 -0
  65. package/src/components/ui/dialog/DialogContent.vue +140 -0
  66. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  67. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  68. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  69. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  70. package/src/components/ui/dialog/index.ts +7 -0
  71. package/src/components/ui/drawer/Drawer.vue +27 -0
  72. package/src/components/ui/drawer/DrawerClose.vue +31 -0
  73. package/src/components/ui/drawer/DrawerContent.vue +113 -0
  74. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  75. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  76. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  77. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  78. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  79. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  80. package/src/components/ui/drawer/index.ts +10 -0
  81. package/src/components/ui/popover/PopoverContent.vue +7 -4
  82. package/src/components/ui/popover/PopoverOption.vue +4 -0
  83. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  84. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  85. package/src/components/ui/tooltip/TooltipContent.vue +77 -0
  86. package/src/components/ui/tooltip/TooltipTrigger.vue +24 -0
  87. package/src/components/ui/tooltip/index.ts +3 -0
  88. package/src/index.ts +9 -2
  89. package/src/lib/__tests__/teleport-target.spec.ts +73 -0
  90. package/src/lib/layer-manager.ts +64 -0
  91. package/src/lib/teleport-target.ts +46 -0
  92. package/src/locales/en.json +3 -1
  93. package/src/locales/es.json +3 -1
  94. package/src/locales/pt_br.json +3 -1
  95. package/src/stories/Dialog.stories.js +832 -0
  96. package/src/stories/Drawer.stories.js +1 -1
  97. package/src/stories/DrawerNext.stories.js +611 -0
  98. package/src/stories/Input.mdx +3 -0
  99. package/src/stories/LayerManager.docs.mdx +40 -0
  100. package/src/stories/LayerManager.stories.js +407 -0
  101. package/src/stories/ModalDialog.mdx +3 -0
  102. package/src/stories/ModalDialog.stories.js +96 -1
  103. package/src/stories/MultiSelect.stories.js +143 -45
  104. package/src/stories/Select.stories.js +161 -0
  105. package/src/stories/TemplatePreview.stories.js +27 -27
  106. package/src/stories/TemplatePreviewModal.stories.js +31 -31
  107. package/src/components/MultiSelect/MultiSelect.vue +0 -297
@@ -34,10 +34,10 @@ import modal from './Modal/Modal.vue';
34
34
  import modalUpload from './ModalUpload/ModalUpload.vue';
35
35
  import { callAlert, callModal } from '../utils/call';
36
36
  import selectSmart from './SelectSmart/SelectSmart.vue';
37
- // import select from './Select/Select.vue';
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
 
@@ -156,10 +170,10 @@ export const components: ComponentsMap = {
156
170
  unnnicModalDialog: ModalDialog,
157
171
  unnnicModalUpload: modalUpload,
158
172
  unnnicSelectSmart: selectSmart,
159
- // unnnicSelect: select,
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;
@@ -271,7 +299,7 @@ export const unnnicModalDialog = ModalDialog;
271
299
  export const unnnicModalNext = ModalNext;
272
300
  export const unnnicModalUpload = modalUpload;
273
301
  export const unnnicSelectSmart = selectSmart as VueComponent;
274
- // export const unnnicSelect = select;
302
+ export const unnnicSelect = select as VueComponent;
275
303
  export const unnnicSelectItem = selectItem;
276
304
  // export const unnnicSelectListItem = selectListItem;
277
305
  export const unnnicMultiSelect = multiSelect as VueComponent;
@@ -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;
@@ -385,7 +427,7 @@ export const UnnnicModalDialog = ModalDialog;
385
427
  export const UnnnicModalNext = ModalNext;
386
428
  export const UnnnicModalUpload = modalUpload;
387
429
  export const UnnnicSelectSmart = selectSmart as VueComponent;
388
- // export const UnnnicSelect = select;
430
+ export const UnnnicSelect = select as VueComponent;
389
431
  export const UnnnicSelectItem = selectItem;
390
432
  // export const UnnnicSelectListItem = selectListItem;
391
433
  export const UnnnicMultiSelect = multiSelect as VueComponent;
@@ -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>