@weni/unnnic-system 3.12.6 → 3.12.8-alpha.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 (91) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/{es-e7dc92a2.mjs → es-52edeb71.mjs} +1 -1
  3. package/dist/{index-84ade580.mjs → index-756fe685.mjs} +99873 -96635
  4. package/dist/index.d.ts +5714 -1674
  5. package/dist/{pt-br-51fd679a.mjs → pt-br-24583c8c.mjs} +1 -1
  6. package/dist/style.css +1 -1
  7. package/dist/unnnic.mjs +236 -204
  8. package/dist/unnnic.umd.js +48 -44
  9. package/package.json +3 -2
  10. package/src/assets/scss/scheme-colors.scss +223 -223
  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/Checkbox/Checkbox.vue +1 -1
  14. package/src/components/Drawer/Drawer.vue +190 -269
  15. package/src/components/Drawer/__tests__/Drawer.spec.js +37 -46
  16. package/src/components/Drawer/__tests__/__snapshots__/Drawer.spec.js.snap +18 -19
  17. package/src/components/FormElement/FormElement.vue +1 -1
  18. package/src/components/Input/BaseInput.vue +25 -5
  19. package/src/components/Input/Input.scss +2 -3
  20. package/src/components/Input/Input.vue +24 -1
  21. package/src/components/Input/TextInput.vue +64 -25
  22. package/src/components/Input/__test__/TextInput.spec.js +1 -1
  23. package/src/components/Input/__test__/__snapshots__/Input.spec.js.snap +5 -1
  24. package/src/components/Input/__test__/__snapshots__/TextInput.spec.js.snap +7 -1
  25. package/src/components/ModalDialog/ModalDialog.vue +64 -148
  26. package/src/components/ModalDialog/__tests__/ModalDialog.spec.js +11 -221
  27. package/src/components/ModalDialog/__tests__/__snapshots__/ModalDialog.spec.js.snap +1 -22
  28. package/src/components/MultiSelect/MultSelectOption.vue +49 -0
  29. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +557 -0
  30. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +229 -0
  31. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +87 -0
  32. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +51 -0
  33. package/src/components/MultiSelect/index.vue +265 -0
  34. package/src/components/Radio/Radio.vue +1 -1
  35. package/src/components/Select/__tests__/Select.spec.js +422 -0
  36. package/src/components/Select/__tests__/SelectItem.spec.js +330 -0
  37. package/src/components/Select/__tests__/__snapshots__/Popover.spec.js.snap +8 -0
  38. package/src/components/Select/__tests__/__snapshots__/Select.spec.js.snap +71 -0
  39. package/src/components/Select/__tests__/__snapshots__/SelectItem.spec.js.snap +15 -0
  40. package/src/components/Select/__tests__/__snapshots__/SelectOption.spec.js.snap +25 -0
  41. package/src/components/Select/__tests__/__snapshots__/SelectPopover.spec.js.snap +8 -0
  42. package/src/components/Select/index.vue +308 -0
  43. package/src/components/Switch/Switch.vue +1 -1
  44. package/src/components/Tab/__test__/__snapshots__/Tab.spec.js.snap +3 -1
  45. package/src/components/TemplatePreview/TemplatePreview.vue +2 -2
  46. package/src/components/TemplatePreview/TemplatePreviewModal.vue +1 -1
  47. package/src/components/Toast/Toast.vue +16 -9
  48. package/src/components/ToolTip/ToolTip.vue +25 -177
  49. package/src/components/ToolTip/__tests__/ToolTip.spec.js +339 -61
  50. package/src/components/index.ts +66 -6
  51. package/src/components/ui/dialog/Dialog.vue +19 -0
  52. package/src/components/ui/dialog/DialogClose.vue +29 -0
  53. package/src/components/ui/dialog/DialogContent.vue +140 -0
  54. package/src/components/ui/dialog/DialogFooter.vue +50 -0
  55. package/src/components/ui/dialog/DialogHeader.vue +83 -0
  56. package/src/components/ui/dialog/DialogTitle.vue +38 -0
  57. package/src/components/ui/dialog/DialogTrigger.vue +16 -0
  58. package/src/components/ui/dialog/index.ts +7 -0
  59. package/src/components/ui/drawer/Drawer.vue +27 -0
  60. package/src/components/ui/drawer/DrawerClose.vue +31 -0
  61. package/src/components/ui/drawer/DrawerContent.vue +111 -0
  62. package/src/components/ui/drawer/DrawerDescription.vue +40 -0
  63. package/src/components/ui/drawer/DrawerFooter.vue +38 -0
  64. package/src/components/ui/drawer/DrawerHeader.vue +57 -0
  65. package/src/components/ui/drawer/DrawerOverlay.vue +33 -0
  66. package/src/components/ui/drawer/DrawerTitle.vue +37 -0
  67. package/src/components/ui/drawer/DrawerTrigger.vue +31 -0
  68. package/src/components/ui/drawer/index.ts +10 -0
  69. package/src/components/ui/popover/PopoverContent.vue +30 -10
  70. package/src/components/ui/popover/PopoverOption.vue +5 -1
  71. package/src/components/ui/popover/PopoverTrigger.vue +5 -1
  72. package/src/components/ui/tooltip/Tooltip.vue +21 -0
  73. package/src/components/ui/tooltip/TooltipContent.vue +74 -0
  74. package/src/components/ui/tooltip/TooltipTrigger.vue +26 -0
  75. package/src/components/ui/tooltip/index.ts +3 -0
  76. package/src/lib/layer-manager.ts +92 -0
  77. package/src/locales/en.json +3 -1
  78. package/src/locales/es.json +3 -1
  79. package/src/locales/pt_br.json +3 -1
  80. package/src/stories/Dialog.stories.js +832 -0
  81. package/src/stories/Drawer.stories.js +1 -1
  82. package/src/stories/DrawerNext.stories.js +611 -0
  83. package/src/stories/Input.mdx +3 -0
  84. package/src/stories/LayerManager.docs.mdx +40 -0
  85. package/src/stories/LayerManager.stories.js +364 -0
  86. package/src/stories/ModalDialog.mdx +3 -0
  87. package/src/stories/ModalDialog.stories.js +1 -1
  88. package/src/stories/MultiSelect.stories.js +143 -45
  89. package/src/stories/Popover.stories.js +5 -0
  90. package/src/stories/Select.stories.js +161 -0
  91. package/src/components/MultiSelect/MultiSelect.vue +0 -297
@@ -0,0 +1,161 @@
1
+ import UnnnicSelect from '../components/Select/index.vue';
2
+
3
+ const options = [
4
+ { label: 'Option 1', value: 'option1', altValue: 'alt_value_option1' },
5
+ { label: 'Option 2', value: 'option2', altValue: 'alt_value_option2' },
6
+ { label: 'Option 3', value: 'option3', altValue: 'alt_value_option3' },
7
+ { label: 'Option 4', value: 'option4', altValue: 'alt_value_option4' },
8
+ { label: 'Option 5', value: 'option5', altValue: 'alt_value_option5' },
9
+ { label: 'Option 6', value: 'option6', altValue: 'alt_value_option6' },
10
+ { label: 'Option 7', value: 'option7', altValue: 'alt_value_option7' },
11
+ { label: 'Option 8', value: 'option8', altValue: 'alt_value_option8' },
12
+ { label: 'Option 9', value: 'option9', altValue: 'alt_value_option9' },
13
+ { label: 'Option 10', value: 'option10', disabled: true },
14
+ ];
15
+
16
+ export default {
17
+ title: 'Form/Select',
18
+ component: UnnnicSelect,
19
+ tags: ['autodocs'],
20
+ parameters: {
21
+ docs: {
22
+ description: {
23
+ component:
24
+ 'Select is designed to solve common problems related to option selection.',
25
+ },
26
+ },
27
+ },
28
+ argTypes: {
29
+ options: {
30
+ description:
31
+ 'List of items to be displayed in the options. If an item has a `disabled` key set to `true`, that item will be disabled. By default, the component looks for the `label` and `value` keys to display and update the model, but these are not required if you wish to customize them using the `itemLabel` and `itemValue` props, respectively.',
32
+ },
33
+ placeholder: {
34
+ description: 'Text to be displayed in the placeholder.',
35
+ },
36
+ label: {
37
+ description: 'Text to be displayed in the label.',
38
+ },
39
+ modelValue: {
40
+ description:
41
+ 'Model variable. Its type will always match the return type of the key specified by `itemValue`, or the entire options object when `returnObject` prop is set to `true`.',
42
+ },
43
+ returnObject: {
44
+ description:
45
+ 'Prop to indicate that the full option object should be returned in the v-model.',
46
+ },
47
+ itemLabel: {
48
+ description:
49
+ 'Field of the option item that should be used to render the option label.',
50
+ },
51
+ itemValue: {
52
+ description:
53
+ 'Field of the option item that should be used to return value to v-model.',
54
+ },
55
+ type: {
56
+ description: 'Select state type',
57
+ },
58
+ errors: {
59
+ description:
60
+ "Error message or messages. When it's an array, the messages will be separated by commas.",
61
+ },
62
+ message: {
63
+ description: 'Help or hint message.',
64
+ },
65
+ size: {
66
+ description: 'Select size',
67
+ },
68
+ optionsLines: {
69
+ description:
70
+ 'Number of options to display at most; if exceeded, scrolling will be enabled.',
71
+ },
72
+ enableSearch: {
73
+ description:
74
+ 'If true, enables a search field displayed inside the options popover. The `update:search` event is emitted on each input.',
75
+ },
76
+ search: {
77
+ description: 'Search value.',
78
+ },
79
+ locale: {
80
+ description: 'Locale for i18n translations.',
81
+ },
82
+ disabled: {
83
+ description: 'Disable the select.',
84
+ },
85
+ },
86
+ render: (args) => ({
87
+ components: { UnnnicSelect },
88
+ setup() {
89
+ const handleSearch = (value) => {
90
+ args.search = value;
91
+ };
92
+ return { args, handleSearch };
93
+ },
94
+ data() {
95
+ return {
96
+ exampleValue: null,
97
+ };
98
+ },
99
+ template: `
100
+ <div style="width: 300px;">
101
+ <p>modelValue: {{ exampleValue }}</p>
102
+ <unnnic-select v-model="exampleValue" v-bind="args" @update:search="handleSearch" />
103
+ </div>
104
+
105
+ `,
106
+ }),
107
+ };
108
+
109
+ export const Default = {
110
+ args: {
111
+ placeholder: 'Placeholder',
112
+ label: 'Label',
113
+ options,
114
+ },
115
+ };
116
+
117
+ export const ReturnObject = {
118
+ args: {
119
+ returnObject: true,
120
+ placeholder: 'Placeholder',
121
+ label: 'Label',
122
+ options,
123
+ },
124
+ };
125
+
126
+ export const AlternativeValueKey = {
127
+ args: {
128
+ itemValue: 'altValue',
129
+ placeholder: 'Placeholder',
130
+ label: 'Label',
131
+ options,
132
+ },
133
+ };
134
+
135
+ export const AlternativeValueLabel = {
136
+ args: {
137
+ itemLabel: 'altValue',
138
+ placeholder: 'Placeholder',
139
+ label: 'Label',
140
+ options,
141
+ },
142
+ };
143
+
144
+ export const Disabled = {
145
+ args: {
146
+ placeholder: 'Placeholder',
147
+ label: 'Label',
148
+ options,
149
+ disabled: true,
150
+ },
151
+ };
152
+
153
+ export const WithSearch = {
154
+ args: {
155
+ placeholder: 'Placeholder',
156
+ label: 'Label',
157
+ options,
158
+ enableSearch: true,
159
+ search: '',
160
+ },
161
+ };
@@ -1,297 +0,0 @@
1
- <template>
2
- <div
3
- :class="expand ? 'expand-multiselect' : 'normal-multiselect'"
4
- tabindex="-1"
5
- >
6
- <span
7
- v-if="label"
8
- class="select-permission-label"
9
- >{{ label }}</span
10
- >
11
- <div
12
- class="select-permission"
13
- tabindex="0"
14
- @keypress="handleIsOpenKeyboard"
15
- @click="active = !active"
16
- >
17
- <h6 class="title noselect">{{ inputTitle }}</h6>
18
- <UnnnicIcon
19
- :icon="active ? 'arrow-button-up-1' : 'arrow-button-down-1'"
20
- size="sm"
21
- scheme="neutral-dark"
22
- />
23
- </div>
24
- <div
25
- v-if="active"
26
- v-on-click-outside="onClickOutside"
27
- class="select-content"
28
- tabindex="0"
29
- >
30
- <div>
31
- <template
32
- v-for="(group, indexGroup) in modelValue"
33
- :key="`group-${indexGroup}`"
34
- >
35
- <h6
36
- v-if="!hideGroupTitle"
37
- :key="`title-${indexGroup}`"
38
- class="title"
39
- >
40
- {{ group.title }}
41
- </h6>
42
- <section>
43
- <template
44
- v-for="(item, indexItem) in group.items"
45
- :key="`item-${indexItem}`"
46
- >
47
- <div
48
- v-if="hideRadio"
49
- :key="indexItem + 'input'"
50
- class="unnnic-radio-container unnnic-radio-container--sm"
51
- style="cursor: pointer"
52
- @click="change(indexGroup, indexItem)"
53
- >
54
- <strong>{{ item.title }}</strong>
55
- <span>{{ item.description }}</span>
56
- </div>
57
- <UnnnicRadio
58
- v-else
59
- id=""
60
- :key="'else' + indexItem + 'input'"
61
- name=""
62
- :modelValue="group.selected"
63
- :value="indexItem"
64
- size="sm"
65
- class=""
66
- @update:model-value="change(indexGroup, $event)"
67
- >
68
- <strong>{{ item.title }}</strong>
69
- <span>{{ item.description }}</span>
70
- </UnnnicRadio>
71
- </template>
72
- </section>
73
- </template>
74
- </div>
75
- </div>
76
- </div>
77
- </template>
78
-
79
- <script>
80
- import { vOnClickOutside } from '@vueuse/components';
81
- import UnnnicIcon from '../Icon.vue';
82
- import UnnnicRadio from '../Radio/Radio.vue';
83
-
84
- export default {
85
- name: 'UnnnicMultiSelect',
86
- components: {
87
- UnnnicIcon,
88
- UnnnicRadio,
89
- },
90
- directives: {
91
- onClickOutside: vOnClickOutside,
92
- },
93
- props: {
94
- isOpen: {
95
- default: false,
96
- },
97
- expand: {
98
- default: false,
99
- },
100
- label: {
101
- type: String,
102
- default: '',
103
- },
104
- modelValue: {
105
- type: Array,
106
- default: () => [],
107
- },
108
- inputTitle: {
109
- type: String,
110
- default: 'Teste',
111
- },
112
- hideRadio: {
113
- type: Boolean,
114
- default: false,
115
- },
116
- hideGroupTitle: {
117
- type: Boolean,
118
- default: false,
119
- },
120
- unselectable: {
121
- type: Boolean,
122
- default: false,
123
- },
124
- },
125
-
126
- data() {
127
- return {
128
- active: false,
129
- };
130
- },
131
-
132
- watch: {
133
- isOpen() {
134
- this.active = this.open;
135
- },
136
- },
137
- methods: {
138
- handleIsOpenKeyboard(event) {
139
- if (
140
- document.querySelector('.select-permission:focus-visible') &&
141
- event.keyCode === 32
142
- ) {
143
- this.active = !this.active;
144
- }
145
- },
146
-
147
- onClickOutside() {
148
- if (!this.active) return;
149
- this.active = false;
150
- },
151
-
152
- change(indexGroup, indexSelected) {
153
- this.$emit(
154
- 'update:model-value',
155
- this.modelValue.map((item, index) => {
156
- if (index === indexGroup) {
157
- let selected = indexSelected;
158
- if (this.unselectable && item.selected === indexSelected) {
159
- selected = -1;
160
- }
161
- return { ...item, selected };
162
- }
163
-
164
- return item;
165
- }),
166
- );
167
- },
168
- },
169
- };
170
- </script>
171
-
172
- <style lang="scss" scoped>
173
- @use '@/assets/scss/unnnic' as *;
174
-
175
- .normal-multiselect,
176
- .expand-multiselect {
177
- user-select: none;
178
- }
179
-
180
- .normal-multiselect {
181
- position: relative;
182
- max-width: 319px;
183
-
184
- .select-content {
185
- max-width: 319px;
186
- }
187
- }
188
-
189
- .expand-multiselect {
190
- position: relative;
191
- width: 100%;
192
-
193
- .select-content {
194
- width: 100%;
195
- }
196
- }
197
-
198
- .noselect {
199
- -webkit-touch-callout: none; /* iOS Safari */
200
- -webkit-user-select: none; /* Safari */
201
- -khtml-user-select: none; /* Konqueror HTML */
202
- -moz-user-select: none; /* Old versions of Firefox */
203
- -ms-user-select: none; /* Internet Explorer/Edge */
204
- user-select: none; /* Non-prefixed version, currently
205
- supported by Chrome, Edge, Opera and Firefox */
206
- }
207
-
208
- .select-permission,
209
- .select-content > div {
210
- padding: $unnnic-squish-xs;
211
- background-color: $unnnic-color-neutral-snow;
212
-
213
- border-radius: $unnnic-border-radius-sm;
214
- border: $unnnic-border-width-thinner solid $unnnic-color-neutral-soft;
215
- }
216
- .select-permission {
217
- display: flex;
218
- flex-direction: row;
219
- justify-content: space-between;
220
- align-items: center;
221
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
222
-
223
- cursor: pointer;
224
- .icon {
225
- margin-left: $unnnic-spacing-inline-xs;
226
- }
227
- }
228
- .select-permission-label {
229
- display: block;
230
-
231
- color: $unnnic-color-neutral-cloudy;
232
- margin-bottom: $unnnic-spacing-stack-xs;
233
-
234
- font-family: $unnnic-font-family-secondary;
235
- font-size: $unnnic-font-size-body-gt;
236
- line-height: $unnnic-font-size-body-gt + $unnnic-line-height-medium;
237
- }
238
-
239
- .title {
240
- font-family: $unnnic-font-family-secondary;
241
- font-size: $unnnic-font-size-body-gt;
242
- margin: 0;
243
- font-weight: $unnnic-font-weight-regular;
244
- color: $unnnic-color-neutral-dark;
245
- }
246
-
247
- .select-content {
248
- position: absolute;
249
- margin-top: $unnnic-spacing-stack-xs;
250
-
251
- > div {
252
- box-shadow: $unnnic-shadow-level-near;
253
- .title {
254
- margin-bottom: $unnnic-spacing-stack-sm;
255
- }
256
-
257
- & section {
258
- display: flex;
259
- flex-direction: column;
260
-
261
- & + h6 {
262
- margin-top: $unnnic-spacing-stack-sm;
263
- padding-top: $unnnic-spacing-stack-sm;
264
- border-top: $unnnic-border-width-thinner solid
265
- $unnnic-color-neutral-darkest;
266
- }
267
-
268
- strong,
269
- span {
270
- display: block;
271
- font-family: $unnnic-font-family-secondary;
272
- font-size: $unnnic-font-size-body-gt;
273
- }
274
-
275
- strong {
276
- font-weight: $unnnic-font-weight-regular;
277
- }
278
- span {
279
- font-weight: $unnnic-font-weight-light;
280
- }
281
-
282
- .unnnic-radio-container {
283
- & + .unnnic-radio-container {
284
- margin-top: $unnnic-spacing-stack-sm;
285
- padding-top: $unnnic-spacing-stack-sm;
286
- border-top: $unnnic-border-width-thinner solid
287
- $unnnic-color-neutral-lightest;
288
- }
289
-
290
- :deep(.unnnic-icon) {
291
- margin-right: $unnnic-inline-xs;
292
- }
293
- }
294
- }
295
- }
296
- }
297
- </style>