@weni/unnnic-system 3.12.8-alpha.0 → 3.12.8

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 (90) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{es-52edeb71.mjs → es-62c1e8d3.mjs} +1 -1
  3. package/dist/{index-756fe685.mjs → index-ef197fd5.mjs} +52261 -55425
  4. package/dist/index.d.ts +1449 -5339
  5. package/dist/{pt-br-24583c8c.mjs → pt-br-198b147b.mjs} +1 -1
  6. package/dist/style.css +1 -1
  7. package/dist/unnnic.mjs +203 -233
  8. package/dist/unnnic.umd.js +44 -48
  9. package/package.json +2 -3
  10. package/src/assets/scss/scheme-colors.scss +223 -223
  11. package/src/assets/scss/tailwind.scss +0 -8
  12. package/src/components/Alert/__tests__/__snapshots__/Alert.spec.js.snap +1 -1
  13. package/src/components/Checkbox/Checkbox.vue +1 -1
  14. package/src/components/Drawer/Drawer.vue +269 -190
  15. package/src/components/Drawer/__tests__/Drawer.spec.js +46 -37
  16. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +19 -18
  17. package/src/components/FormElement/FormElement.vue +1 -1
  18. package/src/components/Input/BaseInput.vue +5 -25
  19. package/src/components/Input/Input.scss +3 -2
  20. package/src/components/Input/Input.vue +1 -24
  21. package/src/components/Input/TextInput.vue +25 -64
  22. package/src/components/Input/__test__/TextInput.spec.js +1 -1
  23. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +1 -5
  24. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +1 -7
  25. package/src/components/ModalDialog/ModalDialog.vue +148 -64
  26. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +221 -11
  27. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +22 -1
  28. package/src/components/MultiSelect/MultiSelect.vue +297 -0
  29. package/src/components/Radio/Radio.vue +1 -1
  30. package/src/components/Switch/Switch.vue +1 -1
  31. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +1 -3
  32. package/src/components/TemplatePreview/TemplatePreview.vue +2 -2
  33. package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
  34. package/src/components/Toast/Toast.vue +9 -16
  35. package/src/components/ToolTip/ToolTip.vue +177 -25
  36. package/src/components/ToolTip/__tests__/ToolTip.spec.js +61 -339
  37. package/src/components/index.ts +6 -62
  38. package/src/components/ui/popover/PopoverContent.vue +4 -5
  39. package/src/components/ui/popover/PopoverOption.vue +0 -4
  40. package/src/components/ui/popover/PopoverTrigger.vue +1 -5
  41. package/src/locales/en.json +1 -3
  42. package/src/locales/es.json +1 -3
  43. package/src/locales/pt_br.json +1 -3
  44. package/src/stories/Drawer.stories.js +1 -1
  45. package/src/stories/Input.mdx +0 -3
  46. package/src/stories/ModalDialog.mdx +0 -3
  47. package/src/stories/ModalDialog.stories.js +1 -1
  48. package/src/stories/MultiSelect.stories.js +45 -143
  49. package/src/components/MultiSelect/MultSelectOption.vue +0 -49
  50. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +0 -557
  51. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +0 -229
  52. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +0 -87
  53. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +0 -51
  54. package/src/components/MultiSelect/index.vue +0 -265
  55. package/src/components/Select/__tests__/Select.spec.js +0 -422
  56. package/src/components/Select/__tests__/SelectItem.spec.js +0 -330
  57. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +0 -8
  58. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +0 -71
  59. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +0 -15
  60. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +0 -25
  61. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +0 -8
  62. package/src/components/Select/index.vue +0 -308
  63. package/src/components/ui/dialog/Dialog.vue +0 -19
  64. package/src/components/ui/dialog/DialogClose.vue +0 -29
  65. package/src/components/ui/dialog/DialogContent.vue +0 -140
  66. package/src/components/ui/dialog/DialogFooter.vue +0 -50
  67. package/src/components/ui/dialog/DialogHeader.vue +0 -83
  68. package/src/components/ui/dialog/DialogTitle.vue +0 -38
  69. package/src/components/ui/dialog/DialogTrigger.vue +0 -16
  70. package/src/components/ui/dialog/index.ts +0 -7
  71. package/src/components/ui/drawer/Drawer.vue +0 -27
  72. package/src/components/ui/drawer/DrawerClose.vue +0 -31
  73. package/src/components/ui/drawer/DrawerContent.vue +0 -111
  74. package/src/components/ui/drawer/DrawerDescription.vue +0 -40
  75. package/src/components/ui/drawer/DrawerFooter.vue +0 -38
  76. package/src/components/ui/drawer/DrawerHeader.vue +0 -57
  77. package/src/components/ui/drawer/DrawerOverlay.vue +0 -33
  78. package/src/components/ui/drawer/DrawerTitle.vue +0 -37
  79. package/src/components/ui/drawer/DrawerTrigger.vue +0 -31
  80. package/src/components/ui/drawer/index.ts +0 -10
  81. package/src/components/ui/tooltip/Tooltip.vue +0 -21
  82. package/src/components/ui/tooltip/TooltipContent.vue +0 -74
  83. package/src/components/ui/tooltip/TooltipTrigger.vue +0 -26
  84. package/src/components/ui/tooltip/index.ts +0 -3
  85. package/src/lib/layer-manager.ts +0 -92
  86. package/src/stories/Dialog.stories.js +0 -832
  87. package/src/stories/DrawerNext.stories.js +0 -611
  88. package/src/stories/LayerManager.docs.mdx +0 -40
  89. package/src/stories/LayerManager.stories.js +0 -364
  90. package/src/stories/Select.stories.js +0 -161
@@ -1,308 +0,0 @@
1
- <template>
2
- <div
3
- class="unnnic-select"
4
- @keydown="handleKeyDown"
5
- >
6
- <Popover
7
- :open="openPopover"
8
- @update:open="openPopover = $event"
9
- >
10
- <PopoverTrigger class="w-full">
11
- <UnnnicInput
12
- ref="selectInputRef"
13
- :modelValue="inputValue"
14
- class="unnnic-select__input"
15
- readonly
16
- useFocusProp
17
- :focus="openPopover"
18
- :size="props.size"
19
- :placeholder="props.placeholder"
20
- :label="props.label"
21
- :errors="props.errors"
22
- :message="props.message"
23
- :iconRight="openPopover ? 'keyboard_arrow_up' : 'keyboard_arrow_down'"
24
- :disabled="props.disabled"
25
- :showClear="!!selectedItem"
26
- @clear="emit('update:modelValue', '')"
27
- />
28
- </PopoverTrigger>
29
- <PopoverContent
30
- align="start"
31
- :class="'h-full'"
32
- :style="popoverContentCustomStyles"
33
- :width="inputWidthString"
34
- >
35
- <div class="unnnic-select__content">
36
- <UnnnicInput
37
- v-if="props.enableSearch"
38
- class="unnnic-select__input-search"
39
- :modelValue="props.search"
40
- :placeholder="$t('search')"
41
- iconLeft="search"
42
- @update:model-value="handleSearch"
43
- />
44
- <p
45
- v-if="filteredOptions.length === 0"
46
- class="unnnic-select__content-no-results"
47
- >
48
- {{ $t('without_results') }}
49
- </p>
50
- <PopoverOption
51
- v-for="(option, index) in filteredOptions"
52
- v-else
53
- :key="option[props.itemValue]"
54
- :data-option-index="index"
55
- data-testid="select-option"
56
- :label="option[props.itemLabel]"
57
- :active="
58
- option[props.itemValue] === selectedItem?.[props.itemValue]
59
- "
60
- :focused="focusedOptionIndex === index"
61
- :disabled="option.disabled"
62
- @click="handleSelectOption(option)"
63
- />
64
- </div>
65
- </PopoverContent>
66
- </Popover>
67
- </div>
68
- </template>
69
-
70
- <script setup lang="ts">
71
- import { computed, ref, watch, nextTick } from 'vue';
72
- import { useElementSize } from '@vueuse/core';
73
-
74
- import UnnnicInput from '../Input/Input.vue';
75
-
76
- import {
77
- Popover,
78
- PopoverTrigger,
79
- PopoverContent,
80
- PopoverOption,
81
- } from '../ui/popover/index';
82
-
83
- import UnnnicI18n from '../../mixins/i18n';
84
-
85
- defineOptions({
86
- name: 'UnnnicSelect',
87
- mixins: [UnnnicI18n],
88
- });
89
-
90
- interface SelectProps {
91
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
- options: Array<{ [key: string]: any }>;
93
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
94
- modelValue: any;
95
- returnObject?: boolean;
96
- itemLabel?: string;
97
- itemValue?: string;
98
- placeholder?: string;
99
- label?: string;
100
- type?: 'normal' | 'error';
101
- errors?: string | Array<string>;
102
- message?: string;
103
- size?: 'sm' | 'md';
104
- optionsLines?: number;
105
- enableSearch?: boolean;
106
- search?: string;
107
- locale?: string;
108
- disabled?: boolean;
109
- }
110
-
111
- const props = withDefaults(defineProps<SelectProps>(), {
112
- size: 'md',
113
- type: 'normal',
114
- placeholder: '',
115
- optionsLines: 5,
116
- returnObject: false,
117
- itemLabel: 'label',
118
- itemValue: 'value',
119
- locale: 'en',
120
- enableSearch: false,
121
- disabled: false,
122
- label: '',
123
- errors: '',
124
- message: '',
125
- search: '',
126
- });
127
-
128
- const emit = defineEmits<{
129
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
130
- 'update:modelValue': [value: any];
131
- 'update:search': [value: string];
132
- }>();
133
-
134
- const openPopover = ref(false);
135
- const selectInputRef = ref<HTMLInputElement | null>(null);
136
- const { width: inputWidth } = useElementSize(selectInputRef);
137
-
138
- const inputWidthString = computed(() => {
139
- return `${inputWidth.value}px`;
140
- });
141
-
142
- watch(openPopover, () => {
143
- if (!openPopover.value) {
144
- handleSearch('');
145
- } else {
146
- focusedOptionIndex.value = -1;
147
- }
148
-
149
- if (openPopover.value && props.modelValue) {
150
- const selectedOptionIndex = props.options.findIndex(
151
- (option) =>
152
- option[props.itemValue] === selectedItem.value?.[props.itemValue],
153
- );
154
- scrollToOption(selectedOptionIndex, 'instant', 'center');
155
- }
156
- });
157
-
158
- const handleKeyDown = (event) => {
159
- const { key } = event;
160
- const validKeys = ['ArrowUp', 'ArrowDown', 'Enter'];
161
-
162
- if (validKeys.includes(key)) {
163
- event.preventDefault();
164
- if (key === 'ArrowUp') {
165
- if (focusedOptionIndex.value === 0) return;
166
- focusedOptionIndex.value--;
167
- scrollToOption(focusedOptionIndex.value);
168
- }
169
- if (key === 'ArrowDown') {
170
- if (focusedOptionIndex.value === filteredOptions.value.length - 1) return;
171
- focusedOptionIndex.value++;
172
- scrollToOption(focusedOptionIndex.value);
173
- }
174
- if (key === 'Enter' && focusedOptionIndex.value !== -1) {
175
- handleSelectOption(filteredOptions.value[focusedOptionIndex.value]);
176
- }
177
- }
178
- };
179
-
180
- const focusedOptionIndex = ref<number>(-1);
181
-
182
- const scrollToOption = (
183
- index: number,
184
- behavior: 'smooth' | 'instant' = 'smooth',
185
- block: 'center' | 'start' | 'end' | 'nearest' = 'center',
186
- ) => {
187
- nextTick(() => {
188
- const option = document.querySelector(`[data-option-index="${index}"]`);
189
- if (option) {
190
- option.scrollIntoView?.({ behavior, block });
191
- }
192
- });
193
- };
194
-
195
- const calculatedPopoverHeight = computed(() => {
196
- if (!props.options || props.options.length === 0) return 'unset';
197
- const popoverPadding = 32;
198
- const popoverGap = 4;
199
- // 37 = 21px (height) + 16px (padding)
200
- const fieldsHeight = 37 * props.optionsLines;
201
- const gapsCompensation = props.enableSearch ? 1 : 2;
202
-
203
- const size =
204
- fieldsHeight +
205
- popoverPadding +
206
- (popoverGap * props.optionsLines - gapsCompensation);
207
-
208
- return `${props.enableSearch ? size + 45 + 1 : size}px`;
209
- });
210
-
211
- const popoverContentCustomStyles = computed(() => {
212
- const emptyFilteredOptions = filteredOptions.value?.length === 0;
213
- return {
214
- overflow: 'auto',
215
- display: 'flex',
216
- flexDirection: 'column',
217
- minHeight: calculatedPopoverHeight.value,
218
- maxHeight: emptyFilteredOptions ? 'unset' : calculatedPopoverHeight.value,
219
- height: emptyFilteredOptions ? calculatedPopoverHeight.value : 'unset',
220
- };
221
- });
222
-
223
- const selectedItem = computed(() => {
224
- if (props.returnObject) return props.modelValue;
225
-
226
- return props.options.find(
227
- (option) => option[props.itemValue] === props.modelValue,
228
- );
229
- });
230
-
231
- const inputValue = computed(() => {
232
- return selectedItem.value?.[props.itemLabel];
233
- });
234
-
235
- const handleSelectOption = (option) => {
236
- if (
237
- option[props.itemValue] === selectedItem.value?.[props.itemValue] ||
238
- option.disabled
239
- )
240
- return;
241
-
242
- emit(
243
- 'update:modelValue',
244
- props.returnObject ? option : option[props.itemValue],
245
- );
246
- openPopover.value = false;
247
- };
248
-
249
- const handleSearch = (value: string) => {
250
- emit('update:search', value);
251
- };
252
-
253
- const filteredOptions = computed(() => {
254
- if (!props.enableSearch || !props.search) return props.options;
255
-
256
- return props.options.filter(
257
- (option) =>
258
- option[props.itemLabel]
259
- .toLowerCase()
260
- .includes(props.search?.toLowerCase()) ||
261
- option[props.itemValue]
262
- .toLowerCase()
263
- .includes(props.search?.toLowerCase()),
264
- );
265
- });
266
- </script>
267
-
268
- <style lang="scss" scoped>
269
- @use '@/assets/scss/unnnic' as *;
270
-
271
- :deep(.unnnic-select__input) {
272
- cursor: pointer;
273
- }
274
-
275
- :deep(.unnnic-select__input-search) {
276
- > .icon-left {
277
- color: $unnnic-color-fg-base;
278
- }
279
- }
280
-
281
- :deep(.unnnic-select__input) {
282
- > .icon-right {
283
- color: $unnnic-color-fg-base;
284
- }
285
- }
286
-
287
- .unnnic-select {
288
- &__content {
289
- display: flex;
290
- flex-direction: column;
291
- padding: 0;
292
- margin: 0;
293
- gap: $unnnic-space-1;
294
-
295
- height: -webkit-fill-available;
296
-
297
- &-no-results {
298
- margin: 0;
299
- display: flex;
300
- align-items: center;
301
- justify-content: center;
302
- height: 100%;
303
- font: $unnnic-font-emphasis;
304
- color: $unnnic-color-fg-muted;
305
- }
306
- }
307
- }
308
- </style>
@@ -1,19 +0,0 @@
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>
@@ -1,29 +0,0 @@
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>
@@ -1,140 +0,0 @@
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
-
15
- defineOptions({
16
- name: 'UnnnicDialogContent',
17
- });
18
-
19
- const props = withDefaults(
20
- defineProps<
21
- DialogContentProps & {
22
- parentClass?: HTMLAttributes['class'];
23
- class?: HTMLAttributes['class'];
24
- size?: 'small' | 'medium' | 'large';
25
- }
26
- >(),
27
- {
28
- size: 'medium',
29
- parentClass: '', // This class should be temporary, to be discontinued with the ModalDialog component
30
- class: '',
31
- },
32
- );
33
- const emits = defineEmits<DialogContentEmits>();
34
-
35
- const delegatedProps = reactiveOmit(props, 'class', 'parentClass');
36
-
37
- const forwarded = useForwardPropsEmits(delegatedProps, emits);
38
-
39
- const overlayZIndex = useLayerZIndex('modal', { offset: -2 });
40
- const modalZIndex = useLayerZIndex('modal');
41
-
42
- const contentClasses = computed(() =>
43
- cn(
44
- 'unnnic-dialog-content',
45
- `unnnic-dialog-content--size-${props.size}`,
46
- '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%]',
47
- props.class,
48
- ),
49
- );
50
-
51
- // This component is used to wrap the DialogContent component in a section if the parentClass is provided
52
- // This is a temporary solution, to be discontinued with the ModalDialog component
53
- const ConditionalWrapper: Component = (_, { slots }) => {
54
- const content = slots.default?.();
55
- return props.parentClass
56
- ? h('section', { class: props.parentClass }, content)
57
- : content;
58
- };
59
- </script>
60
-
61
- <template>
62
- <DialogPortal>
63
- <DialogOverlay
64
- 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"
65
- :style="{ zIndex: overlayZIndex }"
66
- />
67
-
68
- <ConditionalWrapper>
69
- <DialogContent
70
- v-bind="forwarded"
71
- :class="contentClasses"
72
- :style="{ zIndex: modalZIndex }"
73
- >
74
- <slot />
75
- </DialogContent>
76
- </ConditionalWrapper>
77
- </DialogPortal>
78
- </template>
79
-
80
- <style lang="scss" scoped>
81
- @use '@/assets/scss/unnnic' as *;
82
-
83
- .unnnic-dialog-overlay {
84
- position: fixed;
85
- top: 0;
86
- left: 0;
87
-
88
- width: 100vw;
89
- height: 100vh;
90
- background: rgba(53, 57, 69, 0.5);
91
- }
92
-
93
- .unnnic-dialog-content {
94
- position: fixed;
95
- top: 50%;
96
- left: 50%;
97
-
98
- overflow: hidden;
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>
@@ -1,50 +0,0 @@
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>
@@ -1,83 +0,0 @@
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>
@@ -1,38 +0,0 @@
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>
@@ -1,16 +0,0 @@
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>
@@ -1,7 +0,0 @@
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';