@ledgerhq/lumen-ui-react 0.1.16 → 0.1.17
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/ai-rules/RULES.md +1 -1
- package/dist/index.js +148 -142
- package/dist/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/lib/Components/BaseInput/BaseInput.js +70 -77
- package/dist/lib/Components/MediaImage/MediaImage.d.ts +19 -0
- package/dist/lib/Components/MediaImage/MediaImage.d.ts.map +1 -0
- package/dist/lib/Components/MediaImage/MediaImage.js +75 -0
- package/dist/lib/Components/MediaImage/index.d.ts +3 -0
- package/dist/lib/Components/MediaImage/index.d.ts.map +1 -0
- package/dist/lib/Components/MediaImage/types.d.ts +38 -0
- package/dist/lib/Components/MediaImage/types.d.ts.map +1 -0
- package/dist/lib/Components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/lib/Components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/lib/Components/SearchInput/SearchInput.js +24 -20
- package/dist/lib/Components/SearchInput/types.d.ts +1 -1
- package/dist/lib/Components/SearchInput/types.d.ts.map +1 -1
- package/dist/lib/Components/Select/Select.d.ts +27 -12
- package/dist/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/lib/Components/Select/Select.js +356 -202
- package/dist/lib/Components/Select/SelectContext.d.ts +3 -1
- package/dist/lib/Components/Select/SelectContext.d.ts.map +1 -1
- package/dist/lib/Components/Select/index.d.ts +1 -1
- package/dist/lib/Components/Select/index.d.ts.map +1 -1
- package/dist/lib/Components/Select/types.d.ts +171 -140
- package/dist/lib/Components/Select/types.d.ts.map +1 -1
- package/dist/lib/Components/Select/useSelectItems/index.d.ts +2 -0
- package/dist/lib/Components/Select/useSelectItems/index.d.ts.map +1 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.d.ts +30 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.d.ts.map +1 -0
- package/dist/lib/Components/Select/useSelectItems/useSelectItems.js +42 -0
- package/dist/lib/Components/Select/utils/groupItems.d.ts +13 -0
- package/dist/lib/Components/Select/utils/groupItems.d.ts.map +1 -0
- package/dist/lib/Components/Select/utils/groupItems.js +16 -0
- package/dist/lib/Components/Select/utils/index.d.ts +2 -0
- package/dist/lib/Components/Select/utils/index.d.ts.map +1 -0
- package/dist/lib/Components/index.d.ts +1 -0
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/libs/utils-shared/dist/index.js +151 -124
- package/dist/node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js +17 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/empty/ComboboxEmpty.js +26 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js +34 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroupContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/group-label/ComboboxGroupLabel.js +27 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js +221 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js +113 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/item-indicator/ComboboxItemIndicator.js +52 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js +65 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js +76 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js +24 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js +102 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js +14 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js +596 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/ComboboxRoot.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js +41 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/constants.js +8 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/index.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js +43 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js +10 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/store.js +74 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js +135 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js +32 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js +15 -0
- package/dist/node_modules/@base-ui/react/esm/combobox/value/ComboboxValue.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/CompositeList.js +81 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/CompositeListContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/composite/list/useCompositeListItem.js +55 -0
- package/dist/node_modules/@base-ui/react/esm/field/control/FieldControlDataAttributes.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/field/root/FieldRootContext.js +53 -0
- package/dist/node_modules/@base-ui/react/esm/field/useField.js +51 -0
- package/dist/node_modules/@base-ui/react/esm/field/utils/constants.js +37 -0
- package/dist/node_modules/@base-ui/react/esm/field/utils/getCombinedFieldValidityData.js +12 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useListNavigation.js +287 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/hooks/useTypeahead.js +71 -0
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js +218 -4
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js +7 -3
- package/dist/node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js +3 -3
- package/dist/node_modules/@base-ui/react/esm/form/FormContext.js +23 -0
- package/dist/node_modules/@base-ui/react/esm/labelable-provider/LabelableContext.js +19 -0
- package/dist/node_modules/@base-ui/react/esm/labelable-provider/useLabelableId.js +44 -0
- package/dist/node_modules/@base-ui/react/esm/utils/constants.js +11 -8
- package/dist/node_modules/@base-ui/react/esm/utils/createBaseUIEventDetails.js +22 -13
- package/dist/node_modules/@base-ui/react/esm/utils/getPseudoElementBounds.js +18 -0
- package/dist/node_modules/@base-ui/react/esm/utils/itemEquality.js +20 -0
- package/dist/node_modules/@base-ui/react/esm/utils/reason-parts.js +13 -6
- package/dist/node_modules/@base-ui/react/esm/utils/resolveAriaLabelledBy.js +6 -0
- package/dist/node_modules/@base-ui/react/esm/utils/resolveValueLabel.js +73 -0
- package/dist/node_modules/@base-ui/react/esm/utils/serializeValue.js +14 -0
- package/dist/node_modules/@base-ui/utils/esm/detectBrowser.js +8 -7
- package/dist/node_modules/@base-ui/utils/esm/empty.js +3 -2
- package/dist/node_modules/@base-ui/utils/esm/useControlled.js +31 -0
- package/dist/node_modules/@base-ui/utils/esm/visuallyHidden.js +5 -1
- package/dist/package.json +1 -2
- package/package.json +1 -2
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { useControlled as Xe } from "../../../../utils/esm/useControlled.js";
|
|
3
|
+
import { useIsoLayoutEffect as Z } from "../../../../utils/esm/useIsoLayoutEffect.js";
|
|
4
|
+
import { useOnFirstRender as dn } from "../../../../utils/esm/useOnFirstRender.js";
|
|
5
|
+
import { useStableCallback as E } from "../../../../utils/esm/useStableCallback.js";
|
|
6
|
+
import { useMergedRefs as mn } from "../../../../utils/esm/useMergedRefs.js";
|
|
7
|
+
import { visuallyHiddenInput as pn, visuallyHidden as gn } from "../../../../utils/esm/visuallyHidden.js";
|
|
8
|
+
import { useRefWithInit as Ct } from "../../../../utils/esm/useRefWithInit.js";
|
|
9
|
+
import { useValueAsRef as In } from "../../../../utils/esm/useValueAsRef.js";
|
|
10
|
+
import { createGenericEventDetails as oe, createChangeEventDetails as S } from "../../utils/createBaseUIEventDetails.js";
|
|
11
|
+
import { ComboboxRootContext as hn, ComboboxFloatingContext as Cn, ComboboxDerivedItemsContext as yn, ComboboxInputValueContext as vn } from "./ComboboxRootContext.js";
|
|
12
|
+
import { selectors as F } from "../store.js";
|
|
13
|
+
import { useOpenChangeComplete as xn } from "../../utils/useOpenChangeComplete.js";
|
|
14
|
+
import { useFieldRootContext as Rn } from "../../field/root/FieldRootContext.js";
|
|
15
|
+
import { useField as Vn } from "../../field/useField.js";
|
|
16
|
+
import { useFormContext as bn } from "../../form/FormContext.js";
|
|
17
|
+
import { useLabelableId as Pn } from "../../labelable-provider/useLabelableId.js";
|
|
18
|
+
import { createSingleSelectionCollatorFilter as En, createCollatorItemFilter as Sn } from "./utils/index.js";
|
|
19
|
+
import { useCoreFilter as An } from "./utils/useFilter.js";
|
|
20
|
+
import { useTransitionStatus as On } from "../../utils/useTransitionStatus.js";
|
|
21
|
+
import { useOpenInteractionType as Fn } from "../../utils/useOpenInteractionType.js";
|
|
22
|
+
import { useValueChanged as Ee } from "../../utils/useValueChanged.js";
|
|
23
|
+
import { stringifyAsLabel as z, isGroupedItems as Mn, stringifyAsValue as le } from "../../utils/resolveValueLabel.js";
|
|
24
|
+
import { selectedValueIncludes as Tn, removeItem as Hn, findItemIndex as yt, defaultItemEquality as wn, compareItemEquality as kn } from "../../utils/itemEquality.js";
|
|
25
|
+
import { INITIAL_LAST_HIGHLIGHT as B, NO_ACTIVE_VALUE as qn } from "./utils/constants.js";
|
|
26
|
+
import { jsx as D, jsxs as Ln } from "react/jsx-runtime";
|
|
27
|
+
import { EMPTY_ARRAY as Se, NOOP as M, EMPTY_OBJECT as Gn } from "../../../../utils/esm/empty.js";
|
|
28
|
+
import { useStore as T } from "../../../../utils/esm/store/useStore.js";
|
|
29
|
+
import { useFloatingRootContext as Nn } from "../../floating-ui-react/hooks/useFloatingRootContext.js";
|
|
30
|
+
import { useClick as Un } from "../../floating-ui-react/hooks/useClick.js";
|
|
31
|
+
import { useDismiss as Qn } from "../../floating-ui-react/hooks/useDismiss.js";
|
|
32
|
+
import { useListNavigation as _n } from "../../floating-ui-react/hooks/useListNavigation.js";
|
|
33
|
+
import { useInteractions as zn } from "../../floating-ui-react/hooks/useInteractions.js";
|
|
34
|
+
import { Store as Bn } from "../../../../utils/esm/store/Store.js";
|
|
35
|
+
import { inputClear as ee, inputChange as vt, focusOut as Yn, outsidePress as jn, itemPress as Wn, none as Y, inputPress as Jn } from "../../utils/reason-parts.js";
|
|
36
|
+
import { getTarget as xt, contains as Ae } from "../../floating-ui-react/utils/element.js";
|
|
37
|
+
function Mi(H) {
|
|
38
|
+
const {
|
|
39
|
+
id: Rt,
|
|
40
|
+
onOpenChangeComplete: Ze,
|
|
41
|
+
defaultSelectedValue: De = null,
|
|
42
|
+
selectedValue: Vt,
|
|
43
|
+
onSelectedValueChange: bt,
|
|
44
|
+
defaultInputValue: et,
|
|
45
|
+
inputValue: tt,
|
|
46
|
+
selectionMode: s = "none",
|
|
47
|
+
onItemHighlighted: Pt,
|
|
48
|
+
name: Et,
|
|
49
|
+
disabled: St = !1,
|
|
50
|
+
readOnly: L = !1,
|
|
51
|
+
required: se = !1,
|
|
52
|
+
inputRef: At,
|
|
53
|
+
grid: j = !1,
|
|
54
|
+
items: u,
|
|
55
|
+
filteredItems: ue,
|
|
56
|
+
filter: ae,
|
|
57
|
+
openOnInputClick: ce = !0,
|
|
58
|
+
autoHighlight: nt = !1,
|
|
59
|
+
keepHighlight: Ot = !1,
|
|
60
|
+
highlightItemOnHover: Ft = !0,
|
|
61
|
+
loopFocus: it = !0,
|
|
62
|
+
itemToStringLabel: d,
|
|
63
|
+
itemToStringValue: w,
|
|
64
|
+
isItemEqualToValue: W = wn,
|
|
65
|
+
virtualized: Oe = !1,
|
|
66
|
+
inline: fe = !1,
|
|
67
|
+
fillInputOnItemPress: Mt = !0,
|
|
68
|
+
modal: Fe = !1,
|
|
69
|
+
limit: A = -1,
|
|
70
|
+
autoComplete: rt = "list",
|
|
71
|
+
formAutoComplete: Tt,
|
|
72
|
+
locale: Ht,
|
|
73
|
+
submitOnItemClick: Me = !1
|
|
74
|
+
} = H, {
|
|
75
|
+
clearErrors: ot
|
|
76
|
+
} = bn(), {
|
|
77
|
+
setDirty: de,
|
|
78
|
+
validityData: me,
|
|
79
|
+
shouldValidateOnChange: pe,
|
|
80
|
+
setFilled: Te,
|
|
81
|
+
name: wt,
|
|
82
|
+
disabled: kt,
|
|
83
|
+
setTouched: qt,
|
|
84
|
+
setFocused: Lt,
|
|
85
|
+
validationMode: Gt,
|
|
86
|
+
validation: h
|
|
87
|
+
} = Rn(), G = Pn({
|
|
88
|
+
id: Rt
|
|
89
|
+
}), ge = An({
|
|
90
|
+
locale: Ht
|
|
91
|
+
}), [N, Ie] = o.useState(!1), [Nt, he] = o.useState(null), He = o.useRef([]), lt = o.useRef([]), we = o.useRef(null), C = o.useRef(null), Ut = o.useRef(null), Qt = o.useRef(null), _t = o.useRef(null), st = o.useRef(!0), ut = o.useRef(!1), at = o.useRef(null), ct = o.useRef(null), ke = o.useRef(null), V = o.useRef(B), qe = o.useRef(null), J = o.useRef([]), ft = o.useRef([]), U = kt || St, b = wt ?? Et, g = s === "multiple", y = s === "single", $ = tt !== void 0 || et !== void 0, k = u !== void 0, Le = ue !== void 0;
|
|
92
|
+
let m;
|
|
93
|
+
nt === "always" ? m = "always" : m = nt ? "input-change" : !1;
|
|
94
|
+
const [n, zt] = Xe({
|
|
95
|
+
controlled: Vt,
|
|
96
|
+
default: g ? De ?? Se : De,
|
|
97
|
+
name: "Combobox",
|
|
98
|
+
state: "selectedValue"
|
|
99
|
+
}), Ce = o.useMemo(() => ae === null ? () => !0 : ae !== void 0 ? ae : y && !N ? En(ge, d, n) : Sn(ge, d), [ae, y, n, N, ge, d]), dt = Ct(() => $ ? et ?? "" : y ? z(n, d) : "").current, [I, Bt] = Xe({
|
|
100
|
+
controlled: tt,
|
|
101
|
+
default: dt,
|
|
102
|
+
name: "Combobox",
|
|
103
|
+
state: "inputValue"
|
|
104
|
+
}), [a, Yt] = Xe({
|
|
105
|
+
controlled: H.open,
|
|
106
|
+
default: H.defaultOpen,
|
|
107
|
+
name: "Combobox",
|
|
108
|
+
state: "open"
|
|
109
|
+
}), O = Mn(u), p = Nt ?? (I === "" ? "" : String(I).trim()), Ge = y ? z(n, d) : "", mt = y && !N && p !== "" && Ge !== "" && Ge.length === p.length && ge.contains(Ge, p), te = mt ? "" : p, pt = k && Le && mt, K = o.useMemo(() => u ? O ? u.flatMap((e) => e.items) : u : Se, [u, O]), ne = o.useMemo(() => {
|
|
110
|
+
if (ue && !pt)
|
|
111
|
+
return ue;
|
|
112
|
+
if (!u)
|
|
113
|
+
return Se;
|
|
114
|
+
if (O) {
|
|
115
|
+
const t = u, r = [];
|
|
116
|
+
let l = 0;
|
|
117
|
+
for (const c of t) {
|
|
118
|
+
if (A > -1 && l >= A)
|
|
119
|
+
break;
|
|
120
|
+
const f = te === "" ? c.items : c.items.filter((Pe) => Ce(Pe, te, d));
|
|
121
|
+
if (f.length === 0)
|
|
122
|
+
continue;
|
|
123
|
+
const Q = A > -1 ? A - l : 1 / 0, _ = f.slice(0, Q);
|
|
124
|
+
if (_.length > 0) {
|
|
125
|
+
const Pe = {
|
|
126
|
+
...c,
|
|
127
|
+
items: _
|
|
128
|
+
};
|
|
129
|
+
r.push(Pe), l += _.length;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return r;
|
|
133
|
+
}
|
|
134
|
+
if (te === "")
|
|
135
|
+
return A > -1 ? K.slice(0, A) : (
|
|
136
|
+
// The cast here is done as `flatItems` is readonly.
|
|
137
|
+
// valuesRef.current, a mutable ref, can be set to `flatFilteredItems`, which may
|
|
138
|
+
// reference this exact readonly value, creating a mutation risk.
|
|
139
|
+
// However, <Combobox.Item> can never mutate this value as the mutating effect
|
|
140
|
+
// bails early when `items` is provided, and this is only ever returned
|
|
141
|
+
// when `items` is provided due to the early return at the top of this hook.
|
|
142
|
+
K
|
|
143
|
+
);
|
|
144
|
+
const e = [];
|
|
145
|
+
for (const t of K) {
|
|
146
|
+
if (A > -1 && e.length >= A)
|
|
147
|
+
break;
|
|
148
|
+
Ce(t, te, d) && e.push(t);
|
|
149
|
+
}
|
|
150
|
+
return e;
|
|
151
|
+
}, [ue, pt, u, O, te, A, Ce, d, K]), v = o.useMemo(() => O ? ne.flatMap((t) => t.items) : ne, [ne, O]), i = Ct(() => new Bn({
|
|
152
|
+
id: G,
|
|
153
|
+
labelId: void 0,
|
|
154
|
+
selectedValue: n,
|
|
155
|
+
open: a,
|
|
156
|
+
filter: Ce,
|
|
157
|
+
query: p,
|
|
158
|
+
items: u,
|
|
159
|
+
selectionMode: s,
|
|
160
|
+
listRef: He,
|
|
161
|
+
labelsRef: lt,
|
|
162
|
+
popupRef: we,
|
|
163
|
+
emptyRef: _t,
|
|
164
|
+
inputRef: C,
|
|
165
|
+
startDismissRef: Ut,
|
|
166
|
+
endDismissRef: Qt,
|
|
167
|
+
keyboardActiveRef: st,
|
|
168
|
+
chipsContainerRef: at,
|
|
169
|
+
clearRef: ct,
|
|
170
|
+
valuesRef: J,
|
|
171
|
+
allValuesRef: ft,
|
|
172
|
+
selectionEventRef: ke,
|
|
173
|
+
name: b,
|
|
174
|
+
disabled: U,
|
|
175
|
+
readOnly: L,
|
|
176
|
+
required: se,
|
|
177
|
+
grid: j,
|
|
178
|
+
isGrouped: O,
|
|
179
|
+
virtualized: Oe,
|
|
180
|
+
openOnInputClick: ce,
|
|
181
|
+
itemToStringLabel: d,
|
|
182
|
+
isItemEqualToValue: W,
|
|
183
|
+
modal: Fe,
|
|
184
|
+
autoHighlight: m,
|
|
185
|
+
submitOnItemClick: Me,
|
|
186
|
+
hasInputValue: $,
|
|
187
|
+
mounted: !1,
|
|
188
|
+
forceMounted: !1,
|
|
189
|
+
transitionStatus: "idle",
|
|
190
|
+
inline: fe,
|
|
191
|
+
activeIndex: null,
|
|
192
|
+
selectedIndex: null,
|
|
193
|
+
popupProps: {},
|
|
194
|
+
inputProps: {},
|
|
195
|
+
triggerProps: {},
|
|
196
|
+
positionerElement: null,
|
|
197
|
+
listElement: null,
|
|
198
|
+
triggerElement: null,
|
|
199
|
+
inputElement: null,
|
|
200
|
+
inputGroupElement: null,
|
|
201
|
+
popupSide: null,
|
|
202
|
+
openMethod: null,
|
|
203
|
+
inputInsidePopup: !0,
|
|
204
|
+
onOpenChangeComplete: Ze || M,
|
|
205
|
+
// Placeholder callbacks replaced on first render
|
|
206
|
+
setOpen: M,
|
|
207
|
+
setInputValue: M,
|
|
208
|
+
setSelectedValue: M,
|
|
209
|
+
setIndices: M,
|
|
210
|
+
onItemHighlighted: M,
|
|
211
|
+
handleSelection: M,
|
|
212
|
+
getItemProps: () => Gn,
|
|
213
|
+
forceMount: M,
|
|
214
|
+
requestSubmit: M
|
|
215
|
+
})).current, X = s === "none" ? I : n, jt = o.useMemo(() => s === "none" ? X : Array.isArray(n) ? n.map((e) => le(e, w)) : le(n, w), [X, w, s, n]), Ne = E(Pt), Ue = E(Ze), ye = T(i, F.activeIndex), Wt = T(i, F.selectedIndex), ve = T(i, F.positionerElement), gt = T(i, F.listElement), ie = T(i, F.triggerElement), xe = T(i, F.inputElement), Jt = T(i, F.inputGroupElement), x = T(i, F.inline), q = T(i, F.inputInsidePopup), $t = In(ie), {
|
|
216
|
+
mounted: It,
|
|
217
|
+
setMounted: Kt,
|
|
218
|
+
transitionStatus: Qe
|
|
219
|
+
} = On(a), {
|
|
220
|
+
openMethod: ht,
|
|
221
|
+
triggerProps: _e
|
|
222
|
+
} = Fn(a);
|
|
223
|
+
Vn({
|
|
224
|
+
id: G,
|
|
225
|
+
name: b,
|
|
226
|
+
commit: h.commit,
|
|
227
|
+
value: X,
|
|
228
|
+
controlRef: q ? $t : C,
|
|
229
|
+
getValue: () => jt
|
|
230
|
+
});
|
|
231
|
+
const Re = E(() => {
|
|
232
|
+
u ? lt.current = v.map((e) => z(e, d)) : i.set("forceMounted", !0);
|
|
233
|
+
}), Xt = o.useRef(n);
|
|
234
|
+
Z(() => {
|
|
235
|
+
n !== Xt.current && Re();
|
|
236
|
+
}, [Re, n]);
|
|
237
|
+
const R = E((e) => {
|
|
238
|
+
i.update(e);
|
|
239
|
+
const t = e.type || "none";
|
|
240
|
+
if (e.activeIndex !== void 0)
|
|
241
|
+
if (e.activeIndex === null)
|
|
242
|
+
V.current !== B && (V.current = B, Ne(void 0, oe(t, void 0, {
|
|
243
|
+
index: -1
|
|
244
|
+
})));
|
|
245
|
+
else {
|
|
246
|
+
const r = J.current[e.activeIndex];
|
|
247
|
+
V.current = {
|
|
248
|
+
value: r,
|
|
249
|
+
index: e.activeIndex
|
|
250
|
+
}, Ne(r, oe(t, void 0, {
|
|
251
|
+
index: e.activeIndex
|
|
252
|
+
}));
|
|
253
|
+
}
|
|
254
|
+
}), P = E((e, t) => {
|
|
255
|
+
if (ut.current = t.reason === ee, H.onInputValueChange?.(e, t), !t.isCanceled) {
|
|
256
|
+
if (t.reason === vt) {
|
|
257
|
+
const r = t.event, l = r.inputType;
|
|
258
|
+
if (r.type === "compositionend" || l != null && l !== "" && l !== "insertReplacementText") {
|
|
259
|
+
const f = e.trim() !== "";
|
|
260
|
+
f && Ie(!0), qe.current = {
|
|
261
|
+
hasQuery: f
|
|
262
|
+
}, f && m && i.state.activeIndex == null && i.set("activeIndex", 0);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
Bt(e);
|
|
266
|
+
}
|
|
267
|
+
}), re = E((e, t) => {
|
|
268
|
+
if (a !== e && (t.reason === "escape-key" && k && v.length === 0 && !i.state.emptyRef.current && t.allowPropagation(), H.onOpenChange?.(e, t), !t.isCanceled && (!e && N && (y ? (x || he(p), p === "" && Ie(!1)) : g && (x || q ? R({
|
|
269
|
+
activeIndex: null
|
|
270
|
+
}) : he(p), P("", S(ee, t.event)))), Yt(e), !e && q && (t.reason === Yn || t.reason === jn) && (qt(!0), Lt(!1), Gt === "onBlur")))) {
|
|
271
|
+
const r = s === "none" ? I : n;
|
|
272
|
+
h.commit(r);
|
|
273
|
+
}
|
|
274
|
+
}), Ve = E((e, t) => {
|
|
275
|
+
if (bt?.(e, t), t.isCanceled)
|
|
276
|
+
return;
|
|
277
|
+
zt(e), (s === "none" && we.current && Mt || y && !i.state.inputInsidePopup) && P(z(e, d), S(t.reason, t.event)), y && e != null && t.reason !== vt && N && !x && he(p);
|
|
278
|
+
}), Zt = E((e, t) => {
|
|
279
|
+
let r = t;
|
|
280
|
+
if (r === void 0) {
|
|
281
|
+
if (ye === null)
|
|
282
|
+
return;
|
|
283
|
+
r = J.current[ye];
|
|
284
|
+
}
|
|
285
|
+
const l = xt(e), c = ke.current ?? e;
|
|
286
|
+
ke.current = null;
|
|
287
|
+
const f = S(Wn, c), Q = l?.closest("a")?.getAttribute("href");
|
|
288
|
+
if (Q) {
|
|
289
|
+
Q.startsWith("#") && re(!1, f);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
if (g) {
|
|
293
|
+
const _ = Array.isArray(n) ? n : [], fn = Tn(_, r, i.state.isItemEqualToValue) ? Hn(_, r, i.state.isItemEqualToValue) : [..._, r];
|
|
294
|
+
if (Ve(fn, f), !(C.current ? C.current.value.trim() !== "" : !1))
|
|
295
|
+
return;
|
|
296
|
+
i.state.inputInsidePopup ? P("", S(ee, f.event)) : re(!1, f);
|
|
297
|
+
} else
|
|
298
|
+
Ve(r, f), re(!1, f);
|
|
299
|
+
}), ze = E(() => {
|
|
300
|
+
if (!i.state.submitOnItemClick)
|
|
301
|
+
return;
|
|
302
|
+
const e = i.state.inputElement?.form;
|
|
303
|
+
e && typeof e.requestSubmit == "function" && e.requestSubmit();
|
|
304
|
+
}), Be = E(() => {
|
|
305
|
+
if (Kt(!1), Ue?.(!1), Ie(!1), he(null), R(s === "none" ? {
|
|
306
|
+
activeIndex: null,
|
|
307
|
+
selectedIndex: null
|
|
308
|
+
} : {
|
|
309
|
+
activeIndex: null
|
|
310
|
+
}), g && C.current && C.current.value !== "" && !ut.current && P("", S(ee)), y)
|
|
311
|
+
if (i.state.inputInsidePopup)
|
|
312
|
+
C.current && C.current.value !== "" && P("", S(ee));
|
|
313
|
+
else {
|
|
314
|
+
const e = z(n, d);
|
|
315
|
+
C.current && C.current.value !== e && P(e, S(e === "" ? ee : Y));
|
|
316
|
+
}
|
|
317
|
+
}), Dt = o.useMemo(() => x && ve ? {
|
|
318
|
+
current: ve.closest('[role="dialog"]')
|
|
319
|
+
} : we, [x, ve]);
|
|
320
|
+
xn({
|
|
321
|
+
enabled: !H.actionsRef,
|
|
322
|
+
open: a,
|
|
323
|
+
ref: Dt,
|
|
324
|
+
onComplete() {
|
|
325
|
+
a || Be();
|
|
326
|
+
}
|
|
327
|
+
}), o.useImperativeHandle(H.actionsRef, () => ({
|
|
328
|
+
unmount: Be
|
|
329
|
+
}), [Be]), Z(function() {
|
|
330
|
+
if (a || s === "none")
|
|
331
|
+
return;
|
|
332
|
+
const t = u ? K : ft.current;
|
|
333
|
+
if (g) {
|
|
334
|
+
const r = Array.isArray(n) ? n : [], l = r[r.length - 1], c = yt(t, l, W);
|
|
335
|
+
R({
|
|
336
|
+
selectedIndex: c === -1 ? null : c
|
|
337
|
+
});
|
|
338
|
+
} else {
|
|
339
|
+
const r = yt(t, n, W);
|
|
340
|
+
R({
|
|
341
|
+
selectedIndex: r === -1 ? null : r
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}, [a, n, u, s, K, g, W, R]), Z(() => {
|
|
345
|
+
u && (J.current = v, He.current.length = v.length);
|
|
346
|
+
}, [u, v]), Z(() => {
|
|
347
|
+
const e = qe.current;
|
|
348
|
+
if (e && (e.hasQuery ? m && i.set("activeIndex", 0) : m === "always" && i.set("activeIndex", 0), qe.current = null), !a && !x)
|
|
349
|
+
return;
|
|
350
|
+
const r = k || Le ? v : J.current, l = i.state.activeIndex;
|
|
351
|
+
if (l == null) {
|
|
352
|
+
if (m === "always" && r.length > 0) {
|
|
353
|
+
i.set("activeIndex", 0);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
V.current !== B && (V.current = B, i.state.onItemHighlighted(void 0, oe(Y, void 0, {
|
|
357
|
+
index: -1
|
|
358
|
+
})));
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
if (l >= r.length) {
|
|
362
|
+
V.current !== B && (V.current = B, i.state.onItemHighlighted(void 0, oe(Y, void 0, {
|
|
363
|
+
index: -1
|
|
364
|
+
}))), i.set("activeIndex", null);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const c = r[l], f = V.current.value, Q = f !== qn && kn(c, f, i.state.isItemEqualToValue);
|
|
368
|
+
(V.current.index !== l || !Q) && (V.current = {
|
|
369
|
+
value: c,
|
|
370
|
+
index: l
|
|
371
|
+
}, i.state.onItemHighlighted(c, oe(Y, void 0, {
|
|
372
|
+
index: l
|
|
373
|
+
})));
|
|
374
|
+
}, [ye, m, Le, k, v, x, a, i]), Z(() => {
|
|
375
|
+
if (s === "none") {
|
|
376
|
+
Te(String(I) !== "");
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
Te(g ? Array.isArray(n) && n.length > 0 : n != null);
|
|
380
|
+
}, [Te, s, I, n, g]), o.useEffect(() => {
|
|
381
|
+
k && m && v.length === 0 && R({
|
|
382
|
+
activeIndex: null
|
|
383
|
+
});
|
|
384
|
+
}, [k, m, v.length, R]), Ee(p, () => {
|
|
385
|
+
!a || p === "" || p === String(dt) || Ie(!0);
|
|
386
|
+
}), Ee(n, () => {
|
|
387
|
+
if (s !== "none" && (ot(b), de(n !== me.initialValue), pe() ? h.commit(n) : h.commit(n, !0), y && !$ && !q)) {
|
|
388
|
+
const e = z(n, d);
|
|
389
|
+
I !== e && P(e, S(Y));
|
|
390
|
+
}
|
|
391
|
+
}), Ee(I, () => {
|
|
392
|
+
s === "none" && (ot(b), de(I !== me.initialValue), pe() ? h.commit(I) : h.commit(I, !0));
|
|
393
|
+
}), Ee(u, () => {
|
|
394
|
+
if (!y || $ || q || N)
|
|
395
|
+
return;
|
|
396
|
+
const e = z(n, d);
|
|
397
|
+
I !== e && P(e, S(Y));
|
|
398
|
+
});
|
|
399
|
+
const be = Nn({
|
|
400
|
+
open: x ? !0 : a,
|
|
401
|
+
onOpenChange: re,
|
|
402
|
+
elements: {
|
|
403
|
+
reference: q ? ie : xe,
|
|
404
|
+
floating: ve
|
|
405
|
+
}
|
|
406
|
+
});
|
|
407
|
+
let Ye, je;
|
|
408
|
+
x || (Ye = j ? "grid" : "listbox", je = a ? "true" : "false");
|
|
409
|
+
const en = o.useMemo(() => {
|
|
410
|
+
const e = xe?.tagName === "INPUT", t = xe == null || e, r = t || a, l = t ? {
|
|
411
|
+
autoComplete: "off",
|
|
412
|
+
spellCheck: "false",
|
|
413
|
+
autoCorrect: "off",
|
|
414
|
+
autoCapitalize: "none"
|
|
415
|
+
} : {};
|
|
416
|
+
return r && (l.role = "combobox", l["aria-expanded"] = je, l["aria-haspopup"] = Ye, l["aria-controls"] = a ? gt?.id : void 0, l["aria-autocomplete"] = rt), {
|
|
417
|
+
reference: l,
|
|
418
|
+
floating: {
|
|
419
|
+
role: "presentation"
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
}, [xe, a, je, Ye, gt?.id, rt]), tn = Un(be, {
|
|
423
|
+
enabled: !L && !U && ce,
|
|
424
|
+
event: "mousedown-only",
|
|
425
|
+
toggle: !1,
|
|
426
|
+
// Apply a small delay for touch to let iOS viewport centering settle.
|
|
427
|
+
// This avoids top-bottom flip flickers if the preferred position is "top" when first tapping.
|
|
428
|
+
touchOpenDelay: q ? 0 : 50,
|
|
429
|
+
reason: Jn
|
|
430
|
+
}), nn = Qn(be, {
|
|
431
|
+
enabled: !L && !U && !x,
|
|
432
|
+
outsidePressEvent: {
|
|
433
|
+
mouse: "sloppy",
|
|
434
|
+
// The visual viewport (affected by the mobile software keyboard) can be
|
|
435
|
+
// somewhat small. The user may want to scroll the screen to see more of
|
|
436
|
+
// the popup.
|
|
437
|
+
touch: "intentional"
|
|
438
|
+
},
|
|
439
|
+
// Without a popup, let the Escape key bubble the event up to other popups' handlers.
|
|
440
|
+
bubbles: x ? !0 : void 0,
|
|
441
|
+
outsidePress(e) {
|
|
442
|
+
const t = xt(e);
|
|
443
|
+
return !Ae(ie, t) && !Ae(ct.current, t) && !Ae(at.current, t) && !Ae(Jt, t);
|
|
444
|
+
}
|
|
445
|
+
}), rn = _n(be, {
|
|
446
|
+
enabled: !L && !U,
|
|
447
|
+
id: G,
|
|
448
|
+
listRef: He,
|
|
449
|
+
activeIndex: ye,
|
|
450
|
+
selectedIndex: Wt,
|
|
451
|
+
virtual: !0,
|
|
452
|
+
loopFocus: it,
|
|
453
|
+
allowEscape: it && !m,
|
|
454
|
+
focusItemOnOpen: N || s === "none" && !m ? !1 : "auto",
|
|
455
|
+
focusItemOnHover: Ft,
|
|
456
|
+
resetOnPointerLeave: !Ot,
|
|
457
|
+
// `cols` > 1 enables grid navigation.
|
|
458
|
+
// Since <Combobox.Row> infers column sizes (and is required when building a grid),
|
|
459
|
+
// it works correctly even with a value of `2`.
|
|
460
|
+
// Floating UI tests don't require `role="row"` wrappers, so retains the number API.
|
|
461
|
+
cols: j ? 2 : 1,
|
|
462
|
+
orientation: j ? "horizontal" : void 0,
|
|
463
|
+
disabledIndices: Se,
|
|
464
|
+
onNavigate(e, t) {
|
|
465
|
+
!t && !a || Qe === "ending" || R(t ? {
|
|
466
|
+
activeIndex: e,
|
|
467
|
+
type: st.current ? "keyboard" : "pointer"
|
|
468
|
+
} : {
|
|
469
|
+
activeIndex: e
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
}), {
|
|
473
|
+
getReferenceProps: We,
|
|
474
|
+
getFloatingProps: Je,
|
|
475
|
+
getItemProps: $e
|
|
476
|
+
} = zn([en, tn, nn, rn]);
|
|
477
|
+
dn(() => {
|
|
478
|
+
i.update({
|
|
479
|
+
inline: fe,
|
|
480
|
+
popupProps: Je(),
|
|
481
|
+
inputProps: We(),
|
|
482
|
+
triggerProps: _e,
|
|
483
|
+
getItemProps: $e,
|
|
484
|
+
setOpen: re,
|
|
485
|
+
setInputValue: P,
|
|
486
|
+
setSelectedValue: Ve,
|
|
487
|
+
setIndices: R,
|
|
488
|
+
onItemHighlighted: Ne,
|
|
489
|
+
handleSelection: Zt,
|
|
490
|
+
forceMount: Re,
|
|
491
|
+
requestSubmit: ze
|
|
492
|
+
});
|
|
493
|
+
}), Z(() => {
|
|
494
|
+
i.update({
|
|
495
|
+
id: G,
|
|
496
|
+
selectedValue: n,
|
|
497
|
+
open: a,
|
|
498
|
+
mounted: It,
|
|
499
|
+
transitionStatus: Qe,
|
|
500
|
+
items: u,
|
|
501
|
+
inline: fe,
|
|
502
|
+
popupProps: Je(),
|
|
503
|
+
inputProps: We(),
|
|
504
|
+
triggerProps: _e,
|
|
505
|
+
openMethod: ht,
|
|
506
|
+
getItemProps: $e,
|
|
507
|
+
selectionMode: s,
|
|
508
|
+
name: b,
|
|
509
|
+
disabled: U,
|
|
510
|
+
readOnly: L,
|
|
511
|
+
required: se,
|
|
512
|
+
grid: j,
|
|
513
|
+
isGrouped: O,
|
|
514
|
+
virtualized: Oe,
|
|
515
|
+
onOpenChangeComplete: Ue,
|
|
516
|
+
openOnInputClick: ce,
|
|
517
|
+
itemToStringLabel: d,
|
|
518
|
+
modal: Fe,
|
|
519
|
+
autoHighlight: m,
|
|
520
|
+
isItemEqualToValue: W,
|
|
521
|
+
submitOnItemClick: Me,
|
|
522
|
+
hasInputValue: $,
|
|
523
|
+
requestSubmit: ze
|
|
524
|
+
});
|
|
525
|
+
}, [i, G, n, a, It, Qe, u, Je, We, $e, ht, _e, s, b, U, L, se, h, j, O, Oe, Ue, ce, d, Fe, W, Me, $, fe, ze, m]);
|
|
526
|
+
const on = mn(At, h.inputRef), ln = o.useMemo(() => ({
|
|
527
|
+
query: p,
|
|
528
|
+
hasItems: k,
|
|
529
|
+
filteredItems: ne,
|
|
530
|
+
flatFilteredItems: v
|
|
531
|
+
}), [p, k, ne, v]), sn = o.useMemo(() => Array.isArray(X) ? "" : le(X, w), [X, w]), un = g && Array.isArray(n) && n.length > 0, Ke = g || s === "none" ? void 0 : b, an = o.useMemo(() => !g || !Array.isArray(n) || !b ? null : n.map((e) => {
|
|
532
|
+
const t = le(e, w);
|
|
533
|
+
return /* @__PURE__ */ D("input", {
|
|
534
|
+
type: "hidden",
|
|
535
|
+
name: b,
|
|
536
|
+
value: t
|
|
537
|
+
}, t);
|
|
538
|
+
}), [g, n, b, w]), cn = /* @__PURE__ */ Ln(o.Fragment, {
|
|
539
|
+
children: [H.children, /* @__PURE__ */ D("input", {
|
|
540
|
+
...h.getInputValidationProps({
|
|
541
|
+
// Move focus when the hidden input is focused.
|
|
542
|
+
onFocus() {
|
|
543
|
+
if (q) {
|
|
544
|
+
ie?.focus();
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
(C.current || ie)?.focus();
|
|
548
|
+
},
|
|
549
|
+
// Handle browser autofill.
|
|
550
|
+
onChange(e) {
|
|
551
|
+
if (e.nativeEvent.defaultPrevented)
|
|
552
|
+
return;
|
|
553
|
+
const t = e.target.value, r = S(Y, e.nativeEvent);
|
|
554
|
+
function l() {
|
|
555
|
+
if (g)
|
|
556
|
+
return;
|
|
557
|
+
if (s === "none") {
|
|
558
|
+
de(t !== me.initialValue), P(t, r), pe() && h.commit(t);
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const c = J.current.find((f) => le(f, w).toLowerCase() === t.toLowerCase());
|
|
562
|
+
c != null && (de(c !== me.initialValue), Ve?.(c, r), pe() && h.commit(c));
|
|
563
|
+
}
|
|
564
|
+
u ? l() : (Re(), queueMicrotask(l));
|
|
565
|
+
}
|
|
566
|
+
}),
|
|
567
|
+
id: G && Ke == null ? `${G}-hidden-input` : void 0,
|
|
568
|
+
name: Ke,
|
|
569
|
+
autoComplete: Tt,
|
|
570
|
+
disabled: U,
|
|
571
|
+
required: se && !un,
|
|
572
|
+
readOnly: L,
|
|
573
|
+
value: sn,
|
|
574
|
+
ref: on,
|
|
575
|
+
style: Ke ? pn : gn,
|
|
576
|
+
tabIndex: -1,
|
|
577
|
+
"aria-hidden": !0
|
|
578
|
+
}), an]
|
|
579
|
+
});
|
|
580
|
+
return /* @__PURE__ */ D(hn.Provider, {
|
|
581
|
+
value: i,
|
|
582
|
+
children: /* @__PURE__ */ D(Cn.Provider, {
|
|
583
|
+
value: be,
|
|
584
|
+
children: /* @__PURE__ */ D(yn.Provider, {
|
|
585
|
+
value: ln,
|
|
586
|
+
children: /* @__PURE__ */ D(vn.Provider, {
|
|
587
|
+
value: I,
|
|
588
|
+
children: cn
|
|
589
|
+
})
|
|
590
|
+
})
|
|
591
|
+
})
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
export {
|
|
595
|
+
Mi as AriaCombobox
|
|
596
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AriaCombobox as n } from "./AriaCombobox.js";
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
function p(e) {
|
|
4
|
+
const {
|
|
5
|
+
multiple: o = !1,
|
|
6
|
+
defaultValue: l,
|
|
7
|
+
value: t,
|
|
8
|
+
onValueChange: u,
|
|
9
|
+
autoComplete: a,
|
|
10
|
+
...m
|
|
11
|
+
} = e;
|
|
12
|
+
return /* @__PURE__ */ r(n, {
|
|
13
|
+
...m,
|
|
14
|
+
selectionMode: o ? "multiple" : "single",
|
|
15
|
+
selectedValue: t,
|
|
16
|
+
defaultSelectedValue: l,
|
|
17
|
+
onSelectedValueChange: u,
|
|
18
|
+
formAutoComplete: a
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as ComboboxRoot
|
|
23
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import e from "../../../../utils/esm/formatErrorMessage.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
const n = /* @__PURE__ */ t.createContext(void 0);
|
|
4
|
+
process.env.NODE_ENV !== "production" && (n.displayName = "ComboboxRootContext");
|
|
5
|
+
const s = /* @__PURE__ */ t.createContext(void 0);
|
|
6
|
+
process.env.NODE_ENV !== "production" && (s.displayName = "ComboboxFloatingContext");
|
|
7
|
+
const r = /* @__PURE__ */ t.createContext(void 0);
|
|
8
|
+
process.env.NODE_ENV !== "production" && (r.displayName = "ComboboxDerivedItemsContext");
|
|
9
|
+
const i = /* @__PURE__ */ t.createContext("");
|
|
10
|
+
process.env.NODE_ENV !== "production" && (i.displayName = "ComboboxInputValueContext");
|
|
11
|
+
function b() {
|
|
12
|
+
const o = t.useContext(n);
|
|
13
|
+
if (!o)
|
|
14
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : e(22));
|
|
15
|
+
return o;
|
|
16
|
+
}
|
|
17
|
+
function C() {
|
|
18
|
+
const o = t.useContext(s);
|
|
19
|
+
if (!o)
|
|
20
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : e(23));
|
|
21
|
+
return o;
|
|
22
|
+
}
|
|
23
|
+
function m() {
|
|
24
|
+
const o = t.useContext(r);
|
|
25
|
+
if (!o)
|
|
26
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : e(24));
|
|
27
|
+
return o;
|
|
28
|
+
}
|
|
29
|
+
function c() {
|
|
30
|
+
return t.useContext(i);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
r as ComboboxDerivedItemsContext,
|
|
34
|
+
s as ComboboxFloatingContext,
|
|
35
|
+
i as ComboboxInputValueContext,
|
|
36
|
+
n as ComboboxRootContext,
|
|
37
|
+
m as useComboboxDerivedItemsContext,
|
|
38
|
+
C as useComboboxFloatingContext,
|
|
39
|
+
c as useComboboxInputValueContext,
|
|
40
|
+
b as useComboboxRootContext
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { stringifyAsLabel as o } from "../../../utils/resolveValueLabel.js";
|
|
2
|
+
function f(r, e) {
|
|
3
|
+
return (t, i) => {
|
|
4
|
+
if (t == null)
|
|
5
|
+
return !1;
|
|
6
|
+
const n = o(t, e);
|
|
7
|
+
return r.contains(n, i);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function s(r, e, t) {
|
|
11
|
+
return (i, n) => {
|
|
12
|
+
if (i == null)
|
|
13
|
+
return !1;
|
|
14
|
+
if (!n)
|
|
15
|
+
return !0;
|
|
16
|
+
const u = o(i, e), l = t != null ? o(t, e) : "";
|
|
17
|
+
return l && r.contains(l, n) && l.length === n.length ? !0 : r.contains(u, n);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
f as createCollatorItemFilter,
|
|
22
|
+
s as createSingleSelectionCollatorFilter
|
|
23
|
+
};
|