@agnos-ui/core 0.4.4 → 0.5.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 (113) hide show
  1. package/README.md +2 -2
  2. package/{accordion-BnaSamoQ.js → accordion-BGv150k9.js} +10 -13
  3. package/{accordion-DmPT0O0j.cjs → accordion-Lp-LEbZ2.cjs} +10 -13
  4. package/{alert-CEFbEgvG.cjs → alert-Bq101evB.cjs} +1 -1
  5. package/{alert-DdGuK__c.js → alert-DJ2l7bcA.js} +1 -1
  6. package/{common-CO5b5G_J.js → common-Banw3FYN.js} +15 -14
  7. package/{common-nxv_hKNE.cjs → common-DvPjK7SS.cjs} +15 -14
  8. package/components/accordion/accordion.d.ts +35 -8
  9. package/components/accordion/index.cjs +1 -1
  10. package/components/accordion/index.js +1 -1
  11. package/components/alert/alert.d.ts +16 -1
  12. package/components/alert/common.d.ts +19 -1
  13. package/components/alert/index.cjs +1 -1
  14. package/components/alert/index.js +1 -1
  15. package/components/commonProps.d.ts +3 -0
  16. package/components/modal/index.cjs +1 -1
  17. package/components/modal/index.js +1 -1
  18. package/components/modal/modal.d.ts +3 -135
  19. package/components/pagination/index.cjs +1 -1
  20. package/components/pagination/index.js +1 -1
  21. package/components/pagination/pagination.d.ts +30 -217
  22. package/components/progressbar/index.cjs +1 -1
  23. package/components/progressbar/index.js +1 -1
  24. package/components/progressbar/progressbar.d.ts +13 -3
  25. package/components/rating/index.cjs +1 -1
  26. package/components/rating/index.js +1 -1
  27. package/components/rating/rating.d.ts +26 -115
  28. package/components/select/index.cjs +1 -1
  29. package/components/select/index.js +1 -1
  30. package/components/select/select.d.ts +21 -148
  31. package/components/slider/index.cjs +1 -1
  32. package/components/slider/index.js +1 -1
  33. package/components/slider/slider.d.ts +31 -126
  34. package/components/toast/index.cjs +1 -1
  35. package/components/toast/index.js +1 -1
  36. package/components/toast/toast.d.ts +16 -1
  37. package/config.d.ts +17 -1
  38. package/{directive-3-8yr-ZK.js → directive-CKEccryv.js} +11 -5
  39. package/{directive-j-xRk-h3.cjs → directive-DdlwGFtf.cjs} +11 -5
  40. package/index.cjs +13 -13
  41. package/index.js +15 -15
  42. package/{modal-D4d8sy85.cjs → modal-DDHcrykD.cjs} +10 -21
  43. package/{modal-CeTI4jxI.js → modal-DP-4I7vf.js} +11 -22
  44. package/package.json +6 -5
  45. package/{pagination-B9WFv70F.cjs → pagination-CBysiPUs.cjs} +23 -35
  46. package/{pagination-BpPHKQsH.js → pagination-DwDRot6q.js} +23 -35
  47. package/{progressbar-BybOg5FE.js → progressbar-CGmNq0cS.js} +3 -4
  48. package/{progressbar-DXCMeJvL.cjs → progressbar-DghzCJ6_.cjs} +3 -4
  49. package/{rating-D6Tv_4Vx.js → rating-Da38uaZz.js} +61 -54
  50. package/{rating-C2Y95r50.cjs → rating-DlfOuwuX.cjs} +61 -54
  51. package/{select-jUrt_lSn.js → select-CAEPqdz1.js} +92 -72
  52. package/{select-BBiF-m3N.cjs → select-LBVhNdrd.cjs} +92 -72
  53. package/services/extendWidget.d.ts +37 -4
  54. package/services/floatingUI.cjs +3 -2
  55. package/services/floatingUI.d.ts +28 -27
  56. package/services/floatingUI.js +3 -2
  57. package/services/focustrack.cjs +1 -1
  58. package/services/focustrack.d.ts +21 -0
  59. package/services/focustrack.js +1 -1
  60. package/services/hash.d.ts +2 -1
  61. package/services/intersection.cjs +1 -1
  62. package/services/intersection.d.ts +9 -13
  63. package/services/intersection.js +1 -1
  64. package/services/matchMedia.cjs +1 -1
  65. package/services/matchMedia.d.ts +2 -1
  66. package/services/matchMedia.js +1 -1
  67. package/services/navManager.cjs +1 -1
  68. package/services/navManager.d.ts +85 -41
  69. package/services/navManager.js +1 -1
  70. package/services/portal.cjs +1 -1
  71. package/services/portal.d.ts +3 -0
  72. package/services/portal.js +1 -1
  73. package/services/resizeObserver.cjs +2 -2
  74. package/services/resizeObserver.d.ts +2 -6
  75. package/services/resizeObserver.js +2 -2
  76. package/services/siblingsInert.cjs +3 -3
  77. package/services/siblingsInert.d.ts +3 -5
  78. package/services/siblingsInert.js +3 -3
  79. package/services/transitions/baseTransitions.cjs +4 -5
  80. package/services/transitions/baseTransitions.d.ts +21 -4
  81. package/services/transitions/baseTransitions.js +4 -5
  82. package/services/transitions/collapse.cjs +1 -1
  83. package/services/transitions/collapse.d.ts +6 -0
  84. package/services/transitions/collapse.js +1 -1
  85. package/services/transitions/cssTransitions.cjs +1 -1
  86. package/services/transitions/cssTransitions.d.ts +3 -0
  87. package/services/transitions/cssTransitions.js +1 -1
  88. package/services/transitions/simpleClassTransition.cjs +1 -1
  89. package/services/transitions/simpleClassTransition.d.ts +9 -2
  90. package/services/transitions/simpleClassTransition.js +1 -1
  91. package/{slider-ByDkbyr1.js → slider-DYrwS7Mv.js} +118 -116
  92. package/{slider-BdsZpxJr.cjs → slider-DlOAawbZ.cjs} +118 -116
  93. package/{toast-BzxextBQ.js → toast-CpvsibAI.js} +3 -3
  94. package/{toast-Dy3ck2cM.cjs → toast-D_uSrRZL.cjs} +3 -3
  95. package/types.cjs +0 -8
  96. package/types.d.ts +151 -19
  97. package/types.js +1 -9
  98. package/utils/directive.cjs +1 -1
  99. package/utils/directive.d.ts +81 -32
  100. package/utils/directive.js +1 -1
  101. package/utils/internal/checks.d.ts +6 -0
  102. package/utils/internal/dom.d.ts +5 -5
  103. package/utils/internal/promise.d.ts +9 -0
  104. package/utils/internal/sort.d.ts +2 -2
  105. package/utils/internal/ssrHTMLElement.d.ts +4 -0
  106. package/utils/stores.cjs +1 -1
  107. package/utils/stores.d.ts +80 -42
  108. package/utils/stores.js +1 -1
  109. package/utils/writables.cjs +2 -1
  110. package/utils/writables.d.ts +52 -3
  111. package/utils/writables.js +2 -1
  112. package/{writables-D46sFgGK.cjs → writables-BPAJvaL_.cjs} +9 -0
  113. package/{writables-DoU_XYTX.js → writables-DCiBdIBK.js} +11 -2
package/config.d.ts CHANGED
@@ -8,9 +8,22 @@ import type { AccordionProps } from './components/accordion/accordion';
8
8
  import type { ProgressbarProps } from './components/progressbar/progressbar';
9
9
  import type { SliderProps } from './components/slider/slider';
10
10
  import type { ToastProps } from './components/toast/toast';
11
+ /**
12
+ * A utility type that makes all properties of an object type `T` optional,
13
+ * and also makes all properties of the nested objects within `T` optional.
14
+ *
15
+ * @template T - The object type to be transformed.
16
+ */
11
17
  export type Partial2Levels<T> = Partial<{
12
18
  [Level1 in keyof T]: Partial<T[Level1]>;
13
19
  }>;
20
+ /**
21
+ * Represents a store for widget configurations with support for partial updates
22
+ * at two levels of depth. This store includes signals for its own state, an optional
23
+ * parent state, and an optional adapted parent state.
24
+ *
25
+ * @template T - The type of the widget configuration.
26
+ */
14
27
  export type WidgetsConfigStore<T> = WritableSignal<Partial2Levels<T>> & {
15
28
  own$: WritableSignal<Partial2Levels<T>>;
16
29
  parent$: undefined | WritableSignal<Partial2Levels<T>>;
@@ -45,7 +58,10 @@ export declare const mergeInto: <T>(destination: T, source: T | undefined, level
45
58
  * parent$, adaptedParent$ (containing the value computed after the first step), and own$ (that contains only overridding properties).
46
59
  * The resulting store is writable, its set function is actually the set function of the own$ store.
47
60
  */
48
- export declare const createWidgetsConfig: <T>(parent$?: WidgetsConfigStore<T> | undefined, adaptParentConfig?: (config: Partial2Levels<T>) => Partial2Levels<T>) => WidgetsConfigStore<T>;
61
+ export declare const createWidgetsConfig: <T>(parent$?: WidgetsConfigStore<T>, adaptParentConfig?: (config: Partial2Levels<T>) => Partial2Levels<T>) => WidgetsConfigStore<T>;
62
+ /**
63
+ * Configuration for various widgets used in the application.
64
+ */
49
65
  export type WidgetsConfig = {
50
66
  /**
51
67
  * the pagination widget config
@@ -142,13 +142,19 @@ const isBrowserHTMLElement = BROWSER ? (element) => {
142
142
  var _a;
143
143
  const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
144
144
  return element instanceof contentWindow.HTMLElement;
145
- } : (element) => false;
145
+ } : (
146
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
147
+ (element) => false
148
+ );
146
149
  const browserDirective = BROWSER ? (directive) => (node, args) => {
147
150
  if (isBrowserHTMLElement(node)) {
148
151
  return directive(node, args);
149
152
  }
150
- } : (directive) => () => {
151
- };
153
+ } : (
154
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
155
+ (directive) => () => {
156
+ }
157
+ );
152
158
  const bindDirective = (directive, directiveArg$) => (element) => {
153
159
  let firstTime = true;
154
160
  let instance;
@@ -189,13 +195,13 @@ const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
189
195
  return {
190
196
  destroy: async () => {
191
197
  if (asyncUnsubscribe) {
192
- await 0;
198
+ await Promise.resolve();
193
199
  }
194
200
  unsubscribe();
195
201
  }
196
202
  };
197
203
  };
198
- const directiveUpdate = (update) => (element, arg) => {
204
+ const directiveUpdate = (update) => (_element, arg) => {
199
205
  update(arg);
200
206
  return {
201
207
  update
@@ -143,13 +143,19 @@ const isBrowserHTMLElement = esmEnv.BROWSER ? (element) => {
143
143
  var _a;
144
144
  const contentWindow = ((_a = element == null ? void 0 : element.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
145
145
  return element instanceof contentWindow.HTMLElement;
146
- } : (element) => false;
146
+ } : (
147
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
148
+ (element) => false
149
+ );
147
150
  const browserDirective = esmEnv.BROWSER ? (directive) => (node, args) => {
148
151
  if (isBrowserHTMLElement(node)) {
149
152
  return directive(node, args);
150
153
  }
151
- } : (directive) => () => {
152
- };
154
+ } : (
155
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
156
+ (directive) => () => {
157
+ }
158
+ );
153
159
  const bindDirective = (directive, directiveArg$) => (element) => {
154
160
  let firstTime = true;
155
161
  let instance;
@@ -190,13 +196,13 @@ const directiveSubscribe = (store, asyncUnsubscribe = true) => () => {
190
196
  return {
191
197
  destroy: async () => {
192
198
  if (asyncUnsubscribe) {
193
- await 0;
199
+ await Promise.resolve();
194
200
  }
195
201
  unsubscribe();
196
202
  }
197
203
  };
198
204
  };
199
- const directiveUpdate = (update) => (element, arg) => {
205
+ const directiveUpdate = (update) => (_element, arg) => {
200
206
  update(arg);
201
207
  return {
202
208
  update
package/index.cjs CHANGED
@@ -1,15 +1,15 @@
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-DmPT0O0j.cjs");
5
- const alert = require("./alert-CEFbEgvG.cjs");
6
- const modal = require("./modal-D4d8sy85.cjs");
7
- const pagination = require("./pagination-B9WFv70F.cjs");
8
- const progressbar = require("./progressbar-DXCMeJvL.cjs");
9
- const rating = require("./rating-C2Y95r50.cjs");
10
- const select = require("./select-BBiF-m3N.cjs");
11
- const slider = require("./slider-BdsZpxJr.cjs");
12
- const toast = require("./toast-Dy3ck2cM.cjs");
4
+ const accordion = require("./accordion-Lp-LEbZ2.cjs");
5
+ const alert = require("./alert-Bq101evB.cjs");
6
+ const modal = require("./modal-DDHcrykD.cjs");
7
+ const pagination = require("./pagination-CBysiPUs.cjs");
8
+ const progressbar = require("./progressbar-DghzCJ6_.cjs");
9
+ const rating = require("./rating-DlfOuwuX.cjs");
10
+ const select = require("./select-LBVhNdrd.cjs");
11
+ const slider = require("./slider-DlOAawbZ.cjs");
12
+ const toast = require("./toast-D_uSrRZL.cjs");
13
13
  const config = require("./config.cjs");
14
14
  const services_extendWidget = require("./services/extendWidget.cjs");
15
15
  const services_floatingUI = require("./services/floatingUI.cjs");
@@ -24,11 +24,10 @@ const services_hash = require("./services/hash.cjs");
24
24
  const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
25
25
  const services_transitions_cssTransitions = require("./services/transitions/cssTransitions.cjs");
26
26
  const services_transitions_simpleClassTransition = require("./services/transitions/simpleClassTransition.cjs");
27
- const utils_directive = require("./directive-j-xRk-h3.cjs");
27
+ const utils_directive = require("./directive-DdlwGFtf.cjs");
28
28
  const utils_stores = require("./utils/stores.cjs");
29
- const utils_writables = require("./writables-D46sFgGK.cjs");
29
+ const utils_writables = require("./writables-BPAJvaL_.cjs");
30
30
  exports.INVALID_VALUE = types.INVALID_VALUE;
31
- exports.toSlotContextWidget = types.toSlotContextWidget;
32
31
  exports.createAccordion = accordion.createAccordion;
33
32
  exports.createAccordionItem = accordion.createAccordionItem;
34
33
  exports.factoryCreateAccordion = accordion.factoryCreateAccordion;
@@ -64,7 +63,7 @@ exports.getKeyName = services_navManager.getKeyName;
64
63
  exports.isInternalInputNavigation = services_navManager.isInternalInputNavigation;
65
64
  exports.portal = services_portal.portal;
66
65
  exports.createResizeObserver = services_resizeObserver.createResizeObserver;
67
- exports.sliblingsInert = services_siblingsInert.sliblingsInert;
66
+ exports.siblingsInert = services_siblingsInert.siblingsInert;
68
67
  exports.hash$ = services_hash.hash$;
69
68
  exports.createTransition = services_transitions_baseTransitions.createTransition;
70
69
  exports.noAnimation = services_transitions_baseTransitions.noAnimation;
@@ -104,6 +103,7 @@ exports.toWritableStore = utils_stores.toWritableStore;
104
103
  exports.writableWithDefault = utils_stores.writableWithDefault;
105
104
  exports.writablesForProps = utils_stores.writablesForProps;
106
105
  exports.writablesWithDefault = utils_stores.writablesWithDefault;
106
+ exports.createTypeEnum = utils_writables.createTypeEnum;
107
107
  exports.testToNormalizeValue = utils_writables.testToNormalizeValue;
108
108
  exports.typeArray = utils_writables.typeArray;
109
109
  exports.typeBoolean = utils_writables.typeBoolean;
package/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import { INVALID_VALUE, toSlotContextWidget } from "./types.js";
2
- import { a, c, f, g } from "./accordion-BnaSamoQ.js";
3
- import { c as c2, g as g2 } from "./alert-DdGuK__c.js";
4
- import { c as c3, g as g3, a as a2, m } from "./modal-CeTI4jxI.js";
5
- import { c as c4, g as g4 } from "./pagination-BpPHKQsH.js";
6
- import { c as c5, g as g5 } from "./progressbar-BybOg5FE.js";
7
- import { c as c6, g as g6 } from "./rating-D6Tv_4Vx.js";
8
- import { c as c7, g as g7 } from "./select-jUrt_lSn.js";
9
- import { c as c8, g as g8 } from "./slider-ByDkbyr1.js";
10
- import { c as c9, g as g9 } from "./toast-BzxextBQ.js";
1
+ import { INVALID_VALUE } from "./types.js";
2
+ import { a, c, f, g } from "./accordion-BGv150k9.js";
3
+ import { c as c2, g as g2 } from "./alert-DJ2l7bcA.js";
4
+ import { c as c3, g as g3, a as a2, m } from "./modal-DP-4I7vf.js";
5
+ import { c as c4, g as g4 } from "./pagination-DwDRot6q.js";
6
+ import { c as c5, g as g5 } from "./progressbar-CGmNq0cS.js";
7
+ import { c as c6, g as g6 } from "./rating-Da38uaZz.js";
8
+ import { c as c7, g as g7 } from "./select-CAEPqdz1.js";
9
+ import { c as c8, g as g8 } from "./slider-DYrwS7Mv.js";
10
+ import { c as c9, g as g9 } from "./toast-CpvsibAI.js";
11
11
  import { createWidgetsConfig, mergeInto } from "./config.js";
12
12
  import { extendWidgetProps } from "./services/extendWidget.js";
13
13
  import { createFloatingUI } from "./services/floatingUI.js";
@@ -17,14 +17,14 @@ import { createMatchMedia } from "./services/matchMedia.js";
17
17
  import { createNavManager, getKeyName, isInternalInputNavigation } from "./services/navManager.js";
18
18
  import { portal } from "./services/portal.js";
19
19
  import { createResizeObserver } from "./services/resizeObserver.js";
20
- import { sliblingsInert } from "./services/siblingsInert.js";
20
+ import { siblingsInert } from "./services/siblingsInert.js";
21
21
  import { hash$ } from "./services/hash.js";
22
22
  import { createTransition, noAnimation } from "./services/transitions/baseTransitions.js";
23
23
  import { createCSSTransition, getTransitionDurationMs, hasTransition } from "./services/transitions/cssTransitions.js";
24
24
  import { createSimpleClassTransition } from "./services/transitions/simpleClassTransition.js";
25
- import { o, a as a3, c as c10, b, p, n, g as g10, j, f as f2, h, q, d, e, i, m as m2, k, l, r, s } from "./directive-3-8yr-ZK.js";
25
+ import { o, a as a3, c as c10, b, p, n, g as g10, j, f as f2, h, q, d, e, i, m as m2, k, l, r, s } from "./directive-CKEccryv.js";
26
26
  import { bindableDerived, bindableProp, createPatch, findChangedProperties, isStore, mergeConfigStores, normalizeConfigStores, stateStores, toReadableStore, toWritableStore, writableWithDefault, writablesForProps, writablesWithDefault } from "./utils/stores.js";
27
- import { t, h as h2, c as c11, d as d2, f as f3, g as g11, a as a4, b as b2, e as e2 } from "./writables-DoU_XYTX.js";
27
+ import { i as i2, t, h as h2, c as c11, d as d2, f as f3, g as g11, a as a4, b as b2, e as e2 } from "./writables-DCiBdIBK.js";
28
28
  export {
29
29
  INVALID_VALUE,
30
30
  activeElement$,
@@ -60,6 +60,7 @@ export {
60
60
  h as createStoreDirective,
61
61
  c9 as createToast,
62
62
  createTransition,
63
+ i2 as createTypeEnum,
63
64
  createWidgetsConfig,
64
65
  q as directiveAttributes,
65
66
  d as directiveSubscribe,
@@ -94,12 +95,11 @@ export {
94
95
  normalizeConfigStores,
95
96
  portal,
96
97
  r as registrationArray,
97
- sliblingsInert,
98
+ siblingsInert,
98
99
  s as ssrAttributes,
99
100
  stateStores,
100
101
  t as testToNormalizeValue,
101
102
  toReadableStore,
102
- toSlotContextWidget,
103
103
  toWritableStore,
104
104
  h2 as typeArray,
105
105
  c11 as typeBoolean,
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  const tansu = require("@amadeus-it-group/tansu");
3
- const utils_writables = require("./writables-D46sFgGK.cjs");
3
+ const utils_writables = require("./writables-BPAJvaL_.cjs");
4
4
  const utils_stores = require("./utils/stores.cjs");
5
5
  const services_transitions_baseTransitions = require("./services/transitions/baseTransitions.cjs");
6
6
  const promise = require("./promise-BMJ8qhA8.cjs");
7
7
  const func = require("./func-Qd3cD9a3.cjs");
8
- const utils_directive = require("./directive-j-xRk-h3.cjs");
8
+ const utils_directive = require("./directive-DdlwGFtf.cjs");
9
9
  const services_portal = require("./services/portal.cjs");
10
10
  const services_siblingsInert = require("./services/siblingsInert.cjs");
11
11
  const internalRemoveScrollbars = () => {
@@ -179,7 +179,7 @@ function createModal(config$) {
179
179
  "aria-label": ariaCloseButtonLabel$
180
180
  },
181
181
  events: {
182
- click: res.actions.closeButtonClick
182
+ click: () => close(modalCloseButtonClick)
183
183
  }
184
184
  }));
185
185
  const backdropAttributeDirective = utils_directive.createAttributesDirective(() => ({
@@ -192,7 +192,11 @@ function createModal(config$) {
192
192
  class: className$
193
193
  },
194
194
  events: {
195
- click: res.actions.modalClick
195
+ click: (event) => {
196
+ if (event.currentTarget === event.target && closeOnOutsideClick$()) {
197
+ close(modalOutsideClick);
198
+ }
199
+ }
196
200
  }
197
201
  }));
198
202
  const res = {
@@ -211,13 +215,8 @@ function createModal(config$) {
211
215
  directives: {
212
216
  modalPortalDirective,
213
217
  backdropPortalDirective,
214
- backdropDirective: utils_directive.mergeDirectives(utils_directive.bindDirectiveNoArg(backdropTransition.directives.directive), backdropAttributeDirective),
215
- modalDirective: utils_directive.mergeDirectives(
216
- utils_directive.bindDirectiveNoArg(modalTransition.directives.directive),
217
- services_siblingsInert.sliblingsInert,
218
- utils_directive.directiveSubscribe(action$),
219
- modalAttributeDirective
220
- ),
218
+ backdropDirective: utils_directive.mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
219
+ modalDirective: utils_directive.mergeDirectives(modalTransition.directives.directive, services_siblingsInert.siblingsInert, utils_directive.directiveSubscribe(action$), modalAttributeDirective),
221
220
  closeButtonDirective,
222
221
  dialogDirective: utils_directive.bindDirective(
223
222
  utils_directive.browserDirective((dialog, visible) => {
@@ -245,16 +244,6 @@ function createModal(config$) {
245
244
  return hideResult;
246
245
  },
247
246
  patch
248
- },
249
- actions: {
250
- modalClick(event) {
251
- if (event.currentTarget === event.target && closeOnOutsideClick$()) {
252
- close(modalOutsideClick);
253
- }
254
- },
255
- closeButtonClick(event) {
256
- close(modalCloseButtonClick);
257
- }
258
247
  }
259
248
  };
260
249
  return res;
@@ -1,12 +1,12 @@
1
1
  import { computed, readable } from "@amadeus-it-group/tansu";
2
- import { c as typeBoolean, e as typeString, f as typeFunction, g as typeHTMLElementOrNull } from "./writables-DoU_XYTX.js";
2
+ import { c as typeBoolean, e as typeString, f as typeFunction, g as typeHTMLElementOrNull } from "./writables-DCiBdIBK.js";
3
3
  import { writablesForProps, stateStores } from "./utils/stores.js";
4
4
  import { createTransition } from "./services/transitions/baseTransitions.js";
5
5
  import { d as promiseFromStore } from "./promise-CY2U8bTP.js";
6
6
  import { n as noop } from "./func-DR0n-ShK.js";
7
- import { r as registrationArray, a as bindDirective, k as mergeDirectives, c as bindDirectiveNoArg, d as directiveSubscribe, b as browserDirective, n as createAttributesDirective } from "./directive-3-8yr-ZK.js";
7
+ import { r as registrationArray, a as bindDirective, k as mergeDirectives, d as directiveSubscribe, b as browserDirective, n as createAttributesDirective } from "./directive-CKEccryv.js";
8
8
  import { portal } from "./services/portal.js";
9
- import { sliblingsInert } from "./services/siblingsInert.js";
9
+ import { siblingsInert } from "./services/siblingsInert.js";
10
10
  const internalRemoveScrollbars = () => {
11
11
  const scrollbarWidth = Math.abs(window.innerWidth - document.documentElement.clientWidth);
12
12
  const body = document.body;
@@ -178,7 +178,7 @@ function createModal(config$) {
178
178
  "aria-label": ariaCloseButtonLabel$
179
179
  },
180
180
  events: {
181
- click: res.actions.closeButtonClick
181
+ click: () => close(modalCloseButtonClick)
182
182
  }
183
183
  }));
184
184
  const backdropAttributeDirective = createAttributesDirective(() => ({
@@ -191,7 +191,11 @@ function createModal(config$) {
191
191
  class: className$
192
192
  },
193
193
  events: {
194
- click: res.actions.modalClick
194
+ click: (event) => {
195
+ if (event.currentTarget === event.target && closeOnOutsideClick$()) {
196
+ close(modalOutsideClick);
197
+ }
198
+ }
195
199
  }
196
200
  }));
197
201
  const res = {
@@ -210,13 +214,8 @@ function createModal(config$) {
210
214
  directives: {
211
215
  modalPortalDirective,
212
216
  backdropPortalDirective,
213
- backdropDirective: mergeDirectives(bindDirectiveNoArg(backdropTransition.directives.directive), backdropAttributeDirective),
214
- modalDirective: mergeDirectives(
215
- bindDirectiveNoArg(modalTransition.directives.directive),
216
- sliblingsInert,
217
- directiveSubscribe(action$),
218
- modalAttributeDirective
219
- ),
217
+ backdropDirective: mergeDirectives(backdropTransition.directives.directive, backdropAttributeDirective),
218
+ modalDirective: mergeDirectives(modalTransition.directives.directive, siblingsInert, directiveSubscribe(action$), modalAttributeDirective),
220
219
  closeButtonDirective,
221
220
  dialogDirective: bindDirective(
222
221
  browserDirective((dialog, visible) => {
@@ -244,16 +243,6 @@ function createModal(config$) {
244
243
  return hideResult;
245
244
  },
246
245
  patch
247
- },
248
- actions: {
249
- modalClick(event) {
250
- if (event.currentTarget === event.target && closeOnOutsideClick$()) {
251
- close(modalOutsideClick);
252
- }
253
- },
254
- closeButtonClick(event) {
255
- close(modalCloseButtonClick);
256
- }
257
246
  }
258
247
  };
259
248
  return res;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agnos-ui/core",
3
- "description": "Framework-agnostic headless widget library.",
4
- "version": "0.4.4",
3
+ "description": "Framework-agnostic headless component library.",
4
+ "version": "0.5.0",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
7
7
  "module": "./index.js",
@@ -45,11 +45,11 @@
45
45
  },
46
46
  "peerDependencies": {
47
47
  "@amadeus-it-group/tansu": "^1.0.0",
48
- "@floating-ui/dom": "^1.6.8",
49
- "esm-env": "^1.0.0"
48
+ "@floating-ui/dom": "^1.6.12",
49
+ "esm-env": "^1.1.4"
50
50
  },
51
51
  "sideEffects": false,
52
- "homepage": "https://amadeusitgroup.github.io/AgnosUI/latest/",
52
+ "homepage": "https://www.agnosui.dev/latest/",
53
53
  "bugs": "https://github.com/AmadeusITGroup/AgnosUI/issues",
54
54
  "license": "MIT",
55
55
  "repository": {
@@ -62,6 +62,7 @@
62
62
  "accordion",
63
63
  "AgnosUI",
64
64
  "alert",
65
+ "collapse",
65
66
  "components",
66
67
  "modal",
67
68
  "pagination",
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  const tansu = require("@amadeus-it-group/tansu");
3
- const types = require("./types.cjs");
4
3
  const utils_stores = require("./utils/stores.cjs");
5
- const utils_writables = require("./writables-D46sFgGK.cjs");
4
+ const utils_writables = require("./writables-BPAJvaL_.cjs");
6
5
  const func = require("./func-Qd3cD9a3.cjs");
7
- const utils_directive = require("./directive-j-xRk-h3.cjs");
6
+ const utils_directive = require("./directive-DdlwGFtf.cjs");
8
7
  const PAGE_LINK_DEFAULT = "#";
9
8
  const defaultConfig = {
10
9
  page: 1,
@@ -13,7 +12,6 @@ const defaultConfig = {
13
12
  disabled: false,
14
13
  directionLinks: true,
15
14
  boundaryLinks: false,
16
- size: null,
17
15
  onPageChange: func.noop,
18
16
  pagesFactory: (_page, pageCount) => {
19
17
  const pages = [];
@@ -30,7 +28,7 @@ const defaultConfig = {
30
28
  ariaNextLabel: "Action link for next page",
31
29
  ariaLastLabel: "Action link for last page",
32
30
  ariaEllipsisLabel: "Ellipsis page element",
33
- ariaLiveLabel: (currentPage, pageCount) => `Current page is ${currentPage}`,
31
+ ariaLiveLabel: (currentPage) => `Current page is ${currentPage}`,
34
32
  className: "",
35
33
  pageLink: (_page) => PAGE_LINK_DEFAULT
36
34
  };
@@ -44,7 +42,6 @@ const configValidator = {
44
42
  disabled: utils_writables.typeBoolean,
45
43
  directionLinks: utils_writables.typeBoolean,
46
44
  boundaryLinks: utils_writables.typeBoolean,
47
- size: { normalizeValue: (value) => value === "lg" || value === "sm" || value === null ? value : types.INVALID_VALUE },
48
45
  onPageChange: utils_writables.typeFunction,
49
46
  pagesFactory: utils_writables.typeFunction,
50
47
  ariaLabel: utils_writables.typeString,
@@ -56,7 +53,8 @@ const configValidator = {
56
53
  ariaLastLabel: utils_writables.typeString,
57
54
  ariaLiveLabel: utils_writables.typeFunction,
58
55
  className: utils_writables.typeString,
59
- pageLink: utils_writables.typeFunction
56
+ pageLink: utils_writables.typeFunction,
57
+ ariaEllipsisLabel: utils_writables.typeString
60
58
  };
61
59
  function createPagination(config) {
62
60
  const [
@@ -110,17 +108,13 @@ function createPagination(config) {
110
108
  };
111
109
  });
112
110
  const ariaLiveLabelText$ = tansu.computed(() => ariaLiveLabel$()(page$(), pageCount$()));
113
- function handleNavigation(pageNumber, event, pageNavigationHandler) {
111
+ function handleNavigation(pageNumber, event) {
114
112
  if (pagesHrefs$()[pageNumber - 1] === PAGE_LINK_DEFAULT) {
115
113
  event == null ? void 0 : event.preventDefault();
116
114
  }
117
115
  if (!event || !(event.ctrlKey || event.metaKey)) {
118
116
  event == null ? void 0 : event.preventDefault();
119
- if (pageNavigationHandler) {
120
- page$.update(pageNavigationHandler);
121
- } else {
122
- page$.set(pageNumber);
123
- }
117
+ page$.set(pageNumber);
124
118
  }
125
119
  }
126
120
  const widget = {
@@ -142,50 +136,44 @@ function createPagination(config) {
142
136
  ...stateProps
143
137
  }),
144
138
  patch,
145
- actions: {
139
+ api: {
146
140
  /**
147
141
  * Set the current page pageNumber (starting from 1)
148
142
  * @param pageNumber - Current page number to set.
149
143
  * Value is normalized between 1 and the number of page
150
- * @param event UI event that triggered the select
151
144
  */
152
- select(pageNumber, event) {
153
- handleNavigation(pageNumber, event);
145
+ select(pageNumber) {
146
+ page$.set(pageNumber);
154
147
  },
155
148
  /**
156
149
  * Select the first page
157
- * @param event Event triggering the action
158
150
  */
159
- first(event) {
160
- handleNavigation(1, event);
151
+ first() {
152
+ page$.set(1);
161
153
  },
162
154
  /**
163
155
  * Select the previous page
164
- * @param event Event triggering the action
165
156
  */
166
- previous(event) {
167
- handleNavigation(page$() - 1, event, (page) => page - 1);
157
+ previous() {
158
+ page$.update((p) => p - 1);
168
159
  },
169
160
  /**
170
161
  * Select the next page
171
- * @param event Event triggering the action
172
162
  */
173
- next(event) {
174
- handleNavigation(page$() + 1, event, (page) => page + 1);
163
+ next() {
164
+ page$.update((p) => p + 1);
175
165
  },
176
166
  /**
177
167
  * Select the last page
178
- * @param event Event triggering the action
179
168
  */
180
- last(event) {
181
- handleNavigation(pageCount$(), event);
169
+ last() {
170
+ page$.set(pageCount$());
182
171
  }
183
172
  },
184
- api: {},
185
173
  directives: {
186
174
  pageLink: utils_directive.createAttributesDirective((pageLinkContext$) => ({
187
175
  events: {
188
- click: (e) => widget.actions.select(pageLinkContext$().page, e)
176
+ click: (e) => handleNavigation(pageLinkContext$().page, e)
189
177
  },
190
178
  attributes: {
191
179
  "aria-current": tansu.computed(() => page$() === pageLinkContext$().page ? "page" : void 0),
@@ -200,7 +188,7 @@ function createPagination(config) {
200
188
  })),
201
189
  pageFirst: utils_directive.createAttributesDirective(() => ({
202
190
  events: {
203
- click: (e) => widget.actions.first(e)
191
+ click: (e) => handleNavigation(1, e)
204
192
  },
205
193
  attributes: {
206
194
  "aria-label": ariaFirstLabel$,
@@ -214,7 +202,7 @@ function createPagination(config) {
214
202
  })),
215
203
  pagePrev: utils_directive.createAttributesDirective(() => ({
216
204
  events: {
217
- click: (e) => widget.actions.previous(e)
205
+ click: (e) => handleNavigation(page$() - 1, e)
218
206
  },
219
207
  attributes: {
220
208
  "aria-label": ariaPreviousLabel$,
@@ -228,7 +216,7 @@ function createPagination(config) {
228
216
  })),
229
217
  pageNext: utils_directive.createAttributesDirective(() => ({
230
218
  events: {
231
- click: (e) => widget.actions.next(e)
219
+ click: (e) => handleNavigation(page$() + 1, e)
232
220
  },
233
221
  attributes: {
234
222
  "aria-label": ariaNextLabel$,
@@ -242,7 +230,7 @@ function createPagination(config) {
242
230
  })),
243
231
  pageLast: utils_directive.createAttributesDirective(() => ({
244
232
  events: {
245
- click: (e) => widget.actions.last(e)
233
+ click: (e) => handleNavigation(pageCount$(), e)
246
234
  },
247
235
  attributes: {
248
236
  "aria-label": ariaLastLabel$,