@digdir/designsystemet-react 0.59.0 → 0.59.1-alpha.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/dist/cjs/components/DropdownMenu/DropdownMenuContent.js +4 -4
- package/dist/cjs/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/cjs/components/Modal/ModalDialog.js +1 -1
- package/dist/cjs/components/Popover/PopoverContent.js +6 -6
- package/dist/cjs/components/Popover/PopoverTrigger.js +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +6 -6
- package/dist/cjs/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/cjs/components/form/Combobox/Combobox.js +60 -177
- package/dist/cjs/components/form/Combobox/ComboboxContext.js +8 -0
- package/dist/cjs/components/form/Combobox/ComboboxIdContext.js +42 -0
- package/dist/cjs/components/form/Combobox/Custom/Custom.js +14 -9
- package/dist/cjs/components/form/Combobox/Empty/Empty.js +4 -4
- package/dist/cjs/components/form/Combobox/Option/Option.js +15 -33
- package/dist/cjs/components/form/Combobox/Option/useComboboxOption.js +47 -0
- package/dist/cjs/components/form/Combobox/internal/ComboboxChips.js +14 -6
- package/dist/cjs/components/form/Combobox/internal/ComboboxClearButton.js +4 -4
- package/dist/cjs/components/form/Combobox/internal/ComboboxInput.js +40 -35
- package/dist/cjs/components/form/Combobox/internal/ComboboxNative.js +2 -2
- package/dist/cjs/components/form/Combobox/useCombobox.js +46 -32
- package/dist/cjs/components/form/Combobox/useComboboxKeyboard.js +79 -0
- package/dist/cjs/components/form/Combobox/useFloatingCombobox.js +78 -0
- package/dist/cjs/components/form/Search/Search.js +1 -1
- package/dist/cjs/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
- package/dist/cjs/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +83 -31
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +307 -157
- package/dist/cjs/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -4
- package/dist/cjs/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +22 -18
- package/dist/{esm → cjs/packages/react}/node_modules/tabbable/dist/index.esm.js +59 -13
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/cjs/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/esm/components/DropdownMenu/DropdownMenuContent.js +3 -3
- package/dist/esm/components/DropdownMenu/DropdownMenuTrigger.js +1 -1
- package/dist/esm/components/Modal/ModalDialog.js +1 -1
- package/dist/esm/components/Popover/PopoverContent.js +4 -4
- package/dist/esm/components/Popover/PopoverTrigger.js +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +4 -4
- package/dist/esm/components/form/Checkbox/Checkbox.js +1 -1
- package/dist/esm/components/form/Combobox/Combobox.js +65 -182
- package/dist/esm/components/form/Combobox/ComboboxContext.js +6 -0
- package/dist/esm/components/form/Combobox/ComboboxIdContext.js +35 -0
- package/dist/esm/components/form/Combobox/Custom/Custom.js +13 -8
- package/dist/esm/components/form/Combobox/Empty/Empty.js +3 -3
- package/dist/esm/components/form/Combobox/Option/Option.js +15 -33
- package/dist/esm/components/form/Combobox/Option/useComboboxOption.js +45 -0
- package/dist/esm/components/form/Combobox/internal/ComboboxChips.js +13 -5
- package/dist/esm/components/form/Combobox/internal/ComboboxClearButton.js +3 -3
- package/dist/esm/components/form/Combobox/internal/ComboboxInput.js +39 -34
- package/dist/esm/components/form/Combobox/internal/ComboboxNative.js +2 -2
- package/dist/esm/components/form/Combobox/useCombobox.js +46 -32
- package/dist/esm/components/form/Combobox/useComboboxKeyboard.js +77 -0
- package/dist/esm/components/form/Combobox/useFloatingCombobox.js +76 -0
- package/dist/esm/components/form/Search/Search.js +1 -1
- package/dist/esm/node_modules/@floating-ui/utils/{dom/dist → dist}/floating-ui.utils.dom.js +7 -4
- package/dist/esm/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +5 -0
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/core/dist/floating-ui.core.js +40 -16
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/dom/dist/floating-ui.dom.js +82 -30
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react/dist/floating-ui.react.js +282 -135
- package/dist/esm/{node_modules/@floating-ui/react/utils → packages/react/node_modules/@floating-ui/react}/dist/floating-ui.react.utils.js +9 -5
- package/dist/esm/{node_modules → packages/react/node_modules}/@floating-ui/react-dom/dist/floating-ui.react-dom.js +19 -14
- package/dist/{cjs → esm/packages/react}/node_modules/tabbable/dist/index.esm.js +55 -15
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexItem.js +1 -1
- package/dist/esm/utilities/RovingTabIndex/RovingTabindexRoot.js +1 -1
- package/dist/types/components/form/Combobox/Combobox.d.ts +104 -39
- package/dist/types/components/form/Combobox/Combobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts +48 -0
- package/dist/types/components/form/Combobox/ComboboxContext.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts +19 -0
- package/dist/types/components/form/Combobox/ComboboxIdContext.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/Custom/Custom.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/Option.d.ts +2 -2
- package/dist/types/components/form/Combobox/Option/Option.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts +14 -0
- package/dist/types/components/form/Combobox/Option/useComboboxOption.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/internal/ComboboxChips.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts +0 -1
- package/dist/types/components/form/Combobox/internal/ComboboxInput.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts +3 -1
- package/dist/types/components/form/Combobox/internal/ComboboxNative.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useCombobox.d.ts +13 -5
- package/dist/types/components/form/Combobox/useCombobox.d.ts.map +1 -1
- package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts +20 -0
- package/dist/types/components/form/Combobox/useComboboxKeyboard.d.ts.map +1 -0
- package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts +41 -0
- package/dist/types/components/form/Combobox/useFloatingCombobox.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -6
- package/dist/cjs/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -68
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -4
- package/dist/esm/node_modules/@floating-ui/react/node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.js +0 -57
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { isShadowRoot, isHTMLElement } from '
|
|
2
|
+
import { isShadowRoot, isHTMLElement } from '../../../../../../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js';
|
|
3
3
|
|
|
4
4
|
function activeElement(doc) {
|
|
5
5
|
let activeElement = doc.activeElement;
|
|
@@ -13,7 +13,7 @@ function contains(parent, child) {
|
|
|
13
13
|
if (!parent || !child) {
|
|
14
14
|
return false;
|
|
15
15
|
}
|
|
16
|
-
const rootNode = child.getRootNode
|
|
16
|
+
const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
|
|
17
17
|
|
|
18
18
|
// First, attempt with faster native method
|
|
19
19
|
if (parent.contains(child)) {
|
|
@@ -70,9 +70,10 @@ function isVirtualClick(event) {
|
|
|
70
70
|
return event.detail === 0 && !event.pointerType;
|
|
71
71
|
}
|
|
72
72
|
function isVirtualPointerEvent(event) {
|
|
73
|
-
|
|
73
|
+
if (isJSDOM()) return false;
|
|
74
|
+
return !isAndroid() && event.width === 0 && event.height === 0 || isAndroid() && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'mouse' ||
|
|
74
75
|
// iOS VoiceOver returns 0.333• for width/height.
|
|
75
|
-
event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0;
|
|
76
|
+
event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch';
|
|
76
77
|
}
|
|
77
78
|
function isSafari() {
|
|
78
79
|
// Chrome DevTools does not complain about navigator.vendor
|
|
@@ -85,6 +86,9 @@ function isAndroid() {
|
|
|
85
86
|
function isMac() {
|
|
86
87
|
return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints;
|
|
87
88
|
}
|
|
89
|
+
function isJSDOM() {
|
|
90
|
+
return getUserAgent().includes('jsdom/');
|
|
91
|
+
}
|
|
88
92
|
function isMouseLikePointerType(pointerType, strict) {
|
|
89
93
|
// On some Linux machines with Chromium, mouse inputs return a `pointerType`
|
|
90
94
|
// of "pen": https://github.com/floating-ui/floating-ui/issues/2015
|
|
@@ -137,4 +141,4 @@ function isTypeableCombobox(element) {
|
|
|
137
141
|
return element.getAttribute('role') === 'combobox' && isTypeableElement(element);
|
|
138
142
|
}
|
|
139
143
|
|
|
140
|
-
export { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };
|
|
144
|
+
export { TYPEABLE_SELECTOR, activeElement, contains, getDocument, getPlatform, getTarget, getUserAgent, isAndroid, isEventTargetWithin, isJSDOM, isMac, isMouseLikePointerType, isReactEvent, isRootElement, isSafari, isTypeableCombobox, isTypeableElement, isVirtualClick, isVirtualPointerEvent, stopEvent };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { computePosition } from '../../dom/dist/floating-ui.dom.js';
|
|
3
|
-
export { autoUpdate, platform } from '../../dom/dist/floating-ui.dom.js';
|
|
2
|
+
import { arrow as arrow$1, computePosition } from '../../dom/dist/floating-ui.dom.js';
|
|
3
|
+
export { autoUpdate, flip, platform, shift, size } from '../../dom/dist/floating-ui.dom.js';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useLayoutEffect, useEffect } from 'react';
|
|
6
6
|
import * as ReactDOM from 'react-dom';
|
|
7
|
-
import { arrow as arrow$1 } from '../../core/dist/floating-ui.core.js';
|
|
8
|
-
export { detectOverflow, flip, offset, shift, size } from '../../core/dist/floating-ui.core.js';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
9
|
* Provides data to position an inner element of the floating element so that it
|
|
@@ -33,7 +31,8 @@ const arrow = options => {
|
|
|
33
31
|
}).fn(state);
|
|
34
32
|
}
|
|
35
33
|
return {};
|
|
36
|
-
}
|
|
34
|
+
}
|
|
35
|
+
if (element) {
|
|
37
36
|
return arrow$1({
|
|
38
37
|
element,
|
|
39
38
|
padding
|
|
@@ -58,11 +57,13 @@ function deepEqual(a, b) {
|
|
|
58
57
|
if (typeof a === 'function' && a.toString() === b.toString()) {
|
|
59
58
|
return true;
|
|
60
59
|
}
|
|
61
|
-
let length
|
|
62
|
-
|
|
60
|
+
let length;
|
|
61
|
+
let i;
|
|
62
|
+
let keys;
|
|
63
|
+
if (a && b && typeof a === 'object') {
|
|
63
64
|
if (Array.isArray(a)) {
|
|
64
65
|
length = a.length;
|
|
65
|
-
if (length
|
|
66
|
+
if (length !== b.length) return false;
|
|
66
67
|
for (i = length; i-- !== 0;) {
|
|
67
68
|
if (!deepEqual(a[i], b[i])) {
|
|
68
69
|
return false;
|
|
@@ -91,6 +92,8 @@ function deepEqual(a, b) {
|
|
|
91
92
|
}
|
|
92
93
|
return true;
|
|
93
94
|
}
|
|
95
|
+
|
|
96
|
+
// biome-ignore lint/suspicious/noSelfCompare: in source
|
|
94
97
|
return a !== a && b !== b;
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -151,22 +154,23 @@ function useFloating(options) {
|
|
|
151
154
|
const [_reference, _setReference] = React.useState(null);
|
|
152
155
|
const [_floating, _setFloating] = React.useState(null);
|
|
153
156
|
const setReference = React.useCallback(node => {
|
|
154
|
-
if (node
|
|
157
|
+
if (node !== referenceRef.current) {
|
|
155
158
|
referenceRef.current = node;
|
|
156
159
|
_setReference(node);
|
|
157
160
|
}
|
|
158
|
-
}, [
|
|
161
|
+
}, []);
|
|
159
162
|
const setFloating = React.useCallback(node => {
|
|
160
163
|
if (node !== floatingRef.current) {
|
|
161
164
|
floatingRef.current = node;
|
|
162
165
|
_setFloating(node);
|
|
163
166
|
}
|
|
164
|
-
}, [
|
|
167
|
+
}, []);
|
|
165
168
|
const referenceEl = externalReference || _reference;
|
|
166
169
|
const floatingEl = externalFloating || _floating;
|
|
167
170
|
const referenceRef = React.useRef(null);
|
|
168
171
|
const floatingRef = React.useRef(null);
|
|
169
172
|
const dataRef = React.useRef(data);
|
|
173
|
+
const hasWhileElementsMounted = whileElementsMounted != null;
|
|
170
174
|
const whileElementsMountedRef = useLatestRef(whileElementsMounted);
|
|
171
175
|
const platformRef = useLatestRef(platform);
|
|
172
176
|
const update = React.useCallback(() => {
|
|
@@ -210,17 +214,18 @@ function useFloating(options) {
|
|
|
210
214
|
isMountedRef.current = false;
|
|
211
215
|
};
|
|
212
216
|
}, []);
|
|
217
|
+
|
|
218
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: `hasWhileElementsMounted` is intentionally included.
|
|
213
219
|
index(() => {
|
|
214
220
|
if (referenceEl) referenceRef.current = referenceEl;
|
|
215
221
|
if (floatingEl) floatingRef.current = floatingEl;
|
|
216
222
|
if (referenceEl && floatingEl) {
|
|
217
223
|
if (whileElementsMountedRef.current) {
|
|
218
224
|
return whileElementsMountedRef.current(referenceEl, floatingEl, update);
|
|
219
|
-
} else {
|
|
220
|
-
update();
|
|
221
225
|
}
|
|
226
|
+
update();
|
|
222
227
|
}
|
|
223
|
-
}, [referenceEl, floatingEl, update, whileElementsMountedRef]);
|
|
228
|
+
}, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
|
|
224
229
|
const refs = React.useMemo(() => ({
|
|
225
230
|
reference: referenceRef,
|
|
226
231
|
floating: floatingRef,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
2
|
/*!
|
|
5
|
-
* tabbable 6.
|
|
3
|
+
* tabbable 6.2.0
|
|
6
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
7
5
|
*/
|
|
8
6
|
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
@@ -182,7 +180,27 @@ var getCandidatesIteratively = function getCandidatesIteratively(elements, inclu
|
|
|
182
180
|
}
|
|
183
181
|
return candidates;
|
|
184
182
|
};
|
|
185
|
-
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @private
|
|
186
|
+
* Determines if the node has an explicitly specified `tabindex` attribute.
|
|
187
|
+
* @param {HTMLElement} node
|
|
188
|
+
* @returns {boolean} True if so; false if not.
|
|
189
|
+
*/
|
|
190
|
+
var hasTabIndex = function hasTabIndex(node) {
|
|
191
|
+
return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Determine the tab index of a given node.
|
|
196
|
+
* @param {HTMLElement} node
|
|
197
|
+
* @returns {number} Tab order (negative, 0, or positive number).
|
|
198
|
+
* @throws {Error} If `node` is falsy.
|
|
199
|
+
*/
|
|
200
|
+
var getTabIndex = function getTabIndex(node) {
|
|
201
|
+
if (!node) {
|
|
202
|
+
throw new Error('No node provided');
|
|
203
|
+
}
|
|
186
204
|
if (node.tabIndex < 0) {
|
|
187
205
|
// in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
188
206
|
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
@@ -191,16 +209,28 @@ var getTabindex = function getTabindex(node, isScope) {
|
|
|
191
209
|
// order, consider their tab index to be 0.
|
|
192
210
|
// Also browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
193
211
|
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
194
|
-
|
|
195
|
-
// isScope is positive for custom element with shadow root or slot that by default
|
|
196
|
-
// have tabIndex -1, but need to be sorted by document order in order for their
|
|
197
|
-
// content to be inserted in the correct position
|
|
198
|
-
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
|
|
212
|
+
if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
|
|
199
213
|
return 0;
|
|
200
214
|
}
|
|
201
215
|
}
|
|
202
216
|
return node.tabIndex;
|
|
203
217
|
};
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Determine the tab index of a given node __for sort order purposes__.
|
|
221
|
+
* @param {HTMLElement} node
|
|
222
|
+
* @param {boolean} [isScope] True for a custom element with shadow root or slot that, by default,
|
|
223
|
+
* has tabIndex -1, but needs to be sorted by document order in order for its content to be
|
|
224
|
+
* inserted into the correct sort position.
|
|
225
|
+
* @returns {number} Tab order (negative, 0, or positive number).
|
|
226
|
+
*/
|
|
227
|
+
var getSortOrderTabIndex = function getSortOrderTabIndex(node, isScope) {
|
|
228
|
+
var tabIndex = getTabIndex(node);
|
|
229
|
+
if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
|
|
230
|
+
return 0;
|
|
231
|
+
}
|
|
232
|
+
return tabIndex;
|
|
233
|
+
};
|
|
204
234
|
var sortOrderedTabbables = function sortOrderedTabbables(a, b) {
|
|
205
235
|
return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
|
|
206
236
|
};
|
|
@@ -443,7 +473,7 @@ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(o
|
|
|
443
473
|
return true;
|
|
444
474
|
};
|
|
445
475
|
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
|
|
446
|
-
if (isNonTabbableRadio(node) ||
|
|
476
|
+
if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
|
|
447
477
|
return false;
|
|
448
478
|
}
|
|
449
479
|
return true;
|
|
@@ -468,7 +498,7 @@ var sortByOrder = function sortByOrder(candidates) {
|
|
|
468
498
|
candidates.forEach(function (item, i) {
|
|
469
499
|
var isScope = !!item.scopeParent;
|
|
470
500
|
var element = isScope ? item.scopeParent : item;
|
|
471
|
-
var candidateTabindex =
|
|
501
|
+
var candidateTabindex = getSortOrderTabIndex(element, isScope);
|
|
472
502
|
var elements = isScope ? sortByOrder(item.candidates) : element;
|
|
473
503
|
if (candidateTabindex === 0) {
|
|
474
504
|
isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
|
|
@@ -487,20 +517,30 @@ var sortByOrder = function sortByOrder(candidates) {
|
|
|
487
517
|
return acc;
|
|
488
518
|
}, []).concat(regularTabbables);
|
|
489
519
|
};
|
|
490
|
-
var tabbable = function tabbable(
|
|
520
|
+
var tabbable = function tabbable(container, options) {
|
|
491
521
|
options = options || {};
|
|
492
522
|
var candidates;
|
|
493
523
|
if (options.getShadowRoot) {
|
|
494
|
-
candidates = getCandidatesIteratively([
|
|
524
|
+
candidates = getCandidatesIteratively([container], options.includeContainer, {
|
|
495
525
|
filter: isNodeMatchingSelectorTabbable.bind(null, options),
|
|
496
526
|
flatten: false,
|
|
497
527
|
getShadowRoot: options.getShadowRoot,
|
|
498
528
|
shadowRootFilter: isValidShadowRootTabbable
|
|
499
529
|
});
|
|
500
530
|
} else {
|
|
501
|
-
candidates = getCandidates(
|
|
531
|
+
candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
|
|
502
532
|
}
|
|
503
533
|
return sortByOrder(candidates);
|
|
504
534
|
};
|
|
535
|
+
var isTabbable = function isTabbable(node, options) {
|
|
536
|
+
options = options || {};
|
|
537
|
+
if (!node) {
|
|
538
|
+
throw new Error('No node provided');
|
|
539
|
+
}
|
|
540
|
+
if (matches.call(node, candidateSelector) === false) {
|
|
541
|
+
return false;
|
|
542
|
+
}
|
|
543
|
+
return isNodeMatchingSelectorTabbable(options, node);
|
|
544
|
+
};
|
|
505
545
|
|
|
506
|
-
|
|
546
|
+
export { getTabIndex, isTabbable, tabbable };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
4
|
+
import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
import { useRovingTabindex } from './useRovingTabindex.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, forwardRef, useState, useRef } from 'react';
|
|
4
|
-
import { useMergeRefs } from '../../node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
4
|
+
import { useMergeRefs } from '../../packages/react/node_modules/@floating-ui/react/dist/floating-ui.react.js';
|
|
5
5
|
import { Slot as $5e63c961fc1ce211$export$8c6ed5c666ac1360 } from '../../node_modules/@radix-ui/react-slot/dist/index.js';
|
|
6
6
|
|
|
7
7
|
const RovingTabindexContext = createContext({
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type * as React from 'react';
|
|
2
|
-
import type { UseFloatingReturn, UseListNavigationProps } from '@floating-ui/react';
|
|
3
2
|
import type { FormFieldProps } from '../useFormField';
|
|
4
|
-
import { useFormField } from '../useFormField';
|
|
5
3
|
import type { PortalProps } from '../../../types/Portal';
|
|
6
4
|
import type { Option } from './useCombobox';
|
|
7
5
|
export type ComboboxProps = {
|
|
@@ -100,6 +98,110 @@ export type ComboboxProps = {
|
|
|
100
98
|
*/
|
|
101
99
|
chipSrLabel?: (option: Option) => string;
|
|
102
100
|
} & PortalProps & FormFieldProps & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'>;
|
|
101
|
+
export declare const ComboboxComponent: React.ForwardRefExoticComponent<{
|
|
102
|
+
/**
|
|
103
|
+
* Label for the combobox
|
|
104
|
+
*/
|
|
105
|
+
label?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Visually hides `label` and `description` (still available for screen readers)
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
hideLabel?: boolean | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* String array of selected options. Contains only one option during single selection mode.
|
|
113
|
+
*/
|
|
114
|
+
value?: string[] | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* String array of initial selected options. Contains only one option during single selection mode.
|
|
117
|
+
*/
|
|
118
|
+
initialValue?: string[] | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Callback function that is called when the value changes
|
|
121
|
+
*/
|
|
122
|
+
onValueChange?: ((value: string[]) => void) | undefined;
|
|
123
|
+
/**
|
|
124
|
+
* Multiple options can be selected
|
|
125
|
+
* @default false
|
|
126
|
+
*/
|
|
127
|
+
multiple?: boolean | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* Name of the value when used in a form
|
|
130
|
+
*/
|
|
131
|
+
name?: string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Exposes the HTML `size` attribute.
|
|
134
|
+
* @default 0
|
|
135
|
+
*/
|
|
136
|
+
htmlSize?: number | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* Hides chips when multiple options are selected
|
|
139
|
+
* @default false
|
|
140
|
+
*/
|
|
141
|
+
hideChips?: boolean | undefined;
|
|
142
|
+
/**
|
|
143
|
+
* Label for the clear button
|
|
144
|
+
* @default 'Fjern alt'
|
|
145
|
+
* @deprecated Use `clearButtonLabel` instead
|
|
146
|
+
*/
|
|
147
|
+
cleanButtonLabel?: string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* Hides the clear button
|
|
150
|
+
* @default false
|
|
151
|
+
*/
|
|
152
|
+
hideClearButton?: boolean | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* Label for the clear button
|
|
155
|
+
* @default 'Fjern alt'
|
|
156
|
+
*/
|
|
157
|
+
clearButtonLabel?: string | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* Enables virtualizing of options list.
|
|
160
|
+
* @see https://tanstack.com/virtual
|
|
161
|
+
* @default false
|
|
162
|
+
*/
|
|
163
|
+
virtual?: boolean | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Value of the input field
|
|
166
|
+
*/
|
|
167
|
+
inputValue?: string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* Adds `aria-busy` and displays loading state for the Combobox
|
|
170
|
+
* All options will be hidden and replaced with a loading message.
|
|
171
|
+
* @default false
|
|
172
|
+
*/
|
|
173
|
+
loading?: boolean | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* Text to display when the combobox is loading
|
|
176
|
+
* @default 'Laster...'
|
|
177
|
+
*/
|
|
178
|
+
loadingLabel?: string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Filter function for filtering the list of options. Return `true` to show option, `false` to hide option.
|
|
181
|
+
* @param inputValue
|
|
182
|
+
* @param option
|
|
183
|
+
* @returns boolean
|
|
184
|
+
*
|
|
185
|
+
* @default (inputValue, option) => option.value.toLowerCase().startsWith(inputValue.toLowerCase())
|
|
186
|
+
*/
|
|
187
|
+
filter?: ((inputValue: string, option: Option) => boolean) | undefined;
|
|
188
|
+
/**
|
|
189
|
+
* Add a screen reader label to the chips
|
|
190
|
+
* @param option
|
|
191
|
+
* @returns string
|
|
192
|
+
*
|
|
193
|
+
* @default (option) => 'Slett ' + option.label,
|
|
194
|
+
*/
|
|
195
|
+
chipSrLabel?: ((option: Option) => string) | undefined;
|
|
196
|
+
} & PortalProps & {
|
|
197
|
+
error?: React.ReactNode;
|
|
198
|
+
errorId?: string | undefined;
|
|
199
|
+
disabled?: boolean | undefined;
|
|
200
|
+
description?: React.ReactNode;
|
|
201
|
+
id?: string | undefined;
|
|
202
|
+
readOnly?: boolean | undefined;
|
|
203
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
204
|
+
} & Pick<React.HTMLAttributes<HTMLElement>, "aria-describedby"> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
103
205
|
export declare const Combobox: React.ForwardRefExoticComponent<{
|
|
104
206
|
/**
|
|
105
207
|
* Label for the combobox
|
|
@@ -204,41 +306,4 @@ export declare const Combobox: React.ForwardRefExoticComponent<{
|
|
|
204
306
|
readOnly?: boolean | undefined;
|
|
205
307
|
size?: "small" | "medium" | "large" | undefined;
|
|
206
308
|
} & Pick<React.HTMLAttributes<HTMLElement>, "aria-describedby"> & Omit<React.InputHTMLAttributes<HTMLInputElement>, "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
207
|
-
type ComboboxContextType = {
|
|
208
|
-
multiple: NonNullable<ComboboxProps['multiple']>;
|
|
209
|
-
disabled: NonNullable<ComboboxProps['disabled']>;
|
|
210
|
-
readOnly: NonNullable<ComboboxProps['readOnly']>;
|
|
211
|
-
name: ComboboxProps['name'];
|
|
212
|
-
error: ComboboxProps['error'];
|
|
213
|
-
htmlSize: ComboboxProps['htmlSize'];
|
|
214
|
-
hideChips: NonNullable<ComboboxProps['hideChips']>;
|
|
215
|
-
clearButtonLabel: NonNullable<ComboboxProps['clearButtonLabel']>;
|
|
216
|
-
hideClearButton: NonNullable<ComboboxProps['hideClearButton']>;
|
|
217
|
-
options: Option[];
|
|
218
|
-
selectedOptions: Option[];
|
|
219
|
-
size: NonNullable<ComboboxProps['size']>;
|
|
220
|
-
formFieldProps: ReturnType<typeof useFormField>;
|
|
221
|
-
refs: UseFloatingReturn['refs'];
|
|
222
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
223
|
-
activeIndex: number | null;
|
|
224
|
-
open: boolean;
|
|
225
|
-
inputValue: string;
|
|
226
|
-
activeDescendant: string | undefined;
|
|
227
|
-
optionValues: string[];
|
|
228
|
-
listId: string;
|
|
229
|
-
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
230
|
-
setOpen: (open: boolean) => void;
|
|
231
|
-
handleKeyDown: (event: React.KeyboardEvent) => void;
|
|
232
|
-
setActiveIndex: (index: number | null) => void;
|
|
233
|
-
setActiveOption: (index: number, id: string) => void;
|
|
234
|
-
getReferenceProps: (props?: Record<string, unknown>) => Record<string, unknown>;
|
|
235
|
-
onOptionClick: (value: string) => void;
|
|
236
|
-
setSelectedOptions: React.Dispatch<React.SetStateAction<Option[]>>;
|
|
237
|
-
chipSrLabel: NonNullable<ComboboxProps['chipSrLabel']>;
|
|
238
|
-
handleSelectOption: (option: Option) => void;
|
|
239
|
-
listRef: UseListNavigationProps['listRef'];
|
|
240
|
-
forwareddRef: React.Ref<HTMLInputElement>;
|
|
241
|
-
};
|
|
242
|
-
export declare const ComboboxContext: React.Context<ComboboxContextType | undefined>;
|
|
243
|
-
export {};
|
|
244
309
|
//# sourceMappingURL=Combobox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/Combobox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/Combobox.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAMpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAKzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAa5C,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACzD;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;CAC1C,GAAG,WAAW,GACb,cAAc,GACd,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAE5D,eAAO,MAAM,iBAAiB;IAlG5B;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;6BACqB,MAAM,EAAE,KAAK,IAAI;IACzC;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;OAOG;2BACmB,MAAM,UAAU,MAAM,KAAK,OAAO;IACxD;;;;;;OAMG;4BACoB,MAAM,KAAK,MAAM;;;;;;;;;oKAiWzC,CAAC;AAEF,eAAO,MAAM,QAAQ;IAhcnB;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;6BACqB,MAAM,EAAE,KAAK,IAAI;IACzC;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;;;OAIG;;IAEH;;OAEG;;IAEH;;;;OAIG;;IAEH;;;OAGG;;IAEH;;;;;;;OAOG;2BACmB,MAAM,UAAU,MAAM,KAAK,OAAO;IACxD;;;;;;OAMG;4BACoB,MAAM,KAAK,MAAM;;;;;;;;;oKA4WzC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { UseFloatingReturn, UseListNavigationProps, useInteractions } from '@floating-ui/react';
|
|
2
|
+
import type { useFormField } from '../useFormField';
|
|
3
|
+
import type { ComboboxProps } from './Combobox';
|
|
4
|
+
import type { Option } from './useCombobox';
|
|
5
|
+
import type useCombobox from './useCombobox';
|
|
6
|
+
type ComboboxContextType = {
|
|
7
|
+
multiple: NonNullable<ComboboxProps['multiple']>;
|
|
8
|
+
disabled: NonNullable<ComboboxProps['disabled']>;
|
|
9
|
+
readOnly: NonNullable<ComboboxProps['readOnly']>;
|
|
10
|
+
name: ComboboxProps['name'];
|
|
11
|
+
error: ComboboxProps['error'];
|
|
12
|
+
htmlSize: ComboboxProps['htmlSize'];
|
|
13
|
+
hideChips: NonNullable<ComboboxProps['hideChips']>;
|
|
14
|
+
clearButtonLabel: NonNullable<ComboboxProps['clearButtonLabel']>;
|
|
15
|
+
hideClearButton: NonNullable<ComboboxProps['hideClearButton']>;
|
|
16
|
+
filteredOptions: ReturnType<typeof useCombobox>['filteredOptions'];
|
|
17
|
+
options: {
|
|
18
|
+
[key: string]: Option;
|
|
19
|
+
};
|
|
20
|
+
selectedOptions: {
|
|
21
|
+
[key: string]: Option;
|
|
22
|
+
};
|
|
23
|
+
size: NonNullable<ComboboxProps['size']>;
|
|
24
|
+
formFieldProps: ReturnType<typeof useFormField>;
|
|
25
|
+
refs: UseFloatingReturn['refs'];
|
|
26
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
27
|
+
open: boolean;
|
|
28
|
+
inputValue: string;
|
|
29
|
+
optionValues: string[];
|
|
30
|
+
listId: string;
|
|
31
|
+
customIds: string[];
|
|
32
|
+
setInputValue: React.Dispatch<React.SetStateAction<string>>;
|
|
33
|
+
setOpen: (open: boolean) => void;
|
|
34
|
+
handleKeyDown: (event: React.KeyboardEvent) => void;
|
|
35
|
+
getReferenceProps: (props?: Record<string, unknown>) => Record<string, unknown>;
|
|
36
|
+
getItemProps: ReturnType<typeof useInteractions>['getItemProps'];
|
|
37
|
+
onOptionClick: (value: string) => void;
|
|
38
|
+
setSelectedOptions: React.Dispatch<React.SetStateAction<{
|
|
39
|
+
[key: string]: Option;
|
|
40
|
+
}>>;
|
|
41
|
+
chipSrLabel: NonNullable<ComboboxProps['chipSrLabel']>;
|
|
42
|
+
handleSelectOption: (option: Option) => void;
|
|
43
|
+
listRef: UseListNavigationProps['listRef'];
|
|
44
|
+
forwareddRef: React.Ref<HTMLInputElement>;
|
|
45
|
+
};
|
|
46
|
+
export declare const ComboboxContext: import("react").Context<ComboboxContextType | undefined>;
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=ComboboxContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/ComboboxContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9B,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,SAAS,EAAE,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,gBAAgB,EAAE,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACjE,eAAe,EAAE,WAAW,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC/D,eAAe,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,OAAO,EAAE;QACP,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,eAAe,EAAE;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,IAAI,EAAE,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,cAAc,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;IAChD,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,aAAa,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5D,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,aAAa,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,KAAK,IAAI,CAAC;IACpD,iBAAiB,EAAE,CACjB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC5B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,YAAY,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,cAAc,CAAC,CAAC;IACjE,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAChC,KAAK,CAAC,cAAc,CAAC;QACnB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC,CACH,CAAC;IACF,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,CAAC;IACvD,kBAAkB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,OAAO,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAC3C,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,eAAe,0DAE3B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Dispatch } from 'react';
|
|
2
|
+
type ComboboxIdContextType = {
|
|
3
|
+
activeIndex: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const ComboboxIdContext: import("react").Context<ComboboxIdContextType>;
|
|
6
|
+
type SetActiveIndexAction = {
|
|
7
|
+
type: 'SET_ACTIVE_INDEX';
|
|
8
|
+
payload: number;
|
|
9
|
+
};
|
|
10
|
+
type ComboboxIdReducerAction = SetActiveIndexAction;
|
|
11
|
+
export declare const ComboboxIdReducer: (state: ComboboxIdContextType, action: ComboboxIdReducerAction) => ComboboxIdContextType;
|
|
12
|
+
export declare const ComboboxIdDispatch: import("react").Context<Dispatch<SetActiveIndexAction>>;
|
|
13
|
+
export declare const ComboboxIdProvider: ({ children, }: {
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare function useComboboxIdDispatch(): Dispatch<SetActiveIndexAction>;
|
|
17
|
+
export declare function useComboboxId(): ComboboxIdContextType;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=ComboboxIdContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxIdContext.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/Combobox/ComboboxIdContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,iBAAiB,gDAE5B,CAAC;AAEH,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,uBAAuB,GAAG,oBAAoB,CAAC;AAEpD,eAAO,MAAM,iBAAiB,UACrB,qBAAqB,UACpB,uBAAuB,0BAWhC,CAAC;AAEF,eAAO,MAAM,kBAAkB,yDAI7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;cAGnB,MAAM,SAAS;6CAa1B,CAAC;AAEF,wBAAgB,qBAAqB,mCAEpC;AAED,wBAAgB,aAAa,0BAE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Custom.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Custom/Custom.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Custom.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Custom/Custom.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAWpC,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,WAAW,CAAC,EAAE,KAAK,CAAC;IACpB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GACtC,CAAC,gBAAgB,GAAG,mBAAmB,CAAC,CAAC;AAE3C,eAAO,MAAM,cAAc,4FA6C1B,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -14,7 +14,7 @@ export type ComboboxOptionProps = {
|
|
|
14
14
|
*/
|
|
15
15
|
displayValue?: string;
|
|
16
16
|
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
17
|
-
export declare const ComboboxOption: React.ForwardRefExoticComponent<{
|
|
17
|
+
export declare const ComboboxOption: React.MemoExoticComponent<React.ForwardRefExoticComponent<{
|
|
18
18
|
/**
|
|
19
19
|
* The value returned when the option is selected
|
|
20
20
|
*/
|
|
@@ -28,5 +28,5 @@ export declare const ComboboxOption: React.ForwardRefExoticComponent<{
|
|
|
28
28
|
* Required if children is not composed of strings only.
|
|
29
29
|
*/
|
|
30
30
|
displayValue?: string | undefined;
|
|
31
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement
|
|
31
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>>;
|
|
32
32
|
//# sourceMappingURL=Option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/Option.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Option.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/Option.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAYpC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc;IAfzB;;OAEG;WACI,MAAM;IACb;;OAEG;;IAEH;;;OAGG;;4FAyEJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type UseComboboxOptionProps = {
|
|
2
|
+
id?: string;
|
|
3
|
+
ref: React.Ref<HTMLButtonElement>;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
export default function useComboboxOption({ id, ref, value, }: UseComboboxOptionProps): {
|
|
7
|
+
id: string;
|
|
8
|
+
ref: ((instance: HTMLButtonElement | null) => void) | null;
|
|
9
|
+
selected: import("../useCombobox").Option;
|
|
10
|
+
active: boolean;
|
|
11
|
+
onOptionClick: (...args: never[]) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useComboboxOption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComboboxOption.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/Option/useComboboxOption.tsx"],"names":[],"mappings":"AAOA,KAAK,sBAAsB,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,EAAE,EACF,GAAG,EACH,KAAK,GACN,EAAE,sBAAsB;;;;;;EAoDxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxChips.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxChips.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;
|
|
1
|
+
{"version":3,"file":"ComboboxChips.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxChips.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;CA4DzB,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxInput.tsx"],"names":[],"mappings":"AAgBA,eAAO,MAAM,aAAa;kBAEvB,KAAK,MAAM,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;;CA+K3D,CAAC;AAIF,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Option } from '../useCombobox';
|
|
2
2
|
import type { ComboboxProps } from '../Combobox';
|
|
3
3
|
type ComboboxNativeProps = {
|
|
4
|
-
selectedOptions:
|
|
4
|
+
selectedOptions: {
|
|
5
|
+
[key: string]: Option;
|
|
6
|
+
};
|
|
5
7
|
multiple: NonNullable<ComboboxProps['multiple']>;
|
|
6
8
|
name: ComboboxProps['name'];
|
|
7
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxNative.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxNative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"ComboboxNative.d.ts","sourceRoot":"","sources":["../../../../../../src/components/form/Combobox/internal/ComboboxNative.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC;IACjD,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc;2CAIxB,mBAAmB;;CAqBrB,CAAC;AAIF,eAAe,cAAc,CAAC"}
|