@agnos-ui/core 0.10.0-next.0 → 0.10.0-next.2

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.
@@ -34,7 +34,7 @@ const defaultAccordionConfig = {
34
34
  itemDestroyOnHide: true,
35
35
  itemAnimated: true,
36
36
  itemTransition: utils_func.noop,
37
- itemHeadingTag: "",
37
+ itemHeadingLevel: 2,
38
38
  itemClassName: "",
39
39
  itemHeaderClassName: "",
40
40
  itemButtonClassName: "",
@@ -56,7 +56,7 @@ const defaultItemConfig = {
56
56
  buttonClassName: defaultAccordionConfig.itemButtonClassName,
57
57
  bodyContainerClassName: defaultAccordionConfig.itemBodyContainerClassName,
58
58
  bodyClassName: defaultAccordionConfig.itemBodyClassName,
59
- headingTag: defaultAccordionConfig.itemHeadingTag
59
+ headingLevel: defaultAccordionConfig.itemHeadingLevel
60
60
  };
61
61
  const coreAccordionItemProps = Object.keys(defaultItemConfig);
62
62
  function getAccordionDefaultConfig() {
@@ -75,7 +75,7 @@ const configAccordionValidator = {
75
75
  itemButtonClassName: utils_writables.typeString,
76
76
  itemBodyContainerClassName: utils_writables.typeString,
77
77
  itemBodyClassName: utils_writables.typeString,
78
- itemHeadingTag: utils_writables.typeString
78
+ itemHeadingLevel: utils_writables.createTypeEnum([1, 2, 3, 4, 5, 6])
79
79
  };
80
80
  const configItemValidator = {
81
81
  id: utils_writables.typeString,
@@ -92,7 +92,7 @@ const configItemValidator = {
92
92
  buttonClassName: utils_writables.typeString,
93
93
  bodyContainerClassName: utils_writables.typeString,
94
94
  bodyClassName: utils_writables.typeString,
95
- headingTag: utils_writables.typeString
95
+ headingLevel: utils_writables.createTypeEnum([1, 2, 3, 4, 5, 6])
96
96
  };
97
97
  function createAccordionItem(config) {
98
98
  const [
@@ -132,7 +132,7 @@ function createAccordionItem(config) {
132
132
  }
133
133
  }
134
134
  });
135
- const shouldBeInDOM$ = tansu.computed(() => destroyOnHide$() === false || !transition.stores.hidden$());
135
+ const shouldBeInDOM$ = tansu.computed(() => !destroyOnHide$() || !transition.stores.hidden$());
136
136
  const toggleDirective = utils_directive.createAttributesDirective(() => ({
137
137
  attributes: {
138
138
  id: tansu.computed(() => `${id$()}-toggle`),
@@ -155,7 +155,8 @@ function createAccordionItem(config) {
155
155
  attributes: {
156
156
  id: tansu.computed(() => `${id$()}-body-container`),
157
157
  class: bodyContainerClassName$,
158
- "aria-labelledby": tansu.computed(() => `${id$()}-toggle`)
158
+ "aria-labelledby": tansu.computed(() => `${id$()}-toggle`),
159
+ role: tansu.readable("region")
159
160
  }
160
161
  }));
161
162
  return {
@@ -2,7 +2,7 @@ import { writablesForProps, idWithDefault, stateStores, true$, mergeConfigStores
2
2
  import { createTransition } from "./services/transitions/baseTransitions.js";
3
3
  import { writable, computed, readable, asWritable } from "@amadeus-it-group/tansu";
4
4
  import { noop } from "./utils/func.js";
5
- import { e as typeString, g as typeFunction, c as typeBoolean } from "./writables-e0tyaQpe.js";
5
+ import { j as createTypeEnum, e as typeString, g as typeFunction, c as typeBoolean } from "./writables-e0tyaQpe.js";
6
6
  import { n as mergeDirectives, p as createAttributesDirective, r as registrationArray, d as directiveSubscribe } from "./dom-Bcg9ORcA.js";
7
7
  import { createWidgetFactory } from "./utils/widget.js";
8
8
  function adjustItemsCloseOthers(items, openItems, oldOpen) {
@@ -33,7 +33,7 @@ const defaultAccordionConfig = {
33
33
  itemDestroyOnHide: true,
34
34
  itemAnimated: true,
35
35
  itemTransition: noop,
36
- itemHeadingTag: "",
36
+ itemHeadingLevel: 2,
37
37
  itemClassName: "",
38
38
  itemHeaderClassName: "",
39
39
  itemButtonClassName: "",
@@ -55,7 +55,7 @@ const defaultItemConfig = {
55
55
  buttonClassName: defaultAccordionConfig.itemButtonClassName,
56
56
  bodyContainerClassName: defaultAccordionConfig.itemBodyContainerClassName,
57
57
  bodyClassName: defaultAccordionConfig.itemBodyClassName,
58
- headingTag: defaultAccordionConfig.itemHeadingTag
58
+ headingLevel: defaultAccordionConfig.itemHeadingLevel
59
59
  };
60
60
  const coreAccordionItemProps = Object.keys(defaultItemConfig);
61
61
  function getAccordionDefaultConfig() {
@@ -74,7 +74,7 @@ const configAccordionValidator = {
74
74
  itemButtonClassName: typeString,
75
75
  itemBodyContainerClassName: typeString,
76
76
  itemBodyClassName: typeString,
77
- itemHeadingTag: typeString
77
+ itemHeadingLevel: createTypeEnum([1, 2, 3, 4, 5, 6])
78
78
  };
79
79
  const configItemValidator = {
80
80
  id: typeString,
@@ -91,7 +91,7 @@ const configItemValidator = {
91
91
  buttonClassName: typeString,
92
92
  bodyContainerClassName: typeString,
93
93
  bodyClassName: typeString,
94
- headingTag: typeString
94
+ headingLevel: createTypeEnum([1, 2, 3, 4, 5, 6])
95
95
  };
96
96
  function createAccordionItem(config) {
97
97
  const [
@@ -131,7 +131,7 @@ function createAccordionItem(config) {
131
131
  }
132
132
  }
133
133
  });
134
- const shouldBeInDOM$ = computed(() => destroyOnHide$() === false || !transition.stores.hidden$());
134
+ const shouldBeInDOM$ = computed(() => !destroyOnHide$() || !transition.stores.hidden$());
135
135
  const toggleDirective = createAttributesDirective(() => ({
136
136
  attributes: {
137
137
  id: computed(() => `${id$()}-toggle`),
@@ -154,7 +154,8 @@ function createAccordionItem(config) {
154
154
  attributes: {
155
155
  id: computed(() => `${id$()}-body-container`),
156
156
  class: bodyContainerClassName$,
157
- "aria-labelledby": computed(() => `${id$()}-toggle`)
157
+ "aria-labelledby": computed(() => `${id$()}-toggle`),
158
+ role: readable("region")
158
159
  }
159
160
  }));
160
161
  return {
@@ -86,11 +86,11 @@ export interface AccordionProps extends WidgetsCommonPropsAndState {
86
86
  */
87
87
  itemBodyClassName: string;
88
88
  /**
89
- * The html tag to use for the accordion-item-header.
89
+ * The html heading level to use for the accordion-item-header.
90
90
  *
91
- * @defaultValue `''`
91
+ * @defaultValue `2`
92
92
  */
93
- itemHeadingTag: string;
93
+ itemHeadingLevel: 1 | 2 | 3 | 4 | 5 | 6;
94
94
  }
95
95
  /**
96
96
  * Represents the state of an Accordion component.
@@ -244,9 +244,9 @@ interface AccordionItemCommonPropsAndState extends WidgetsCommonPropsAndState {
244
244
  */
245
245
  bodyClassName: string;
246
246
  /**
247
- * The html tag to use for the accordion-item-header.
247
+ * The html heading level to use for the accordion-item-header.
248
248
  */
249
- headingTag: string;
249
+ headingLevel: 1 | 2 | 3 | 4 | 5 | 6;
250
250
  }
251
251
  /**
252
252
  * Properties for an AccordionItem component.
@@ -305,7 +305,7 @@ export declare function getAccordionDefaultConfig(): AccordionProps;
305
305
  */
306
306
  export declare function createAccordionItem(config?: PropsConfig<AccordionItemProps>): AccordionItemWidget;
307
307
  /**
308
- * Create an accordion WidgetFactory based on a item factory and the list of item props that should inherit from the parent accordion
308
+ * Create an accordion WidgetFactory based on an item factory and the list of item props that should inherit from the parent accordion
309
309
  *
310
310
  * @param itemFactory - the item factory
311
311
  * @param accordionItemProps - the list of item props
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const accordion = require("../../accordion-yD-czBna.cjs");
3
+ const accordion = require("../../accordion-DRIm0xHf.cjs");
4
4
  exports.createAccordion = accordion.createAccordion;
5
5
  exports.createAccordionItem = accordion.createAccordionItem;
6
6
  exports.factoryCreateAccordion = accordion.factoryCreateAccordion;
@@ -1,4 +1,4 @@
1
- import { a, c, f, g } from "../../accordion-CcirvrjR.js";
1
+ import { a, c, f, g } from "../../accordion-DqnKGmbS.js";
2
2
  export {
3
3
  a as createAccordion,
4
4
  c as createAccordionItem,
@@ -16,6 +16,8 @@ interface EmblaOptions {
16
16
  * Enables choosing a custom container element which holds the slides. By default, Embla will choose the first direct child element of the root element. Provide a valid CSS selector string.
17
17
  *
18
18
  * @see {@link https://www.embla-carousel.com/api/options/#container}
19
+ *
20
+ * @defaultValue `null`
19
21
  */
20
22
  container: string | null;
21
23
  /**
@@ -71,10 +73,14 @@ interface EmblaOptions {
71
73
  interface CarouselCommonPropsState extends Pick<EmblaOptions, 'direction'> {
72
74
  /**
73
75
  * If `true`, 'previous' and 'next' navigation arrows will be visible.
76
+ *
77
+ * @defaultValue `true`
74
78
  */
75
79
  showNavigationArrows: boolean;
76
80
  /**
77
81
  * If `true`, navigation indicators at the bottom of the slide will be visible.
82
+ *
83
+ * @defaultValue `true`
78
84
  */
79
85
  showNavigationIndicators: boolean;
80
86
  }
@@ -89,14 +95,23 @@ export interface CarouselProps extends EmblaOptions, CarouselCommonPropsState {
89
95
  plugins: EmblaPluginType[];
90
96
  /**
91
97
  * Aria label for navigation indicators
98
+ *
99
+ * @defaultValue
100
+ * ```ts
101
+ * (index: number) => `Select slide ${index + 1}`
102
+ * ```
92
103
  */
93
104
  ariaIndicatorLabel: (index: number) => string;
94
105
  /**
95
106
  * Aria label for previous button
107
+ *
108
+ * @defaultValue `'Select previous slide'`
96
109
  */
97
110
  ariaPrevLabel: string;
98
111
  /**
99
112
  * Aria label for next button
113
+ *
114
+ * @defaultValue `'Select next slide'`
100
115
  */
101
116
  ariaNextLabel: string;
102
117
  }
@@ -7,7 +7,7 @@ interface CollapseCommonPropsAndState {
7
7
  /**
8
8
  * If `true` the collapse is visible to the user
9
9
  *
10
- * @defaultValue `true`
10
+ * @defaultValue `false`
11
11
  */
12
12
  visible: boolean;
13
13
  }
@@ -75,7 +75,10 @@ export interface CollapseProps extends CollapseCommonPropsAndState {
75
75
  *
76
76
  * Depending on the value of `animatedOnInit`, the animation can be optionally skipped during the showing process.
77
77
  *
78
- * @defaultValue `() => {}`
78
+ * @defaultValue
79
+ * ```ts
80
+ * () => {}
81
+ * ```
79
82
  */
80
83
  transition: TransitionFn;
81
84
  }
@@ -7,6 +7,12 @@ import type { WidgetsCommonPropsAndState } from '../commonProps';
7
7
  */
8
8
  export type DrawerPositions = 'inline-start' | 'inline-end' | 'block-start' | 'block-end';
9
9
  interface DrawerCommonPropsAndState extends WidgetsCommonPropsAndState {
10
+ /**
11
+ * CSS classes to be applied on the widget main container
12
+ *
13
+ * @defaultValue `'w-full'`
14
+ */
15
+ className: string;
10
16
  /**
11
17
  * Which element should contain the drawer and backdrop DOM elements.
12
18
  * If it is not null, the drawer and backdrop DOM elements are moved to the specified container.
@@ -70,30 +76,44 @@ export interface DrawerProps extends DrawerCommonPropsAndState {
70
76
  backdropTransition: TransitionFn;
71
77
  /**
72
78
  * If `true` opening and closing will be animated.
79
+ *
80
+ * @defaultValue `true`
73
81
  */
74
82
  animated: boolean;
75
83
  /**
76
84
  * aria-labelledby attribute to use for the drawer element.
85
+ *
86
+ * @defaultValue `''`
77
87
  */
78
88
  ariaLabelledBy: string;
79
89
  /**
80
90
  * aria-describedby attribute to use for the drawer element.
91
+ *
92
+ * @defaultValue `''`
81
93
  */
82
94
  ariaDescribedBy: string;
83
95
  /**
84
96
  * The width of the drawer in pixels.
97
+ *
98
+ * @defaultValue `200`
85
99
  */
86
100
  width: number;
87
101
  /**
88
102
  * The height of the drawer in pixels.
103
+ *
104
+ * @defaultValue `200`
89
105
  */
90
106
  height: number;
91
107
  /**
92
108
  * If `true` displays the backdrop element and disables the body scrolling, otherwise the body of the document is navigable
109
+ *
110
+ * @defaultValue `true`
93
111
  */
94
112
  backdrop: boolean;
95
113
  /**
96
114
  * If `true` allows body scrolling when the drawer is open.
115
+ *
116
+ * @defaultValue `false`
97
117
  */
98
118
  bodyScroll: boolean;
99
119
  /**
@@ -248,7 +248,7 @@ export interface SliderProps extends SliderCommonPropsAndState {
248
248
  *
249
249
  * @defaultValue
250
250
  * ```ts
251
- * (value: number) => ''
251
+ * () => ''
252
252
  * ```
253
253
  */
254
254
  ariaValueText: (value: number, sortedIndex: number) => string;
@@ -280,21 +280,21 @@ export interface SliderProps extends SliderCommonPropsAndState {
280
280
  * Minimum distance between two values.
281
281
  * When set to 0, no minimum distance constraint is applied.
282
282
  *
283
- * @defaultValue 0
283
+ * @defaultValue `0`
284
284
  */
285
285
  minRange: number;
286
286
  /**
287
287
  * Maximum distance between two values
288
288
  * When set to 0, no maximum distance constraint is applied.
289
289
  *
290
- * @defaultValue 0
290
+ * @defaultValue `0`
291
291
  */
292
292
  maxRange: number;
293
293
  /**
294
294
  * When true, if moving a value would break the minRange or maxRange constraint,
295
295
  * it will instead push or pull the neighboring values to keep the allowed range rather than just stopping.
296
296
  *
297
- * @defaultValue false
297
+ * @defaultValue `false`
298
298
  */
299
299
  pushRange: boolean;
300
300
  }
@@ -40,12 +40,6 @@ export interface NormalizedTreeItem extends TreeItem {
40
40
  children: NormalizedTreeItem[];
41
41
  }
42
42
  interface TreeCommonPropsAndState extends WidgetsCommonPropsAndState {
43
- /**
44
- * Optional accessibility label for the tree if there is no explicit label
45
- *
46
- * @defaultValue `''`
47
- */
48
- ariaLabel?: string;
49
43
  }
50
44
  /**
51
45
  * Interface representing the properties for the Tree component.
package/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const types = require("./types.cjs");
4
- const accordion = require("./accordion-yD-czBna.cjs");
4
+ const accordion = require("./accordion-DRIm0xHf.cjs");
5
5
  const alert = require("./alert-B-jQDQcB.cjs");
6
6
  const collapse = require("./collapse-gLiT080Y.cjs");
7
7
  const modal = require("./modal-DiXZXYjR.cjs");
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { FACTORY_WIDGET_NAME, INVALID_VALUE } from "./types.js";
2
- import { a, c, f, g } from "./accordion-CcirvrjR.js";
2
+ import { a, c, f, g } from "./accordion-DqnKGmbS.js";
3
3
  import { c as c2, g as g2 } from "./alert-gGz2CDS9.js";
4
4
  import { c as c3, g as g3 } from "./collapse-BV4kD3j9.js";
5
5
  import { c as c4, g as g4, a as a2, b, m } from "./modal-CAvQW-vo.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/core",
3
3
  "description": "Framework-agnostic headless component library.",
4
- "version": "0.10.0-next.0",
4
+ "version": "0.10.0-next.2",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -32,6 +32,8 @@ export declare const removeClasses: (element: SSRHTMLElement, classes?: string[]
32
32
  * @param type - A string representing the event type to listen for.
33
33
  * @param fn - The event listener function or object.
34
34
  * @param options - An options object that specifies characteristics about the event listener.
35
+ * @template K - event type
36
+ * @template T - event object type
35
37
  * @returns A function that removes the event listener from the element.
36
38
  */
37
39
  export declare function addEvent<K extends keyof HTMLElementEventMap, T extends HTMLElementEventMap[K]>(element: EventTarget, type: K, fn: (this: EventTarget, ev: T) => any, options?: boolean | AddEventListenerOptions): () => void;