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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.2
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- `composeEventHandlers` now accepts direct handlers, bound `[handler, data]`
|
|
8
|
+
tuples, and `undefined`, rather than bare accessors returning handlers. Replace
|
|
9
|
+
`composeEventHandlers(() => handleClick)` with `composeEventHandlers(handleClick)`.
|
|
10
|
+
- For replaceable props or conditional handler sources, use
|
|
11
|
+
`composeEventHandlers(liveEventHandler(() => props.onClick), handleClick)`.
|
|
12
|
+
Both utilities are exported from `solid-baseui/internals/composeEventHandlers`.
|
|
13
|
+
Old bare accessors may still typecheck as void-returning handlers, but their
|
|
14
|
+
returned functions are no longer invoked. Migrate every call before upgrading.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Preserve Drawer swipe state, observers, and nested progress across unrelated
|
|
19
|
+
store updates, and retain Popover trigger-handoff animation completion.
|
|
20
|
+
- Compose string and callback-returned string styles correctly in Slider.Track,
|
|
21
|
+
Slider.Indicator, Slider.Thumb, and Tabs.Indicator.
|
|
22
|
+
- Return a directly attachable native handler from `composeEventHandlers` while
|
|
23
|
+
exposing Base UI cancellation to composed callbacks. Preserve native input/focus
|
|
24
|
+
target typing and expose cancellation on composed Toolbar events.
|
|
25
|
+
- Preserve the DOM receiver when NumberField.Input dispatches blur callbacks,
|
|
26
|
+
including replaceable bound handlers and teardown-time blur.
|
|
27
|
+
- Correct Combobox grid navigation, highlight restoration, controlled input and
|
|
28
|
+
autofill rollback, popup-input ARIA, RTL End navigation, portal focus, and List
|
|
29
|
+
exit-animation completion.
|
|
30
|
+
- Preserve Tooltip cursor initialization and reopening, detached registration and
|
|
31
|
+
hydration state, viewport payload updates, nested timers, and provider cleanup.
|
|
32
|
+
- Preserve Autocomplete form-name ownership across SSR and hydration, and isolate
|
|
33
|
+
Field context when replacing a popup input.
|
|
34
|
+
- Cancel stale Drawer alignment frames before delayed virtual-keyboard realignment.
|
|
35
|
+
- Improve Combobox grouped-array callback inference for mutable single-select and
|
|
36
|
+
readonly multiple-select items.
|
|
37
|
+
|
|
38
|
+
### Verification
|
|
39
|
+
|
|
40
|
+
- Complete the requested Tooltip, Combobox, Autocomplete, and Drawer test-ledger
|
|
41
|
+
verification, including additional unit, browser, type, SSR, and hydration cases.
|
|
42
|
+
- The package remains an unstable alpha; this does not establish exhaustive Base UI
|
|
43
|
+
1.8 parity or physical-device keyboard and gesture behavior.
|
|
44
|
+
|
|
3
45
|
## 0.1.0-alpha.1
|
|
4
46
|
|
|
5
47
|
### Breaking Changes
|
package/README.md
CHANGED
|
@@ -123,25 +123,24 @@ callback writes native or custom-component JSX directly.
|
|
|
123
123
|
callback and forward props/ref to every possible final element, for example
|
|
124
124
|
`render={(props) => <>{compact() ? <span {...props} /> : <div {...props} />}</>}` on a
|
|
125
125
|
visual part that supports those roots.
|
|
126
|
-
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
- Put interaction handlers such as `onClick` on the outer Base UI component. It
|
|
127
|
+
composes caller handlers with its internal behavior. Use `render` for the
|
|
128
|
+
element, styling, and prop forwarding, not to override supplied event handlers.
|
|
129
|
+
Custom components used inside `render` should also forward those handlers to
|
|
130
|
+
the final DOM node.
|
|
131
|
+
- A spread does not compose an overridden ref or class. Preserve supplied values
|
|
132
|
+
with Solid ref/class arrays when adding your own.
|
|
130
133
|
|
|
131
134
|
```tsx
|
|
132
135
|
import { Button } from "solid-baseui/button";
|
|
133
|
-
import { composeEventHandlers } from "solid-baseui/internals/composeEventHandlers";
|
|
134
136
|
|
|
135
137
|
<Button
|
|
138
|
+
onClick={() => console.info("Save activated")}
|
|
136
139
|
render={(props) => (
|
|
137
140
|
<button
|
|
138
141
|
{...props}
|
|
139
142
|
class={[props.class, "action"]}
|
|
140
143
|
ref={[props.ref, (element) => { element.dataset.action = "save"; }]}
|
|
141
|
-
onClick={composeEventHandlers(
|
|
142
|
-
() => props.onClick,
|
|
143
|
-
() => () => console.info("Save activated"),
|
|
144
|
-
)}
|
|
145
144
|
/>
|
|
146
145
|
)}
|
|
147
146
|
>
|
|
@@ -149,9 +148,11 @@ import { composeEventHandlers } from "solid-baseui/internals/composeEventHandler
|
|
|
149
148
|
</Button>;
|
|
150
149
|
```
|
|
151
150
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
Avoid `render={(props) => <button {...props} onClick={handleClick} />}`:
|
|
152
|
+
the explicit handler replaces the supplied handler and can break the component's
|
|
153
|
+
internal interaction behavior. Moving the spread last can instead discard your
|
|
154
|
+
handler. Put `onClick={handleClick}` on the outer component so both behaviors are
|
|
155
|
+
preserved without manually composing handlers.
|
|
155
156
|
|
|
156
157
|
Component authors can import `useRender` from `solid-baseui/use-render` or the
|
|
157
158
|
package root. Its signature is
|
|
@@ -165,17 +166,47 @@ root, `solid-baseui/use-render`, and `solid-baseui/types`.
|
|
|
165
166
|
|
|
166
167
|
See [CHANGELOG.md](./CHANGELOG.md) for this alpha's changes.
|
|
167
168
|
|
|
169
|
+
## Migrating To 0.1.0-alpha.2
|
|
170
|
+
|
|
171
|
+
Version `0.1.0-alpha.2` changes the internal event-composition API to direct handlers:
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import type { JSX } from "@solidjs/web";
|
|
175
|
+
import { omit } from "solid-js";
|
|
176
|
+
import {
|
|
177
|
+
composeEventHandlers,
|
|
178
|
+
liveEventHandler,
|
|
179
|
+
} from "solid-baseui/internals/composeEventHandlers";
|
|
180
|
+
|
|
181
|
+
function CustomButton(props: JSX.ButtonHTMLAttributes<HTMLButtonElement>) {
|
|
182
|
+
const others = omit(props, "onClick");
|
|
183
|
+
const onClick = composeEventHandlers<HTMLButtonElement, MouseEvent>(
|
|
184
|
+
liveEventHandler(() => props.onClick),
|
|
185
|
+
(event) => event.preventBaseUIHandler(),
|
|
186
|
+
);
|
|
187
|
+
return <button type="button" onClick={onClick} {...others} />;
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Fixed handlers need no outer function. Use `liveEventHandler` only when a callback
|
|
192
|
+
prop or handler selection can change; it creates a deferred source for the composer,
|
|
193
|
+
not a standalone DOM handler. Sources resolve in order at event time, including
|
|
194
|
+
Solid's `[handler, data]` tuples. Base UI cancellation stops later handlers and
|
|
195
|
+
source resolution; native `preventDefault` has its separate meaning.
|
|
196
|
+
|
|
197
|
+
This is a breaking change from alpha.1. Bare `() => handler` arguments must be
|
|
198
|
+
converted to direct handlers or explicit live sources. Handler return values are
|
|
199
|
+
ignored, so an old accessor can still typecheck without doing the intended work.
|
|
200
|
+
|
|
168
201
|
## Status
|
|
169
202
|
|
|
170
|
-
|
|
171
|
-
|
|
203
|
+
All 38 component families in the pinned inventory are implemented and exported.
|
|
204
|
+
The requested Tooltip, Combobox, Autocomplete, and Drawer verification is complete;
|
|
205
|
+
the project is now in stabilization and performance optimization.
|
|
172
206
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
| Combobox, Autocomplete | In progress |
|
|
177
|
-
| Drawer | Behavior complete; parts of the upstream test ledger unclassified |
|
|
178
|
-
| Remaining families | Done |
|
|
207
|
+
Implementation coverage is not exhaustive Base UI 1.8 parity or production stability.
|
|
208
|
+
The optional `unstable-use-media-query` utility is not implemented and is outside
|
|
209
|
+
the 38-component scope.
|
|
179
210
|
|
|
180
211
|
A component is only treated as done when its upstream Base UI test ledger is
|
|
181
212
|
classified and represented in the Solid suite. Per-family status, the decisions
|
|
@@ -0,0 +1,521 @@
|
|
|
1
|
+
import { t as e } from "./useRender-CxZ8PI-g.js";
|
|
2
|
+
import { getStateAttributesProps as t } from "./internals/getStateAttributesProps.js";
|
|
3
|
+
import { P as n, d as r, i } from "./reasons-Co5CzjKq.js";
|
|
4
|
+
import { n as a, t as o } from "./resolveStyle-XcgAuaKR.js";
|
|
5
|
+
import { createChangeEventDetails as s } from "./internals/createBaseUIEventDetails.js";
|
|
6
|
+
import { transitionStatusMapping as c } from "./internals/stateAttributesMapping.js";
|
|
7
|
+
import { composeEventHandlers as l, liveEventHandler as u } from "./internals/composeEventHandlers.js";
|
|
8
|
+
import { i as d, n as f, o as p } from "./dom-lDdayFF_.js";
|
|
9
|
+
import { n as m, t as h } from "./InternalBackdrop-B8_lfUvf.js";
|
|
10
|
+
import { c as g, i as _, n as ee, r as v, s as y, t as b } from "./FloatingTree-23B7KKPD.js";
|
|
11
|
+
import { a as te, n as x, o as ne, t as S } from "./PopupStore-BjRwcvbG.js";
|
|
12
|
+
import { a as C, o as re } from "./popupStateMapping-nhukB8NK.js";
|
|
13
|
+
import { i as w, n as T, r as E, t as D } from "./PopupHandle-DyX5gY1e.js";
|
|
14
|
+
import { t as ie } from "./setRef-fXF6OIo3.js";
|
|
15
|
+
import { a as O, i as ae, n as k, r as A, t as oe } from "./buttonSemantics-paljfpOX.js";
|
|
16
|
+
import { createComponent as j, getNextElement as M, memo as N, mergeProps as P, runHydrationEvents as F, spread as I, template as L } from "@solidjs/web";
|
|
17
|
+
import { $REFRESH as se, Show as R, createContext as z, createEffect as B, createMemo as V, createSignal as H, createUniqueId as U, omit as W, onCleanup as G, untrack as K, useContext as q } from "solid-js";
|
|
18
|
+
//#region src/dialog/store/DialogStore.ts
|
|
19
|
+
var ce = class extends S {
|
|
20
|
+
openMethodAccessor;
|
|
21
|
+
setOpenMethodSignal;
|
|
22
|
+
openMethodRevisionAccessor;
|
|
23
|
+
setOpenMethodRevision;
|
|
24
|
+
constructor(e = {}) {
|
|
25
|
+
super(e);
|
|
26
|
+
let [t, n] = H(null, { ownedWrite: !0 });
|
|
27
|
+
this.openMethodAccessor = t, this.setOpenMethodSignal = n;
|
|
28
|
+
let [r, i] = H(0, { ownedWrite: !0 });
|
|
29
|
+
this.openMethodRevisionAccessor = r, this.setOpenMethodRevision = i;
|
|
30
|
+
}
|
|
31
|
+
openMethod() {
|
|
32
|
+
return this.openMethodAccessor();
|
|
33
|
+
}
|
|
34
|
+
setOpenMethod(e) {
|
|
35
|
+
this.setOpenMethodSignal(e), this.setOpenMethodRevision((e) => e + 1);
|
|
36
|
+
}
|
|
37
|
+
openMethodRevision() {
|
|
38
|
+
return this.openMethodRevisionAccessor();
|
|
39
|
+
}
|
|
40
|
+
setPayload(e) {
|
|
41
|
+
this.set("payload", e);
|
|
42
|
+
}
|
|
43
|
+
setOpen(e, t) {
|
|
44
|
+
return !e && t.trigger == null && this.activeTriggerId() != null && (t.trigger = this.state.activeTriggerElement ?? void 0), super.setOpen(e, t);
|
|
45
|
+
}
|
|
46
|
+
}, J = class extends T {
|
|
47
|
+
openMethod() {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
setOpenMethod(e) {}
|
|
51
|
+
setPayload(e) {}
|
|
52
|
+
}, Y = Symbol("DialogRootContext"), le = z(Y);
|
|
53
|
+
function X(e = !1) {
|
|
54
|
+
let t = q(le);
|
|
55
|
+
if (t === Y) {
|
|
56
|
+
if (e) return;
|
|
57
|
+
throw Error("Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.");
|
|
58
|
+
}
|
|
59
|
+
return t;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region src/dialog/root/DialogRoot.tsx
|
|
63
|
+
function ue(e) {
|
|
64
|
+
return Z("dialog", e);
|
|
65
|
+
}
|
|
66
|
+
function Z(e, t, n = {}) {
|
|
67
|
+
let i = X(!0), a = g(), o = y(), c = a ?? new v(), l = U(), u = U(), h = K(() => t.open !== void 0), x = K(() => t.triggerId !== void 0), S = i !== void 0, C = e === "alert-dialog", re = e === "drawer", w = V(() => C ? !0 : t.modal ?? !0), T = V(() => C || (t.disablePointerDismissal ?? !1)), D = new ce({
|
|
68
|
+
controlledOpen: () => h ? t.open : void 0,
|
|
69
|
+
controlledTriggerId: () => x ? t.triggerId : void 0,
|
|
70
|
+
floatingId: u,
|
|
71
|
+
nested: o !== null,
|
|
72
|
+
nodeId: l,
|
|
73
|
+
onOpenChange: () => t.onOpenChange,
|
|
74
|
+
onOpenChangeComplete: () => t.onOpenChangeComplete
|
|
75
|
+
});
|
|
76
|
+
D.update({
|
|
77
|
+
open: h ? !!K(() => t.open) : !!K(() => t.defaultOpen),
|
|
78
|
+
activeTriggerId: K(() => t.defaultTriggerId ?? null)
|
|
79
|
+
});
|
|
80
|
+
let ie = D.access((e) => e.payload), O = _({
|
|
81
|
+
tree: c,
|
|
82
|
+
id: l,
|
|
83
|
+
parentId: o,
|
|
84
|
+
context: () => D.context.floatingRoot
|
|
85
|
+
}), [ae, k] = H(), [A, oe] = H(), [M, P] = H(null, { ownedWrite: !0 }), [F, I] = H(null, { ownedWrite: !0 }), [L, R] = H(null, { ownedWrite: !0 }), [z, W] = H(0, {
|
|
86
|
+
equals: !1,
|
|
87
|
+
ownedWrite: !0
|
|
88
|
+
}), q = /* @__PURE__ */ new Map(), J = V(() => {
|
|
89
|
+
z();
|
|
90
|
+
let e = 0;
|
|
91
|
+
for (let t of q.values()) e += t.dialogCount;
|
|
92
|
+
return e;
|
|
93
|
+
}), Y = V(() => {
|
|
94
|
+
z();
|
|
95
|
+
let e = 0;
|
|
96
|
+
for (let t of q.values()) e += t.drawerCount;
|
|
97
|
+
return e;
|
|
98
|
+
}), ue = { current: !0 }, Z = te(D, () => D.track().popupElement, { onUnmount: () => D.setOpenMethod(null) });
|
|
99
|
+
function de(e, t, n) {
|
|
100
|
+
let r = q.get(e);
|
|
101
|
+
(r?.dialogCount !== t || r.drawerCount !== n) && (q.set(e, {
|
|
102
|
+
dialogCount: t,
|
|
103
|
+
drawerCount: n
|
|
104
|
+
}), W((e) => e + 1));
|
|
105
|
+
}
|
|
106
|
+
function fe(e) {
|
|
107
|
+
q.delete(e) && W((e) => e + 1);
|
|
108
|
+
}
|
|
109
|
+
let pe = {
|
|
110
|
+
store: D,
|
|
111
|
+
tree: c,
|
|
112
|
+
nested: S,
|
|
113
|
+
role: C ? "alertdialog" : "dialog",
|
|
114
|
+
modal: w,
|
|
115
|
+
disablePointerDismissal: T,
|
|
116
|
+
nestedOpenDialogCount: J,
|
|
117
|
+
nestedOpenDrawerCount: Y,
|
|
118
|
+
outsidePressEnabled: ue,
|
|
119
|
+
titleId: ae,
|
|
120
|
+
setTitleId: k,
|
|
121
|
+
descriptionId: A,
|
|
122
|
+
setDescriptionId: oe,
|
|
123
|
+
backdropElement: M,
|
|
124
|
+
setBackdropElement: P,
|
|
125
|
+
internalBackdropElement: F,
|
|
126
|
+
setInternalBackdropElement: I,
|
|
127
|
+
viewportElement: L,
|
|
128
|
+
setViewportElement: R,
|
|
129
|
+
presence: Z,
|
|
130
|
+
updateNestedLayer: de,
|
|
131
|
+
removeNestedLayer: fe
|
|
132
|
+
};
|
|
133
|
+
D.context.floatingRoot.context.data.insideElements = () => [
|
|
134
|
+
M(),
|
|
135
|
+
F(),
|
|
136
|
+
L()
|
|
137
|
+
], D.configureTriggerUnmount({ closeOnActiveTriggerUnmount: !1 }), E(() => t.handle, D);
|
|
138
|
+
let me = ne({
|
|
139
|
+
context: D.context.floatingRoot,
|
|
140
|
+
tree: () => c,
|
|
141
|
+
escapeKey: () => J() === 0,
|
|
142
|
+
outsidePress: () => (e) => {
|
|
143
|
+
if (!ue.current || T() || J() > 0 || "button" in e && e.button !== 0) return !1;
|
|
144
|
+
if ("touches" in e) {
|
|
145
|
+
if (e.type === "touchend") {
|
|
146
|
+
if (e.changedTouches.length !== 1 || e.touches.length !== 0) return !1;
|
|
147
|
+
} else if (e.touches.length !== 1) return !1;
|
|
148
|
+
}
|
|
149
|
+
if (w() === !1) return !0;
|
|
150
|
+
let t = d(e), n = F(), r = M();
|
|
151
|
+
return !n && !r || t === n || t === r || p(t) && f(t, D.state.popupElement) && !t.hasAttribute("data-base-ui-portal");
|
|
152
|
+
},
|
|
153
|
+
outsidePressEvent: () => F() || M() ? "intentional" : {
|
|
154
|
+
mouse: w() === "trap-focus" ? "sloppy" : "intentional",
|
|
155
|
+
touch: "sloppy"
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
D.setInteractionProps({
|
|
159
|
+
activeTriggerProps: { onKeyDown: me.onKeyDown },
|
|
160
|
+
inactiveTriggerProps: { onKeyDown: me.onKeyDown },
|
|
161
|
+
popupProps: {}
|
|
162
|
+
}), m(() => D.open() && w() === !0, () => D.track().popupElement), B(() => ({
|
|
163
|
+
open: D.open(),
|
|
164
|
+
activeTriggerId: D.activeTriggerId()
|
|
165
|
+
}), () => K(() => D.reconcileTriggers()));
|
|
166
|
+
let Q = K(() => D.open()), $ = K(() => D.openMethodRevision());
|
|
167
|
+
B(() => ({
|
|
168
|
+
open: D.open(),
|
|
169
|
+
openMethodRevision: D.openMethodRevision()
|
|
170
|
+
}), (e) => {
|
|
171
|
+
!e.open && Q ? $ = e.openMethodRevision : e.open && !Q && e.openMethodRevision === $ && D.setOpenMethod(null), Q = e.open;
|
|
172
|
+
});
|
|
173
|
+
let he = Symbol("DialogRoot");
|
|
174
|
+
B(() => ({
|
|
175
|
+
open: D.open(),
|
|
176
|
+
nestedDialogs: J(),
|
|
177
|
+
nestedDrawers: Y()
|
|
178
|
+
}), (e) => {
|
|
179
|
+
i?.updateNestedLayer(he, e.open ? e.nestedDialogs + 1 : 0, e.open ? e.nestedDrawers + +!!re : 0);
|
|
180
|
+
});
|
|
181
|
+
let ge = {
|
|
182
|
+
unmount: Z.forceUnmount,
|
|
183
|
+
close() {
|
|
184
|
+
D.setOpen(!1, s(r));
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
B(() => t.actionsRef, (e) => {
|
|
188
|
+
e?.(ge);
|
|
189
|
+
});
|
|
190
|
+
function _e() {
|
|
191
|
+
let e = V(() => t.children), n = K(e), r = n;
|
|
192
|
+
return typeof n == "function" && (r = n.name === "bound read" && Object.prototype.hasOwnProperty.call(n, se) ? N(() => e()) : K(() => n({ payload: ie }))), r;
|
|
193
|
+
}
|
|
194
|
+
return G(() => {
|
|
195
|
+
i?.removeNestedLayer(he), D.clearInteractionProps(), delete D.context.floatingRoot.context.data.insideElements;
|
|
196
|
+
}), j(le, {
|
|
197
|
+
value: pe,
|
|
198
|
+
get children() {
|
|
199
|
+
return j(ee, {
|
|
200
|
+
value: c,
|
|
201
|
+
get children() {
|
|
202
|
+
return j(b, {
|
|
203
|
+
get value() {
|
|
204
|
+
return O.id ?? null;
|
|
205
|
+
},
|
|
206
|
+
get children() {
|
|
207
|
+
return [N(() => n.extraContent?.()), j(_e, {})];
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/dialog/utils/mergeDialogStyles.ts
|
|
217
|
+
function de(e, t) {
|
|
218
|
+
if (typeof t == "string") {
|
|
219
|
+
let n = Object.entries(e).filter((e) => e[1] != null).map(([e, t]) => `${e}:${String(t)}`).join(";");
|
|
220
|
+
return n ? `${n};${t}` : t;
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
...e,
|
|
224
|
+
...t || void 0
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
//#endregion
|
|
228
|
+
//#region src/dialog/utils/stateAttributesMapping.ts
|
|
229
|
+
var fe = { "data-open": "" }, pe = { "data-closed": "" }, me = { "data-nested-dialog-open": "" }, Q = {
|
|
230
|
+
open: (e) => e ? fe : pe,
|
|
231
|
+
...c
|
|
232
|
+
}, $ = {
|
|
233
|
+
...Q,
|
|
234
|
+
nestedDialogOpen: (e) => e ? me : null
|
|
235
|
+
}, he = /* @__PURE__ */ L("<button>");
|
|
236
|
+
function ge(n) {
|
|
237
|
+
let r = X(), c = n, d = n, f = V(() => c.disabled ?? !1), p = V(() => c.nativeButton ?? !0), m = V(() => ({ disabled: f() })), h = e(n, () => m(), (e) => (() => {
|
|
238
|
+
var t = M(he);
|
|
239
|
+
return I(t, e, !1), F(), t;
|
|
240
|
+
})()), g = V(() => a(n.class, m())), _ = V(() => o(n.style, m())), ee = V(() => t(m())), v = W(d, "render", "class", "disabled", "nativeButton", "onClick", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "ref", "style");
|
|
241
|
+
function y(e) {
|
|
242
|
+
r.store.open() && r.store.setOpen(!1, s(i, e));
|
|
243
|
+
}
|
|
244
|
+
let b = l(u(() => K(() => f() ? A : void 0)), u(() => c.onClick), y), te = l(u(() => K(() => f() ? A : void 0)), u(() => c.onPointerDown)), x = l(u(() => K(() => f() ? O : void 0)), u(() => c.onMouseDown)), ne = l(u(() => K(() => f() ? ae : void 0)), u(() => c.onKeyDown), u(() => K(() => p() ? void 0 : oe))), S = l(u(() => K(() => f() ? O : void 0)), u(() => c.onKeyUp), u(() => K(() => p() ? void 0 : k)));
|
|
245
|
+
return j(h, P({
|
|
246
|
+
ref: [c.ref],
|
|
247
|
+
get type() {
|
|
248
|
+
return p() ? "button" : void 0;
|
|
249
|
+
},
|
|
250
|
+
get role() {
|
|
251
|
+
return p() ? void 0 : "button";
|
|
252
|
+
},
|
|
253
|
+
get tabIndex() {
|
|
254
|
+
return !p() && f() ? -1 : 0;
|
|
255
|
+
},
|
|
256
|
+
get disabled() {
|
|
257
|
+
return (N(() => !!p())() ? f() : p()) || void 0;
|
|
258
|
+
},
|
|
259
|
+
get "aria-disabled"() {
|
|
260
|
+
return !p() && f() ? "true" : void 0;
|
|
261
|
+
},
|
|
262
|
+
get class() {
|
|
263
|
+
return g();
|
|
264
|
+
},
|
|
265
|
+
get style() {
|
|
266
|
+
return _();
|
|
267
|
+
},
|
|
268
|
+
onClick: b,
|
|
269
|
+
onKeyDown: ne,
|
|
270
|
+
onKeyUp: S,
|
|
271
|
+
onMouseDown: x,
|
|
272
|
+
onPointerDown: te
|
|
273
|
+
}, ee, v));
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/dialog/description/DialogDescription.tsx
|
|
277
|
+
var _e = /* @__PURE__ */ L("<p>");
|
|
278
|
+
function ve(t) {
|
|
279
|
+
let n = X(), r = t, i = t, s = `base-ui-${U()}`, c = V(() => r.id || s), l = {}, u = e(t, () => l, (e) => (() => {
|
|
280
|
+
var t = M(_e);
|
|
281
|
+
return I(t, e, !1), F(), t;
|
|
282
|
+
})()), d = V(() => a(t.class, l)), f = V(() => o(t.style, l)), p = W(i, "render", "class", "id", "ref", "style");
|
|
283
|
+
return B(() => c(), (e) => (n.setDescriptionId(e), () => n.setDescriptionId((t) => t === e ? void 0 : t))), j(u, P({
|
|
284
|
+
ref: [r.ref],
|
|
285
|
+
get id() {
|
|
286
|
+
return c();
|
|
287
|
+
},
|
|
288
|
+
get class() {
|
|
289
|
+
return d();
|
|
290
|
+
},
|
|
291
|
+
get style() {
|
|
292
|
+
return f();
|
|
293
|
+
}
|
|
294
|
+
}, p));
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/dialog/portal/DialogPortalContext.ts
|
|
298
|
+
var ye = Symbol("DialogPortalContext"), be = z(ye);
|
|
299
|
+
function xe() {
|
|
300
|
+
let e = q(be);
|
|
301
|
+
if (e === ye) throw Error("Base UI: <Dialog.Portal> is missing.");
|
|
302
|
+
return e;
|
|
303
|
+
}
|
|
304
|
+
//#endregion
|
|
305
|
+
//#region src/dialog/portal/DialogPortal.tsx
|
|
306
|
+
function Se(e) {
|
|
307
|
+
let t = X(), n = e, r = e, i = V(() => n.keepMounted ?? !1), s = V(() => t.presence.mounted() || i()), c = {}, l = V(() => a(e.class, c)), u = V(() => o(e.style, c)), d = W(r, "render", "class", "container", "keepMounted", "ref", "style"), f = { keepMounted: i };
|
|
308
|
+
function p() {
|
|
309
|
+
let e = null;
|
|
310
|
+
return G(() => {
|
|
311
|
+
t.internalBackdropElement() === e && t.setInternalBackdropElement(null);
|
|
312
|
+
}), j(h, {
|
|
313
|
+
ref: (n) => {
|
|
314
|
+
e = n, t.setInternalBackdropElement(n);
|
|
315
|
+
},
|
|
316
|
+
get open() {
|
|
317
|
+
return t.store.open();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
return j(R, {
|
|
322
|
+
get when() {
|
|
323
|
+
return s();
|
|
324
|
+
},
|
|
325
|
+
get children() {
|
|
326
|
+
return j(be, {
|
|
327
|
+
value: f,
|
|
328
|
+
get children() {
|
|
329
|
+
return j(re, P({
|
|
330
|
+
get render() {
|
|
331
|
+
return e.render;
|
|
332
|
+
},
|
|
333
|
+
get container() {
|
|
334
|
+
return n.container;
|
|
335
|
+
},
|
|
336
|
+
ref: (e) => {
|
|
337
|
+
n.ref && ie(n.ref, e);
|
|
338
|
+
},
|
|
339
|
+
get class() {
|
|
340
|
+
return l();
|
|
341
|
+
},
|
|
342
|
+
get style() {
|
|
343
|
+
return u();
|
|
344
|
+
}
|
|
345
|
+
}, d, { get children() {
|
|
346
|
+
return [j(R, {
|
|
347
|
+
get when() {
|
|
348
|
+
return N(() => !!t.presence.mounted())() ? t.modal() === !0 : t.presence.mounted();
|
|
349
|
+
},
|
|
350
|
+
get children() {
|
|
351
|
+
return j(p, {});
|
|
352
|
+
}
|
|
353
|
+
}), N(() => e.children)];
|
|
354
|
+
} }));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
//#endregion
|
|
361
|
+
//#region src/dialog/title/DialogTitle.tsx
|
|
362
|
+
var Ce = /* @__PURE__ */ L("<h2>");
|
|
363
|
+
function we(t) {
|
|
364
|
+
let n = X(), r = t, i = t, s = `base-ui-${U()}`, c = V(() => r.id || s), l = {}, u = e(t, () => l, (e) => (() => {
|
|
365
|
+
var t = M(Ce);
|
|
366
|
+
return I(t, e, !1), F(), t;
|
|
367
|
+
})()), d = V(() => a(t.class, l)), f = V(() => o(t.style, l)), p = W(i, "render", "class", "id", "ref", "style");
|
|
368
|
+
return B(() => c(), (e) => (n.setTitleId(e), () => n.setTitleId((t) => t === e ? void 0 : t))), j(u, P({
|
|
369
|
+
ref: [r.ref],
|
|
370
|
+
get id() {
|
|
371
|
+
return c();
|
|
372
|
+
},
|
|
373
|
+
get class() {
|
|
374
|
+
return d();
|
|
375
|
+
},
|
|
376
|
+
get style() {
|
|
377
|
+
return f();
|
|
378
|
+
}
|
|
379
|
+
}, p));
|
|
380
|
+
}
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/dialog/trigger/DialogTrigger.tsx
|
|
383
|
+
var Te = /* @__PURE__ */ L("<button>");
|
|
384
|
+
function Ee(r) {
|
|
385
|
+
let i = X(!0), c = r;
|
|
386
|
+
if (!i && !K(() => c.handle)) throw Error("Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.");
|
|
387
|
+
let d = r, f = `base-ui-${U()}`, p = V(() => c.id || f), m = V(() => c.disabled ?? !1), h = V(() => c.nativeButton ?? !0), [g, _] = H(null, { ownedWrite: !0 }), ee = w(() => c.handle), v = V(() => ee() ?? i?.store), y = V(() => {
|
|
388
|
+
let e = v();
|
|
389
|
+
return !!(e?.open() && e.activeTriggerId() === p());
|
|
390
|
+
}), b = V(() => ({
|
|
391
|
+
disabled: m(),
|
|
392
|
+
open: y()
|
|
393
|
+
})), te = e(r, () => b(), (e) => (() => {
|
|
394
|
+
var t = M(Te);
|
|
395
|
+
return I(t, e, !1), F(), t;
|
|
396
|
+
})()), ne = V(() => a(r.class, b())), S = V(() => o(r.style, b())), re = V(() => t(b(), C)), T = W(d, "render", "class", "disabled", "handle", "id", "nativeButton", "onClick", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "payload", "ref", "style"), E = "", D = "";
|
|
397
|
+
x(v, p, g, () => ({ payload: c.payload }));
|
|
398
|
+
function ie(e) {
|
|
399
|
+
let t = v(), r = g();
|
|
400
|
+
!t || !r || e.button !== 0 || (t.open() || t.setOpenMethod(D || (e.detail === 0 ? "keyboard" : De() ? "touch" : "mouse")), t.setOpen(!(t.open() && t.activeTriggerId() === p()), s(n, e, r)));
|
|
401
|
+
}
|
|
402
|
+
function L() {
|
|
403
|
+
D = E, E = "";
|
|
404
|
+
}
|
|
405
|
+
function se(e) {
|
|
406
|
+
E = e.pointerType;
|
|
407
|
+
}
|
|
408
|
+
function R(e) {
|
|
409
|
+
E = "keyboard";
|
|
410
|
+
let t = v(), n = t?.state.popupElement, r = t ? (t.activeTriggerId() === p() ? t.state.activeTriggerProps : t.state.inactiveTriggerProps).onKeyDown : void 0, i = e.currentTarget;
|
|
411
|
+
n && i && n.ownerDocument !== i.ownerDocument && typeof r == "function" && r(e);
|
|
412
|
+
}
|
|
413
|
+
let z = l(u(() => K(() => m() ? A : void 0)), L, u(() => c.onClick), ie), B = l(u(() => K(() => m() ? A : void 0)), u(() => c.onPointerDown), se), G = l(u(() => K(() => m() ? O : void 0)), u(() => c.onMouseDown)), q = l(u(() => K(() => m() ? ae : void 0)), u(() => c.onKeyDown), R, u(() => K(() => h() ? void 0 : oe))), ce = l(u(() => K(() => m() ? O : void 0)), u(() => c.onKeyUp), u(() => K(() => h() ? void 0 : k)));
|
|
414
|
+
return j(te, P({
|
|
415
|
+
ref: [((e) => _(e)), c.ref],
|
|
416
|
+
get id() {
|
|
417
|
+
return p();
|
|
418
|
+
},
|
|
419
|
+
get type() {
|
|
420
|
+
return h() ? "button" : void 0;
|
|
421
|
+
},
|
|
422
|
+
get role() {
|
|
423
|
+
return h() ? void 0 : "button";
|
|
424
|
+
},
|
|
425
|
+
get tabIndex() {
|
|
426
|
+
return !h() && m() ? -1 : 0;
|
|
427
|
+
},
|
|
428
|
+
get disabled() {
|
|
429
|
+
return (N(() => !!h())() ? m() : h()) || void 0;
|
|
430
|
+
},
|
|
431
|
+
get "aria-disabled"() {
|
|
432
|
+
return !h() && m() ? "true" : void 0;
|
|
433
|
+
},
|
|
434
|
+
"aria-haspopup": "dialog",
|
|
435
|
+
get "aria-expanded"() {
|
|
436
|
+
return y() ? "true" : "false";
|
|
437
|
+
},
|
|
438
|
+
get "aria-controls"() {
|
|
439
|
+
return v()?.triggerPopupId(p());
|
|
440
|
+
},
|
|
441
|
+
"data-base-ui-click-trigger": "",
|
|
442
|
+
get class() {
|
|
443
|
+
return ne();
|
|
444
|
+
},
|
|
445
|
+
get style() {
|
|
446
|
+
return S();
|
|
447
|
+
},
|
|
448
|
+
onClick: z,
|
|
449
|
+
onKeyDown: q,
|
|
450
|
+
onKeyUp: ce,
|
|
451
|
+
onMouseDown: G,
|
|
452
|
+
onPointerDown: B
|
|
453
|
+
}, re, T));
|
|
454
|
+
}
|
|
455
|
+
function De() {
|
|
456
|
+
if (typeof navigator > "u") return !1;
|
|
457
|
+
let e = navigator.platform.toLowerCase();
|
|
458
|
+
return /^i(os$|p)/.test(e) || e === "macintel" && navigator.maxTouchPoints > 1;
|
|
459
|
+
}
|
|
460
|
+
//#endregion
|
|
461
|
+
//#region src/dialog/viewport/DialogViewport.tsx
|
|
462
|
+
var Oe = /* @__PURE__ */ L("<div>");
|
|
463
|
+
function ke(n) {
|
|
464
|
+
let r = xe(), i = X(), s = n, c = W(n, "render", "class", "ref", "style"), l = V(() => ({
|
|
465
|
+
open: i.store.open(),
|
|
466
|
+
transitionStatus: i.store.track().transitionStatus,
|
|
467
|
+
nested: i.nested,
|
|
468
|
+
nestedDialogOpen: i.nestedOpenDialogCount() > 0
|
|
469
|
+
})), u = e(n, () => l(), (e) => (() => {
|
|
470
|
+
var t = M(Oe);
|
|
471
|
+
return I(t, e, !1), F(), t;
|
|
472
|
+
})()), d = V(() => a(n.class, l())), f = V(() => de({ "pointer-events": i.store.open() ? void 0 : "none" }, o(n.style, l()))), p = V(() => t(l(), $)), m = V(() => r.keepMounted() || i.presence.mounted()), h = null;
|
|
473
|
+
return G(() => {
|
|
474
|
+
i.viewportElement() === h && i.setViewportElement(null);
|
|
475
|
+
}), j(R, {
|
|
476
|
+
get when() {
|
|
477
|
+
return m();
|
|
478
|
+
},
|
|
479
|
+
get children() {
|
|
480
|
+
return j(u, P({
|
|
481
|
+
ref: [((e) => {
|
|
482
|
+
h = e, i.setViewportElement(e);
|
|
483
|
+
}), s.ref],
|
|
484
|
+
role: "presentation",
|
|
485
|
+
get hidden() {
|
|
486
|
+
return !i.presence.mounted();
|
|
487
|
+
},
|
|
488
|
+
get class() {
|
|
489
|
+
return d();
|
|
490
|
+
},
|
|
491
|
+
get style() {
|
|
492
|
+
return f();
|
|
493
|
+
}
|
|
494
|
+
}, p, c));
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/dialog/store/DialogHandle.ts
|
|
500
|
+
var Ae = class extends D {
|
|
501
|
+
constructor() {
|
|
502
|
+
super("Dialog", !1, new J());
|
|
503
|
+
}
|
|
504
|
+
open(e) {
|
|
505
|
+
this.openByTrigger(e);
|
|
506
|
+
}
|
|
507
|
+
openWithPayload(e) {
|
|
508
|
+
this.attachedStore && (this.attachedStore.setPayload(e), this.attachedStore.setOpen(!0, s(r)));
|
|
509
|
+
}
|
|
510
|
+
close() {
|
|
511
|
+
this.closePopup();
|
|
512
|
+
}
|
|
513
|
+
get isOpen() {
|
|
514
|
+
return this.attachedStore?.open() ?? !1;
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
function je() {
|
|
518
|
+
return new Ae();
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
export { we as a, ve as c, Q as d, de as f, X as h, Ee as i, ge as l, Z as m, je as n, Se as o, ue as p, ke as r, xe as s, Ae as t, $ as u };
|