@avenirs-esr/avenirs-dsav 0.1.56 → 0.1.57

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 (76) hide show
  1. package/dist/avenirs-dsav.css +2 -2
  2. package/dist/components/badges/AvTag/AvTag.stub.d.ts +4 -4
  3. package/dist/components/badges/AvTag/AvTag.vue.d.ts +11 -7
  4. package/dist/components/base/AvFieldset/AvFieldset.stub.d.ts +13 -0
  5. package/dist/components/base/AvFieldset/AvFieldset.test.d.ts +1 -0
  6. package/dist/components/base/AvFieldset/AvFieldset.vue.d.ts +64 -0
  7. package/dist/components/base/AvIcon/AvIcon.stories.d.ts +47 -0
  8. package/dist/components/base/{AvVIcon/AvVIcon.stub.d.ts → AvIcon/AvIcon.stub.d.ts} +5 -1
  9. package/dist/components/base/AvIcon/AvIcon.test.d.ts +1 -0
  10. package/dist/components/base/{AvVIcon/AvVIcon.vue.d.ts → AvIcon/AvIcon.vue.d.ts} +9 -15
  11. package/dist/components/base/AvIconText/AvIconText.stories.d.ts +1 -1
  12. package/dist/components/base/index.d.ts +2 -1
  13. package/dist/components/feedback/AvAlert/AvAlert.vue.d.ts +1 -1
  14. package/dist/components/header/AvHeader/AvHeader.stories.d.ts +28 -0
  15. package/dist/components/header/AvHeader/AvHeader.vue.d.ts +12 -26
  16. package/dist/components/header/AvHeader/injection-key.d.ts +4 -0
  17. package/dist/components/header/AvHeaderMenuLinks/AvHeaderMenuLinks.vue.d.ts +3 -4
  18. package/dist/components/interaction/accordions/AvAccordion/AvAccordion.stories.d.ts +13 -16
  19. package/dist/components/interaction/accordions/AvAccordion/AvAccordion.stub.d.ts +10 -0
  20. package/dist/components/interaction/accordions/AvAccordion/AvAccordion.vue.d.ts +5 -0
  21. package/dist/components/interaction/accordions/AvAccordionsGroup/AvAccordionsGroup.stories.d.ts +5 -12
  22. package/dist/components/interaction/accordions/AvAccordionsGroup/AvAccordionsGroup.vue.d.ts +5 -9
  23. package/dist/components/interaction/accordions/injection-key.d.ts +7 -0
  24. package/dist/components/interaction/buttons/AvButton/AvButton.stub.d.ts +2 -0
  25. package/dist/components/interaction/buttons/AvButton/AvButton.vue.d.ts +6 -14
  26. package/dist/components/interaction/buttons/AvLanguageSelector/AvLanguageSelector.stories.d.ts +26 -0
  27. package/dist/components/interaction/buttons/AvLanguageSelector/AvLanguageSelector.test.d.ts +1 -0
  28. package/dist/components/interaction/buttons/AvLanguageSelector/AvLanguageSelector.vue.d.ts +38 -0
  29. package/dist/components/interaction/buttons/index.d.ts +1 -0
  30. package/dist/components/interaction/checkboxes/AvCheckbox/AvChecbox.stories.d.ts +36 -0
  31. package/dist/components/interaction/checkboxes/AvCheckbox/AvCheckbox.stub.d.ts +49 -0
  32. package/dist/components/interaction/checkboxes/AvCheckbox/AvCheckbox.test.d.ts +1 -0
  33. package/dist/components/interaction/checkboxes/AvCheckbox/AvCheckbox.vue.d.ts +71 -0
  34. package/dist/components/interaction/checkboxes/index.d.ts +1 -0
  35. package/dist/components/interaction/files/AvFileUpload/AvFileUpload.vue.d.ts +1 -1
  36. package/dist/components/interaction/index.d.ts +1 -0
  37. package/dist/components/interaction/inputs/AvInput/AvInput.stories.d.ts +7 -7
  38. package/dist/components/interaction/inputs/AvInput/AvInput.vue.d.ts +18 -9
  39. package/dist/components/interaction/inputs/AvSearchBar/AvSearchBar.stories.d.ts +27 -0
  40. package/dist/components/interaction/inputs/AvSearchBar/AvSearchBar.test.d.ts +1 -0
  41. package/dist/components/interaction/inputs/AvSearchBar/AvSearchBar.vue.d.ts +35 -0
  42. package/dist/components/interaction/inputs/index.d.ts +1 -0
  43. package/dist/components/interaction/lists/AvListItem/AvListItem.stub.d.ts +2 -2
  44. package/dist/components/interaction/radios/AvRadioButtonSet/AvRadioButtonSet.vue.d.ts +10 -0
  45. package/dist/components/interaction/radios/AvRadioButtonSet/components/RadioButton.vue.d.ts +50 -0
  46. package/dist/components/interaction/selects/AvAutocomplete/AvAutocomplete.stories.d.ts +13 -13
  47. package/dist/components/interaction/selects/AvAutocomplete/AvAutocomplete.stub.d.ts +1 -1
  48. package/dist/components/interaction/selects/AvAutocomplete/AvAutocomplete.vue.d.ts +7 -7
  49. package/dist/components/interaction/selects/AvAutocomplete/AvAutocompleteContext.d.ts +1 -1
  50. package/dist/components/interaction/selects/AvAutocomplete/AvAutocompleteDropdown.vue.d.ts +2 -2
  51. package/dist/components/interaction/selects/AvAutocomplete/AvAutocompleteInput.vue.d.ts +63 -117
  52. package/dist/components/interaction/selects/AvAutocomplete/AvAutocompleteSelectedTags.vue.d.ts +3 -3
  53. package/dist/components/interaction/selects/AvMultiselect/AvMultiselect.stories.d.ts +6 -4
  54. package/dist/components/interaction/selects/AvMultiselect/AvMultiselect.types.d.ts +17 -0
  55. package/dist/components/interaction/selects/AvMultiselect/AvMultiselect.vue.d.ts +34 -27
  56. package/dist/components/interaction/selects/AvMultiselect/components/MultiselectCollapse.test.d.ts +1 -0
  57. package/dist/components/interaction/selects/AvMultiselect/components/MultiselectCollapse.vue.d.ts +39 -0
  58. package/dist/components/interaction/selects/index.d.ts +2 -1
  59. package/dist/components/interaction/toggles/AvToggle/AvToggle.stories.d.ts +2 -0
  60. package/dist/components/interaction/toggles/AvToggle/AvToggle.stub.d.ts +4 -4
  61. package/dist/components/navigation/AvBreadcrumb/AvBreadcrumb.stories.d.ts +2 -0
  62. package/dist/composables/index.d.ts +1 -0
  63. package/dist/composables/use-collapsable/use-collapsable.d.ts +101 -0
  64. package/dist/composables/use-collapsable/use-collapsable.test.d.ts +1 -0
  65. package/dist/index.cjs.js +8 -8
  66. package/dist/index.d.ts +0 -1
  67. package/dist/index.es.js +6601 -6834
  68. package/dist/injection-key.cjs.js +1 -0
  69. package/dist/injection-key.es.js +4 -0
  70. package/dist/test-utils.cjs.js +39 -12
  71. package/dist/test-utils.es.js +105 -44
  72. package/dist/tests/index.d.ts +5 -2
  73. package/dist/tests/stubs.d.ts +0 -43
  74. package/package.json +2 -1
  75. package/dist/components/base/AvVIcon/AvVIcon.stories.d.ts +0 -40
  76. package/dist/types/index.d.ts +0 -2
@@ -0,0 +1,39 @@
1
+ import type { Slot } from 'vue';
2
+ import type { AvMultiselectOption } from '@/components/interaction/selects/AvMultiselect/AvMultiselect.types';
3
+ import type { UseCollapsableReturn } from '@/composables/use-collapsable/use-collapsable';
4
+ export interface MultiselectCollapseProps {
5
+ isVisible: boolean;
6
+ selected: AvMultiselectOption[];
7
+ options: AvMultiselectOption[];
8
+ hint?: string;
9
+ legend?: string;
10
+ id: string;
11
+ selectAll?: boolean;
12
+ search?: boolean;
13
+ selectAllLabel?: [string, string];
14
+ maxOverflowHeight?: CSSStyleDeclaration['maxHeight'];
15
+ useCollapsableReturn: Omit<UseCollapsableReturn, 'adjust'>;
16
+ noResultLabel?: string;
17
+ }
18
+ type __VLS_Props = MultiselectCollapseProps;
19
+ type __VLS_Slots = {
20
+ 'legend'?: Slot;
21
+ 'no-results'?: Slot;
22
+ };
23
+ type __VLS_PublicProps = __VLS_Props & {
24
+ modelValue: (string | number)[];
25
+ };
26
+ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
27
+ "update:modelValue": (value: (string | number)[]) => any;
28
+ } & {
29
+ close: () => any;
30
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
+ onClose?: (() => any) | undefined;
32
+ "onUpdate:modelValue"?: ((value: (string | number)[]) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, __VLS_Slots>;
34
+ export default _default;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
@@ -1,4 +1,5 @@
1
1
  export * from './AvAutocomplete/AvAutocomplete.types';
2
2
  export { default as AvAutocomplete } from './AvAutocomplete/AvAutocomplete.vue';
3
- export { default as AvMultiselect, type AvMultiselectOption, type AvMultiselectProps } from './AvMultiselect/AvMultiselect.vue';
3
+ export type { AvMultiselectOption } from './AvMultiselect/AvMultiselect.types';
4
+ export { default as AvMultiselect, type AvMultiselectProps } from './AvMultiselect/AvMultiselect.vue';
4
5
  export { default as AvSelect } from './AvSelect/AvSelect.vue';
@@ -1,6 +1,8 @@
1
1
  import type { Meta, StoryFn } from '@storybook/vue3';
2
2
  import { type AvToggleProps } from '@/components/interaction/toggles/AvToggle/AvToggle.vue';
3
3
  /**
4
+ * <h1 class="n1">Toggles - <code>AvToggle</code></h1>
5
+ *
4
6
  * <h2 class="n2">✨ Introduction</h2>
5
7
  *
6
8
  * <p>
@@ -1,17 +1,17 @@
1
1
  export declare const AvToggleStub: import("vue").DefineComponent<{
2
- name?: any;
3
2
  id?: any;
4
- modelValue?: any;
3
+ name?: any;
5
4
  disabled?: any;
6
5
  description?: any;
6
+ modelValue?: any;
7
7
  activeText?: any;
8
8
  inactiveText?: any;
9
9
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:modelValue"[], "update:modelValue", import("vue").PublicProps, Readonly<{
10
- name?: any;
11
10
  id?: any;
12
- modelValue?: any;
11
+ name?: any;
13
12
  disabled?: any;
14
13
  description?: any;
14
+ modelValue?: any;
15
15
  activeText?: any;
16
16
  inactiveText?: any;
17
17
  }> & Readonly<{
@@ -1,6 +1,8 @@
1
1
  import type { Meta, StoryFn } from '@storybook/vue3';
2
2
  import { type AvBreadcrumbProps } from '@/components/navigation/AvBreadcrumb/AvBreadcrumb.vue';
3
3
  /**
4
+ * <h1 class="n1">Navigation - <code>AvBreadcrumb</code></h1>
5
+ *
4
6
  * <h2 class="n2">✨ Introduction</h2>
5
7
  *
6
8
  * <p>
@@ -1,3 +1,4 @@
1
1
  export * from './use-av-breakpoints/use-av-breakpoints';
2
+ export * from './use-collapsable/use-collapsable';
2
3
  export * from './use-focus-trap/use-focus-trap';
3
4
  export * from './use-global-background-color/use-global-background-color';
@@ -0,0 +1,101 @@
1
+ import type { Ref } from 'vue';
2
+ /**
3
+ * Return type of the {@link useCollapsable} composable.
4
+ *
5
+ * This composable provides a reactive API to manage a collapsible section
6
+ * (expand/collapse behavior) in sync with DSFR's CSS-based collapse system.
7
+ *
8
+ * It exposes the current state (`collapsing`, `cssExpanded`),
9
+ * DOM reference (`collapse`), and imperative methods to adjust or toggle
10
+ * the collapsible container.
11
+ */
12
+ export interface UseCollapsableReturn {
13
+ /**
14
+ * Reference to the collapsible container element.
15
+ * Should be bound via `ref="collapse"` in the template.
16
+ */
17
+ collapse: Ref<HTMLElement | undefined>;
18
+ /**
19
+ * Indicates whether a transition (expand/collapse animation)
20
+ * is currently in progress.
21
+ */
22
+ collapsing: Ref<boolean>;
23
+ /**
24
+ * Reflects the final expanded/collapsed CSS state.
25
+ * True if the section is expanded, false if collapsed.
26
+ */
27
+ cssExpanded: Ref<boolean>;
28
+ /**
29
+ * Programmatically toggles expansion or collapse of the container.
30
+ *
31
+ * This method updates internal CSS variables and waits for
32
+ * the next `requestAnimationFrame` to ensure transitions are properly triggered.
33
+ *
34
+ * @param {boolean} newValue - `true` to expand, `false` to collapse.
35
+ * @example
36
+ * ```ts
37
+ * const { doExpand } = useCollapsable()
38
+ * doExpand(true) // expands the container
39
+ * ```
40
+ */
41
+ doExpand: (newValue: boolean) => void;
42
+ /**
43
+ * Recomputes the current collapsible height and updates
44
+ * the related CSS custom properties.
45
+ *
46
+ * Should be called before starting an animation or when content changes dynamically.
47
+ *
48
+ * Mirrors DSFR’s internal behavior:
49
+ * {@link https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/collapse/collapse.js#L61 collapse.js#L61}
50
+ */
51
+ adjust: () => void;
52
+ /**
53
+ * Callback to handle the end of a CSS transition.
54
+ *
55
+ * Typically attached to a `transitionend` event listener
56
+ * to finalize the expand/collapse state.
57
+ *
58
+ * - Resets internal flags.
59
+ * - Optionally focuses the first anchor (`<a>`) when expanded.
60
+ * - Removes collapse height restrictions when fully collapsed.
61
+ *
62
+ * @param {boolean} expanded - Final expanded state (`true` = expanded, `false` = collapsed).
63
+ * @param {boolean} [autoFocus=true] - If true, focus the first anchor after expansion.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const { onTransitionEnd } = useCollapsable()
68
+ * collapse.value?.addEventListener('transitionend', () => onTransitionEnd(cssExpanded.value))
69
+ * ```
70
+ *
71
+ * @see {@link https://github.com/GouvernementFR/dsfr/blob/main/src/core/script/collapse/collapse.js#L25 collapse.js#L25}
72
+ */
73
+ onTransitionEnd: (expanded: boolean, autoFocus?: boolean) => void;
74
+ }
75
+ /**
76
+ * Vue composable providing a reactive API for collapsible sections,
77
+ * consistent with DSFR’s collapse mechanism.
78
+ *
79
+ * It manages internal CSS variables (`--collapse`, `--collapse-max-height`) and
80
+ * state flags (`collapsing`, `cssExpanded`) to synchronize DOM transitions.
81
+ *
82
+ * @example
83
+ * ```vue
84
+ * <template>
85
+ * <div ref="collapse" class="fr-collapse" @transitionend="onTransitionEnd(cssExpanded)">
86
+ * <slot />
87
+ * </div>
88
+ * <button @click="doExpand(!cssExpanded)">Toggle</button>
89
+ * </template>
90
+ *
91
+ * <script setup lang="ts">
92
+ * import { useCollapsable } from '@avenirs-esr/avenirs-dsav'
93
+ *
94
+ * const { collapse, cssExpanded, doExpand, onTransitionEnd } = useCollapsable()
95
+ * </script>
96
+ * ```
97
+ *
98
+ * @returns {UseCollapsableReturn} Object exposing the reactive refs and methods
99
+ * to control collapsible elements.
100
+ */
101
+ export declare function useCollapsable(): UseCollapsableReturn;