@weni/unnnic-system 3.36.0 → 3.36.1-alpha.1

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 (42) hide show
  1. package/dist/assets/scss/tailwind.css +1 -1
  2. package/dist/components/MultiSelect/MultiSelectOption.css +1 -1
  3. package/dist/components/MultiSelect/MultiSelectOption.vue.mjs +2 -2
  4. package/dist/components/MultiSelect/MultiSelectOption.vue2.mjs +41 -15
  5. package/dist/components/MultiSelect/MultiSelectTreeOptions.css +1 -0
  6. package/dist/components/MultiSelect/MultiSelectTreeOptions.vue.mjs +7 -0
  7. package/dist/components/MultiSelect/MultiSelectTreeOptions.vue2.mjs +50 -0
  8. package/dist/components/MultiSelect/index.css +1 -1
  9. package/dist/components/MultiSelect/index.vue.mjs +2 -2
  10. package/dist/components/MultiSelect/index.vue2.mjs +126 -114
  11. package/dist/components/SelectTime/index.css +1 -1
  12. package/dist/components/SelectTime/index.vue.mjs +55 -42
  13. package/dist/composables/useMultiSelectRows.mjs +74 -0
  14. package/dist/composables/useMultiSelectSelection.mjs +44 -0
  15. package/dist/composables/useSelectBase.mjs +44 -39
  16. package/dist/composables/useSelectKeyboard.mjs +70 -35
  17. package/dist/composables/useTreeExpansion.mjs +24 -0
  18. package/dist/lib/tree-selection.mjs +66 -0
  19. package/dist/locales/en.json.mjs +9 -5
  20. package/dist/style.css +6 -4
  21. package/dist/unnnic.umd.js +19 -19
  22. package/package.json +2 -2
  23. package/src/components/MultiSelect/MultiSelectOption.vue +66 -3
  24. package/src/components/MultiSelect/MultiSelectTreeOptions.vue +73 -0
  25. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +556 -0
  26. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +55 -1
  27. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +5 -0
  28. package/src/components/MultiSelect/index.vue +57 -50
  29. package/src/components/Select/_select-shared.scss +8 -0
  30. package/src/components/Select/types.ts +1 -0
  31. package/src/components/SelectTime/__tests__/SelectTime.spec.js +88 -0
  32. package/src/components/SelectTime/index.vue +31 -7
  33. package/src/composables/useMultiSelectRows.ts +121 -0
  34. package/src/composables/useMultiSelectSelection.ts +97 -0
  35. package/src/composables/useSelectBase.ts +40 -16
  36. package/src/composables/useSelectKeyboard.ts +92 -18
  37. package/src/composables/useTreeExpansion.ts +44 -0
  38. package/src/lib/__tests__/tree-selection.spec.ts +141 -0
  39. package/src/lib/tree-selection.ts +156 -0
  40. package/src/locales/en.json +3 -1
  41. package/src/stories/MultiSelect.stories.js +62 -1
  42. package/src/stories/SelectTime.stories.js +5 -1
@@ -1,24 +1,56 @@
1
1
  /**
2
- * Shared keyboard navigation for Select and MultiSelect (ArrowUp, ArrowDown, Enter).
2
+ * Shared keyboard navigation for Select and MultiSelect
3
+ * (ArrowUp, ArrowDown, Enter, optional ArrowRight, ArrowLeft and Space).
3
4
  * Binds keydown to document when popover is open and unbinds when closed.
4
5
  */
5
- import { ref, nextTick, watch, onBeforeUnmount, type Ref } from 'vue';
6
+ import {
7
+ ref,
8
+ nextTick,
9
+ watch,
10
+ onBeforeUnmount,
11
+ toValue,
12
+ type MaybeRefOrGetter,
13
+ type Ref,
14
+ } from 'vue';
6
15
  import type { SelectOption } from '../components/Select/types';
7
16
 
8
17
  const DATA_OPTION_INDEX = 'data-option-index';
9
18
 
10
- export interface UseSelectKeyboardOptions {
19
+ export interface UseSelectKeyboardOptions<
20
+ T extends SelectOption = SelectOption,
21
+ > {
11
22
  closeOnSelect?: boolean;
12
23
  closePopover: () => void;
13
24
  openPopoverRef: Ref<boolean>;
25
+ /** May return the index to focus next. */
26
+ onArrowRight?: (index: number, option: T) => number | void;
27
+ /** May return the index to focus next. */
28
+ onArrowLeft?: (index: number, option: T) => number | void;
29
+ toggleOnSpace?: MaybeRefOrGetter<boolean>;
30
+ }
31
+
32
+ function isEditableTarget(event: KeyboardEvent) {
33
+ const target = event.target;
34
+ if (!(target instanceof HTMLElement)) return false;
35
+ if (target.closest('input, textarea, button, [contenteditable="true"]')) {
36
+ return true;
37
+ }
38
+ return target.isContentEditable;
14
39
  }
15
40
 
16
41
  export function useSelectKeyboard<T extends SelectOption>(
17
42
  getFilteredOptions: () => T[],
18
43
  onSelectOption: (option: T) => void,
19
- options: UseSelectKeyboardOptions,
44
+ options: UseSelectKeyboardOptions<T>,
20
45
  ) {
21
- const { closeOnSelect = true, closePopover, openPopoverRef } = options;
46
+ const {
47
+ closeOnSelect = true,
48
+ closePopover,
49
+ openPopoverRef,
50
+ onArrowRight,
51
+ onArrowLeft,
52
+ toggleOnSpace = false,
53
+ } = options;
22
54
  const focusedOptionIndex = ref(-1);
23
55
 
24
56
  function scrollToOption(
@@ -34,30 +66,64 @@ export function useSelectKeyboard<T extends SelectOption>(
34
66
  });
35
67
  }
36
68
 
37
- function handleKeyDown(event: KeyboardEvent) {
38
- const validKeys = ['ArrowUp', 'ArrowDown', 'Enter'];
39
- if (!validKeys.includes(event.key)) return;
69
+ function selectFocusedOption() {
70
+ const list = getFilteredOptions();
71
+ const option = list[focusedOptionIndex.value];
72
+ if (focusedOptionIndex.value < 0 || !option) return;
73
+ if (option.disabled) return;
74
+ onSelectOption(option);
75
+ if (closeOnSelect) closePopover();
76
+ }
40
77
 
41
- event.preventDefault();
78
+ function handleKeyDown(event: KeyboardEvent) {
42
79
  const list = getFilteredOptions();
43
80
 
44
81
  if (event.key === 'ArrowUp') {
82
+ event.preventDefault();
45
83
  if (focusedOptionIndex.value <= 0) return;
46
84
  focusedOptionIndex.value--;
47
85
  scrollToOption(focusedOptionIndex.value);
48
- } else if (event.key === 'ArrowDown') {
86
+ return;
87
+ }
88
+
89
+ if (event.key === 'ArrowDown') {
90
+ event.preventDefault();
49
91
  if (focusedOptionIndex.value >= list.length - 1) return;
50
92
  focusedOptionIndex.value++;
51
93
  scrollToOption(focusedOptionIndex.value);
52
- } else if (
53
- event.key === 'Enter' &&
54
- focusedOptionIndex.value >= 0 &&
55
- list[focusedOptionIndex.value]
56
- ) {
94
+ return;
95
+ }
96
+
97
+ if (event.key === 'Enter') {
98
+ event.preventDefault();
99
+ selectFocusedOption();
100
+ return;
101
+ }
102
+
103
+ const horizontalHandler =
104
+ event.key === 'ArrowRight'
105
+ ? onArrowRight
106
+ : event.key === 'ArrowLeft'
107
+ ? onArrowLeft
108
+ : undefined;
109
+
110
+ if (horizontalHandler) {
111
+ if (isEditableTarget(event)) return;
112
+ event.preventDefault();
57
113
  const option = list[focusedOptionIndex.value];
58
- if (option?.disabled) return;
59
- onSelectOption(option);
60
- if (closeOnSelect) closePopover();
114
+ if (!option) return;
115
+ const nextIndex = horizontalHandler(focusedOptionIndex.value, option);
116
+ if (typeof nextIndex === 'number' && nextIndex >= 0) {
117
+ focusedOptionIndex.value = nextIndex;
118
+ scrollToOption(nextIndex);
119
+ }
120
+ return;
121
+ }
122
+
123
+ if (event.key === ' ' && toValue(toggleOnSpace)) {
124
+ if (isEditableTarget(event)) return;
125
+ event.preventDefault();
126
+ selectFocusedOption();
61
127
  }
62
128
  }
63
129
 
@@ -79,6 +145,14 @@ export function useSelectKeyboard<T extends SelectOption>(
79
145
  if (isOpen) nextTick(bindKeydown);
80
146
  else unbindKeydown();
81
147
  });
148
+ watch(
149
+ () => getFilteredOptions().length,
150
+ (length) => {
151
+ if (focusedOptionIndex.value >= length) {
152
+ focusedOptionIndex.value = length - 1;
153
+ }
154
+ },
155
+ );
82
156
  onBeforeUnmount(unbindKeydown);
83
157
  }
84
158
 
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Which tree parents are expanded. While searching, every parent starts
3
+ * expanded and the user may still collapse it; that search-only state is
4
+ * discarded when the search starts or ends, so the manual expansion is back
5
+ * once the search is cleared.
6
+ */
7
+ import { ref, toValue, watch, type MaybeRefOrGetter } from 'vue';
8
+
9
+ export function useTreeExpansion(isSearchActive: MaybeRefOrGetter<boolean>) {
10
+ const expandedValues = ref(new Set<unknown>());
11
+ const searchCollapsedValues = ref(new Set<unknown>());
12
+
13
+ watch(
14
+ () => toValue(isSearchActive),
15
+ () => {
16
+ searchCollapsedValues.value = new Set();
17
+ },
18
+ );
19
+
20
+ function isExpanded(value: unknown) {
21
+ return toValue(isSearchActive)
22
+ ? !searchCollapsedValues.value.has(value)
23
+ : expandedValues.value.has(value);
24
+ }
25
+
26
+ function setExpanded(value: unknown, expanded = !isExpanded(value)) {
27
+ const searching = toValue(isSearchActive);
28
+ const target = searching ? searchCollapsedValues : expandedValues;
29
+ const shouldInclude = searching ? !expanded : expanded;
30
+ const next = new Set(target.value);
31
+
32
+ if (shouldInclude) next.add(value);
33
+ else next.delete(value);
34
+
35
+ target.value = next;
36
+ }
37
+
38
+ function reset() {
39
+ expandedValues.value = new Set();
40
+ searchCollapsedValues.value = new Set();
41
+ }
42
+
43
+ return { isExpanded, setExpanded, reset };
44
+ }
@@ -0,0 +1,141 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import type { SelectOption } from '@/components/Select/types';
3
+ import {
4
+ filterTreeOptions,
5
+ getCheckState,
6
+ getDisplayOptions,
7
+ getDrivingChildren,
8
+ getVisibleChildren,
9
+ isTreeOptions,
10
+ toggleOptionValue,
11
+ withImpliedChildren,
12
+ } from '@/lib/tree-selection';
13
+
14
+ const getValue = (option: SelectOption) => option.value;
15
+
16
+ const delay: SelectOption = { label: 'Delay', value: 'delay' };
17
+ const tracking: SelectOption = { label: 'Tracking', value: 'tracking' };
18
+ const delivery: SelectOption = {
19
+ label: 'Delivery',
20
+ value: 'delivery',
21
+ children: [
22
+ delay,
23
+ tracking,
24
+ { label: 'Locked', value: 'locked', disabled: true },
25
+ ],
26
+ };
27
+ const payment: SelectOption = {
28
+ label: 'Payment',
29
+ value: 'payment',
30
+ children: [{ label: 'Pix', value: 'pix' }],
31
+ };
32
+ const other: SelectOption = { label: 'Other', value: 'other' };
33
+ const options = [delivery, payment, other];
34
+
35
+ const toggle = (values: unknown[], option: SelectOption, checked: boolean) =>
36
+ toggleOptionValue(options, values, option, checked, getValue);
37
+
38
+ describe('tree-selection', () => {
39
+ it('detects tree options', () => {
40
+ expect(isTreeOptions(options)).toBe(true);
41
+ expect(isTreeOptions([other])).toBe(false);
42
+ });
43
+
44
+ it('drives a parent by its enabled children, or all when none is enabled', () => {
45
+ expect(getDrivingChildren(delivery).map(getValue)).toEqual([
46
+ 'delay',
47
+ 'tracking',
48
+ ]);
49
+
50
+ const locked = { value: 'p', children: [{ value: 'c', disabled: true }] };
51
+ expect(getDrivingChildren(locked).map(getValue)).toEqual(['c']);
52
+ });
53
+
54
+ describe('search', () => {
55
+ const matches = (option: SelectOption) =>
56
+ String(option.label).toLowerCase().includes('track');
57
+
58
+ it('keeps roots that match or have a matching child', () => {
59
+ expect(filterTreeOptions(options, matches)).toEqual([delivery]);
60
+ });
61
+
62
+ it('shows only matching children under a non-matching root', () => {
63
+ expect(getVisibleChildren(delivery, matches).map(getValue)).toEqual([
64
+ 'tracking',
65
+ ]);
66
+ });
67
+
68
+ it('shows every child under a matching root', () => {
69
+ expect(getVisibleChildren(delivery, () => true)).toHaveLength(3);
70
+ });
71
+ });
72
+
73
+ it('adds the enabled children implied by a parent value', () => {
74
+ expect(withImpliedChildren(options, ['delivery'], getValue)).toEqual([
75
+ 'delivery',
76
+ 'delay',
77
+ 'tracking',
78
+ ]);
79
+ });
80
+
81
+ describe('getCheckState', () => {
82
+ const stateOf = (option: SelectOption, values: unknown[]) =>
83
+ getCheckState(option, new Set(values), getValue);
84
+
85
+ it('returns the leaf selection', () => {
86
+ expect(stateOf(other, ['other'])).toBe(true);
87
+ expect(stateOf(other, [])).toBe(false);
88
+ });
89
+
90
+ it('returns true, less or false for a parent', () => {
91
+ expect(stateOf(delivery, ['delay', 'tracking'])).toBe(true);
92
+ expect(stateOf(delivery, ['delay'])).toBe('less');
93
+ expect(stateOf(delivery, [])).toBe(false);
94
+ });
95
+ });
96
+
97
+ describe('toggleOptionValue', () => {
98
+ it('checks a parent with its enabled children', () => {
99
+ expect(toggle([], delivery, true)).toEqual([
100
+ 'delay',
101
+ 'tracking',
102
+ 'delivery',
103
+ ]);
104
+ });
105
+
106
+ it('unchecks a parent and its children', () => {
107
+ expect(
108
+ toggle(['delay', 'tracking', 'delivery'], delivery, false),
109
+ ).toEqual([]);
110
+ });
111
+
112
+ it('adds the parent once its last driving child is checked', () => {
113
+ expect(toggle(['delay'], tracking, true)).toEqual([
114
+ 'delay',
115
+ 'tracking',
116
+ 'delivery',
117
+ ]);
118
+ });
119
+
120
+ it('removes the parent when a child is unchecked', () => {
121
+ expect(toggle(['delay', 'tracking', 'delivery'], delay, false)).toEqual([
122
+ 'tracking',
123
+ ]);
124
+ });
125
+
126
+ it('toggles a leaf and keeps unknown values', () => {
127
+ expect(toggle(['unknown'], other, true)).toEqual(['unknown', 'other']);
128
+ expect(toggle(['unknown', 'other'], other, false)).toEqual(['unknown']);
129
+ });
130
+ });
131
+
132
+ it('displays a full parent instead of its children, in tree order', () => {
133
+ const selected = new Set(['other', 'pix', 'payment', 'delay']);
134
+
135
+ expect(getDisplayOptions(options, selected, getValue)).toEqual([
136
+ delay,
137
+ payment,
138
+ other,
139
+ ]);
140
+ });
141
+ });
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Pure selection rules for options with one level of children.
3
+ * Rules work on option values (`option[itemValue]`); converting them from and
4
+ * to a component model is the caller's job. Options without children are
5
+ * leaves, so a flat list follows the same rules.
6
+ */
7
+ import type { CheckboxValue } from '../components/Checkbox/Checkbox.vue';
8
+ import type { SelectOption } from '../components/Select/types';
9
+
10
+ export type GetOptionValue = (option: SelectOption) => unknown;
11
+ export type OptionMatcher = (option: SelectOption) => boolean;
12
+
13
+ export function getOptionChildren(option: SelectOption): SelectOption[] {
14
+ return Array.isArray(option.children) ? option.children : [];
15
+ }
16
+
17
+ export function hasOptionChildren(option: SelectOption) {
18
+ return getOptionChildren(option).length > 0;
19
+ }
20
+
21
+ export function isTreeOptions(options: SelectOption[]) {
22
+ return options.some(hasOptionChildren);
23
+ }
24
+
25
+ export function flattenTreeOptions(options: SelectOption[]) {
26
+ return options.flatMap((option) => [option, ...getOptionChildren(option)]);
27
+ }
28
+
29
+ /**
30
+ * Children that decide whether a parent is fully checked. Disabled children
31
+ * are skipped so they cannot keep a parent partial forever, unless every
32
+ * child is disabled.
33
+ */
34
+ export function getDrivingChildren(parent: SelectOption) {
35
+ const children = getOptionChildren(parent);
36
+ const enabled = children.filter((child) => !child.disabled);
37
+ return enabled.length ? enabled : children;
38
+ }
39
+
40
+ /** Roots kept by a search: the matching ones and those with a matching child. */
41
+ export function filterTreeOptions(
42
+ options: SelectOption[],
43
+ matches: OptionMatcher,
44
+ ) {
45
+ return options.filter(
46
+ (option) => matches(option) || getOptionChildren(option).some(matches),
47
+ );
48
+ }
49
+
50
+ /** Children shown under a kept root: all of them when the root matches. */
51
+ export function getVisibleChildren(
52
+ option: SelectOption,
53
+ matches: OptionMatcher,
54
+ ) {
55
+ const children = getOptionChildren(option);
56
+ return matches(option) ? children : children.filter(matches);
57
+ }
58
+
59
+ /**
60
+ * A parent value received without its children (e.g. restored from a URL)
61
+ * implies its enabled children, so they count as selected.
62
+ */
63
+ export function withImpliedChildren(
64
+ options: SelectOption[],
65
+ values: unknown[],
66
+ getValue: GetOptionValue,
67
+ ) {
68
+ const explicit = new Set(values);
69
+ const implied = options
70
+ .filter((option) => explicit.has(getValue(option)))
71
+ .flatMap(getOptionChildren)
72
+ .filter((child) => !child.disabled && !explicit.has(getValue(child)))
73
+ .map(getValue);
74
+
75
+ return [...values, ...implied];
76
+ }
77
+
78
+ export function getCheckState(
79
+ option: SelectOption,
80
+ selected: Set<unknown>,
81
+ getValue: GetOptionValue,
82
+ ): CheckboxValue {
83
+ const isSelected = (item: SelectOption) => selected.has(getValue(item));
84
+ const children = getOptionChildren(option);
85
+
86
+ if (!children.length) return isSelected(option);
87
+ if (getDrivingChildren(option).every(isSelected)) return true;
88
+ return children.some(isSelected) ? 'less' : false;
89
+ }
90
+
91
+ function findParent(
92
+ options: SelectOption[],
93
+ option: SelectOption,
94
+ getValue: GetOptionValue,
95
+ ) {
96
+ const value = getValue(option);
97
+ return options.find((root) =>
98
+ getOptionChildren(root).some((child) => getValue(child) === value),
99
+ );
100
+ }
101
+
102
+ /** The parent value is present only while all its driving children are. */
103
+ function syncParentValue(
104
+ parent: SelectOption,
105
+ values: unknown[],
106
+ getValue: GetOptionValue,
107
+ ) {
108
+ const parentValue = getValue(parent);
109
+ const selected = new Set(values);
110
+ const rest = values.filter((value) => value !== parentValue);
111
+ const isFull = getDrivingChildren(parent).every((child) =>
112
+ selected.has(getValue(child)),
113
+ );
114
+
115
+ return isFull ? [...rest, parentValue] : rest;
116
+ }
117
+
118
+ /**
119
+ * Checks or unchecks an option. A parent toggles its enabled children; a
120
+ * child or leaf toggles itself. `values` must already include implied
121
+ * children; values unknown to `options` are kept.
122
+ */
123
+ export function toggleOptionValue(
124
+ options: SelectOption[],
125
+ values: unknown[],
126
+ option: SelectOption,
127
+ checked: boolean,
128
+ getValue: GetOptionValue,
129
+ ) {
130
+ const isParent = hasOptionChildren(option);
131
+ const parent = isParent ? option : findParent(options, option, getValue);
132
+ const toggled = isParent
133
+ ? getOptionChildren(option).filter((child) => !child.disabled)
134
+ : [option];
135
+ const toggledValues = toggled.map(getValue);
136
+
137
+ const next = values.filter((value) => !toggledValues.includes(value));
138
+ if (checked) next.push(...toggledValues);
139
+
140
+ return parent ? syncParentValue(parent, next, getValue) : next;
141
+ }
142
+
143
+ /** Selected options in tree order, where a full parent replaces its children. */
144
+ export function getDisplayOptions(
145
+ options: SelectOption[],
146
+ selected: Set<unknown>,
147
+ getValue: GetOptionValue,
148
+ ) {
149
+ const isSelected = (item: SelectOption) => selected.has(getValue(item));
150
+
151
+ return options.flatMap((option) => {
152
+ if (!hasOptionChildren(option)) return isSelected(option) ? [option] : [];
153
+ if (getCheckState(option, selected, getValue) === true) return [option];
154
+ return getOptionChildren(option).filter(isSelected);
155
+ });
156
+ }
@@ -48,6 +48,8 @@
48
48
  "custom": "Custom"
49
49
  }
50
50
  },
51
+ "collapse": "Collapse",
52
+ "expand": "Expand",
51
53
  "search": "Search",
52
54
  "without_results": "No results found"
53
- }
55
+ }
@@ -28,7 +28,7 @@ export default {
28
28
  argTypes: {
29
29
  options: {
30
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.',
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. An optional `children` array (one level) turns the item into a collapsible group: checking the parent selects every child, a partial selection shows the parent as indeterminate, and the closed field lists a fully checked parent once without its children.',
32
32
  },
33
33
  placeholder: {
34
34
  description: 'Text to be displayed in the placeholder.',
@@ -180,6 +180,67 @@ export const WithSearch = {
180
180
  },
181
181
  };
182
182
 
183
+ const topicOptions = [
184
+ {
185
+ label: 'Status do pedido',
186
+ value: 'status-do-pedido',
187
+ children: [
188
+ { label: 'Atraso na entrega', value: 'atraso-na-entrega' },
189
+ { label: 'Rastreamento', value: 'rastreamento' },
190
+ { label: 'Nota fiscal', value: 'nota-fiscal' },
191
+ ],
192
+ },
193
+ {
194
+ label: 'Troca e devolução',
195
+ value: 'troca-e-devolucao',
196
+ children: [
197
+ { label: 'Produto com defeito', value: 'produto-com-defeito' },
198
+ { label: 'Arrependimento', value: 'arrependimento' },
199
+ ],
200
+ },
201
+ {
202
+ label: 'Pagamento',
203
+ value: 'pagamento',
204
+ children: [
205
+ { label: 'Pix', value: 'pix' },
206
+ { label: 'Cartão', value: 'cartao' },
207
+ ],
208
+ },
209
+ {
210
+ label: 'Dúvidas sobre produto',
211
+ value: 'duvidas-sobre-produto',
212
+ children: [
213
+ { label: 'Tamanho', value: 'tamanho' },
214
+ { label: 'Cor', value: 'cor' },
215
+ ],
216
+ },
217
+ {
218
+ label: 'Cancelamento',
219
+ value: 'cancelamento',
220
+ children: [{ label: 'Pedido', value: 'pedido' }],
221
+ },
222
+ { label: 'Unclassified', value: 'unclassified' },
223
+ { label: 'Other', value: 'other' },
224
+ ];
225
+
226
+ export const WithChildren = {
227
+ args: {
228
+ placeholder: 'All topics',
229
+ label: 'Topic',
230
+ options: topicOptions,
231
+ },
232
+ };
233
+
234
+ export const WithChildrenAndSearch = {
235
+ args: {
236
+ placeholder: 'All topics',
237
+ label: 'Topic',
238
+ options: topicOptions,
239
+ enableSearch: true,
240
+ search: '',
241
+ },
242
+ };
243
+
183
244
  export const WithInfiniteScroll = {
184
245
  render: () => ({
185
246
  components: { UnnnicMultiSelect },
@@ -3,7 +3,11 @@ import unnnicSelectTime from '../components/SelectTime/index.vue';
3
3
  export default {
4
4
  title: 'Select/SelectTime',
5
5
  component: unnnicSelectTime,
6
- argTypes: {},
6
+ argTypes: {
7
+ enable24hTime: {
8
+ control: 'boolean',
9
+ },
10
+ },
7
11
  render: (args) => ({
8
12
  components: {
9
13
  unnnicSelectTime,