solid-baseui 0.1.0-alpha.1 → 0.1.0-alpha.2
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/CHANGELOG.md +42 -0
- package/README.md +51 -20
- package/dist/lib/client/DialogHandle-DluOK_7u.js +521 -0
- package/dist/lib/client/DialogPopup-CfEb3F54.js +138 -0
- package/dist/lib/client/FieldControl-eDe-Jnp9.js +142 -0
- package/dist/lib/client/{FieldRootContext-izCEh80D.js → FieldRootContext-D3fuVjs3.js} +1 -1
- package/dist/lib/client/{FocusManager-NP1uPXTi.js → FocusManager-q7z7PMV1.js} +92 -89
- package/dist/lib/client/{InternalBackdrop-cSK13gaM.js → InternalBackdrop-B8_lfUvf.js} +1 -1
- package/dist/lib/client/{MenuSubmenuTrigger-yfncqM-D.js → MenuSubmenuTrigger-DMb5CwTF.js} +386 -386
- package/dist/lib/client/{PopupHandle-CQI6Om1Z.js → PopupHandle-DyX5gY1e.js} +17 -11
- package/dist/lib/client/{PopupStore-Du0O57fL.js → PopupStore-BjRwcvbG.js} +91 -88
- package/dist/lib/client/PopupViewport-BanYHrD-.js +154 -0
- package/dist/lib/client/{TriggerFocusGuards-Cs8LVBj5.js → TriggerFocusGuards-Fzspp3Y1.js} +2 -2
- package/dist/lib/client/accordion/index.js +1 -1
- package/dist/lib/client/{accordion-BFeZFpJZ.js → accordion-CA2DfX67.js} +144 -144
- package/dist/lib/client/alert-dialog/index.js +1 -1
- package/dist/lib/client/{alert-dialog-BxGUF8_Q.js → alert-dialog-Bup88Dpx.js} +2 -2
- package/dist/lib/client/autocomplete/index.js +1 -1
- package/dist/lib/client/{autocomplete-C9QA98XD.js → autocomplete-oyy_uRpU.js} +2 -2
- package/dist/lib/client/avatar/index.js +1 -1
- package/dist/lib/client/avatar-DNZ4fnBd.js +191 -0
- package/dist/lib/client/button/index.js +1 -1
- package/dist/lib/client/button-BJZYmCVv.js +88 -0
- package/dist/lib/client/checkbox/index.js +1 -1
- package/dist/lib/client/checkbox-group/index.js +1 -1
- package/dist/lib/client/{checkbox-group-CwMDoSTK.js → checkbox-group-DGyrciZJ.js} +1 -1
- package/dist/lib/client/checkbox-sQHYTbpB.js +425 -0
- package/dist/lib/client/collapsible/index.js +1 -1
- package/dist/lib/client/collapsible-BENbFFCc.js +230 -0
- package/dist/lib/client/combobox/index.js +1 -1
- package/dist/lib/client/{combobox-6DhOdzit.js → combobox-BGH8QLXH.js} +143 -141
- package/dist/lib/client/compositeNavigation-DCt1sQon.js +82 -0
- package/dist/lib/client/{constants-cOVxAoxB.js → constants-ByOMFJAe.js} +100 -100
- package/dist/lib/client/context-menu/index.js +1 -1
- package/dist/lib/client/context-menu-xQ1sBCET.js +220 -0
- package/dist/lib/client/{createAnchorPositioning-D96gu-Dz.js → createAnchorPositioning-DCXIApS1.js} +1 -1
- package/dist/lib/client/{createAnchoredPopupScrollLock-Cx0cbh1_.js → createAnchoredPopupScrollLock-BxKpJbCE.js} +2 -2
- package/dist/lib/client/{createClickInteraction-CTaIFBiV.js → createClickInteraction-BeBsTqtY.js} +1 -1
- package/dist/lib/client/{createFocusInteraction--s9_qBf3.js → createFocusInteraction-DQPWkZe2.js} +7 -7
- package/dist/lib/client/{createPopupAutoResize-Dn-stj-8.js → createPopupAutoResize-CSNpMz5v.js} +3 -3
- package/dist/lib/client/dialog/index.js +1 -1
- package/dist/lib/client/{dialog-B9tR9X48.js → dialog-C0EF0a5u.js} +2 -2
- package/dist/lib/client/{dom-BEAeQ9Eb.js → dom-lDdayFF_.js} +25 -15
- package/dist/lib/client/drawer/index.js +1 -1
- package/dist/lib/client/{drawer-dyr3_sKQ.js → drawer-uKoNBwDU.js} +519 -518
- package/dist/lib/client/field/index.js +1 -1
- package/dist/lib/client/{field-CjUAjp1m.js → field-DIMrgpBW.js} +144 -144
- package/dist/lib/client/form/index.js +1 -1
- package/dist/lib/client/form-Bqq8wSLY.js +109 -0
- package/dist/lib/client/index.js +34 -34
- package/dist/lib/client/input/index.js +1 -1
- package/dist/lib/client/{input-_QHvSSqM.js → input-YthuKwIE.js} +1 -1
- package/dist/lib/client/internals/composeEventHandlers.js +14 -8
- package/dist/lib/client/internals/field-root-context/index.js +2 -2
- package/dist/lib/client/{mergeStyleValue-DhTA9Nwe.js → isSolidAccessor-BH_FevwH.js} +1 -12
- package/dist/lib/client/menu/index.js +1 -1
- package/dist/lib/client/{menu-DLqUBmMK.js → menu-4rNLN6aX.js} +79 -79
- package/dist/lib/client/menubar/index.js +1 -1
- package/dist/lib/client/menubar-nFQGtNmY.js +163 -0
- package/dist/lib/client/mergeStyleValue-Dcd36yxZ.js +12 -0
- package/dist/lib/client/navigation-menu/index.js +1 -1
- package/dist/lib/client/{navigation-menu-mVHV41Ky.js → navigation-menu-BbRyun3a.js} +284 -284
- package/dist/lib/client/number-field/index.js +1 -1
- package/dist/lib/client/{number-field-DusLw_0X.js → number-field-hT_H0hVu.js} +356 -356
- package/dist/lib/client/otp-field/index.js +1 -1
- package/dist/lib/client/otp-field-lsy2iGID.js +584 -0
- package/dist/lib/client/popover/index.js +1 -1
- package/dist/lib/client/{popover-Cv7xn0nW.js → popover-Cmvmuf1L.js} +250 -248
- package/dist/lib/client/{popupStateMapping-C6jQ_LKo.js → popupStateMapping-nhukB8NK.js} +51 -51
- package/dist/lib/client/preview-card/index.js +1 -1
- package/dist/lib/client/{preview-card-FTN_aafM.js → preview-card-Dtu8AnBN.js} +168 -168
- package/dist/lib/client/radio/index.js +1 -1
- package/dist/lib/client/{radio-DA_oZhQT.js → radio-CeCU-Qqi.js} +77 -77
- package/dist/lib/client/radio-group/index.js +1 -1
- package/dist/lib/client/radio-group-NbuJvjQe.js +195 -0
- package/dist/lib/client/{safePolygon-DJG0VIVo.js → safePolygon-DVAR5dQD.js} +70 -70
- package/dist/lib/client/scroll-area/index.js +1 -1
- package/dist/lib/client/scroll-area-DqbvoAd7.js +717 -0
- package/dist/lib/client/{scrollable-SRNYlhF7.js → scrollable-BVaDUXng.js} +12 -12
- package/dist/lib/client/select/index.js +1 -1
- package/dist/lib/client/{select-DSPJt7Rk.js → select-Dad51Xbn.js} +635 -634
- package/dist/lib/client/slider/index.js +1 -1
- package/dist/lib/client/slider-CLSKFq_M.js +927 -0
- package/dist/lib/client/switch/index.js +1 -1
- package/dist/lib/client/{switch-CPl7QHKI.js → switch-Bzuu5EIg.js} +61 -61
- package/dist/lib/client/tabs/index.js +1 -1
- package/dist/lib/client/{tabs-Bn4rZDyZ.js → tabs-DWiBDv8D.js} +252 -249
- package/dist/lib/client/toast/index.js +1 -1
- package/dist/lib/client/{toast-7LdqZWOs.js → toast-DmtPJW2k.js} +353 -353
- package/dist/lib/client/toggle/index.js +1 -1
- package/dist/lib/client/{toggle-CsC37e3e.js → toggle-CAe-Z8Xn.js} +33 -33
- package/dist/lib/client/toggle-group/index.js +1 -1
- package/dist/lib/client/{toggle-group-DSWb9HxN.js → toggle-group-BbQg5s-m.js} +44 -44
- package/dist/lib/client/toolbar/index.js +1 -1
- package/dist/lib/client/{toolbar-DcCi3HNp.js → toolbar-BXT_g-oX.js} +218 -218
- package/dist/lib/client/tooltip/index.js +1 -1
- package/dist/lib/client/{tooltip-D-PkGco9.js → tooltip-h2r2_Xuo.js} +250 -249
- package/dist/lib/client/{useFilteredItems-B7z2CGMV.js → useFilteredItems-BX0BEuSI.js} +850 -819
- package/dist/lib/server/{DialogHandle-nJSSy_jM.js → DialogHandle-BGIISmG7.js} +16 -16
- package/dist/lib/server/{DialogPopup-Da1aIxVA.js → DialogPopup-C2ZDGf42.js} +4 -4
- package/dist/lib/server/{FieldControl-BDeNR3ug.js → FieldControl-CDMMyvuj.js} +6 -6
- package/dist/lib/server/{FieldRootContext-IC-LWzVp.js → FieldRootContext-Bfpna6gA.js} +3 -3
- package/dist/lib/server/{FocusManager-1LfoCsya.js → FocusManager-D-xgblGs.js} +9 -3
- package/dist/lib/server/{InternalBackdrop-C_iDPVR-.js → InternalBackdrop-D_2zAWnl.js} +1 -1
- package/dist/lib/server/{MenuSubmenuTrigger-rR8ZN7YR.js → MenuSubmenuTrigger-BMQKlOvU.js} +50 -50
- package/dist/lib/server/{PopupHandle-Ct6wywmP.js → PopupHandle-QNj4mED2.js} +14 -5
- package/dist/lib/server/{PopupStore-kHjFPiQ5.js → PopupStore-evylvVnN.js} +5 -2
- package/dist/lib/server/{PopupViewport-DftN5VUp.js → PopupViewport-BDttjORN.js} +37 -27
- package/dist/lib/server/{TriggerFocusGuards-CvoGfft9.js → TriggerFocusGuards-B9GNbLrL.js} +2 -2
- package/dist/lib/server/accordion/index.js +7 -7
- package/dist/lib/server/alert-dialog/index.js +2 -2
- package/dist/lib/server/autocomplete/index.js +2 -2
- package/dist/lib/server/avatar/index.js +3 -3
- package/dist/lib/server/button/index.js +6 -6
- package/dist/lib/server/checkbox/index.js +7 -7
- package/dist/lib/server/checkbox-group/index.js +1 -1
- package/dist/lib/server/collapsible/index.js +6 -6
- package/dist/lib/server/combobox/index.js +18 -18
- package/dist/lib/server/{compositeNavigation-BRVT1C38.js → compositeNavigation-D5jKM4yk.js} +32 -1
- package/dist/lib/server/{constants-D7ciIzsV.js → constants-ByqXubhO.js} +2 -2
- package/dist/lib/server/context-menu/index.js +9 -9
- package/dist/lib/server/{createAnchorPositioning-B5Y0WEev.js → createAnchorPositioning-DrQYe7RS.js} +1 -1
- package/dist/lib/server/{createAnchoredPopupScrollLock-DFuUrykR.js → createAnchoredPopupScrollLock-q6gnOSmv.js} +2 -2
- package/dist/lib/server/{createClickInteraction-BYsMgvup.js → createClickInteraction-D7oc1Vco.js} +1 -1
- package/dist/lib/server/{createFocusInteraction-DMyKsniI.js → createFocusInteraction-DFKr4G7a.js} +1 -1
- package/dist/lib/server/{createPopupAutoResize-ImBjwdj_.js → createPopupAutoResize-Cg0-lLf4.js} +1 -1
- package/dist/lib/server/dialog/index.js +2 -2
- package/dist/lib/server/{dom-Crg_2R-j.js → dom-D8_aB1yy.js} +14 -1
- package/dist/lib/server/drawer/index.js +38 -34
- package/dist/lib/server/field/index.js +6 -6
- package/dist/lib/server/form/index.js +2 -2
- package/dist/lib/server/input/index.js +1 -1
- package/dist/lib/server/internals/composeEventHandlers.js +15 -9
- package/dist/lib/server/internals/field-root-context/index.js +1 -1
- package/dist/lib/server/{mergeStyleValue-BwJ10_X2.js → isSolidAccessor-CZpzAH5l.js} +1 -20
- package/dist/lib/server/menu/index.js +17 -17
- package/dist/lib/server/menubar/index.js +4 -4
- package/dist/lib/server/mergeStyleValue-DecVaoac.js +20 -0
- package/dist/lib/server/navigation-menu/index.js +21 -21
- package/dist/lib/server/number-field/index.js +21 -21
- package/dist/lib/server/otp-field/index.js +8 -8
- package/dist/lib/server/popover/index.js +27 -26
- package/dist/lib/server/{popupStateMapping-B2KsiiLb.js → popupStateMapping-VHqr6M4H.js} +1 -1
- package/dist/lib/server/preview-card/index.js +16 -16
- package/dist/lib/server/radio/index.js +6 -6
- package/dist/lib/server/radio-group/index.js +5 -5
- package/dist/lib/server/{safePolygon-C1GNJbKR.js → safePolygon-B8QtiIZ3.js} +1 -1
- package/dist/lib/server/scroll-area/index.js +18 -18
- package/dist/lib/server/{scrollable-CjsSxbGr.js → scrollable-C9Pgq8T5.js} +1 -1
- package/dist/lib/server/select/index.js +39 -38
- package/dist/lib/server/slider/index.js +14 -14
- package/dist/lib/server/switch/index.js +9 -9
- package/dist/lib/server/tabs/index.js +12 -8
- package/dist/lib/server/toast/index.js +32 -32
- package/dist/lib/server/toggle/index.js +7 -7
- package/dist/lib/server/toggle-group/index.js +2 -2
- package/dist/lib/server/toolbar/index.js +14 -14
- package/dist/lib/server/tooltip/index.js +32 -27
- package/dist/lib/server/{useFilteredItems-DCxq20Is.js → useFilteredItems-BmhL0nf1.js} +181 -137
- package/dist/lib/types/accordion/trigger/AccordionTrigger.d.ts +7 -7
- package/dist/lib/types/combobox/chip/ComboboxChip.d.ts +2 -0
- package/dist/lib/types/combobox/root/ComboboxRoot.d.ts +6 -1
- package/dist/lib/types/combobox/store/ComboboxStore.d.ts +1 -0
- package/dist/lib/types/combobox/utils/handleInputPress.d.ts +1 -1
- package/dist/lib/types/field/control/FieldControl.d.ts +5 -5
- package/dist/lib/types/internals/composeEventHandlers.d.ts +9 -2
- package/dist/lib/types/internals/field-root-context/FieldRootContext.d.ts +1 -0
- package/dist/lib/types/internals/overlay/dom.d.ts +2 -0
- package/dist/lib/types/number-field/input/NumberFieldInput.d.ts +5 -5
- package/dist/lib/types/slider/track/SliderTrack.d.ts +2 -2
- package/dist/lib/types/toolbar/link/ToolbarLink.d.ts +10 -3
- package/dist/lib/types/toolbar/root/ToolbarRoot.d.ts +10 -4
- package/package.json +1 -1
- package/dist/lib/client/DialogHandle-BGyIbcvg.js +0 -521
- package/dist/lib/client/DialogPopup-Df7MC358.js +0 -138
- package/dist/lib/client/FieldControl-C0PATyKV.js +0 -142
- package/dist/lib/client/PopupViewport-IS4XU03s.js +0 -152
- package/dist/lib/client/avatar-BQoEzzav.js +0 -191
- package/dist/lib/client/button-akYS6FyY.js +0 -88
- package/dist/lib/client/checkbox-DOXtzBhA.js +0 -425
- package/dist/lib/client/collapsible-t8YReaIp.js +0 -230
- package/dist/lib/client/compositeNavigation-sxniYTc7.js +0 -58
- package/dist/lib/client/context-menu-CplDpqmi.js +0 -220
- package/dist/lib/client/form-6Ne_bWQX.js +0 -109
- package/dist/lib/client/menubar-DhPRUQZ6.js +0 -163
- package/dist/lib/client/otp-field-D-B9tZzF.js +0 -584
- package/dist/lib/client/radio-group-CWtQxWDl.js +0 -195
- package/dist/lib/client/scroll-area-NCr49LkD.js +0 -717
- package/dist/lib/client/slider-CWq9hxFf.js +0 -927
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { t as e } from "./useRender-CxZ8PI-g.js";
|
|
2
|
+
import { getStateAttributesProps as t } from "./internals/getStateAttributesProps.js";
|
|
3
|
+
import { n, t as r } from "./resolveStyle-XcgAuaKR.js";
|
|
4
|
+
import { composeEventHandlers as i, liveEventHandler as a } from "./internals/composeEventHandlers.js";
|
|
5
|
+
import { t as o } from "./FocusManager-q7z7PMV1.js";
|
|
6
|
+
import { d as s, f as c, h as l, s as u, u as d } from "./DialogHandle-DluOK_7u.js";
|
|
7
|
+
import { createComponent as f, getNextElement as p, mergeProps as m, runHydrationEvents as h, spread as g, template as _ } from "@solidjs/web";
|
|
8
|
+
import { Show as v, createEffect as y, createMemo as b, omit as x, onCleanup as S } from "solid-js";
|
|
9
|
+
//#region src/dialog/backdrop/DialogBackdrop.tsx
|
|
10
|
+
var C = /* @__PURE__ */ _("<div>");
|
|
11
|
+
function w(i) {
|
|
12
|
+
let a = l(), o = i, u = x(i, "render", "class", "forceRender", "ref", "style"), d = b(() => ({
|
|
13
|
+
open: a.store.open(),
|
|
14
|
+
transitionStatus: a.store.track().transitionStatus
|
|
15
|
+
})), _ = e(i, () => d(), (e) => (() => {
|
|
16
|
+
var t = p(C);
|
|
17
|
+
return g(t, e, !1), h(), t;
|
|
18
|
+
})()), y = b(() => n(i.class, d())), w = b(() => c({
|
|
19
|
+
"user-select": "none",
|
|
20
|
+
"-webkit-user-select": "none"
|
|
21
|
+
}, r(i.style, d()))), T = b(() => t(d(), s)), E = b(() => !!o.forceRender || !a.nested);
|
|
22
|
+
function D() {
|
|
23
|
+
let e = null;
|
|
24
|
+
return S(() => {
|
|
25
|
+
a.backdropElement() === e && a.setBackdropElement(null);
|
|
26
|
+
}), f(_, m({
|
|
27
|
+
ref: [((t) => {
|
|
28
|
+
e = t, a.setBackdropElement(t);
|
|
29
|
+
}), o.ref],
|
|
30
|
+
role: "presentation",
|
|
31
|
+
get hidden() {
|
|
32
|
+
return !a.presence.mounted();
|
|
33
|
+
},
|
|
34
|
+
get class() {
|
|
35
|
+
return y();
|
|
36
|
+
},
|
|
37
|
+
get style() {
|
|
38
|
+
return w();
|
|
39
|
+
}
|
|
40
|
+
}, T, u));
|
|
41
|
+
}
|
|
42
|
+
return f(v, {
|
|
43
|
+
get when() {
|
|
44
|
+
return E();
|
|
45
|
+
},
|
|
46
|
+
get children() {
|
|
47
|
+
return f(D, {});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/dialog/popup/DialogPopup.tsx
|
|
53
|
+
var T = /* @__PURE__ */ _("<div>"), E = /* @__PURE__ */ new Set([
|
|
54
|
+
"ArrowUp",
|
|
55
|
+
"ArrowDown",
|
|
56
|
+
"ArrowLeft",
|
|
57
|
+
"ArrowRight",
|
|
58
|
+
"Home",
|
|
59
|
+
"End"
|
|
60
|
+
]);
|
|
61
|
+
function D(s) {
|
|
62
|
+
u();
|
|
63
|
+
let _ = l(), v = s, C = x(s, "render", "class", "finalFocus", "id", "initialFocus", "onKeyDown", "ref", "style"), w = b(() => ({
|
|
64
|
+
open: _.store.open(),
|
|
65
|
+
transitionStatus: _.store.track().transitionStatus,
|
|
66
|
+
nested: _.nested,
|
|
67
|
+
nestedDialogOpen: _.nestedOpenDialogCount() > 0
|
|
68
|
+
})), D = e(s, () => w(), (e) => (() => {
|
|
69
|
+
var t = p(T);
|
|
70
|
+
return g(t, e, !1), h(), t;
|
|
71
|
+
})()), O = b(() => n(s.class, w())), k = b(() => c({ "--nested-dialogs": _.nestedOpenDialogCount() }, r(s.style, w()))), A = b(() => t(w(), d)), j = b(() => v.id ?? _.store.context.floatingId), M = b(() => v.initialFocus ?? ((e) => e !== "touch" || _.store.state.popupElement)), N = i(a(() => v.onKeyDown), (e) => {
|
|
72
|
+
E.has(e.key) && e.stopPropagation();
|
|
73
|
+
}), P = null;
|
|
74
|
+
y(() => j(), (e) => {
|
|
75
|
+
_.store.setPopupId(e);
|
|
76
|
+
}), S(() => {
|
|
77
|
+
_.store.state.popupElement === P && _.store.setPopupElement(null);
|
|
78
|
+
});
|
|
79
|
+
let F = f(D, m({
|
|
80
|
+
ref: [((e) => {
|
|
81
|
+
P = e, _.store.setPopupElement(e);
|
|
82
|
+
}), v.ref],
|
|
83
|
+
get id() {
|
|
84
|
+
return j();
|
|
85
|
+
},
|
|
86
|
+
get role() {
|
|
87
|
+
return _.role;
|
|
88
|
+
},
|
|
89
|
+
tabIndex: -1,
|
|
90
|
+
"data-base-ui-focusable": "",
|
|
91
|
+
get hidden() {
|
|
92
|
+
return !_.presence.mounted();
|
|
93
|
+
},
|
|
94
|
+
get "aria-labelledby"() {
|
|
95
|
+
return _.titleId();
|
|
96
|
+
},
|
|
97
|
+
get "aria-describedby"() {
|
|
98
|
+
return _.descriptionId();
|
|
99
|
+
},
|
|
100
|
+
get class() {
|
|
101
|
+
return O();
|
|
102
|
+
},
|
|
103
|
+
get style() {
|
|
104
|
+
return k();
|
|
105
|
+
},
|
|
106
|
+
onKeyDown: N
|
|
107
|
+
}, A, C));
|
|
108
|
+
return f(o, {
|
|
109
|
+
get context() {
|
|
110
|
+
return _.store.context.floatingRoot;
|
|
111
|
+
},
|
|
112
|
+
get tree() {
|
|
113
|
+
return _.tree;
|
|
114
|
+
},
|
|
115
|
+
get disabled() {
|
|
116
|
+
return !_.presence.mounted();
|
|
117
|
+
},
|
|
118
|
+
get closeOnFocusOut() {
|
|
119
|
+
return !_.disablePointerDismissal();
|
|
120
|
+
},
|
|
121
|
+
get initialFocus() {
|
|
122
|
+
return M();
|
|
123
|
+
},
|
|
124
|
+
get returnFocus() {
|
|
125
|
+
return v.finalFocus;
|
|
126
|
+
},
|
|
127
|
+
get modal() {
|
|
128
|
+
return _.modal() !== !1;
|
|
129
|
+
},
|
|
130
|
+
restoreFocus: "popup",
|
|
131
|
+
get openInteractionType() {
|
|
132
|
+
return _.store.openMethod();
|
|
133
|
+
},
|
|
134
|
+
children: F
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
export { w as n, D as t };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { t as e } from "./useRender-CxZ8PI-g.js";
|
|
2
|
+
import { getStateAttributesProps as t } from "./internals/getStateAttributesProps.js";
|
|
3
|
+
import { w as n } from "./reasons-Co5CzjKq.js";
|
|
4
|
+
import { n as r, t as i } from "./resolveStyle-XcgAuaKR.js";
|
|
5
|
+
import { createChangeEventDetails as a } from "./internals/createBaseUIEventDetails.js";
|
|
6
|
+
import { composeEventHandlers as o, liveEventHandler as s } from "./internals/composeEventHandlers.js";
|
|
7
|
+
import { fieldStateAttributesMapping as c } from "./internals/field-constants.js";
|
|
8
|
+
import { r as l } from "./FieldRootContext-D3fuVjs3.js";
|
|
9
|
+
import { n as u } from "./FormContext-CwLBtm_d.js";
|
|
10
|
+
import { r as d } from "./LabelableContext-CmQF-TX2.js";
|
|
11
|
+
import { t as f } from "./createLabelableId-DxJRwMUJ.js";
|
|
12
|
+
import { createComponent as p, getNextElement as ee, mergeProps as m, runHydrationEvents as h, spread as g, template as _ } from "@solidjs/web";
|
|
13
|
+
import { createEffect as v, createMemo as y, createSignal as b, createUniqueId as te, omit as x, onCleanup as ne, onSettled as S, untrack as C } from "solid-js";
|
|
14
|
+
//#region src/field/control/FieldControl.tsx
|
|
15
|
+
var w = /* @__PURE__ */ _("<input>");
|
|
16
|
+
function T(_) {
|
|
17
|
+
let T = l(!0), O = u(), k = d(), A = _, j = _, M = Symbol("FieldControl"), N = !1, P = C(() => A.value !== void 0), F = () => A.value == null ? void 0 : String(A.value), I = C(F), L, R = !1, z = k.defaultControlId, B = typeof z == "string" ? z : `base-ui-${te()}`, [V, H] = b(), U = x(j, "aria-describedby", "aria-labelledby", "render", "autofocus", "class", "defaultValue", "disabled", "id", "name", "onBlur", "onFocus", "onInput", "onKeyDown", "onValueChange", "ref", "style", "value"), W = f(() => A.id, B), G = y(() => T.disabled() || (A.disabled ?? !1)), K = y(() => T.name() ?? A.name), q = y(() => ({
|
|
18
|
+
...T.state(),
|
|
19
|
+
disabled: G()
|
|
20
|
+
})), J = y(() => r(_.class, q())), Y = e(_, () => q(), (e) => (() => {
|
|
21
|
+
var t = ee(w);
|
|
22
|
+
return g(t, e, !1), h(), t;
|
|
23
|
+
})()), X = y(() => i(_.style, q())), Z = y(() => t(q(), c)), Q = () => {
|
|
24
|
+
if (A.value !== void 0) return F();
|
|
25
|
+
let e = V();
|
|
26
|
+
return E(e) ? e.value : A.defaultValue;
|
|
27
|
+
}, $ = {
|
|
28
|
+
id: B,
|
|
29
|
+
name: void 0,
|
|
30
|
+
value: Q,
|
|
31
|
+
getValue: () => {
|
|
32
|
+
let e = V();
|
|
33
|
+
return E(e) ? e.value : Q();
|
|
34
|
+
},
|
|
35
|
+
getControl: () => V() ?? null
|
|
36
|
+
}, re = o(s(() => A.onInput)), ie = o(s(() => A.onFocus)), ae = o(s(() => A.onBlur)), oe = o(s(() => A.onKeyDown));
|
|
37
|
+
function se(e) {
|
|
38
|
+
if (H(e), N || !E(e)) return;
|
|
39
|
+
N = !0;
|
|
40
|
+
let t = C(() => A.defaultValue);
|
|
41
|
+
if (C(() => A.value) === void 0 && t !== void 0 && !Array.isArray(t)) {
|
|
42
|
+
let n = String(t);
|
|
43
|
+
"defaultValue" in e && (e.defaultValue = n), e.value = n;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function ce(e) {
|
|
47
|
+
if (re.call(e.currentTarget, e), e.baseUIHandlerPrevented) return;
|
|
48
|
+
let t = D(e.currentTarget), r = a(n, e);
|
|
49
|
+
if (A.onValueChange?.(t, r), P) {
|
|
50
|
+
let t = e.currentTarget;
|
|
51
|
+
queueMicrotask(() => {
|
|
52
|
+
!R && E(t) && (t.value = F() ?? "");
|
|
53
|
+
});
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
T.setDirty(t !== (T.validityData().initialValue ?? "")), T.setFilled(t !== ""), !e.defaultPrevented && !r.isCanceled && (O.clearError(K()), T.validation.change(t));
|
|
57
|
+
}
|
|
58
|
+
function le(e) {
|
|
59
|
+
ie.call(e.currentTarget, e), !e.baseUIHandlerPrevented && T.setFocused(!0);
|
|
60
|
+
}
|
|
61
|
+
function ue(e) {
|
|
62
|
+
if (ae.call(e.currentTarget, e), !e.baseUIHandlerPrevented && (T.setTouched(!0), T.setFocused(!1), T.validationMode() === "onBlur")) {
|
|
63
|
+
let t = D(e.currentTarget);
|
|
64
|
+
T.validation.commit(t), P && queueMicrotask(() => {
|
|
65
|
+
if (R) return;
|
|
66
|
+
let e = F();
|
|
67
|
+
e !== void 0 && e !== t && e !== (T.validityData().initialValue ?? "") && T.validation.commit(e);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function de(e) {
|
|
72
|
+
if (oe.call(e.currentTarget, e), !e.baseUIHandlerPrevented && e.currentTarget.tagName === "INPUT" && e.key === "Enter") {
|
|
73
|
+
T.setTouched(!0);
|
|
74
|
+
let t = e.currentTarget;
|
|
75
|
+
if (t.form && t.form === O.formElement() && !e.defaultPrevented) {
|
|
76
|
+
let e = O.submitCount();
|
|
77
|
+
clearTimeout(L), L = setTimeout(() => {
|
|
78
|
+
O.submitCount() === e && T.validation.commit(t.value);
|
|
79
|
+
}, 0);
|
|
80
|
+
} else T.validation.commit(t.value);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return v(() => ({
|
|
84
|
+
id: W(),
|
|
85
|
+
name: A.name,
|
|
86
|
+
disabled: G(),
|
|
87
|
+
element: V()
|
|
88
|
+
}), (e) => {
|
|
89
|
+
$.id = e.id, $.name = e.name, T.registerFieldControl(M, e.disabled || !e.element ? void 0 : $);
|
|
90
|
+
}), v(() => V(), (e) => {
|
|
91
|
+
if (E(e)) return T.validation.registerInput(M, e, () => C(() => V() ?? null));
|
|
92
|
+
}), v(F, (e) => C(() => {
|
|
93
|
+
e !== void 0 && (T.setFilled(e !== ""), e !== I && (I = e, O.clearError(K()), T.setDirty(e !== (T.validityData().initialValue ?? "")), T.validation.change(e)));
|
|
94
|
+
})), S(() => {
|
|
95
|
+
let e = V();
|
|
96
|
+
E(e) && T.setFilled(e.value !== ""), A.autofocus && e?.ownerDocument.activeElement === e && T.setFocused(!0);
|
|
97
|
+
}), ne(() => {
|
|
98
|
+
R = !0, clearTimeout(L), T.registerFieldControl(M, void 0);
|
|
99
|
+
}), p(Y, m({
|
|
100
|
+
ref: [se, A.ref],
|
|
101
|
+
get id() {
|
|
102
|
+
return W();
|
|
103
|
+
},
|
|
104
|
+
get class() {
|
|
105
|
+
return J();
|
|
106
|
+
},
|
|
107
|
+
get style() {
|
|
108
|
+
return X();
|
|
109
|
+
},
|
|
110
|
+
get name() {
|
|
111
|
+
return K();
|
|
112
|
+
},
|
|
113
|
+
get disabled() {
|
|
114
|
+
return G();
|
|
115
|
+
}
|
|
116
|
+
}, () => A.value === void 0 ? { defaultValue: A.defaultValue } : { value: A.value }, {
|
|
117
|
+
get autofocus() {
|
|
118
|
+
return A.autofocus;
|
|
119
|
+
},
|
|
120
|
+
get "aria-labelledby"() {
|
|
121
|
+
return A["aria-labelledby"] ?? k.labelId();
|
|
122
|
+
},
|
|
123
|
+
get "aria-describedby"() {
|
|
124
|
+
return k.getAriaDescribedBy(A["aria-describedby"]);
|
|
125
|
+
},
|
|
126
|
+
get "aria-invalid"() {
|
|
127
|
+
return q().valid === !1 && !G() ? "true" : void 0;
|
|
128
|
+
},
|
|
129
|
+
onInput: ce,
|
|
130
|
+
onFocus: le,
|
|
131
|
+
onBlur: ue,
|
|
132
|
+
onKeyDown: de
|
|
133
|
+
}, Z, U));
|
|
134
|
+
}
|
|
135
|
+
function E(e) {
|
|
136
|
+
return !!(e && (e.tagName === "INPUT" || e.tagName === "SELECT" || e.tagName === "TEXTAREA"));
|
|
137
|
+
}
|
|
138
|
+
function D(e) {
|
|
139
|
+
return "value" in e ? String(e.value) : "";
|
|
140
|
+
}
|
|
141
|
+
//#endregion
|
|
142
|
+
export { T as t };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { u as e } from "./reasons-Co5CzjKq.js";
|
|
2
2
|
import { createChangeEventDetails as t } from "./internals/createBaseUIEventDetails.js";
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { c as
|
|
6
|
-
import { applyRef as ee, createComponent as
|
|
3
|
+
import { a as n, d as r, f as i, i as a, l as o, m as s, n as c, p as l, r as u, s as d, t as f } from "./dom-lDdayFF_.js";
|
|
4
|
+
import { a as p, o as m } from "./FloatingTree-23B7KKPD.js";
|
|
5
|
+
import { c as h, g, h as _, l as v, m as y, p as b, s as x, u as S } from "./popupStateMapping-nhukB8NK.js";
|
|
6
|
+
import { applyRef as ee, createComponent as C, memo as te } from "@solidjs/web";
|
|
7
7
|
import { Show as w, createEffect as T, createMemo as E, untrack as D } from "solid-js";
|
|
8
8
|
//#region src/internals/overlay/markOthers.ts
|
|
9
9
|
var O = {
|
|
@@ -14,7 +14,7 @@ var O = {
|
|
|
14
14
|
"aria-hidden": /* @__PURE__ */ new WeakSet()
|
|
15
15
|
}, A = /* @__PURE__ */ new WeakMap(), j = 0;
|
|
16
16
|
function M(e) {
|
|
17
|
-
return e ?
|
|
17
|
+
return e ? r(e) ? e.host : M(e.parentNode) : null;
|
|
18
18
|
}
|
|
19
19
|
function N(e, t) {
|
|
20
20
|
return t.map((t) => {
|
|
@@ -39,7 +39,7 @@ function F(e, t, n) {
|
|
|
39
39
|
return i(e), r;
|
|
40
40
|
}
|
|
41
41
|
function I(e, t = {}) {
|
|
42
|
-
let { ariaHidden: n = !1, inert: r = !1, mark: i = !0 } = t, a =
|
|
42
|
+
let { ariaHidden: n = !1, inert: r = !1, mark: i = !0 } = t, a = s(e[0]).body, o = N(a, e), c = i ? F(a, P(o), new Set(o)) : [], l = [], u = [], d = r ? "inert" : n ? "aria-hidden" : null;
|
|
43
43
|
if (d) {
|
|
44
44
|
let e = N(a, Array.from(a.querySelectorAll("[aria-live]"))), t = o.concat(e);
|
|
45
45
|
F(a, P(t), new Set(t)).forEach((e) => {
|
|
@@ -47,7 +47,7 @@ function I(e, t = {}) {
|
|
|
47
47
|
O[d].set(e, r), u.push(e), r === 1 && n && k[d].add(e), n || e.setAttribute(d, d === "inert" ? "" : "true");
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
c.forEach((e) => {
|
|
51
51
|
let t = (A.get(e) ?? 0) + 1;
|
|
52
52
|
A.set(e, t), l.push(e), t === 1 && e.setAttribute("data-base-ui-inert", "");
|
|
53
53
|
}), j += 1;
|
|
@@ -83,24 +83,24 @@ function H() {
|
|
|
83
83
|
function U(e) {
|
|
84
84
|
return typeof e == "function" ? e() : e ?? null;
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
return e ?
|
|
86
|
+
function ne(e) {
|
|
87
|
+
return e ? y(e) ? e : _(e)[0] ?? e : null;
|
|
88
88
|
}
|
|
89
89
|
function W(e) {
|
|
90
90
|
if (e.hasAttribute("tabindex") && !e.hasAttribute("data-tabindex") || !e.getAttribute("role")?.includes("dialog")) return;
|
|
91
|
-
let t =
|
|
91
|
+
let t = h(e).some((e) => {
|
|
92
92
|
let t = e.getAttribute("data-tabindex") || "";
|
|
93
|
-
return
|
|
93
|
+
return y(e) || e.hasAttribute("data-tabindex") && !t.startsWith("-");
|
|
94
94
|
}) ? "-1" : "0";
|
|
95
95
|
(e.getAttribute("tabindex") !== t || e.getAttribute("data-tabindex") !== t) && (e.setAttribute("tabindex", t), e.setAttribute("data-tabindex", t));
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function re(e, t) {
|
|
98
98
|
return e.type === "keydown" || e.type === "keyup" ? "keyboard" : e.type === "focus" || e.type === "focusin" || e.type === "focusout" || e.type === "blur" ? t || "keyboard" : "pointerType" in e ? e.pointerType || "keyboard" : "touches" in e ? "touch" : e.type.includes("mouse") || e.type === "click" ? t || (e.detail === 0 ? "keyboard" : "mouse") : "";
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function ie(e) {
|
|
101
101
|
return e.detail === 0 && !e.pointerType;
|
|
102
102
|
}
|
|
103
|
-
function
|
|
103
|
+
function ae(e) {
|
|
104
104
|
return e.width === 0 && e.height === 0;
|
|
105
105
|
}
|
|
106
106
|
function G(e, t = {}) {
|
|
@@ -112,16 +112,16 @@ function G(e, t = {}) {
|
|
|
112
112
|
z === n && (cancelAnimationFrame(n), z = 0);
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
function K(
|
|
116
|
-
let
|
|
115
|
+
function K(r) {
|
|
116
|
+
let h = x(), O = !1, k = !1, A = null, j = "", M = "", N, P = 0, F = () => r.context.track().open, L = () => r.referenceElement?.() ?? r.context.track().domReferenceElement, R = () => r.context.track().floatingElement, z = E(() => n(R())), B = () => r.disabled ?? !1, K = () => r.modal ?? !0, J = () => r.closeOnFocusOut ?? !0, Y = () => r.getInsideElements?.().filter((e) => e != null) ?? [], X = () => i(L()) && r.initialFocus === !1, Z = (e = z()) => e ? _(e) : [], Q = () => r.context.context.nodeId;
|
|
117
117
|
T(() => ({
|
|
118
118
|
disabled: B(),
|
|
119
119
|
modal: K(),
|
|
120
120
|
focusElement: z()
|
|
121
121
|
}), (e) => {
|
|
122
122
|
if (e.disabled || !e.modal || !e.focusElement) return;
|
|
123
|
-
let t =
|
|
124
|
-
n.key === "Tab" &&
|
|
123
|
+
let t = s(e.focusElement), n = (n) => {
|
|
124
|
+
n.key === "Tab" && c(e.focusElement, f(t)) && Z().length === 0 && !X() && (n.preventDefault(), n.stopPropagation());
|
|
125
125
|
};
|
|
126
126
|
return t.addEventListener("keydown", n), () => t.removeEventListener("keydown", n);
|
|
127
127
|
}), T(() => ({
|
|
@@ -130,8 +130,8 @@ function K(d) {
|
|
|
130
130
|
focusElement: z()
|
|
131
131
|
}), (e) => {
|
|
132
132
|
if (e.disabled || !e.open || !e.focusElement) return;
|
|
133
|
-
let t =
|
|
134
|
-
let t =
|
|
133
|
+
let t = s(e.focusElement), n = (e) => {
|
|
134
|
+
let t = a(e);
|
|
135
135
|
M = e.pointerType || "keyboard", t?.closest("[data-base-ui-click-trigger]") && (k = !0, clearTimeout(N), N = setTimeout(() => {
|
|
136
136
|
k = !1;
|
|
137
137
|
}));
|
|
@@ -148,29 +148,29 @@ function K(d) {
|
|
|
148
148
|
floating: R(),
|
|
149
149
|
focusElement: z(),
|
|
150
150
|
modal: K(),
|
|
151
|
-
restoreFocus:
|
|
152
|
-
tree:
|
|
151
|
+
restoreFocus: r.restoreFocus,
|
|
152
|
+
tree: r.tree
|
|
153
153
|
}), (n) => {
|
|
154
154
|
if (n.disabled || !n.closeOnFocusOut || !n.reference && !n.floating) return;
|
|
155
|
-
let
|
|
155
|
+
let i = s(n.focusElement), o = () => {
|
|
156
156
|
k = !0, clearTimeout(N), N = setTimeout(() => {
|
|
157
157
|
k = !1;
|
|
158
158
|
});
|
|
159
|
-
},
|
|
160
|
-
let t =
|
|
161
|
-
|
|
162
|
-
},
|
|
163
|
-
let
|
|
164
|
-
n.modal && !
|
|
165
|
-
let
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
U(
|
|
171
|
-
U(
|
|
172
|
-
].includes(
|
|
173
|
-
if (
|
|
159
|
+
}, l = (e) => {
|
|
160
|
+
let t = a(e);
|
|
161
|
+
y(t) && (A = t);
|
|
162
|
+
}, g = (o) => {
|
|
163
|
+
let s = o.relatedTarget, l = a(o);
|
|
164
|
+
n.modal && !s && l && c(n.floating, l) && V(l), queueMicrotask(() => {
|
|
165
|
+
let a = !!(s?.hasAttribute("data-base-ui-focus-guard") && [
|
|
166
|
+
h?.beforeInside(),
|
|
167
|
+
h?.afterInside(),
|
|
168
|
+
h?.beforeOutside(),
|
|
169
|
+
h?.afterOutside(),
|
|
170
|
+
U(r.previousFocusableElement),
|
|
171
|
+
U(r.nextFocusableElement)
|
|
172
|
+
].includes(s)), g = r.context.context.triggerElements, _ = !(u(n.reference, s) || u(n.floating, s) || c(s, n.floating) || c(h?.portalNode(), s) || Y().some((e) => e === s || c(e, s)) || g.hasMatchingElement((e) => c(e, s)) || a || n.tree && (m(n.tree.nodes, Q()).some((e) => u(e.context?.state.floatingElement, s) || u(e.context?.state.domReferenceElement, s)) || p(n.tree.nodes, Q()).some((e) => e.context?.state.floatingElement === s || e.context?.state.domReferenceElement === s)));
|
|
173
|
+
if (o.currentTarget === n.reference && n.focusElement && W(n.focusElement), n.restoreFocus && o.currentTarget !== n.reference && !d(l) && f(i) === i.body && n.focusElement) {
|
|
174
174
|
if (n.focusElement.focus(), n.restoreFocus === "popup") {
|
|
175
175
|
cancelAnimationFrame(P), P = requestAnimationFrame(() => n.focusElement?.focus());
|
|
176
176
|
return;
|
|
@@ -178,11 +178,14 @@ function K(d) {
|
|
|
178
178
|
let e = Z();
|
|
179
179
|
((A && e.includes(A) ? A : null) ?? e[e.length - 1] ?? n.focusElement).focus();
|
|
180
180
|
}
|
|
181
|
-
(X() || !n.modal) &&
|
|
181
|
+
(X() || !n.modal) && s && _ && !k && (X() || s !== H()) && (O = !0, r.context.setOpen(!1, t(e, o)));
|
|
182
182
|
});
|
|
183
|
+
}, _ = (e) => {
|
|
184
|
+
let t = a(e);
|
|
185
|
+
!c(n.floating, t) && !c(n.reference, t) && (u(n.floating, t) || u(n.reference, t)) && g(e);
|
|
183
186
|
};
|
|
184
|
-
return n.reference && (n.reference.addEventListener("focusout",
|
|
185
|
-
n.reference && (n.reference.removeEventListener("focusout",
|
|
187
|
+
return i.addEventListener("focusout", _), n.reference && (n.reference.addEventListener("focusout", g), n.reference.addEventListener("pointerdown", o)), n.floating?.addEventListener("focusin", l), n.floating?.addEventListener("focusout", g), () => {
|
|
188
|
+
i.removeEventListener("focusout", _), n.reference && (n.reference.removeEventListener("focusout", g), n.reference.removeEventListener("pointerdown", o)), n.floating?.removeEventListener("focusin", l), n.floating?.removeEventListener("focusout", g);
|
|
186
189
|
};
|
|
187
190
|
}), T(() => ({
|
|
188
191
|
disabled: B(),
|
|
@@ -190,20 +193,20 @@ function K(d) {
|
|
|
190
193
|
floating: R(),
|
|
191
194
|
modal: K(),
|
|
192
195
|
untrapped: X(),
|
|
193
|
-
tree:
|
|
196
|
+
tree: r.tree,
|
|
194
197
|
nodeId: Q(),
|
|
195
|
-
portalNode:
|
|
196
|
-
beforeInside:
|
|
197
|
-
afterInside:
|
|
198
|
-
beforeOutside:
|
|
199
|
-
afterOutside:
|
|
198
|
+
portalNode: h?.portalNode(),
|
|
199
|
+
beforeInside: h?.beforeInside(),
|
|
200
|
+
afterInside: h?.afterInside(),
|
|
201
|
+
beforeOutside: h?.beforeOutside(),
|
|
202
|
+
afterOutside: h?.afterOutside(),
|
|
200
203
|
insideElements: Y(),
|
|
201
204
|
domReference: L(),
|
|
202
|
-
previous: U(
|
|
203
|
-
next: U(
|
|
205
|
+
previous: U(r.previousFocusableElement),
|
|
206
|
+
next: U(r.nextFocusableElement)
|
|
204
207
|
}), (e) => {
|
|
205
208
|
if (e.disabled || !e.open || !e.floating) return;
|
|
206
|
-
let t = Array.from(e.portalNode?.querySelectorAll("[data-base-ui-portal]") ?? []), n = (e.tree ?
|
|
209
|
+
let t = Array.from(e.portalNode?.querySelectorAll("[data-base-ui-portal]") ?? []), n = (e.tree ? p(e.tree.nodes, e.nodeId) : []).find((e) => i(e.context?.state.domReferenceElement ?? null))?.context?.state.domReferenceElement, r = I([
|
|
207
210
|
...[
|
|
208
211
|
e.portalNode,
|
|
209
212
|
e.floating,
|
|
@@ -227,43 +230,43 @@ function K(d) {
|
|
|
227
230
|
...t
|
|
228
231
|
].filter((e) => e != null));
|
|
229
232
|
return () => {
|
|
230
|
-
a(),
|
|
233
|
+
a(), r();
|
|
231
234
|
};
|
|
232
235
|
}), T(() => ({
|
|
233
236
|
open: F(),
|
|
234
237
|
disabled: B(),
|
|
235
238
|
focusElement: z(),
|
|
236
|
-
initialFocus:
|
|
237
|
-
interactionType:
|
|
239
|
+
initialFocus: r.initialFocus ?? !0,
|
|
240
|
+
interactionType: r.openInteractionType ?? ""
|
|
238
241
|
}), (e) => {
|
|
239
242
|
if (!e.open || e.disabled || !e.focusElement) return;
|
|
240
243
|
j = "", M = "";
|
|
241
|
-
let t =
|
|
244
|
+
let t = s(e.focusElement), n = f(t), i = () => {};
|
|
242
245
|
return queueMicrotask(() => {
|
|
243
|
-
let
|
|
244
|
-
if (s === void 0 || s === !1 ||
|
|
245
|
-
let
|
|
246
|
-
|
|
247
|
-
preventScroll:
|
|
246
|
+
let a = e.initialFocus, o = typeof a == "function" ? a(e.interactionType) : a, s = q(o) ? o.current : o;
|
|
247
|
+
if (s === void 0 || s === !1 || c(e.focusElement, n)) return;
|
|
248
|
+
let l = () => Z(e.focusElement)[0] ?? e.focusElement, u = (s === !0 || s === null ? l() : s) ?? l(), d = c(e.focusElement, f(t));
|
|
249
|
+
i = G(u, {
|
|
250
|
+
preventScroll: u === e.focusElement,
|
|
248
251
|
shouldFocus: () => {
|
|
249
|
-
if (!
|
|
250
|
-
if (
|
|
251
|
-
let n =
|
|
252
|
-
return n ===
|
|
252
|
+
if (!r.context.state.open) return !1;
|
|
253
|
+
if (d) return !0;
|
|
254
|
+
let n = f(t);
|
|
255
|
+
return n === u || !c(e.focusElement, n);
|
|
253
256
|
}
|
|
254
257
|
});
|
|
255
|
-
}), () =>
|
|
258
|
+
}), () => i();
|
|
256
259
|
}), T(() => ({
|
|
257
260
|
disabled: B(),
|
|
258
261
|
focusElement: z(),
|
|
259
|
-
interactionType:
|
|
262
|
+
interactionType: r.openInteractionType
|
|
260
263
|
}), (e) => {
|
|
261
264
|
if (e.disabled || !e.focusElement) return;
|
|
262
|
-
let t =
|
|
263
|
-
V(
|
|
264
|
-
let a =
|
|
265
|
-
if (e.open || (j =
|
|
266
|
-
if (e.nested || e.nativeEvent.type === "click" &&
|
|
265
|
+
let t = s(e.focusElement), n = f(t), i = e.interactionType === null;
|
|
266
|
+
V(n);
|
|
267
|
+
let a = r.context.context.events.on("openchange", (e) => {
|
|
268
|
+
if (e.open || (j = re(e.nativeEvent, M)), e.reason === "trigger-hover" && e.nativeEvent.type === "mouseleave" && (O = !0), e.reason === "outside-press") {
|
|
269
|
+
if (e.nested || e.nativeEvent.type === "click" && ie(e.nativeEvent) || "pointerType" in e.nativeEvent && ae(e.nativeEvent)) O = !1;
|
|
267
270
|
else {
|
|
268
271
|
let e = !1;
|
|
269
272
|
t.createElement("div").focus({ get preventScroll() {
|
|
@@ -274,11 +277,11 @@ function K(d) {
|
|
|
274
277
|
});
|
|
275
278
|
return () => {
|
|
276
279
|
a();
|
|
277
|
-
let e =
|
|
280
|
+
let e = f(t), s = r.context.state.floatingElement, l = D(Y), u = D(() => r.tree), d = c(s, e) || l.some((t) => t === e || c(t, e)) || !!(u && m(u.nodes, r.context.context.nodeId, !1).some((t) => c(t.context?.state.floatingElement, e))), p = D(() => r.returnFocus) ?? !0, h = typeof p == "function" ? p(j) : p, g = q(h) ? h.current : h;
|
|
278
281
|
if (g === void 0 || g === !1) return;
|
|
279
|
-
let _ =
|
|
282
|
+
let _ = r.context.state.domReferenceElement, v = _?.isConnected ? _ : null, y = n?.isConnected && n.localName !== "body" ? n : null, b = (i ? y ?? v : v ?? y) ?? H() ?? null, x = ne(g === !0 || g === null ? b : g);
|
|
280
283
|
queueMicrotask(() => {
|
|
281
|
-
if (!O &&
|
|
284
|
+
if (!O && o(x) && (x === e || e === t.body || d || typeof p != "boolean")) {
|
|
282
285
|
let e = { preventScroll: !0 };
|
|
283
286
|
j === "keyboard" && (e.focusVisible = !0), x.focus(e);
|
|
284
287
|
}
|
|
@@ -291,11 +294,11 @@ function K(d) {
|
|
|
291
294
|
floating: R()
|
|
292
295
|
}), (e) => {
|
|
293
296
|
if (e.disabled || e.open || !e.floating) return;
|
|
294
|
-
let t =
|
|
295
|
-
|
|
297
|
+
let t = f(s(e.floating));
|
|
298
|
+
l(t) && c(e.floating, t) && t.blur();
|
|
296
299
|
}), T(() => ({
|
|
297
300
|
disabled: B(),
|
|
298
|
-
portal:
|
|
301
|
+
portal: h,
|
|
299
302
|
modal: K(),
|
|
300
303
|
open: F(),
|
|
301
304
|
closeOnFocusOut: J(),
|
|
@@ -306,7 +309,7 @@ function K(d) {
|
|
|
306
309
|
open: e.open,
|
|
307
310
|
closeOnFocusOut: e.closeOnFocusOut,
|
|
308
311
|
domReference: e.reference,
|
|
309
|
-
onOpenChange: (e, t) =>
|
|
312
|
+
onOpenChange: (e, t) => r.context.setOpen(e, t)
|
|
310
313
|
}), () => e.portal?.setFocusManagerState(null);
|
|
311
314
|
}), T(() => ({
|
|
312
315
|
disabled: B(),
|
|
@@ -314,39 +317,39 @@ function K(d) {
|
|
|
314
317
|
}), (e) => {
|
|
315
318
|
!e.disabled && e.focusElement && W(e.focusElement);
|
|
316
319
|
});
|
|
317
|
-
let $ = E(() => !B() && (!K() || !X()) && !!(
|
|
320
|
+
let $ = E(() => !B() && (!K() || !X()) && !!(h || K()));
|
|
318
321
|
return [
|
|
319
|
-
|
|
322
|
+
C(w, {
|
|
320
323
|
get when() {
|
|
321
324
|
return $();
|
|
322
325
|
},
|
|
323
326
|
get children() {
|
|
324
|
-
return
|
|
327
|
+
return C(g, {
|
|
325
328
|
"data-type": "inside",
|
|
326
|
-
ref: [
|
|
329
|
+
ref: [h?.setBeforeInside, r.beforeContentGuardRef],
|
|
327
330
|
onFocus: (e) => {
|
|
328
331
|
if (K()) {
|
|
329
332
|
let e = Z();
|
|
330
333
|
G(e[e.length - 1]);
|
|
331
|
-
} else
|
|
334
|
+
} else h?.portalNode() && (O = !1, b(e, h.portalNode()) ? v(L())?.focus() : (U(r.previousFocusableElement) ?? h.beforeOutside())?.focus());
|
|
332
335
|
}
|
|
333
336
|
});
|
|
334
337
|
}
|
|
335
338
|
}),
|
|
336
|
-
|
|
337
|
-
|
|
339
|
+
te(() => r.children),
|
|
340
|
+
C(w, {
|
|
338
341
|
get when() {
|
|
339
342
|
return $();
|
|
340
343
|
},
|
|
341
344
|
get children() {
|
|
342
|
-
return
|
|
345
|
+
return C(g, {
|
|
343
346
|
"data-type": "inside",
|
|
344
347
|
ref(e) {
|
|
345
|
-
var t =
|
|
346
|
-
typeof t == "function" || Array.isArray(t) ? ee(t, e) :
|
|
348
|
+
var t = h?.setAfterInside;
|
|
349
|
+
typeof t == "function" || Array.isArray(t) ? ee(t, e) : h && (h.setAfterInside = e);
|
|
347
350
|
},
|
|
348
351
|
onFocus: (e) => {
|
|
349
|
-
K() ? G(Z()[0]) :
|
|
352
|
+
K() ? G(Z()[0]) : h?.portalNode() && (J() && (O = !0), b(e, h.portalNode()) ? S(L())?.focus() : (U(r.nextFocusableElement) ?? h.afterOutside())?.focus());
|
|
350
353
|
}
|
|
351
354
|
});
|
|
352
355
|
}
|
|
@@ -354,7 +357,7 @@ function K(d) {
|
|
|
354
357
|
];
|
|
355
358
|
}
|
|
356
359
|
function q(e) {
|
|
357
|
-
return !!(e && typeof e == "object" && !
|
|
360
|
+
return !!(e && typeof e == "object" && !o(e) && "current" in e);
|
|
358
361
|
}
|
|
359
362
|
//#endregion
|
|
360
363
|
export { K as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as e, m as t } from "./dom-lDdayFF_.js";
|
|
2
2
|
import { getNextElement as n, mergeProps as r, ref as i, runHydrationEvents as a, spread as o, template as s } from "@solidjs/web";
|
|
3
3
|
import { createEffect as c, createSignal as l, omit as u } from "solid-js";
|
|
4
4
|
//#region src/internals/overlay/scrollLock.ts
|