@weni/unnnic-system 3.11.3-alpha.2 → 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.
@@ -0,0 +1,18 @@
1
+ import { SchemeColor } from '../../../types/scheme-colors';
2
+ interface PopoverOptionProps {
3
+ label: string;
4
+ disabled?: boolean;
5
+ active?: boolean;
6
+ focused?: boolean;
7
+ scheme?: SchemeColor;
8
+ icon?: string;
9
+ }
10
+ declare const _default: import('vue').DefineComponent<PopoverOptionProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<PopoverOptionProps> & Readonly<{}>, {
11
+ disabled: boolean;
12
+ icon: string;
13
+ scheme: SchemeColor;
14
+ active: boolean;
15
+ focused: boolean;
16
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
17
+ export default _default;
18
+ //# sourceMappingURL=PopoverOption.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PopoverOption.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/popover/PopoverOption.vue"],"names":[],"mappings":"AAwHA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD,UAAU,kBAAkB;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;;cALY,OAAO;UAIX,MAAM;YADJ,WAAW;YAFX,OAAO;aACN,OAAO;;AAwGnB,wBAQG"}
@@ -2,5 +2,6 @@ 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';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/popover/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.11.3-alpha.2",
3
+ "version": "3.11.3-alpha.3",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -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
+ };