@weni/unnnic-system 3.12.6 → 3.12.7-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.
- package/README.md +9 -1
- package/dist/{es-e7dc92a2.mjs → es-95214495.mjs} +1 -1
- package/dist/{index-84ade580.mjs → index-edacc4d7.mjs} +99452 -96558
- package/dist/index.d.ts +5043 -1561
- package/dist/{pt-br-51fd679a.mjs → pt-br-fb80e803.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/tailwind.scss +8 -0
- package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
- package/src/components/ChartFunnel/DefaultFunnel/ChartDefaultFunnelBase.vue +2 -1
- package/src/components/ChartFunnel/SvgFunnel/ChartFunnelTwoRows.vue +61 -60
- package/src/components/Checkbox/Checkbox.vue +2 -8
- package/src/components/CheckboxGroup/CheckboxGroup.vue +5 -7
- package/src/components/Chip/Chip.vue +1 -1
- package/src/components/Drawer/Drawer.vue +180 -270
- package/src/components/Drawer/__tests__/Drawer.spec.js +32 -43
- package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
- package/src/components/FormElement/FormElement.vue +87 -96
- package/src/components/Input/Input.vue +2 -2
- package/src/components/ModalDialog/ModalDialog.vue +63 -154
- 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/Radio/Radio.vue +6 -12
- package/src/components/Radio/__test__/Radio.spec.js +1 -3
- package/src/components/RadioGroup/RadioGroup.vue +10 -18
- package/src/components/Switch/Switch.vue +3 -10
- package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
- package/src/components/TemplatePreview/TemplatePreview.vue +25 -28
- package/src/components/TemplatePreview/TemplatePreviewModal.vue +10 -10
- package/src/components/TemplatePreview/types.d.ts +3 -3
- package/src/components/Toast/Toast.vue +4 -1
- package/src/components/Toast/ToastManager.ts +4 -1
- package/src/components/Toast/__tests__/ToastManager.spec.js +10 -6
- package/src/components/ToolTip/ToolTip.vue +25 -177
- package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
- package/src/components/index.ts +60 -0
- 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 +31 -0
- package/src/components/ui/drawer/DrawerContent.vue +113 -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 +7 -3
- 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 +77 -0
- package/src/components/ui/tooltip/TooltipTrigger.vue +24 -0
- package/src/components/ui/tooltip/index.ts +3 -0
- package/src/index.ts +9 -2
- package/src/lib/__tests__/teleport-target.spec.ts +73 -0
- package/src/lib/layer-manager.ts +64 -0
- package/src/lib/teleport-target.ts +46 -0
- 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 +407 -0
- package/src/stories/ModalDialog.mdx +3 -0
- package/src/stories/ModalDialog.stories.js +1 -1
- package/src/stories/TemplatePreview.stories.js +27 -27
- package/src/stories/TemplatePreviewModal.stories.js +31 -31
- package/.vscode/extensions.json +0 -3
- package/CHANGELOG.md +0 -1074
package/src/components/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ import checkbox from './Checkbox/Checkbox.vue';
|
|
|
28
28
|
import checkboxGroup from './CheckboxGroup/CheckboxGroup.vue';
|
|
29
29
|
import collapse from './Collapse/Collapse.vue';
|
|
30
30
|
import radio from './Radio/Radio.vue';
|
|
31
|
+
import radioGroup from './RadioGroup/RadioGroup.vue';
|
|
31
32
|
import languageSelect from './Dropdown/LanguageSelect.vue';
|
|
32
33
|
import modal from './Modal/Modal.vue';
|
|
33
34
|
import modalUpload from './ModalUpload/ModalUpload.vue';
|
|
@@ -111,6 +112,20 @@ import {
|
|
|
111
112
|
SegmentedControlContent,
|
|
112
113
|
} from './ui/segmented-control';
|
|
113
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';
|
|
114
129
|
|
|
115
130
|
type VueComponent = Component;
|
|
116
131
|
|
|
@@ -148,6 +163,7 @@ export const components: ComponentsMap = {
|
|
|
148
163
|
unnnicCheckboxGroup: checkboxGroup,
|
|
149
164
|
unnnicCollapse: collapse,
|
|
150
165
|
unnnicRadio: radio,
|
|
166
|
+
unnnicRadioGroup: radioGroup,
|
|
151
167
|
unnnicLanguageSelect: languageSelect,
|
|
152
168
|
unnnicModal: modal,
|
|
153
169
|
unnnicModalNext: ModalNext,
|
|
@@ -230,6 +246,20 @@ export const components: ComponentsMap = {
|
|
|
230
246
|
unnnicSegmentedControlTrigger: SegmentedControlTrigger,
|
|
231
247
|
unnnicSegmentedControlContent: SegmentedControlContent,
|
|
232
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,
|
|
233
263
|
};
|
|
234
264
|
|
|
235
265
|
export const unnnicFontSize = fontSize;
|
|
@@ -262,6 +292,7 @@ export const unnnicCheckbox = checkbox;
|
|
|
262
292
|
export const unnnicCheckboxGroup = checkboxGroup;
|
|
263
293
|
export const unnnicCollapse = collapse;
|
|
264
294
|
export const unnnicRadio = radio;
|
|
295
|
+
export const unnnicRadioGroup = radioGroup;
|
|
265
296
|
export const unnniclanguageSelect = languageSelect as VueComponent;
|
|
266
297
|
export const unnnicModal = modal;
|
|
267
298
|
export const unnnicModalDialog = ModalDialog;
|
|
@@ -344,6 +375,20 @@ export const unnnicSegmentedControlList = SegmentedControlList;
|
|
|
344
375
|
export const unnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
345
376
|
export const unnnicSegmentedControlContent = SegmentedControlContent;
|
|
346
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;
|
|
347
392
|
|
|
348
393
|
export const UnnnicFontSize = fontSize;
|
|
349
394
|
export const UnnnicFormElement = formElement;
|
|
@@ -375,6 +420,7 @@ export const UnnnicCheckbox = checkbox;
|
|
|
375
420
|
export const UnnnicCheckboxGroup = checkboxGroup;
|
|
376
421
|
export const UnnnicCollapse = collapse;
|
|
377
422
|
export const UnnnicRadio = radio;
|
|
423
|
+
export const UnnnicRadioGroup = radioGroup;
|
|
378
424
|
export const UnnniclanguageSelect = languageSelect as VueComponent;
|
|
379
425
|
export const UnnnicModal = modal;
|
|
380
426
|
export const UnnnicModalDialog = ModalDialog;
|
|
@@ -457,3 +503,17 @@ export const UnnnicSegmentedControlList = SegmentedControlList;
|
|
|
457
503
|
export const UnnnicSegmentedControlTrigger = SegmentedControlTrigger;
|
|
458
504
|
export const UnnnicSegmentedControlContent = SegmentedControlContent;
|
|
459
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>
|