@agnos-ui/core 0.0.1-alpha.1 → 0.0.1-alpha.10

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 (119) hide show
  1. package/{accordion.d.ts → components/accordion/accordion.d.ts} +27 -18
  2. package/{accordion.js → components/accordion/accordion.js} +80 -76
  3. package/components/accordion/index.d.ts +1 -0
  4. package/components/accordion/index.js +1 -0
  5. package/components/alert/alert.d.ts +31 -0
  6. package/components/alert/alert.js +22 -0
  7. package/{alert.d.ts → components/alert/common.d.ts} +17 -21
  8. package/{alert.js → components/alert/common.js} +21 -19
  9. package/components/alert/index.d.ts +2 -0
  10. package/components/alert/index.js +2 -0
  11. package/components/modal/index.d.ts +1 -0
  12. package/components/modal/index.js +1 -0
  13. package/{modal → components/modal}/modal.d.ts +28 -21
  14. package/{modal → components/modal}/modal.js +58 -28
  15. package/components/pagination/index.d.ts +2 -0
  16. package/components/pagination/index.js +2 -0
  17. package/{pagination.d.ts → components/pagination/pagination.d.ts} +2 -3
  18. package/{pagination.js → components/pagination/pagination.js} +5 -4
  19. package/components/progressbar/index.d.ts +1 -0
  20. package/components/progressbar/index.js +1 -0
  21. package/components/progressbar/progressbar.d.ts +86 -0
  22. package/components/progressbar/progressbar.js +78 -0
  23. package/components/rating/index.d.ts +1 -0
  24. package/components/rating/index.js +1 -0
  25. package/{rating.d.ts → components/rating/rating.d.ts} +4 -5
  26. package/{rating.js → components/rating/rating.js} +6 -9
  27. package/components/select/index.d.ts +1 -0
  28. package/components/select/index.js +1 -0
  29. package/components/select/select.d.ts +337 -0
  30. package/components/select/select.js +266 -0
  31. package/components/slider/index.d.ts +1 -0
  32. package/components/slider/index.js +1 -0
  33. package/components/slider/slider.d.ts +245 -0
  34. package/components/slider/slider.js +413 -0
  35. package/config.d.ts +17 -7
  36. package/config.js +3 -3
  37. package/index.d.ts +23 -10
  38. package/index.js +29 -10
  39. package/package.json +32 -4
  40. package/services/extendWidget.d.ts +23 -0
  41. package/services/extendWidget.js +35 -0
  42. package/services/floatingUI.d.ts +56 -0
  43. package/services/floatingUI.js +105 -0
  44. package/services/focustrack.js +5 -5
  45. package/services/intersection.d.ts +9 -1
  46. package/services/intersection.js +10 -2
  47. package/services/navManager.d.ts +93 -0
  48. package/services/navManager.js +172 -0
  49. package/services/portal.d.ts +7 -0
  50. package/services/portal.js +15 -4
  51. package/services/siblingsInert.d.ts +2 -1
  52. package/services/siblingsInert.js +2 -2
  53. package/{transitions → services/transitions}/baseTransitions.d.ts +15 -2
  54. package/{transitions → services/transitions}/baseTransitions.js +21 -10
  55. package/services/transitions/bootstrap/collapse.d.ts +2 -0
  56. package/services/transitions/bootstrap/fade.d.ts +1 -0
  57. package/services/transitions/bootstrap.d.ts +2 -0
  58. package/services/transitions/bootstrap.js +2 -0
  59. package/services/transitions/collapse.d.ts +43 -0
  60. package/{transitions → services/transitions}/collapse.js +15 -2
  61. package/{transitions → services/transitions}/cssTransitions.d.ts +6 -0
  62. package/{transitions → services/transitions}/cssTransitions.js +8 -4
  63. package/{transitions → services/transitions}/simpleClassTransition.d.ts +12 -1
  64. package/services/transitions/simpleClassTransition.js +42 -0
  65. package/types.d.ts +43 -4
  66. package/types.js +7 -0
  67. package/{services/directiveUtils.js → utils/directive.js} +1 -1
  68. package/utils/internal/checks.d.ts +49 -0
  69. package/utils/internal/checks.js +60 -0
  70. package/utils/internal/dom.d.ts +25 -0
  71. package/utils/internal/dom.js +61 -0
  72. package/utils/internal/func.d.ts +11 -0
  73. package/utils/internal/func.js +11 -0
  74. package/utils/internal/isFocusable.d.ts +9 -0
  75. package/utils/internal/isFocusable.js +35 -0
  76. package/utils/internal/math.d.ts +5 -0
  77. package/utils/internal/math.js +13 -0
  78. package/utils/internal/promise.d.ts +87 -0
  79. package/utils/internal/promise.js +169 -0
  80. package/utils/internal/scrollbars.d.ts +8 -0
  81. package/{modal → utils/internal}/scrollbars.js +7 -1
  82. package/utils/internal/sort.d.ts +16 -0
  83. package/utils/internal/sort.js +28 -0
  84. package/utils/internal/textDirection.d.ts +7 -0
  85. package/utils/internal/textDirection.js +7 -0
  86. package/utils/internal/traversal.d.ts +54 -0
  87. package/utils/internal/traversal.js +105 -0
  88. package/{services → utils}/stores.d.ts +67 -33
  89. package/{services → utils}/stores.js +121 -59
  90. package/utils/writables.d.ts +32 -0
  91. package/utils/writables.js +72 -0
  92. package/modal/scrollbars.d.ts +0 -2
  93. package/select.d.ts +0 -196
  94. package/select.js +0 -240
  95. package/services/checks.d.ts +0 -32
  96. package/services/checks.js +0 -43
  97. package/services/index.d.ts +0 -7
  98. package/services/index.js +0 -7
  99. package/services/writables.d.ts +0 -7
  100. package/services/writables.js +0 -16
  101. package/transitions/bootstrap/collapse.d.ts +0 -2
  102. package/transitions/bootstrap/fade.d.ts +0 -1
  103. package/transitions/bootstrap/index.d.ts +0 -2
  104. package/transitions/bootstrap/index.js +0 -2
  105. package/transitions/collapse.d.ts +0 -29
  106. package/transitions/index.d.ts +0 -5
  107. package/transitions/index.js +0 -5
  108. package/transitions/simpleClassTransition.js +0 -28
  109. package/transitions/utils.d.ts +0 -20
  110. package/transitions/utils.js +0 -83
  111. package/utils.d.ts +0 -2
  112. package/utils.js +0 -2
  113. /package/{commonProps.d.ts → components/commonProps.d.ts} +0 -0
  114. /package/{commonProps.js → components/commonProps.js} +0 -0
  115. /package/{pagination.utils.d.ts → components/pagination/bootstrap.d.ts} +0 -0
  116. /package/{pagination.utils.js → components/pagination/bootstrap.js} +0 -0
  117. /package/{transitions → services/transitions}/bootstrap/collapse.js +0 -0
  118. /package/{transitions → services/transitions}/bootstrap/fade.js +0 -0
  119. /package/{services/directiveUtils.d.ts → utils/directive.d.ts} +0 -0
package/select.d.ts DELETED
@@ -1,196 +0,0 @@
1
- import type { HasFocus } from './services/focustrack';
2
- import type { PropsConfig } from './services/stores';
3
- import type { Widget } from './types';
4
- import type { WidgetsCommonPropsAndState } from './commonProps';
5
- export interface SelectCommonPropsAndState<Item> extends WidgetsCommonPropsAndState {
6
- /**
7
- * List of selected items
8
- */
9
- selected: Item[];
10
- /**
11
- * Filtered text to be display in the filter input
12
- */
13
- filterText: string;
14
- /**
15
- * true if the select is disabled
16
- */
17
- disabled: boolean;
18
- /**
19
- * true if the select is open
20
- */
21
- opened: boolean;
22
- /**
23
- * true if a loading process is being done
24
- */
25
- loading: boolean;
26
- }
27
- export interface SelectProps<T> extends SelectCommonPropsAndState<T> {
28
- /**
29
- * List of available items for the dropdown
30
- */
31
- items: T[];
32
- /**
33
- * Custom function to filter an item.
34
- * By default, item is considered as a string, and the function returns true if the text is found
35
- */
36
- matchFn(item: T, text: string): boolean;
37
- /**
38
- * Custom function to get the id of an item
39
- * By default, the item is returned
40
- */
41
- itemId(item: T): string;
42
- /**
43
- * Callback called when the text filter change
44
- * @param text - Filtered text
45
- */
46
- onFilterTextChange?(text: string): void;
47
- }
48
- /**
49
- * Item representation built from the items provided in parameters
50
- */
51
- export interface ItemCtx<T> {
52
- /**
53
- * Original item given in the parameters
54
- */
55
- item: T;
56
- /**
57
- * Unique id to identify the item
58
- */
59
- id: string;
60
- /**
61
- * Specify if the item is checked
62
- */
63
- selected: boolean;
64
- /**
65
- * Select the item
66
- */
67
- select(): void;
68
- /**
69
- * Unselect the item
70
- */
71
- unselect(): void;
72
- /**
73
- * Toggle the item selection
74
- */
75
- toggle(): void;
76
- }
77
- export interface SelectState<Item> extends SelectCommonPropsAndState<Item> {
78
- /**
79
- * List of visible items displayed in the menu
80
- */
81
- visible: ItemCtx<Item>[];
82
- /**
83
- * Highlighted item context.
84
- * It is designed to define the highlighted item in the dropdown menu
85
- */
86
- highlighted: ItemCtx<Item> | undefined;
87
- }
88
- export interface SelectApi<Item> {
89
- /**
90
- * Clear all the selected items
91
- */
92
- clear(): void;
93
- /**
94
- * Clear the filter text
95
- */
96
- clearText(): void;
97
- /**
98
- * Highlight the given item, if there is a corresponding match among the visible list
99
- */
100
- highlight(item: Item): void;
101
- /**
102
- * Highlight the first item among the visible list
103
- */
104
- highlightFirst(): void;
105
- /**
106
- * Highlight the previous item among the visible list
107
- * Loop to the last item if needed
108
- */
109
- highlightPrevious(): void;
110
- /**
111
- * Highlight the next item among the visible list.
112
- * Loop to the first item if needed
113
- */
114
- highlightNext(): void;
115
- /**
116
- * Highlight the last item among the visible list
117
- */
118
- highlightLast(): void;
119
- /**
120
- * Focus the provided item among the selected list.
121
- * The focus feature is designed to know what item must be focused in the UI, i.e. among the badge elements.
122
- */
123
- focus(item: Item): void;
124
- /**
125
- * Focus the first element
126
- */
127
- focusFirst(): void;
128
- /**
129
- * Focus the previous element. If no element was focused before the call, nothing happens.
130
- */
131
- focusPrevious(): void;
132
- /**
133
- * Focus the next element. If no element was focused before the call, nothing happens.
134
- */
135
- focusNext(): void;
136
- /**
137
- * Focus the last element. If no element was focused before the call, nothing happens.
138
- */
139
- focusLast(): void;
140
- /**
141
- * Select the provided item.
142
- * The selected list is used to
143
- * @param item - the item to select
144
- */
145
- select(item: Item): void;
146
- /**
147
- * Unselect the provided item.
148
- * @param item - the item to unselect
149
- */
150
- unselect(item: Item): void;
151
- /**
152
- * Toggle the selection of an item
153
- * @param item - the item to toggle
154
- * @param selected - an optional boolean to enforce the selected/unselected state instead of toggling
155
- */
156
- toggleItem(item: Item, selected?: boolean): void;
157
- /**
158
- * open the select
159
- */
160
- open(): void;
161
- /**
162
- * close the select
163
- */
164
- close(): void;
165
- /**
166
- * Toggle the dropdown menu
167
- * @param isOpen - If specified, set the menu in the defined state.
168
- */
169
- toggle(isOpen?: boolean): void;
170
- }
171
- export interface SelectDirectives {
172
- /**
173
- * Directive to be used in the input group and the menu containers
174
- */
175
- hasFocusDirective: HasFocus['directive'];
176
- }
177
- export interface SelectActions {
178
- /**
179
- * Method to be plugged to on the 'input' event. The input text will be used as the filter text.
180
- */
181
- onInput: (e: {
182
- target: any;
183
- }) => void;
184
- /**
185
- * Method to be plugged to on an keydown event, in order to control the keyboard interactions with the highlighted item.
186
- * It manages arrow keys to move the highlighted item, or enter to toggle the item.
187
- */
188
- onInputKeydown: (e: any) => void;
189
- }
190
- export type SelectWidget<Item> = Widget<SelectProps<Item>, SelectState<Item>, SelectApi<Item>, SelectActions, SelectDirectives>;
191
- /**
192
- * Create a SelectWidget with given config props
193
- * @param config - an optional alert config
194
- * @returns a SelectWidget
195
- */
196
- export declare function createSelect<Item>(config?: PropsConfig<SelectProps<Item>>): SelectWidget<Item>;
package/select.js DELETED
@@ -1,240 +0,0 @@
1
- import { asReadable, batch, computed, writable } from '@amadeus-it-group/tansu';
2
- import { createHasFocus } from './services/focustrack';
3
- import { stateStores, writablesForProps } from './services/stores';
4
- function defaultMatchFn(item, text) {
5
- return JSON.stringify(item).toLowerCase().includes(text.toLowerCase());
6
- }
7
- function defaultItemId(item) {
8
- return '' + item;
9
- }
10
- const defaultConfig = {
11
- opened: false,
12
- disabled: false,
13
- items: [],
14
- filterText: '',
15
- loading: false,
16
- selected: [],
17
- itemId: defaultItemId,
18
- matchFn: defaultMatchFn,
19
- onFilterTextChange: undefined,
20
- className: '',
21
- };
22
- /**
23
- * Create a SelectWidget with given config props
24
- * @param config - an optional alert config
25
- * @returns a SelectWidget
26
- */
27
- export function createSelect(config) {
28
- // Props
29
- const [{ opened$: _dirtyOpened$, items$, itemId$, matchFn$, onFilterTextChange$, ...otherProps }, patch] = writablesForProps(defaultConfig, config);
30
- const { selected$, filterText$ } = otherProps;
31
- const { hasFocus$, directive: hasFocusDirective } = createHasFocus();
32
- const opened$ = computed(() => {
33
- const _dirtyOpened = _dirtyOpened$();
34
- const hasFocus = hasFocus$();
35
- if (!hasFocus && _dirtyOpened) {
36
- _dirtyOpened$.set(false);
37
- }
38
- return _dirtyOpened && hasFocus;
39
- });
40
- const highlightedIndex$ = (function () {
41
- const store = writable(0);
42
- const newStore = asReadable(store, {
43
- set(index) {
44
- const { length } = visible$();
45
- if (index != undefined) {
46
- if (!length) {
47
- index = undefined;
48
- }
49
- else if (index < 0) {
50
- index = length - 1;
51
- }
52
- else if (index >= length) {
53
- index = 0;
54
- }
55
- }
56
- store.set(index);
57
- },
58
- update(fn) {
59
- newStore.set(fn(store()));
60
- },
61
- });
62
- return newStore;
63
- })();
64
- const visible$ = computed(() => {
65
- const list = [];
66
- if (opened$()) {
67
- const selected = selected$();
68
- const filterText = filterText$();
69
- const matchFn = !filterText ? () => true : matchFn$();
70
- const itemId = itemId$();
71
- for (const item of items$()) {
72
- if (matchFn(item, filterText)) {
73
- list.push({
74
- item,
75
- id: itemId(item),
76
- selected: selected.includes(item),
77
- select: function () {
78
- widget.api.select(this);
79
- }.bind(item),
80
- unselect: function () {
81
- widget.api.unselect(this);
82
- }.bind(item),
83
- toggle: function () {
84
- widget.api.toggleItem(this);
85
- }.bind(item),
86
- });
87
- }
88
- }
89
- }
90
- return list;
91
- });
92
- const highlighted$ = computed(() => {
93
- const visible = visible$();
94
- const highlightedIndex = highlightedIndex$();
95
- return visible.length && highlightedIndex != undefined ? visible[highlightedIndex] : undefined;
96
- });
97
- const widget = {
98
- ...stateStores({
99
- visible$,
100
- highlighted$,
101
- opened$,
102
- ...otherProps,
103
- }),
104
- patch,
105
- api: {
106
- clear() {
107
- selected$.set([]);
108
- },
109
- select(item) {
110
- widget.api.toggleItem(item, true);
111
- },
112
- unselect(item) {
113
- widget.api.toggleItem(item, false);
114
- },
115
- toggleItem(item, selected) {
116
- if (!items$().includes(item)) {
117
- return;
118
- }
119
- selected$.update((selectedItems) => {
120
- selectedItems = [...selectedItems];
121
- const index = selectedItems.indexOf(item);
122
- if (selected == null) {
123
- selected = index === -1;
124
- }
125
- if (selected && index === -1) {
126
- selectedItems.push(item);
127
- }
128
- else if (!selected && index !== -1) {
129
- selectedItems.splice(index, 1);
130
- }
131
- return selectedItems;
132
- });
133
- },
134
- clearText() {
135
- // FIXME: not implemented yet!
136
- },
137
- highlight(item) {
138
- const index = visible$().findIndex((itemCtx) => itemCtx.item === item);
139
- highlightedIndex$.set(index === -1 ? undefined : index);
140
- },
141
- highlightFirst() {
142
- highlightedIndex$.set(0);
143
- },
144
- highlightPrevious() {
145
- highlightedIndex$.update((highlightedIndex) => {
146
- return highlightedIndex != null ? highlightedIndex - 1 : -1;
147
- });
148
- },
149
- highlightNext() {
150
- highlightedIndex$.update((highlightedIndex) => {
151
- return highlightedIndex != null ? highlightedIndex + 1 : Infinity;
152
- });
153
- },
154
- highlightLast() {
155
- highlightedIndex$.set(-1);
156
- },
157
- focus(item) {
158
- // FIXME: not implemented yet!
159
- },
160
- focusFirst() {
161
- // FIXME: not implemented yet!
162
- },
163
- focusPrevious() {
164
- // FIXME: not implemented yet!
165
- },
166
- focusNext() {
167
- // FIXME: not implemented yet!
168
- },
169
- focusLast() {
170
- // FIXME: not implemented yet!
171
- },
172
- open: () => widget.api.toggle(true),
173
- close: () => widget.api.toggle(false),
174
- toggle(isOpen) {
175
- _dirtyOpened$.update((value) => (isOpen != null ? isOpen : !value));
176
- },
177
- },
178
- directives: {
179
- hasFocusDirective,
180
- },
181
- actions: {
182
- onInput({ target }) {
183
- const value = target.value;
184
- batch(() => {
185
- patch({
186
- opened: value != null && value !== '',
187
- filterText: value,
188
- });
189
- onFilterTextChange$()?.(value);
190
- });
191
- },
192
- onInputKeydown(e) {
193
- const { ctrlKey, key } = e;
194
- let keyManaged = true;
195
- switch (key) {
196
- case 'ArrowDown': {
197
- const isOpen = opened$();
198
- if (isOpen) {
199
- if (ctrlKey) {
200
- widget.api.highlightLast();
201
- }
202
- else {
203
- widget.api.highlightNext();
204
- }
205
- }
206
- else {
207
- widget.api.open();
208
- widget.api.highlightFirst();
209
- }
210
- break;
211
- }
212
- case 'ArrowUp':
213
- if (ctrlKey) {
214
- widget.api.highlightFirst();
215
- }
216
- else {
217
- widget.api.highlightPrevious();
218
- }
219
- break;
220
- case 'Enter': {
221
- const itemCtx = highlighted$();
222
- if (itemCtx) {
223
- widget.api.toggleItem(itemCtx.item);
224
- }
225
- break;
226
- }
227
- case 'Escape':
228
- _dirtyOpened$.set(false);
229
- break;
230
- default:
231
- keyManaged = false;
232
- }
233
- if (keyManaged) {
234
- e.preventDefault();
235
- }
236
- },
237
- },
238
- };
239
- return widget;
240
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * a number type guard
3
- * @param value the value to check
4
- * @returns true if the value is a number
5
- */
6
- export declare function isNumber(value: any): value is number;
7
- /**
8
- * a boolean type guard
9
- * @param value the value to check
10
- * @returns true if the value is a boolean
11
- */
12
- export declare function isBoolean(value: any): value is boolean;
13
- /**
14
- * a function type guard
15
- * @param value the value to check
16
- * @returns true if the value is a function
17
- */
18
- export declare function isFunction(value: any): value is (...args: any[]) => any;
19
- /**
20
- * a string type guard
21
- * @param value the value to check
22
- * @returns true if the value is a string
23
- */
24
- export declare function isString(value: any): value is string;
25
- /**
26
- * Clamp the value based on a maximum and optional minimum
27
- * @param value the value to check
28
- * @param max the max to clamp to
29
- * @param [min] the min to clamp to
30
- * @returns the clamped value
31
- */
32
- export declare function clamp(value: number, max: number, min?: number): number;
@@ -1,43 +0,0 @@
1
- /**
2
- * a number type guard
3
- * @param value the value to check
4
- * @returns true if the value is a number
5
- */
6
- export function isNumber(value) {
7
- return typeof value === 'number' && !isNaN(value) && Number.isFinite(value);
8
- }
9
- /**
10
- * a boolean type guard
11
- * @param value the value to check
12
- * @returns true if the value is a boolean
13
- */
14
- export function isBoolean(value) {
15
- return value === true || value === false;
16
- }
17
- /**
18
- * a function type guard
19
- * @param value the value to check
20
- * @returns true if the value is a function
21
- */
22
- export function isFunction(value) {
23
- return typeof value === 'function';
24
- }
25
- /**
26
- * a string type guard
27
- * @param value the value to check
28
- * @returns true if the value is a string
29
- */
30
- export function isString(value) {
31
- return typeof value === 'string';
32
- }
33
- // TODO should we check that max > min?
34
- /**
35
- * Clamp the value based on a maximum and optional minimum
36
- * @param value the value to check
37
- * @param max the max to clamp to
38
- * @param [min] the min to clamp to
39
- * @returns the clamped value
40
- */
41
- export function clamp(value, max, min = 0) {
42
- return Math.max(Math.min(value, max), min);
43
- }
@@ -1,7 +0,0 @@
1
- export * from './siblingsInert';
2
- export * from './directiveUtils';
3
- export * from './focustrack';
4
- export * from './intersection';
5
- export * from './portal';
6
- export * from './stores';
7
- export * from './writables';
package/services/index.js DELETED
@@ -1,7 +0,0 @@
1
- export * from './siblingsInert';
2
- export * from './directiveUtils';
3
- export * from './focustrack';
4
- export * from './intersection';
5
- export * from './portal';
6
- export * from './stores';
7
- export * from './writables';
@@ -1,7 +0,0 @@
1
- import type { WritableWithDefaultOptions } from './stores';
2
- import { INVALID_VALUE } from './stores';
3
- export declare const testToNormalizeValue: <T>(filter: (value: T) => boolean) => (value: T) => typeof INVALID_VALUE | T;
4
- export declare const typeNumber: WritableWithDefaultOptions<number>;
5
- export declare const typeBoolean: WritableWithDefaultOptions<boolean>;
6
- export declare const typeString: WritableWithDefaultOptions<string, any>;
7
- export declare const typeFunction: WritableWithDefaultOptions<(...args: any[]) => any>;
@@ -1,16 +0,0 @@
1
- import { isBoolean, isFunction, isNumber, isString } from './checks';
2
- import { INVALID_VALUE } from './stores';
3
- export const testToNormalizeValue = (filter) => (value) => filter(value) ? value : INVALID_VALUE;
4
- export const typeNumber = {
5
- normalizeValue: testToNormalizeValue(isNumber),
6
- };
7
- export const typeBoolean = {
8
- normalizeValue: testToNormalizeValue(isBoolean),
9
- };
10
- export const typeString = {
11
- normalizeValue: testToNormalizeValue(isString),
12
- };
13
- export const typeFunction = {
14
- normalizeValue: testToNormalizeValue(isFunction),
15
- equal: Object.is,
16
- };
@@ -1,2 +0,0 @@
1
- export declare const collapseVerticalTransition: import("..").TransitionFn;
2
- export declare const collapseHorizontalTransition: import("..").TransitionFn;
@@ -1 +0,0 @@
1
- export declare const fadeTransition: import("..").TransitionFn;
@@ -1,2 +0,0 @@
1
- export * from './collapse';
2
- export * from './fade';
@@ -1,2 +0,0 @@
1
- export * from './collapse';
2
- export * from './fade';
@@ -1,29 +0,0 @@
1
- export interface CollapseContext {
2
- /**
3
- * the maximum size of the collapseable content.
4
- */
5
- maxSize?: string;
6
- /**
7
- * the minimum size of the collapseable content
8
- */
9
- minSize?: string;
10
- }
11
- export interface CollapseConfig {
12
- /**
13
- * the direction in which the collapsing is performed
14
- */
15
- dimension?: 'width' | 'height';
16
- /**
17
- * the list of classes to add to the collapsable element when shown
18
- */
19
- showClasses?: string[];
20
- /**
21
- * the list of classes to add to the collapsable element when collapsed
22
- */
23
- hideClasses?: string[];
24
- /**
25
- * the list of classes to add to the collapsable element while transitioning
26
- */
27
- animationPendingClasses?: string[];
28
- }
29
- export declare const createCollapseTransition: ({ dimension, showClasses, hideClasses, animationPendingClasses }?: CollapseConfig) => import("./baseTransitions").TransitionFn;
@@ -1,5 +0,0 @@
1
- export * from './baseTransitions';
2
- export * from './cssTransitions';
3
- export * from './simpleClassTransition';
4
- import * as bootstrap from './bootstrap';
5
- export { bootstrap };
@@ -1,5 +0,0 @@
1
- export * from './baseTransitions';
2
- export * from './cssTransitions';
3
- export * from './simpleClassTransition';
4
- import * as bootstrap from './bootstrap';
5
- export { bootstrap };
@@ -1,28 +0,0 @@
1
- import { createCSSTransition } from './cssTransitions';
2
- import { addClasses, reflow, removeClasses } from './utils';
3
- export const createSimpleClassTransition = ({ animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses, }) => createCSSTransition((element, direction, animation, context) => {
4
- removeClasses(element, showClasses);
5
- removeClasses(element, hideClasses);
6
- if (animation) {
7
- removeClasses(element, direction === 'show' ? animationPendingHideClasses : animationPendingShowClasses);
8
- if (!context.started) {
9
- context.started = true;
10
- // if the animation is starting, explicitly sets the initial state (reverse of the direction)
11
- // so that it is not impacted by another reflow done somewhere else before we had time to put
12
- // the right classes:
13
- const classes = direction === 'show' ? hideClasses : showClasses;
14
- addClasses(element, classes);
15
- reflow(element);
16
- removeClasses(element, classes);
17
- }
18
- addClasses(element, animationPendingClasses);
19
- reflow(element);
20
- addClasses(element, direction === 'show' ? animationPendingShowClasses : animationPendingHideClasses);
21
- }
22
- return () => {
23
- removeClasses(element, animationPendingClasses);
24
- removeClasses(element, animationPendingShowClasses);
25
- removeClasses(element, animationPendingHideClasses);
26
- addClasses(element, direction === 'show' ? showClasses : hideClasses);
27
- };
28
- });
@@ -1,20 +0,0 @@
1
- import type { ReadableSignal } from '@amadeus-it-group/tansu';
2
- export declare const promiseFromStore: <T>(store: ReadableSignal<T>, condition?: (value: T) => boolean) => {
3
- promise: Promise<T>;
4
- unsubscribe(): void;
5
- };
6
- export declare const promiseFromEvent: (element: EventTarget, event: string) => {
7
- promise: Promise<Event>;
8
- unsubscribe(): void;
9
- };
10
- export declare const promiseFromTimeout: (delay: number) => {
11
- promise: Promise<void>;
12
- unsubscribe(): void;
13
- };
14
- /**
15
- * Launch a reflow using a call to the provided html element getBoudingClientRect
16
- * @param element the html element
17
- */
18
- export declare function reflow(element?: HTMLElement): void;
19
- export declare const addClasses: (element: HTMLElement, classes?: string[]) => void;
20
- export declare const removeClasses: (element: HTMLElement, classes?: string[]) => void;