@agnos-ui/core 0.1.1 → 0.3.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 (145) hide show
  1. package/README.md +3 -3
  2. package/accordion-BaWN0_n-.js +330 -0
  3. package/accordion-BuIgxZ0S.cjs +329 -0
  4. package/alert-C4jCg9Pl.cjs +8 -0
  5. package/alert-Dlf-BV98.js +9 -0
  6. package/common-DRdsw5m8.js +76 -0
  7. package/common-nJRMXbwj.cjs +75 -0
  8. package/components/accordion/accordion.d.ts +57 -64
  9. package/components/accordion/index.cjs +7 -0
  10. package/components/accordion/index.js +7 -1
  11. package/components/alert/alert.d.ts +3 -12
  12. package/components/alert/common.d.ts +4 -13
  13. package/components/alert/index.cjs +10 -0
  14. package/components/alert/index.js +10 -2
  15. package/components/modal/index.cjs +7 -0
  16. package/components/modal/index.js +7 -1
  17. package/components/modal/modal.d.ts +7 -49
  18. package/components/pagination/index.cjs +5 -0
  19. package/components/pagination/index.d.ts +0 -1
  20. package/components/pagination/index.js +5 -2
  21. package/components/pagination/pagination.d.ts +107 -128
  22. package/components/progressbar/index.cjs +5 -0
  23. package/components/progressbar/index.js +5 -1
  24. package/components/progressbar/progressbar.d.ts +6 -22
  25. package/components/rating/index.cjs +5 -0
  26. package/components/rating/index.js +5 -1
  27. package/components/rating/rating.d.ts +16 -11
  28. package/components/select/index.cjs +6 -0
  29. package/components/select/index.js +6 -1
  30. package/components/select/select.d.ts +45 -57
  31. package/components/slider/index.cjs +5 -0
  32. package/components/slider/index.js +5 -1
  33. package/components/slider/slider.d.ts +63 -5
  34. package/components/toast/index.cjs +5 -0
  35. package/components/toast/index.d.ts +1 -0
  36. package/components/toast/index.js +5 -0
  37. package/components/toast/toast.d.ts +47 -0
  38. package/config.cjs +38 -0
  39. package/config.d.ts +6 -1
  40. package/config.js +35 -50
  41. package/directive-BTSEYLF3.cjs +404 -0
  42. package/directive-DCYlDznf.js +405 -0
  43. package/func-DR0n-ShK.js +7 -0
  44. package/func-Qd3cD9a3.cjs +6 -0
  45. package/index.cjs +119 -0
  46. package/index.d.ts +3 -1
  47. package/index.js +119 -31
  48. package/modal-BI2qUu1M.js +251 -0
  49. package/modal-rzMpATf5.cjs +250 -0
  50. package/package.json +30 -22
  51. package/pagination--GkwduJn.js +263 -0
  52. package/pagination-EWSWQT1I.cjs +262 -0
  53. package/progressbar-DH7DHYMp.cjs +83 -0
  54. package/progressbar-DuRX7_my.js +84 -0
  55. package/promise-BMJ8qhA8.cjs +118 -0
  56. package/promise-CY2U8bTP.js +119 -0
  57. package/rating-BR5wD7y2.js +173 -0
  58. package/rating-CmuYUSxy.cjs +172 -0
  59. package/select-BCs6HQWn.js +358 -0
  60. package/select-CCIKn8WR.cjs +357 -0
  61. package/services/extendWidget.cjs +32 -0
  62. package/services/extendWidget.d.ts +10 -5
  63. package/services/extendWidget.js +31 -34
  64. package/services/floatingUI.cjs +131 -0
  65. package/services/floatingUI.d.ts +30 -14
  66. package/services/floatingUI.js +128 -102
  67. package/services/focustrack.cjs +47 -0
  68. package/services/focustrack.js +45 -44
  69. package/services/hash.cjs +15 -0
  70. package/services/hash.d.ts +2 -0
  71. package/services/hash.js +15 -0
  72. package/services/intersection.cjs +53 -0
  73. package/services/intersection.js +48 -50
  74. package/services/matchMedia.cjs +13 -0
  75. package/services/matchMedia.d.ts +7 -0
  76. package/services/matchMedia.js +13 -0
  77. package/services/navManager.cjs +196 -0
  78. package/services/navManager.d.ts +24 -17
  79. package/services/navManager.js +186 -162
  80. package/services/portal.cjs +43 -0
  81. package/services/portal.js +41 -42
  82. package/services/resizeObserver.cjs +32 -0
  83. package/services/resizeObserver.d.ts +14 -0
  84. package/services/resizeObserver.js +32 -0
  85. package/services/siblingsInert.cjs +40 -0
  86. package/services/siblingsInert.js +31 -31
  87. package/services/transitions/baseTransitions.cjs +171 -0
  88. package/services/transitions/baseTransitions.d.ts +16 -16
  89. package/services/transitions/baseTransitions.js +159 -170
  90. package/services/transitions/collapse.cjs +44 -0
  91. package/services/transitions/collapse.js +41 -49
  92. package/services/transitions/cssTransitions.cjs +32 -0
  93. package/services/transitions/cssTransitions.d.ts +2 -1
  94. package/services/transitions/cssTransitions.js +29 -39
  95. package/services/transitions/simpleClassTransition.cjs +31 -0
  96. package/services/transitions/simpleClassTransition.js +30 -41
  97. package/slider-CA_fszn7.js +536 -0
  98. package/slider-DsLvT87U.cjs +535 -0
  99. package/toast-8tWp6x89.js +63 -0
  100. package/toast-Aw8o0Iwe.cjs +62 -0
  101. package/types.cjs +12 -0
  102. package/types.d.ts +21 -1
  103. package/types.js +11 -13
  104. package/utils/directive.cjs +26 -0
  105. package/utils/directive.d.ts +155 -4
  106. package/utils/directive.js +25 -189
  107. package/utils/internal/dom.d.ts +57 -3
  108. package/utils/internal/promise.d.ts +2 -2
  109. package/utils/internal/ssrHTMLElement.d.ts +7 -0
  110. package/utils/internal/textDirection.d.ts +1 -1
  111. package/utils/stores.cjs +163 -0
  112. package/utils/stores.d.ts +23 -20
  113. package/utils/stores.js +151 -269
  114. package/utils/writables.cjs +13 -0
  115. package/utils/writables.js +12 -71
  116. package/writables-D46sFgGK.cjs +85 -0
  117. package/writables-DoU_XYTX.js +86 -0
  118. package/components/accordion/accordion.js +0 -267
  119. package/components/alert/alert.js +0 -22
  120. package/components/alert/common.js +0 -69
  121. package/components/commonProps.js +0 -1
  122. package/components/modal/modal.js +0 -186
  123. package/components/pagination/bootstrap.d.ts +0 -8
  124. package/components/pagination/bootstrap.js +0 -110
  125. package/components/pagination/pagination.js +0 -149
  126. package/components/progressbar/progressbar.js +0 -78
  127. package/components/rating/rating.js +0 -138
  128. package/components/select/select.js +0 -266
  129. package/components/slider/slider.js +0 -415
  130. package/services/transitions/bootstrap/collapse.d.ts +0 -2
  131. package/services/transitions/bootstrap/collapse.js +0 -15
  132. package/services/transitions/bootstrap/fade.d.ts +0 -1
  133. package/services/transitions/bootstrap/fade.js +0 -7
  134. package/services/transitions/bootstrap.d.ts +0 -2
  135. package/services/transitions/bootstrap.js +0 -2
  136. package/utils/internal/checks.js +0 -60
  137. package/utils/internal/dom.js +0 -61
  138. package/utils/internal/func.js +0 -11
  139. package/utils/internal/isFocusable.js +0 -35
  140. package/utils/internal/math.js +0 -13
  141. package/utils/internal/promise.js +0 -169
  142. package/utils/internal/scrollbars.js +0 -33
  143. package/utils/internal/sort.js +0 -28
  144. package/utils/internal/textDirection.js +0 -7
  145. package/utils/internal/traversal.js +0 -105
@@ -36,6 +36,24 @@ export interface HandleDisplayOptions {
36
36
  */
37
37
  top: number | null;
38
38
  }
39
+ export interface SliderHandle {
40
+ /**
41
+ * Value of the handle
42
+ */
43
+ value: number;
44
+ /**
45
+ * Handle id
46
+ */
47
+ id: number;
48
+ /**
49
+ * ariaLabel of the handle
50
+ */
51
+ ariaLabel: string;
52
+ /**
53
+ * ariaValueText of the handle
54
+ */
55
+ ariaValueText: string;
56
+ }
39
57
  export interface SliderCommonPropsAndState extends WidgetsCommonPropsAndState {
40
58
  /**
41
59
  * Minimum value that can be assigned to the slider
@@ -106,11 +124,7 @@ export interface SliderState extends SliderCommonPropsAndState {
106
124
  /**
107
125
  * Array of the sorted handles to display
108
126
  */
109
- sortedHandles: {
110
- value: number;
111
- id: number;
112
- ariaLabel: string;
113
- }[];
127
+ sortedHandles: SliderHandle[];
114
128
  /**
115
129
  * Array of objects representing progress display options
116
130
  */
@@ -119,6 +133,10 @@ export interface SliderState extends SliderCommonPropsAndState {
119
133
  * Array of objects representing handle display options
120
134
  */
121
135
  handleDisplayOptions: HandleDisplayOptions[];
136
+ /**
137
+ * Check if the slider is interactive, meaning it is not disabled or readonly
138
+ */
139
+ interactive: boolean;
122
140
  }
123
141
  export interface SliderProps extends SliderCommonPropsAndState {
124
142
  /**
@@ -128,6 +146,13 @@ export interface SliderProps extends SliderCommonPropsAndState {
128
146
  * @param index - index of the handle in the original list
129
147
  */
130
148
  ariaLabelHandle: (value: number, sortedIndex: number, index: number) => string;
149
+ /**
150
+ * Return the value for the 'aria-valuetext' attribute for the handle
151
+ * @param value - value of the handle
152
+ * @param sortedIndex - index of the handle in the sorted list
153
+ * @param index - index of the handle in the original list
154
+ */
155
+ ariaValueText: (value: number, sortedIndex: number, index: number) => string;
131
156
  /**
132
157
  * An event emitted when slider values are changed
133
158
  *
@@ -142,6 +167,22 @@ export interface SliderDirectives {
142
167
  * Directive to get the slider component elementRef
143
168
  */
144
169
  sliderDirective: Directive;
170
+ /**
171
+ * Directive used to style the progress display for each handle
172
+ */
173
+ progressDisplayDirective: Directive<{
174
+ option: ProgressDisplayOptions;
175
+ }>;
176
+ /**
177
+ * Directive to apply to the slider clickable area, to directly move the handle to a given specific position
178
+ */
179
+ clickableAreaDirective: Directive;
180
+ /**
181
+ * Directive to apply to the slider handle if any
182
+ */
183
+ handleDirective: Directive<{
184
+ item: SliderHandle;
185
+ }>;
145
186
  /**
146
187
  * Directive to get the minLabel elementRef
147
188
  */
@@ -150,6 +191,16 @@ export interface SliderDirectives {
150
191
  * Directive to get the maxLabel elementRef
151
192
  */
152
193
  maxLabelDirective: Directive;
194
+ /**
195
+ * Directive to apply to the handle when combined label display is active
196
+ */
197
+ combinedHandleLabelDisplayDirective: Directive;
198
+ /**
199
+ * Directive to apply to the handle when combined label display is not active
200
+ */
201
+ handleLabelDisplayDirective: Directive<{
202
+ index: number;
203
+ }>;
153
204
  }
154
205
  export interface SliderActions {
155
206
  /**
@@ -189,6 +240,13 @@ export declare function getSliderDefaultConfig(): {
189
240
  * @param index - index of the handle in the original list
190
241
  */
191
242
  ariaLabelHandle: (value: number, sortedIndex: number, index: number) => string;
243
+ /**
244
+ * Return the value for the 'aria-valuetext' attribute for the handle
245
+ * @param value - value of the handle
246
+ * @param sortedIndex - index of the handle in the sorted list
247
+ * @param index - index of the handle in the original list
248
+ */
249
+ ariaValueText: (value: number, sortedIndex: number, index: number) => string;
192
250
  /**
193
251
  * An event emitted when slider values are changed
194
252
  *
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const toast = require("../../toast-Aw8o0Iwe.cjs");
4
+ exports.createToast = toast.createToast;
5
+ exports.getToastDefaultConfig = toast.getToastDefaultConfig;
@@ -0,0 +1 @@
1
+ export * from './toast';
@@ -0,0 +1,5 @@
1
+ import { c, g } from "../../toast-8tWp6x89.js";
2
+ export {
3
+ c as createToast,
4
+ g as getToastDefaultConfig
5
+ };
@@ -0,0 +1,47 @@
1
+ import type { ExtendWidgetAdaptSlotWidgetProps, ExtendWidgetInterfaces } from '../../services/extendWidget';
2
+ import type { Directive, PropsConfig, Widget } from '../../types';
3
+ import type { CommonAlertApi, CommonAlertDirectives, CommonAlertProps, CommonAlertState } from '../alert/common';
4
+ export interface ToastExtraProps {
5
+ /**
6
+ * If `true` automatically hides the toast after the delay.
7
+ */
8
+ autoHide: boolean;
9
+ /**
10
+ * Delay in milliseconds before hiding the toast.
11
+ */
12
+ delay: number;
13
+ }
14
+ export interface ExtraDirectives {
15
+ /**
16
+ * Directive that handles the autohide of the toast component
17
+ */
18
+ autoHideDirective: Directive;
19
+ /**
20
+ * Directive that adds all the necessary attributes to the body
21
+ */
22
+ bodyDirective: Directive;
23
+ /**
24
+ * Directive that adds all the necessary attributes to the close button depending on the presence of the header
25
+ */
26
+ closeButtonDirective: Directive;
27
+ }
28
+ export interface ToastState extends ExtendWidgetAdaptSlotWidgetProps<CommonAlertState, ToastExtraProps, ExtraDirectives> {
29
+ }
30
+ export interface ToastProps extends ExtendWidgetAdaptSlotWidgetProps<CommonAlertProps, ToastExtraProps, ExtraDirectives> {
31
+ }
32
+ export interface ToastApi extends CommonAlertApi {
33
+ }
34
+ export interface ToastDirectives extends ExtendWidgetInterfaces<CommonAlertDirectives, ExtraDirectives> {
35
+ }
36
+ export type ToastWidget = Widget<ToastProps, ToastState, ToastApi, object, ToastDirectives>;
37
+ /**
38
+ * Retrieve a shallow copy of the default toast config
39
+ * @returns the default toast config
40
+ */
41
+ export declare function getToastDefaultConfig(): ToastProps;
42
+ /**
43
+ * Create a ToastWidget with given config props
44
+ * @param config - an optional toast config
45
+ * @returns a ToastWidget
46
+ */
47
+ export declare function createToast(config?: PropsConfig<ToastProps>): ToastWidget;
package/config.cjs ADDED
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const tansu = require("@amadeus-it-group/tansu");
4
+ const func = require("./func-Qd3cD9a3.cjs");
5
+ const mergeInto = (destination, source, levels = Infinity) => {
6
+ if (source !== void 0) {
7
+ if (typeof source === "object" && source && levels >= 1) {
8
+ if (!destination) {
9
+ destination = {};
10
+ }
11
+ for (const key of Object.keys(source)) {
12
+ if (!Object.prototype.hasOwnProperty.call(source, key))
13
+ continue;
14
+ if (key === "__proto__" || key === "constructor")
15
+ continue;
16
+ destination[key] = mergeInto(destination[key], source[key], levels - 1);
17
+ }
18
+ } else {
19
+ return source;
20
+ }
21
+ }
22
+ return destination;
23
+ };
24
+ const createWidgetsConfig = (parent$, adaptParentConfig = func.identity) => {
25
+ const own$ = tansu.writable({});
26
+ const adaptedParent$ = adaptParentConfig === func.identity ? parent$ : tansu.computed(() => adaptParentConfig(mergeInto({}, parent$ == null ? void 0 : parent$(), 2)));
27
+ return tansu.asWritable(
28
+ tansu.computed(() => mergeInto(mergeInto({}, adaptedParent$ == null ? void 0 : adaptedParent$(), 2), own$(), 2)),
29
+ {
30
+ ...own$,
31
+ own$,
32
+ adaptedParent$,
33
+ parent$
34
+ }
35
+ );
36
+ };
37
+ exports.createWidgetsConfig = createWidgetsConfig;
38
+ exports.mergeInto = mergeInto;
package/config.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { SelectProps } from './components/select/select';
7
7
  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
+ import type { ToastProps } from './components/toast/toast';
10
11
  export type Partial2Levels<T> = Partial<{
11
12
  [Level1 in keyof T]: Partial<T[Level1]>;
12
13
  }>;
@@ -44,7 +45,7 @@ export declare const mergeInto: <T>(destination: T, source: T | undefined, level
44
45
  * parent$, adaptedParent$ (containing the value computed after the first step), and own$ (that contains only overridding properties).
45
46
  * The resulting store is writable, its set function is actually the set function of the own$ store.
46
47
  */
47
- export declare const createWidgetsConfig: <T>(parent$?: WidgetsConfigStore<T> | undefined, adaptParentConfig?: (config: Partial<{ [Level1 in keyof T]: Partial<T[Level1]>; }>) => Partial<{ [Level1 in keyof T]: Partial<T[Level1]>; }>) => WidgetsConfigStore<T>;
48
+ export declare const createWidgetsConfig: <T>(parent$?: WidgetsConfigStore<T> | undefined, adaptParentConfig?: (config: Partial2Levels<T>) => Partial2Levels<T>) => WidgetsConfigStore<T>;
48
49
  export interface WidgetsConfig {
49
50
  /**
50
51
  * the pagination widget config
@@ -78,4 +79,8 @@ export interface WidgetsConfig {
78
79
  * slider widget config
79
80
  */
80
81
  slider: SliderProps;
82
+ /**
83
+ * toast widget config
84
+ */
85
+ toast: ToastProps;
81
86
  }
package/config.js CHANGED
@@ -1,53 +1,38 @@
1
- import { asWritable, computed, writable } from '@amadeus-it-group/tansu';
2
- import { identity } from './utils/internal/func';
3
- /**
4
- * Merges source object into destination object, up to the provided number of levels.
5
- * @param destination - destination object
6
- * @param source - source object
7
- * @param levels - number of levels to merge
8
- * @returns the destination object in most cases, or the source in some cases (if the source is not undefined and either levels is smaller than 1
9
- * or the source is not an object)
10
- */
11
- export const mergeInto = (destination, source, levels = Infinity) => {
12
- if (source !== undefined) {
13
- if (typeof source === 'object' && source && levels >= 1) {
14
- for (const key of Object.keys(source)) {
15
- destination[key] = mergeInto(destination[key] ?? {}, source[key], levels - 1);
16
- }
17
- }
18
- else {
19
- return source;
20
- }
1
+ import { writable, computed, asWritable } from "@amadeus-it-group/tansu";
2
+ import { i as identity } from "./func-DR0n-ShK.js";
3
+ const mergeInto = (destination, source, levels = Infinity) => {
4
+ if (source !== void 0) {
5
+ if (typeof source === "object" && source && levels >= 1) {
6
+ if (!destination) {
7
+ destination = {};
8
+ }
9
+ for (const key of Object.keys(source)) {
10
+ if (!Object.prototype.hasOwnProperty.call(source, key))
11
+ continue;
12
+ if (key === "__proto__" || key === "constructor")
13
+ continue;
14
+ destination[key] = mergeInto(destination[key], source[key], levels - 1);
15
+ }
16
+ } else {
17
+ return source;
21
18
  }
22
- return destination;
19
+ }
20
+ return destination;
23
21
  };
24
- /**
25
- * Creates a new widgets default configuration store, optionally inheriting from a parent store, and containing
26
- * its own set of widgets configuration properties that override the same properties form the parent configuration.
27
- *
28
- * @remarks
29
- * The resulting store has a value computed from the parent store in two steps:
30
- * - first step: the parent configuration is transformed by the adaptParentConfig function (if specified).
31
- * If adaptParentConfig is not specified, this step is skipped.
32
- * - second step: the configuration from step 1 is merged (2-levels deep) with the own$ store. The own$ store initially contains
33
- * an empty object (i.e. no property from the parent is overridden). It can be changed by calling set on the store returned by this function.
34
- *
35
- * @param parent$ - optional parent widgets default configuration store.
36
- * @param adaptParentConfig - optional function that receives a 2-levels copy of the widgets default configuration
37
- * from parent$ (or an empty object if parent$ is not specified) and returns the widgets default configuration to be used.
38
- * It is called only if the configuration is needed, and was not yet computed for the current value of the parent configuration.
39
- * It is called in a tansu reactive context, so it can use any tansu store and will be called again if those stores change.
40
- * @returns the resulting widgets default configuration store, which contains 3 additional properties that are stores:
41
- * parent$, adaptedParent$ (containing the value computed after the first step), and own$ (that contains only overridding properties).
42
- * The resulting store is writable, its set function is actually the set function of the own$ store.
43
- */
44
- export const createWidgetsConfig = (parent$, adaptParentConfig = identity) => {
45
- const own$ = writable({});
46
- const adaptedParent$ = adaptParentConfig === identity ? parent$ : computed(() => adaptParentConfig(mergeInto({}, parent$?.(), 2)));
47
- return asWritable(computed(() => mergeInto(mergeInto({}, adaptedParent$?.(), 2), own$(), 2)), {
48
- ...own$,
49
- own$,
50
- adaptedParent$,
51
- parent$,
52
- });
22
+ const createWidgetsConfig = (parent$, adaptParentConfig = identity) => {
23
+ const own$ = writable({});
24
+ const adaptedParent$ = adaptParentConfig === identity ? parent$ : computed(() => adaptParentConfig(mergeInto({}, parent$ == null ? void 0 : parent$(), 2)));
25
+ return asWritable(
26
+ computed(() => mergeInto(mergeInto({}, adaptedParent$ == null ? void 0 : adaptedParent$(), 2), own$(), 2)),
27
+ {
28
+ ...own$,
29
+ own$,
30
+ adaptedParent$,
31
+ parent$
32
+ }
33
+ );
34
+ };
35
+ export {
36
+ createWidgetsConfig,
37
+ mergeInto
53
38
  };