solid-baseui 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +26 -0
- package/README.md +150 -0
- package/dist/lib/client/CSPContext-faVzToiT.js +10 -0
- package/dist/lib/client/CheckboxGroupContext-1CRRHK0T.js +8 -0
- package/dist/lib/client/DialogHandle-DrN2YWCv.js +518 -0
- package/dist/lib/client/DialogPopup-ZlqmGfdk.js +136 -0
- package/dist/lib/client/DirectionContext-BwMabICS.js +7 -0
- package/dist/lib/client/FieldControl-Bc-z2og6.js +116 -0
- package/dist/lib/client/FieldItemContext-Bwzf-4tL.js +7 -0
- package/dist/lib/client/FieldRootContext-izCEh80D.js +32 -0
- package/dist/lib/client/FieldsetRootContext-BgThSAcd.js +13 -0
- package/dist/lib/client/FloatingTree-23B7KKPD.js +83 -0
- package/dist/lib/client/FocusManager-grSdNHqW.js +360 -0
- package/dist/lib/client/FormContext-BB05lWOI.js +16 -0
- package/dist/lib/client/InternalBackdrop-cSK13gaM.js +160 -0
- package/dist/lib/client/LabelableContext-DKsB0fIx.js +48 -0
- package/dist/lib/client/MenuSubmenuTrigger-QZkQ0F2v.js +1570 -0
- package/dist/lib/client/MenubarContext-BYt3fkt-.js +13 -0
- package/dist/lib/client/PopupHandle-CcJG4NMy.js +101 -0
- package/dist/lib/client/PopupStore-DjB-wO88.js +468 -0
- package/dist/lib/client/PopupViewport-DgrIqQea.js +152 -0
- package/dist/lib/client/RadioGroupContext-CZexBsPa.js +9 -0
- package/dist/lib/client/Separator-9DboD_Si.js +25 -0
- package/dist/lib/client/ToggleGroupContext-_THxLgJU.js +9 -0
- package/dist/lib/client/ToolbarGroupContext-Dpc3_mFx.js +9 -0
- package/dist/lib/client/ToolbarItemOwnerContext-DtVqVnSE.js +9 -0
- package/dist/lib/client/ToolbarRootContext-88yZoAOy.js +13 -0
- package/dist/lib/client/TriggerFocusGuards-CQ-JuASy.js +56 -0
- package/dist/lib/client/accordion/index.js +2 -0
- package/dist/lib/client/accordion-sOXt9AlG.js +399 -0
- package/dist/lib/client/alert-dialog/index.js +2 -0
- package/dist/lib/client/alert-dialog-BH_3ndio.js +30 -0
- package/dist/lib/client/autocomplete/index.js +2 -0
- package/dist/lib/client/autocomplete-Cob_FZEP.js +113 -0
- package/dist/lib/client/avatar/index.js +2 -0
- package/dist/lib/client/avatar-AF9vyD4q.js +146 -0
- package/dist/lib/client/button/index.js +2 -0
- package/dist/lib/client/button-DpUi-2g8.js +82 -0
- package/dist/lib/client/buttonSemantics-paljfpOX.js +39 -0
- package/dist/lib/client/checkbox/index.js +2 -0
- package/dist/lib/client/checkbox-BbAwOptH.js +441 -0
- package/dist/lib/client/checkbox-group/index.js +2 -0
- package/dist/lib/client/checkbox-group-CSSp_805.js +128 -0
- package/dist/lib/client/collapsible/index.js +2 -0
- package/dist/lib/client/collapsible-BIbje_ub.js +232 -0
- package/dist/lib/client/combobox/index.js +2 -0
- package/dist/lib/client/combobox-8O-vgTLL.js +352 -0
- package/dist/lib/client/compositeNavigation-sxniYTc7.js +58 -0
- package/dist/lib/client/constants-BYjBUIIi.js +424 -0
- package/dist/lib/client/context-menu/index.js +2 -0
- package/dist/lib/client/context-menu-BTMkXtrs.js +217 -0
- package/dist/lib/client/createAnchorPositioning-DcxDXUgB.js +1058 -0
- package/dist/lib/client/createAnchoredPopupScrollLock-Cx0cbh1_.js +19 -0
- package/dist/lib/client/createClickInteraction-CTaIFBiV.js +45 -0
- package/dist/lib/client/createCollapsiblePanel-DeDu0O2t.js +231 -0
- package/dist/lib/client/createFocusInteraction-D4w1-235.js +50 -0
- package/dist/lib/client/createPopupAutoResize-CGNiLhGq.js +60 -0
- package/dist/lib/client/createTransitionStatus-B1L-whed.js +53 -0
- package/dist/lib/client/csp-provider/index.js +2 -0
- package/dist/lib/client/csp-provider-C7nRHDKK.js +16 -0
- package/dist/lib/client/dialog/index.js +2 -0
- package/dist/lib/client/dialog-DkaQwIgP.js +19 -0
- package/dist/lib/client/direction-provider/index.js +3 -0
- package/dist/lib/client/direction-provider-DYhRN-8f.js +13 -0
- package/dist/lib/client/dom-BEAeQ9Eb.js +58 -0
- package/dist/lib/client/drawer/index.js +2 -0
- package/dist/lib/client/drawer-Ce2cChLt.js +1550 -0
- package/dist/lib/client/field/index.js +2 -0
- package/dist/lib/client/field-C-o7jzKW.js +469 -0
- package/dist/lib/client/fieldset/index.js +2 -0
- package/dist/lib/client/fieldset-BQTAWv2L.js +65 -0
- package/dist/lib/client/form/index.js +2 -0
- package/dist/lib/client/form-BINBiW5L.js +106 -0
- package/dist/lib/client/form-types-DFBxc1LF.js +8 -0
- package/dist/lib/client/index.js +43 -0
- package/dist/lib/client/input/index.js +2 -0
- package/dist/lib/client/input-gb0ejxkm.js +7 -0
- package/dist/lib/client/internals/composeEventHandlers.js +50 -0
- package/dist/lib/client/internals/createBaseUIEventDetails.js +31 -0
- package/dist/lib/client/internals/csp-context/index.js +2 -0
- package/dist/lib/client/internals/direction-context/index.js +2 -0
- package/dist/lib/client/internals/field-constants.js +56 -0
- package/dist/lib/client/internals/field-root-context/index.js +2 -0
- package/dist/lib/client/internals/form-context/index.js +2 -0
- package/dist/lib/client/internals/getStateAttributesProps.js +21 -0
- package/dist/lib/client/internals/labelable-provider/index.js +19 -0
- package/dist/lib/client/internals/mergeStyles.js +9 -0
- package/dist/lib/client/internals/reasons.js +2 -0
- package/dist/lib/client/internals/stateAttributesMapping.js +8 -0
- package/dist/lib/client/internals/types.js +0 -0
- package/dist/lib/client/menu/index.js +2 -0
- package/dist/lib/client/menu-DeMT08oD.js +326 -0
- package/dist/lib/client/menubar/index.js +2 -0
- package/dist/lib/client/menubar-C4aomSYv.js +185 -0
- package/dist/lib/client/mergeStyleValue-C4ITiiIV.js +42 -0
- package/dist/lib/client/meter/index.js +2 -0
- package/dist/lib/client/meter-xSU37Q0m.js +171 -0
- package/dist/lib/client/navigation-menu/index.js +2 -0
- package/dist/lib/client/navigation-menu-ZILQmdn6.js +1083 -0
- package/dist/lib/client/number-field/index.js +2 -0
- package/dist/lib/client/number-field-B8CsTb_8.js +1035 -0
- package/dist/lib/client/otp-field/index.js +2 -0
- package/dist/lib/client/otp-field-DBkMcnog.js +582 -0
- package/dist/lib/client/platform-Bk5Q32mf.js +13 -0
- package/dist/lib/client/popover/index.js +2 -0
- package/dist/lib/client/popover-CQwyp-fs.js +929 -0
- package/dist/lib/client/popupStateMapping-C9eZl19i.js +367 -0
- package/dist/lib/client/preview-card/index.js +2 -0
- package/dist/lib/client/preview-card-D_2Q8lpC.js +625 -0
- package/dist/lib/client/progress/index.js +2 -0
- package/dist/lib/client/progress-D7r0xAC9.js +188 -0
- package/dist/lib/client/radio/index.js +2 -0
- package/dist/lib/client/radio-CzGQ81z1.js +299 -0
- package/dist/lib/client/radio-group/index.js +2 -0
- package/dist/lib/client/radio-group-DpHlBKA6.js +193 -0
- package/dist/lib/client/reasons-Co5CzjKq.js +41 -0
- package/dist/lib/client/resolveStyle-XcgAuaKR.js +11 -0
- package/dist/lib/client/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/lib/client/runOnceAnimationsFinish-15EM-Z4l.js +48 -0
- package/dist/lib/client/safePolygon--bbKn0c8.js +316 -0
- package/dist/lib/client/scroll-area/index.js +2 -0
- package/dist/lib/client/scroll-area-CffM4U0R.js +701 -0
- package/dist/lib/client/scrollable-SRNYlhF7.js +42 -0
- package/dist/lib/client/select/index.js +2 -0
- package/dist/lib/client/select-IFhiEg73.js +1940 -0
- package/dist/lib/client/separator/index.js +2 -0
- package/dist/lib/client/setRef-fXF6OIo3.js +7 -0
- package/dist/lib/client/slider/index.js +2 -0
- package/dist/lib/client/slider-BCagYmGp.js +921 -0
- package/dist/lib/client/switch/index.js +2 -0
- package/dist/lib/client/switch-RIJeDnvS.js +308 -0
- package/dist/lib/client/tabs/index.js +2 -0
- package/dist/lib/client/tabs-fOAKs7r3.js +696 -0
- package/dist/lib/client/toast/index.js +2 -0
- package/dist/lib/client/toast-D2P8UqUs.js +1108 -0
- package/dist/lib/client/toggle/index.js +2 -0
- package/dist/lib/client/toggle-group/index.js +2 -0
- package/dist/lib/client/toggle-group-0Aue0owJ.js +129 -0
- package/dist/lib/client/toggle-momVEIBL.js +138 -0
- package/dist/lib/client/toolbar/index.js +2 -0
- package/dist/lib/client/toolbar-Du22aKCv.js +492 -0
- package/dist/lib/client/tooltip/index.js +2 -0
- package/dist/lib/client/tooltip-CyK61fl1.js +844 -0
- package/dist/lib/client/types/index.js +0 -0
- package/dist/lib/client/useFilteredItems-DTekHz39.js +2223 -0
- package/dist/lib/client/withoutComponentBinding-CcCW7fSc.js +13 -0
- package/dist/lib/server/CSPContext-DOxR0PO7.js +10 -0
- package/dist/lib/server/CheckboxGroupContext-DTP679kK.js +8 -0
- package/dist/lib/server/DialogHandle-ATZlm9RC.js +689 -0
- package/dist/lib/server/DialogPopup-BebI-w5P.js +159 -0
- package/dist/lib/server/DirectionContext-YORWLF08.js +10 -0
- package/dist/lib/server/FieldControl-Y_kI7ARp.js +174 -0
- package/dist/lib/server/FieldItemContext-x-C7ZlmX.js +7 -0
- package/dist/lib/server/FieldRootContext-IC-LWzVp.js +34 -0
- package/dist/lib/server/FieldsetRootContext-DyNqCjK6.js +14 -0
- package/dist/lib/server/FloatingTree-z1JPD1dR.js +101 -0
- package/dist/lib/server/FocusManager-BrbZVWME.js +538 -0
- package/dist/lib/server/FormContext-pvESt85v.js +17 -0
- package/dist/lib/server/InternalBackdrop-C_iDPVR-.js +260 -0
- package/dist/lib/server/LabelableContext-DZP3rgAY.js +59 -0
- package/dist/lib/server/MenuSubmenuTrigger-DA4gsv6z.js +2072 -0
- package/dist/lib/server/MenubarContext-C-62rMnO.js +14 -0
- package/dist/lib/server/PopupHandle-DthPgNjy.js +115 -0
- package/dist/lib/server/PopupStore-DEs3FAEe.js +645 -0
- package/dist/lib/server/PopupViewport-3r_KTFwX.js +220 -0
- package/dist/lib/server/RadioGroupContext-D5xmTkDz.js +10 -0
- package/dist/lib/server/Separator-vhhYxWGr.js +31 -0
- package/dist/lib/server/ToggleGroupContext-COor8gYc.js +10 -0
- package/dist/lib/server/ToolbarGroupContext-CzdHxijX.js +10 -0
- package/dist/lib/server/ToolbarItemOwnerContext-L5dsZ_vS.js +10 -0
- package/dist/lib/server/ToolbarRootContext-DD-qe7s8.js +14 -0
- package/dist/lib/server/TriggerFocusGuards-sbGwf45f.js +63 -0
- package/dist/lib/server/accordion/index.js +566 -0
- package/dist/lib/server/alert-dialog/index.js +36 -0
- package/dist/lib/server/autocomplete/index.js +173 -0
- package/dist/lib/server/avatar/index.js +199 -0
- package/dist/lib/server/button/index.js +119 -0
- package/dist/lib/server/buttonSemantics-BSwDxJhh.js +49 -0
- package/dist/lib/server/checkbox/index.js +537 -0
- package/dist/lib/server/checkbox-group/index.js +198 -0
- package/dist/lib/server/collapsible/index.js +307 -0
- package/dist/lib/server/combobox/index.js +480 -0
- package/dist/lib/server/compositeNavigation-BRVT1C38.js +68 -0
- package/dist/lib/server/constants-9H__9xbS.js +706 -0
- package/dist/lib/server/context-menu/index.js +263 -0
- package/dist/lib/server/createAnchorPositioning-C-cVOPwz.js +381 -0
- package/dist/lib/server/createAnchoredPopupScrollLock-DFuUrykR.js +20 -0
- package/dist/lib/server/createClickInteraction-BYsMgvup.js +68 -0
- package/dist/lib/server/createCollapsiblePanel-DTyVJz0G.js +297 -0
- package/dist/lib/server/createFocusInteraction-EIS0QOel.js +77 -0
- package/dist/lib/server/createPopupAutoResize-DO50jjNX.js +111 -0
- package/dist/lib/server/createTransitionStatus-BTlrerSS.js +61 -0
- package/dist/lib/server/csp-provider/index.js +15 -0
- package/dist/lib/server/dialog/index.js +19 -0
- package/dist/lib/server/direction-provider/index.js +13 -0
- package/dist/lib/server/dom-Crg_2R-j.js +67 -0
- package/dist/lib/server/drawer/index.js +2351 -0
- package/dist/lib/server/field/index.js +677 -0
- package/dist/lib/server/fieldset/index.js +91 -0
- package/dist/lib/server/form/index.js +136 -0
- package/dist/lib/server/form-types-P7-SCWyr.js +8 -0
- package/dist/lib/server/index.js +43 -0
- package/dist/lib/server/input/index.js +11 -0
- package/dist/lib/server/internals/composeEventHandlers.js +60 -0
- package/dist/lib/server/internals/createBaseUIEventDetails.js +33 -0
- package/dist/lib/server/internals/csp-context/index.js +2 -0
- package/dist/lib/server/internals/direction-context/index.js +2 -0
- package/dist/lib/server/internals/field-constants.js +64 -0
- package/dist/lib/server/internals/field-root-context/index.js +2 -0
- package/dist/lib/server/internals/form-context/index.js +2 -0
- package/dist/lib/server/internals/getStateAttributesProps.js +23 -0
- package/dist/lib/server/internals/labelable-provider/index.js +20 -0
- package/dist/lib/server/internals/mergeStyles.js +15 -0
- package/dist/lib/server/internals/reasons.js +76 -0
- package/dist/lib/server/internals/stateAttributesMapping.js +15 -0
- package/dist/lib/server/internals/types.js +1 -0
- package/dist/lib/server/menu/index.js +423 -0
- package/dist/lib/server/menubar/index.js +242 -0
- package/dist/lib/server/mergeStyleValue-Db8bRCM4.js +67 -0
- package/dist/lib/server/meter/index.js +217 -0
- package/dist/lib/server/navigation-menu/index.js +1436 -0
- package/dist/lib/server/number-field/index.js +1497 -0
- package/dist/lib/server/otp-field/index.js +811 -0
- package/dist/lib/server/platform-DYukKUir.js +13 -0
- package/dist/lib/server/popover/index.js +1187 -0
- package/dist/lib/server/popupStateMapping-nKoUwoke.js +459 -0
- package/dist/lib/server/preview-card/index.js +797 -0
- package/dist/lib/server/progress/index.js +252 -0
- package/dist/lib/server/radio/index.js +364 -0
- package/dist/lib/server/radio-group/index.js +282 -0
- package/dist/lib/server/resolveStyle-XCSFDHAL.js +11 -0
- package/dist/lib/server/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/lib/server/runOnceAnimationsFinish-DCHzXWZU.js +59 -0
- package/dist/lib/server/safePolygon-CAm5RJGv.js +474 -0
- package/dist/lib/server/scroll-area/index.js +993 -0
- package/dist/lib/server/scrollable-CjsSxbGr.js +54 -0
- package/dist/lib/server/select/index.js +2630 -0
- package/dist/lib/server/separator/index.js +2 -0
- package/dist/lib/server/setRef-Bt70sW7c.js +7 -0
- package/dist/lib/server/slider/index.js +1333 -0
- package/dist/lib/server/switch/index.js +389 -0
- package/dist/lib/server/tabs/index.js +1007 -0
- package/dist/lib/server/toast/index.js +1588 -0
- package/dist/lib/server/toggle/index.js +201 -0
- package/dist/lib/server/toggle-group/index.js +192 -0
- package/dist/lib/server/toolbar/index.js +685 -0
- package/dist/lib/server/tooltip/index.js +1092 -0
- package/dist/lib/server/types/index.js +1 -0
- package/dist/lib/server/useFilteredItems-DvuctLt3.js +3157 -0
- package/dist/lib/server/withoutComponentBinding-BHaWr5kU.js +20 -0
- package/dist/lib/types/accordion/header/AccordionHeader.d.ts +12 -0
- package/dist/lib/types/accordion/index.d.ts +6 -0
- package/dist/lib/types/accordion/index.parts.d.ts +5 -0
- package/dist/lib/types/accordion/item/AccordionItem.d.ts +29 -0
- package/dist/lib/types/accordion/item/AccordionItemContext.d.ts +22 -0
- package/dist/lib/types/accordion/item/AccordionItemDataAttributes.d.ts +5 -0
- package/dist/lib/types/accordion/item/stateAttributesMapping.d.ts +13 -0
- package/dist/lib/types/accordion/panel/AccordionPanel.d.ts +20 -0
- package/dist/lib/types/accordion/panel/AccordionPanelCssVars.d.ts +4 -0
- package/dist/lib/types/accordion/root/AccordionRoot.d.ts +46 -0
- package/dist/lib/types/accordion/root/AccordionRootContext.d.ts +22 -0
- package/dist/lib/types/accordion/root/stateAttributesMapping.d.ts +3 -0
- package/dist/lib/types/accordion/trigger/AccordionTrigger.d.ts +27 -0
- package/dist/lib/types/accordion/trigger/AccordionTriggerDataAttributes.d.ts +4 -0
- package/dist/lib/types/alert-dialog/handle.d.ts +6 -0
- package/dist/lib/types/alert-dialog/index.d.ts +10 -0
- package/dist/lib/types/alert-dialog/index.parts.d.ts +10 -0
- package/dist/lib/types/alert-dialog/root/AlertDialogRoot.d.ts +29 -0
- package/dist/lib/types/alert-dialog/trigger/AlertDialogTrigger.d.ts +19 -0
- package/dist/lib/types/autocomplete/index.d.ts +24 -0
- package/dist/lib/types/autocomplete/index.parts.d.ts +23 -0
- package/dist/lib/types/autocomplete/input-group/AutocompleteInputGroup.d.ts +26 -0
- package/dist/lib/types/autocomplete/item/AutocompleteItem.d.ts +18 -0
- package/dist/lib/types/autocomplete/root/AutocompleteRoot.d.ts +195 -0
- package/dist/lib/types/autocomplete/root/utils/useFilter.d.ts +9 -0
- package/dist/lib/types/autocomplete/separator/AutocompleteSeparator.d.ts +17 -0
- package/dist/lib/types/autocomplete/trigger/AutocompleteTrigger.d.ts +24 -0
- package/dist/lib/types/autocomplete/value/AutocompleteValue.d.ts +15 -0
- package/dist/lib/types/avatar/fallback/AvatarFallback.d.ts +16 -0
- package/dist/lib/types/avatar/image/AvatarImage.d.ts +17 -0
- package/dist/lib/types/avatar/image/createImageLoadingStatus.d.ts +10 -0
- package/dist/lib/types/avatar/index.d.ts +4 -0
- package/dist/lib/types/avatar/index.parts.d.ts +3 -0
- package/dist/lib/types/avatar/root/AvatarRoot.d.ts +13 -0
- package/dist/lib/types/avatar/root/AvatarRootContext.d.ts +10 -0
- package/dist/lib/types/button/Button.d.ts +34 -0
- package/dist/lib/types/button/index.d.ts +2 -0
- package/dist/lib/types/checkbox/index.d.ts +3 -0
- package/dist/lib/types/checkbox/index.parts.d.ts +2 -0
- package/dist/lib/types/checkbox/indicator/CheckboxIndicator.d.ts +20 -0
- package/dist/lib/types/checkbox/root/CheckboxRoot.d.ts +56 -0
- package/dist/lib/types/checkbox/root/CheckboxRootContext.d.ts +7 -0
- package/dist/lib/types/checkbox/utils/getCheckboxStateAttributesMapping.d.ts +3 -0
- package/dist/lib/types/checkbox-group/CheckboxGroup.d.ts +32 -0
- package/dist/lib/types/checkbox-group/CheckboxGroupContext.d.ts +30 -0
- package/dist/lib/types/checkbox-group/index.d.ts +2 -0
- package/dist/lib/types/collapsible/index.d.ts +4 -0
- package/dist/lib/types/collapsible/index.parts.d.ts +3 -0
- package/dist/lib/types/collapsible/panel/CollapsiblePanel.d.ts +25 -0
- package/dist/lib/types/collapsible/panel/createCollapsiblePanel.d.ts +26 -0
- package/dist/lib/types/collapsible/root/CollapsibleRoot.d.ts +34 -0
- package/dist/lib/types/collapsible/root/CollapsibleRootContext.d.ts +19 -0
- package/dist/lib/types/collapsible/root/createCollapsibleTransitionStatus.d.ts +9 -0
- package/dist/lib/types/collapsible/root/stateAttributesMapping.d.ts +14 -0
- package/dist/lib/types/collapsible/trigger/CollapsibleTrigger.d.ts +28 -0
- package/dist/lib/types/combobox/arrow/ComboboxArrow.d.ts +16 -0
- package/dist/lib/types/combobox/backdrop/ComboboxBackdrop.d.ts +14 -0
- package/dist/lib/types/combobox/chip/ComboboxChip.d.ts +17 -0
- package/dist/lib/types/combobox/chip/ComboboxChipContext.d.ts +8 -0
- package/dist/lib/types/combobox/chip-remove/ComboboxChipRemove.d.ts +26 -0
- package/dist/lib/types/combobox/chips/ComboboxChips.d.ts +16 -0
- package/dist/lib/types/combobox/chips/ComboboxChipsContext.d.ts +26 -0
- package/dist/lib/types/combobox/clear/ComboboxClear.d.ts +35 -0
- package/dist/lib/types/combobox/collection/ComboboxCollection.d.ts +19 -0
- package/dist/lib/types/combobox/empty/ComboboxEmpty.d.ts +16 -0
- package/dist/lib/types/combobox/group/ComboboxGroup.d.ts +19 -0
- package/dist/lib/types/combobox/group/ComboboxGroupContext.d.ts +9 -0
- package/dist/lib/types/combobox/group-label/ComboboxGroupLabel.d.ts +11 -0
- package/dist/lib/types/combobox/icon/ComboboxIcon.d.ts +12 -0
- package/dist/lib/types/combobox/index.d.ts +29 -0
- package/dist/lib/types/combobox/index.parts.d.ts +28 -0
- package/dist/lib/types/combobox/input/ComboboxInput.d.ts +36 -0
- package/dist/lib/types/combobox/input-group/ComboboxInputGroup.d.ts +24 -0
- package/dist/lib/types/combobox/item/ComboboxItem.d.ts +40 -0
- package/dist/lib/types/combobox/item/ComboboxItemContext.d.ts +9 -0
- package/dist/lib/types/combobox/item-indicator/ComboboxItemIndicator.d.ts +22 -0
- package/dist/lib/types/combobox/label/ComboboxLabel.d.ts +22 -0
- package/dist/lib/types/combobox/list/ComboboxList.d.ts +24 -0
- package/dist/lib/types/combobox/popup/ComboboxPopup.d.ts +35 -0
- package/dist/lib/types/combobox/portal/ComboboxPortal.d.ts +25 -0
- package/dist/lib/types/combobox/portal/ComboboxPortalContext.d.ts +5 -0
- package/dist/lib/types/combobox/positioner/ComboboxPositioner.d.ts +37 -0
- package/dist/lib/types/combobox/positioner/ComboboxPositionerContext.d.ts +11 -0
- package/dist/lib/types/combobox/root/AriaCombobox.d.ts +82 -0
- package/dist/lib/types/combobox/root/ComboboxRoot.d.ts +180 -0
- package/dist/lib/types/combobox/root/ComboboxRootContext.d.ts +99 -0
- package/dist/lib/types/combobox/root/utils/useFilter.d.ts +25 -0
- package/dist/lib/types/combobox/root/utils/useFilteredItems.d.ts +5 -0
- package/dist/lib/types/combobox/row/ComboboxRow.d.ts +14 -0
- package/dist/lib/types/combobox/row/ComboboxRowContext.d.ts +3 -0
- package/dist/lib/types/combobox/separator/ComboboxSeparator.d.ts +21 -0
- package/dist/lib/types/combobox/status/ComboboxStatus.d.ts +17 -0
- package/dist/lib/types/combobox/store/ComboboxItemRegistry.d.ts +39 -0
- package/dist/lib/types/combobox/store/ComboboxStore.d.ts +65 -0
- package/dist/lib/types/combobox/trigger/ComboboxTrigger.d.ts +36 -0
- package/dist/lib/types/combobox/types.d.ts +15 -0
- package/dist/lib/types/combobox/utils/ComboboxInternalDismissButton.d.ts +9 -0
- package/dist/lib/types/combobox/utils/comboboxPopupId.d.ts +5 -0
- package/dist/lib/types/combobox/utils/createInitialLiveRegionTextMutation.d.ts +7 -0
- package/dist/lib/types/combobox/utils/handleInputPress.d.ts +7 -0
- package/dist/lib/types/combobox/utils/parts.d.ts +4 -0
- package/dist/lib/types/combobox/utils/stateAttributesMapping.d.ts +58 -0
- package/dist/lib/types/combobox/value/ComboboxValue.d.ts +20 -0
- package/dist/lib/types/context-menu/index.d.ts +19 -0
- package/dist/lib/types/context-menu/index.parts.d.ts +19 -0
- package/dist/lib/types/context-menu/root/ContextMenuRoot.d.ts +21 -0
- package/dist/lib/types/context-menu/root/ContextMenuRootContext.d.ts +19 -0
- package/dist/lib/types/context-menu/trigger/ContextMenuTrigger.d.ts +21 -0
- package/dist/lib/types/csp-provider/CSPProvider.d.ts +14 -0
- package/dist/lib/types/csp-provider/index.d.ts +2 -0
- package/dist/lib/types/dialog/backdrop/DialogBackdrop.d.ts +18 -0
- package/dist/lib/types/dialog/close/DialogClose.d.ts +26 -0
- package/dist/lib/types/dialog/description/DialogDescription.d.ts +11 -0
- package/dist/lib/types/dialog/index.d.ts +10 -0
- package/dist/lib/types/dialog/index.parts.d.ts +10 -0
- package/dist/lib/types/dialog/popup/DialogPopup.d.ts +24 -0
- package/dist/lib/types/dialog/portal/DialogPortal.d.ts +17 -0
- package/dist/lib/types/dialog/portal/DialogPortalContext.d.ts +8 -0
- package/dist/lib/types/dialog/root/DialogRoot.d.ts +44 -0
- package/dist/lib/types/dialog/root/DialogRootContext.d.ts +38 -0
- package/dist/lib/types/dialog/store/DialogHandle.d.ts +11 -0
- package/dist/lib/types/dialog/store/DialogStore.d.ts +20 -0
- package/dist/lib/types/dialog/title/DialogTitle.d.ts +11 -0
- package/dist/lib/types/dialog/trigger/DialogTrigger.d.ts +30 -0
- package/dist/lib/types/dialog/utils/mergeDialogStyles.d.ts +2 -0
- package/dist/lib/types/dialog/utils/stateAttributesMapping.d.ts +20 -0
- package/dist/lib/types/dialog/viewport/DialogViewport.d.ts +16 -0
- package/dist/lib/types/direction-provider/DirectionProvider.d.ts +13 -0
- package/dist/lib/types/direction-provider/index.d.ts +4 -0
- package/dist/lib/types/drawer/backdrop/DrawerBackdrop.d.ts +24 -0
- package/dist/lib/types/drawer/backdrop/DrawerBackdropCssVars.d.ts +7 -0
- package/dist/lib/types/drawer/content/DrawerContent.d.ts +14 -0
- package/dist/lib/types/drawer/content/DrawerContentDataAttributes.d.ts +1 -0
- package/dist/lib/types/drawer/handle.d.ts +14 -0
- package/dist/lib/types/drawer/indent/DrawerIndent.d.ts +16 -0
- package/dist/lib/types/drawer/indent-background/DrawerIndentBackground.d.ts +23 -0
- package/dist/lib/types/drawer/index.d.ts +17 -0
- package/dist/lib/types/drawer/index.parts.d.ts +16 -0
- package/dist/lib/types/drawer/popup/DrawerPopup.d.ts +46 -0
- package/dist/lib/types/drawer/popup/DrawerPopupCssVars.d.ts +37 -0
- package/dist/lib/types/drawer/popup/DrawerPopupDataAttributes.d.ts +25 -0
- package/dist/lib/types/drawer/provider/DrawerProvider.d.ts +15 -0
- package/dist/lib/types/drawer/provider/DrawerProviderContext.d.ts +21 -0
- package/dist/lib/types/drawer/root/DrawerRoot.d.ts +65 -0
- package/dist/lib/types/drawer/root/DrawerRootContext.d.ts +68 -0
- package/dist/lib/types/drawer/root/createDrawerSnapPoints.d.ts +24 -0
- package/dist/lib/types/drawer/swipe-area/DrawerSwipeArea.d.ts +43 -0
- package/dist/lib/types/drawer/swipe-area/DrawerSwipeAreaDataAttributes.d.ts +15 -0
- package/dist/lib/types/drawer/viewport/DrawerViewport.d.ts +31 -0
- package/dist/lib/types/drawer/viewport/DrawerViewportContext.d.ts +12 -0
- package/dist/lib/types/drawer/viewport/DrawerViewportCssVars.d.ts +8 -0
- package/dist/lib/types/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardContext.d.ts +14 -0
- package/dist/lib/types/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardProvider.d.ts +14 -0
- package/dist/lib/types/field/control/FieldControl.d.ts +35 -0
- package/dist/lib/types/field/description/FieldDescription.d.ts +16 -0
- package/dist/lib/types/field/error/FieldError.d.ts +19 -0
- package/dist/lib/types/field/index.d.ts +8 -0
- package/dist/lib/types/field/index.parts.d.ts +8 -0
- package/dist/lib/types/field/item/FieldItem.d.ts +16 -0
- package/dist/lib/types/field/item/FieldItemContext.d.ts +6 -0
- package/dist/lib/types/field/label/FieldLabel.d.ts +24 -0
- package/dist/lib/types/field/root/FieldRoot.d.ts +30 -0
- package/dist/lib/types/field/root/createFieldValidation.d.ts +22 -0
- package/dist/lib/types/field/validity/FieldValidity.d.ts +16 -0
- package/dist/lib/types/fieldset/index.d.ts +3 -0
- package/dist/lib/types/fieldset/index.parts.d.ts +2 -0
- package/dist/lib/types/fieldset/legend/FieldsetLegend.d.ts +21 -0
- package/dist/lib/types/fieldset/root/FieldsetRoot.d.ts +21 -0
- package/dist/lib/types/fieldset/root/FieldsetRootContext.d.ts +11 -0
- package/dist/lib/types/form/Form.d.ts +39 -0
- package/dist/lib/types/form/index.d.ts +2 -0
- package/dist/lib/types/index.d.ts +41 -0
- package/dist/lib/types/input/Input.d.ts +20 -0
- package/dist/lib/types/input/index.d.ts +2 -0
- package/dist/lib/types/internals/buttonSemantics.d.ts +10 -0
- package/dist/lib/types/internals/clamp.d.ts +1 -0
- package/dist/lib/types/internals/composeEventHandlers.d.ts +11 -0
- package/dist/lib/types/internals/constants.d.ts +4 -0
- package/dist/lib/types/internals/createBaseUIEventDetails.d.ts +57 -0
- package/dist/lib/types/internals/createTransitionStatus.d.ts +9 -0
- package/dist/lib/types/internals/csp-context/CSPContext.d.ts +7 -0
- package/dist/lib/types/internals/csp-context/index.d.ts +2 -0
- package/dist/lib/types/internals/direction-context/DirectionContext.d.ts +6 -0
- package/dist/lib/types/internals/direction-context/index.d.ts +2 -0
- package/dist/lib/types/internals/field-constants.d.ts +44 -0
- package/dist/lib/types/internals/field-root-context/FieldRootContext.d.ts +31 -0
- package/dist/lib/types/internals/field-root-context/index.d.ts +2 -0
- package/dist/lib/types/internals/filter.d.ts +18 -0
- package/dist/lib/types/internals/form-context/FormContext.d.ts +13 -0
- package/dist/lib/types/internals/form-context/index.d.ts +3 -0
- package/dist/lib/types/internals/form-types.d.ts +11 -0
- package/dist/lib/types/internals/getStateAttributesProps.d.ts +4 -0
- package/dist/lib/types/internals/installOwnedEventHandlers.d.ts +3 -0
- package/dist/lib/types/internals/isSolidAccessor.d.ts +6 -0
- package/dist/lib/types/internals/itemEquality.d.ts +17 -0
- package/dist/lib/types/internals/labelable-provider/LabelableContext.d.ts +18 -0
- package/dist/lib/types/internals/labelable-provider/LabelableProvider.d.ts +11 -0
- package/dist/lib/types/internals/labelable-provider/index.d.ts +2 -0
- package/dist/lib/types/internals/mergeStyleValue.d.ts +8 -0
- package/dist/lib/types/internals/mergeStyles.d.ts +6 -0
- package/dist/lib/types/internals/overlay/FloatingRootStore.d.ts +49 -0
- package/dist/lib/types/internals/overlay/FloatingTree.d.ts +48 -0
- package/dist/lib/types/internals/overlay/FocusGuard.d.ts +2 -0
- package/dist/lib/types/internals/overlay/FocusManager.d.ts +30 -0
- package/dist/lib/types/internals/overlay/InternalBackdrop.d.ts +6 -0
- package/dist/lib/types/internals/overlay/PopupHandle.d.ts +47 -0
- package/dist/lib/types/internals/overlay/PopupPortal.d.ts +37 -0
- package/dist/lib/types/internals/overlay/PopupStore.d.ts +89 -0
- package/dist/lib/types/internals/overlay/PopupTriggerMap.d.ts +11 -0
- package/dist/lib/types/internals/overlay/PopupViewport.d.ts +16 -0
- package/dist/lib/types/internals/overlay/ReactiveStore.d.ts +26 -0
- package/dist/lib/types/internals/overlay/TriggerFocusGuards.d.ts +14 -0
- package/dist/lib/types/internals/overlay/adaptiveOrigin.d.ts +2 -0
- package/dist/lib/types/internals/overlay/compositeNavigation.d.ts +20 -0
- package/dist/lib/types/internals/overlay/createAnchorPositioning.d.ts +57 -0
- package/dist/lib/types/internals/overlay/createAnchoredPopupScrollLock.d.ts +12 -0
- package/dist/lib/types/internals/overlay/createClickInteraction.d.ts +20 -0
- package/dist/lib/types/internals/overlay/createClientPoint.d.ts +12 -0
- package/dist/lib/types/internals/overlay/createContextMenuInteraction.d.ts +17 -0
- package/dist/lib/types/internals/overlay/createDelayGroup.d.ts +18 -0
- package/dist/lib/types/internals/overlay/createDismiss.d.ts +27 -0
- package/dist/lib/types/internals/overlay/createFloatingPosition.d.ts +22 -0
- package/dist/lib/types/internals/overlay/createFocusInteraction.d.ts +14 -0
- package/dist/lib/types/internals/overlay/createHoverInteraction.d.ts +30 -0
- package/dist/lib/types/internals/overlay/createInitialPositioning.d.ts +3 -0
- package/dist/lib/types/internals/overlay/createListNavigation.d.ts +26 -0
- package/dist/lib/types/internals/overlay/createPopupAutoResize.d.ts +18 -0
- package/dist/lib/types/internals/overlay/createPopupPresence.d.ts +18 -0
- package/dist/lib/types/internals/overlay/createSwipeDismiss.d.ts +107 -0
- package/dist/lib/types/internals/overlay/createTypeahead.d.ts +20 -0
- package/dist/lib/types/internals/overlay/dom.d.ts +19 -0
- package/dist/lib/types/internals/overlay/eventEmitter.d.ts +7 -0
- package/dist/lib/types/internals/overlay/getElementAtPoint.d.ts +8 -0
- package/dist/lib/types/internals/overlay/index.d.ts +37 -0
- package/dist/lib/types/internals/overlay/inlineRect.d.ts +32 -0
- package/dist/lib/types/internals/overlay/markOthers.d.ts +6 -0
- package/dist/lib/types/internals/overlay/popupStateMapping.d.ts +46 -0
- package/dist/lib/types/internals/overlay/safePolygon.d.ts +24 -0
- package/dist/lib/types/internals/overlay/scrollLock.d.ts +10 -0
- package/dist/lib/types/internals/overlay/tabbable.d.ts +11 -0
- package/dist/lib/types/internals/platform.d.ts +1 -0
- package/dist/lib/types/internals/reason-parts.d.ts +35 -0
- package/dist/lib/types/internals/reasons.d.ts +4 -0
- package/dist/lib/types/internals/resolveClass.d.ts +3 -0
- package/dist/lib/types/internals/resolveStyle.d.ts +3 -0
- package/dist/lib/types/internals/runOnceAnimationsFinish.d.ts +4 -0
- package/dist/lib/types/internals/scrollable.d.ts +18 -0
- package/dist/lib/types/internals/setRef.d.ts +2 -0
- package/dist/lib/types/internals/stateAttributesMapping.d.ts +8 -0
- package/dist/lib/types/internals/types.d.ts +2 -0
- package/dist/lib/types/internals/valueLabel.d.ts +28 -0
- package/dist/lib/types/internals/withoutComponentBinding.d.ts +7 -0
- package/dist/lib/types/menu/arrow/MenuArrow.d.ts +16 -0
- package/dist/lib/types/menu/backdrop/MenuBackdrop.d.ts +14 -0
- package/dist/lib/types/menu/checkbox-item/MenuCheckboxItem.d.ts +37 -0
- package/dist/lib/types/menu/checkbox-item/MenuCheckboxItemContext.d.ts +6 -0
- package/dist/lib/types/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.d.ts +18 -0
- package/dist/lib/types/menu/group/MenuGroup.d.ts +11 -0
- package/dist/lib/types/menu/group/MenuGroupContext.d.ts +9 -0
- package/dist/lib/types/menu/group-label/MenuGroupLabel.d.ts +11 -0
- package/dist/lib/types/menu/index.d.ts +20 -0
- package/dist/lib/types/menu/index.parts.d.ts +21 -0
- package/dist/lib/types/menu/item/MenuItem.d.ts +28 -0
- package/dist/lib/types/menu/item/createMenuItem.d.ts +24 -0
- package/dist/lib/types/menu/link-item/MenuLinkItem.d.ts +25 -0
- package/dist/lib/types/menu/popup/MenuPopup.d.ts +28 -0
- package/dist/lib/types/menu/portal/MenuPortal.d.ts +17 -0
- package/dist/lib/types/menu/portal/MenuPortalContext.d.ts +8 -0
- package/dist/lib/types/menu/positioner/MenuPositioner.d.ts +39 -0
- package/dist/lib/types/menu/positioner/MenuPositionerContext.d.ts +5 -0
- package/dist/lib/types/menu/radio-group/MenuRadioGroup.d.ts +24 -0
- package/dist/lib/types/menu/radio-group/MenuRadioGroupContext.d.ts +11 -0
- package/dist/lib/types/menu/radio-item/MenuRadioItem.d.ts +30 -0
- package/dist/lib/types/menu/radio-item/MenuRadioItemContext.d.ts +6 -0
- package/dist/lib/types/menu/radio-item-indicator/MenuRadioItemIndicator.d.ts +18 -0
- package/dist/lib/types/menu/root/MenuRoot.d.ts +56 -0
- package/dist/lib/types/menu/root/MenuRootContext.d.ts +23 -0
- package/dist/lib/types/menu/store/MenuCollection.d.ts +19 -0
- package/dist/lib/types/menu/store/MenuHandle.d.ts +10 -0
- package/dist/lib/types/menu/store/MenuStore.d.ts +110 -0
- package/dist/lib/types/menu/submenu-root/MenuSubmenuRoot.d.ts +17 -0
- package/dist/lib/types/menu/submenu-root/MenuSubmenuRootContext.d.ts +8 -0
- package/dist/lib/types/menu/submenu-trigger/MenuSubmenuTrigger.d.ts +33 -0
- package/dist/lib/types/menu/trigger/MenuTrigger.d.ts +36 -0
- package/dist/lib/types/menu/utils/mergeMenuStyles.d.ts +2 -0
- package/dist/lib/types/menu/utils/stateAttributesMapping.d.ts +39 -0
- package/dist/lib/types/menu/viewport/MenuViewport.d.ts +15 -0
- package/dist/lib/types/menubar/Menubar.d.ts +23 -0
- package/dist/lib/types/menubar/MenubarContext.d.ts +34 -0
- package/dist/lib/types/menubar/index.d.ts +2 -0
- package/dist/lib/types/meter/index.d.ts +6 -0
- package/dist/lib/types/meter/index.parts.d.ts +5 -0
- package/dist/lib/types/meter/indicator/MeterIndicator.d.ts +12 -0
- package/dist/lib/types/meter/label/MeterLabel.d.ts +17 -0
- package/dist/lib/types/meter/root/MeterRoot.d.ts +28 -0
- package/dist/lib/types/meter/root/MeterRootContext.d.ts +12 -0
- package/dist/lib/types/meter/track/MeterTrack.d.ts +12 -0
- package/dist/lib/types/meter/value/MeterValue.d.ts +16 -0
- package/dist/lib/types/navigation-menu/arrow/NavigationMenuArrow.d.ts +16 -0
- package/dist/lib/types/navigation-menu/backdrop/NavigationMenuBackdrop.d.ts +14 -0
- package/dist/lib/types/navigation-menu/composite/NavigationMenuCompositeContext.d.ts +22 -0
- package/dist/lib/types/navigation-menu/content/NavigationMenuContent.d.ts +21 -0
- package/dist/lib/types/navigation-menu/icon/NavigationMenuIcon.d.ts +12 -0
- package/dist/lib/types/navigation-menu/index.d.ts +14 -0
- package/dist/lib/types/navigation-menu/index.parts.d.ts +13 -0
- package/dist/lib/types/navigation-menu/item/NavigationMenuItem.d.ts +15 -0
- package/dist/lib/types/navigation-menu/item/NavigationMenuItemContext.d.ts +8 -0
- package/dist/lib/types/navigation-menu/link/NavigationMenuLink.d.ts +20 -0
- package/dist/lib/types/navigation-menu/list/NavigationMenuList.d.ts +12 -0
- package/dist/lib/types/navigation-menu/popup/NavigationMenuPopup.d.ts +23 -0
- package/dist/lib/types/navigation-menu/portal/NavigationMenuPortal.d.ts +17 -0
- package/dist/lib/types/navigation-menu/portal/NavigationMenuPortalContext.d.ts +8 -0
- package/dist/lib/types/navigation-menu/positioner/NavigationMenuPositioner.d.ts +37 -0
- package/dist/lib/types/navigation-menu/positioner/NavigationMenuPositionerContext.d.ts +5 -0
- package/dist/lib/types/navigation-menu/root/NavigationMenuRoot.d.ts +39 -0
- package/dist/lib/types/navigation-menu/root/NavigationMenuRootContext.d.ts +19 -0
- package/dist/lib/types/navigation-menu/store/NavigationMenuStore.d.ts +64 -0
- package/dist/lib/types/navigation-menu/trigger/NavigationMenuTrigger.d.ts +27 -0
- package/dist/lib/types/navigation-menu/utils/mergeNavigationMenuStyles.d.ts +2 -0
- package/dist/lib/types/navigation-menu/viewport/NavigationMenuViewport.d.ts +11 -0
- package/dist/lib/types/number-field/decrement/NumberFieldDecrement.d.ts +12 -0
- package/dist/lib/types/number-field/group/NumberFieldGroup.d.ts +12 -0
- package/dist/lib/types/number-field/increment/NumberFieldIncrement.d.ts +12 -0
- package/dist/lib/types/number-field/increment/NumberFieldStepperButton.d.ts +26 -0
- package/dist/lib/types/number-field/index.d.ts +8 -0
- package/dist/lib/types/number-field/index.parts.d.ts +7 -0
- package/dist/lib/types/number-field/input/NumberFieldInput.d.ts +25 -0
- package/dist/lib/types/number-field/root/NumberFieldRoot.d.ts +55 -0
- package/dist/lib/types/number-field/root/NumberFieldRootContext.d.ts +39 -0
- package/dist/lib/types/number-field/root/createPressAndHold.d.ts +24 -0
- package/dist/lib/types/number-field/scrub-area/NumberFieldScrubArea.d.ts +20 -0
- package/dist/lib/types/number-field/scrub-area/NumberFieldScrubAreaContext.d.ts +13 -0
- package/dist/lib/types/number-field/scrub-area-cursor/NumberFieldScrubAreaCursor.d.ts +12 -0
- package/dist/lib/types/number-field/utils/format.d.ts +2 -0
- package/dist/lib/types/number-field/utils/getViewportRect.d.ts +6 -0
- package/dist/lib/types/number-field/utils/parse.d.ts +40 -0
- package/dist/lib/types/number-field/utils/platform.d.ts +3 -0
- package/dist/lib/types/number-field/utils/stateAttributesMapping.d.ts +10 -0
- package/dist/lib/types/number-field/utils/types.d.ts +16 -0
- package/dist/lib/types/number-field/utils/validate.d.ts +9 -0
- package/dist/lib/types/otp-field/index.d.ts +3 -0
- package/dist/lib/types/otp-field/index.parts.d.ts +3 -0
- package/dist/lib/types/otp-field/input/OTPFieldInput.d.ts +29 -0
- package/dist/lib/types/otp-field/root/OTPFieldRoot.d.ts +56 -0
- package/dist/lib/types/otp-field/root/OTPFieldRootContext.d.ts +45 -0
- package/dist/lib/types/otp-field/utils/otp.d.ts +14 -0
- package/dist/lib/types/otp-field/utils/stateAttributesMapping.d.ts +5 -0
- package/dist/lib/types/popover/arrow/PopoverArrow.d.ts +16 -0
- package/dist/lib/types/popover/backdrop/PopoverBackdrop.d.ts +14 -0
- package/dist/lib/types/popover/close/PopoverClose.d.ts +25 -0
- package/dist/lib/types/popover/description/PopoverDescription.d.ts +11 -0
- package/dist/lib/types/popover/index.d.ts +12 -0
- package/dist/lib/types/popover/index.parts.d.ts +12 -0
- package/dist/lib/types/popover/popup/PopoverPopup.d.ts +26 -0
- package/dist/lib/types/popover/portal/PopoverPortal.d.ts +17 -0
- package/dist/lib/types/popover/portal/PopoverPortalContext.d.ts +8 -0
- package/dist/lib/types/popover/positioner/PopoverPositioner.d.ts +38 -0
- package/dist/lib/types/popover/positioner/PopoverPositionerContext.d.ts +5 -0
- package/dist/lib/types/popover/root/PopoverRoot.d.ts +38 -0
- package/dist/lib/types/popover/root/PopoverRootContext.d.ts +25 -0
- package/dist/lib/types/popover/store/PopoverHandle.d.ts +10 -0
- package/dist/lib/types/popover/store/PopoverStore.d.ts +65 -0
- package/dist/lib/types/popover/title/PopoverTitle.d.ts +11 -0
- package/dist/lib/types/popover/trigger/PopoverTrigger.d.ts +33 -0
- package/dist/lib/types/popover/utils/ClosePartContext.d.ts +10 -0
- package/dist/lib/types/popover/utils/mergePopoverStyles.d.ts +2 -0
- package/dist/lib/types/popover/utils/stateAttributesMapping.d.ts +26 -0
- package/dist/lib/types/popover/viewport/PopoverViewport.d.ts +15 -0
- package/dist/lib/types/preview-card/arrow/PreviewCardArrow.d.ts +16 -0
- package/dist/lib/types/preview-card/backdrop/PreviewCardBackdrop.d.ts +14 -0
- package/dist/lib/types/preview-card/index.d.ts +9 -0
- package/dist/lib/types/preview-card/index.parts.d.ts +9 -0
- package/dist/lib/types/preview-card/popup/PreviewCardPopup.d.ts +23 -0
- package/dist/lib/types/preview-card/portal/PreviewCardPortal.d.ts +17 -0
- package/dist/lib/types/preview-card/portal/PreviewCardPortalContext.d.ts +8 -0
- package/dist/lib/types/preview-card/positioner/PreviewCardPositioner.d.ts +38 -0
- package/dist/lib/types/preview-card/positioner/PreviewCardPositionerContext.d.ts +5 -0
- package/dist/lib/types/preview-card/root/PreviewCardRoot.d.ts +37 -0
- package/dist/lib/types/preview-card/root/PreviewCardRootContext.d.ts +12 -0
- package/dist/lib/types/preview-card/store/PreviewCardHandle.d.ts +10 -0
- package/dist/lib/types/preview-card/store/PreviewCardStore.d.ts +34 -0
- package/dist/lib/types/preview-card/trigger/PreviewCardTrigger.d.ts +20 -0
- package/dist/lib/types/preview-card/utils/mergePreviewCardStyles.d.ts +2 -0
- package/dist/lib/types/preview-card/utils/stateAttributesMapping.d.ts +32 -0
- package/dist/lib/types/preview-card/viewport/PreviewCardViewport.d.ts +14 -0
- package/dist/lib/types/progress/index.d.ts +6 -0
- package/dist/lib/types/progress/index.parts.d.ts +6 -0
- package/dist/lib/types/progress/indicator/ProgressIndicator.d.ts +12 -0
- package/dist/lib/types/progress/label/ProgressLabel.d.ts +17 -0
- package/dist/lib/types/progress/root/ProgressRoot.d.ts +31 -0
- package/dist/lib/types/progress/root/ProgressRootContext.d.ts +13 -0
- package/dist/lib/types/progress/root/stateAttributesMapping.d.ts +3 -0
- package/dist/lib/types/progress/track/ProgressTrack.d.ts +12 -0
- package/dist/lib/types/progress/value/ProgressValue.d.ts +16 -0
- package/dist/lib/types/radio/index.d.ts +3 -0
- package/dist/lib/types/radio/index.parts.d.ts +2 -0
- package/dist/lib/types/radio/indicator/RadioIndicator.d.ts +20 -0
- package/dist/lib/types/radio/root/RadioRoot.d.ts +39 -0
- package/dist/lib/types/radio/root/RadioRootContext.d.ts +7 -0
- package/dist/lib/types/radio-group/RadioGroup.d.ts +43 -0
- package/dist/lib/types/radio-group/RadioGroupContext.d.ts +33 -0
- package/dist/lib/types/radio-group/index.d.ts +2 -0
- package/dist/lib/types/scroll-area/constants.d.ts +2 -0
- package/dist/lib/types/scroll-area/content/ScrollAreaContent.d.ts +12 -0
- package/dist/lib/types/scroll-area/corner/ScrollAreaCorner.d.ts +11 -0
- package/dist/lib/types/scroll-area/index.d.ts +7 -0
- package/dist/lib/types/scroll-area/index.parts.d.ts +6 -0
- package/dist/lib/types/scroll-area/root/ScrollAreaRoot.d.ts +58 -0
- package/dist/lib/types/scroll-area/root/ScrollAreaRootContext.d.ts +44 -0
- package/dist/lib/types/scroll-area/root/stateAttributes.d.ts +3 -0
- package/dist/lib/types/scroll-area/scrollbar/ScrollAreaScrollbar.d.ts +28 -0
- package/dist/lib/types/scroll-area/scrollbar/ScrollAreaScrollbarContext.d.ts +7 -0
- package/dist/lib/types/scroll-area/thumb/ScrollAreaThumb.d.ts +22 -0
- package/dist/lib/types/scroll-area/utils/dom.d.ts +2 -0
- package/dist/lib/types/scroll-area/utils/eventTarget.d.ts +2 -0
- package/dist/lib/types/scroll-area/utils/getOffset.d.ts +1 -0
- package/dist/lib/types/scroll-area/utils/scrollEdges.d.ts +1 -0
- package/dist/lib/types/scroll-area/viewport/ScrollAreaViewport.d.ts +22 -0
- package/dist/lib/types/scroll-area/viewport/ScrollAreaViewportContext.d.ts +7 -0
- package/dist/lib/types/select/arrow/SelectArrow.d.ts +16 -0
- package/dist/lib/types/select/backdrop/SelectBackdrop.d.ts +14 -0
- package/dist/lib/types/select/group/SelectGroup.d.ts +11 -0
- package/dist/lib/types/select/group/SelectGroupContext.d.ts +9 -0
- package/dist/lib/types/select/group-label/SelectGroupLabel.d.ts +11 -0
- package/dist/lib/types/select/icon/SelectIcon.d.ts +12 -0
- package/dist/lib/types/select/index.d.ts +20 -0
- package/dist/lib/types/select/index.parts.d.ts +19 -0
- package/dist/lib/types/select/item/SelectItem.d.ts +32 -0
- package/dist/lib/types/select/item/SelectItemContext.d.ts +12 -0
- package/dist/lib/types/select/item-indicator/SelectItemIndicator.d.ts +18 -0
- package/dist/lib/types/select/item-text/SelectItemText.d.ts +11 -0
- package/dist/lib/types/select/label/SelectLabel.d.ts +17 -0
- package/dist/lib/types/select/list/SelectList.d.ts +16 -0
- package/dist/lib/types/select/popup/SelectPopup.d.ts +26 -0
- package/dist/lib/types/select/portal/SelectPortal.d.ts +16 -0
- package/dist/lib/types/select/portal/SelectPortalContext.d.ts +4 -0
- package/dist/lib/types/select/positioner/SelectPositioner.d.ts +37 -0
- package/dist/lib/types/select/positioner/SelectPositionerContext.d.ts +16 -0
- package/dist/lib/types/select/root/SelectRoot.d.ts +52 -0
- package/dist/lib/types/select/root/SelectRootContext.d.ts +63 -0
- package/dist/lib/types/select/scroll-arrow/SelectScrollArrow.d.ts +22 -0
- package/dist/lib/types/select/scroll-down-arrow/SelectScrollDownArrow.d.ts +15 -0
- package/dist/lib/types/select/scroll-up-arrow/SelectScrollUpArrow.d.ts +15 -0
- package/dist/lib/types/select/separator/SelectSeparator.d.ts +17 -0
- package/dist/lib/types/select/store/SelectCollection.d.ts +25 -0
- package/dist/lib/types/select/store/SelectStore.d.ts +82 -0
- package/dist/lib/types/select/trigger/SelectTrigger.d.ts +35 -0
- package/dist/lib/types/select/types.d.ts +10 -0
- package/dist/lib/types/select/utils/equality.d.ts +2 -0
- package/dist/lib/types/select/utils/mergeSelectStyles.d.ts +1 -0
- package/dist/lib/types/select/utils/scrollEdges.d.ts +3 -0
- package/dist/lib/types/select/utils/stateAttributesMapping.d.ts +37 -0
- package/dist/lib/types/select/utils/value.d.ts +7 -0
- package/dist/lib/types/select/value/SelectValue.d.ts +18 -0
- package/dist/lib/types/separator/Separator.d.ts +19 -0
- package/dist/lib/types/separator/index.d.ts +2 -0
- package/dist/lib/types/slider/control/SliderControl.d.ts +18 -0
- package/dist/lib/types/slider/index.d.ts +8 -0
- package/dist/lib/types/slider/index.parts.d.ts +7 -0
- package/dist/lib/types/slider/indicator/SliderIndicator.d.ts +12 -0
- package/dist/lib/types/slider/label/SliderLabel.d.ts +17 -0
- package/dist/lib/types/slider/root/SliderRoot.d.ts +57 -0
- package/dist/lib/types/slider/root/SliderRootContext.d.ts +63 -0
- package/dist/lib/types/slider/stateAttributesMapping.d.ts +14 -0
- package/dist/lib/types/slider/thumb/SliderThumb.d.ts +31 -0
- package/dist/lib/types/slider/thumb/SliderThumbDataAttributes.d.ts +11 -0
- package/dist/lib/types/slider/thumb/prehydrationScript.d.ts +1 -0
- package/dist/lib/types/slider/track/SliderTrack.d.ts +12 -0
- package/dist/lib/types/slider/utils/dom.d.ts +4 -0
- package/dist/lib/types/slider/utils/getPushedThumbValues.d.ts +1 -0
- package/dist/lib/types/slider/utils/getSliderValue.d.ts +1 -0
- package/dist/lib/types/slider/utils/math.d.ts +4 -0
- package/dist/lib/types/slider/utils/resolveThumbCollision.d.ts +7 -0
- package/dist/lib/types/slider/utils/roundValueToStep.d.ts +2 -0
- package/dist/lib/types/slider/utils/validateMinimumDistance.d.ts +1 -0
- package/dist/lib/types/slider/value/SliderValue.d.ts +16 -0
- package/dist/lib/types/switch/index.d.ts +3 -0
- package/dist/lib/types/switch/index.parts.d.ts +2 -0
- package/dist/lib/types/switch/root/SwitchRoot.d.ts +55 -0
- package/dist/lib/types/switch/root/SwitchRootContext.d.ts +7 -0
- package/dist/lib/types/switch/stateAttributesMapping.d.ts +9 -0
- package/dist/lib/types/switch/thumb/SwitchThumb.d.ts +12 -0
- package/dist/lib/types/tabs/index.d.ts +6 -0
- package/dist/lib/types/tabs/index.parts.d.ts +5 -0
- package/dist/lib/types/tabs/indicator/TabsIndicator.d.ts +22 -0
- package/dist/lib/types/tabs/indicator/TabsIndicatorCssVars.d.ts +8 -0
- package/dist/lib/types/tabs/indicator/prehydrationScript.d.ts +1 -0
- package/dist/lib/types/tabs/list/TabsList.d.ts +21 -0
- package/dist/lib/types/tabs/list/TabsListContext.d.ts +14 -0
- package/dist/lib/types/tabs/panel/TabsPanel.d.ts +30 -0
- package/dist/lib/types/tabs/panel/TabsPanelDataAttributes.d.ts +6 -0
- package/dist/lib/types/tabs/root/TabsRoot.d.ts +38 -0
- package/dist/lib/types/tabs/root/TabsRootContext.d.ts +43 -0
- package/dist/lib/types/tabs/root/TabsRootDataAttributes.d.ts +4 -0
- package/dist/lib/types/tabs/root/stateAttributesMapping.d.ts +8 -0
- package/dist/lib/types/tabs/tab/TabsTab.d.ts +59 -0
- package/dist/lib/types/tabs/tab/TabsTabDataAttributes.d.ts +6 -0
- package/dist/lib/types/toast/action/ToastAction.d.ts +30 -0
- package/dist/lib/types/toast/arrow/ToastArrow.d.ts +18 -0
- package/dist/lib/types/toast/close/ToastClose.d.ts +29 -0
- package/dist/lib/types/toast/content/ToastContent.d.ts +15 -0
- package/dist/lib/types/toast/createToastManager.d.ts +15 -0
- package/dist/lib/types/toast/description/ToastDescription.d.ts +16 -0
- package/dist/lib/types/toast/index.d.ts +17 -0
- package/dist/lib/types/toast/index.parts.d.ts +11 -0
- package/dist/lib/types/toast/portal/ToastPortal.d.ts +20 -0
- package/dist/lib/types/toast/positioner/ToastPositioner.d.ts +42 -0
- package/dist/lib/types/toast/positioner/ToastPositionerContext.d.ts +6 -0
- package/dist/lib/types/toast/provider/ToastProvider.d.ts +28 -0
- package/dist/lib/types/toast/provider/ToastProviderContext.d.ts +5 -0
- package/dist/lib/types/toast/root/ToastRoot.d.ts +39 -0
- package/dist/lib/types/toast/root/ToastRootContext.d.ts +14 -0
- package/dist/lib/types/toast/store/ToastStore.d.ts +60 -0
- package/dist/lib/types/toast/title/ToastTitle.d.ts +13 -0
- package/dist/lib/types/toast/types.d.ts +77 -0
- package/dist/lib/types/toast/useToastManager.d.ts +11 -0
- package/dist/lib/types/toast/utils/createToastLabelPart.d.ts +17 -0
- package/dist/lib/types/toast/utils/focusVisible.d.ts +6 -0
- package/dist/lib/types/toast/utils/generateToastId.d.ts +5 -0
- package/dist/lib/types/toast/utils/isRenderableNode.d.ts +6 -0
- package/dist/lib/types/toast/utils/mergeToastStyles.d.ts +2 -0
- package/dist/lib/types/toast/utils/resolvePromiseOptions.d.ts +2 -0
- package/dist/lib/types/toast/viewport/ToastViewport.d.ts +13 -0
- package/dist/lib/types/toggle/Toggle.d.ts +40 -0
- package/dist/lib/types/toggle/index.d.ts +2 -0
- package/dist/lib/types/toggle-group/ToggleGroup.d.ts +37 -0
- package/dist/lib/types/toggle-group/ToggleGroupContext.d.ts +25 -0
- package/dist/lib/types/toggle-group/index.d.ts +2 -0
- package/dist/lib/types/toolbar/ToolbarItemOwnerContext.d.ts +10 -0
- package/dist/lib/types/toolbar/button/ToolbarButton.d.ts +32 -0
- package/dist/lib/types/toolbar/createToolbarItem.d.ts +13 -0
- package/dist/lib/types/toolbar/group/ToolbarGroup.d.ts +16 -0
- package/dist/lib/types/toolbar/group/ToolbarGroupContext.d.ts +8 -0
- package/dist/lib/types/toolbar/index.d.ts +8 -0
- package/dist/lib/types/toolbar/index.parts.d.ts +7 -0
- package/dist/lib/types/toolbar/input/ToolbarInput.d.ts +29 -0
- package/dist/lib/types/toolbar/link/ToolbarLink.d.ts +14 -0
- package/dist/lib/types/toolbar/root/ToolbarRoot.d.ts +29 -0
- package/dist/lib/types/toolbar/root/ToolbarRootContext.d.ts +23 -0
- package/dist/lib/types/toolbar/separator/ToolbarSeparator.d.ts +16 -0
- package/dist/lib/types/tooltip/arrow/TooltipArrow.d.ts +17 -0
- package/dist/lib/types/tooltip/index.d.ts +9 -0
- package/dist/lib/types/tooltip/index.parts.d.ts +9 -0
- package/dist/lib/types/tooltip/popup/TooltipPopup.d.ts +23 -0
- package/dist/lib/types/tooltip/portal/TooltipPortal.d.ts +17 -0
- package/dist/lib/types/tooltip/portal/TooltipPortalContext.d.ts +8 -0
- package/dist/lib/types/tooltip/positioner/TooltipPositioner.d.ts +37 -0
- package/dist/lib/types/tooltip/positioner/TooltipPositionerContext.d.ts +14 -0
- package/dist/lib/types/tooltip/provider/TooltipProvider.d.ts +15 -0
- package/dist/lib/types/tooltip/provider/TooltipProviderContext.d.ts +10 -0
- package/dist/lib/types/tooltip/root/TooltipRoot.d.ts +40 -0
- package/dist/lib/types/tooltip/root/TooltipRootContext.d.ts +11 -0
- package/dist/lib/types/tooltip/store/TooltipHandle.d.ts +10 -0
- package/dist/lib/types/tooltip/store/TooltipStore.d.ts +60 -0
- package/dist/lib/types/tooltip/trigger/TooltipTrigger.d.ts +35 -0
- package/dist/lib/types/tooltip/utils/mergeTooltipStyles.d.ts +2 -0
- package/dist/lib/types/tooltip/utils/stateAttributesMapping.d.ts +68 -0
- package/dist/lib/types/tooltip/viewport/TooltipViewport.d.ts +14 -0
- package/dist/lib/types/types/index.d.ts +29 -0
- package/package.json +583 -0
|
@@ -0,0 +1,2351 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { getStateAttributesProps } from "../internals/getStateAttributesProps.js";
|
|
3
|
+
import { a as closeWatcher, k as swipe } from "../internals/reasons.js";
|
|
4
|
+
import { n as resolveClass, t as resolveStyle } from "../resolveStyle-XCSFDHAL.js";
|
|
5
|
+
import { createChangeEventDetails } from "../internals/createBaseUIEventDetails.js";
|
|
6
|
+
import { TransitionStatusDataAttributes } from "../internals/stateAttributesMapping.js";
|
|
7
|
+
import { composeEventHandlers } from "../internals/composeEventHandlers.js";
|
|
8
|
+
import { a as isElement, c as isHTMLElement, l as isInteractiveElement, m as ownerWindow, n as contains, p as ownerDocument, r as getEventTarget, t as activeElement } from "../dom-Crg_2R-j.js";
|
|
9
|
+
import { n as createTriggerRegistration } from "../PopupStore-DEs3FAEe.js";
|
|
10
|
+
import { r as popupTransitionStateMapping, t as CommonPopupDataAttributes } from "../popupStateMapping-nKoUwoke.js";
|
|
11
|
+
import { t as FocusManager } from "../FocusManager-BrbZVWME.js";
|
|
12
|
+
import { a as DialogTitle, c as DialogDescription, d as dialogTransitionStateAttributesMapping, f as mergeDialogStyles, h as useDialogRootContext, i as DialogTrigger, l as DialogClose, m as renderDialogRoot, o as DialogPortal, r as DialogViewport, s as useDialogPortalContext, t as DialogHandle } from "../DialogHandle-ATZlm9RC.js";
|
|
13
|
+
import { n as getComposedParentNode, t as findScrollableTouchTarget } from "../scrollable-CjsSxbGr.js";
|
|
14
|
+
import { t as isAndroid } from "../platform-DYukKUir.js";
|
|
15
|
+
import { a as getElementTransform, i as getDisplacement, o as getElementAtPoint, r as createSwipeDismiss, s as clamp, t as BASE_UI_SWIPE_IGNORE_SELECTOR } from "../constants-9H__9xbS.js";
|
|
16
|
+
import { Dynamic, mergeProps, ssrElement } from "@solidjs/web";
|
|
17
|
+
import { Show, createContext, createEffect, createMemo, createSignal, createUniqueId, flush, merge, omit, onCleanup, untrack, useContext } from "solid-js";
|
|
18
|
+
//#region src/drawer/popup/DrawerPopupCssVars.ts
|
|
19
|
+
var DrawerPopupCssVars = /* @__PURE__ */ function(DrawerPopupCssVars) {
|
|
20
|
+
/**
|
|
21
|
+
* The number of nested drawers that are currently open.
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
DrawerPopupCssVars["nestedDrawers"] = "--nested-drawers";
|
|
25
|
+
/**
|
|
26
|
+
* The height of the drawer popup.
|
|
27
|
+
* @type {CSS length}
|
|
28
|
+
*/
|
|
29
|
+
DrawerPopupCssVars["height"] = "--drawer-height";
|
|
30
|
+
/**
|
|
31
|
+
* The height of the frontmost open drawer in the current nested drawer stack.
|
|
32
|
+
* @type {CSS length}
|
|
33
|
+
*/
|
|
34
|
+
DrawerPopupCssVars["frontmostHeight"] = "--drawer-frontmost-height";
|
|
35
|
+
/**
|
|
36
|
+
* The swipe movement on the X axis.
|
|
37
|
+
* @type {CSS length}
|
|
38
|
+
*/
|
|
39
|
+
DrawerPopupCssVars["swipeMovementX"] = "--drawer-swipe-movement-x";
|
|
40
|
+
/**
|
|
41
|
+
* The swipe movement on the Y axis.
|
|
42
|
+
* @type {CSS length}
|
|
43
|
+
*/
|
|
44
|
+
DrawerPopupCssVars["swipeMovementY"] = "--drawer-swipe-movement-y";
|
|
45
|
+
/**
|
|
46
|
+
* The snap point offset used for translating the drawer.
|
|
47
|
+
* @type {CSS length}
|
|
48
|
+
*/
|
|
49
|
+
DrawerPopupCssVars["snapPointOffset"] = "--drawer-snap-point-offset";
|
|
50
|
+
/**
|
|
51
|
+
* A scalar (0.1-1) used to scale the swipe release transition duration in CSS.
|
|
52
|
+
* @type {number}
|
|
53
|
+
*/
|
|
54
|
+
DrawerPopupCssVars["swipeStrength"] = "--drawer-swipe-strength";
|
|
55
|
+
return DrawerPopupCssVars;
|
|
56
|
+
}({});
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/drawer/backdrop/DrawerBackdropCssVars.ts
|
|
59
|
+
var DrawerBackdropCssVars = /* @__PURE__ */ function(DrawerBackdropCssVars) {
|
|
60
|
+
/**
|
|
61
|
+
* The swipe progress of the drawer gesture.
|
|
62
|
+
* @type {number}
|
|
63
|
+
*/
|
|
64
|
+
DrawerBackdropCssVars["swipeProgress"] = "--drawer-swipe-progress";
|
|
65
|
+
return DrawerBackdropCssVars;
|
|
66
|
+
}({});
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/drawer/backdrop/DrawerBackdrop.tsx
|
|
69
|
+
/** An overlay displayed beneath the drawer popup. */
|
|
70
|
+
function DrawerBackdrop(props) {
|
|
71
|
+
const context = useDialogRootContext();
|
|
72
|
+
const internalProps = props;
|
|
73
|
+
const others = omit(props, "as", "class", "forceRender", "ref", "style");
|
|
74
|
+
const state = createMemo(() => ({
|
|
75
|
+
open: context.store.open(),
|
|
76
|
+
transitionStatus: context.presence.transitionStatus()
|
|
77
|
+
}));
|
|
78
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
79
|
+
const styleValue = createMemo(() => mergeDialogStyles({
|
|
80
|
+
"pointer-events": context.store.open() ? void 0 : "none",
|
|
81
|
+
"user-select": "none",
|
|
82
|
+
"-webkit-user-select": "none",
|
|
83
|
+
[DrawerBackdropCssVars.swipeProgress]: "0",
|
|
84
|
+
[DrawerPopupCssVars.swipeStrength]: "1"
|
|
85
|
+
}, resolveStyle(props.style, state())));
|
|
86
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state(), dialogTransitionStateAttributesMapping));
|
|
87
|
+
const shouldRender = createMemo(() => Boolean(internalProps.forceRender) || !context.nested);
|
|
88
|
+
function BackdropElement() {
|
|
89
|
+
let backdropElement = null;
|
|
90
|
+
onCleanup(() => {
|
|
91
|
+
if (context.backdropElement() === backdropElement) context.setBackdropElement(null);
|
|
92
|
+
});
|
|
93
|
+
return Dynamic(mergeProps({
|
|
94
|
+
get component() {
|
|
95
|
+
return props.as ?? "div";
|
|
96
|
+
},
|
|
97
|
+
ref: [((element) => {
|
|
98
|
+
backdropElement = element;
|
|
99
|
+
context.setBackdropElement(element);
|
|
100
|
+
}), internalProps.ref],
|
|
101
|
+
role: "presentation",
|
|
102
|
+
get hidden() {
|
|
103
|
+
return !context.presence.mounted();
|
|
104
|
+
},
|
|
105
|
+
get ["class"]() {
|
|
106
|
+
return classValue();
|
|
107
|
+
},
|
|
108
|
+
get style() {
|
|
109
|
+
return styleValue();
|
|
110
|
+
}
|
|
111
|
+
}, stateAttributes, others));
|
|
112
|
+
}
|
|
113
|
+
return Show({
|
|
114
|
+
get when() {
|
|
115
|
+
return shouldRender();
|
|
116
|
+
},
|
|
117
|
+
get children() {
|
|
118
|
+
return BackdropElement({});
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/drawer/content/DrawerContentDataAttributes.ts
|
|
124
|
+
var DRAWER_CONTENT_ATTRIBUTE = "data-drawer-content";
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/drawer/content/DrawerContent.tsx
|
|
127
|
+
/**
|
|
128
|
+
* A container for the drawer contents. Allows text selection of its children without swipe
|
|
129
|
+
* interference when using a mouse pointer.
|
|
130
|
+
*/
|
|
131
|
+
function DrawerContent(props) {
|
|
132
|
+
useDialogRootContext();
|
|
133
|
+
const internalProps = props;
|
|
134
|
+
const others = omit(props, "as", "class", "ref", "style");
|
|
135
|
+
const state = {};
|
|
136
|
+
const classValue = createMemo(() => resolveClass(props.class, state));
|
|
137
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state));
|
|
138
|
+
return Dynamic(mergeProps({
|
|
139
|
+
get component() {
|
|
140
|
+
return props.as ?? "div";
|
|
141
|
+
},
|
|
142
|
+
ref: [internalProps.ref]
|
|
143
|
+
}, { [DRAWER_CONTENT_ATTRIBUTE]: "" }, {
|
|
144
|
+
get ["class"]() {
|
|
145
|
+
return classValue();
|
|
146
|
+
},
|
|
147
|
+
get style() {
|
|
148
|
+
return styleValue();
|
|
149
|
+
}
|
|
150
|
+
}, others));
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/drawer/provider/DrawerProviderContext.ts
|
|
154
|
+
var MISSING_CONTEXT$3 = Symbol("DrawerProviderContext");
|
|
155
|
+
var DrawerProviderContext = createContext(MISSING_CONTEXT$3);
|
|
156
|
+
function useDrawerProviderContext() {
|
|
157
|
+
const context = useContext(DrawerProviderContext);
|
|
158
|
+
return context === MISSING_CONTEXT$3 ? void 0 : context;
|
|
159
|
+
}
|
|
160
|
+
function createVisualStateStore() {
|
|
161
|
+
let state = {
|
|
162
|
+
swipeProgress: 0,
|
|
163
|
+
frontmostHeight: 0
|
|
164
|
+
};
|
|
165
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
166
|
+
return {
|
|
167
|
+
getSnapshot: () => state,
|
|
168
|
+
set(nextState) {
|
|
169
|
+
let nextSwipeProgress = state.swipeProgress;
|
|
170
|
+
if (nextState.swipeProgress !== void 0) nextSwipeProgress = Number.isFinite(nextState.swipeProgress) ? nextState.swipeProgress : 0;
|
|
171
|
+
let nextFrontmostHeight = state.frontmostHeight;
|
|
172
|
+
if (nextState.frontmostHeight !== void 0) nextFrontmostHeight = Number.isFinite(nextState.frontmostHeight) ? nextState.frontmostHeight : 0;
|
|
173
|
+
if (nextSwipeProgress === state.swipeProgress && nextFrontmostHeight === state.frontmostHeight) return;
|
|
174
|
+
state = {
|
|
175
|
+
swipeProgress: nextSwipeProgress,
|
|
176
|
+
frontmostHeight: nextFrontmostHeight
|
|
177
|
+
};
|
|
178
|
+
listeners.forEach((listener) => {
|
|
179
|
+
listener();
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
subscribe(listener) {
|
|
183
|
+
listeners.add(listener);
|
|
184
|
+
return () => {
|
|
185
|
+
listeners.delete(listener);
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region src/drawer/indent-background/DrawerIndentBackground.tsx
|
|
192
|
+
var ACTIVE = { "data-active": "" };
|
|
193
|
+
var INACTIVE = { "data-inactive": "" };
|
|
194
|
+
var drawerIndentStateAttributesMapping = { active: (value) => value ? ACTIVE : INACTIVE };
|
|
195
|
+
/**
|
|
196
|
+
* An element placed before `<Drawer.Indent>` to render a background layer that can be styled
|
|
197
|
+
* based on whether any drawer is open.
|
|
198
|
+
*/
|
|
199
|
+
function DrawerIndentBackground(props) {
|
|
200
|
+
const provider = useDrawerProviderContext();
|
|
201
|
+
const internalProps = props;
|
|
202
|
+
const others = omit(props, "as", "class", "ref", "style");
|
|
203
|
+
const state = () => ({ active: provider?.active() ?? false });
|
|
204
|
+
const classValue = () => resolveClass(props.class, state());
|
|
205
|
+
const styleValue = () => resolveStyle(props.style, state());
|
|
206
|
+
const stateAttributes = () => getStateAttributesProps(state(), drawerIndentStateAttributesMapping);
|
|
207
|
+
const component = untrack(() => props.as);
|
|
208
|
+
return component === void 0 ? ssrElement("div", () => {
|
|
209
|
+
return mergeProps({
|
|
210
|
+
get ["class"]() {
|
|
211
|
+
return classValue();
|
|
212
|
+
},
|
|
213
|
+
get style() {
|
|
214
|
+
return styleValue();
|
|
215
|
+
}
|
|
216
|
+
}, stateAttributes, others);
|
|
217
|
+
}, void 0, true) : Dynamic(mergeProps({
|
|
218
|
+
component,
|
|
219
|
+
ref: [internalProps.ref],
|
|
220
|
+
get ["class"]() {
|
|
221
|
+
return classValue();
|
|
222
|
+
},
|
|
223
|
+
get style() {
|
|
224
|
+
return styleValue();
|
|
225
|
+
}
|
|
226
|
+
}, stateAttributes, others));
|
|
227
|
+
}
|
|
228
|
+
//#endregion
|
|
229
|
+
//#region src/drawer/indent/DrawerIndent.tsx
|
|
230
|
+
/**
|
|
231
|
+
* A wrapper element intended to contain your app's main UI. Applies `data-active` when any drawer
|
|
232
|
+
* within the nearest `<Drawer.Provider>` is open.
|
|
233
|
+
*/
|
|
234
|
+
function DrawerIndent(props) {
|
|
235
|
+
const provider = useDrawerProviderContext();
|
|
236
|
+
const internalProps = props;
|
|
237
|
+
const others = omit(props, "as", "class", "ref", "style");
|
|
238
|
+
const state = () => ({ active: provider?.active() ?? false });
|
|
239
|
+
const classValue = () => resolveClass(props.class, state());
|
|
240
|
+
const styleValue = () => mergeDialogStyles({ [DrawerBackdropCssVars.swipeProgress]: "0" }, resolveStyle(props.style, state()));
|
|
241
|
+
const stateAttributes = () => getStateAttributesProps(state(), drawerIndentStateAttributesMapping);
|
|
242
|
+
let indentElement = null;
|
|
243
|
+
const indentRef = [((element) => {
|
|
244
|
+
indentElement = element;
|
|
245
|
+
}), internalProps.ref];
|
|
246
|
+
const component = untrack(() => props.as);
|
|
247
|
+
const element = component === void 0 ? ssrElement("div", () => {
|
|
248
|
+
return mergeProps({
|
|
249
|
+
get ["class"]() {
|
|
250
|
+
return classValue();
|
|
251
|
+
},
|
|
252
|
+
get style() {
|
|
253
|
+
return styleValue();
|
|
254
|
+
}
|
|
255
|
+
}, stateAttributes, others);
|
|
256
|
+
}, void 0, true) : Dynamic(mergeProps({
|
|
257
|
+
component,
|
|
258
|
+
ref: indentRef,
|
|
259
|
+
get ["class"]() {
|
|
260
|
+
return classValue();
|
|
261
|
+
},
|
|
262
|
+
get style() {
|
|
263
|
+
return styleValue();
|
|
264
|
+
}
|
|
265
|
+
}, stateAttributes, others));
|
|
266
|
+
createEffect(() => provider?.visualStateStore, (visualStateStore) => {
|
|
267
|
+
const indent = indentElement;
|
|
268
|
+
if (!indent || !visualStateStore) return;
|
|
269
|
+
function syncVisualState() {
|
|
270
|
+
const { swipeProgress, frontmostHeight } = visualStateStore.getSnapshot();
|
|
271
|
+
indent.style.setProperty(DrawerBackdropCssVars.swipeProgress, swipeProgress <= 0 ? "0" : `${swipeProgress}`);
|
|
272
|
+
if (frontmostHeight <= 0) indent.style.removeProperty(DrawerPopupCssVars.height);
|
|
273
|
+
else indent.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
274
|
+
}
|
|
275
|
+
syncVisualState();
|
|
276
|
+
const unsubscribe = visualStateStore.subscribe(syncVisualState);
|
|
277
|
+
return () => {
|
|
278
|
+
unsubscribe();
|
|
279
|
+
indent.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
280
|
+
indent.style.removeProperty(DrawerPopupCssVars.height);
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
return element;
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/drawer/root/DrawerRootContext.ts
|
|
287
|
+
var MISSING_CONTEXT$2 = Symbol("DrawerRootContext");
|
|
288
|
+
var DrawerRootContext = createContext(MISSING_CONTEXT$2);
|
|
289
|
+
function useDrawerRootContext(optional = false) {
|
|
290
|
+
const context = useContext(DrawerRootContext);
|
|
291
|
+
if (context === MISSING_CONTEXT$2) {
|
|
292
|
+
if (optional) return;
|
|
293
|
+
throw new Error("Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>.");
|
|
294
|
+
}
|
|
295
|
+
return context;
|
|
296
|
+
}
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region src/drawer/root/createDrawerSnapPoints.ts
|
|
299
|
+
/**
|
|
300
|
+
* Resolves the vertical swipe movement for a snap point, applying square-root damping once the
|
|
301
|
+
* drag overshoots the fully-open edge (`nextOffset < 0`) so the popup resists travelling past it.
|
|
302
|
+
*/
|
|
303
|
+
function getSnapPointSwipeMovement(baseOffset, movementValue) {
|
|
304
|
+
const nextOffset = baseOffset + movementValue;
|
|
305
|
+
if (nextOffset >= 0) return movementValue;
|
|
306
|
+
return -Math.sqrt(-nextOffset) - baseOffset;
|
|
307
|
+
}
|
|
308
|
+
function resolveSnapPointValue(snapPoint, viewportHeight, rootFontSize) {
|
|
309
|
+
if (!Number.isFinite(viewportHeight) || viewportHeight <= 0) return null;
|
|
310
|
+
if (typeof snapPoint === "number") {
|
|
311
|
+
if (!Number.isFinite(snapPoint)) return null;
|
|
312
|
+
if (snapPoint <= 1) return clamp(snapPoint, 0, 1) * viewportHeight;
|
|
313
|
+
return snapPoint;
|
|
314
|
+
}
|
|
315
|
+
const trimmed = snapPoint.trim();
|
|
316
|
+
if (trimmed.endsWith("px")) {
|
|
317
|
+
const value = Number.parseFloat(trimmed);
|
|
318
|
+
return Number.isFinite(value) ? value : null;
|
|
319
|
+
}
|
|
320
|
+
if (trimmed.endsWith("rem")) {
|
|
321
|
+
const value = Number.parseFloat(trimmed);
|
|
322
|
+
return Number.isFinite(value) ? value * rootFontSize : null;
|
|
323
|
+
}
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
/** Returns the index of the value closest to `target`, or `-1` if `values` is empty. */
|
|
327
|
+
function closestSnapPointIndex(values, target) {
|
|
328
|
+
let closestIndex = -1;
|
|
329
|
+
let closestDistance = Infinity;
|
|
330
|
+
for (let index = 0; index < values.length; index += 1) {
|
|
331
|
+
const distance = Math.abs(values[index] - target);
|
|
332
|
+
if (distance < closestDistance) {
|
|
333
|
+
closestDistance = distance;
|
|
334
|
+
closestIndex = index;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return closestIndex;
|
|
338
|
+
}
|
|
339
|
+
function createDrawerSnapPoints() {
|
|
340
|
+
const dialog = useDialogRootContext();
|
|
341
|
+
const drawer = useDrawerRootContext();
|
|
342
|
+
const [viewportHeight, setViewportHeight] = createSignal(0, { ownedWrite: true });
|
|
343
|
+
const [rootFontSize, setRootFontSize] = createSignal(16, { ownedWrite: true });
|
|
344
|
+
createEffect(() => dialog.viewportElement(), (viewportElement) => {
|
|
345
|
+
function measure() {
|
|
346
|
+
const html = ownerDocument(viewportElement).documentElement;
|
|
347
|
+
setViewportHeight(viewportElement ? viewportElement.offsetHeight : html.clientHeight);
|
|
348
|
+
const fontSize = Number.parseFloat(ownerWindow(html).getComputedStyle(html).fontSize);
|
|
349
|
+
if (Number.isFinite(fontSize)) setRootFontSize(fontSize);
|
|
350
|
+
}
|
|
351
|
+
measure();
|
|
352
|
+
if (!viewportElement || typeof ResizeObserver !== "function") return;
|
|
353
|
+
const resizeObserver = new ResizeObserver(measure);
|
|
354
|
+
resizeObserver.observe(viewportElement);
|
|
355
|
+
return () => resizeObserver.disconnect();
|
|
356
|
+
});
|
|
357
|
+
const resolvedSnapPoints = createMemo(() => {
|
|
358
|
+
const points = drawer.snapPoints();
|
|
359
|
+
const height = viewportHeight();
|
|
360
|
+
const popup = drawer.popupHeight();
|
|
361
|
+
if (!points || points.length === 0 || height <= 0 || popup <= 0) return [];
|
|
362
|
+
const fontSize = rootFontSize();
|
|
363
|
+
const maxHeight = Math.min(popup, height);
|
|
364
|
+
const resolved = points.map((value) => {
|
|
365
|
+
const resolvedHeight = resolveSnapPointValue(value, height, fontSize);
|
|
366
|
+
if (resolvedHeight === null) return null;
|
|
367
|
+
const clampedHeight = clamp(resolvedHeight, 0, maxHeight);
|
|
368
|
+
return {
|
|
369
|
+
value,
|
|
370
|
+
height: clampedHeight,
|
|
371
|
+
offset: Math.max(0, popup - clampedHeight)
|
|
372
|
+
};
|
|
373
|
+
}).filter((point) => Boolean(point));
|
|
374
|
+
if (resolved.length <= 1) return resolved;
|
|
375
|
+
const deduped = [];
|
|
376
|
+
const seenHeights = [];
|
|
377
|
+
for (let index = resolved.length - 1; index >= 0; index -= 1) {
|
|
378
|
+
const point = resolved[index];
|
|
379
|
+
if (seenHeights.some((seen) => Math.abs(seen - point.height) <= 1)) continue;
|
|
380
|
+
seenHeights.push(point.height);
|
|
381
|
+
deduped.push(point);
|
|
382
|
+
}
|
|
383
|
+
deduped.reverse();
|
|
384
|
+
return deduped;
|
|
385
|
+
});
|
|
386
|
+
const activeResolvedSnapPoint = createMemo(() => {
|
|
387
|
+
const active = drawer.activeSnapPoint();
|
|
388
|
+
if (active === null) return;
|
|
389
|
+
const points = resolvedSnapPoints();
|
|
390
|
+
const exactMatch = points.find((point) => Object.is(point.value, active));
|
|
391
|
+
if (exactMatch) return exactMatch;
|
|
392
|
+
const height = viewportHeight();
|
|
393
|
+
const maxHeight = Math.min(drawer.popupHeight(), height);
|
|
394
|
+
const resolvedHeight = resolveSnapPointValue(active, height, rootFontSize());
|
|
395
|
+
if (resolvedHeight === null) return;
|
|
396
|
+
const clampedHeight = clamp(resolvedHeight, 0, maxHeight);
|
|
397
|
+
return points[closestSnapPointIndex(points.map((point) => point.height), clampedHeight)];
|
|
398
|
+
});
|
|
399
|
+
return {
|
|
400
|
+
snapPoints: drawer.snapPoints,
|
|
401
|
+
activeSnapPoint: drawer.activeSnapPoint,
|
|
402
|
+
setActiveSnapPoint: drawer.setActiveSnapPoint,
|
|
403
|
+
popupHeight: drawer.popupHeight,
|
|
404
|
+
viewportHeight,
|
|
405
|
+
resolvedSnapPoints,
|
|
406
|
+
activeSnapPointOffset: () => activeResolvedSnapPoint()?.offset ?? null
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/drawer/viewport/DrawerViewportContext.ts
|
|
411
|
+
var MISSING_CONTEXT$1 = Symbol("DrawerViewportContext");
|
|
412
|
+
var DrawerViewportContext = createContext(MISSING_CONTEXT$1);
|
|
413
|
+
function useDrawerViewportContext() {
|
|
414
|
+
const context = useContext(DrawerViewportContext);
|
|
415
|
+
return context === MISSING_CONTEXT$1 ? void 0 : context;
|
|
416
|
+
}
|
|
417
|
+
//#endregion
|
|
418
|
+
//#region src/drawer/popup/DrawerPopupDataAttributes.ts
|
|
419
|
+
var DrawerPopupDataAttributes = /* @__PURE__ */ function(DrawerPopupDataAttributes) {
|
|
420
|
+
/** Present when the drawer is open. */
|
|
421
|
+
DrawerPopupDataAttributes[DrawerPopupDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
|
|
422
|
+
/** Present when the drawer is closed. */
|
|
423
|
+
DrawerPopupDataAttributes[DrawerPopupDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
424
|
+
/** Present when the drawer begins animating in. */
|
|
425
|
+
DrawerPopupDataAttributes[DrawerPopupDataAttributes["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
426
|
+
/** Present when the drawer is animating out. */
|
|
427
|
+
DrawerPopupDataAttributes[DrawerPopupDataAttributes["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
428
|
+
/** Present when the drawer is at the expanded (full-height) snap point. */
|
|
429
|
+
DrawerPopupDataAttributes["expanded"] = "data-expanded";
|
|
430
|
+
/** Present when a nested drawer is open. */
|
|
431
|
+
DrawerPopupDataAttributes["nestedDrawerOpen"] = "data-nested-drawer-open";
|
|
432
|
+
/** Present when a nested drawer is being swiped. */
|
|
433
|
+
DrawerPopupDataAttributes["nestedDrawerSwiping"] = "data-nested-drawer-swiping";
|
|
434
|
+
/** Present when the drawer is dismissed by swiping. */
|
|
435
|
+
DrawerPopupDataAttributes["swipeDismiss"] = "data-swipe-dismiss";
|
|
436
|
+
/**
|
|
437
|
+
* Indicates the swipe direction.
|
|
438
|
+
* @type {'up' | 'down' | 'left' | 'right'}
|
|
439
|
+
*/
|
|
440
|
+
DrawerPopupDataAttributes["swipeDirection"] = "data-swipe-direction";
|
|
441
|
+
/** Present when the drawer is being swiped. */
|
|
442
|
+
DrawerPopupDataAttributes["swiping"] = "data-swiping";
|
|
443
|
+
return DrawerPopupDataAttributes;
|
|
444
|
+
}({});
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/drawer/popup/DrawerPopup.tsx
|
|
447
|
+
var COMPOSITE_KEYS = /* @__PURE__ */ new Set([
|
|
448
|
+
"ArrowUp",
|
|
449
|
+
"ArrowDown",
|
|
450
|
+
"ArrowLeft",
|
|
451
|
+
"ArrowRight",
|
|
452
|
+
"Home",
|
|
453
|
+
"End"
|
|
454
|
+
]);
|
|
455
|
+
var drawerSwipeVarsRegistered = false;
|
|
456
|
+
/**
|
|
457
|
+
* Removes inheritance of high-frequency drawer swipe CSS variables, which reduces style
|
|
458
|
+
* recalculation cost in complex drawers with deep subtrees.
|
|
459
|
+
* See https://motion.dev/blog/web-animation-performance-tier-list under the
|
|
460
|
+
* "Improving CSS variable performance" section.
|
|
461
|
+
*/
|
|
462
|
+
function removeCssVariableInheritance() {
|
|
463
|
+
if (drawerSwipeVarsRegistered) return;
|
|
464
|
+
if (typeof CSS !== "undefined" && "registerProperty" in CSS) {
|
|
465
|
+
for (const name of [
|
|
466
|
+
DrawerPopupCssVars.swipeMovementX,
|
|
467
|
+
DrawerPopupCssVars.swipeMovementY,
|
|
468
|
+
DrawerPopupCssVars.snapPointOffset
|
|
469
|
+
]) try {
|
|
470
|
+
CSS.registerProperty({
|
|
471
|
+
name,
|
|
472
|
+
syntax: "<length>",
|
|
473
|
+
inherits: false,
|
|
474
|
+
initialValue: "0px"
|
|
475
|
+
});
|
|
476
|
+
} catch {}
|
|
477
|
+
for (const { name, initialValue } of [{
|
|
478
|
+
name: DrawerBackdropCssVars.swipeProgress,
|
|
479
|
+
initialValue: "0"
|
|
480
|
+
}, {
|
|
481
|
+
name: DrawerPopupCssVars.swipeStrength,
|
|
482
|
+
initialValue: "1"
|
|
483
|
+
}]) try {
|
|
484
|
+
CSS.registerProperty({
|
|
485
|
+
name,
|
|
486
|
+
syntax: "<number>",
|
|
487
|
+
inherits: false,
|
|
488
|
+
initialValue
|
|
489
|
+
});
|
|
490
|
+
} catch {}
|
|
491
|
+
}
|
|
492
|
+
drawerSwipeVarsRegistered = true;
|
|
493
|
+
}
|
|
494
|
+
var EXPANDED = { [DrawerPopupDataAttributes.expanded]: "" };
|
|
495
|
+
var NESTED_DRAWER_OPEN = { [DrawerPopupDataAttributes.nestedDrawerOpen]: "" };
|
|
496
|
+
var NESTED_DRAWER_SWIPING = { [DrawerPopupDataAttributes.nestedDrawerSwiping]: "" };
|
|
497
|
+
var SWIPING = { [DrawerPopupDataAttributes.swiping]: "" };
|
|
498
|
+
var stateAttributesMapping$1 = {
|
|
499
|
+
...popupTransitionStateMapping,
|
|
500
|
+
expanded: (value) => value ? EXPANDED : null,
|
|
501
|
+
nestedDrawerOpen: (value) => value ? NESTED_DRAWER_OPEN : null,
|
|
502
|
+
nestedDrawerSwiping: (value) => value ? NESTED_DRAWER_SWIPING : null,
|
|
503
|
+
swipeDirection: (value) => ({ [DrawerPopupDataAttributes.swipeDirection]: value }),
|
|
504
|
+
swiping: (value) => value ? SWIPING : null
|
|
505
|
+
};
|
|
506
|
+
/** A container for the drawer contents. */
|
|
507
|
+
function DrawerPopup(props) {
|
|
508
|
+
useDialogPortalContext();
|
|
509
|
+
const context = useDialogRootContext();
|
|
510
|
+
const drawer = useDrawerRootContext();
|
|
511
|
+
const swipe = useDrawerViewportContext();
|
|
512
|
+
const snap = createDrawerSnapPoints();
|
|
513
|
+
const internalProps = props;
|
|
514
|
+
const others = omit(props, "as", "class", "finalFocus", "id", "initialFocus", "onKeyDown", "ref", "style");
|
|
515
|
+
const nestedDrawerOpen = createMemo(() => context.nestedOpenDrawerCount() > 0);
|
|
516
|
+
const swiping = createMemo(() => swipe?.swiping() ?? false);
|
|
517
|
+
let popupElement = null;
|
|
518
|
+
let measuredPopupHeight = 0;
|
|
519
|
+
function measureHeight() {
|
|
520
|
+
if (!popupElement) return;
|
|
521
|
+
const offsetHeight = popupElement.offsetHeight;
|
|
522
|
+
const frontmostHeight = untrack(drawer.frontmostHeight);
|
|
523
|
+
if (measuredPopupHeight > 0 && frontmostHeight > measuredPopupHeight && offsetHeight > measuredPopupHeight) return;
|
|
524
|
+
if (measuredPopupHeight > 0 && untrack(drawer.hasNestedDrawer)) {
|
|
525
|
+
drawer.onPopupHeightChange(measuredPopupHeight);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
if (offsetHeight === measuredPopupHeight) return;
|
|
529
|
+
measuredPopupHeight = offsetHeight;
|
|
530
|
+
drawer.onPopupHeightChange(offsetHeight);
|
|
531
|
+
}
|
|
532
|
+
createEffect(() => ({
|
|
533
|
+
mounted: context.presence.mounted(),
|
|
534
|
+
nestedDrawerOpen: nestedDrawerOpen(),
|
|
535
|
+
element: context.store.track().popupElement
|
|
536
|
+
}), (state) => {
|
|
537
|
+
if (!state.mounted) {
|
|
538
|
+
measuredPopupHeight = 0;
|
|
539
|
+
drawer.onPopupHeightChange(0);
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
if (!state.element) return;
|
|
543
|
+
removeCssVariableInheritance();
|
|
544
|
+
measureHeight();
|
|
545
|
+
if (typeof ResizeObserver !== "function") return;
|
|
546
|
+
const resizeObserver = new ResizeObserver(measureHeight);
|
|
547
|
+
resizeObserver.observe(state.element);
|
|
548
|
+
return () => resizeObserver.disconnect();
|
|
549
|
+
});
|
|
550
|
+
createEffect(() => context.store.track().popupElement, (element) => {
|
|
551
|
+
function syncNestedSwipeProgress() {
|
|
552
|
+
if (!element) return;
|
|
553
|
+
const progress = drawer.nestedSwipeProgressStore.getSnapshot();
|
|
554
|
+
element.style.setProperty(DrawerBackdropCssVars.swipeProgress, progress > 0 ? `${progress}` : "0");
|
|
555
|
+
}
|
|
556
|
+
syncNestedSwipeProgress();
|
|
557
|
+
const unsubscribe = drawer.nestedSwipeProgressStore.subscribe(syncNestedSwipeProgress);
|
|
558
|
+
return () => {
|
|
559
|
+
unsubscribe();
|
|
560
|
+
element?.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
createEffect(() => ({
|
|
564
|
+
open: context.store.open(),
|
|
565
|
+
frontmostHeight: drawer.frontmostHeight()
|
|
566
|
+
}), (state) => {
|
|
567
|
+
if (!state.open) return;
|
|
568
|
+
drawer.notifyParentFrontmostHeight?.(state.frontmostHeight);
|
|
569
|
+
return () => drawer.notifyParentFrontmostHeight?.(0);
|
|
570
|
+
});
|
|
571
|
+
createEffect(() => ({
|
|
572
|
+
open: context.store.open(),
|
|
573
|
+
transitionStatus: context.presence.transitionStatus()
|
|
574
|
+
}), (state) => {
|
|
575
|
+
if (!drawer.notifyParentHasNestedDrawer) return;
|
|
576
|
+
drawer.notifyParentHasNestedDrawer(state.open || state.transitionStatus === "ending");
|
|
577
|
+
return () => drawer.notifyParentHasNestedDrawer?.(false);
|
|
578
|
+
});
|
|
579
|
+
const state = createMemo(() => ({
|
|
580
|
+
open: context.store.open(),
|
|
581
|
+
transitionStatus: context.presence.transitionStatus(),
|
|
582
|
+
expanded: drawer.activeSnapPoint() === 1,
|
|
583
|
+
nested: context.nested,
|
|
584
|
+
nestedDrawerOpen: nestedDrawerOpen(),
|
|
585
|
+
nestedDrawerSwiping: drawer.nestedSwiping(),
|
|
586
|
+
swipeDirection: drawer.swipeDirection(),
|
|
587
|
+
swiping: swiping()
|
|
588
|
+
}));
|
|
589
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
590
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state(), stateAttributesMapping$1));
|
|
591
|
+
const snapPointOffsetValue = createMemo(() => {
|
|
592
|
+
const points = snap.snapPoints();
|
|
593
|
+
const direction = drawer.swipeDirection();
|
|
594
|
+
const shouldApply = points && points.length > 0 && (direction === "down" || direction === "up");
|
|
595
|
+
const offset = snap.activeSnapPointOffset();
|
|
596
|
+
if (!shouldApply || offset === null) return null;
|
|
597
|
+
return direction === "up" ? -offset : offset;
|
|
598
|
+
});
|
|
599
|
+
const dragStyles = createMemo(() => {
|
|
600
|
+
const base = swipe ? swipe.getDragStyles() : {};
|
|
601
|
+
const points = snap.snapPoints();
|
|
602
|
+
const direction = drawer.swipeDirection();
|
|
603
|
+
if (!(points && points.length > 0 && (direction === "down" || direction === "up")) || direction !== "down") return base;
|
|
604
|
+
const movementValue = Number.parseFloat(String(base[DrawerPopupCssVars.swipeMovementY]));
|
|
605
|
+
if (swiping() && Number.isFinite(movementValue)) return {
|
|
606
|
+
...base,
|
|
607
|
+
transform: void 0,
|
|
608
|
+
[DrawerPopupCssVars.swipeMovementY]: `${getSnapPointSwipeMovement(snap.activeSnapPointOffset() ?? 0, movementValue)}px`
|
|
609
|
+
};
|
|
610
|
+
return {
|
|
611
|
+
...base,
|
|
612
|
+
transform: void 0
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
const styleValue = createMemo(() => {
|
|
616
|
+
const frontmostHeight = drawer.frontmostHeight();
|
|
617
|
+
const shouldUseAutoHeight = !drawer.hasNestedDrawer() && context.presence.transitionStatus() !== "ending";
|
|
618
|
+
const height = drawer.popupHeight();
|
|
619
|
+
const swipeStrength = swipe?.swipeStrength() ?? null;
|
|
620
|
+
const offset = snapPointOffsetValue();
|
|
621
|
+
return mergeDialogStyles({
|
|
622
|
+
...dragStyles(),
|
|
623
|
+
[DrawerBackdropCssVars.swipeProgress]: "0",
|
|
624
|
+
[DrawerPopupCssVars.nestedDrawers]: context.nestedOpenDrawerCount(),
|
|
625
|
+
[DrawerPopupCssVars.height]: height && !shouldUseAutoHeight ? `${height}px` : void 0,
|
|
626
|
+
[DrawerPopupCssVars.snapPointOffset]: typeof offset === "number" ? `${offset}px` : "0px",
|
|
627
|
+
[DrawerPopupCssVars.frontmostHeight]: frontmostHeight ? `${frontmostHeight}px` : void 0,
|
|
628
|
+
[DrawerPopupCssVars.swipeStrength]: typeof swipeStrength === "number" && Number.isFinite(swipeStrength) && swipeStrength > 0 ? `${swipeStrength}` : "1"
|
|
629
|
+
}, resolveStyle(props.style, state()));
|
|
630
|
+
});
|
|
631
|
+
const id = createMemo(() => internalProps.id ?? context.store.context.floatingId);
|
|
632
|
+
const initialFocus = createMemo(() => internalProps.initialFocus ?? (() => context.store.state.popupElement));
|
|
633
|
+
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown, () => (event) => {
|
|
634
|
+
if (COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
635
|
+
});
|
|
636
|
+
createEffect(() => id(), (currentId) => {
|
|
637
|
+
context.store.setPopupId(currentId);
|
|
638
|
+
});
|
|
639
|
+
onCleanup(() => {
|
|
640
|
+
if (context.store.state.popupElement === popupElement) context.store.setPopupElement(null);
|
|
641
|
+
});
|
|
642
|
+
const popup = Dynamic(mergeProps({
|
|
643
|
+
get component() {
|
|
644
|
+
return props.as ?? "div";
|
|
645
|
+
},
|
|
646
|
+
ref: [((element) => {
|
|
647
|
+
popupElement = element;
|
|
648
|
+
context.store.setPopupElement(element);
|
|
649
|
+
}), internalProps.ref],
|
|
650
|
+
get id() {
|
|
651
|
+
return id();
|
|
652
|
+
},
|
|
653
|
+
get role() {
|
|
654
|
+
return context.role;
|
|
655
|
+
},
|
|
656
|
+
tabIndex: -1,
|
|
657
|
+
"data-base-ui-focusable": "",
|
|
658
|
+
get hidden() {
|
|
659
|
+
return !context.presence.mounted();
|
|
660
|
+
},
|
|
661
|
+
get ["aria-labelledby"]() {
|
|
662
|
+
return context.titleId();
|
|
663
|
+
},
|
|
664
|
+
get ["aria-describedby"]() {
|
|
665
|
+
return context.descriptionId();
|
|
666
|
+
},
|
|
667
|
+
get ["class"]() {
|
|
668
|
+
return classValue();
|
|
669
|
+
},
|
|
670
|
+
get style() {
|
|
671
|
+
return styleValue();
|
|
672
|
+
},
|
|
673
|
+
onKeyDown
|
|
674
|
+
}, stateAttributes, others));
|
|
675
|
+
return FocusManager({
|
|
676
|
+
get context() {
|
|
677
|
+
return context.store.context.floatingRoot;
|
|
678
|
+
},
|
|
679
|
+
get tree() {
|
|
680
|
+
return context.tree;
|
|
681
|
+
},
|
|
682
|
+
get disabled() {
|
|
683
|
+
return !context.presence.mounted();
|
|
684
|
+
},
|
|
685
|
+
get closeOnFocusOut() {
|
|
686
|
+
return !context.disablePointerDismissal();
|
|
687
|
+
},
|
|
688
|
+
get initialFocus() {
|
|
689
|
+
return initialFocus();
|
|
690
|
+
},
|
|
691
|
+
get returnFocus() {
|
|
692
|
+
return internalProps.finalFocus;
|
|
693
|
+
},
|
|
694
|
+
get modal() {
|
|
695
|
+
return context.modal() !== false;
|
|
696
|
+
},
|
|
697
|
+
restoreFocus: "popup",
|
|
698
|
+
get openInteractionType() {
|
|
699
|
+
return context.store.openMethod();
|
|
700
|
+
},
|
|
701
|
+
children: popup
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/drawer/provider/DrawerProvider.tsx
|
|
706
|
+
/**
|
|
707
|
+
* Provides a shared context for coordinating global Drawer UI, such as indent/background effects
|
|
708
|
+
* based on whether any Drawer is open. Doesn't render its own HTML element.
|
|
709
|
+
*/
|
|
710
|
+
function DrawerProvider(props) {
|
|
711
|
+
const [revision, setRevision] = createSignal(0, {
|
|
712
|
+
equals: false,
|
|
713
|
+
ownedWrite: true
|
|
714
|
+
});
|
|
715
|
+
const openDrawers = /* @__PURE__ */ new Set();
|
|
716
|
+
const visualStateStore = createVisualStateStore();
|
|
717
|
+
const active = () => {
|
|
718
|
+
revision();
|
|
719
|
+
return openDrawers.size > 0;
|
|
720
|
+
};
|
|
721
|
+
function setDrawerOpen(drawer, open) {
|
|
722
|
+
if (openDrawers.has(drawer) === open) return;
|
|
723
|
+
if (open) openDrawers.add(drawer);
|
|
724
|
+
else openDrawers.delete(drawer);
|
|
725
|
+
setRevision((value) => value + 1);
|
|
726
|
+
}
|
|
727
|
+
return DrawerProviderContext({
|
|
728
|
+
value: {
|
|
729
|
+
setDrawerOpen,
|
|
730
|
+
removeDrawer: (drawer) => setDrawerOpen(drawer, false),
|
|
731
|
+
active,
|
|
732
|
+
visualStateStore
|
|
733
|
+
},
|
|
734
|
+
get children() {
|
|
735
|
+
return props.children;
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/drawer/root/DrawerRoot.tsx
|
|
741
|
+
function createNestedSwipeProgressStore() {
|
|
742
|
+
let progress = 0;
|
|
743
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
744
|
+
return {
|
|
745
|
+
getSnapshot: () => progress,
|
|
746
|
+
set(nextProgress) {
|
|
747
|
+
const resolved = Number.isFinite(nextProgress) ? nextProgress : 0;
|
|
748
|
+
if (resolved === progress) return;
|
|
749
|
+
progress = resolved;
|
|
750
|
+
listeners.forEach((listener) => {
|
|
751
|
+
listener();
|
|
752
|
+
});
|
|
753
|
+
},
|
|
754
|
+
subscribe(listener) {
|
|
755
|
+
listeners.add(listener);
|
|
756
|
+
return () => {
|
|
757
|
+
listeners.delete(listener);
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
/** Groups all parts of the drawer. Doesn't render its own HTML element. */
|
|
763
|
+
function DrawerRoot(props) {
|
|
764
|
+
const parentDrawer = useDrawerRootContext(true);
|
|
765
|
+
const [popupHeight, setPopupHeight] = createSignal(0, { ownedWrite: true });
|
|
766
|
+
const [frontmostHeight, setFrontmostHeight] = createSignal(0, { ownedWrite: true });
|
|
767
|
+
const [hasNestedDrawer, setHasNestedDrawer] = createSignal(false, { ownedWrite: true });
|
|
768
|
+
const [nestedSwiping, setNestedSwiping] = createSignal(false, { ownedWrite: true });
|
|
769
|
+
const nestedSwipeProgressStore = createNestedSwipeProgressStore();
|
|
770
|
+
const snapPoints = () => props.snapPoints;
|
|
771
|
+
const resolvedDefaultSnapPoint = () => props.defaultSnapPoint !== void 0 ? props.defaultSnapPoint : snapPoints()?.[0] ?? null;
|
|
772
|
+
const snapPointControlled = untrack(() => props.snapPoint !== void 0);
|
|
773
|
+
const [uncontrolledSnapPoint, setUncontrolledSnapPoint] = createSignal(untrack(resolvedDefaultSnapPoint), { ownedWrite: true });
|
|
774
|
+
const activeSnapPointValue = () => snapPointControlled ? props.snapPoint ?? null : uncontrolledSnapPoint();
|
|
775
|
+
let nestedDrawerOpen = false;
|
|
776
|
+
function setActiveSnapPoint(nextSnapPoint, eventDetails) {
|
|
777
|
+
const resolvedEventDetails = eventDetails ?? createChangeEventDetails("none");
|
|
778
|
+
props.onSnapPointChange?.(nextSnapPoint, resolvedEventDetails);
|
|
779
|
+
if (resolvedEventDetails.isCanceled) return;
|
|
780
|
+
setUncontrolledSnapPoint(() => nextSnapPoint);
|
|
781
|
+
}
|
|
782
|
+
const resolvedActiveSnapPoint = () => {
|
|
783
|
+
const active = activeSnapPointValue();
|
|
784
|
+
if (snapPointControlled) return active;
|
|
785
|
+
const points = snapPoints();
|
|
786
|
+
if (!points || points.length === 0) return active;
|
|
787
|
+
if (active === null || !points.some((snapPoint) => Object.is(snapPoint, active))) return resolvedDefaultSnapPoint();
|
|
788
|
+
return active;
|
|
789
|
+
};
|
|
790
|
+
function onPopupHeightChange(height) {
|
|
791
|
+
setPopupHeight(height);
|
|
792
|
+
if (!nestedDrawerOpen && height > 0) setFrontmostHeight(height);
|
|
793
|
+
}
|
|
794
|
+
function onNestedFrontmostHeightChange(height) {
|
|
795
|
+
if (height > 0) {
|
|
796
|
+
nestedDrawerOpen = true;
|
|
797
|
+
setFrontmostHeight(height);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
nestedDrawerOpen = false;
|
|
801
|
+
const ownHeight = untrack(popupHeight);
|
|
802
|
+
if (ownHeight > 0) setFrontmostHeight(ownHeight);
|
|
803
|
+
}
|
|
804
|
+
function onNestedSwipeProgressChange(progress) {
|
|
805
|
+
nestedSwipeProgressStore.set(progress);
|
|
806
|
+
parentDrawer?.onNestedSwipeProgressChange(progress);
|
|
807
|
+
}
|
|
808
|
+
function onNestedSwipingChange(swiping) {
|
|
809
|
+
setNestedSwiping(swiping);
|
|
810
|
+
parentDrawer?.onNestedSwipingChange(swiping);
|
|
811
|
+
}
|
|
812
|
+
function handleOpenChange(open, eventDetails) {
|
|
813
|
+
props.onOpenChange?.(open, eventDetails);
|
|
814
|
+
if (eventDetails.isCanceled) return;
|
|
815
|
+
const points = untrack(snapPoints);
|
|
816
|
+
if (!open && points && points.length > 0) setActiveSnapPoint(untrack(resolvedDefaultSnapPoint), createChangeEventDetails(eventDetails.reason, eventDetails.event, eventDetails.trigger));
|
|
817
|
+
}
|
|
818
|
+
const context = {
|
|
819
|
+
swipeDirection: () => props.swipeDirection ?? "down",
|
|
820
|
+
swipeAreaActive: { current: false },
|
|
821
|
+
snapToSequentialPoints: () => props.snapToSequentialPoints ?? false,
|
|
822
|
+
snapPoints,
|
|
823
|
+
activeSnapPoint: resolvedActiveSnapPoint,
|
|
824
|
+
setActiveSnapPoint,
|
|
825
|
+
frontmostHeight,
|
|
826
|
+
popupHeight,
|
|
827
|
+
hasNestedDrawer,
|
|
828
|
+
onPopupHeightChange,
|
|
829
|
+
nestedSwiping,
|
|
830
|
+
nestedSwipeProgressStore,
|
|
831
|
+
onNestedDrawerPresenceChange: setHasNestedDrawer,
|
|
832
|
+
onNestedFrontmostHeightChange,
|
|
833
|
+
onNestedSwipingChange,
|
|
834
|
+
onNestedSwipeProgressChange,
|
|
835
|
+
notifyParentFrontmostHeight: parentDrawer ? (height) => parentDrawer.onNestedFrontmostHeightChange(height) : void 0,
|
|
836
|
+
notifyParentSwipingChange: parentDrawer ? (swiping) => parentDrawer.onNestedSwipingChange(swiping) : void 0,
|
|
837
|
+
notifyParentSwipeProgressChange: parentDrawer ? (progress) => parentDrawer.onNestedSwipeProgressChange(progress) : void 0,
|
|
838
|
+
notifyParentHasNestedDrawer: parentDrawer ? (present) => parentDrawer.onNestedDrawerPresenceChange(present) : void 0
|
|
839
|
+
};
|
|
840
|
+
const dialogProps = merge(props, { onOpenChange: handleOpenChange });
|
|
841
|
+
function DrawerDialogRoot() {
|
|
842
|
+
return renderDialogRoot("drawer", dialogProps, { extraContent: () => DrawerProviderReporter({}) });
|
|
843
|
+
}
|
|
844
|
+
return DrawerRootContext({
|
|
845
|
+
value: context,
|
|
846
|
+
get children() {
|
|
847
|
+
return DrawerDialogRoot({});
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Reports the drawer's open state to the nearest `Drawer.Provider` and wires the Android back
|
|
853
|
+
* gesture through `CloseWatcher`. Renders nothing.
|
|
854
|
+
*/
|
|
855
|
+
function DrawerProviderReporter() {
|
|
856
|
+
const provider = useDrawerProviderContext();
|
|
857
|
+
const dialog = useDialogRootContext();
|
|
858
|
+
const store = dialog.store;
|
|
859
|
+
const token = {};
|
|
860
|
+
createEffect(() => store.open(), (open) => {
|
|
861
|
+
provider?.setDrawerOpen(token, open);
|
|
862
|
+
});
|
|
863
|
+
createEffect(() => provider, (current) => () => current?.removeDrawer(token));
|
|
864
|
+
createEffect(() => ({
|
|
865
|
+
open: store.open(),
|
|
866
|
+
topmost: dialog.nestedOpenDialogCount() === 0,
|
|
867
|
+
popupElement: store.track().popupElement
|
|
868
|
+
}), (state) => {
|
|
869
|
+
if (!state.open || !state.topmost || !isAndroid()) return;
|
|
870
|
+
const CloseWatcherCtor = ownerWindow(state.popupElement).CloseWatcher;
|
|
871
|
+
if (!CloseWatcherCtor) return;
|
|
872
|
+
function handleCloseWatcher(event) {
|
|
873
|
+
if (!store.open()) return;
|
|
874
|
+
store.setOpen(false, createChangeEventDetails(closeWatcher, event));
|
|
875
|
+
}
|
|
876
|
+
const closeWatcher$1 = new CloseWatcherCtor();
|
|
877
|
+
closeWatcher$1.addEventListener("close", handleCloseWatcher);
|
|
878
|
+
return () => {
|
|
879
|
+
closeWatcher$1.removeEventListener("close", handleCloseWatcher);
|
|
880
|
+
closeWatcher$1.destroy();
|
|
881
|
+
};
|
|
882
|
+
});
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
//#endregion
|
|
886
|
+
//#region src/drawer/swipe-area/DrawerSwipeAreaDataAttributes.ts
|
|
887
|
+
var DrawerSwipeAreaDataAttributes = /* @__PURE__ */ function(DrawerSwipeAreaDataAttributes) {
|
|
888
|
+
/** Present when the drawer is open. */
|
|
889
|
+
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["open"] = CommonPopupDataAttributes.open] = "open";
|
|
890
|
+
/** Present when the drawer is closed. */
|
|
891
|
+
DrawerSwipeAreaDataAttributes[DrawerSwipeAreaDataAttributes["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
892
|
+
/** Present when the swipe area is disabled. */
|
|
893
|
+
DrawerSwipeAreaDataAttributes["disabled"] = "data-disabled";
|
|
894
|
+
/**
|
|
895
|
+
* Indicates the swipe direction.
|
|
896
|
+
* @type {'up' | 'down' | 'left' | 'right'}
|
|
897
|
+
*/
|
|
898
|
+
DrawerSwipeAreaDataAttributes["swipeDirection"] = "data-swipe-direction";
|
|
899
|
+
/** Present when the drawer is being swiped. */
|
|
900
|
+
DrawerSwipeAreaDataAttributes["swiping"] = "data-swiping";
|
|
901
|
+
return DrawerSwipeAreaDataAttributes;
|
|
902
|
+
}({});
|
|
903
|
+
//#endregion
|
|
904
|
+
//#region src/drawer/swipe-area/DrawerSwipeArea.tsx
|
|
905
|
+
var DEFAULT_SWIPE_OPEN_RATIO = .5;
|
|
906
|
+
var MIN_SWIPE_START_DISTANCE = 1;
|
|
907
|
+
var VELOCITY_THRESHOLD = .1;
|
|
908
|
+
var FALLBACK_SWIPE_OPEN_THRESHOLD = 40;
|
|
909
|
+
var SWIPE_AREA_OPEN = { [DrawerSwipeAreaDataAttributes.open]: "" };
|
|
910
|
+
var SWIPE_AREA_CLOSED = { [DrawerSwipeAreaDataAttributes.closed]: "" };
|
|
911
|
+
var SWIPE_AREA_SWIPING = { [DrawerSwipeAreaDataAttributes.swiping]: "" };
|
|
912
|
+
var SWIPE_AREA_DISABLED = { [DrawerSwipeAreaDataAttributes.disabled]: "" };
|
|
913
|
+
var stateAttributesMapping = {
|
|
914
|
+
open: (value) => value ? SWIPE_AREA_OPEN : SWIPE_AREA_CLOSED,
|
|
915
|
+
swiping: (value) => value ? SWIPE_AREA_SWIPING : null,
|
|
916
|
+
swipeDirection: (value) => ({ [DrawerSwipeAreaDataAttributes.swipeDirection]: value }),
|
|
917
|
+
disabled: (value) => value ? SWIPE_AREA_DISABLED : null
|
|
918
|
+
};
|
|
919
|
+
var oppositeSwipeDirection = {
|
|
920
|
+
up: "down",
|
|
921
|
+
down: "up",
|
|
922
|
+
left: "right",
|
|
923
|
+
right: "left"
|
|
924
|
+
};
|
|
925
|
+
function resolveTouchAction(direction) {
|
|
926
|
+
return direction === "left" || direction === "right" ? "pan-y" : "pan-x";
|
|
927
|
+
}
|
|
928
|
+
function isVirtualClick(event) {
|
|
929
|
+
return event.mozInputSource === 0 ? event.isTrusted : event.detail === 0 && !event.pointerType;
|
|
930
|
+
}
|
|
931
|
+
/** An invisible area that listens for swipe gestures to open the drawer. */
|
|
932
|
+
function DrawerSwipeArea(props) {
|
|
933
|
+
const context = useDialogRootContext();
|
|
934
|
+
const store = context.store;
|
|
935
|
+
const drawer = useDrawerRootContext();
|
|
936
|
+
const provider = useDrawerProviderContext();
|
|
937
|
+
const internalProps = props;
|
|
938
|
+
const others = omit(props, "as", "class", "disabled", "id", "onPointerCancel", "onPointerDown", "onPointerMove", "onPointerUp", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "ref", "style", "swipeDirection");
|
|
939
|
+
const generatedId = `base-ui-${createUniqueId()}`;
|
|
940
|
+
const id = createMemo(() => internalProps.id || generatedId);
|
|
941
|
+
const disabled = createMemo(() => internalProps.disabled ?? false);
|
|
942
|
+
const [swipeAreaElement, setSwipeAreaElement] = createSignal(null, { ownedWrite: true });
|
|
943
|
+
const [swipeActive, setSwipeActive] = createSignal(false, { ownedWrite: true });
|
|
944
|
+
let swipeStartEvent = null;
|
|
945
|
+
let openedBySwipe = false;
|
|
946
|
+
const dragDelta = {
|
|
947
|
+
x: 0,
|
|
948
|
+
y: 0
|
|
949
|
+
};
|
|
950
|
+
let closedOffset = null;
|
|
951
|
+
let appliedSwipeStyles = false;
|
|
952
|
+
let swipePopupElement = null;
|
|
953
|
+
let swipeBackdropElement = null;
|
|
954
|
+
let popupTransition = null;
|
|
955
|
+
let releaseGuardCleanup = null;
|
|
956
|
+
const resolvedSwipeDirection = createMemo(() => internalProps.swipeDirection ?? oppositeSwipeDirection[drawer.swipeDirection()]);
|
|
957
|
+
const dismissDirection = createMemo(() => oppositeSwipeDirection[resolvedSwipeDirection()]);
|
|
958
|
+
const enabled = createMemo(() => !disabled() && (!store.open() || swipeActive()));
|
|
959
|
+
createTriggerRegistration(() => store, id, swipeAreaElement);
|
|
960
|
+
function resetDragDelta() {
|
|
961
|
+
dragDelta.x = 0;
|
|
962
|
+
dragDelta.y = 0;
|
|
963
|
+
}
|
|
964
|
+
function disableDismissForSwipe() {
|
|
965
|
+
releaseGuardCleanup?.();
|
|
966
|
+
context.outsidePressEnabled.current = false;
|
|
967
|
+
}
|
|
968
|
+
function enableDismissAfterRelease() {
|
|
969
|
+
releaseGuardCleanup?.();
|
|
970
|
+
const doc = ownerDocument(swipeAreaElement());
|
|
971
|
+
function restore(event) {
|
|
972
|
+
if (event?.type === "click" && event.detail !== 0 && !isVirtualClick(event)) return;
|
|
973
|
+
releaseGuardCleanup = null;
|
|
974
|
+
doc.removeEventListener("pointerdown", restore, true);
|
|
975
|
+
doc.removeEventListener("click", restore, true);
|
|
976
|
+
context.outsidePressEnabled.current = true;
|
|
977
|
+
}
|
|
978
|
+
releaseGuardCleanup = restore;
|
|
979
|
+
doc.addEventListener("pointerdown", restore, true);
|
|
980
|
+
doc.addEventListener("click", restore, true);
|
|
981
|
+
}
|
|
982
|
+
function getPopupSize(popupElement) {
|
|
983
|
+
const direction = dismissDirection();
|
|
984
|
+
const size = direction === "left" || direction === "right" ? popupElement.offsetWidth : popupElement.offsetHeight;
|
|
985
|
+
return size <= 0 ? null : size;
|
|
986
|
+
}
|
|
987
|
+
function resolvePopupSize() {
|
|
988
|
+
const popupElement = store.state.popupElement;
|
|
989
|
+
return popupElement ? getPopupSize(popupElement) : null;
|
|
990
|
+
}
|
|
991
|
+
function resolveClosedOffset(popupElement) {
|
|
992
|
+
const offset = getPopupSize(popupElement);
|
|
993
|
+
if (offset == null) return null;
|
|
994
|
+
const direction = dismissDirection();
|
|
995
|
+
const isHorizontal = direction === "left" || direction === "right";
|
|
996
|
+
const transform = getElementTransform(popupElement);
|
|
997
|
+
const transformOffset = isHorizontal ? transform.x : transform.y;
|
|
998
|
+
if (Number.isFinite(transformOffset) && Math.abs(transformOffset) > .5) return Math.min(offset, Math.abs(transformOffset));
|
|
999
|
+
return offset;
|
|
1000
|
+
}
|
|
1001
|
+
function resolveSwipeOpenThreshold() {
|
|
1002
|
+
const popupSize = resolvePopupSize();
|
|
1003
|
+
return popupSize == null ? FALLBACK_SWIPE_OPEN_THRESHOLD : popupSize * DEFAULT_SWIPE_OPEN_RATIO;
|
|
1004
|
+
}
|
|
1005
|
+
function applySwipeMovement() {
|
|
1006
|
+
const popupElement = store.state.popupElement;
|
|
1007
|
+
if (!popupElement) return;
|
|
1008
|
+
if (!store.open() || !context.presence.mounted()) return;
|
|
1009
|
+
closedOffset ??= resolveClosedOffset(popupElement);
|
|
1010
|
+
if (closedOffset === null) return;
|
|
1011
|
+
const direction = resolvedSwipeDirection();
|
|
1012
|
+
const dismiss = dismissDirection();
|
|
1013
|
+
const displacement = Math.max(0, getDisplacement(direction, dragDelta.x, dragDelta.y));
|
|
1014
|
+
const dampedDisplacement = displacement > closedOffset ? closedOffset + Math.sqrt(displacement - closedOffset) : displacement;
|
|
1015
|
+
const movement = (closedOffset - dampedDisplacement) * (dismiss === "left" || dismiss === "up" ? -1 : 1);
|
|
1016
|
+
const isHorizontal = dismiss === "left" || dismiss === "right";
|
|
1017
|
+
const movementX = isHorizontal ? movement : 0;
|
|
1018
|
+
const movementY = isHorizontal ? 0 : movement;
|
|
1019
|
+
const openProgress = Math.max(0, Math.min(1, displacement / closedOffset));
|
|
1020
|
+
const backdropProgress = Math.max(0, Math.min(1, 1 - openProgress));
|
|
1021
|
+
const frontmostHeight = drawer.frontmostHeight();
|
|
1022
|
+
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementX, `${movementX}px`);
|
|
1023
|
+
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementY, `${movementY}px`);
|
|
1024
|
+
popupElement.setAttribute(DrawerPopupDataAttributes.swiping, "");
|
|
1025
|
+
swipePopupElement = popupElement;
|
|
1026
|
+
popupTransition ??= popupElement.style.transition;
|
|
1027
|
+
popupElement.style.transition = "none";
|
|
1028
|
+
const backdropElement = context.backdropElement();
|
|
1029
|
+
if (backdropElement) {
|
|
1030
|
+
backdropElement.setAttribute(DrawerPopupDataAttributes.swiping, "");
|
|
1031
|
+
swipeBackdropElement = backdropElement;
|
|
1032
|
+
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `${backdropProgress}`);
|
|
1033
|
+
if (openProgress > 0 && frontmostHeight > 0) backdropElement.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1034
|
+
else backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1035
|
+
}
|
|
1036
|
+
provider?.visualStateStore.set({
|
|
1037
|
+
swipeProgress: openProgress,
|
|
1038
|
+
frontmostHeight: openProgress > 0 ? frontmostHeight : 0
|
|
1039
|
+
});
|
|
1040
|
+
appliedSwipeStyles = true;
|
|
1041
|
+
drawer.swipeAreaActive.current = true;
|
|
1042
|
+
}
|
|
1043
|
+
function clearSwipeStyles() {
|
|
1044
|
+
if (swipePopupElement) {
|
|
1045
|
+
swipePopupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementX);
|
|
1046
|
+
swipePopupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementY);
|
|
1047
|
+
swipePopupElement.removeAttribute(DrawerPopupDataAttributes.swiping);
|
|
1048
|
+
if (popupTransition !== null) {
|
|
1049
|
+
swipePopupElement.style.transition = popupTransition;
|
|
1050
|
+
popupTransition = null;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
if (swipeBackdropElement) {
|
|
1054
|
+
swipeBackdropElement.removeAttribute(DrawerPopupDataAttributes.swiping);
|
|
1055
|
+
swipeBackdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
1056
|
+
swipeBackdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1057
|
+
}
|
|
1058
|
+
provider?.visualStateStore.set({
|
|
1059
|
+
swipeProgress: 0,
|
|
1060
|
+
frontmostHeight: 0
|
|
1061
|
+
});
|
|
1062
|
+
appliedSwipeStyles = false;
|
|
1063
|
+
swipePopupElement = null;
|
|
1064
|
+
swipeBackdropElement = null;
|
|
1065
|
+
drawer.swipeAreaActive.current = false;
|
|
1066
|
+
}
|
|
1067
|
+
function openDrawer(event) {
|
|
1068
|
+
openedBySwipe = true;
|
|
1069
|
+
store.setOpen(true, createChangeEventDetails(swipe, event, swipeAreaElement() ?? void 0));
|
|
1070
|
+
}
|
|
1071
|
+
function closeDrawer(event) {
|
|
1072
|
+
store.setOpen(false, createChangeEventDetails(swipe, event, swipeAreaElement() ?? void 0));
|
|
1073
|
+
}
|
|
1074
|
+
function resetSwipeInteractionState() {
|
|
1075
|
+
swipeStartEvent = null;
|
|
1076
|
+
openedBySwipe = false;
|
|
1077
|
+
closedOffset = null;
|
|
1078
|
+
setSwipeActive(false);
|
|
1079
|
+
}
|
|
1080
|
+
function finishSwipeInteraction() {
|
|
1081
|
+
resetSwipeInteractionState();
|
|
1082
|
+
enableDismissAfterRelease();
|
|
1083
|
+
resetDragDelta();
|
|
1084
|
+
clearSwipeStyles();
|
|
1085
|
+
}
|
|
1086
|
+
const swipe$2 = createSwipeDismiss({
|
|
1087
|
+
enabled,
|
|
1088
|
+
directions: () => [resolvedSwipeDirection()],
|
|
1089
|
+
element: swipeAreaElement,
|
|
1090
|
+
trackDrag: false,
|
|
1091
|
+
movementCssVars: {
|
|
1092
|
+
x: DrawerPopupCssVars.swipeMovementX,
|
|
1093
|
+
y: DrawerPopupCssVars.swipeMovementY
|
|
1094
|
+
},
|
|
1095
|
+
onSwipeStart(event) {
|
|
1096
|
+
disableDismissForSwipe();
|
|
1097
|
+
swipeStartEvent = event;
|
|
1098
|
+
openedBySwipe = false;
|
|
1099
|
+
setSwipeActive(true);
|
|
1100
|
+
resetDragDelta();
|
|
1101
|
+
},
|
|
1102
|
+
onProgress(_progress, details) {
|
|
1103
|
+
if (!details || !swipeStartEvent) return;
|
|
1104
|
+
dragDelta.x = details.deltaX;
|
|
1105
|
+
dragDelta.y = details.deltaY;
|
|
1106
|
+
const direction = resolvedSwipeDirection();
|
|
1107
|
+
if (details.direction !== direction) return;
|
|
1108
|
+
const displacement = getDisplacement(direction, details.deltaX, details.deltaY);
|
|
1109
|
+
if (!openedBySwipe && displacement < MIN_SWIPE_START_DISTANCE) return;
|
|
1110
|
+
if (!openedBySwipe && !store.open()) openDrawer(swipeStartEvent);
|
|
1111
|
+
applySwipeMovement();
|
|
1112
|
+
},
|
|
1113
|
+
onRelease({ event, direction, deltaX, deltaY, releaseVelocityX, releaseVelocityY }) {
|
|
1114
|
+
const swipeOpenDirection = resolvedSwipeDirection();
|
|
1115
|
+
const displacement = getDisplacement(swipeOpenDirection, deltaX, deltaY);
|
|
1116
|
+
const releaseVelocity = getDisplacement(swipeOpenDirection, releaseVelocityX, releaseVelocityY);
|
|
1117
|
+
const hasEnoughDistance = displacement >= resolveSwipeOpenThreshold();
|
|
1118
|
+
if (direction === swipeOpenDirection && (hasEnoughDistance || releaseVelocity >= VELOCITY_THRESHOLD) && !disabled()) {
|
|
1119
|
+
if (!store.open()) openDrawer(event);
|
|
1120
|
+
} else if (openedBySwipe && store.open()) closeDrawer(event);
|
|
1121
|
+
finishSwipeInteraction();
|
|
1122
|
+
return false;
|
|
1123
|
+
},
|
|
1124
|
+
onCancel: finishSwipeInteraction
|
|
1125
|
+
});
|
|
1126
|
+
createEffect(() => ({
|
|
1127
|
+
active: swipeActive(),
|
|
1128
|
+
open: store.open(),
|
|
1129
|
+
mounted: context.presence.mounted(),
|
|
1130
|
+
popupElement: store.track().popupElement,
|
|
1131
|
+
frontmostHeight: drawer.frontmostHeight()
|
|
1132
|
+
}), (state) => {
|
|
1133
|
+
if (state.active && appliedSwipeStyles) untrack(applySwipeMovement);
|
|
1134
|
+
});
|
|
1135
|
+
createEffect(() => enabled(), (isEnabled) => {
|
|
1136
|
+
if (isEnabled) return;
|
|
1137
|
+
untrack(() => {
|
|
1138
|
+
if (swipeActive()) enableDismissAfterRelease();
|
|
1139
|
+
swipe$2.reset();
|
|
1140
|
+
resetDragDelta();
|
|
1141
|
+
clearSwipeStyles();
|
|
1142
|
+
resetSwipeInteractionState();
|
|
1143
|
+
});
|
|
1144
|
+
});
|
|
1145
|
+
onCleanup(() => {
|
|
1146
|
+
releaseGuardCleanup?.();
|
|
1147
|
+
context.outsidePressEnabled.current = true;
|
|
1148
|
+
});
|
|
1149
|
+
const state = createMemo(() => ({
|
|
1150
|
+
open: store.open(),
|
|
1151
|
+
swiping: swipe$2.swiping(),
|
|
1152
|
+
swipeDirection: resolvedSwipeDirection(),
|
|
1153
|
+
disabled: disabled()
|
|
1154
|
+
}));
|
|
1155
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1156
|
+
const styleValue = createMemo(() => mergeDialogStyles({
|
|
1157
|
+
"pointer-events": enabled() ? void 0 : "none",
|
|
1158
|
+
"touch-action": resolveTouchAction(resolvedSwipeDirection())
|
|
1159
|
+
}, resolveStyle(props.style, state())));
|
|
1160
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state(), stateAttributesMapping));
|
|
1161
|
+
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown, () => (event) => {
|
|
1162
|
+
if (event.pointerType === "touch") return;
|
|
1163
|
+
swipe$2.pointerHandlers.onPointerDown(event);
|
|
1164
|
+
if (event.cancelable) event.preventDefault();
|
|
1165
|
+
});
|
|
1166
|
+
const onPointerMove = composeEventHandlers(() => internalProps.onPointerMove, () => (event) => {
|
|
1167
|
+
if (event.pointerType === "touch") return;
|
|
1168
|
+
swipe$2.pointerHandlers.onPointerMove(event);
|
|
1169
|
+
});
|
|
1170
|
+
const onPointerUp = composeEventHandlers(() => internalProps.onPointerUp, () => (event) => {
|
|
1171
|
+
if (event.pointerType === "touch") return;
|
|
1172
|
+
swipe$2.pointerHandlers.onPointerUp(event);
|
|
1173
|
+
});
|
|
1174
|
+
const onPointerCancel = composeEventHandlers(() => internalProps.onPointerCancel, () => (event) => {
|
|
1175
|
+
if (event.pointerType === "touch") return;
|
|
1176
|
+
swipe$2.pointerHandlers.onPointerCancel(event);
|
|
1177
|
+
});
|
|
1178
|
+
const onTouchStart = composeEventHandlers(() => internalProps.onTouchStart, () => (event) => swipe$2.touchHandlers.onTouchStart(event));
|
|
1179
|
+
const onTouchMove = composeEventHandlers(() => internalProps.onTouchMove, () => (event) => swipe$2.touchHandlers.onTouchMove(event));
|
|
1180
|
+
const onTouchEnd = composeEventHandlers(() => internalProps.onTouchEnd, () => (event) => swipe$2.touchHandlers.onTouchEnd(event));
|
|
1181
|
+
const onTouchCancel = composeEventHandlers(() => internalProps.onTouchCancel, () => (event) => swipe$2.touchHandlers.onTouchCancel(event));
|
|
1182
|
+
return Dynamic(mergeProps({
|
|
1183
|
+
get component() {
|
|
1184
|
+
return props.as ?? "div";
|
|
1185
|
+
},
|
|
1186
|
+
ref: [((element) => setSwipeAreaElement(element)), internalProps.ref],
|
|
1187
|
+
get id() {
|
|
1188
|
+
return id();
|
|
1189
|
+
},
|
|
1190
|
+
role: "presentation",
|
|
1191
|
+
"aria-hidden": "true",
|
|
1192
|
+
get ["class"]() {
|
|
1193
|
+
return classValue();
|
|
1194
|
+
},
|
|
1195
|
+
get style() {
|
|
1196
|
+
return styleValue();
|
|
1197
|
+
},
|
|
1198
|
+
onPointerDown,
|
|
1199
|
+
onPointerMove,
|
|
1200
|
+
onPointerUp,
|
|
1201
|
+
onPointerCancel,
|
|
1202
|
+
onTouchStart,
|
|
1203
|
+
onTouchMove,
|
|
1204
|
+
onTouchEnd,
|
|
1205
|
+
onTouchCancel
|
|
1206
|
+
}, stateAttributes, others));
|
|
1207
|
+
}
|
|
1208
|
+
//#endregion
|
|
1209
|
+
//#region src/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardContext.ts
|
|
1210
|
+
var MISSING_CONTEXT = Symbol("DrawerVirtualKeyboardContext");
|
|
1211
|
+
var DrawerVirtualKeyboardContext = createContext(MISSING_CONTEXT);
|
|
1212
|
+
function useDrawerVirtualKeyboardContext() {
|
|
1213
|
+
const context = useContext(DrawerVirtualKeyboardContext);
|
|
1214
|
+
return context === MISSING_CONTEXT ? void 0 : context;
|
|
1215
|
+
}
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region src/drawer/viewport/DrawerViewport.tsx
|
|
1218
|
+
var MIN_SWIPE_THRESHOLD = 10;
|
|
1219
|
+
var FAST_SWIPE_VELOCITY = .5;
|
|
1220
|
+
var SNAP_VELOCITY_THRESHOLD = .5;
|
|
1221
|
+
var SNAP_VELOCITY_MULTIPLIER = 300;
|
|
1222
|
+
var MAX_SNAP_VELOCITY = 4;
|
|
1223
|
+
var MIN_SWIPE_RELEASE_VELOCITY = .2;
|
|
1224
|
+
var MAX_SWIPE_RELEASE_VELOCITY = 4;
|
|
1225
|
+
var MIN_SWIPE_RELEASE_DURATION_MS = 80;
|
|
1226
|
+
var MAX_SWIPE_RELEASE_DURATION_MS = 360;
|
|
1227
|
+
var MIN_SWIPE_RELEASE_SCALAR = .1;
|
|
1228
|
+
var AXIS_LOCK_SLOP = 6;
|
|
1229
|
+
var AXIS_LOCK_BIAS = 2;
|
|
1230
|
+
var DRAWER_CONTENT_SELECTOR = `[${DRAWER_CONTENT_ATTRIBUTE}]`;
|
|
1231
|
+
/** A positioning container for the drawer popup that can be made scrollable. */
|
|
1232
|
+
function DrawerViewport(props) {
|
|
1233
|
+
const context = useDialogRootContext();
|
|
1234
|
+
const store = context.store;
|
|
1235
|
+
const drawer = useDrawerRootContext();
|
|
1236
|
+
const provider = useDrawerProviderContext();
|
|
1237
|
+
const snap = createDrawerSnapPoints();
|
|
1238
|
+
const virtualKeyboard = useDrawerVirtualKeyboardContext();
|
|
1239
|
+
const internalProps = props;
|
|
1240
|
+
const others = omit(props, "children", "onPointerCancel", "onPointerDown", "onPointerMove", "onPointerUp", "onTouchCancel", "onTouchEnd", "onTouchStart");
|
|
1241
|
+
const open = () => store.open();
|
|
1242
|
+
const mounted = () => context.presence.mounted();
|
|
1243
|
+
const nestedDrawerOpen = () => context.nestedOpenDrawerCount() > 0;
|
|
1244
|
+
const swipeDirection = () => drawer.swipeDirection();
|
|
1245
|
+
const scrollAxis = () => swipeDirection() === "left" || swipeDirection() === "right" ? "horizontal" : "vertical";
|
|
1246
|
+
const crossScrollAxis = () => scrollAxis() === "vertical" ? "horizontal" : "vertical";
|
|
1247
|
+
const [swipeRelease, setSwipeRelease] = createSignal(null, { ownedWrite: true });
|
|
1248
|
+
let pendingSwipeCloseSnapPoint;
|
|
1249
|
+
let controlledDismissFrame;
|
|
1250
|
+
let swipingNow = false;
|
|
1251
|
+
let nestedSwipeActive = false;
|
|
1252
|
+
let lastPointerType = "";
|
|
1253
|
+
let ignoreNextTouchStartFromPen = false;
|
|
1254
|
+
let ignoreTouchSwipe = false;
|
|
1255
|
+
let touchScrollState = null;
|
|
1256
|
+
const snapPointRange = createMemo(() => {
|
|
1257
|
+
const points = drawer.snapPoints();
|
|
1258
|
+
const resolved = snap.resolvedSnapPoints();
|
|
1259
|
+
const direction = swipeDirection();
|
|
1260
|
+
if (!points || points.length < 2 || resolved.length < 2 || direction !== "down" && direction !== "up") return null;
|
|
1261
|
+
const offsets = resolved.map((point) => point.offset).sort((a, b) => a - b);
|
|
1262
|
+
return {
|
|
1263
|
+
minOffset: offsets[0],
|
|
1264
|
+
range: offsets[1] - offsets[0]
|
|
1265
|
+
};
|
|
1266
|
+
});
|
|
1267
|
+
const snapPointProgress = createMemo(() => {
|
|
1268
|
+
const range = snapPointRange();
|
|
1269
|
+
const offset = snap.activeSnapPointOffset();
|
|
1270
|
+
if (!range || offset === null) return null;
|
|
1271
|
+
return clamp((offset - range.minOffset) / range.range, 0, 1);
|
|
1272
|
+
});
|
|
1273
|
+
const swipeDirections = createMemo(() => {
|
|
1274
|
+
const points = drawer.snapPoints();
|
|
1275
|
+
const direction = swipeDirection();
|
|
1276
|
+
if (points && points.length > 0 && (direction === "down" || direction === "up")) return direction === "down" ? ["down", "up"] : ["up", "down"];
|
|
1277
|
+
return [direction];
|
|
1278
|
+
});
|
|
1279
|
+
function setSwipeDismissed(dismissed) {
|
|
1280
|
+
store.state.popupElement?.toggleAttribute(DrawerPopupDataAttributes.swipeDismiss, dismissed);
|
|
1281
|
+
context.backdropElement()?.toggleAttribute(DrawerPopupDataAttributes.swipeDismiss, dismissed);
|
|
1282
|
+
}
|
|
1283
|
+
function clearSwipeRelease() {
|
|
1284
|
+
setSwipeDismissed(false);
|
|
1285
|
+
store.state.popupElement?.removeAttribute(TransitionStatusDataAttributes.endingStyle);
|
|
1286
|
+
setSwipeRelease(null);
|
|
1287
|
+
}
|
|
1288
|
+
function finishNestedSwipe() {
|
|
1289
|
+
if (!nestedSwipeActive) return;
|
|
1290
|
+
nestedSwipeActive = false;
|
|
1291
|
+
drawer.notifyParentSwipingChange?.(false);
|
|
1292
|
+
}
|
|
1293
|
+
function applySwipeProgress(resolvedProgress, shouldTrackProgress, notifyParent) {
|
|
1294
|
+
const isActive = open() && !context.nested && shouldTrackProgress;
|
|
1295
|
+
const progress = isActive ? resolvedProgress : 0;
|
|
1296
|
+
const nestedSwipeProgress = open() && shouldTrackProgress ? resolvedProgress : 0;
|
|
1297
|
+
const frontmostHeight = drawer.frontmostHeight();
|
|
1298
|
+
if (notifyParent && drawer.notifyParentSwipeProgressChange) {
|
|
1299
|
+
drawer.notifyParentSwipeProgressChange(nestedSwipeProgress);
|
|
1300
|
+
if (nestedSwipeProgress <= 0) finishNestedSwipe();
|
|
1301
|
+
}
|
|
1302
|
+
provider?.visualStateStore.set({
|
|
1303
|
+
swipeProgress: progress,
|
|
1304
|
+
frontmostHeight: progress > 0 ? frontmostHeight : 0
|
|
1305
|
+
});
|
|
1306
|
+
const backdropElement = context.backdropElement();
|
|
1307
|
+
if (!backdropElement) return;
|
|
1308
|
+
const showProgress = isActive && progress > 0;
|
|
1309
|
+
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, showProgress ? `${progress}` : "0");
|
|
1310
|
+
if (showProgress && frontmostHeight > 0) backdropElement.style.setProperty(DrawerPopupCssVars.height, `${frontmostHeight}px`);
|
|
1311
|
+
else backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1312
|
+
}
|
|
1313
|
+
function resolveSwipeRelease(popupElement, direction, deltaX, deltaY, velocityX, velocityY, releaseVelocityX, releaseVelocityY) {
|
|
1314
|
+
const size = getBaseSwipeSize(popupElement, direction);
|
|
1315
|
+
if (size <= 0) return null;
|
|
1316
|
+
const points = drawer.snapPoints();
|
|
1317
|
+
const translationAlongDirection = ((direction === "down" || direction === "up") && points && points.length > 0 ? snap.activeSnapPointOffset() ?? 0 : 0) + getDisplacement(direction, deltaX, deltaY);
|
|
1318
|
+
const remainingDistance = Math.max(0, size - translationAlongDirection);
|
|
1319
|
+
if (remainingDistance <= 0) return null;
|
|
1320
|
+
const releaseVelocity = getDisplacement(direction, releaseVelocityX, releaseVelocityY);
|
|
1321
|
+
const directionalVelocity = Math.abs(releaseVelocity) > 0 ? releaseVelocity : getDisplacement(direction, velocityX, velocityY);
|
|
1322
|
+
if (directionalVelocity <= MIN_SWIPE_RELEASE_VELOCITY) return null;
|
|
1323
|
+
const clampedVelocity = clamp(directionalVelocity, MIN_SWIPE_RELEASE_VELOCITY, MAX_SWIPE_RELEASE_VELOCITY);
|
|
1324
|
+
return MIN_SWIPE_RELEASE_SCALAR + (clamp(remainingDistance / clampedVelocity, MIN_SWIPE_RELEASE_DURATION_MS, MAX_SWIPE_RELEASE_DURATION_MS) - MIN_SWIPE_RELEASE_DURATION_MS) / 280 * .9;
|
|
1325
|
+
}
|
|
1326
|
+
function updateNestedSwipeActive(details) {
|
|
1327
|
+
if (nestedSwipeActive || !details) return;
|
|
1328
|
+
const direction = details.direction ?? swipeDirection();
|
|
1329
|
+
if (Math.abs(getDisplacement(direction, details.deltaX, details.deltaY)) < MIN_SWIPE_THRESHOLD) return;
|
|
1330
|
+
nestedSwipeActive = true;
|
|
1331
|
+
drawer.notifyParentSwipingChange?.(true);
|
|
1332
|
+
}
|
|
1333
|
+
const swipe$1 = createSwipeDismiss({
|
|
1334
|
+
enabled: () => mounted() && !nestedDrawerOpen(),
|
|
1335
|
+
directions: swipeDirections,
|
|
1336
|
+
element: () => store.track().popupElement,
|
|
1337
|
+
ignoreSelectorWhenTouch: false,
|
|
1338
|
+
ignoreScrollableAncestors: true,
|
|
1339
|
+
movementCssVars: {
|
|
1340
|
+
x: DrawerPopupCssVars.swipeMovementX,
|
|
1341
|
+
y: DrawerPopupCssVars.swipeMovementY
|
|
1342
|
+
},
|
|
1343
|
+
swipeThreshold: ({ element, direction }) => getBaseSwipeThreshold(element, direction),
|
|
1344
|
+
onSwipeStart(event) {
|
|
1345
|
+
if ("touches" in event || event.pointerType === "touch") return;
|
|
1346
|
+
const popupElement = store.state.popupElement;
|
|
1347
|
+
const selection = ownerDocument(popupElement).getSelection?.();
|
|
1348
|
+
if (!selection || selection.isCollapsed) return;
|
|
1349
|
+
const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
1350
|
+
const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
1351
|
+
if (!contains(popupElement, anchorElement) && !contains(popupElement, focusElement)) return;
|
|
1352
|
+
selection.removeAllRanges();
|
|
1353
|
+
},
|
|
1354
|
+
onSwipingChange(swiping) {
|
|
1355
|
+
swipingNow = swiping;
|
|
1356
|
+
setBackdropSwipingAttribute(context.backdropElement(), swiping);
|
|
1357
|
+
if (!swiping && !drawer.notifyParentSwipeProgressChange) finishNestedSwipe();
|
|
1358
|
+
},
|
|
1359
|
+
canStart(position, details) {
|
|
1360
|
+
const popupElement = store.state.popupElement;
|
|
1361
|
+
if (!popupElement) return false;
|
|
1362
|
+
const elementAtPoint = getElementAtPoint(popupElement.getRootNode(), position.x, position.y);
|
|
1363
|
+
if (!elementAtPoint || !contains(popupElement, elementAtPoint)) return false;
|
|
1364
|
+
const nativeEvent = details.nativeEvent;
|
|
1365
|
+
if (("touches" in nativeEvent || nativeEvent.pointerType === "touch") && shouldIgnoreSwipeForTextSelection(popupElement.ownerDocument, popupElement)) return false;
|
|
1366
|
+
return true;
|
|
1367
|
+
},
|
|
1368
|
+
onProgress(progress, details) {
|
|
1369
|
+
updateNestedSwipeActive(details);
|
|
1370
|
+
const points = drawer.snapPoints();
|
|
1371
|
+
const hasSnapPoints = Boolean(points && points.length > 0);
|
|
1372
|
+
if (swipingNow && swipeDirection() === "down" && hasSnapPoints && details) {
|
|
1373
|
+
const popupElement = store.state.popupElement;
|
|
1374
|
+
if (popupElement) {
|
|
1375
|
+
popupElement.style.removeProperty("transform");
|
|
1376
|
+
popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementY, `${getSnapPointSwipeMovement(snap.activeSnapPointOffset() ?? 0, details.deltaY)}px`);
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
let resolvedProgress = progress;
|
|
1380
|
+
const range = snapPointRange();
|
|
1381
|
+
const popupHeight = snap.popupHeight();
|
|
1382
|
+
if (range && popupHeight > 0) {
|
|
1383
|
+
const baseOffset = snap.activeSnapPointOffset() ?? range.minOffset;
|
|
1384
|
+
const offsetToProgress = (nextOffset) => clamp((nextOffset - range.minOffset) / range.range, 0, 1);
|
|
1385
|
+
if (details && Number.isFinite(details.deltaY)) resolvedProgress = offsetToProgress(clamp(baseOffset + details.deltaY, 0, popupHeight));
|
|
1386
|
+
else {
|
|
1387
|
+
const progressFromSnapPoint = snapPointProgress();
|
|
1388
|
+
if (progressFromSnapPoint !== null) resolvedProgress = progressFromSnapPoint;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
applySwipeProgress(resolvedProgress, true, true);
|
|
1392
|
+
},
|
|
1393
|
+
onRelease({ event, deltaX, deltaY, direction, velocityX, velocityY, releaseVelocityX, releaseVelocityY }) {
|
|
1394
|
+
const popupElement = store.state.popupElement;
|
|
1395
|
+
if (!popupElement) {
|
|
1396
|
+
clearSwipeRelease();
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1399
|
+
function startSwipeRelease(resolvedDirection) {
|
|
1400
|
+
finishNestedSwipe();
|
|
1401
|
+
setSwipeDismissed(true);
|
|
1402
|
+
popupElement.style.removeProperty("transition");
|
|
1403
|
+
popupElement.setAttribute(TransitionStatusDataAttributes.endingStyle, "");
|
|
1404
|
+
setSwipeRelease(resolveSwipeRelease(popupElement, resolvedDirection, deltaX, deltaY, velocityX, velocityY, releaseVelocityX, releaseVelocityY));
|
|
1405
|
+
flush();
|
|
1406
|
+
}
|
|
1407
|
+
const points = drawer.snapPoints();
|
|
1408
|
+
const currentSwipeDirection = swipeDirection();
|
|
1409
|
+
if (!points || points.length === 0) {
|
|
1410
|
+
if (!direction) {
|
|
1411
|
+
clearSwipeRelease();
|
|
1412
|
+
return;
|
|
1413
|
+
}
|
|
1414
|
+
const directionalDelta = getDisplacement(direction, deltaX, deltaY);
|
|
1415
|
+
if (directionalDelta <= 0) {
|
|
1416
|
+
clearSwipeRelease();
|
|
1417
|
+
return false;
|
|
1418
|
+
}
|
|
1419
|
+
if (getDisplacement(direction, velocityX, velocityY) >= FAST_SWIPE_VELOCITY) {
|
|
1420
|
+
startSwipeRelease(direction);
|
|
1421
|
+
return true;
|
|
1422
|
+
}
|
|
1423
|
+
const shouldClose = directionalDelta > getBaseSwipeThreshold(popupElement, direction);
|
|
1424
|
+
if (shouldClose) startSwipeRelease(direction);
|
|
1425
|
+
else clearSwipeRelease();
|
|
1426
|
+
return shouldClose;
|
|
1427
|
+
}
|
|
1428
|
+
if (currentSwipeDirection !== "down" && currentSwipeDirection !== "up") {
|
|
1429
|
+
clearSwipeRelease();
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
const popupHeight = snap.popupHeight();
|
|
1433
|
+
if (!popupHeight) {
|
|
1434
|
+
clearSwipeRelease();
|
|
1435
|
+
return false;
|
|
1436
|
+
}
|
|
1437
|
+
const resolvedSnapPoints = snap.resolvedSnapPoints();
|
|
1438
|
+
if (resolvedSnapPoints.length === 0) {
|
|
1439
|
+
clearSwipeRelease();
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
const dragDelta = currentSwipeDirection === "down" ? deltaY : -deltaY;
|
|
1443
|
+
const dragDirection = Math.sign(dragDelta);
|
|
1444
|
+
const releaseDirectionalVelocity = currentSwipeDirection === "down" ? releaseVelocityY : -releaseVelocityY;
|
|
1445
|
+
const fallbackDirectionalVelocity = currentSwipeDirection === "down" ? velocityY : -velocityY;
|
|
1446
|
+
let resolvedDirectionalVelocity = releaseDirectionalVelocity;
|
|
1447
|
+
if (dragDirection !== 0 && Math.abs(dragDelta) >= MIN_SWIPE_THRESHOLD) {
|
|
1448
|
+
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
1449
|
+
if (velocityDirection !== 0 && velocityDirection !== dragDirection) resolvedDirectionalVelocity = fallbackDirectionalVelocity;
|
|
1450
|
+
}
|
|
1451
|
+
const currentOffset = snap.activeSnapPointOffset() ?? 0;
|
|
1452
|
+
const dragTargetOffset = clamp(currentOffset + dragDelta, 0, popupHeight);
|
|
1453
|
+
const velocityOffset = Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD ? clamp(resolvedDirectionalVelocity, -4, MAX_SNAP_VELOCITY) * SNAP_VELOCITY_MULTIPLIER : 0;
|
|
1454
|
+
const targetOffset = drawer.snapToSequentialPoints() ? dragTargetOffset : clamp(dragTargetOffset + velocityOffset, 0, popupHeight);
|
|
1455
|
+
const snapPointEventDetails = createChangeEventDetails(swipe, event);
|
|
1456
|
+
const closeFromSnapPoints = () => {
|
|
1457
|
+
pendingSwipeCloseSnapPoint = snap.activeSnapPoint();
|
|
1458
|
+
drawer.setActiveSnapPoint(null, snapPointEventDetails);
|
|
1459
|
+
startSwipeRelease(currentSwipeDirection);
|
|
1460
|
+
return true;
|
|
1461
|
+
};
|
|
1462
|
+
if (drawer.snapToSequentialPoints()) {
|
|
1463
|
+
const orderedSnapPoints = [...resolvedSnapPoints].sort((first, second) => first.offset - second.offset);
|
|
1464
|
+
const orderedOffsets = orderedSnapPoints.map((point) => point.offset);
|
|
1465
|
+
const currentIndex = closestSnapPointIndex(orderedOffsets, currentOffset);
|
|
1466
|
+
let targetSnapPoint = orderedSnapPoints[closestSnapPointIndex(orderedOffsets, targetOffset)];
|
|
1467
|
+
const velocityDirection = Math.sign(resolvedDirectionalVelocity);
|
|
1468
|
+
const shouldAdvance = dragDirection !== 0 && velocityDirection !== 0 && velocityDirection === dragDirection && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD;
|
|
1469
|
+
let effectiveTargetOffset = targetOffset;
|
|
1470
|
+
if (shouldAdvance) {
|
|
1471
|
+
const adjacentIndex = clamp(currentIndex + dragDirection, 0, orderedSnapPoints.length - 1);
|
|
1472
|
+
if (adjacentIndex !== currentIndex) {
|
|
1473
|
+
const adjacentPoint = orderedSnapPoints[adjacentIndex];
|
|
1474
|
+
if (dragDirection > 0 ? targetOffset < adjacentPoint.offset : targetOffset > adjacentPoint.offset) {
|
|
1475
|
+
targetSnapPoint = adjacentPoint;
|
|
1476
|
+
effectiveTargetOffset = adjacentPoint.offset;
|
|
1477
|
+
}
|
|
1478
|
+
} else if (dragDirection > 0) return closeFromSnapPoints();
|
|
1479
|
+
}
|
|
1480
|
+
if (Math.abs(effectiveTargetOffset - popupHeight) < Math.abs(effectiveTargetOffset - targetSnapPoint.offset)) return closeFromSnapPoints();
|
|
1481
|
+
drawer.setActiveSnapPoint(targetSnapPoint.value, snapPointEventDetails);
|
|
1482
|
+
clearSwipeRelease();
|
|
1483
|
+
return false;
|
|
1484
|
+
}
|
|
1485
|
+
if (resolvedDirectionalVelocity >= FAST_SWIPE_VELOCITY && dragDelta > 0) return closeFromSnapPoints();
|
|
1486
|
+
const closestSnapPoint = resolvedSnapPoints[closestSnapPointIndex(resolvedSnapPoints.map((point) => point.offset), targetOffset)];
|
|
1487
|
+
if (Math.abs(targetOffset - popupHeight) < Math.abs(targetOffset - closestSnapPoint.offset)) return closeFromSnapPoints();
|
|
1488
|
+
drawer.setActiveSnapPoint(closestSnapPoint.value, snapPointEventDetails);
|
|
1489
|
+
clearSwipeRelease();
|
|
1490
|
+
return false;
|
|
1491
|
+
},
|
|
1492
|
+
onDismiss(event) {
|
|
1493
|
+
provider?.visualStateStore.set({
|
|
1494
|
+
swipeProgress: 0,
|
|
1495
|
+
frontmostHeight: 0
|
|
1496
|
+
});
|
|
1497
|
+
const backdropElement = context.backdropElement();
|
|
1498
|
+
if (backdropElement) {
|
|
1499
|
+
backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0");
|
|
1500
|
+
backdropElement.style.removeProperty(DrawerPopupCssVars.height);
|
|
1501
|
+
}
|
|
1502
|
+
const dismissEventDetails = createChangeEventDetails(swipe, event);
|
|
1503
|
+
store.setOpen(false, dismissEventDetails);
|
|
1504
|
+
if (dismissEventDetails.isCanceled) {
|
|
1505
|
+
if (pendingSwipeCloseSnapPoint !== void 0) drawer.setActiveSnapPoint(pendingSwipeCloseSnapPoint, createChangeEventDetails(swipe, event));
|
|
1506
|
+
pendingSwipeCloseSnapPoint = void 0;
|
|
1507
|
+
swipe$1.reset();
|
|
1508
|
+
clearSwipeRelease();
|
|
1509
|
+
return;
|
|
1510
|
+
}
|
|
1511
|
+
if (store.open()) {
|
|
1512
|
+
const savedEvent = event;
|
|
1513
|
+
controlledDismissFrame = requestAnimationFrame(() => {
|
|
1514
|
+
controlledDismissFrame = void 0;
|
|
1515
|
+
if (store.open()) {
|
|
1516
|
+
if (pendingSwipeCloseSnapPoint !== void 0) drawer.setActiveSnapPoint(pendingSwipeCloseSnapPoint, createChangeEventDetails(swipe, savedEvent));
|
|
1517
|
+
pendingSwipeCloseSnapPoint = void 0;
|
|
1518
|
+
clearSwipeRelease();
|
|
1519
|
+
swipe$1.reset();
|
|
1520
|
+
} else pendingSwipeCloseSnapPoint = void 0;
|
|
1521
|
+
});
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
pendingSwipeCloseSnapPoint = void 0;
|
|
1525
|
+
setSwipeDismissed(true);
|
|
1526
|
+
}
|
|
1527
|
+
});
|
|
1528
|
+
createEffect(() => ({
|
|
1529
|
+
mounted: mounted(),
|
|
1530
|
+
nestedDrawerOpen: nestedDrawerOpen(),
|
|
1531
|
+
open: open(),
|
|
1532
|
+
rootElement: context.viewportElement() ?? store.track().popupElement,
|
|
1533
|
+
axis: scrollAxis(),
|
|
1534
|
+
direction: swipeDirection()
|
|
1535
|
+
}), (state) => {
|
|
1536
|
+
const rootElement = state.rootElement;
|
|
1537
|
+
if (!rootElement) return;
|
|
1538
|
+
const isVerticalScrollAxis = state.axis === "vertical";
|
|
1539
|
+
const doc = ownerDocument(rootElement);
|
|
1540
|
+
function processTouchMove(event, touchState, touch) {
|
|
1541
|
+
const drawerAxisDelta = isVerticalScrollAxis ? touch.clientY - touchState.lastY : touch.clientX - touchState.lastX;
|
|
1542
|
+
if (event.touches.length === 2) return;
|
|
1543
|
+
if (shouldIgnoreSwipeForTextSelection(doc, rootElement)) return;
|
|
1544
|
+
if (!state.open || !state.mounted || state.nestedDrawerOpen) return;
|
|
1545
|
+
if (shouldYieldTouchMove(touchState, event, touch, isVerticalScrollAxis)) return;
|
|
1546
|
+
const scrollTarget = touchState.scrollTarget;
|
|
1547
|
+
if (!scrollTarget || scrollTarget === doc.documentElement || scrollTarget === doc.body) {
|
|
1548
|
+
if (event.cancelable) event.preventDefault();
|
|
1549
|
+
event.stopPropagation();
|
|
1550
|
+
swipe$1.moveNative(event, rootElement);
|
|
1551
|
+
return;
|
|
1552
|
+
}
|
|
1553
|
+
if (!hasScrollableContentOnAxis(scrollTarget, state.axis)) {
|
|
1554
|
+
if (event.cancelable) event.preventDefault();
|
|
1555
|
+
event.stopPropagation();
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1558
|
+
if (drawerAxisDelta !== 0) {
|
|
1559
|
+
const canSwipeFromScrollEdge = canSwipeFromScrollEdgeOnMove(scrollTarget, state.axis, state.direction, drawerAxisDelta);
|
|
1560
|
+
if (!touchState.allowSwipe) {
|
|
1561
|
+
if (event.cancelable && canSwipeFromScrollEdge) {
|
|
1562
|
+
touchState.allowSwipe = true;
|
|
1563
|
+
event.preventDefault();
|
|
1564
|
+
} else touchState.allowSwipe = false;
|
|
1565
|
+
} else if (event.cancelable) event.preventDefault();
|
|
1566
|
+
}
|
|
1567
|
+
if (touchState.allowSwipe === true) {
|
|
1568
|
+
event.stopPropagation();
|
|
1569
|
+
swipe$1.moveNative(event, rootElement);
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
function handleNativeTouchMove(event) {
|
|
1573
|
+
virtualKeyboard?.onTouchMove(event);
|
|
1574
|
+
if (ignoreTouchSwipe) return;
|
|
1575
|
+
const touch = event.touches[0];
|
|
1576
|
+
if (!touch || !touchScrollState) return;
|
|
1577
|
+
processTouchMove(event, touchScrollState, touch);
|
|
1578
|
+
touchScrollState.lastX = touch.clientX;
|
|
1579
|
+
touchScrollState.lastY = touch.clientY;
|
|
1580
|
+
}
|
|
1581
|
+
doc.addEventListener("touchmove", handleNativeTouchMove, {
|
|
1582
|
+
passive: false,
|
|
1583
|
+
capture: true
|
|
1584
|
+
});
|
|
1585
|
+
return () => doc.removeEventListener("touchmove", handleNativeTouchMove, { capture: true });
|
|
1586
|
+
});
|
|
1587
|
+
createEffect(() => ({
|
|
1588
|
+
range: snapPointRange(),
|
|
1589
|
+
swiping: swipe$1.swiping(),
|
|
1590
|
+
open: open(),
|
|
1591
|
+
nested: context.nested,
|
|
1592
|
+
progress: snapPointProgress(),
|
|
1593
|
+
frontmostHeight: drawer.frontmostHeight()
|
|
1594
|
+
}), (state) => {
|
|
1595
|
+
if (!state.range || state.swiping) return;
|
|
1596
|
+
untrack(() => applySwipeProgress(!state.open || state.nested ? 0 : state.progress ?? 0, true, false));
|
|
1597
|
+
});
|
|
1598
|
+
createEffect(() => open(), (isOpen) => {
|
|
1599
|
+
if (!drawer.notifyParentSwipeProgressChange) return;
|
|
1600
|
+
if (!isOpen) drawer.notifyParentSwipeProgressChange(0);
|
|
1601
|
+
return () => drawer.notifyParentSwipeProgressChange?.(0);
|
|
1602
|
+
});
|
|
1603
|
+
createEffect(() => open(), (isOpen) => {
|
|
1604
|
+
if (!isOpen) return;
|
|
1605
|
+
untrack(() => {
|
|
1606
|
+
if (!drawer.swipeAreaActive.current) swipe$1.reset();
|
|
1607
|
+
clearSwipeRelease();
|
|
1608
|
+
});
|
|
1609
|
+
});
|
|
1610
|
+
onCleanup(() => {
|
|
1611
|
+
if (controlledDismissFrame !== void 0) cancelAnimationFrame(controlledDismissFrame);
|
|
1612
|
+
provider?.visualStateStore.set({
|
|
1613
|
+
swipeProgress: 0,
|
|
1614
|
+
frontmostHeight: 0
|
|
1615
|
+
});
|
|
1616
|
+
setBackdropSwipingAttribute(context.backdropElement(), false);
|
|
1617
|
+
finishNestedSwipe();
|
|
1618
|
+
});
|
|
1619
|
+
const viewportContext = {
|
|
1620
|
+
swiping: swipe$1.swiping,
|
|
1621
|
+
getDragStyles: swipe$1.getDragStyles,
|
|
1622
|
+
swipeStrength: swipeRelease,
|
|
1623
|
+
setSwipeDismissed
|
|
1624
|
+
};
|
|
1625
|
+
function resetTouchSwipeState(ignoreSwipe) {
|
|
1626
|
+
ignoreTouchSwipe = ignoreSwipe;
|
|
1627
|
+
touchScrollState = null;
|
|
1628
|
+
}
|
|
1629
|
+
function resetTouchTrackingState() {
|
|
1630
|
+
resetTouchSwipeState(false);
|
|
1631
|
+
lastPointerType = "";
|
|
1632
|
+
ignoreNextTouchStartFromPen = false;
|
|
1633
|
+
}
|
|
1634
|
+
function handlePointerEnd(event) {
|
|
1635
|
+
lastPointerType = "";
|
|
1636
|
+
return event.pointerType !== "touch";
|
|
1637
|
+
}
|
|
1638
|
+
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown, () => (event) => {
|
|
1639
|
+
lastPointerType = event.pointerType;
|
|
1640
|
+
ignoreNextTouchStartFromPen = event.pointerType === "pen";
|
|
1641
|
+
if (!open() || !mounted() || nestedDrawerOpen()) return;
|
|
1642
|
+
const currentTarget = event.currentTarget;
|
|
1643
|
+
const elementAtPoint = getElementAtPoint(currentTarget.getRootNode(), event.clientX, event.clientY);
|
|
1644
|
+
if (isSwipeIgnoredTarget(elementAtPoint) || isDrawerContentTarget(elementAtPoint)) return;
|
|
1645
|
+
if (event.pointerType === "touch") return;
|
|
1646
|
+
swipe$1.pointerHandlers.onPointerDown(event);
|
|
1647
|
+
});
|
|
1648
|
+
const onPointerMove = composeEventHandlers(() => internalProps.onPointerMove, () => (event) => {
|
|
1649
|
+
if (event.pointerType === "touch") return;
|
|
1650
|
+
swipe$1.pointerHandlers.onPointerMove(event);
|
|
1651
|
+
});
|
|
1652
|
+
const onPointerUp = composeEventHandlers(() => internalProps.onPointerUp, () => (event) => {
|
|
1653
|
+
if (handlePointerEnd(event)) swipe$1.pointerHandlers.onPointerUp(event);
|
|
1654
|
+
});
|
|
1655
|
+
const onPointerCancel = composeEventHandlers(() => internalProps.onPointerCancel, () => (event) => {
|
|
1656
|
+
if (handlePointerEnd(event)) swipe$1.pointerHandlers.onPointerCancel(event);
|
|
1657
|
+
});
|
|
1658
|
+
const onTouchStart = composeEventHandlers(() => internalProps.onTouchStart, () => (event) => {
|
|
1659
|
+
if (lastPointerType === "pen" && ignoreNextTouchStartFromPen) {
|
|
1660
|
+
ignoreNextTouchStartFromPen = false;
|
|
1661
|
+
resetTouchSwipeState(false);
|
|
1662
|
+
return;
|
|
1663
|
+
}
|
|
1664
|
+
if (!open() || !mounted() || nestedDrawerOpen()) {
|
|
1665
|
+
resetTouchSwipeState(false);
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
const touch = event.touches[0];
|
|
1669
|
+
if (!touch) return;
|
|
1670
|
+
const rootElement = event.currentTarget;
|
|
1671
|
+
if (isEventOnRangeInput(event, ownerWindow(rootElement))) {
|
|
1672
|
+
resetTouchSwipeState(false);
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
const elementAtPoint = getElementAtPoint(rootElement.getRootNode(), touch.clientX, touch.clientY);
|
|
1676
|
+
const eventTarget = getEventTarget(event);
|
|
1677
|
+
const target = isElement(eventTarget) ? eventTarget : rootElement;
|
|
1678
|
+
if (!contains(rootElement, target)) {
|
|
1679
|
+
resetTouchSwipeState(true);
|
|
1680
|
+
return;
|
|
1681
|
+
}
|
|
1682
|
+
virtualKeyboard?.onTouchStart(event);
|
|
1683
|
+
if (isSwipeIgnoredTarget(elementAtPoint)) {
|
|
1684
|
+
resetTouchSwipeState(true);
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
ignoreTouchSwipe = false;
|
|
1688
|
+
const axis = scrollAxis();
|
|
1689
|
+
const scrollTarget = findScrollableTouchTarget(target, rootElement, axis);
|
|
1690
|
+
const hasCrossAxisScrollableContent = findScrollableTouchTarget(target, rootElement, crossScrollAxis()) != null;
|
|
1691
|
+
let allowSwipe = null;
|
|
1692
|
+
if (scrollTarget) allowSwipe = isAtSwipeStartEdge(scrollTarget, axis, swipeDirection()) ? null : false;
|
|
1693
|
+
touchScrollState = {
|
|
1694
|
+
startX: touch.clientX,
|
|
1695
|
+
startY: touch.clientY,
|
|
1696
|
+
lastX: touch.clientX,
|
|
1697
|
+
lastY: touch.clientY,
|
|
1698
|
+
scrollTarget,
|
|
1699
|
+
hasCrossAxisScrollableContent,
|
|
1700
|
+
allowSwipe,
|
|
1701
|
+
preserveNativeCrossAxisScroll: false,
|
|
1702
|
+
drawerAxisAttributed: false
|
|
1703
|
+
};
|
|
1704
|
+
swipe$1.touchHandlers.onTouchStart(event);
|
|
1705
|
+
});
|
|
1706
|
+
const onTouchEnd = composeEventHandlers(() => internalProps.onTouchEnd, () => (event) => {
|
|
1707
|
+
virtualKeyboard?.onTouchEnd(event);
|
|
1708
|
+
resetTouchTrackingState();
|
|
1709
|
+
swipe$1.touchHandlers.onTouchEnd(event);
|
|
1710
|
+
});
|
|
1711
|
+
const onTouchCancel = composeEventHandlers(() => internalProps.onTouchCancel, () => (event) => {
|
|
1712
|
+
virtualKeyboard?.onTouchCancel();
|
|
1713
|
+
resetTouchTrackingState();
|
|
1714
|
+
swipe$1.touchHandlers.onTouchCancel(event);
|
|
1715
|
+
});
|
|
1716
|
+
return DialogViewport(mergeProps(others, {
|
|
1717
|
+
onPointerDown,
|
|
1718
|
+
onPointerMove,
|
|
1719
|
+
onPointerUp,
|
|
1720
|
+
onPointerCancel,
|
|
1721
|
+
onTouchStart,
|
|
1722
|
+
onTouchEnd,
|
|
1723
|
+
onTouchCancel,
|
|
1724
|
+
"data-nested-dialog-open": void 0,
|
|
1725
|
+
get children() {
|
|
1726
|
+
return DrawerViewportContext({
|
|
1727
|
+
value: viewportContext,
|
|
1728
|
+
get children() {
|
|
1729
|
+
return props.children;
|
|
1730
|
+
}
|
|
1731
|
+
});
|
|
1732
|
+
}
|
|
1733
|
+
}));
|
|
1734
|
+
}
|
|
1735
|
+
function setBackdropSwipingAttribute(backdropElement, swiping) {
|
|
1736
|
+
backdropElement?.toggleAttribute(DrawerPopupDataAttributes.swiping, swiping);
|
|
1737
|
+
}
|
|
1738
|
+
function isSwipeIgnoredTarget(target) {
|
|
1739
|
+
return Boolean(target?.closest(BASE_UI_SWIPE_IGNORE_SELECTOR));
|
|
1740
|
+
}
|
|
1741
|
+
function isDrawerContentTarget(target) {
|
|
1742
|
+
return Boolean(target?.closest(DRAWER_CONTENT_SELECTOR));
|
|
1743
|
+
}
|
|
1744
|
+
function getBaseSwipeSize(element, direction) {
|
|
1745
|
+
return direction === "left" || direction === "right" ? element.offsetWidth : element.offsetHeight;
|
|
1746
|
+
}
|
|
1747
|
+
function getBaseSwipeThreshold(element, direction) {
|
|
1748
|
+
return Math.max(getBaseSwipeSize(element, direction) * .5, MIN_SWIPE_THRESHOLD);
|
|
1749
|
+
}
|
|
1750
|
+
function isRangeInput(target, win) {
|
|
1751
|
+
return target instanceof win.HTMLInputElement && target.type === "range";
|
|
1752
|
+
}
|
|
1753
|
+
function isTextSelectionControl(target) {
|
|
1754
|
+
return target.tagName === "INPUT" || target.tagName === "TEXTAREA";
|
|
1755
|
+
}
|
|
1756
|
+
function hasExpandedSelectionWithinTarget(selection, target) {
|
|
1757
|
+
const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement;
|
|
1758
|
+
const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement;
|
|
1759
|
+
return selection.containsNode(target, true) || contains(target, anchorElement) || contains(target, focusElement);
|
|
1760
|
+
}
|
|
1761
|
+
function shouldIgnoreSwipeForTextSelection(doc, rootElement) {
|
|
1762
|
+
const active = activeElement(doc);
|
|
1763
|
+
if (active && contains(rootElement, active) && isTextSelectionControl(active)) {
|
|
1764
|
+
const { selectionStart, selectionEnd } = active;
|
|
1765
|
+
if (selectionStart != null && selectionEnd != null && selectionStart < selectionEnd) return true;
|
|
1766
|
+
}
|
|
1767
|
+
const selection = doc.getSelection?.();
|
|
1768
|
+
if (!selection || selection.isCollapsed) return false;
|
|
1769
|
+
return hasExpandedSelectionWithinTarget(selection, rootElement);
|
|
1770
|
+
}
|
|
1771
|
+
function isEventOnRangeInput(event, win) {
|
|
1772
|
+
return event.composedPath().some((pathTarget) => isRangeInput(pathTarget, win));
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Arbitrates a touchmove between the drawer swipe and a native cross-axis scroll. Returns `true`
|
|
1776
|
+
* when the move must be left alone — either because the cross axis already won the gesture, or
|
|
1777
|
+
* because neither axis has passed the slop yet and the gesture cannot be attributed.
|
|
1778
|
+
*/
|
|
1779
|
+
function shouldYieldTouchMove(touchState, event, touch, isVerticalScrollAxis) {
|
|
1780
|
+
if (touchState.preserveNativeCrossAxisScroll) return true;
|
|
1781
|
+
if (touchState.drawerAxisAttributed || touchState.allowSwipe === true || !touchState.hasCrossAxisScrollableContent) return false;
|
|
1782
|
+
if (!event.cancelable) {
|
|
1783
|
+
touchState.preserveNativeCrossAxisScroll = true;
|
|
1784
|
+
return true;
|
|
1785
|
+
}
|
|
1786
|
+
const drawerAxisGestureDelta = isVerticalScrollAxis ? touch.clientY - touchState.startY : touch.clientX - touchState.startX;
|
|
1787
|
+
const crossAxisGestureDelta = isVerticalScrollAxis ? touch.clientX - touchState.startX : touch.clientY - touchState.startY;
|
|
1788
|
+
const absDrawerAxisGestureDelta = Math.abs(drawerAxisGestureDelta);
|
|
1789
|
+
const absCrossAxisGestureDelta = Math.abs(crossAxisGestureDelta);
|
|
1790
|
+
if (absCrossAxisGestureDelta >= AXIS_LOCK_SLOP && absCrossAxisGestureDelta > absDrawerAxisGestureDelta + AXIS_LOCK_BIAS) {
|
|
1791
|
+
touchState.preserveNativeCrossAxisScroll = true;
|
|
1792
|
+
return true;
|
|
1793
|
+
}
|
|
1794
|
+
if (absDrawerAxisGestureDelta >= AXIS_LOCK_SLOP) {
|
|
1795
|
+
touchState.drawerAxisAttributed = true;
|
|
1796
|
+
return false;
|
|
1797
|
+
}
|
|
1798
|
+
return true;
|
|
1799
|
+
}
|
|
1800
|
+
function hasScrollableContentOnAxis(scrollTarget, axis) {
|
|
1801
|
+
return getScrollMetrics(scrollTarget, axis).max > 0;
|
|
1802
|
+
}
|
|
1803
|
+
function getScrollMetrics(scrollTarget, axis) {
|
|
1804
|
+
if (axis === "vertical") return {
|
|
1805
|
+
offset: scrollTarget.scrollTop,
|
|
1806
|
+
max: Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight)
|
|
1807
|
+
};
|
|
1808
|
+
return {
|
|
1809
|
+
offset: scrollTarget.scrollLeft,
|
|
1810
|
+
max: Math.max(0, scrollTarget.scrollWidth - scrollTarget.clientWidth)
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
function isAtSwipeStartEdge(scrollTarget, axis, direction) {
|
|
1814
|
+
const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis);
|
|
1815
|
+
const { offset, max } = getScrollMetrics(scrollTarget, axis);
|
|
1816
|
+
return dismissFromStartEdge ? offset <= 0 : offset >= max;
|
|
1817
|
+
}
|
|
1818
|
+
function canSwipeFromScrollEdgeOnMove(scrollTarget, axis, direction, delta) {
|
|
1819
|
+
if (!(shouldDismissFromStartEdge(direction, axis) ? delta > 0 : delta < 0)) return false;
|
|
1820
|
+
return isAtSwipeStartEdge(scrollTarget, axis, direction);
|
|
1821
|
+
}
|
|
1822
|
+
function shouldDismissFromStartEdge(direction, axis) {
|
|
1823
|
+
return axis === "vertical" ? direction === "down" : direction === "right";
|
|
1824
|
+
}
|
|
1825
|
+
//#endregion
|
|
1826
|
+
//#region src/drawer/viewport/DrawerViewportCssVars.ts
|
|
1827
|
+
var DrawerViewportCssVars = /* @__PURE__ */ function(DrawerViewportCssVars) {
|
|
1828
|
+
/**
|
|
1829
|
+
* The software keyboard inset, measured from the bottom edge of the layout viewport.
|
|
1830
|
+
* Present only when the drawer is wrapped in `Drawer.VirtualKeyboardProvider`.
|
|
1831
|
+
* @type {CSS length}
|
|
1832
|
+
*/
|
|
1833
|
+
DrawerViewportCssVars["keyboardInset"] = "--drawer-keyboard-inset";
|
|
1834
|
+
return DrawerViewportCssVars;
|
|
1835
|
+
}({});
|
|
1836
|
+
//#endregion
|
|
1837
|
+
//#region src/drawer/virtual-keyboard-provider/DrawerVirtualKeyboardProvider.tsx
|
|
1838
|
+
var KEYBOARD_RESIZE_THRESHOLD = 60;
|
|
1839
|
+
var KEYBOARD_VISIBILITY_MARGIN = 16;
|
|
1840
|
+
var KEYBOARD_SCROLL_SLACK = 48;
|
|
1841
|
+
var KEYBOARD_REALIGN_INTERVAL = 150;
|
|
1842
|
+
var KEYBOARD_REALIGN_MAX_PASSES = 4;
|
|
1843
|
+
var KEYBOARD_SETTLE_FRAME_LIMIT = 60;
|
|
1844
|
+
var INPUT_TAP_MOVE_THRESHOLD = 10;
|
|
1845
|
+
var INPUT_TAP_HIT_SLOP = 16;
|
|
1846
|
+
var KEYBOARD_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
1847
|
+
"email",
|
|
1848
|
+
"number",
|
|
1849
|
+
"password",
|
|
1850
|
+
"search",
|
|
1851
|
+
"tel",
|
|
1852
|
+
"text",
|
|
1853
|
+
"url"
|
|
1854
|
+
]);
|
|
1855
|
+
/**
|
|
1856
|
+
* Returned by the point-based resolver when the lift point lands on another interactive/label
|
|
1857
|
+
* element. It signals that the tap was intentionally rejected, so the caller must NOT fall back to
|
|
1858
|
+
* the touchstart target (`touchend.target` stays at the touchstart node on mobile) — doing so
|
|
1859
|
+
* would steal a tap meant for that element.
|
|
1860
|
+
*/
|
|
1861
|
+
var KEYBOARD_TAP_BLOCKED = Symbol("KeyboardTapBlocked");
|
|
1862
|
+
/**
|
|
1863
|
+
* Provides keyboard-aware focus and scroll handling for bottom-sheet drawers with form fields.
|
|
1864
|
+
*/
|
|
1865
|
+
function DrawerVirtualKeyboardProvider(props) {
|
|
1866
|
+
const context = useDialogRootContext();
|
|
1867
|
+
const store = context.store;
|
|
1868
|
+
let pendingKeyboardFocusMoved = false;
|
|
1869
|
+
let keyboardTouchStart = null;
|
|
1870
|
+
let focusedKeyboardTarget = null;
|
|
1871
|
+
let keyboardScrollAdjustment = null;
|
|
1872
|
+
let programmaticKeyboardFocus = false;
|
|
1873
|
+
let keyboardFocusFrame;
|
|
1874
|
+
let keyboardRealignTimeout;
|
|
1875
|
+
function cancelKeyboardFocusFrame() {
|
|
1876
|
+
if (keyboardFocusFrame !== void 0) {
|
|
1877
|
+
cancelAnimationFrame(keyboardFocusFrame);
|
|
1878
|
+
keyboardFocusFrame = void 0;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
function clearKeyboardRealignTimeout() {
|
|
1882
|
+
if (keyboardRealignTimeout !== void 0) {
|
|
1883
|
+
clearTimeout(keyboardRealignTimeout);
|
|
1884
|
+
keyboardRealignTimeout = void 0;
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
function restoreKeyboardScrollAdjustment() {
|
|
1888
|
+
const adjustment = keyboardScrollAdjustment;
|
|
1889
|
+
if (!adjustment) return;
|
|
1890
|
+
adjustment.element.style.overflowAnchor = adjustment.overflowAnchor;
|
|
1891
|
+
adjustment.element.style.paddingBottom = adjustment.paddingBottom;
|
|
1892
|
+
adjustment.element.style.scrollPaddingBottom = adjustment.scrollPaddingBottom;
|
|
1893
|
+
keyboardScrollAdjustment = null;
|
|
1894
|
+
}
|
|
1895
|
+
function setKeyboardScrollSlack(element, slack) {
|
|
1896
|
+
const roundedSlack = Math.max(0, Math.ceil(slack));
|
|
1897
|
+
let adjustment = keyboardScrollAdjustment;
|
|
1898
|
+
if (adjustment && !adjustment.element.isConnected) {
|
|
1899
|
+
restoreKeyboardScrollAdjustment();
|
|
1900
|
+
adjustment = null;
|
|
1901
|
+
}
|
|
1902
|
+
if (roundedSlack === 0) {
|
|
1903
|
+
restoreKeyboardScrollAdjustment();
|
|
1904
|
+
return;
|
|
1905
|
+
}
|
|
1906
|
+
if (adjustment && adjustment.element !== element) {
|
|
1907
|
+
restoreKeyboardScrollAdjustment();
|
|
1908
|
+
adjustment = null;
|
|
1909
|
+
}
|
|
1910
|
+
if (!adjustment) {
|
|
1911
|
+
const styles = ownerWindow(element).getComputedStyle(element);
|
|
1912
|
+
adjustment = {
|
|
1913
|
+
element,
|
|
1914
|
+
overflowAnchor: element.style.overflowAnchor,
|
|
1915
|
+
paddingBottom: element.style.paddingBottom,
|
|
1916
|
+
scrollPaddingBottom: element.style.scrollPaddingBottom,
|
|
1917
|
+
computedPaddingBottom: Number.parseFloat(styles.paddingBottom) || 0,
|
|
1918
|
+
computedScrollPaddingBottom: Number.parseFloat(styles.scrollPaddingBottom) || 0
|
|
1919
|
+
};
|
|
1920
|
+
keyboardScrollAdjustment = adjustment;
|
|
1921
|
+
}
|
|
1922
|
+
element.style.overflowAnchor = "none";
|
|
1923
|
+
element.style.paddingBottom = `${adjustment.computedPaddingBottom + roundedSlack}px`;
|
|
1924
|
+
element.style.scrollPaddingBottom = `${adjustment.computedScrollPaddingBottom + KEYBOARD_VISIBILITY_MARGIN}px`;
|
|
1925
|
+
}
|
|
1926
|
+
function animateKeyboardScroll(element, scrollTop) {
|
|
1927
|
+
const behavior = ownerWindow(element).matchMedia?.("(prefers-reduced-motion: reduce)")?.matches ? "auto" : "smooth";
|
|
1928
|
+
element.scrollTo({
|
|
1929
|
+
top: scrollTop,
|
|
1930
|
+
behavior
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
function resetTouchTrackingState() {
|
|
1934
|
+
pendingKeyboardFocusMoved = false;
|
|
1935
|
+
keyboardTouchStart = null;
|
|
1936
|
+
}
|
|
1937
|
+
createEffect(() => ({
|
|
1938
|
+
mounted: context.presence.mounted(),
|
|
1939
|
+
open: store.open(),
|
|
1940
|
+
modal: context.modal(),
|
|
1941
|
+
nestedDrawerOpen: context.nestedOpenDialogCount() > 0,
|
|
1942
|
+
rootElement: context.viewportElement()
|
|
1943
|
+
}), (state) => {
|
|
1944
|
+
if (!state.mounted || !state.open) {
|
|
1945
|
+
focusedKeyboardTarget = null;
|
|
1946
|
+
restoreKeyboardScrollAdjustment();
|
|
1947
|
+
cancelKeyboardFocusFrame();
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
const rootElement = state.rootElement;
|
|
1951
|
+
if (!rootElement) {
|
|
1952
|
+
restoreKeyboardScrollAdjustment();
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1955
|
+
const doc = ownerDocument(rootElement);
|
|
1956
|
+
const win = ownerWindow(rootElement);
|
|
1957
|
+
const visualViewport = win.visualViewport;
|
|
1958
|
+
const nestedDrawerOpen = state.nestedDrawerOpen;
|
|
1959
|
+
let keyboardScrollElement = null;
|
|
1960
|
+
let keyboardScrollDestination = 0;
|
|
1961
|
+
let keyboardScrollChecks = 0;
|
|
1962
|
+
let keyboardScrollObserved = -1;
|
|
1963
|
+
function setDrawerKeyboardInset(inset) {
|
|
1964
|
+
rootElement.style.setProperty(DrawerViewportCssVars.keyboardInset, `${Math.max(0, Math.ceil(inset))}px`);
|
|
1965
|
+
}
|
|
1966
|
+
function clearFocusedKeyboardTarget() {
|
|
1967
|
+
focusedKeyboardTarget = null;
|
|
1968
|
+
keyboardScrollElement = null;
|
|
1969
|
+
setDrawerKeyboardInset(0);
|
|
1970
|
+
restoreKeyboardScrollAdjustment();
|
|
1971
|
+
cancelKeyboardFocusFrame();
|
|
1972
|
+
clearKeyboardRealignTimeout();
|
|
1973
|
+
}
|
|
1974
|
+
const baseScrollX = win.scrollX;
|
|
1975
|
+
const baseScrollY = win.scrollY;
|
|
1976
|
+
function restoreWindowScroll() {
|
|
1977
|
+
if (state.modal !== true || nestedDrawerOpen || !focusedKeyboardTarget || getKeyboardVisualViewport(win) == null) return false;
|
|
1978
|
+
if (win.scrollX !== baseScrollX || win.scrollY !== baseScrollY) {
|
|
1979
|
+
win.scrollTo({
|
|
1980
|
+
left: baseScrollX,
|
|
1981
|
+
top: baseScrollY,
|
|
1982
|
+
behavior: "instant"
|
|
1983
|
+
});
|
|
1984
|
+
return true;
|
|
1985
|
+
}
|
|
1986
|
+
return false;
|
|
1987
|
+
}
|
|
1988
|
+
let restorePreemptedFocus = null;
|
|
1989
|
+
function consumePreemptedFocus() {
|
|
1990
|
+
restorePreemptedFocus?.();
|
|
1991
|
+
restorePreemptedFocus = null;
|
|
1992
|
+
}
|
|
1993
|
+
function preemptFocusReveal(target, keyboardViewport) {
|
|
1994
|
+
consumePreemptedFocus();
|
|
1995
|
+
const rect = target.getBoundingClientRect();
|
|
1996
|
+
restorePreemptedFocus = overrideGeometryDuringFocus(target, (keyboardViewport.top + keyboardViewport.bottom - rect.top - rect.bottom) / 2);
|
|
1997
|
+
}
|
|
1998
|
+
function alignFocusedKeyboardTarget() {
|
|
1999
|
+
keyboardFocusFrame = void 0;
|
|
2000
|
+
consumePreemptedFocus();
|
|
2001
|
+
const target = focusedKeyboardTarget;
|
|
2002
|
+
if (nestedDrawerOpen || !target || !contains(rootElement, target)) {
|
|
2003
|
+
setDrawerKeyboardInset(0);
|
|
2004
|
+
restoreKeyboardScrollAdjustment();
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
restoreWindowScroll();
|
|
2008
|
+
const keyboardViewport = getKeyboardVisualViewport(win);
|
|
2009
|
+
if (!keyboardViewport) {
|
|
2010
|
+
setDrawerKeyboardInset(0);
|
|
2011
|
+
restoreKeyboardScrollAdjustment();
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
setDrawerKeyboardInset(Math.max(0, win.innerHeight - keyboardViewport.bottom));
|
|
2015
|
+
const scrollTarget = findKeyboardScrollTarget(target, rootElement);
|
|
2016
|
+
if (!scrollTarget) {
|
|
2017
|
+
restoreKeyboardScrollAdjustment();
|
|
2018
|
+
return;
|
|
2019
|
+
}
|
|
2020
|
+
const scrollTargetRect = scrollTarget.getBoundingClientRect();
|
|
2021
|
+
const clippedBottom = Math.min(scrollTargetRect.bottom, keyboardViewport.bottom);
|
|
2022
|
+
const overlap = Math.max(0, scrollTargetRect.bottom - keyboardViewport.bottom);
|
|
2023
|
+
setKeyboardScrollSlack(scrollTarget, overlap > 0 ? overlap + KEYBOARD_SCROLL_SLACK : 0);
|
|
2024
|
+
const maxScrollTop = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight);
|
|
2025
|
+
if (maxScrollTop <= 0) return;
|
|
2026
|
+
const visibleTop = Math.max(scrollTargetRect.top, keyboardViewport.top) + KEYBOARD_VISIBILITY_MARGIN;
|
|
2027
|
+
const visibleBottom = clippedBottom - KEYBOARD_VISIBILITY_MARGIN;
|
|
2028
|
+
if (visibleBottom <= visibleTop) return;
|
|
2029
|
+
const targetRect = target.getBoundingClientRect();
|
|
2030
|
+
const nextScrollTop = scrollTarget.scrollTop + (targetRect.top + targetRect.bottom - visibleTop - visibleBottom) / 2;
|
|
2031
|
+
const destination = Math.round(clamp(nextScrollTop, 0, maxScrollTop));
|
|
2032
|
+
if (!(keyboardScrollElement === scrollTarget && Math.abs(keyboardScrollDestination - destination) <= 1)) {
|
|
2033
|
+
const checks = keyboardScrollElement === scrollTarget ? keyboardScrollChecks + 1 : 1;
|
|
2034
|
+
keyboardScrollElement = scrollTarget;
|
|
2035
|
+
keyboardScrollDestination = destination;
|
|
2036
|
+
keyboardScrollChecks = checks;
|
|
2037
|
+
keyboardScrollObserved = -1;
|
|
2038
|
+
if (checks <= KEYBOARD_SETTLE_FRAME_LIMIT) {
|
|
2039
|
+
scheduleKeyboardFocusAlignment();
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
} else if (keyboardScrollObserved >= 0) {
|
|
2043
|
+
const current = scrollTarget.scrollTop;
|
|
2044
|
+
if (Math.abs(current - destination) <= 1) return;
|
|
2045
|
+
if (current !== keyboardScrollObserved) {
|
|
2046
|
+
keyboardScrollObserved = current;
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
keyboardScrollElement = scrollTarget;
|
|
2051
|
+
keyboardScrollDestination = destination;
|
|
2052
|
+
keyboardScrollChecks = 0;
|
|
2053
|
+
keyboardScrollObserved = scrollTarget.scrollTop;
|
|
2054
|
+
animateKeyboardScroll(scrollTarget, destination);
|
|
2055
|
+
}
|
|
2056
|
+
function scheduleKeyboardFocusAlignment() {
|
|
2057
|
+
cancelKeyboardFocusFrame();
|
|
2058
|
+
keyboardFocusFrame = requestAnimationFrame(alignFocusedKeyboardTarget);
|
|
2059
|
+
}
|
|
2060
|
+
function scheduleDelayedKeyboardRealign() {
|
|
2061
|
+
let remainingPasses = KEYBOARD_REALIGN_MAX_PASSES;
|
|
2062
|
+
const realign = () => {
|
|
2063
|
+
keyboardRealignTimeout = void 0;
|
|
2064
|
+
alignFocusedKeyboardTarget();
|
|
2065
|
+
remainingPasses -= 1;
|
|
2066
|
+
if (remainingPasses > 0) keyboardRealignTimeout = setTimeout(realign, KEYBOARD_REALIGN_INTERVAL);
|
|
2067
|
+
};
|
|
2068
|
+
clearKeyboardRealignTimeout();
|
|
2069
|
+
keyboardRealignTimeout = setTimeout(realign, KEYBOARD_REALIGN_INTERVAL);
|
|
2070
|
+
}
|
|
2071
|
+
function captureFocusedKeyboardTarget(eventTarget) {
|
|
2072
|
+
if (nestedDrawerOpen) return false;
|
|
2073
|
+
const target = resolveKeyboardInputTarget(eventTarget);
|
|
2074
|
+
if (!target || !contains(rootElement, target)) return false;
|
|
2075
|
+
if (focusedKeyboardTarget !== target) keyboardScrollElement = null;
|
|
2076
|
+
focusedKeyboardTarget = target;
|
|
2077
|
+
return true;
|
|
2078
|
+
}
|
|
2079
|
+
function handleFocusIn(event) {
|
|
2080
|
+
programmaticKeyboardFocus = false;
|
|
2081
|
+
consumePreemptedFocus();
|
|
2082
|
+
if (!captureFocusedKeyboardTarget(getEventTarget(event))) {
|
|
2083
|
+
clearFocusedKeyboardTarget();
|
|
2084
|
+
return;
|
|
2085
|
+
}
|
|
2086
|
+
if (getKeyboardVisualViewport(win) != null) scheduleDelayedKeyboardRealign();
|
|
2087
|
+
scheduleKeyboardFocusAlignment();
|
|
2088
|
+
}
|
|
2089
|
+
function handleFocusOut(event) {
|
|
2090
|
+
if (programmaticKeyboardFocus) return;
|
|
2091
|
+
if (captureFocusedKeyboardTarget(event.relatedTarget)) {
|
|
2092
|
+
const target = focusedKeyboardTarget;
|
|
2093
|
+
const keyboardViewport = getKeyboardVisualViewport(win);
|
|
2094
|
+
if (target && keyboardViewport) preemptFocusReveal(target, keyboardViewport);
|
|
2095
|
+
scheduleKeyboardFocusAlignment();
|
|
2096
|
+
return;
|
|
2097
|
+
}
|
|
2098
|
+
clearFocusedKeyboardTarget();
|
|
2099
|
+
}
|
|
2100
|
+
function handleViewportUpdate() {
|
|
2101
|
+
if (focusedKeyboardTarget || captureFocusedKeyboardTarget(activeElement(doc))) scheduleKeyboardFocusAlignment();
|
|
2102
|
+
}
|
|
2103
|
+
function handleWindowScroll() {
|
|
2104
|
+
if (restoreWindowScroll()) scheduleKeyboardFocusAlignment();
|
|
2105
|
+
}
|
|
2106
|
+
function cancelKeyboardRealignOnPointerDown() {
|
|
2107
|
+
cancelKeyboardFocusFrame();
|
|
2108
|
+
clearKeyboardRealignTimeout();
|
|
2109
|
+
keyboardScrollElement = null;
|
|
2110
|
+
}
|
|
2111
|
+
visualViewport?.addEventListener("resize", handleViewportUpdate);
|
|
2112
|
+
visualViewport?.addEventListener("scroll", handleViewportUpdate);
|
|
2113
|
+
doc.addEventListener("focusin", handleFocusIn, true);
|
|
2114
|
+
doc.addEventListener("focusout", handleFocusOut, true);
|
|
2115
|
+
win.addEventListener("scroll", handleWindowScroll);
|
|
2116
|
+
doc.addEventListener("pointerdown", cancelKeyboardRealignOnPointerDown, true);
|
|
2117
|
+
if (captureFocusedKeyboardTarget(activeElement(doc))) scheduleKeyboardFocusAlignment();
|
|
2118
|
+
return () => {
|
|
2119
|
+
visualViewport?.removeEventListener("resize", handleViewportUpdate);
|
|
2120
|
+
visualViewport?.removeEventListener("scroll", handleViewportUpdate);
|
|
2121
|
+
doc.removeEventListener("focusin", handleFocusIn, true);
|
|
2122
|
+
doc.removeEventListener("focusout", handleFocusOut, true);
|
|
2123
|
+
win.removeEventListener("scroll", handleWindowScroll);
|
|
2124
|
+
doc.removeEventListener("pointerdown", cancelKeyboardRealignOnPointerDown, true);
|
|
2125
|
+
consumePreemptedFocus();
|
|
2126
|
+
clearFocusedKeyboardTarget();
|
|
2127
|
+
rootElement.style.removeProperty(DrawerViewportCssVars.keyboardInset);
|
|
2128
|
+
};
|
|
2129
|
+
});
|
|
2130
|
+
function onTouchStart(event) {
|
|
2131
|
+
const touch = event.touches[0];
|
|
2132
|
+
pendingKeyboardFocusMoved = false;
|
|
2133
|
+
keyboardTouchStart = touch ? {
|
|
2134
|
+
x: touch.clientX,
|
|
2135
|
+
y: touch.clientY
|
|
2136
|
+
} : null;
|
|
2137
|
+
}
|
|
2138
|
+
function onTouchMove(event) {
|
|
2139
|
+
const touch = event.touches[0];
|
|
2140
|
+
if (!touch || !keyboardTouchStart || pendingKeyboardFocusMoved) return;
|
|
2141
|
+
if (Math.abs(touch.clientX - keyboardTouchStart.x) > INPUT_TAP_MOVE_THRESHOLD || Math.abs(touch.clientY - keyboardTouchStart.y) > INPUT_TAP_MOVE_THRESHOLD) pendingKeyboardFocusMoved = true;
|
|
2142
|
+
}
|
|
2143
|
+
function onTouchEnd(event) {
|
|
2144
|
+
const rootElement = context.viewportElement();
|
|
2145
|
+
if (!store.open() || !context.presence.mounted() || context.nestedOpenDialogCount() > 0 || !rootElement || !keyboardTouchStart || pendingKeyboardFocusMoved) {
|
|
2146
|
+
resetTouchTrackingState();
|
|
2147
|
+
return;
|
|
2148
|
+
}
|
|
2149
|
+
const touch = event.changedTouches[0] ?? event.touches[0];
|
|
2150
|
+
const root = rootElement.getRootNode();
|
|
2151
|
+
const pointTarget = touch ? resolveKeyboardTouchTargetFromPoint(root, touch.clientX, touch.clientY) : null;
|
|
2152
|
+
if (pointTarget === KEYBOARD_TAP_BLOCKED) {
|
|
2153
|
+
resetTouchTrackingState();
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
2156
|
+
const keyboardTarget = touch && (pointTarget ?? resolveKeyboardTouchTarget(getEventTarget(event)));
|
|
2157
|
+
if (keyboardTarget && (!contains(rootElement, keyboardTarget.focusTarget) || !contains(rootElement, keyboardTarget.clickTarget))) {
|
|
2158
|
+
resetTouchTrackingState();
|
|
2159
|
+
return;
|
|
2160
|
+
}
|
|
2161
|
+
if (keyboardTarget) {
|
|
2162
|
+
const { clickTarget, focusTarget } = keyboardTarget;
|
|
2163
|
+
const win = ownerWindow(focusTarget);
|
|
2164
|
+
if (win.visualViewport && win.visualViewport.scale !== 1) {
|
|
2165
|
+
resetTouchTrackingState();
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
if (activeElement(ownerDocument(focusTarget)) === focusTarget && (!win.visualViewport || getKeyboardVisualViewport(win) != null)) {
|
|
2169
|
+
resetTouchTrackingState();
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
event.preventDefault();
|
|
2173
|
+
programmaticKeyboardFocus = true;
|
|
2174
|
+
try {
|
|
2175
|
+
focusKeyboardInputWithoutPageScroll(focusTarget);
|
|
2176
|
+
} finally {
|
|
2177
|
+
programmaticKeyboardFocus = false;
|
|
2178
|
+
}
|
|
2179
|
+
dispatchKeyboardClick(clickTarget, touch);
|
|
2180
|
+
resetTouchTrackingState();
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
resetTouchTrackingState();
|
|
2184
|
+
}
|
|
2185
|
+
return DrawerVirtualKeyboardContext({
|
|
2186
|
+
value: {
|
|
2187
|
+
onTouchStart,
|
|
2188
|
+
onTouchMove,
|
|
2189
|
+
onTouchEnd,
|
|
2190
|
+
onTouchCancel: resetTouchTrackingState
|
|
2191
|
+
},
|
|
2192
|
+
get children() {
|
|
2193
|
+
return props.children;
|
|
2194
|
+
}
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
function isKeyboardInputElement(element) {
|
|
2198
|
+
if (element.isContentEditable) return true;
|
|
2199
|
+
const win = ownerWindow(element);
|
|
2200
|
+
if (element instanceof win.HTMLTextAreaElement || element instanceof win.HTMLInputElement && KEYBOARD_INPUT_TYPES.has(element.type)) return !element.matches(":disabled");
|
|
2201
|
+
return false;
|
|
2202
|
+
}
|
|
2203
|
+
function resolveKeyboardInputTarget(target) {
|
|
2204
|
+
if (!isHTMLElement(target)) return null;
|
|
2205
|
+
if (isKeyboardInputElement(target)) return target.isContentEditable ? getContentEditableHost(target) : target;
|
|
2206
|
+
const control = target.closest("label")?.control ?? null;
|
|
2207
|
+
return isHTMLElement(control) && isKeyboardInputElement(control) ? control : null;
|
|
2208
|
+
}
|
|
2209
|
+
function resolveKeyboardTouchTarget(target) {
|
|
2210
|
+
if (!isHTMLElement(target)) return null;
|
|
2211
|
+
const focusTarget = resolveKeyboardInputTarget(target);
|
|
2212
|
+
if (!focusTarget) return null;
|
|
2213
|
+
return {
|
|
2214
|
+
focusTarget,
|
|
2215
|
+
clickTarget: target
|
|
2216
|
+
};
|
|
2217
|
+
}
|
|
2218
|
+
/**
|
|
2219
|
+
* Inherited-editable descendants (no `contenteditable` attribute of their own) are not focusable,
|
|
2220
|
+
* so focusing them is a no-op; resolve taps on them to the editing host.
|
|
2221
|
+
*/
|
|
2222
|
+
function getContentEditableHost(element) {
|
|
2223
|
+
let host = element;
|
|
2224
|
+
while (host.parentElement?.isContentEditable) host = host.parentElement;
|
|
2225
|
+
return host;
|
|
2226
|
+
}
|
|
2227
|
+
function resolveKeyboardTouchTargetFromPoint(root, clientX, clientY) {
|
|
2228
|
+
const exactTarget = getElementAtPoint(root, clientX, clientY);
|
|
2229
|
+
if (isHTMLElement(exactTarget)) {
|
|
2230
|
+
const exactKeyboardTarget = resolveKeyboardInputTarget(exactTarget);
|
|
2231
|
+
if (exactKeyboardTarget) return {
|
|
2232
|
+
focusTarget: exactKeyboardTarget,
|
|
2233
|
+
clickTarget: exactTarget
|
|
2234
|
+
};
|
|
2235
|
+
}
|
|
2236
|
+
if (isInteractiveElement(exactTarget) || exactTarget?.closest("label") != null) return KEYBOARD_TAP_BLOCKED;
|
|
2237
|
+
for (const [offsetX, offsetY] of [
|
|
2238
|
+
[0, INPUT_TAP_HIT_SLOP],
|
|
2239
|
+
[0, -16],
|
|
2240
|
+
[INPUT_TAP_HIT_SLOP, 0],
|
|
2241
|
+
[-16, 0]
|
|
2242
|
+
]) {
|
|
2243
|
+
const keyboardTarget = resolveKeyboardInputTarget(getElementAtPoint(root, clientX + offsetX, clientY + offsetY));
|
|
2244
|
+
if (keyboardTarget) return {
|
|
2245
|
+
focusTarget: keyboardTarget,
|
|
2246
|
+
clickTarget: keyboardTarget
|
|
2247
|
+
};
|
|
2248
|
+
}
|
|
2249
|
+
return null;
|
|
2250
|
+
}
|
|
2251
|
+
function dispatchKeyboardClick(target, touch) {
|
|
2252
|
+
const win = ownerWindow(target);
|
|
2253
|
+
const ClickEvent = win.PointerEvent ?? win.MouseEvent;
|
|
2254
|
+
const init = {
|
|
2255
|
+
bubbles: true,
|
|
2256
|
+
cancelable: true,
|
|
2257
|
+
clientX: touch.clientX,
|
|
2258
|
+
clientY: touch.clientY,
|
|
2259
|
+
detail: 1
|
|
2260
|
+
};
|
|
2261
|
+
let event;
|
|
2262
|
+
try {
|
|
2263
|
+
event = new ClickEvent("click", {
|
|
2264
|
+
...init,
|
|
2265
|
+
view: win
|
|
2266
|
+
});
|
|
2267
|
+
} catch {
|
|
2268
|
+
event = new ClickEvent("click", init);
|
|
2269
|
+
}
|
|
2270
|
+
target.dispatchEvent(event);
|
|
2271
|
+
}
|
|
2272
|
+
function focusKeyboardInputWithoutPageScroll(target) {
|
|
2273
|
+
const wasFocused = activeElement(ownerDocument(target)) === target;
|
|
2274
|
+
const restoreStyles = overrideGeometryDuringFocus(target, -2e3);
|
|
2275
|
+
try {
|
|
2276
|
+
if (wasFocused) target.blur();
|
|
2277
|
+
target.focus({ preventScroll: true });
|
|
2278
|
+
} finally {
|
|
2279
|
+
restoreStyles();
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Overrides the painted geometry WebKit samples when an element gains focus. The rect is hidden
|
|
2284
|
+
* (opacity) rather than detached so layout is unaffected; the caller must restore synchronously
|
|
2285
|
+
* before the next paint.
|
|
2286
|
+
*/
|
|
2287
|
+
function overrideGeometryDuringFocus(target, translateY) {
|
|
2288
|
+
const previousOpacity = target.style.opacity;
|
|
2289
|
+
const previousTransform = target.style.transform;
|
|
2290
|
+
const previousTransition = target.style.transition;
|
|
2291
|
+
target.style.transition = "none";
|
|
2292
|
+
target.style.opacity = "0";
|
|
2293
|
+
target.style.transform = `translateY(${translateY}px)`;
|
|
2294
|
+
return () => {
|
|
2295
|
+
target.style.opacity = previousOpacity;
|
|
2296
|
+
target.style.transform = previousTransform;
|
|
2297
|
+
target.style.transition = previousTransition;
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
function findKeyboardScrollTarget(target, root) {
|
|
2301
|
+
const scrollStart = getComposedParentNode(target);
|
|
2302
|
+
return findScrollableTouchTarget(scrollStart, root, "vertical") ?? findScrollableTouchTarget(scrollStart, root, "vertical", true);
|
|
2303
|
+
}
|
|
2304
|
+
function getKeyboardVisualViewport(win) {
|
|
2305
|
+
const visualViewport = win.visualViewport;
|
|
2306
|
+
if (!visualViewport || visualViewport.scale !== 1) return null;
|
|
2307
|
+
if (win.innerHeight - visualViewport.height <= KEYBOARD_RESIZE_THRESHOLD) return null;
|
|
2308
|
+
const top = Math.max(0, visualViewport.offsetTop);
|
|
2309
|
+
return {
|
|
2310
|
+
top,
|
|
2311
|
+
bottom: Math.min(win.innerHeight, top + visualViewport.height)
|
|
2312
|
+
};
|
|
2313
|
+
}
|
|
2314
|
+
//#endregion
|
|
2315
|
+
//#region src/drawer/handle.ts
|
|
2316
|
+
/**
|
|
2317
|
+
* Imperatively controls a Drawer and associates detached `Drawer.Trigger` components with a
|
|
2318
|
+
* `Drawer.Root`. Create one with `Drawer.createHandle()` and pass it to the `handle` prop of the
|
|
2319
|
+
* root and of any triggers rendered outside of it.
|
|
2320
|
+
*
|
|
2321
|
+
* The imperative methods take effect only while a root using this handle is mounted; calls made
|
|
2322
|
+
* before a root attaches (or after it unmounts) are ignored.
|
|
2323
|
+
*/
|
|
2324
|
+
var DrawerHandle = class extends DialogHandle {};
|
|
2325
|
+
/** Creates a new handle to connect a Drawer.Root with detached Drawer.Trigger components. */
|
|
2326
|
+
function createDrawerHandle() {
|
|
2327
|
+
return new DrawerHandle();
|
|
2328
|
+
}
|
|
2329
|
+
//#endregion
|
|
2330
|
+
//#region src/drawer/index.parts.ts
|
|
2331
|
+
var index_parts_exports = /* @__PURE__ */ __exportAll({
|
|
2332
|
+
Backdrop: () => DrawerBackdrop,
|
|
2333
|
+
Close: () => DialogClose,
|
|
2334
|
+
Content: () => DrawerContent,
|
|
2335
|
+
Description: () => DialogDescription,
|
|
2336
|
+
Handle: () => DrawerHandle,
|
|
2337
|
+
Indent: () => DrawerIndent,
|
|
2338
|
+
IndentBackground: () => DrawerIndentBackground,
|
|
2339
|
+
Popup: () => DrawerPopup,
|
|
2340
|
+
Portal: () => DialogPortal,
|
|
2341
|
+
Provider: () => DrawerProvider,
|
|
2342
|
+
Root: () => DrawerRoot,
|
|
2343
|
+
SwipeArea: () => DrawerSwipeArea,
|
|
2344
|
+
Title: () => DialogTitle,
|
|
2345
|
+
Trigger: () => DialogTrigger,
|
|
2346
|
+
Viewport: () => DrawerViewport,
|
|
2347
|
+
VirtualKeyboardProvider: () => DrawerVirtualKeyboardProvider,
|
|
2348
|
+
createHandle: () => createDrawerHandle
|
|
2349
|
+
});
|
|
2350
|
+
//#endregion
|
|
2351
|
+
export { index_parts_exports as Drawer };
|