@agnos-ui/core 0.0.1-alpha.0 → 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 (126) hide show
  1. package/README.md +4 -4
  2. package/{dist/lib → components/accordion}/accordion.d.ts +29 -25
  3. package/{dist/lib → components/accordion}/accordion.js +81 -77
  4. package/components/accordion/index.d.ts +1 -0
  5. package/components/accordion/index.js +1 -0
  6. package/components/alert/alert.d.ts +31 -0
  7. package/components/alert/alert.js +22 -0
  8. package/{dist/lib/alert.d.ts → components/alert/common.d.ts} +17 -20
  9. package/{dist/lib/alert.js → components/alert/common.js} +22 -19
  10. package/components/alert/index.d.ts +2 -0
  11. package/components/alert/index.js +2 -0
  12. package/components/commonProps.d.ts +6 -0
  13. package/components/commonProps.js +1 -0
  14. package/components/modal/index.d.ts +1 -0
  15. package/components/modal/index.js +1 -0
  16. package/{dist/lib → components}/modal/modal.d.ts +30 -29
  17. package/{dist/lib → components}/modal/modal.js +59 -29
  18. package/components/pagination/index.d.ts +2 -0
  19. package/components/pagination/index.js +2 -0
  20. package/{dist/lib → components/pagination}/pagination.d.ts +5 -14
  21. package/{dist/lib → components/pagination}/pagination.js +6 -5
  22. package/components/progressbar/index.d.ts +1 -0
  23. package/components/progressbar/index.js +1 -0
  24. package/components/progressbar/progressbar.d.ts +86 -0
  25. package/components/progressbar/progressbar.js +78 -0
  26. package/components/rating/index.d.ts +1 -0
  27. package/components/rating/index.js +1 -0
  28. package/{dist/lib → components/rating}/rating.d.ts +6 -13
  29. package/{dist/lib → components/rating}/rating.js +6 -9
  30. package/components/select/index.d.ts +1 -0
  31. package/components/select/index.js +1 -0
  32. package/components/select/select.d.ts +337 -0
  33. package/components/select/select.js +266 -0
  34. package/components/slider/index.d.ts +1 -0
  35. package/components/slider/index.js +1 -0
  36. package/components/slider/slider.d.ts +245 -0
  37. package/components/slider/slider.js +413 -0
  38. package/{dist/lib/config.d.ts → config.d.ts} +17 -7
  39. package/{dist/lib/config.js → config.js} +3 -3
  40. package/index.d.ts +25 -0
  41. package/index.js +31 -0
  42. package/package.json +42 -28
  43. package/services/extendWidget.d.ts +23 -0
  44. package/services/extendWidget.js +35 -0
  45. package/services/floatingUI.d.ts +56 -0
  46. package/services/floatingUI.js +105 -0
  47. package/{dist/lib/services → services}/focustrack.js +5 -5
  48. package/services/intersection.d.ts +34 -0
  49. package/services/intersection.js +55 -0
  50. package/services/navManager.d.ts +93 -0
  51. package/services/navManager.js +172 -0
  52. package/{dist/lib/services → services}/portal.d.ts +7 -0
  53. package/services/portal.js +44 -0
  54. package/{dist/lib/services → services}/siblingsInert.d.ts +2 -1
  55. package/{dist/lib/services → services}/siblingsInert.js +2 -2
  56. package/{dist/lib → services}/transitions/baseTransitions.d.ts +15 -2
  57. package/{dist/lib → services}/transitions/baseTransitions.js +21 -10
  58. package/services/transitions/bootstrap/collapse.d.ts +2 -0
  59. package/services/transitions/bootstrap/fade.d.ts +1 -0
  60. package/services/transitions/bootstrap.d.ts +2 -0
  61. package/services/transitions/bootstrap.js +2 -0
  62. package/services/transitions/collapse.d.ts +43 -0
  63. package/{dist/lib → services}/transitions/collapse.js +15 -2
  64. package/{dist/lib → services}/transitions/cssTransitions.d.ts +6 -0
  65. package/{dist/lib → services}/transitions/cssTransitions.js +8 -4
  66. package/{dist/lib → services}/transitions/simpleClassTransition.d.ts +12 -1
  67. package/services/transitions/simpleClassTransition.js +42 -0
  68. package/{dist/lib/types.d.ts → types.d.ts} +43 -4
  69. package/types.js +14 -0
  70. package/{dist/lib/services/directiveUtils.js → utils/directive.js} +1 -1
  71. package/utils/internal/checks.d.ts +49 -0
  72. package/utils/internal/checks.js +60 -0
  73. package/utils/internal/dom.d.ts +25 -0
  74. package/utils/internal/dom.js +61 -0
  75. package/utils/internal/func.d.ts +11 -0
  76. package/utils/internal/func.js +11 -0
  77. package/utils/internal/isFocusable.d.ts +9 -0
  78. package/utils/internal/isFocusable.js +35 -0
  79. package/utils/internal/math.d.ts +5 -0
  80. package/utils/internal/math.js +13 -0
  81. package/utils/internal/promise.d.ts +87 -0
  82. package/utils/internal/promise.js +169 -0
  83. package/utils/internal/scrollbars.d.ts +8 -0
  84. package/{dist/lib/modal → utils/internal}/scrollbars.js +7 -1
  85. package/utils/internal/sort.d.ts +16 -0
  86. package/utils/internal/sort.js +28 -0
  87. package/utils/internal/textDirection.d.ts +7 -0
  88. package/utils/internal/textDirection.js +7 -0
  89. package/utils/internal/traversal.d.ts +54 -0
  90. package/utils/internal/traversal.js +105 -0
  91. package/{dist/lib/services → utils}/stores.d.ts +67 -33
  92. package/{dist/lib/services → utils}/stores.js +121 -59
  93. package/utils/writables.d.ts +32 -0
  94. package/utils/writables.js +72 -0
  95. package/dist/lib/index.d.ts +0 -11
  96. package/dist/lib/index.js +0 -11
  97. package/dist/lib/modal/scrollbars.d.ts +0 -2
  98. package/dist/lib/select.d.ts +0 -199
  99. package/dist/lib/select.js +0 -240
  100. package/dist/lib/services/checks.d.ts +0 -32
  101. package/dist/lib/services/checks.js +0 -43
  102. package/dist/lib/services/index.d.ts +0 -6
  103. package/dist/lib/services/index.js +0 -6
  104. package/dist/lib/services/portal.js +0 -33
  105. package/dist/lib/services/writables.d.ts +0 -7
  106. package/dist/lib/services/writables.js +0 -16
  107. package/dist/lib/transitions/bootstrap/collapse.d.ts +0 -2
  108. package/dist/lib/transitions/bootstrap/fade.d.ts +0 -1
  109. package/dist/lib/transitions/bootstrap/index.d.ts +0 -2
  110. package/dist/lib/transitions/bootstrap/index.js +0 -2
  111. package/dist/lib/transitions/collapse.d.ts +0 -29
  112. package/dist/lib/transitions/index.d.ts +0 -5
  113. package/dist/lib/transitions/index.js +0 -5
  114. package/dist/lib/transitions/simpleClassTransition.js +0 -28
  115. package/dist/lib/transitions/utils.d.ts +0 -20
  116. package/dist/lib/transitions/utils.js +0 -83
  117. package/dist/lib/tsdoc-metadata.json +0 -11
  118. package/dist/lib/types.js +0 -7
  119. package/dist/lib/utils.d.ts +0 -2
  120. package/dist/lib/utils.js +0 -2
  121. /package/{dist/lib/pagination.utils.d.ts → components/pagination/bootstrap.d.ts} +0 -0
  122. /package/{dist/lib/pagination.utils.js → components/pagination/bootstrap.js} +0 -0
  123. /package/{dist/lib/services → services}/focustrack.d.ts +0 -0
  124. /package/{dist/lib → services}/transitions/bootstrap/collapse.js +0 -0
  125. /package/{dist/lib → services}/transitions/bootstrap/fade.js +0 -0
  126. /package/{dist/lib/services/directiveUtils.d.ts → utils/directive.d.ts} +0 -0
@@ -1,2 +0,0 @@
1
- export declare const removeScrollbars: () => void;
2
- export declare const revertScrollbars: () => void;
@@ -1,199 +0,0 @@
1
- import type { HasFocus } from './services/focustrack';
2
- import type { PropsConfig } from './services/stores';
3
- import type { Widget } from './types';
4
- export interface SelectCommonPropsAndState<Item> {
5
- /**
6
- * the class to attach to the select DOM element
7
- */
8
- className: string;
9
- /**
10
- * List of selected items
11
- */
12
- selected: Item[];
13
- /**
14
- * Filtered text to be display in the filter input
15
- */
16
- filterText: string;
17
- /**
18
- * true if the select is disabled
19
- */
20
- disabled: boolean;
21
- /**
22
- * true if the select is open
23
- */
24
- opened: boolean;
25
- /**
26
- * true if a loading process is being done
27
- */
28
- loading: boolean;
29
- }
30
- export interface SelectProps<T> extends SelectCommonPropsAndState<T> {
31
- /**
32
- * List of available items for the dropdown
33
- */
34
- items: T[];
35
- /**
36
- * Custom function to filter an item.
37
- * By default, item is considered as a string, and the function returns true if the text is found
38
- */
39
- matchFn(item: T, text: string): boolean;
40
- /**
41
- * Custom function to get the id of an item
42
- * By default, the item is returned
43
- */
44
- itemId(item: T): string;
45
- /**
46
- * Callback called when the text filter change
47
- * @param text - Filtered text
48
- */
49
- onFilterTextChange?(text: string): void;
50
- }
51
- /**
52
- * Item representation built from the items provided in parameters
53
- */
54
- export interface ItemCtx<T> {
55
- /**
56
- * Original item given in the parameters
57
- */
58
- item: T;
59
- /**
60
- * Unique id to identify the item
61
- */
62
- id: string;
63
- /**
64
- * Specify if the item is checked
65
- */
66
- selected: boolean;
67
- /**
68
- * Select the item
69
- */
70
- select(): void;
71
- /**
72
- * Unselect the item
73
- */
74
- unselect(): void;
75
- /**
76
- * Toggle the item selection
77
- */
78
- toggle(): void;
79
- }
80
- export interface SelectState<Item> extends SelectCommonPropsAndState<Item> {
81
- /**
82
- * List of visible items displayed in the menu
83
- */
84
- visible: ItemCtx<Item>[];
85
- /**
86
- * Highlighted item context.
87
- * It is designed to define the highlighted item in the dropdown menu
88
- */
89
- highlighted: ItemCtx<Item> | undefined;
90
- }
91
- export interface SelectApi<Item> {
92
- /**
93
- * Clear all the selected items
94
- */
95
- clear(): void;
96
- /**
97
- * Clear the filter text
98
- */
99
- clearText(): void;
100
- /**
101
- * Highlight the given item, if there is a corresponding match among the visible list
102
- */
103
- highlight(item: Item): void;
104
- /**
105
- * Highlight the first item among the visible list
106
- */
107
- highlightFirst(): void;
108
- /**
109
- * Highlight the previous item among the visible list
110
- * Loop to the last item if needed
111
- */
112
- highlightPrevious(): void;
113
- /**
114
- * Highlight the next item among the visible list.
115
- * Loop to the first item if needed
116
- */
117
- highlightNext(): void;
118
- /**
119
- * Highlight the last item among the visible list
120
- */
121
- highlightLast(): void;
122
- /**
123
- * Focus the provided item among the selected list.
124
- * The focus feature is designed to know what item must be focused in the UI, i.e. among the badge elements.
125
- */
126
- focus(item: Item): void;
127
- /**
128
- * Focus the first element
129
- */
130
- focusFirst(): void;
131
- /**
132
- * Focus the previous element. If no element was focused before the call, nothing happens.
133
- */
134
- focusPrevious(): void;
135
- /**
136
- * Focus the next element. If no element was focused before the call, nothing happens.
137
- */
138
- focusNext(): void;
139
- /**
140
- * Focus the last element. If no element was focused before the call, nothing happens.
141
- */
142
- focusLast(): void;
143
- /**
144
- * Select the provided item.
145
- * The selected list is used to
146
- * @param item - the item to select
147
- */
148
- select(item: Item): void;
149
- /**
150
- * Unselect the provided item.
151
- * @param item - the item to unselect
152
- */
153
- unselect(item: Item): void;
154
- /**
155
- * Toggle the selection of an item
156
- * @param item - the item to toggle
157
- * @param selected - an optional boolean to enforce the selected/unselected state instead of toggling
158
- */
159
- toggleItem(item: Item, selected?: boolean): void;
160
- /**
161
- * open the select
162
- */
163
- open(): void;
164
- /**
165
- * close the select
166
- */
167
- close(): void;
168
- /**
169
- * Toggle the dropdown menu
170
- * @param isOpen - If specified, set the menu in the defined state.
171
- */
172
- toggle(isOpen?: boolean): void;
173
- }
174
- export interface SelectDirectives {
175
- /**
176
- * Directive to be used in the input group and the menu containers
177
- */
178
- hasFocusDirective: HasFocus['directive'];
179
- }
180
- export interface SelectActions {
181
- /**
182
- * Method to be plugged to on the 'input' event. The input text will be used as the filter text.
183
- */
184
- onInput: (e: {
185
- target: any;
186
- }) => void;
187
- /**
188
- * Method to be plugged to on an keydown event, in order to control the keyboard interactions with the highlighted item.
189
- * It manages arrow keys to move the highlighted item, or enter to toggle the item.
190
- */
191
- onInputKeydown: (e: any) => void;
192
- }
193
- export type SelectWidget<Item> = Widget<SelectProps<Item>, SelectState<Item>, SelectApi<Item>, SelectActions, SelectDirectives>;
194
- /**
195
- * Create a SelectWidget with given config props
196
- * @param config - an optional alert config
197
- * @returns a SelectWidget
198
- */
199
- export declare function createSelect<Item>(config?: PropsConfig<SelectProps<Item>>): SelectWidget<Item>;
@@ -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,6 +0,0 @@
1
- export * from './siblingsInert';
2
- export * from './directiveUtils';
3
- export * from './focustrack';
4
- export * from './portal';
5
- export * from './stores';
6
- export * from './writables';
@@ -1,6 +0,0 @@
1
- export * from './siblingsInert';
2
- export * from './directiveUtils';
3
- export * from './focustrack';
4
- export * from './portal';
5
- export * from './stores';
6
- export * from './writables';
@@ -1,33 +0,0 @@
1
- export const portal = (content, newArg) => {
2
- let arg;
3
- let replaceComment;
4
- const removeReplaceComment = () => {
5
- if (replaceComment) {
6
- replaceComment.parentNode?.replaceChild(content, replaceComment);
7
- replaceComment = null;
8
- }
9
- };
10
- const update = (newArg) => {
11
- if (newArg !== arg) {
12
- arg = newArg;
13
- const container = arg?.container ?? arg?.insertBefore?.parentElement;
14
- if (container) {
15
- if (!replaceComment) {
16
- replaceComment = content.parentNode?.insertBefore(content.ownerDocument.createComment('portal'), content);
17
- }
18
- container.insertBefore(content, arg?.insertBefore ?? null);
19
- }
20
- else {
21
- removeReplaceComment();
22
- }
23
- }
24
- };
25
- update(newArg);
26
- return {
27
- update,
28
- destroy: () => {
29
- removeReplaceComment();
30
- content.parentNode?.removeChild(content);
31
- },
32
- };
33
- };
@@ -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
- });