@rpcbase/ui 0.260.0 → 0.262.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/assets/sha256.worker-BEf4_Y9w.js.map +1 -0
- package/dist/components/FilesUploadField/index.d.ts +19 -6
- package/dist/components/FilesUploadField/index.d.ts.map +1 -1
- package/dist/components/FilesUploadField/sha256.d.ts +5 -0
- package/dist/components/FilesUploadField/sha256.d.ts.map +1 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts +4 -0
- package/dist/components/FilesUploadField/sha256.worker.d.ts.map +1 -0
- package/dist/components/ImagesField/index.d.ts +4 -2
- package/dist/components/ImagesField/index.d.ts.map +1 -1
- package/dist/index.js +10 -10
- package/dist/index298.js +11 -803
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +865 -28
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +26 -510
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +481 -755
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +786 -7428
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +7429 -7
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +6 -12
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +12 -5
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +3 -3
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +5 -469
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +464 -32
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +36 -18
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +17 -28
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +30 -4
- package/dist/index311.js.map +1 -1
- package/dist/index312.js +4 -59
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +59 -9
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +9 -5
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +5 -9
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +9 -12
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +13 -3
- package/dist/index317.js.map +1 -1
- package/dist/index318.js +3 -17
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +14 -23
- package/dist/index319.js.map +1 -1
- package/dist/index320.js +23 -39
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +41 -5
- package/dist/index321.js.map +1 -1
- package/dist/index322.js +5 -25
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +24 -18
- package/dist/index323.js.map +1 -1
- package/dist/index324.js +17 -32
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +34 -5
- package/dist/index325.js.map +1 -1
- package/dist/index326.js +5 -9
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +8 -7
- package/dist/index327.js.map +1 -1
- package/dist/index328.js +8 -9
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +9 -10
- package/dist/index329.js.map +1 -1
- package/dist/index330.js +10 -7
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +7 -75
- package/dist/index331.js.map +1 -1
- package/dist/index332.js +66 -153
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +147 -99
- package/dist/index333.js.map +1 -1
- package/dist/index334.js +113 -13
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +12 -78
- package/dist/index335.js.map +1 -1
- package/dist/index336.js +57 -23
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +45 -12
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +13 -16
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +15 -100
- package/dist/index339.js.map +1 -1
- package/dist/index340.js +95 -50
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +5 -57
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +78 -41
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +58 -100
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +104 -46
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +51 -39
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +42 -142
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +123 -120
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +108 -224
- package/dist/index348.js.map +1 -1
- package/dist/index349.js +174 -158
- package/dist/index349.js.map +1 -1
- package/dist/index350.js +144 -213
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +309 -5
- package/dist/index351.js.map +1 -1
- package/dist/index352.js +5 -6
- package/dist/index352.js.map +1 -1
- package/dist/index353.js +6 -7
- package/dist/index353.js.map +1 -1
- package/dist/index354.js +5 -4
- package/dist/index354.js.map +1 -1
- package/dist/index355.js +4 -4
- package/dist/index355.js.map +1 -1
- package/dist/index356.js +6 -21
- package/dist/index356.js.map +1 -1
- package/dist/index357.js +21 -10
- package/dist/index357.js.map +1 -1
- package/dist/index358.js +10 -128
- package/dist/index358.js.map +1 -1
- package/dist/index359.js +122 -36
- package/dist/index359.js.map +1 -1
- package/dist/index360.js +38 -64
- package/dist/index360.js.map +1 -1
- package/dist/index361.js +66 -115
- package/dist/index361.js.map +1 -1
- package/dist/index362.js +112 -485
- package/dist/index362.js.map +1 -1
- package/dist/index363.js +490 -13
- package/dist/index363.js.map +1 -1
- package/dist/index364.js +13 -4
- package/dist/index364.js.map +1 -1
- package/dist/index365.js +4 -47
- package/dist/index365.js.map +1 -1
- package/dist/index366.js +44 -15
- package/dist/index366.js.map +1 -1
- package/dist/index367.js +19 -5
- package/dist/index367.js.map +1 -1
- package/dist/index368.js +5 -27
- package/dist/index368.js.map +1 -1
- package/dist/index369.js +27 -48
- package/dist/index369.js.map +1 -1
- package/dist/index370.js +46 -27
- package/dist/index370.js.map +1 -1
- package/dist/index371.js +27 -16
- package/dist/index371.js.map +1 -1
- package/dist/index372.js +16 -41
- package/dist/index372.js.map +1 -1
- package/dist/index373.js +42 -14
- package/dist/index373.js.map +1 -1
- package/dist/index374.js +14 -10
- package/dist/index374.js.map +1 -1
- package/dist/index375.js +9 -51
- package/dist/index375.js.map +1 -1
- package/dist/index376.js +53 -43
- package/dist/index376.js.map +1 -1
- package/dist/index377.js +43 -16
- package/dist/index377.js.map +1 -1
- package/dist/index378.js +15 -4
- package/dist/index378.js.map +1 -1
- package/dist/index379.js +4 -4
- package/dist/index379.js.map +1 -1
- package/dist/index380.js +4 -9
- package/dist/index380.js.map +1 -1
- package/dist/index381.js +9 -340
- package/dist/index381.js.map +1 -1
- package/dist/index382.js +339 -4
- package/dist/index382.js.map +1 -1
- package/dist/index383.js +5 -16
- package/dist/index383.js.map +1 -1
- package/dist/index384.js +16 -111
- package/dist/index384.js.map +1 -1
- package/dist/index385.js +109 -19
- package/dist/index385.js.map +1 -1
- package/dist/index386.js +18 -18
- package/dist/index386.js.map +1 -1
- package/dist/index387.js +21 -5
- package/dist/index387.js.map +1 -1
- package/dist/index388.js +5 -20
- package/dist/index388.js.map +1 -1
- package/dist/index389.js +19 -13
- package/dist/index389.js.map +1 -1
- package/dist/index390.js +13 -84
- package/dist/index390.js.map +1 -1
- package/dist/index391.js +84 -7
- package/dist/index391.js.map +1 -1
- package/dist/index392.js +9 -29
- package/dist/index392.js.map +1 -1
- package/dist/index393.js +28 -9
- package/dist/index393.js.map +1 -1
- package/dist/index394.js +9 -5
- package/dist/index394.js.map +1 -1
- package/dist/index395.js +6 -252
- package/dist/index395.js.map +1 -1
- package/dist/index396.js +250 -10
- package/dist/index396.js.map +1 -1
- package/dist/index397.js +11 -10
- package/dist/index397.js.map +1 -1
- package/dist/index398.js +10 -6
- package/dist/index398.js.map +1 -1
- package/dist/index399.js +6 -22
- package/dist/index399.js.map +1 -1
- package/dist/index400.js +21 -21
- package/dist/index400.js.map +1 -1
- package/dist/index401.js +21 -107
- package/dist/index401.js.map +1 -1
- package/dist/index402.js +109 -15
- package/dist/index402.js.map +1 -1
- package/dist/index403.js +15 -12
- package/dist/index403.js.map +1 -1
- package/dist/index404.js +10 -8
- package/dist/index404.js.map +1 -1
- package/dist/index405.js +8 -242
- package/dist/index405.js.map +1 -1
- package/dist/index406.js +238 -25
- package/dist/index406.js.map +1 -1
- package/dist/index407.js +29 -51
- package/dist/index407.js.map +1 -1
- package/dist/index408.js +51 -10
- package/dist/index408.js.map +1 -1
- package/dist/index409.js +11 -128
- package/dist/index409.js.map +1 -1
- package/dist/index410.js +124 -35
- package/dist/index410.js.map +1 -1
- package/dist/index411.js +36 -23
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +26 -11
- package/dist/index412.js.map +1 -1
- package/dist/index413.js +11 -23
- package/dist/index413.js.map +1 -1
- package/dist/index414.js +19 -13
- package/dist/index414.js.map +1 -1
- package/dist/index415.js +14 -13
- package/dist/index415.js.map +1 -1
- package/dist/index416.js +14 -322
- package/dist/index416.js.map +1 -1
- package/dist/index417.js +323 -61
- package/dist/index417.js.map +1 -1
- package/dist/index418.js +63 -4
- package/dist/index418.js.map +1 -1
- package/dist/index419.js +4 -28
- package/dist/index419.js.map +1 -1
- package/dist/index420.js +25 -468
- package/dist/index420.js.map +1 -1
- package/dist/index421.js +452 -250
- package/dist/index421.js.map +1 -1
- package/dist/index422.js +272 -0
- package/dist/index422.js.map +1 -0
- package/package.json +2 -1
package/dist/index382.js
CHANGED
|
@@ -1,9 +1,344 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { useRefWithInit as e } from "./index185.js";
|
|
3
|
+
import { useMergedRefs as t } from "./index186.js";
|
|
4
|
+
import { EMPTY_ARRAY as n, EMPTY_OBJECT as r } from "./index191.js";
|
|
5
|
+
import { mergeProps as i } from "./index195.js";
|
|
6
|
+
import { useStableCallback as a } from "./index202.js";
|
|
7
|
+
import { useIsoLayoutEffect as o } from "./index204.js";
|
|
8
|
+
import { none as ee } from "./index208.js";
|
|
9
|
+
import { createChangeEventDetails as s } from "./index209.js";
|
|
10
|
+
import { useValueAsRef as te } from "./index227.js";
|
|
11
|
+
import { visuallyHidden as ne, visuallyHiddenInput as re } from "./index230.js";
|
|
12
|
+
import { useClick as ie } from "./index245.js";
|
|
13
|
+
import { useDismiss as ae } from "./index246.js";
|
|
14
|
+
import { useOnFirstRender as oe } from "./index250.js";
|
|
15
|
+
import { useStore as c } from "./index260.js";
|
|
16
|
+
import { Store as se } from "./index261.js";
|
|
17
|
+
import { useTransitionStatus as ce } from "./index265.js";
|
|
18
|
+
import { useOpenChangeComplete as le } from "./index267.js";
|
|
19
|
+
import { FOCUSABLE_POPUP_PROPS as ue } from "./index268.js";
|
|
20
|
+
import { useFloatingRootContext as de } from "./index272.js";
|
|
21
|
+
import { useListNavigation as fe } from "./index274.js";
|
|
22
|
+
import { useTypeahead as pe } from "./index275.js";
|
|
23
|
+
import { useValueChanged as me } from "./index291.js";
|
|
24
|
+
import { useOpenInteractionType as he } from "./index292.js";
|
|
25
|
+
import { usePreviousValue as ge } from "./index364.js";
|
|
26
|
+
import { isElementDisabled as _e } from "./index365.js";
|
|
27
|
+
import { useControlled as l } from "./index366.js";
|
|
28
|
+
import { SelectFloatingContext as ve, SelectRootContext as ye } from "./index367.js";
|
|
29
|
+
import { useFieldRootContext as be } from "./index370.js";
|
|
30
|
+
import { useRegisterFieldControl as xe } from "./index371.js";
|
|
31
|
+
import { useLabelableId as Se } from "./index373.js";
|
|
32
|
+
import { compareItemEquality as Ce, defaultItemEquality as we, findItemIndex as Te } from "./index374.js";
|
|
33
|
+
import { stringifyAsLabel as Ee, stringifyAsValue as u } from "./index376.js";
|
|
34
|
+
import { selectors as d } from "./index377.js";
|
|
35
|
+
import { useFormContext as De } from "./index378.js";
|
|
36
|
+
import { areArraysEqual as Oe } from "./index379.js";
|
|
37
|
+
import { getMaxScrollOffset as ke, normalizeScrollOffset as Ae } from "./index381.js";
|
|
38
|
+
import * as f from "react";
|
|
39
|
+
import { jsx as p, jsxs as je } from "react/jsx-runtime";
|
|
40
|
+
//#region ../../node_modules/@base-ui/react/select/root/SelectRoot.mjs
|
|
41
|
+
function Me(Me) {
|
|
42
|
+
let { id: Ne, value: Pe, defaultValue: m = null, onValueChange: Fe, open: Ie, defaultOpen: Le = !1, onOpenChange: Re, name: h, form: g, autoComplete: ze, disabled: Be = !1, readOnly: _ = !1, required: v = !1, modal: y = !0, actionsRef: b, inputRef: Ve, onOpenChangeComplete: x, items: S, multiple: C = !1, itemToStringLabel: w, itemToStringValue: T, isItemEqualToValue: E = we, highlightItemOnHover: D = !0, children: He } = Me, { clearErrors: Ue } = De(), { setDirty: We, setTouched: Ge, setFocused: Ke, validityData: qe, setFilled: O, name: Je, disabled: Ye, validation: k, validationMode: Xe } = be(), A = Se({ id: Ne }), j = Ye || Be, M = Je ?? h, [N, Ze] = l({
|
|
43
|
+
controlled: Pe,
|
|
44
|
+
default: C ? m ?? n : m,
|
|
45
|
+
name: "Select",
|
|
46
|
+
state: "value"
|
|
47
|
+
}), [P, Qe] = l({
|
|
48
|
+
controlled: Ie,
|
|
49
|
+
default: Le,
|
|
50
|
+
name: "Select",
|
|
51
|
+
state: "open"
|
|
52
|
+
}), F = f.useRef([]), I = f.useRef([]), L = f.useRef(null), $e = f.useRef(null), et = f.useRef(0), tt = f.useRef(null), R = f.useRef([]), z = f.useRef(!1), nt = f.useRef(null), B = f.useRef(null), rt = f.useRef({
|
|
53
|
+
allowSelectedMouseUp: !1,
|
|
54
|
+
allowUnselectedMouseUp: !1,
|
|
55
|
+
dragY: 0
|
|
56
|
+
}), it = f.useRef(!1), { mounted: V, setMounted: at, transitionStatus: H } = ce(P), { openMethod: ot, triggerProps: st } = he(P), U = e(() => new se({
|
|
57
|
+
id: A,
|
|
58
|
+
labelId: void 0,
|
|
59
|
+
modal: y,
|
|
60
|
+
multiple: C,
|
|
61
|
+
itemToStringLabel: w,
|
|
62
|
+
itemToStringValue: T,
|
|
63
|
+
isItemEqualToValue: E,
|
|
64
|
+
value: N,
|
|
65
|
+
open: P,
|
|
66
|
+
mounted: V,
|
|
67
|
+
transitionStatus: H,
|
|
68
|
+
items: S,
|
|
69
|
+
forceMount: !1,
|
|
70
|
+
openMethod: null,
|
|
71
|
+
activeIndex: null,
|
|
72
|
+
selectedIndex: null,
|
|
73
|
+
popupProps: {},
|
|
74
|
+
triggerProps: {},
|
|
75
|
+
triggerElement: null,
|
|
76
|
+
positionerElement: null,
|
|
77
|
+
listElement: null,
|
|
78
|
+
popupSide: null,
|
|
79
|
+
scrollUpArrowVisible: !1,
|
|
80
|
+
scrollDownArrowVisible: !1,
|
|
81
|
+
hasScrollArrows: !1
|
|
82
|
+
})).current, ct = c(U, d.activeIndex), lt = c(U, d.selectedIndex), ut = c(U, d.triggerElement), dt = c(U, d.positionerElement), ft = ge(ot), pt = ot ?? ft ?? null, mt = f.useMemo(() => C ? "" : u(N, T), [
|
|
83
|
+
C,
|
|
84
|
+
N,
|
|
85
|
+
T
|
|
86
|
+
]), ht = f.useMemo(() => C && Array.isArray(N) ? N.map((e) => u(e, T)) : u(N, T), [
|
|
87
|
+
C,
|
|
88
|
+
N,
|
|
89
|
+
T
|
|
90
|
+
]);
|
|
91
|
+
xe(te(U.state.triggerElement), A, N, a(() => ht), !j, h);
|
|
92
|
+
let gt = f.useRef(N), W = C ? Array.isArray(N) && N.length > 0 : N != null && u(N, T) !== "";
|
|
93
|
+
o(() => {
|
|
94
|
+
N !== gt.current && U.set("forceMount", !0);
|
|
95
|
+
}, [U, N]), o(() => {
|
|
96
|
+
O(W);
|
|
97
|
+
}, [W, O]), o(function() {
|
|
98
|
+
let e = R.current, t;
|
|
99
|
+
if (C) {
|
|
100
|
+
let n = Array.isArray(N) ? N : [];
|
|
101
|
+
if (n.length === 0) t = null;
|
|
102
|
+
else {
|
|
103
|
+
let r = n[n.length - 1], i = Te(e, r, E);
|
|
104
|
+
t = i === -1 ? null : i;
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
let n = Te(e, N, E);
|
|
108
|
+
t = n === -1 ? null : n;
|
|
109
|
+
}
|
|
110
|
+
t === null && (B.current = null), !P && U.set("selectedIndex", t);
|
|
111
|
+
}, [
|
|
112
|
+
W,
|
|
113
|
+
C,
|
|
114
|
+
P,
|
|
115
|
+
N,
|
|
116
|
+
R,
|
|
117
|
+
E,
|
|
118
|
+
U,
|
|
119
|
+
B
|
|
120
|
+
]);
|
|
121
|
+
function _t(e) {
|
|
122
|
+
let t = qe.initialValue;
|
|
123
|
+
return Array.isArray(e) && Array.isArray(t) ? !Oe(e, t, (e, t) => Ce(e, t, E)) : e !== t;
|
|
124
|
+
}
|
|
125
|
+
me(N, () => {
|
|
126
|
+
Ue(M), We(_t(N)), k.change(N);
|
|
127
|
+
});
|
|
128
|
+
let G = a((e, t) => {
|
|
129
|
+
Re?.(e, t), !t.isCanceled && (Qe(e), !e && (t.reason === "focus-out" || t.reason === "outside-press") && (Ge(!0), Ke(!1), Xe === "onBlur" && k.commit(N)));
|
|
130
|
+
}), K = a(() => {
|
|
131
|
+
at(!1), U.update({
|
|
132
|
+
activeIndex: null,
|
|
133
|
+
openMethod: null
|
|
134
|
+
}), x?.(!1);
|
|
135
|
+
});
|
|
136
|
+
le({
|
|
137
|
+
enabled: !b,
|
|
138
|
+
open: P,
|
|
139
|
+
ref: L,
|
|
140
|
+
onComplete() {
|
|
141
|
+
P || K();
|
|
142
|
+
}
|
|
143
|
+
}), f.useImperativeHandle(b, () => ({ unmount: K }), [K]);
|
|
144
|
+
let q = a((e, t) => {
|
|
145
|
+
Fe?.(e, t), !t.isCanceled && Ze(e);
|
|
146
|
+
}), vt = a(() => {
|
|
147
|
+
let e = U.state.listElement || L.current;
|
|
148
|
+
if (!e) return;
|
|
149
|
+
let t = ke(e.scrollHeight, e.clientHeight), n = Ae(e.scrollTop, t), r = n > 0, i = n < t;
|
|
150
|
+
U.state.scrollUpArrowVisible !== r && U.set("scrollUpArrowVisible", r), U.state.scrollDownArrowVisible !== i && U.set("scrollDownArrowVisible", i);
|
|
151
|
+
}), J = de({
|
|
152
|
+
open: P,
|
|
153
|
+
onOpenChange: G,
|
|
154
|
+
elements: {
|
|
155
|
+
reference: ut,
|
|
156
|
+
floating: dt
|
|
157
|
+
}
|
|
158
|
+
}), yt = ie(J, {
|
|
159
|
+
enabled: !_ && !j,
|
|
160
|
+
event: "mousedown"
|
|
161
|
+
}), Y = ae(J), X = fe(J, {
|
|
162
|
+
enabled: !_ && !j,
|
|
163
|
+
listRef: F,
|
|
164
|
+
activeIndex: ct,
|
|
165
|
+
selectedIndex: lt,
|
|
166
|
+
disabledIndices: n,
|
|
167
|
+
onNavigate(e) {
|
|
168
|
+
e === null && !P || U.set("activeIndex", e);
|
|
169
|
+
},
|
|
170
|
+
focusItemOnHover: D
|
|
171
|
+
}), Z = pe(J, {
|
|
172
|
+
enabled: !_ && !j && (P || !C),
|
|
173
|
+
listRef: I,
|
|
174
|
+
activeIndex: ct,
|
|
175
|
+
selectedIndex: lt,
|
|
176
|
+
disabledIndices: (e) => _e(F.current[e]),
|
|
177
|
+
onMatch(e) {
|
|
178
|
+
P ? U.set("activeIndex", e) : q(R.current[e], s("none"));
|
|
179
|
+
},
|
|
180
|
+
onTyping(e) {
|
|
181
|
+
z.current = e;
|
|
182
|
+
}
|
|
183
|
+
}), Q = f.useMemo(() => {
|
|
184
|
+
let e = i(Z.reference, X.reference, Y.reference, yt.reference, st);
|
|
185
|
+
return A && (e.id = A), e;
|
|
186
|
+
}, [
|
|
187
|
+
yt.reference,
|
|
188
|
+
Z.reference,
|
|
189
|
+
X.reference,
|
|
190
|
+
Y.reference,
|
|
191
|
+
st,
|
|
192
|
+
A
|
|
193
|
+
]), $ = f.useMemo(() => i(ue, Z.floating, X.floating, Y.floating), [
|
|
194
|
+
Z.floating,
|
|
195
|
+
X.floating,
|
|
196
|
+
Y.floating
|
|
197
|
+
]), bt = X.item ?? r;
|
|
198
|
+
oe(() => {
|
|
199
|
+
U.update({
|
|
200
|
+
popupProps: $,
|
|
201
|
+
triggerProps: Q
|
|
202
|
+
});
|
|
203
|
+
}), o(() => {
|
|
204
|
+
U.update({
|
|
205
|
+
id: A,
|
|
206
|
+
modal: y,
|
|
207
|
+
multiple: C,
|
|
208
|
+
value: N,
|
|
209
|
+
open: P,
|
|
210
|
+
mounted: V,
|
|
211
|
+
transitionStatus: H,
|
|
212
|
+
popupProps: $,
|
|
213
|
+
triggerProps: Q,
|
|
214
|
+
items: S,
|
|
215
|
+
itemToStringLabel: w,
|
|
216
|
+
itemToStringValue: T,
|
|
217
|
+
isItemEqualToValue: E,
|
|
218
|
+
openMethod: pt
|
|
219
|
+
});
|
|
220
|
+
}, [
|
|
221
|
+
U,
|
|
222
|
+
A,
|
|
223
|
+
y,
|
|
224
|
+
C,
|
|
225
|
+
N,
|
|
226
|
+
P,
|
|
227
|
+
V,
|
|
228
|
+
H,
|
|
229
|
+
$,
|
|
230
|
+
Q,
|
|
231
|
+
S,
|
|
232
|
+
w,
|
|
233
|
+
T,
|
|
234
|
+
E,
|
|
235
|
+
pt
|
|
236
|
+
]);
|
|
237
|
+
let xt = f.useMemo(() => ({
|
|
238
|
+
store: U,
|
|
239
|
+
name: M,
|
|
240
|
+
required: v,
|
|
241
|
+
disabled: j,
|
|
242
|
+
readOnly: _,
|
|
243
|
+
multiple: C,
|
|
244
|
+
highlightItemOnHover: D,
|
|
245
|
+
setValue: q,
|
|
246
|
+
setOpen: G,
|
|
247
|
+
listRef: F,
|
|
248
|
+
popupRef: L,
|
|
249
|
+
scrollHandlerRef: $e,
|
|
250
|
+
handleScrollArrowVisibility: vt,
|
|
251
|
+
scrollArrowsMountedCountRef: et,
|
|
252
|
+
itemProps: bt,
|
|
253
|
+
valueRef: tt,
|
|
254
|
+
valuesRef: R,
|
|
255
|
+
labelsRef: I,
|
|
256
|
+
typingRef: z,
|
|
257
|
+
selectionRef: rt,
|
|
258
|
+
firstItemTextRef: nt,
|
|
259
|
+
selectedItemTextRef: B,
|
|
260
|
+
validation: k,
|
|
261
|
+
onOpenChangeComplete: x,
|
|
262
|
+
alignItemWithTriggerActiveRef: it,
|
|
263
|
+
initialValueRef: gt
|
|
264
|
+
}), [
|
|
265
|
+
U,
|
|
266
|
+
M,
|
|
267
|
+
v,
|
|
268
|
+
j,
|
|
269
|
+
_,
|
|
270
|
+
C,
|
|
271
|
+
D,
|
|
272
|
+
q,
|
|
273
|
+
G,
|
|
274
|
+
bt,
|
|
275
|
+
k,
|
|
276
|
+
x,
|
|
277
|
+
vt
|
|
278
|
+
]), St = t(Ve, k.inputRef), Ct = C && Array.isArray(N) && N.length > 0, wt = C ? void 0 : M, Tt = f.useMemo(() => !C || !Array.isArray(N) || !M ? null : N.map((e) => {
|
|
279
|
+
let t = u(e, T);
|
|
280
|
+
return /*#__PURE__*/ p("input", {
|
|
281
|
+
type: "hidden",
|
|
282
|
+
form: g,
|
|
283
|
+
name: M,
|
|
284
|
+
value: t,
|
|
285
|
+
disabled: j
|
|
286
|
+
}, t);
|
|
287
|
+
}), [
|
|
288
|
+
C,
|
|
289
|
+
N,
|
|
290
|
+
g,
|
|
291
|
+
M,
|
|
292
|
+
T,
|
|
293
|
+
j
|
|
294
|
+
]);
|
|
295
|
+
return /*#__PURE__*/ p(ye.Provider, {
|
|
296
|
+
value: xt,
|
|
297
|
+
children: /*#__PURE__*/ je(ve.Provider, {
|
|
298
|
+
value: J,
|
|
299
|
+
children: [
|
|
300
|
+
He,
|
|
301
|
+
/*#__PURE__*/ p("input", {
|
|
302
|
+
...k.getValidationProps(j, {
|
|
303
|
+
onFocus() {
|
|
304
|
+
U.state.triggerElement?.focus({ focusVisible: !0 });
|
|
305
|
+
},
|
|
306
|
+
onChange(e) {
|
|
307
|
+
if (e.nativeEvent.defaultPrevented || j || _) return;
|
|
308
|
+
let t = e.currentTarget.value, n = s(ee, e.nativeEvent);
|
|
309
|
+
function r() {
|
|
310
|
+
if (C) return;
|
|
311
|
+
let e = t.toLowerCase(), r = R.current.findIndex((t) => u(t, T).toLowerCase() === e || Ee(t, w).toLowerCase() === e);
|
|
312
|
+
r === -1 && (r = R.current.findIndex((t, n) => {
|
|
313
|
+
let r = I.current[n];
|
|
314
|
+
return r != null && r.toLowerCase() === e;
|
|
315
|
+
}));
|
|
316
|
+
let i = r === -1 ? void 0 : R.current[r];
|
|
317
|
+
i != null && q(i, n);
|
|
318
|
+
}
|
|
319
|
+
U.set("forceMount", !0), queueMicrotask(r);
|
|
320
|
+
}
|
|
321
|
+
}),
|
|
322
|
+
id: A && wt == null ? `${A}-hidden-input` : void 0,
|
|
323
|
+
form: g,
|
|
324
|
+
name: wt,
|
|
325
|
+
autoComplete: ze,
|
|
326
|
+
value: mt,
|
|
327
|
+
disabled: j,
|
|
328
|
+
required: v && !Ct,
|
|
329
|
+
readOnly: _,
|
|
330
|
+
ref: St,
|
|
331
|
+
style: M ? re : ne,
|
|
332
|
+
tabIndex: -1,
|
|
333
|
+
"aria-hidden": !0,
|
|
334
|
+
suppressHydrationWarning: !0
|
|
335
|
+
}),
|
|
336
|
+
Tt
|
|
337
|
+
]
|
|
338
|
+
})
|
|
339
|
+
});
|
|
5
340
|
}
|
|
6
341
|
//#endregion
|
|
7
|
-
export {
|
|
342
|
+
export { Me as SelectRoot };
|
|
8
343
|
|
|
9
344
|
//# sourceMappingURL=index382.js.map
|
package/dist/index382.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index382.js","names":[],"sources":["../../../node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs"],"sourcesContent":["'use client';\n\nexport function getDefaultLabelId(id) {\n return id == null ? undefined : `${id}-label`;\n}\nexport function resolveAriaLabelledBy(fieldLabelId, localLabelId) {\n return fieldLabelId ?? localLabelId;\n}"],"x_google_ignoreList":[0],"mappings":";;AAKA,SAAgB,EAAsB,GAAc,GAAc;CAChE,OAAO,KAAgB;AACzB"}
|
|
1
|
+
{"version":3,"file":"index382.js","names":["React","REASONS.none"],"sources":["../../../node_modules/@base-ui/react/select/root/SelectRoot.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { visuallyHidden, visuallyHiddenInput } from '@base-ui/utils/visuallyHidden';\nimport { useMergedRefs } from '@base-ui/utils/useMergedRefs';\nimport { useRefWithInit } from '@base-ui/utils/useRefWithInit';\nimport { useOnFirstRender } from '@base-ui/utils/useOnFirstRender';\nimport { usePreviousValue } from '@base-ui/utils/usePreviousValue';\nimport { isElementDisabled } from '@base-ui/utils/isElementDisabled';\nimport { useControlled } from '@base-ui/utils/useControlled';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStore, Store } from '@base-ui/utils/store';\nimport { EMPTY_ARRAY, EMPTY_OBJECT } from '@base-ui/utils/empty';\nimport { useClick, useDismiss, useFloatingRootContext, useListNavigation, useTypeahead } from \"../../floating-ui-react/index.mjs\";\nimport { SelectRootContext, SelectFloatingContext } from \"./SelectRootContext.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useRegisterFieldControl } from \"../../internals/field-register-control/useRegisterFieldControl.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { useTransitionStatus } from \"../../internals/useTransitionStatus.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useOpenChangeComplete } from \"../../internals/useOpenChangeComplete.mjs\";\nimport { useFormContext } from \"../../internals/form-context/FormContext.mjs\";\nimport { stringifyAsLabel, stringifyAsValue } from \"../../internals/resolveValueLabel.mjs\";\nimport { compareItemEquality, defaultItemEquality, findItemIndex } from \"../../internals/itemEquality.mjs\";\nimport { areArraysEqual } from \"../../internals/areArraysEqual.mjs\";\nimport { useValueChanged } from \"../../internals/useValueChanged.mjs\";\nimport { useOpenInteractionType } from \"../../utils/useOpenInteractionType.mjs\";\nimport { getMaxScrollOffset, normalizeScrollOffset } from \"../../utils/scrollEdges.mjs\";\nimport { FOCUSABLE_POPUP_PROPS } from \"../../utils/popups/index.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\n\n/**\n * Groups all parts of the select.\n * Doesn't render its own HTML element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nimport { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nexport function SelectRoot(props) {\n const {\n id,\n value: valueProp,\n defaultValue = null,\n onValueChange,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n name: nameProp,\n form,\n autoComplete,\n disabled: disabledProp = false,\n readOnly = false,\n required = false,\n modal = true,\n actionsRef,\n inputRef,\n onOpenChangeComplete,\n items,\n multiple = false,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue = defaultItemEquality,\n highlightItemOnHover = true,\n children\n } = props;\n const {\n clearErrors\n } = useFormContext();\n const {\n setDirty,\n setTouched,\n setFocused,\n validityData,\n setFilled,\n name: fieldName,\n disabled: fieldDisabled,\n validation,\n validationMode\n } = useFieldRootContext();\n const generatedId = useLabelableId({\n id\n });\n const disabled = fieldDisabled || disabledProp;\n const name = fieldName ?? nameProp;\n const [value, setValueUnwrapped] = useControlled({\n controlled: valueProp,\n default: multiple ? defaultValue ?? EMPTY_ARRAY : defaultValue,\n name: 'Select',\n state: 'value'\n });\n const [open, setOpenUnwrapped] = useControlled({\n controlled: openProp,\n default: defaultOpen,\n name: 'Select',\n state: 'open'\n });\n const listRef = React.useRef([]);\n const labelsRef = React.useRef([]);\n const popupRef = React.useRef(null);\n const scrollHandlerRef = React.useRef(null);\n const scrollArrowsMountedCountRef = React.useRef(0);\n const valueRef = React.useRef(null);\n const valuesRef = React.useRef([]);\n const typingRef = React.useRef(false);\n const firstItemTextRef = React.useRef(null);\n const selectedItemTextRef = React.useRef(null);\n const selectionRef = React.useRef({\n allowSelectedMouseUp: false,\n allowUnselectedMouseUp: false,\n dragY: 0\n });\n const alignItemWithTriggerActiveRef = React.useRef(false);\n const {\n mounted,\n setMounted,\n transitionStatus\n } = useTransitionStatus(open);\n const {\n openMethod,\n triggerProps: interactionTypeProps\n } = useOpenInteractionType(open);\n const store = useRefWithInit(() => new Store({\n id: generatedId,\n labelId: undefined,\n modal,\n multiple,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue,\n value,\n open,\n mounted,\n transitionStatus,\n items,\n forceMount: false,\n openMethod: null,\n activeIndex: null,\n selectedIndex: null,\n popupProps: {},\n triggerProps: {},\n triggerElement: null,\n positionerElement: null,\n listElement: null,\n popupSide: null,\n scrollUpArrowVisible: false,\n scrollDownArrowVisible: false,\n hasScrollArrows: false\n })).current;\n const activeIndex = useStore(store, selectors.activeIndex);\n const selectedIndex = useStore(store, selectors.selectedIndex);\n const triggerElement = useStore(store, selectors.triggerElement);\n const positionerElement = useStore(store, selectors.positionerElement);\n const previousOpenMethod = usePreviousValue(openMethod);\n const renderedOpenMethod = openMethod ?? previousOpenMethod ?? null;\n const serializedValue = React.useMemo(() => {\n // In multiple mode the shared input is nameless; per-value entries are submitted via\n // `hiddenInputs`. Its value is therefore irrelevant, and passing the whole array to\n // `stringifyAsValue` would invoke a user `itemToStringValue` with an array it doesn't expect.\n if (multiple) {\n return '';\n }\n return stringifyAsValue(value, itemToStringValue);\n }, [multiple, value, itemToStringValue]);\n const fieldStringValue = React.useMemo(() => {\n if (multiple && Array.isArray(value)) {\n return value.map(currentValue => stringifyAsValue(currentValue, itemToStringValue));\n }\n return stringifyAsValue(value, itemToStringValue);\n }, [multiple, value, itemToStringValue]);\n const controlRef = useValueAsRef(store.state.triggerElement);\n const getStringifiedValueForForm = useStableCallback(() => fieldStringValue);\n useRegisterFieldControl(controlRef, generatedId, value, getStringifiedValueForForm, !disabled, nameProp);\n const initialValueRef = React.useRef(value);\n // Mirror the `hasSelectedValue` store selector so the Field's filled state agrees with the\n // trigger/value placeholder semantics (a value serializing to `''` counts as empty).\n const hasSelectedValue = multiple ? Array.isArray(value) && value.length > 0 : value != null && stringifyAsValue(value, itemToStringValue) !== '';\n useIsoLayoutEffect(() => {\n // Ensure the values and labels are registered for programmatic value changes.\n if (value !== initialValueRef.current) {\n store.set('forceMount', true);\n }\n }, [store, value]);\n useIsoLayoutEffect(() => {\n setFilled(hasSelectedValue);\n }, [hasSelectedValue, setFilled]);\n useIsoLayoutEffect(function syncSelectedIndex() {\n const registry = valuesRef.current;\n let nextIndex;\n if (multiple) {\n const currentValue = Array.isArray(value) ? value : [];\n if (currentValue.length === 0) {\n nextIndex = null;\n } else {\n const lastValue = currentValue[currentValue.length - 1];\n const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);\n nextIndex = lastIndex === -1 ? null : lastIndex;\n }\n } else {\n const index = findItemIndex(registry, value, isItemEqualToValue);\n nextIndex = index === -1 ? null : index;\n }\n if (nextIndex === null) {\n selectedItemTextRef.current = null;\n }\n if (open) {\n return;\n }\n store.set('selectedIndex', nextIndex);\n }, [hasSelectedValue, multiple, open, value, valuesRef, isItemEqualToValue, store, selectedItemTextRef]);\n function isSelectedValueDirty(currentValue) {\n const initialValue = validityData.initialValue;\n if (Array.isArray(currentValue) && Array.isArray(initialValue)) {\n return !areArraysEqual(currentValue, initialValue, (itemValue, initialItemValue) => compareItemEquality(itemValue, initialItemValue, isItemEqualToValue));\n }\n return currentValue !== initialValue;\n }\n useValueChanged(value, () => {\n clearErrors(name);\n setDirty(isSelectedValueDirty(value));\n validation.change(value);\n });\n const setOpen = useStableCallback((nextOpen, eventDetails) => {\n onOpenChange?.(nextOpen, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setOpenUnwrapped(nextOpen);\n if (!nextOpen && (eventDetails.reason === REASONS.focusOut || eventDetails.reason === REASONS.outsidePress)) {\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(value);\n }\n }\n });\n const handleUnmount = useStableCallback(() => {\n setMounted(false);\n store.update({\n activeIndex: null,\n openMethod: null\n });\n onOpenChangeComplete?.(false);\n });\n useOpenChangeComplete({\n enabled: !actionsRef,\n open,\n ref: popupRef,\n onComplete() {\n if (!open) {\n handleUnmount();\n }\n }\n });\n React.useImperativeHandle(actionsRef, () => ({\n unmount: handleUnmount\n }), [handleUnmount]);\n const setValue = useStableCallback((nextValue, eventDetails) => {\n onValueChange?.(nextValue, eventDetails);\n if (eventDetails.isCanceled) {\n return;\n }\n setValueUnwrapped(nextValue);\n });\n const handleScrollArrowVisibility = useStableCallback(() => {\n const scroller = store.state.listElement || popupRef.current;\n if (!scroller) {\n return;\n }\n const maxScrollTop = getMaxScrollOffset(scroller.scrollHeight, scroller.clientHeight);\n const scrollTop = normalizeScrollOffset(scroller.scrollTop, maxScrollTop);\n const shouldShowUp = scrollTop > 0;\n const shouldShowDown = scrollTop < maxScrollTop;\n if (store.state.scrollUpArrowVisible !== shouldShowUp) {\n store.set('scrollUpArrowVisible', shouldShowUp);\n }\n if (store.state.scrollDownArrowVisible !== shouldShowDown) {\n store.set('scrollDownArrowVisible', shouldShowDown);\n }\n });\n const floatingContext = useFloatingRootContext({\n open,\n onOpenChange: setOpen,\n elements: {\n reference: triggerElement,\n floating: positionerElement\n }\n });\n const click = useClick(floatingContext, {\n enabled: !readOnly && !disabled,\n event: 'mousedown'\n });\n const dismiss = useDismiss(floatingContext);\n const listNavigation = useListNavigation(floatingContext, {\n enabled: !readOnly && !disabled,\n listRef,\n activeIndex,\n selectedIndex,\n disabledIndices: EMPTY_ARRAY,\n onNavigate(nextActiveIndex) {\n // Retain the highlight while transitioning out.\n if (nextActiveIndex === null && !open) {\n return;\n }\n store.set('activeIndex', nextActiveIndex);\n },\n focusItemOnHover: highlightItemOnHover\n });\n const typeahead = useTypeahead(floatingContext, {\n enabled: !readOnly && !disabled && (open || !multiple),\n listRef: labelsRef,\n activeIndex,\n selectedIndex,\n // Skip disabled items while matching so typeahead advances to the next selectable item\n // (a click can never select a disabled item and native `<select>` skips them too). Resolve\n // the disabled state from the element via the attribute-only `isElementDisabled` so the\n // hidden, force-mounted items used for closed-trigger typeahead aren't dropped by the\n // `elementsRef`/visibility filter that `disabledIndices` deliberately sidesteps.\n disabledIndices: index => isElementDisabled(listRef.current[index]),\n onMatch(index) {\n if (open) {\n store.set('activeIndex', index);\n } else {\n setValue(valuesRef.current[index], createChangeEventDetails('none'));\n }\n },\n onTyping(typing) {\n typingRef.current = typing;\n }\n });\n const mergedTriggerProps = React.useMemo(() => {\n const triggerInteractionProps = mergeProps(typeahead.reference, listNavigation.reference, dismiss.reference, click.reference, interactionTypeProps);\n if (generatedId) {\n triggerInteractionProps.id = generatedId;\n }\n return triggerInteractionProps;\n }, [click.reference, typeahead.reference, listNavigation.reference, dismiss.reference, interactionTypeProps, generatedId]);\n const popupProps = React.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, typeahead.floating, listNavigation.floating, dismiss.floating), [typeahead.floating, listNavigation.floating, dismiss.floating]);\n const itemProps = listNavigation.item ?? EMPTY_OBJECT;\n useOnFirstRender(() => {\n store.update({\n popupProps,\n triggerProps: mergedTriggerProps\n });\n });\n useIsoLayoutEffect(() => {\n store.update({\n id: generatedId,\n modal,\n multiple,\n value,\n open,\n mounted,\n transitionStatus,\n popupProps,\n triggerProps: mergedTriggerProps,\n items,\n itemToStringLabel,\n itemToStringValue,\n isItemEqualToValue,\n openMethod: renderedOpenMethod\n });\n }, [store, generatedId, modal, multiple, value, open, mounted, transitionStatus, popupProps, mergedTriggerProps, items, itemToStringLabel, itemToStringValue, isItemEqualToValue, renderedOpenMethod]);\n const contextValue = React.useMemo(() => ({\n store,\n name,\n required,\n disabled,\n readOnly,\n multiple,\n highlightItemOnHover,\n setValue,\n setOpen,\n listRef,\n popupRef,\n scrollHandlerRef,\n handleScrollArrowVisibility,\n scrollArrowsMountedCountRef,\n itemProps,\n valueRef,\n valuesRef,\n labelsRef,\n typingRef,\n selectionRef,\n firstItemTextRef,\n selectedItemTextRef,\n validation,\n onOpenChangeComplete,\n alignItemWithTriggerActiveRef,\n initialValueRef\n }), [store, name, required, disabled, readOnly, multiple, highlightItemOnHover, setValue, setOpen, itemProps, validation, onOpenChangeComplete, handleScrollArrowVisibility]);\n const ref = useMergedRefs(inputRef, validation.inputRef);\n const hasMultipleSelection = multiple && Array.isArray(value) && value.length > 0;\n const hiddenInputName = multiple ? undefined : name;\n const hiddenInputs = React.useMemo(() => {\n if (!multiple || !Array.isArray(value) || !name) {\n return null;\n }\n return value.map(v => {\n const currentSerializedValue = stringifyAsValue(v, itemToStringValue);\n return /*#__PURE__*/_jsx(\"input\", {\n type: \"hidden\",\n form: form,\n name: name,\n value: currentSerializedValue,\n disabled: disabled\n }, currentSerializedValue);\n });\n }, [multiple, value, form, name, itemToStringValue, disabled]);\n return /*#__PURE__*/_jsx(SelectRootContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsxs(SelectFloatingContext.Provider, {\n value: floatingContext,\n children: [children, /*#__PURE__*/_jsx(\"input\", {\n ...validation.getValidationProps(disabled, {\n onFocus() {\n // Move focus to the trigger element when the hidden input is focused.\n store.state.triggerElement?.focus({\n // Supported in Chrome from 144 (January 2026)\n focusVisible: true\n });\n },\n // Handle browser autofill.\n onChange(event) {\n // Workaround for https://github.com/facebook/react/issues/9023\n if (event.nativeEvent.defaultPrevented || disabled || readOnly) {\n return;\n }\n const nextValue = event.currentTarget.value;\n const details = createChangeEventDetails(REASONS.none, event.nativeEvent);\n function handleChange() {\n if (multiple) {\n // Browser autofill only writes a single scalar value.\n return;\n }\n\n // Preserve the original serialized matching, then fall back to rendered text,\n // which browsers can autofill for primitive values like `value=\"US\">United States`.\n const nextValueLower = nextValue.toLowerCase();\n let matchingIndex = valuesRef.current.findIndex(candidate => stringifyAsValue(candidate, itemToStringValue).toLowerCase() === nextValueLower || stringifyAsLabel(candidate, itemToStringLabel).toLowerCase() === nextValueLower);\n if (matchingIndex === -1) {\n matchingIndex = valuesRef.current.findIndex((_, index) => {\n const renderedLabel = labelsRef.current[index];\n return renderedLabel != null && renderedLabel.toLowerCase() === nextValueLower;\n });\n }\n const matchingValue = matchingIndex === -1 ? undefined : valuesRef.current[matchingIndex];\n if (matchingValue != null) {\n // `setValue` may be canceled by `onValueChange`; rely on `useValueChanged` to\n // mark the field dirty and run validation only when the value actually changes.\n setValue(matchingValue, details);\n }\n }\n store.set('forceMount', true);\n queueMicrotask(handleChange);\n }\n }),\n id: generatedId && hiddenInputName == null ? `${generatedId}-hidden-input` : undefined,\n form: form,\n name: hiddenInputName,\n autoComplete: autoComplete,\n value: serializedValue,\n disabled: disabled,\n required: required && !hasMultipleSelection,\n readOnly: readOnly,\n ref: ref,\n style: name ? visuallyHiddenInput : visuallyHidden,\n tabIndex: -1,\n \"aria-hidden\": true,\n suppressHydrationWarning: true\n }), hiddenInputs]\n })\n });\n}"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,SAAgB,GAAW,IAAO;CAChC,IAAM,EACJ,QACA,OAAO,IACP,kBAAe,MACf,mBACA,MAAM,IACN,kBAAc,IACd,kBACA,MAAM,GACN,SACA,kBACA,UAAU,KAAe,IACzB,cAAW,IACX,cAAW,IACX,WAAQ,IACR,eACA,cACA,yBACA,UACA,cAAW,IACX,sBACA,sBACA,wBAAqB,IACrB,0BAAuB,IACvB,iBACE,IACE,EACJ,oBACE,GAAe,GACb,EACJ,cACA,gBACA,gBACA,kBACA,cACA,MAAM,IACN,UAAU,IACV,eACA,uBACE,GAAoB,GAClB,IAAc,GAAe,EACjC,OACF,CAAC,GACK,IAAW,MAAiB,IAC5B,IAAO,MAAa,GACpB,CAAC,GAAO,MAAqB,EAAc;EAC/C,YAAY;EACZ,SAAS,IAAW,KAAgB,IAAc;EAClD,MAAM;EACN,OAAO;CACT,CAAC,GACK,CAAC,GAAM,MAAoB,EAAc;EAC7C,YAAY;EACZ,SAAS;EACT,MAAM;EACN,OAAO;CACT,CAAC,GACK,IAAUA,EAAM,OAAO,CAAC,CAAC,GACzB,IAAYA,EAAM,OAAO,CAAC,CAAC,GAC3B,IAAWA,EAAM,OAAO,IAAI,GAC5B,KAAmBA,EAAM,OAAO,IAAI,GACpC,KAA8BA,EAAM,OAAO,CAAC,GAC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AAU,QAAQ;SACxC,OAAO,KAAiB,QAAQ,EAAc,YAAY,MAAM;QAClE,CAAC;QAEH,IAAM,IAAgB,MAAkB,KAAK,KAAA,IAAY,EAAU,QAAQ;QAC3E,AAAI,KAAiB,QAGnB,EAAS,GAAe,CAAO;OAEnC;OAEA,AADA,EAAM,IAAI,cAAc,EAAI,GAC5B,eAAe,CAAY;MAC7B;KACF,CAAC;KACD,IAAI,KAAe,MAAmB,OAAO,GAAG,EAAY,iBAAiB,KAAA;KACvE;KACN,MAAM;KACQ;KACd,OAAO;KACG;KACV,UAAU,KAAY,CAAC;KACb;KACL;KACL,OAAO,IAAO,KAAsB;KACpC,UAAU;KACV,eAAe;KACf,0BAA0B;IAC5B,CAAC;IAAG;GAAY;EAClB,CAAC;CACH,CAAC;AACH"}
|
package/dist/index383.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let r = n.getBoundingClientRect(), i = e(n);
|
|
6
|
-
if (t) return r;
|
|
7
|
-
let a = i.getComputedStyle(n, "::before"), o = i.getComputedStyle(n, "::after");
|
|
8
|
-
if (!(a.content !== "none" || o.content !== "none")) return r;
|
|
9
|
-
let s = parseFloat(a.width) || 0, c = parseFloat(a.height) || 0, l = parseFloat(o.width) || 0, u = parseFloat(o.height) || 0, d = Math.max(r.width, s, l), f = Math.max(r.height, c, u), p = d - r.width, m = f - r.height;
|
|
10
|
-
return {
|
|
11
|
-
left: r.left - p / 2,
|
|
12
|
-
right: r.right + p / 2,
|
|
13
|
-
top: r.top - m / 2,
|
|
14
|
-
bottom: r.bottom + m / 2
|
|
15
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
//#region ../../node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs
|
|
3
|
+
function e(e, t) {
|
|
4
|
+
return e ?? t;
|
|
16
5
|
}
|
|
17
6
|
//#endregion
|
|
18
|
-
export {
|
|
7
|
+
export { e as resolveAriaLabelledBy };
|
|
19
8
|
|
|
20
9
|
//# sourceMappingURL=index383.js.map
|
package/dist/index383.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index383.js","names":[
|
|
1
|
+
{"version":3,"file":"index383.js","names":[],"sources":["../../../node_modules/@base-ui/react/utils/resolveAriaLabelledBy.mjs"],"sourcesContent":["'use client';\n\nexport function getDefaultLabelId(id) {\n return id == null ? undefined : `${id}-label`;\n}\nexport function resolveAriaLabelledBy(fieldLabelId, localLabelId) {\n return fieldLabelId ?? localLabelId;\n}"],"x_google_ignoreList":[0],"mappings":";;AAKA,SAAgB,EAAsB,GAAc,GAAc;CAChE,OAAO,KAAgB;AACzB"}
|
package/dist/index384.js
CHANGED
|
@@ -1,115 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import { useSelectRootContext as p } from "./index366.js";
|
|
16
|
-
import { fieldValidityMapping as m } from "./index368.js";
|
|
17
|
-
import { useFieldRootContext as te } from "./index369.js";
|
|
18
|
-
import { useLabelableContext as ne } from "./index371.js";
|
|
19
|
-
import { useLabelableId as re } from "./index372.js";
|
|
20
|
-
import { selectors as h } from "./index376.js";
|
|
21
|
-
import { resolveAriaLabelledBy as g } from "./index382.js";
|
|
22
|
-
import { getPseudoElementBounds as ie } from "./index383.js";
|
|
23
|
-
import * as _ from "react";
|
|
24
|
-
//#region ../../node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs
|
|
25
|
-
var v = 2, y = 400, b = {
|
|
26
|
-
...n,
|
|
27
|
-
...m,
|
|
28
|
-
popupSide: (e) => e ? { "data-popup-side": e } : null,
|
|
29
|
-
value: () => null
|
|
30
|
-
}, x = /*#__PURE__*/ _.forwardRef(function(n, m) {
|
|
31
|
-
let { render: x, className: ae, id: oe, disabled: S = !1, nativeButton: C = !0, style: se, ...w } = n, { setTouched: T, setFocused: E, validationMode: D, state: O, disabled: k } = te(), { labelId: A } = ne(), { store: j, setOpen: M, selectionRef: N, validation: P, readOnly: F, required: I, alignItemWithTriggerActiveRef: L, disabled: R } = p(), z = k || R || S, B = f(j, h.open), V = f(j, h.mounted), H = f(j, h.value), U = f(j, h.triggerProps), W = f(j, h.positionerElement), G = f(j, h.listElement), K = f(j, h.popupSide), q = f(j, h.id), ce = f(j, h.labelId), le = f(j, h.hasSelectedValue), ue = V && W ? K : null, J = oe ?? q, Y = g(A, ce);
|
|
32
|
-
re({ id: J });
|
|
33
|
-
let de = u(W), X = _.useRef(null), { getButtonProps: fe, buttonRef: pe } = i({
|
|
34
|
-
disabled: z,
|
|
35
|
-
native: C
|
|
36
|
-
}), me = r((e) => {
|
|
37
|
-
j.set("triggerElement", e);
|
|
38
|
-
}), he = s(), Z = s(), Q = s();
|
|
39
|
-
_.useEffect(() => {
|
|
40
|
-
if (B) return Q.start(y, () => {
|
|
41
|
-
N.current.allowUnselectedMouseUp = !0, N.current.allowSelectedMouseUp = !0;
|
|
42
|
-
}), () => {
|
|
43
|
-
Q.clear();
|
|
44
|
-
};
|
|
45
|
-
N.current = {
|
|
46
|
-
allowSelectedMouseUp: !1,
|
|
47
|
-
allowUnselectedMouseUp: !1,
|
|
48
|
-
dragY: 0
|
|
49
|
-
}, Z.clear();
|
|
50
|
-
}, [
|
|
51
|
-
B,
|
|
52
|
-
N,
|
|
53
|
-
Z,
|
|
54
|
-
Q
|
|
55
|
-
]);
|
|
56
|
-
let ge = e(U, {
|
|
57
|
-
id: J,
|
|
58
|
-
role: "combobox",
|
|
59
|
-
"aria-expanded": B ? "true" : "false",
|
|
60
|
-
"aria-haspopup": "listbox",
|
|
61
|
-
"aria-controls": B ? G?.id ?? l(W)?.id : void 0,
|
|
62
|
-
"aria-labelledby": Y,
|
|
63
|
-
"aria-readonly": F || void 0,
|
|
64
|
-
"aria-required": I || void 0,
|
|
65
|
-
tabIndex: z ? -1 : 0,
|
|
66
|
-
onFocus(e) {
|
|
67
|
-
E(!0), B && L.current && M(!1, o(a, e.nativeEvent)), he.start(0, () => {
|
|
68
|
-
j.set("forceMount", !0);
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
onBlur(e) {
|
|
72
|
-
c(W, e.relatedTarget) || (T(!0), E(!1), D === "onBlur" && P.commit(H));
|
|
73
|
-
},
|
|
74
|
-
onMouseDown(e) {
|
|
75
|
-
if (B) return;
|
|
76
|
-
let t = d(e.currentTarget);
|
|
77
|
-
function n(e) {
|
|
78
|
-
if (!X.current) return;
|
|
79
|
-
let t = e.target;
|
|
80
|
-
if (c(X.current, t) || c(de.current, t)) return;
|
|
81
|
-
let n = ie(X.current);
|
|
82
|
-
e.clientX >= n.left - v && e.clientX <= n.right + v && e.clientY >= n.top - v && e.clientY <= n.bottom + v || M(!1, o(ee, e));
|
|
83
|
-
}
|
|
84
|
-
Z.start(0, () => {
|
|
85
|
-
t.addEventListener("mouseup", n, { once: !0 });
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
}, w, fe), $ = P.getValidationProps(z, ge);
|
|
89
|
-
$.role = "combobox";
|
|
90
|
-
let _e = {
|
|
91
|
-
...O,
|
|
92
|
-
open: B,
|
|
93
|
-
disabled: z,
|
|
94
|
-
value: H,
|
|
95
|
-
readOnly: F,
|
|
96
|
-
popupSide: ue,
|
|
97
|
-
placeholder: !le
|
|
1
|
+
import { getWindow as e } from "./index200.js";
|
|
2
|
+
import { jsdom as t } from "./index220.js";
|
|
3
|
+
//#region ../../node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs
|
|
4
|
+
function n(n) {
|
|
5
|
+
let r = n.getBoundingClientRect(), i = e(n);
|
|
6
|
+
if (t) return r;
|
|
7
|
+
let a = i.getComputedStyle(n, "::before"), o = i.getComputedStyle(n, "::after");
|
|
8
|
+
if (!(a.content !== "none" || o.content !== "none")) return r;
|
|
9
|
+
let s = parseFloat(a.width) || 0, c = parseFloat(a.height) || 0, l = parseFloat(o.width) || 0, u = parseFloat(o.height) || 0, d = Math.max(r.width, s, l), f = Math.max(r.height, c, u), p = d - r.width, m = f - r.height;
|
|
10
|
+
return {
|
|
11
|
+
left: r.left - p / 2,
|
|
12
|
+
right: r.right + p / 2,
|
|
13
|
+
top: r.top - m / 2,
|
|
14
|
+
bottom: r.bottom + m / 2
|
|
98
15
|
};
|
|
99
|
-
|
|
100
|
-
ref: [
|
|
101
|
-
m,
|
|
102
|
-
X,
|
|
103
|
-
pe,
|
|
104
|
-
me
|
|
105
|
-
],
|
|
106
|
-
state: _e,
|
|
107
|
-
stateAttributesMapping: b,
|
|
108
|
-
props: $
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
process.env.NODE_ENV !== "production" && (x.displayName = "SelectTrigger");
|
|
16
|
+
}
|
|
112
17
|
//#endregion
|
|
113
|
-
export {
|
|
18
|
+
export { n as getPseudoElementBounds };
|
|
114
19
|
|
|
115
20
|
//# sourceMappingURL=index384.js.map
|
package/dist/index384.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index384.js","names":["React","REASONS.none","REASONS.cancelOpen"],"sources":["../../../node_modules/@base-ui/react/select/trigger/SelectTrigger.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useTimeout } from '@base-ui/utils/useTimeout';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { useStore } from '@base-ui/utils/store';\nimport { useSelectRootContext } from \"../root/SelectRootContext.mjs\";\nimport { useFieldRootContext } from \"../../internals/field-root-context/FieldRootContext.mjs\";\nimport { useLabelableContext } from \"../../internals/labelable-provider/LabelableContext.mjs\";\nimport { pressableTriggerOpenStateMapping } from \"../../utils/popupStateMapping.mjs\";\nimport { fieldValidityMapping } from \"../../internals/field-constants/constants.mjs\";\nimport { useRenderElement } from \"../../internals/useRenderElement.mjs\";\nimport { selectors } from \"../store.mjs\";\nimport { getPseudoElementBounds } from \"../../utils/getPseudoElementBounds.mjs\";\nimport { contains, getFloatingFocusElement } from \"../../floating-ui-react/utils.mjs\";\nimport { mergeProps } from \"../../merge-props/index.mjs\";\nimport { useButton } from \"../../internals/use-button/index.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useLabelableId } from \"../../internals/labelable-provider/useLabelableId.mjs\";\nimport { resolveAriaLabelledBy } from \"../../utils/resolveAriaLabelledBy.mjs\";\nconst BOUNDARY_OFFSET = 2;\nconst SELECTED_DELAY = 400;\nconst stateAttributesMapping = {\n ...pressableTriggerOpenStateMapping,\n ...fieldValidityMapping,\n popupSide: side => side ? {\n 'data-popup-side': side\n } : null,\n value: () => null\n};\n\n/**\n * A button that opens the select popup.\n * Renders a `<button>` element.\n *\n * Documentation: [Base UI Select](https://base-ui.com/react/components/select)\n */\nexport const SelectTrigger = /*#__PURE__*/React.forwardRef(function SelectTrigger(componentProps, forwardedRef) {\n const {\n render,\n className,\n id: idProp,\n disabled: disabledProp = false,\n nativeButton = true,\n style,\n ...elementProps\n } = componentProps;\n const {\n setTouched,\n setFocused,\n validationMode,\n state: fieldState,\n disabled: fieldDisabled\n } = useFieldRootContext();\n const {\n labelId: fieldLabelId\n } = useLabelableContext();\n const {\n store,\n setOpen,\n selectionRef,\n validation,\n readOnly,\n required,\n alignItemWithTriggerActiveRef,\n disabled: selectDisabled\n } = useSelectRootContext();\n const disabled = fieldDisabled || selectDisabled || disabledProp;\n const open = useStore(store, selectors.open);\n const mounted = useStore(store, selectors.mounted);\n const value = useStore(store, selectors.value);\n const triggerProps = useStore(store, selectors.triggerProps);\n const positionerElement = useStore(store, selectors.positionerElement);\n const listElement = useStore(store, selectors.listElement);\n const popupSideValue = useStore(store, selectors.popupSide);\n const rootId = useStore(store, selectors.id);\n const selectLabelId = useStore(store, selectors.labelId);\n const hasSelectedValue = useStore(store, selectors.hasSelectedValue);\n const popupSide = mounted && positionerElement ? popupSideValue : null;\n const id = idProp ?? rootId;\n const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, selectLabelId);\n useLabelableId({\n id\n });\n const positionerRef = useValueAsRef(positionerElement);\n const triggerRef = React.useRef(null);\n const {\n getButtonProps,\n buttonRef\n } = useButton({\n disabled,\n native: nativeButton\n });\n const setTriggerElement = useStableCallback(element => {\n store.set('triggerElement', element);\n });\n const timeoutFocus = useTimeout();\n const timeoutMouseDown = useTimeout();\n const selectedDelayTimeout = useTimeout();\n React.useEffect(() => {\n if (open) {\n // A mousedown on the trigger can open the popup under the cursor. Keep mouseup selection\n // disabled briefly so releasing over either the selected item or a neighboring item doesn't\n // commit an accidental selection. SelectItem can still opt into unselected mouseup sooner\n // after a real drag over the item.\n selectedDelayTimeout.start(SELECTED_DELAY, () => {\n selectionRef.current.allowUnselectedMouseUp = true;\n selectionRef.current.allowSelectedMouseUp = true;\n });\n return () => {\n selectedDelayTimeout.clear();\n };\n }\n selectionRef.current = {\n allowSelectedMouseUp: false,\n allowUnselectedMouseUp: false,\n dragY: 0\n };\n timeoutMouseDown.clear();\n return undefined;\n }, [open, selectionRef, timeoutMouseDown, selectedDelayTimeout]);\n const mergedProps = mergeProps(triggerProps, {\n id,\n role: 'combobox',\n 'aria-expanded': open ? 'true' : 'false',\n 'aria-haspopup': 'listbox',\n 'aria-controls': open ? listElement?.id ?? getFloatingFocusElement(positionerElement)?.id : undefined,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-readonly': readOnly || undefined,\n 'aria-required': required || undefined,\n tabIndex: disabled ? -1 : 0,\n onFocus(event) {\n setFocused(true);\n\n // The popup element shouldn't obscure the focused trigger.\n if (open && alignItemWithTriggerActiveRef.current) {\n setOpen(false, createChangeEventDetails(REASONS.none, event.nativeEvent));\n }\n\n // Saves a re-render on initial click: `forceMount === true` mounts\n // the items before `open === true`. We could sync those cycles better\n // without a timeout, but this is enough for now.\n timeoutFocus.start(0, () => {\n store.set('forceMount', true);\n });\n },\n onBlur(event) {\n // If focus is moving into the popup, don't count it as a blur.\n if (contains(positionerElement, event.relatedTarget)) {\n return;\n }\n setTouched(true);\n setFocused(false);\n if (validationMode === 'onBlur') {\n validation.commit(value);\n }\n },\n onMouseDown(event) {\n if (open) {\n return;\n }\n const doc = ownerDocument(event.currentTarget);\n function handleMouseUp(mouseEvent) {\n if (!triggerRef.current) {\n return;\n }\n const mouseUpTarget = mouseEvent.target;\n\n // Don't treat the release as an outside press when it lands on the trigger or inside\n // the popup positioner (or their children).\n if (contains(triggerRef.current, mouseUpTarget) || contains(positionerRef.current, mouseUpTarget)) {\n return;\n }\n const bounds = getPseudoElementBounds(triggerRef.current);\n if (mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET && mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET) {\n return;\n }\n setOpen(false, createChangeEventDetails(REASONS.cancelOpen, mouseEvent));\n }\n\n // Firefox can fire this upon mousedown\n timeoutMouseDown.start(0, () => {\n doc.addEventListener('mouseup', handleMouseUp, {\n once: true\n });\n });\n }\n }, elementProps, getButtonProps);\n const props = validation.getValidationProps(disabled, mergedProps);\n\n // ensure nested useButton does not overwrite the combobox role:\n // <Toolbar.Button render={<Select.Trigger />} />\n props.role = 'combobox';\n const state = {\n ...fieldState,\n open,\n disabled,\n value,\n readOnly,\n popupSide,\n placeholder: !hasSelectedValue\n };\n return useRenderElement('button', componentProps, {\n ref: [forwardedRef, triggerRef, buttonRef, setTriggerElement],\n state,\n stateAttributesMapping,\n props\n });\n});\nif (process.env.NODE_ENV !== \"production\") SelectTrigger.displayName = \"SelectTrigger\";"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAu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Q,IAAO,EAAyBC,IAAoB,CAAU,CAAC;GACzE;GAGA,EAAiB,MAAM,SAAS;IAC9B,EAAI,iBAAiB,WAAW,GAAe,EAC7C,MAAM,GACR,CAAC;GACH,CAAC;EACH;CACF,GAAG,GAAc,EAAc,GACzB,IAAQ,EAAW,mBAAmB,GAAU,EAAW;CAIjE,EAAM,OAAO;CACb,IAAM,KAAQ;EACZ,GAAG;EACH;EACA;EACA;EACA;EACA;EACA,aAAa,CAAC;CAChB;CACA,OAAO,EAAiB,UAAU,GAAgB;EAChD,KAAK;GAAC;GAAc;GAAY;GAAW;EAAiB;EAC5D;EACA;EACA;CACF,CAAC;AACH,CAAC;AACD,QAAA,IAAA,aAA6B,iBAAc,EAAc,cAAc"}
|
|
1
|
+
{"version":3,"file":"index384.js","names":["ownerWindow","platform.env.jsdom"],"sources":["../../../node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs"],"sourcesContent":["import { ownerWindow } from '@base-ui/utils/owner';\nimport { platform } from '@base-ui/utils/platform';\nexport function getPseudoElementBounds(element) {\n const elementRect = element.getBoundingClientRect();\n const win = ownerWindow(element);\n\n // Avoid \"Not implemented: window.getComputedStyle(elt, pseudoElt)\" in jsdom.\n if (platform.env.jsdom) {\n return elementRect;\n }\n const beforeStyles = win.getComputedStyle(element, '::before');\n const afterStyles = win.getComputedStyle(element, '::after');\n const hasPseudoElements = beforeStyles.content !== 'none' || afterStyles.content !== 'none';\n if (!hasPseudoElements) {\n return elementRect;\n }\n\n // Get dimensions of pseudo-elements\n const beforeWidth = parseFloat(beforeStyles.width) || 0;\n const beforeHeight = parseFloat(beforeStyles.height) || 0;\n const afterWidth = parseFloat(afterStyles.width) || 0;\n const afterHeight = parseFloat(afterStyles.height) || 0;\n\n // Calculate max dimensions including pseudo-elements\n const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth);\n const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight);\n\n // Calculate the differences to extend the bounds\n const widthDiff = totalWidth - elementRect.width;\n const heightDiff = totalHeight - elementRect.height;\n return {\n left: elementRect.left - widthDiff / 2,\n right: elementRect.right + widthDiff / 2,\n top: elementRect.top - heightDiff / 2,\n bottom: elementRect.bottom + heightDiff / 2\n };\n}"],"x_google_ignoreList":[0],"mappings":";;;AAEA,SAAgB,EAAuB,GAAS;CAC9C,IAAM,IAAc,EAAQ,sBAAsB,GAC5C,IAAMA,EAAY,CAAO;CAG/B,IAAIC,GACF,OAAO;CAET,IAAM,IAAe,EAAI,iBAAiB,GAAS,UAAU,GACvD,IAAc,EAAI,iBAAiB,GAAS,SAAS;CAE3D,IAAI,EADsB,EAAa,YAAY,UAAU,EAAY,YAAY,SAEnF,OAAO;CAIT,IAAM,IAAc,WAAW,EAAa,KAAK,KAAK,GAChD,IAAe,WAAW,EAAa,MAAM,KAAK,GAClD,IAAa,WAAW,EAAY,KAAK,KAAK,GAC9C,IAAc,WAAW,EAAY,MAAM,KAAK,GAGhD,IAAa,KAAK,IAAI,EAAY,OAAO,GAAa,CAAU,GAChE,IAAc,KAAK,IAAI,EAAY,QAAQ,GAAc,CAAW,GAGpE,IAAY,IAAa,EAAY,OACrC,IAAa,IAAc,EAAY;CAC7C,OAAO;EACL,MAAM,EAAY,OAAO,IAAY;EACrC,OAAO,EAAY,QAAQ,IAAY;EACvC,KAAK,EAAY,MAAM,IAAa;EACpC,QAAQ,EAAY,SAAS,IAAa;CAC5C;AACF"}
|