@weni/unnnic-system 3.11.3-alpha.1 → 3.11.3-alpha.3

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 (34) hide show
  1. package/dist/components/Drawer/Drawer.vue.d.ts.map +1 -1
  2. package/dist/components/ModalDialog/ModalDialog.vue.d.ts.map +1 -1
  3. package/dist/components/ui/dialog/Dialog.vue.d.ts.map +1 -1
  4. package/dist/components/ui/dialog/DialogClose.vue.d.ts.map +1 -1
  5. package/dist/components/ui/dialog/DialogContent.vue.d.ts.map +1 -1
  6. package/dist/components/ui/dialog/DialogFooter.vue.d.ts.map +1 -1
  7. package/dist/components/ui/dialog/DialogHeader.vue.d.ts.map +1 -1
  8. package/dist/components/ui/dialog/DialogTitle.vue.d.ts.map +1 -1
  9. package/dist/components/ui/dialog/DialogTrigger.vue.d.ts.map +1 -1
  10. package/dist/components/ui/popover/PopoverOption.vue.d.ts +18 -0
  11. package/dist/components/ui/popover/PopoverOption.vue.d.ts.map +1 -0
  12. package/dist/components/ui/popover/index.d.ts +1 -0
  13. package/dist/components/ui/popover/index.d.ts.map +1 -1
  14. package/dist/{es-d411cfce.mjs → es-99b102dc.mjs} +1 -1
  15. package/dist/{index-a0b7e063.mjs → index-c20fa852.mjs} +181 -174
  16. package/dist/{pt-br-e7f8f6fe.mjs → pt-br-b17e69b4.mjs} +1 -1
  17. package/dist/style.css +1 -1
  18. package/dist/unnnic.mjs +1 -1
  19. package/dist/unnnic.umd.js +2 -2
  20. package/package.json +1 -1
  21. package/src/components/Drawer/Drawer.vue +2 -0
  22. package/src/components/Drawer/__tests__/Drawer.spec.js +6 -0
  23. package/src/components/ModalDialog/ModalDialog.vue +2 -0
  24. package/src/components/ui/dialog/Dialog.vue +4 -0
  25. package/src/components/ui/dialog/DialogClose.vue +4 -0
  26. package/src/components/ui/dialog/DialogContent.vue +4 -0
  27. package/src/components/ui/dialog/DialogFooter.vue +4 -0
  28. package/src/components/ui/dialog/DialogHeader.vue +4 -0
  29. package/src/components/ui/dialog/DialogTitle.vue +4 -0
  30. package/src/components/ui/dialog/DialogTrigger.vue +4 -0
  31. package/src/components/ui/popover/PopoverOption.vue +116 -0
  32. package/src/components/ui/popover/index.ts +1 -0
  33. package/src/stories/Popover.stories.js +55 -0
  34. package/src/stories/PopoverOption.stories.js +77 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.11.3-alpha.1",
3
+ "version": "3.11.3-alpha.3",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -6,6 +6,7 @@
6
6
  @update:open="$event ? () => {} : back()"
7
7
  >
8
8
  <DrawerContent
9
+ v-bind="$attrs"
9
10
  :showOverlay="!withoutOverlay"
10
11
  data-testid="drawer-container"
11
12
  :size="mappedSize"
@@ -106,6 +107,7 @@ import {
106
107
 
107
108
  defineOptions({
108
109
  name: 'UnnnicDrawer',
110
+ inheritAttrs: false,
109
111
  });
110
112
 
111
113
  const props = defineProps({
@@ -10,6 +10,12 @@ describe('Drawer.vue', () => {
10
10
  UnnnicIcon: true,
11
11
  UnnnicButton: true,
12
12
  Teleport: templateSlot,
13
+ UnnnicDrawerNext: templateSlot,
14
+ UnnnicDrawerContent: templateSlot,
15
+ UnnnicDrawerFooter: templateSlot,
16
+ UnnnicDrawerClose: templateSlot,
17
+ UnnnicDrawerTitle: templateSlot,
18
+ UnnnicDrawerDescription: templateSlot,
13
19
  };
14
20
 
15
21
  beforeEach(() => {
@@ -4,6 +4,7 @@
4
4
  @update:open="$emit('update:modelValue', $event)"
5
5
  >
6
6
  <UnnnicDialogContent
7
+ v-bind="$attrs"
7
8
  :size="size === 'sm' ? 'small' : size === 'lg' ? 'large' : 'medium'"
8
9
  :parentClass="['unnnic-modal-dialog', $attrs.class]"
9
10
  class="unnnic-modal-dialog__container"
@@ -101,6 +102,7 @@ export default {
101
102
  UnnnicDialogTitle,
102
103
  UnnnicDialogFooter,
103
104
  },
105
+ inheritAttrs: false,
104
106
  mixins: [UnnnicI18n],
105
107
  props: {
106
108
  modelValue: {
@@ -2,6 +2,10 @@
2
2
  import type { DialogRootEmits, DialogRootProps } from 'reka-ui';
3
3
  import { DialogRoot, useForwardPropsEmits } from 'reka-ui';
4
4
 
5
+ defineOptions({
6
+ name: 'UnnnicDialog',
7
+ });
8
+
5
9
  const props = defineProps<DialogRootProps>();
6
10
  const emits = defineEmits<DialogRootEmits>();
7
11
 
@@ -2,6 +2,10 @@
2
2
  import type { DialogCloseProps } from 'reka-ui';
3
3
  import { DialogClose } from 'reka-ui';
4
4
 
5
+ defineOptions({
6
+ name: 'UnnnicDialogClose',
7
+ });
8
+
5
9
  const props = defineProps<DialogCloseProps>();
6
10
  </script>
7
11
 
@@ -11,6 +11,10 @@ import {
11
11
  } from 'reka-ui';
12
12
  import { cn } from '@/lib/utils';
13
13
 
14
+ defineOptions({
15
+ name: 'UnnnicDialogContent',
16
+ });
17
+
14
18
  const props = withDefaults(
15
19
  defineProps<
16
20
  DialogContentProps & {
@@ -2,6 +2,10 @@
2
2
  import type { HTMLAttributes } from 'vue';
3
3
  import { cn } from '@/lib/utils';
4
4
 
5
+ defineOptions({
6
+ name: 'UnnnicDialogFooter',
7
+ });
8
+
5
9
  const props = withDefaults(
6
10
  defineProps<{ class?: HTMLAttributes['class']; divider?: boolean }>(),
7
11
  {
@@ -5,6 +5,10 @@ import UnnnicButton from '@/components/Button/Button.vue';
5
5
  import DialogClose from './DialogClose.vue';
6
6
  import UnnnicIcon, { SchemeColor } from '@/components/Icon.vue';
7
7
 
8
+ defineOptions({
9
+ name: 'UnnnicDialogHeader',
10
+ });
11
+
8
12
  const props = withDefaults(
9
13
  defineProps<{
10
14
  class?: HTMLAttributes['class'];
@@ -5,6 +5,10 @@ import { reactiveOmit } from '@vueuse/core';
5
5
  import { DialogTitle, useForwardProps } from 'reka-ui';
6
6
  import { cn } from '@/lib/utils';
7
7
 
8
+ defineOptions({
9
+ name: 'UnnnicDialogTitle',
10
+ });
11
+
8
12
  const props = defineProps<
9
13
  DialogTitleProps & { class?: HTMLAttributes['class'] }
10
14
  >();
@@ -2,6 +2,10 @@
2
2
  import type { DialogTriggerProps } from 'reka-ui';
3
3
  import { DialogTrigger } from 'reka-ui';
4
4
 
5
+ defineOptions({
6
+ name: 'UnnnicDialogTrigger',
7
+ });
8
+
5
9
  const props = defineProps<DialogTriggerProps>();
6
10
  </script>
7
11
 
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div
3
+ :class="[
4
+ 'unnnic-popover-option',
5
+ {
6
+ 'unnnic-popover-option--disabled': props.disabled,
7
+ 'unnnic-popover-option--active': props.active,
8
+ 'unnnic-popover-option--focused': props.focused,
9
+ },
10
+ ]"
11
+ >
12
+ <UnnnicIcon
13
+ v-if="props.icon"
14
+ :icon="props.icon"
15
+ :scheme="schemeColor"
16
+ size="ant"
17
+ />
18
+ <p
19
+ :class="[
20
+ 'unnnic-popover-option__label',
21
+ `unnnic-popover-option__label--${schemeColor}`,
22
+ `unnnic-popover-option--disabled: ${props.disabled}`,
23
+ ]"
24
+ >
25
+ {{ props.label }}
26
+ </p>
27
+ </div>
28
+ </template>
29
+
30
+ <script setup lang="ts">
31
+ import UnnnicIcon from '@/components/Icon.vue';
32
+
33
+ import type { SchemeColor } from '@/types/scheme-colors';
34
+ import { computed } from 'vue';
35
+
36
+ defineOptions({
37
+ name: 'UnnnicPopoverOption',
38
+ });
39
+
40
+ interface PopoverOptionProps {
41
+ label: string;
42
+ disabled?: boolean;
43
+ active?: boolean;
44
+ focused?: boolean;
45
+ scheme?: SchemeColor;
46
+ icon?: string;
47
+ }
48
+
49
+ const props = withDefaults(defineProps<PopoverOptionProps>(), {
50
+ disabled: false,
51
+ active: false,
52
+ focused: false,
53
+ scheme: 'fg-emphasized',
54
+ icon: '',
55
+ });
56
+
57
+ const schemeColor = computed(() => {
58
+ if (props.active) {
59
+ return 'fg-inverted';
60
+ }
61
+ if (props.disabled) {
62
+ return 'fg-muted';
63
+ }
64
+ return props.scheme;
65
+ });
66
+ </script>
67
+
68
+ <style lang="scss" scoped>
69
+ @use '@/assets/scss/unnnic' as *;
70
+ * {
71
+ margin: 0;
72
+ padding: 0;
73
+ box-sizing: border-box;
74
+ }
75
+
76
+ .unnnic-popover-option {
77
+ cursor: pointer;
78
+ border-radius: $unnnic-radius-1;
79
+ padding: $unnnic-space-2 $unnnic-space-4;
80
+ font: $unnnic-font-emphasis;
81
+ display: flex;
82
+ gap: $unnnic-space-2;
83
+ align-items: center;
84
+
85
+ &:hover:not(&--active):not(&--disabled),
86
+ &--focused {
87
+ background-color: $unnnic-color-bg-soft;
88
+ }
89
+
90
+ &--active {
91
+ background-color: $unnnic-color-bg-active;
92
+ }
93
+
94
+ &--disabled {
95
+ color: $unnnic-color-fg-muted;
96
+ background-color: $unnnic-color-bg-muted;
97
+ cursor: not-allowed;
98
+ }
99
+
100
+ &__label {
101
+ @each $name, $color in $unnnic-scheme-colors {
102
+ &.unnnic-popover-option__label--#{$name} {
103
+ color: $color;
104
+ }
105
+ }
106
+
107
+ &--disabled {
108
+ color: $unnnic-color-fg-muted;
109
+ }
110
+
111
+ &--active {
112
+ color: $unnnic-color-fg-inverted;
113
+ }
114
+ }
115
+ }
116
+ </style>
@@ -2,4 +2,5 @@ export { default as Popover } from './Popover.vue';
2
2
  export { default as PopoverContent } from './PopoverContent.vue';
3
3
  export { default as PopoverFooter } from './PopoverFooter.vue';
4
4
  export { default as PopoverTrigger } from './PopoverTrigger.vue';
5
+ export { default as PopoverOption } from './PopoverOption.vue';
5
6
  export { PopoverAnchor } from 'reka-ui';
@@ -3,6 +3,7 @@ import {
3
3
  PopoverContent,
4
4
  PopoverFooter,
5
5
  PopoverTrigger,
6
+ PopoverOption,
6
7
  } from '../components/ui/popover';
7
8
  import UnnnicButton from '../components/Button/Button.vue';
8
9
  import UnnnicInput from '../components/Input/Input.vue';
@@ -88,6 +89,60 @@ export const Default = {
88
89
  }),
89
90
  };
90
91
 
92
+ export const WithOptions = {
93
+ parameters: {
94
+ docs: {
95
+ description: {
96
+ story: 'Popover with options',
97
+ },
98
+ source: {
99
+ code: `
100
+ <UnnnicPopover>
101
+ <UnnnicPopoverTrigger>
102
+ <UnnnicButton text="Open Popover with options" />
103
+ </UnnnicPopoverTrigger>
104
+ <UnnnicPopoverContent v-bind="args">
105
+ <UnnnicPopoverOption label="Option 1" />
106
+ <UnnnicPopoverOption label="Option 2" />
107
+ <UnnnicPopoverOption label="Option 3" />
108
+ </UnnnicPopoverContent>
109
+ </UnnnicPopover>
110
+ `,
111
+ },
112
+ },
113
+ },
114
+ render: (args) => ({
115
+ components: {
116
+ Popover,
117
+ PopoverContent,
118
+ PopoverTrigger,
119
+ UnnnicButton,
120
+ PopoverOption,
121
+ },
122
+ setup() {
123
+ return { args };
124
+ },
125
+ template: `
126
+ <div style="display: flex; justify-content: center; align-items: center; min-height: 300px;">
127
+ <Popover>
128
+ <PopoverTrigger>
129
+ <UnnnicButton text="Open Popover" />
130
+ </PopoverTrigger>
131
+ <PopoverContent v-bind="args">
132
+ <section style="display: flex; flex-direction: column; gap: 8px;">
133
+ <PopoverOption label="View details" icon="info" scheme="fg-info" />
134
+ <PopoverOption label="Edit" icon="edit" scheme="fg-warning" />
135
+ <PopoverOption label="Delete" icon="delete" scheme="fg-critical" />
136
+ <PopoverOption label="Disable" icon="close" disabled />
137
+ <PopoverOption label="Active" icon="check" active />
138
+ </section>
139
+ </PopoverContent>
140
+ </Popover>
141
+ </div>
142
+ `,
143
+ }),
144
+ };
145
+
91
146
  export const WithFooter = {
92
147
  parameters: {
93
148
  docs: {
@@ -0,0 +1,77 @@
1
+ import { PopoverOption } from '../components/ui/popover';
2
+ import colorsList from '../utils/colorsList';
3
+
4
+ export default {
5
+ title: 'Misc/PopoverOption',
6
+ component: PopoverOption,
7
+ tags: ['autodocs'],
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `A popover component that displays rich content in a portal, floating on top of other content.
12
+ <br/>
13
+ It supports three sizes (small, medium, large).
14
+ <br/>
15
+ API reference: https://www.reka-ui.com/docs/components/popover
16
+ `,
17
+ },
18
+ },
19
+ },
20
+ argTypes: {
21
+ label: {
22
+ control: { type: 'text' },
23
+ description: 'The label of the popover option',
24
+ },
25
+ disabled: {
26
+ control: { type: 'select' },
27
+ options: [true, false],
28
+ description: 'Whether the option is disabled',
29
+ },
30
+ active: {
31
+ control: { type: 'select' },
32
+ options: [true, false],
33
+ description: 'Whether the option is active',
34
+ },
35
+ focused: {
36
+ control: { type: 'select' },
37
+ options: [true, false],
38
+ description:
39
+ 'Whether the option is focused (when the popover is open, the focused option is highlighted)',
40
+ },
41
+ scheme: {
42
+ control: { type: 'select' },
43
+ options: colorsList,
44
+ description: 'The scheme of the option',
45
+ },
46
+ icon: {
47
+ control: { type: 'text' },
48
+ description: 'The icon of the option',
49
+ },
50
+ },
51
+ args: {
52
+ label: 'Option',
53
+ disabled: false,
54
+ active: false,
55
+ scheme: 'fg-emphasized',
56
+ icon: '',
57
+ },
58
+ };
59
+
60
+ export const Default = {
61
+ render: (args) => ({
62
+ components: { PopoverOption },
63
+ setup() {
64
+ return { args };
65
+ },
66
+ template: `
67
+ <section style="display: flex; flex-direction: column; gap: 8px;">
68
+ <PopoverOption v-bind="args" />
69
+ <PopoverOption v-bind="args" disabled />
70
+ <PopoverOption v-bind="args" active />
71
+ <PopoverOption v-bind="args" focused />
72
+ <PopoverOption v-bind="args" icon="delete" scheme="fg-critical" />
73
+ <PopoverOption v-bind="args" icon="info" />
74
+ </section>
75
+ `,
76
+ }),
77
+ };