@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.
- package/README.md +3 -3
- package/accordion-BaWN0_n-.js +330 -0
- package/accordion-BuIgxZ0S.cjs +329 -0
- package/alert-C4jCg9Pl.cjs +8 -0
- package/alert-Dlf-BV98.js +9 -0
- package/common-DRdsw5m8.js +76 -0
- package/common-nJRMXbwj.cjs +75 -0
- package/components/accordion/accordion.d.ts +57 -64
- package/components/accordion/index.cjs +7 -0
- package/components/accordion/index.js +7 -1
- package/components/alert/alert.d.ts +3 -12
- package/components/alert/common.d.ts +4 -13
- package/components/alert/index.cjs +10 -0
- package/components/alert/index.js +10 -2
- package/components/modal/index.cjs +7 -0
- package/components/modal/index.js +7 -1
- package/components/modal/modal.d.ts +7 -49
- package/components/pagination/index.cjs +5 -0
- package/components/pagination/index.d.ts +0 -1
- package/components/pagination/index.js +5 -2
- package/components/pagination/pagination.d.ts +107 -128
- package/components/progressbar/index.cjs +5 -0
- package/components/progressbar/index.js +5 -1
- package/components/progressbar/progressbar.d.ts +6 -22
- package/components/rating/index.cjs +5 -0
- package/components/rating/index.js +5 -1
- package/components/rating/rating.d.ts +16 -11
- package/components/select/index.cjs +6 -0
- package/components/select/index.js +6 -1
- package/components/select/select.d.ts +45 -57
- package/components/slider/index.cjs +5 -0
- package/components/slider/index.js +5 -1
- package/components/slider/slider.d.ts +63 -5
- package/components/toast/index.cjs +5 -0
- package/components/toast/index.d.ts +1 -0
- package/components/toast/index.js +5 -0
- package/components/toast/toast.d.ts +47 -0
- package/config.cjs +38 -0
- package/config.d.ts +6 -1
- package/config.js +35 -50
- package/directive-BTSEYLF3.cjs +404 -0
- package/directive-DCYlDznf.js +405 -0
- package/func-DR0n-ShK.js +7 -0
- package/func-Qd3cD9a3.cjs +6 -0
- package/index.cjs +119 -0
- package/index.d.ts +3 -1
- package/index.js +119 -31
- package/modal-BI2qUu1M.js +251 -0
- package/modal-rzMpATf5.cjs +250 -0
- package/package.json +30 -22
- package/pagination--GkwduJn.js +263 -0
- package/pagination-EWSWQT1I.cjs +262 -0
- package/progressbar-DH7DHYMp.cjs +83 -0
- package/progressbar-DuRX7_my.js +84 -0
- package/promise-BMJ8qhA8.cjs +118 -0
- package/promise-CY2U8bTP.js +119 -0
- package/rating-BR5wD7y2.js +173 -0
- package/rating-CmuYUSxy.cjs +172 -0
- package/select-BCs6HQWn.js +358 -0
- package/select-CCIKn8WR.cjs +357 -0
- package/services/extendWidget.cjs +32 -0
- package/services/extendWidget.d.ts +10 -5
- package/services/extendWidget.js +31 -34
- package/services/floatingUI.cjs +131 -0
- package/services/floatingUI.d.ts +30 -14
- package/services/floatingUI.js +128 -102
- package/services/focustrack.cjs +47 -0
- package/services/focustrack.js +45 -44
- package/services/hash.cjs +15 -0
- package/services/hash.d.ts +2 -0
- package/services/hash.js +15 -0
- package/services/intersection.cjs +53 -0
- package/services/intersection.js +48 -50
- package/services/matchMedia.cjs +13 -0
- package/services/matchMedia.d.ts +7 -0
- package/services/matchMedia.js +13 -0
- package/services/navManager.cjs +196 -0
- package/services/navManager.d.ts +24 -17
- package/services/navManager.js +186 -162
- package/services/portal.cjs +43 -0
- package/services/portal.js +41 -42
- package/services/resizeObserver.cjs +32 -0
- package/services/resizeObserver.d.ts +14 -0
- package/services/resizeObserver.js +32 -0
- package/services/siblingsInert.cjs +40 -0
- package/services/siblingsInert.js +31 -31
- package/services/transitions/baseTransitions.cjs +171 -0
- package/services/transitions/baseTransitions.d.ts +16 -16
- package/services/transitions/baseTransitions.js +159 -170
- package/services/transitions/collapse.cjs +44 -0
- package/services/transitions/collapse.js +41 -49
- package/services/transitions/cssTransitions.cjs +32 -0
- package/services/transitions/cssTransitions.d.ts +2 -1
- package/services/transitions/cssTransitions.js +29 -39
- package/services/transitions/simpleClassTransition.cjs +31 -0
- package/services/transitions/simpleClassTransition.js +30 -41
- package/slider-CA_fszn7.js +536 -0
- package/slider-DsLvT87U.cjs +535 -0
- package/toast-8tWp6x89.js +63 -0
- package/toast-Aw8o0Iwe.cjs +62 -0
- package/types.cjs +12 -0
- package/types.d.ts +21 -1
- package/types.js +11 -13
- package/utils/directive.cjs +26 -0
- package/utils/directive.d.ts +155 -4
- package/utils/directive.js +25 -189
- package/utils/internal/dom.d.ts +57 -3
- package/utils/internal/promise.d.ts +2 -2
- package/utils/internal/ssrHTMLElement.d.ts +7 -0
- package/utils/internal/textDirection.d.ts +1 -1
- package/utils/stores.cjs +163 -0
- package/utils/stores.d.ts +23 -20
- package/utils/stores.js +151 -269
- package/utils/writables.cjs +13 -0
- package/utils/writables.js +12 -71
- package/writables-D46sFgGK.cjs +85 -0
- package/writables-DoU_XYTX.js +86 -0
- package/components/accordion/accordion.js +0 -267
- package/components/alert/alert.js +0 -22
- package/components/alert/common.js +0 -69
- package/components/commonProps.js +0 -1
- package/components/modal/modal.js +0 -186
- package/components/pagination/bootstrap.d.ts +0 -8
- package/components/pagination/bootstrap.js +0 -110
- package/components/pagination/pagination.js +0 -149
- package/components/progressbar/progressbar.js +0 -78
- package/components/rating/rating.js +0 -138
- package/components/select/select.js +0 -266
- package/components/slider/slider.js +0 -415
- package/services/transitions/bootstrap/collapse.d.ts +0 -2
- package/services/transitions/bootstrap/collapse.js +0 -15
- package/services/transitions/bootstrap/fade.d.ts +0 -1
- package/services/transitions/bootstrap/fade.js +0 -7
- package/services/transitions/bootstrap.d.ts +0 -2
- package/services/transitions/bootstrap.js +0 -2
- package/utils/internal/checks.js +0 -60
- package/utils/internal/dom.js +0 -61
- package/utils/internal/func.js +0 -11
- package/utils/internal/isFocusable.js +0 -35
- package/utils/internal/math.js +0 -13
- package/utils/internal/promise.js +0 -169
- package/utils/internal/scrollbars.js +0 -33
- package/utils/internal/sort.js +0 -28
- package/utils/internal/textDirection.js +0 -7
- 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 @@
|
|
|
1
|
+
export * from './toast';
|
|
@@ -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:
|
|
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 {
|
|
2
|
-
import { identity } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
19
|
+
}
|
|
20
|
+
return destination;
|
|
23
21
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
};
|