@volverjs/ui-vue 0.0.10-beta.22 → 0.0.10-beta.24

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 (89) hide show
  1. package/dist/components/VvAccordion/VvAccordion.es.js +119 -79
  2. package/dist/components/VvAccordion/VvAccordion.umd.js +1 -1
  3. package/dist/components/VvAccordion/VvAccordion.vue.d.ts +18 -4
  4. package/dist/components/VvAccordion/index.d.ts +4 -8
  5. package/dist/components/VvAccordionGroup/VvAccordionGroup.es.js +250 -119
  6. package/dist/components/VvAccordionGroup/VvAccordionGroup.umd.js +1 -1
  7. package/dist/components/VvAccordionGroup/VvAccordionGroup.vue.d.ts +18 -6
  8. package/dist/components/VvAccordionGroup/index.d.ts +3 -1
  9. package/dist/components/VvAction/VvAction.vue.d.ts +1 -1
  10. package/dist/components/VvAlert/VvAlert.vue.d.ts +1 -1
  11. package/dist/components/VvButton/VvButton.es.js +92 -98
  12. package/dist/components/VvButton/VvButton.umd.js +1 -1
  13. package/dist/components/VvButton/VvButton.vue.d.ts +7 -7
  14. package/dist/components/VvButton/index.d.ts +11 -11
  15. package/dist/components/VvButtonGroup/VvButtonGroup.es.js +7 -13
  16. package/dist/components/VvButtonGroup/VvButtonGroup.umd.js +1 -1
  17. package/dist/components/VvButtonGroup/VvButtonGroup.vue.d.ts +3 -3
  18. package/dist/components/VvCheckbox/VvCheckbox.es.js +81 -87
  19. package/dist/components/VvCheckbox/VvCheckbox.umd.js +1 -1
  20. package/dist/components/VvCheckbox/VvCheckbox.vue.d.ts +6 -6
  21. package/dist/components/VvCheckbox/index.d.ts +2 -2
  22. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.es.js +15 -29
  23. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.umd.js +1 -1
  24. package/dist/components/VvCheckboxGroup/VvCheckboxGroup.vue.d.ts +5 -5
  25. package/dist/components/VvCombobox/VvCombobox.es.js +13 -16
  26. package/dist/components/VvCombobox/VvCombobox.umd.js +1 -1
  27. package/dist/components/VvCombobox/VvCombobox.vue.d.ts +11 -11
  28. package/dist/components/VvCombobox/index.d.ts +1 -1
  29. package/dist/components/VvDropdown/VvDropdown.vue.d.ts +5 -5
  30. package/dist/components/VvDropdown/VvDropdownAction.vue.d.ts +1 -1
  31. package/dist/components/VvDropdown/VvDropdownOption.vue.d.ts +1 -1
  32. package/dist/components/VvDropdown/index.d.ts +1 -1
  33. package/dist/components/VvInputFile/VvInputFile.es.js +199 -169
  34. package/dist/components/VvInputFile/VvInputFile.umd.js +1 -1
  35. package/dist/components/VvInputFile/VvInputFile.vue.d.ts +55 -9
  36. package/dist/components/VvInputFile/index.d.ts +24 -3
  37. package/dist/components/VvInputText/VvInputClearAction.d.ts +1 -1
  38. package/dist/components/VvInputText/VvInputStepAction.d.ts +1 -1
  39. package/dist/components/VvInputText/VvInputText.vue.d.ts +6 -6
  40. package/dist/components/VvProgress/VvProgress.vue.d.ts +1 -1
  41. package/dist/components/VvRadio/VvRadio.es.js +64 -70
  42. package/dist/components/VvRadio/VvRadio.umd.js +1 -1
  43. package/dist/components/VvRadio/VvRadio.vue.d.ts +6 -6
  44. package/dist/components/VvRadio/index.d.ts +6 -6
  45. package/dist/components/VvRadioGroup/VvRadioGroup.es.js +15 -29
  46. package/dist/components/VvRadioGroup/VvRadioGroup.umd.js +1 -1
  47. package/dist/components/VvRadioGroup/VvRadioGroup.vue.d.ts +5 -5
  48. package/dist/components/VvSelect/VvSelect.vue.d.ts +8 -8
  49. package/dist/components/VvTextarea/VvTextarea.vue.d.ts +5 -5
  50. package/dist/components/VvTooltip/VvTooltip.vue.d.ts +3 -3
  51. package/dist/components/VvTooltip/index.d.ts +1 -1
  52. package/dist/components/index.es.js +478 -324
  53. package/dist/components/index.umd.js +1 -1
  54. package/dist/composables/alert/useInjectAlert.d.ts +1 -6
  55. package/dist/composables/group/useInjectedGroupState.d.ts +4 -5
  56. package/dist/composables/group/useProvideGroupState.d.ts +3 -3
  57. package/dist/constants.d.ts +6 -10
  58. package/dist/icons.es.js +3 -3
  59. package/dist/icons.umd.js +1 -1
  60. package/dist/index.es.js +3 -2
  61. package/dist/index.umd.js +1 -1
  62. package/dist/props/index.d.ts +1 -1
  63. package/dist/resolvers/unplugin.es.js +3 -2
  64. package/dist/resolvers/unplugin.umd.js +1 -1
  65. package/dist/stories/AccordionGroup/AccordionGroup.stories.d.ts +38 -14
  66. package/dist/stories/AccordionGroup/AccordionGroupSlots.stories.d.ts +259 -101
  67. package/dist/types/group.d.ts +37 -15
  68. package/package.json +37 -36
  69. package/src/assets/icons/detailed.json +1 -1
  70. package/src/assets/icons/normal.json +1 -1
  71. package/src/assets/icons/simple.json +1 -1
  72. package/src/components/VvAccordion/VvAccordion.vue +119 -56
  73. package/src/components/VvAccordion/index.ts +8 -23
  74. package/src/components/VvAccordionGroup/VvAccordionGroup.vue +140 -41
  75. package/src/components/VvAccordionGroup/index.ts +3 -1
  76. package/src/components/VvButton/index.ts +7 -12
  77. package/src/components/VvButtonGroup/VvButtonGroup.vue +1 -2
  78. package/src/components/VvCheckbox/index.ts +2 -2
  79. package/src/components/VvCheckboxGroup/VvCheckboxGroup.vue +1 -2
  80. package/src/components/VvInputFile/VvInputFile.vue +72 -47
  81. package/src/components/VvInputFile/index.ts +22 -3
  82. package/src/components/VvRadio/index.ts +5 -5
  83. package/src/components/VvRadioGroup/VvRadioGroup.vue +1 -2
  84. package/src/composables/group/useInjectedGroupState.ts +20 -16
  85. package/src/composables/group/useProvideGroupState.ts +10 -15
  86. package/src/constants.ts +19 -14
  87. package/src/stories/AccordionGroup/AccordionGroup.test.ts +15 -9
  88. package/src/stories/AccordionGroup/AccordionGroupSlots.stories.ts +1 -1
  89. package/src/types/group.ts +22 -14
@@ -12,6 +12,7 @@
12
12
  import VvIcon from '../VvIcon/VvIcon.vue'
13
13
  import HintSlotFactory from '../common/HintSlot'
14
14
  import { VvInputFileProps, type VvInputFileEvents } from '.'
15
+ import Sortable from 'vuedraggable'
15
16
 
16
17
  // props, emit, slots and attrs
17
18
  const props = defineProps(VvInputFileProps)
@@ -66,17 +67,26 @@
66
67
  } = HintSlotFactory(propsDefaults, slots)
67
68
 
68
69
  const localModelValue = useVModel(props, 'modelValue', emit)
69
- const files = computed(() => {
70
- if (
71
- !localModelValue.value ||
72
- (!Array.isArray(localModelValue.value) &&
73
- !(localModelValue.value as File)?.name)
74
- ) {
75
- return []
76
- }
77
- return Array.isArray(localModelValue.value)
78
- ? localModelValue.value
79
- : [localModelValue.value]
70
+ const files = computed({
71
+ get: () => {
72
+ if (
73
+ !localModelValue.value ||
74
+ (!Array.isArray(localModelValue.value) &&
75
+ !(localModelValue.value as File)?.name)
76
+ ) {
77
+ return []
78
+ }
79
+ return Array.isArray(localModelValue.value)
80
+ ? localModelValue.value
81
+ : [localModelValue.value]
82
+ },
83
+ set: (value) => {
84
+ if (isMultiple.value) {
85
+ localModelValue.value = value
86
+ return
87
+ }
88
+ localModelValue.value = value?.[0]
89
+ },
80
90
  })
81
91
 
82
92
  const hasMax = computed(() => {
@@ -250,6 +260,12 @@
250
260
  }
251
261
  return props.iconReplace
252
262
  })
263
+
264
+ const onSortEnd = ({ newIndex }: { newIndex: number | null }) => {
265
+ if (newIndex !== null) {
266
+ selectedFileIndex.value = newIndex
267
+ }
268
+ }
253
269
  </script>
254
270
 
255
271
  <template>
@@ -302,6 +318,7 @@
302
318
  "
303
319
  :multiple="isMultiple"
304
320
  :accept="accept"
321
+ :capture="capture"
305
322
  :name="name"
306
323
  @change="onChange"
307
324
  />
@@ -315,43 +332,51 @@
315
332
  </progress>
316
333
  <VvIcon v-if="hasIconAfter" v-bind="hasIconAfter" />
317
334
  </div>
318
- <ul class="vv-input-file__list">
319
- <li
320
- v-for="(file, index) in files"
321
- :key="index"
322
- class="vv-input-file__item"
323
- :class="{
324
- active:
325
- index === selectedFileIndex &&
326
- hasDropArea &&
327
- files.length > 1,
328
- }"
329
- @click.stop="onClickSelectFile(index)"
330
- >
331
- <button
332
- v-if="hasIconDownload"
333
- type="button"
334
- class="vv-input-file__item-action"
335
- :title="labelDownload"
336
- @click.stop="onClickDownloadFile(file)"
335
+ <Sortable
336
+ v-model="files"
337
+ tag="ul"
338
+ class="vv-input-file__list"
339
+ item-key="name"
340
+ :move="() => sortable"
341
+ @end="onSortEnd"
342
+ >
343
+ <template #item="{ element: file, index }">
344
+ <li
345
+ class="vv-input-file__item"
346
+ :class="{
347
+ active:
348
+ index === selectedFileIndex &&
349
+ hasDropArea &&
350
+ files.length > 1,
351
+ 'cursor-move': sortable,
352
+ }"
353
+ @click.stop="onClickSelectFile(index)"
337
354
  >
338
- <VvIcon v-bind="hasIconDownload" />
339
- </button>
340
- <div class="vv-input-file__item-name">
341
- {{ file.name }}
342
- </div>
343
- <small class="vv-input-file__item-info">
344
- {{ sizeInKiB(file.size) }} KB
345
- </small>
346
- <button
347
- v-if="!readonly"
348
- type="button"
349
- class="vv-input-file__item-remove"
350
- :title="labelRemove"
351
- @click.stop="onClickRemoveFile(index)"
352
- />
353
- </li>
354
- </ul>
355
+ <button
356
+ v-if="hasIconDownload"
357
+ type="button"
358
+ class="vv-input-file__item-action"
359
+ :title="labelDownload"
360
+ @click.stop="onClickDownloadFile(file)"
361
+ >
362
+ <VvIcon v-bind="hasIconDownload" />
363
+ </button>
364
+ <div class="vv-input-file__item-name">
365
+ {{ file.name }}
366
+ </div>
367
+ <small class="vv-input-file__item-info">
368
+ {{ sizeInKiB(file.size) }} KB
369
+ </small>
370
+ <button
371
+ v-if="!readonly"
372
+ type="button"
373
+ class="vv-input-file__item-remove"
374
+ :title="labelRemove"
375
+ @click.stop="onClickRemoveFile(index)"
376
+ />
377
+ </li>
378
+ </template>
379
+ </Sortable>
355
380
  <HintSlot :id="hasHintId" class="vv-input-file__hint">
356
381
  <template v-if="$slots.hint" #hint>
357
382
  <slot name="hint" v-bind="hintSlotScope" />
@@ -13,7 +13,9 @@ import {
13
13
  import { type VvIconProps, ACTION_ICONS } from '../VvIcon'
14
14
 
15
15
  export type VvInputFileEvents = {
16
- 'update:modelValue': [File | undefined]
16
+ 'update:modelValue': [
17
+ File | UploadedFile | (File | UploadedFile)[] | undefined,
18
+ ]
17
19
  }
18
20
 
19
21
  export const VvInputFileProps = {
@@ -30,8 +32,7 @@ export const VvInputFileProps = {
30
32
  * Input value
31
33
  */
32
34
  modelValue: {
33
- type: Object as PropType<File | (File | UploadedFile)[] | UploadedFile>,
34
- required: true,
35
+ type: Object as PropType<File | UploadedFile | (File | UploadedFile)[]>,
35
36
  },
36
37
  /**
37
38
  * Whether to show progress bar
@@ -53,6 +54,20 @@ export const VvInputFileProps = {
53
54
  * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#multiple
54
55
  */
55
56
  multiple: { type: Boolean, default: false },
57
+ /**
58
+ * Front or rear camera
59
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/capture
60
+ */
61
+ capture: {
62
+ type: String as PropType<'user' | 'environment'>,
63
+ default: undefined,
64
+ validation: (value?: string) => {
65
+ if (value === undefined) {
66
+ return true
67
+ }
68
+ return ['user', 'environment'].includes(value)
69
+ },
70
+ },
56
71
  /**
57
72
  * Max number of files
58
73
  */
@@ -61,6 +76,10 @@ export const VvInputFileProps = {
61
76
  * Show drop area
62
77
  */
63
78
  dropArea: { type: Boolean, default: false },
79
+ /**
80
+ * Enable sorting
81
+ */
82
+ sortable: { type: Boolean, default: false },
64
83
  /**
65
84
  * Label for add button
66
85
  */
@@ -1,4 +1,4 @@
1
- import type { ExtractPropTypes, Ref } from 'vue'
1
+ import type { ExtractPropTypes } from 'vue'
2
2
  import type { InputGroupState } from '../../types/group'
3
3
  import { CheckboxRadioProps } from '../../props'
4
4
  import { INJECTION_KEY_RADIO_GROUP } from '../../constants'
@@ -22,13 +22,13 @@ export function useGroupProps(
22
22
 
23
23
  // global props
24
24
  const modelValue = getGroupOrLocalRef('modelValue', props, emit)
25
- const valid = getGroupOrLocalRef('valid', props) as Ref<boolean>
26
- const invalid = getGroupOrLocalRef('invalid', props) as Ref<boolean>
25
+ const valid = getGroupOrLocalRef('valid', props)
26
+ const invalid = getGroupOrLocalRef('invalid', props)
27
27
  const readonly = computed(() =>
28
- Boolean(props.readonly || group?.value?.readonly.value),
28
+ Boolean(props.readonly || group?.readonly.value),
29
29
  )
30
30
  const disabled = computed(() =>
31
- Boolean(props.disabled || group?.value?.disabled.value),
31
+ Boolean(props.disabled || group?.disabled.value),
32
32
  )
33
33
 
34
34
  return {
@@ -29,8 +29,7 @@
29
29
  const { disabled, readonly, vertical, valid, invalid, modifiers } =
30
30
  toRefs(props)
31
31
 
32
- useProvideGroupState<InputGroupState>({
33
- key: INJECTION_KEY_RADIO_GROUP,
32
+ useProvideGroupState<InputGroupState>(INJECTION_KEY_RADIO_GROUP, {
34
33
  modelValue,
35
34
  disabled,
36
35
  readonly,
@@ -1,46 +1,50 @@
1
- import type { Ref } from 'vue'
2
- import type GroupState from '../../types/group'
1
+ import type { Ref, InjectionKey } from 'vue'
3
2
 
4
3
  /**
5
4
  * Injects a group state
6
5
  */
7
- export function useInjectedGroupState<GroupStateType extends GroupState>(
8
- groupKey: string | symbol,
6
+ export function useInjectedGroupState<GroupStateType>(
7
+ groupKey: InjectionKey<GroupStateType>,
9
8
  ) {
10
9
  // Get group state
11
- const group = inject<Ref<GroupStateType> | undefined>(groupKey, undefined)
10
+ const group = inject<GroupStateType | undefined>(groupKey, undefined)
12
11
 
13
12
  // Check if component is in group
14
- const isInGroup = computed(() => !isEmpty(group))
13
+ const isInGroup = computed(() => group !== undefined)
15
14
 
16
15
  /**
17
16
  * Get a group or local property
18
17
  */
19
- function getGroupOrLocalRef<PropsType extends object>(
20
- propName: keyof GroupStateType,
21
- props: PropsType,
18
+ function getGroupOrLocalRef<
19
+ TProps extends object,
20
+ TName extends keyof GroupStateType,
21
+ >(
22
+ propName: TName,
23
+ props: TProps,
22
24
  emit?: (event: string, ...args: unknown[]) => void,
23
25
  ) {
24
- if (group?.value) {
25
- const groupPropValue = unref(group.value)[propName] as Ref<unknown>
26
+ const groupPropValue = group?.[propName] as Ref | undefined
27
+ if (groupPropValue) {
26
28
  return computed({
27
29
  get() {
28
- return groupPropValue?.value
30
+ return groupPropValue.value
29
31
  },
30
32
  set(value: unknown) {
31
33
  groupPropValue.value = value
32
34
  },
33
- })
35
+ }) as GroupStateType[TName]
34
36
  }
35
- const propRef = toRef(props, propName as keyof PropsType)
37
+ const propRef = toRef(props, propName as unknown as keyof TProps)
36
38
  return computed({
37
39
  get() {
38
40
  return propRef.value
39
41
  },
40
42
  set(value: unknown) {
41
- if (emit) emit(`update:${propName as string}`, value)
43
+ if (emit) {
44
+ emit(`update:${propName as string}`, value)
45
+ }
42
46
  },
43
- })
47
+ }) as GroupStateType[TName]
44
48
  }
45
49
 
46
50
  return {
@@ -1,20 +1,15 @@
1
- import type GroupState from '../../types/group'
1
+ import type { Ref, InjectionKey } from 'vue'
2
+ import type { Emitter } from 'mitt'
2
3
 
3
4
  /**
4
5
  * Share part of the state of the component with all its children.
5
- * @param {IGroupState} groupState the group state with all group options
6
6
  */
7
- export function useProvideGroupState<GroupStateType extends GroupState>(
8
- groupState: GroupStateType,
9
- ) {
10
- if (
11
- Object.keys(groupState).some(
12
- (k) => k !== 'key' && !isRef(groupState[k]),
13
- )
14
- )
15
- throw Error("One or more groupState props aren't ref.")
16
- provide(
17
- groupState.key,
18
- computed(() => groupState),
19
- )
7
+ export function useProvideGroupState<
8
+ TGroupState extends Record<
9
+ string,
10
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
+ Ref<unknown> | Emitter<any>
12
+ >,
13
+ >(key: InjectionKey<TGroupState>, groupState: TGroupState) {
14
+ provide(key, groupState)
20
15
  }
package/src/constants.ts CHANGED
@@ -2,6 +2,12 @@ import type { InjectionKey, Ref } from 'vue'
2
2
  import type { Emitter } from 'mitt'
3
3
  import type { Volver } from './Volver'
4
4
  import type { AlertModifiers } from './types/alert'
5
+ import type {
6
+ AccordionGroupState,
7
+ InputGroupState,
8
+ ButtonGroupState,
9
+ AlertGroupState,
10
+ } from './types'
5
11
 
6
12
  export const DEFAULT_ICONIFY_PROVIDER = 'vv'
7
13
 
@@ -73,10 +79,18 @@ export enum AnchorTarget {
73
79
  export const INJECTION_KEY_VOLVER = Symbol.for('volver') as InjectionKey<Volver>
74
80
 
75
81
  // groups
76
- export const INJECTION_KEY_BUTTON_GROUP = Symbol.for('buttonGroup')
77
- export const INJECTION_KEY_RADIO_GROUP = Symbol.for('radioGroup')
78
- export const INJECTION_KEY_CHECK_GROUP = Symbol.for('checkGroup')
79
- export const INJECTION_KEY_ACCORDION_GROUP = Symbol.for('accordionGroup')
82
+ export const INJECTION_KEY_BUTTON_GROUP = Symbol.for(
83
+ 'buttonGroup',
84
+ ) as InjectionKey<ButtonGroupState>
85
+ export const INJECTION_KEY_RADIO_GROUP = Symbol.for(
86
+ 'radioGroup',
87
+ ) as InjectionKey<InputGroupState>
88
+ export const INJECTION_KEY_CHECK_GROUP = Symbol.for(
89
+ 'checkGroup',
90
+ ) as InjectionKey<InputGroupState>
91
+ export const INJECTION_KEY_ACCORDION_GROUP = Symbol.for(
92
+ 'accordionGroup',
93
+ ) as InjectionKey<AccordionGroupState>
80
94
 
81
95
  // dropdown
82
96
  export const INJECTION_KEY_DROPDOWN_TRIGGER = Symbol.for(
@@ -112,10 +126,7 @@ export const INJECTION_KEY_DROPDOWN_ACTION = Symbol.for(
112
126
  // alert
113
127
  export const INJECTION_KEY_ALERT_GROUP = Symbol.for(
114
128
  'alertGroup',
115
- ) as InjectionKey<{
116
- name?: Ref<string | undefined>
117
- bus?: Emitter<{ close: string }>
118
- }>
129
+ ) as InjectionKey<AlertGroupState>
119
130
  export const DEFAULT_ALERT_AUTO_CLOSE = 10000
120
131
  export const DEFAULT_ALERT_MODIFIERS = 'info'
121
132
  export const DEFAULT_ALERT_DISMISSABLE = true
@@ -130,9 +141,3 @@ export const DefaultAlertIconMap = new Map<AlertModifiers, string>([
130
141
  ['warning', DEFAULT_ALERT_WARNING_ICON],
131
142
  ['danger', DEFAULT_ALERT_DANGER_ICON],
132
143
  ])
133
- // {
134
- // success: DEFAULT_ALERT_SUCCESS_ICON,
135
- // info: DEFAULT_ALERT_INFO_ICON,
136
- // warning: DEFAULT_ALERT_WARNING_ICON,
137
- // danger: DEFAULT_ALERT_DANGER_ICON,
138
- // }
@@ -29,12 +29,22 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
29
29
 
30
30
  // open
31
31
  if (!args.disabled && args.items && args.items.length > 0) {
32
- expect(firstChild.open).toBe(args.not ? true : false)
32
+ expect(firstChild.open).toBe(false)
33
33
  expect(firstChildSummary).toBeClicked()
34
34
  await sleep()
35
- expect(firstChild.open).toBe(args.not ? false : true)
35
+ expect(firstChild.open).toBe(true)
36
36
  if (firstChild.open) {
37
- if (args.collapse) {
37
+ if (args.not) {
38
+ expect(JSON.stringify(JSON.parse(value.innerText))).toBe(
39
+ JSON.stringify(
40
+ [
41
+ ...args.items.map(
42
+ (item: { name: string }) => item.name,
43
+ ),
44
+ ].splice(1),
45
+ ),
46
+ )
47
+ } else if (args.collapse) {
38
48
  expect(JSON.stringify(JSON.parse(value.innerText))).toBe(
39
49
  JSON.stringify([args.items[0].name]),
40
50
  )
@@ -42,13 +52,9 @@ export async function defaultTest({ canvasElement, args }: PlayAttributes) {
42
52
  expect(value.innerText).toBe(args.items[0].name)
43
53
  }
44
54
  }
45
- expect(firstChildSummary.getAttribute('aria-expanded')).toBe(
46
- args.not ? 'false' : 'true',
47
- )
55
+ expect(firstChildSummary.getAttribute('aria-expanded')).toBe('true')
48
56
  const content = firstChild.lastChild as HTMLElement
49
- expect(content.getAttribute('aria-hidden')).toBe(
50
- args.not ? 'true' : 'false',
51
- )
57
+ expect(content.getAttribute('aria-hidden')).toBe('false')
52
58
  }
53
59
 
54
60
  // accessibility
@@ -46,7 +46,7 @@ export const Default: Story = {
46
46
  <vv-accordion name="a-3" title="Details 3" :content="content" />
47
47
  </vv-accordion-group>
48
48
  <div class="mt-24" >
49
- Opened: <span data-testId="value">{{ selected }}</span>
49
+ {{ args.not ? 'Closed' : 'Opened'}}: <span data-testId="value">{{ selected }}</span>
50
50
  </div>
51
51
  `,
52
52
  }),
@@ -1,18 +1,11 @@
1
1
  import type { Ref } from 'vue'
2
-
3
- /**
4
- * State shared for a group of elements
5
- */
6
- export default interface GroupState {
7
- // The key of the group
8
- [itemKey: string]: Ref<unknown> | unknown | undefined
9
- key: string | number | symbol
10
- }
2
+ import type { Emitter } from 'mitt'
11
3
 
12
4
  /**
13
5
  * State shared in a group of inputs
14
6
  */
15
- export interface InputGroupState extends GroupState {
7
+ export type InputGroupState = {
8
+ modelValue: Ref<unknown>
16
9
  readonly: Ref<boolean>
17
10
  disabled: Ref<boolean>
18
11
  valid: Ref<boolean>
@@ -22,7 +15,7 @@ export interface InputGroupState extends GroupState {
22
15
  /**
23
16
  * State shared in a group of buttons
24
17
  */
25
- export interface ButtonGroupState extends GroupState {
18
+ export type ButtonGroupState = {
26
19
  modelValue: Ref<
27
20
  string | number | boolean | (string | number | boolean)[] | undefined
28
21
  >
@@ -36,9 +29,24 @@ export interface ButtonGroupState extends GroupState {
36
29
  /**
37
30
  * State shared in a group of accordions
38
31
  */
39
- export interface AccordionGroupState extends GroupState {
40
- collapse: Ref<boolean>
32
+ export type AccordionGroupBusEvents = {
33
+ toggle: { name: string; value: boolean }
34
+ register: { name: string }
35
+ unregister: { name: string }
36
+ expand: { name?: string | string[] }
37
+ collapse: { name?: string | string[] }
38
+ }
39
+ export type AccordionGroupState = {
41
40
  disabled: Ref<boolean>
42
41
  modifiers: Ref<string[] | string | undefined>
43
- not: Ref<boolean>
42
+ bus: Emitter<AccordionGroupBusEvents>
43
+ }
44
+
45
+ /**
46
+ * State shared in a group of alerts
47
+ */
48
+ export type AlertGroupBusEvents = { close: string }
49
+ export type AlertGroupState = {
50
+ name?: Ref<string | undefined>
51
+ bus?: Emitter<AlertGroupBusEvents>
44
52
  }