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,1588 @@
|
|
|
1
|
+
import { t as __exportAll } from "../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { getStateAttributesProps } from "../internals/getStateAttributesProps.js";
|
|
3
|
+
import { n as resolveClass, t as resolveStyle } from "../resolveStyle-XCSFDHAL.js";
|
|
4
|
+
import { transitionStatusMapping } from "../internals/stateAttributesMapping.js";
|
|
5
|
+
import { composeEventHandlers } from "../internals/composeEventHandlers.js";
|
|
6
|
+
import { t as runOnceAnimationsFinish } from "../runOnceAnimationsFinish-DCHzXWZU.js";
|
|
7
|
+
import { a as isElement, m as ownerWindow, n as contains, p as ownerDocument, r as getEventTarget, t as activeElement } from "../dom-Crg_2R-j.js";
|
|
8
|
+
import { t as createAnchorPositioning } from "../createAnchorPositioning-C-cVOPwz.js";
|
|
9
|
+
import { _ as ReactiveStore, g as FocusGuard, n as popupStateMapping, o as PopupPortal } from "../popupStateMapping-nKoUwoke.js";
|
|
10
|
+
import { a as stopButtonInteraction, i as preventDisabledButtonKeyDown, n as handleNonNativeButtonKeyUp, r as preventButtonInteraction, t as handleNonNativeButtonKeyDown } from "../buttonSemantics-BSwDxJhh.js";
|
|
11
|
+
import { t as setRef } from "../setRef-Bt70sW7c.js";
|
|
12
|
+
import { n as useDirection } from "../DirectionContext-YORWLF08.js";
|
|
13
|
+
import { a as getElementTransform, i as getDisplacement, n as LEGACY_SWIPE_IGNORE_SELECTOR, t as BASE_UI_SWIPE_IGNORE_SELECTOR } from "../constants-9H__9xbS.js";
|
|
14
|
+
import { Dynamic, escape, memo, mergeProps, ssr, ssrHydrationKey, ssrStyle } from "@solidjs/web";
|
|
15
|
+
import { For, Show, children, createContext, createEffect, createMemo, createSignal, createUniqueId, flush, omit, onCleanup, untrack, useContext } from "solid-js";
|
|
16
|
+
//#region src/toast/utils/focusVisible.ts
|
|
17
|
+
/**
|
|
18
|
+
* Whether the element is focus-visible. Environments that cannot evaluate
|
|
19
|
+
* `:focus-visible` (JSDOM) report `true` so keyboard-driven behavior stays
|
|
20
|
+
* testable, matching Base UI.
|
|
21
|
+
*/
|
|
22
|
+
function isFocusVisible(element) {
|
|
23
|
+
if (!element) return true;
|
|
24
|
+
try {
|
|
25
|
+
return element.matches(":focus-visible");
|
|
26
|
+
} catch {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/toast/utils/generateToastId.ts
|
|
32
|
+
var counter = 0;
|
|
33
|
+
/**
|
|
34
|
+
* Generates an id for a toast created outside of a component, where Solid's
|
|
35
|
+
* `createUniqueId` has no owner to scope to.
|
|
36
|
+
*/
|
|
37
|
+
function generateToastId(prefix = "toast") {
|
|
38
|
+
counter += 1;
|
|
39
|
+
return `${prefix}-${Math.random().toString(36).slice(2, 6)}-${counter}`;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/toast/utils/resolvePromiseOptions.ts
|
|
43
|
+
function resolvePromiseOptions(options, result) {
|
|
44
|
+
if (typeof options === "string") return { description: options };
|
|
45
|
+
if (typeof options === "function") {
|
|
46
|
+
const resolvedOptions = options(result);
|
|
47
|
+
return typeof resolvedOptions === "string" ? { description: resolvedOptions } : resolvedOptions;
|
|
48
|
+
}
|
|
49
|
+
return options;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/toast/store/ToastStore.ts
|
|
53
|
+
function createToastMetadata(toasts) {
|
|
54
|
+
const metadata = /* @__PURE__ */ new Map();
|
|
55
|
+
let visibleIndex = 0;
|
|
56
|
+
let offsetY = 0;
|
|
57
|
+
toasts.forEach((toast, toastIndex) => {
|
|
58
|
+
const isEnding = toast.transitionStatus === "ending";
|
|
59
|
+
metadata.set(toast.id, {
|
|
60
|
+
value: toast,
|
|
61
|
+
domIndex: toastIndex,
|
|
62
|
+
visibleIndex: isEnding ? -1 : visibleIndex,
|
|
63
|
+
offsetY
|
|
64
|
+
});
|
|
65
|
+
offsetY += toast.height || 0;
|
|
66
|
+
if (!isEnding) visibleIndex += 1;
|
|
67
|
+
});
|
|
68
|
+
return metadata;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Marks the active (non-ending) toasts beyond `limit` as limited. Callers pass toasts in
|
|
72
|
+
* newest-first order, so the newest `limit` toasts stay visible and the rest are flagged.
|
|
73
|
+
* Returns the same toast reference when its `limited` flag is unchanged.
|
|
74
|
+
*/
|
|
75
|
+
function applyLimited(toasts, limit) {
|
|
76
|
+
let activeIndex = 0;
|
|
77
|
+
return toasts.map((toast) => {
|
|
78
|
+
if (toast.transitionStatus === "ending") return toast;
|
|
79
|
+
const limited = activeIndex >= limit;
|
|
80
|
+
activeIndex += 1;
|
|
81
|
+
return toast.limited === limited ? toast : {
|
|
82
|
+
...toast,
|
|
83
|
+
limited
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
var selectors = {
|
|
88
|
+
toasts: (state) => state.toasts,
|
|
89
|
+
isEmpty: (state) => state.toasts.length === 0,
|
|
90
|
+
toast: (state, id) => state.toastMetadata.get(id)?.value,
|
|
91
|
+
toastIndex: (state, id) => state.toastMetadata.get(id)?.domIndex ?? -1,
|
|
92
|
+
toastOffsetY: (state, id) => state.toastMetadata.get(id)?.offsetY ?? 0,
|
|
93
|
+
toastVisibleIndex: (state, id) => state.toastMetadata.get(id)?.visibleIndex ?? -1,
|
|
94
|
+
focused: (state) => state.focused,
|
|
95
|
+
expanded: (state) => state.hovering || state.focused,
|
|
96
|
+
expandedOrOutOfFocus: (state) => state.hovering || state.focused || !state.isWindowFocused,
|
|
97
|
+
prevFocusElement: (state) => state.prevFocusElement
|
|
98
|
+
};
|
|
99
|
+
var ToastStore = class extends ReactiveStore {
|
|
100
|
+
timers = /* @__PURE__ */ new Map();
|
|
101
|
+
areTimersPaused = false;
|
|
102
|
+
constructor(initialState) {
|
|
103
|
+
super({
|
|
104
|
+
...initialState,
|
|
105
|
+
toastMetadata: createToastMetadata(initialState.toasts)
|
|
106
|
+
}, {});
|
|
107
|
+
}
|
|
108
|
+
setViewport = (viewport) => {
|
|
109
|
+
this.set("viewport", viewport);
|
|
110
|
+
};
|
|
111
|
+
syncProviderProps(timeout, limit) {
|
|
112
|
+
const limitChanged = this.state.limit !== limit;
|
|
113
|
+
if (this.state.timeout === timeout && !limitChanged) return;
|
|
114
|
+
const updates = {
|
|
115
|
+
timeout,
|
|
116
|
+
limit
|
|
117
|
+
};
|
|
118
|
+
if (limitChanged) {
|
|
119
|
+
const newToasts = applyLimited(this.state.toasts, limit);
|
|
120
|
+
updates.toasts = newToasts;
|
|
121
|
+
updates.toastMetadata = createToastMetadata(newToasts);
|
|
122
|
+
}
|
|
123
|
+
this.update(updates);
|
|
124
|
+
}
|
|
125
|
+
dispose = () => {
|
|
126
|
+
this.timers.forEach((timer) => this.stopTimer(timer));
|
|
127
|
+
this.timers.clear();
|
|
128
|
+
};
|
|
129
|
+
removeToast(toastId, skipOnRemove = false) {
|
|
130
|
+
const index = selectors.toastIndex(this.state, toastId);
|
|
131
|
+
if (index === -1) return;
|
|
132
|
+
const toast = this.state.toasts[index];
|
|
133
|
+
if (!skipOnRemove) toast?.onRemove?.();
|
|
134
|
+
const newToasts = [...this.state.toasts];
|
|
135
|
+
newToasts.splice(index, 1);
|
|
136
|
+
this.setToasts(newToasts);
|
|
137
|
+
}
|
|
138
|
+
addToast = (toast) => {
|
|
139
|
+
const { timeout, limit } = this.state;
|
|
140
|
+
const id = toast.id || generateToastId();
|
|
141
|
+
if (toast.id) {
|
|
142
|
+
const existingToast = selectors.toast(this.state, toast.id);
|
|
143
|
+
if (existingToast) {
|
|
144
|
+
if (existingToast.transitionStatus === "ending") this.removeToast(toast.id, true);
|
|
145
|
+
else {
|
|
146
|
+
const updates = { ...toast };
|
|
147
|
+
delete updates.id;
|
|
148
|
+
delete updates.transitionStatus;
|
|
149
|
+
this.updateToastInternal(toast.id, updates, true, true);
|
|
150
|
+
return toast.id;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const toastToAdd = {
|
|
155
|
+
...toast,
|
|
156
|
+
id,
|
|
157
|
+
updateKey: 0,
|
|
158
|
+
transitionStatus: "starting"
|
|
159
|
+
};
|
|
160
|
+
const updatedToasts = [toastToAdd, ...this.state.toasts];
|
|
161
|
+
this.setToasts(applyLimited(updatedToasts, limit));
|
|
162
|
+
const duration = toastToAdd.timeout ?? timeout;
|
|
163
|
+
if (toastToAdd.type !== "loading" && duration > 0) this.scheduleTimer(id, duration, () => this.closeToast(id));
|
|
164
|
+
if (selectors.expandedOrOutOfFocus(this.state)) this.pauseTimers();
|
|
165
|
+
return id;
|
|
166
|
+
};
|
|
167
|
+
updateToast = (id, updates) => {
|
|
168
|
+
this.updateToastInternal(id, updates, false, true);
|
|
169
|
+
};
|
|
170
|
+
updateToastInternal = (id, updates, resetTimer = false, markUpdated = false) => {
|
|
171
|
+
const { timeout, toasts } = this.state;
|
|
172
|
+
const prevToast = selectors.toast(this.state, id);
|
|
173
|
+
if (!prevToast) return;
|
|
174
|
+
if (prevToast.transitionStatus === "ending") return;
|
|
175
|
+
const nextToast = {
|
|
176
|
+
...prevToast,
|
|
177
|
+
...updates,
|
|
178
|
+
...markUpdated && { updateKey: prevToast.updateKey + 1 }
|
|
179
|
+
};
|
|
180
|
+
this.setToasts(toasts.map((toast) => toast.id === id ? nextToast : toast));
|
|
181
|
+
const nextTimeout = nextToast.timeout ?? timeout;
|
|
182
|
+
const prevTimeout = prevToast.timeout ?? timeout;
|
|
183
|
+
const timeoutUpdated = Object.hasOwn(updates, "timeout");
|
|
184
|
+
const shouldHaveTimer = nextToast.transitionStatus !== "ending" && nextToast.type !== "loading" && nextTimeout > 0;
|
|
185
|
+
const hasTimer = this.timers.has(id);
|
|
186
|
+
const timeoutChanged = prevTimeout !== nextTimeout;
|
|
187
|
+
const wasLoading = prevToast.type === "loading";
|
|
188
|
+
if (!shouldHaveTimer && hasTimer) {
|
|
189
|
+
this.clearTimer(id);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (shouldHaveTimer && (!hasTimer || timeoutChanged || timeoutUpdated || wasLoading || resetTimer)) {
|
|
193
|
+
this.clearTimer(id);
|
|
194
|
+
this.scheduleTimer(id, nextTimeout, () => this.closeToast(id));
|
|
195
|
+
if (selectors.expandedOrOutOfFocus(this.state)) this.pauseTimers();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
closeToast = (toastId) => {
|
|
199
|
+
const closeAll = toastId === void 0;
|
|
200
|
+
const { limit, toasts } = this.state;
|
|
201
|
+
let toastsToClose;
|
|
202
|
+
if (closeAll) {
|
|
203
|
+
toastsToClose = toasts;
|
|
204
|
+
this.clearTimers();
|
|
205
|
+
} else {
|
|
206
|
+
const toast = selectors.toast(this.state, toastId);
|
|
207
|
+
if (!toast) return;
|
|
208
|
+
toastsToClose = [toast];
|
|
209
|
+
this.clearTimer(toastId);
|
|
210
|
+
}
|
|
211
|
+
const newToasts = applyLimited(toasts.map((item) => closeAll || item.id === toastId ? {
|
|
212
|
+
...item,
|
|
213
|
+
transitionStatus: "ending",
|
|
214
|
+
height: 0
|
|
215
|
+
} : item), limit);
|
|
216
|
+
this.setToasts(newToasts, !newToasts.some((toast) => toast.transitionStatus !== "ending"));
|
|
217
|
+
toastsToClose.forEach((toast) => {
|
|
218
|
+
if (toast.transitionStatus !== "ending") toast.onClose?.();
|
|
219
|
+
});
|
|
220
|
+
this.handleFocusManagement(toastId);
|
|
221
|
+
};
|
|
222
|
+
promiseToast = (promiseValue, options) => {
|
|
223
|
+
const loadingOptions = resolvePromiseOptions(options.loading);
|
|
224
|
+
const id = this.addToast({
|
|
225
|
+
...loadingOptions,
|
|
226
|
+
type: "loading"
|
|
227
|
+
});
|
|
228
|
+
const handledPromise = promiseValue.then((result) => {
|
|
229
|
+
const successOptions = resolvePromiseOptions(options.success, result);
|
|
230
|
+
this.updateToast(id, {
|
|
231
|
+
...successOptions,
|
|
232
|
+
type: "success",
|
|
233
|
+
timeout: successOptions.timeout
|
|
234
|
+
});
|
|
235
|
+
return result;
|
|
236
|
+
}).catch((error) => {
|
|
237
|
+
const errorOptions = resolvePromiseOptions(options.error, error);
|
|
238
|
+
this.updateToast(id, {
|
|
239
|
+
...errorOptions,
|
|
240
|
+
type: "error",
|
|
241
|
+
timeout: errorOptions.timeout
|
|
242
|
+
});
|
|
243
|
+
return Promise.reject(error);
|
|
244
|
+
});
|
|
245
|
+
if (Object.hasOwn(options, "setPromise")) options.setPromise(handledPromise);
|
|
246
|
+
return handledPromise;
|
|
247
|
+
};
|
|
248
|
+
pauseTimers() {
|
|
249
|
+
if (this.areTimersPaused) return;
|
|
250
|
+
this.areTimersPaused = true;
|
|
251
|
+
this.timers.forEach((timer) => {
|
|
252
|
+
if (timer.scheduled) {
|
|
253
|
+
this.stopTimer(timer);
|
|
254
|
+
timer.remaining = Math.max(timer.remaining - (Date.now() - timer.start), 0);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
resumeTimers() {
|
|
259
|
+
if (!this.areTimersPaused) return;
|
|
260
|
+
this.areTimersPaused = false;
|
|
261
|
+
this.timers.forEach((timer, id) => {
|
|
262
|
+
timer.remaining = timer.remaining > 0 ? timer.remaining : timer.delay;
|
|
263
|
+
timer.scheduled = true;
|
|
264
|
+
this.stopTimer(timer);
|
|
265
|
+
timer.handle = setTimeout(() => {
|
|
266
|
+
timer.handle = void 0;
|
|
267
|
+
this.handleTimerFired(id);
|
|
268
|
+
timer.callback();
|
|
269
|
+
}, timer.remaining);
|
|
270
|
+
timer.start = Date.now();
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
restoreFocusToPrevElement() {
|
|
274
|
+
this.state.prevFocusElement?.focus({ preventScroll: true });
|
|
275
|
+
}
|
|
276
|
+
handleDocumentPointerDown = (event) => {
|
|
277
|
+
if (event.pointerType !== "touch") return;
|
|
278
|
+
const target = getEventTarget(event);
|
|
279
|
+
if (contains(this.state.viewport, target)) return;
|
|
280
|
+
this.resumeTimers();
|
|
281
|
+
this.update({
|
|
282
|
+
hovering: false,
|
|
283
|
+
focused: false
|
|
284
|
+
});
|
|
285
|
+
};
|
|
286
|
+
scheduleTimer(id, delay, callback) {
|
|
287
|
+
const start = Date.now();
|
|
288
|
+
const shouldStartActive = !selectors.expandedOrOutOfFocus(this.state);
|
|
289
|
+
const timer = {
|
|
290
|
+
scheduled: shouldStartActive,
|
|
291
|
+
handle: void 0,
|
|
292
|
+
start,
|
|
293
|
+
delay,
|
|
294
|
+
remaining: delay,
|
|
295
|
+
callback
|
|
296
|
+
};
|
|
297
|
+
if (shouldStartActive) timer.handle = setTimeout(() => {
|
|
298
|
+
timer.handle = void 0;
|
|
299
|
+
this.handleTimerFired(id);
|
|
300
|
+
callback();
|
|
301
|
+
}, delay);
|
|
302
|
+
this.timers.set(id, timer);
|
|
303
|
+
}
|
|
304
|
+
stopTimer(timer) {
|
|
305
|
+
if (timer.handle !== void 0) {
|
|
306
|
+
clearTimeout(timer.handle);
|
|
307
|
+
timer.handle = void 0;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
clearTimers() {
|
|
311
|
+
this.timers.forEach((timer) => this.stopTimer(timer));
|
|
312
|
+
this.timers.clear();
|
|
313
|
+
this.areTimersPaused = false;
|
|
314
|
+
}
|
|
315
|
+
clearTimer(id) {
|
|
316
|
+
const timer = this.timers.get(id);
|
|
317
|
+
if (timer) this.stopTimer(timer);
|
|
318
|
+
this.timers.delete(id);
|
|
319
|
+
this.resetPausedStateIfNoTimersRemain();
|
|
320
|
+
}
|
|
321
|
+
handleTimerFired(id) {
|
|
322
|
+
this.timers.delete(id);
|
|
323
|
+
this.resetPausedStateIfNoTimersRemain();
|
|
324
|
+
}
|
|
325
|
+
resetPausedStateIfNoTimersRemain() {
|
|
326
|
+
if (this.timers.size === 0) this.areTimersPaused = false;
|
|
327
|
+
}
|
|
328
|
+
setToasts(newToasts, clearInteraction = newToasts.length === 0) {
|
|
329
|
+
const updates = {
|
|
330
|
+
toasts: newToasts,
|
|
331
|
+
toastMetadata: createToastMetadata(newToasts)
|
|
332
|
+
};
|
|
333
|
+
if (clearInteraction) {
|
|
334
|
+
updates.hovering = false;
|
|
335
|
+
updates.focused = false;
|
|
336
|
+
}
|
|
337
|
+
this.update(updates);
|
|
338
|
+
}
|
|
339
|
+
handleFocusManagement(toastId) {
|
|
340
|
+
const activeEl = activeElement(ownerDocument(this.state.viewport));
|
|
341
|
+
if (!this.state.viewport || !contains(this.state.viewport, activeEl) || !isFocusVisible(activeEl)) return;
|
|
342
|
+
if (toastId === void 0) {
|
|
343
|
+
this.restoreFocusToPrevElement();
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const toasts = selectors.toasts(this.state);
|
|
347
|
+
const currentIndex = selectors.toastIndex(this.state, toastId);
|
|
348
|
+
const scan = (from, step) => {
|
|
349
|
+
for (let index = from; index >= 0 && index < toasts.length; index += step) if (toasts[index].transitionStatus !== "ending") return toasts[index];
|
|
350
|
+
return null;
|
|
351
|
+
};
|
|
352
|
+
const nextToast = scan(currentIndex + 1, 1) ?? scan(currentIndex - 1, -1);
|
|
353
|
+
if (nextToast) nextToast.element?.focus();
|
|
354
|
+
else this.restoreFocusToPrevElement();
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
//#endregion
|
|
358
|
+
//#region src/toast/provider/ToastProviderContext.ts
|
|
359
|
+
var MISSING_CONTEXT$2 = Symbol("ToastProviderContext");
|
|
360
|
+
var ToastProviderContext = createContext(MISSING_CONTEXT$2);
|
|
361
|
+
function useToastProviderContext() {
|
|
362
|
+
const context = useContext(ToastProviderContext);
|
|
363
|
+
if (context === MISSING_CONTEXT$2) throw new Error("Base UI: useToastManager must be used within <Toast.Provider>.");
|
|
364
|
+
return context;
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/toast/provider/ToastProvider.tsx
|
|
368
|
+
/** Provides a context for creating and managing toasts. */
|
|
369
|
+
function ToastProvider(props) {
|
|
370
|
+
const store = new ToastStore({
|
|
371
|
+
timeout: untrack(() => props.timeout ?? 5e3),
|
|
372
|
+
limit: untrack(() => props.limit ?? 3),
|
|
373
|
+
viewport: null,
|
|
374
|
+
toasts: [],
|
|
375
|
+
hovering: false,
|
|
376
|
+
focused: false,
|
|
377
|
+
isWindowFocused: true,
|
|
378
|
+
prevFocusElement: null
|
|
379
|
+
});
|
|
380
|
+
onCleanup(store.dispose);
|
|
381
|
+
createEffect(() => ({
|
|
382
|
+
timeout: props.timeout ?? 5e3,
|
|
383
|
+
limit: props.limit ?? 3
|
|
384
|
+
}), ({ timeout, limit }) => {
|
|
385
|
+
store.syncProviderProps(timeout, limit);
|
|
386
|
+
});
|
|
387
|
+
createEffect(() => props.toastManager, (toastManager) => {
|
|
388
|
+
if (!toastManager) return;
|
|
389
|
+
return toastManager[" subscribe"](({ action, options }) => {
|
|
390
|
+
const id = options.id;
|
|
391
|
+
if (action === "promise" && options.promise) store.promiseToast(options.promise, options);
|
|
392
|
+
else if (action === "update" && id) store.updateToast(id, options);
|
|
393
|
+
else if (action === "close") store.closeToast(id);
|
|
394
|
+
else store.addToast(options);
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
return ToastProviderContext({
|
|
398
|
+
value: store,
|
|
399
|
+
get children() {
|
|
400
|
+
return props.children;
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
//#endregion
|
|
405
|
+
//#region src/toast/utils/mergeToastStyles.ts
|
|
406
|
+
function mergeToastStyles(internal, external) {
|
|
407
|
+
if (typeof external === "string") {
|
|
408
|
+
const serialized = Object.entries(internal).filter((entry) => entry[1] != null).map(([property, value]) => `${property}:${String(value)}`).join(";");
|
|
409
|
+
return serialized ? `${serialized};${external}` : external;
|
|
410
|
+
}
|
|
411
|
+
return {
|
|
412
|
+
...internal,
|
|
413
|
+
...external || void 0
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
//#endregion
|
|
417
|
+
//#region src/toast/viewport/ToastViewport.tsx
|
|
418
|
+
var _tmpl$ = [
|
|
419
|
+
"<div",
|
|
420
|
+
" style=\"",
|
|
421
|
+
"\">",
|
|
422
|
+
"</div>"
|
|
423
|
+
];
|
|
424
|
+
var _tmpl$2 = [
|
|
425
|
+
"<div",
|
|
426
|
+
" role=\"alert\" aria-atomic=\"true\"><div>",
|
|
427
|
+
"</div><div>",
|
|
428
|
+
"</div></div>"
|
|
429
|
+
];
|
|
430
|
+
var visuallyHidden = {
|
|
431
|
+
"clip-path": "inset(50%)",
|
|
432
|
+
overflow: "hidden",
|
|
433
|
+
"white-space": "nowrap",
|
|
434
|
+
border: 0,
|
|
435
|
+
padding: 0,
|
|
436
|
+
width: "1px",
|
|
437
|
+
height: "1px",
|
|
438
|
+
margin: "-1px",
|
|
439
|
+
position: "fixed",
|
|
440
|
+
top: 0,
|
|
441
|
+
left: 0
|
|
442
|
+
};
|
|
443
|
+
/** A container viewport for toasts. */
|
|
444
|
+
function ToastViewport(props) {
|
|
445
|
+
var _v$, _v$2;
|
|
446
|
+
const store = useToastProviderContext();
|
|
447
|
+
const internalProps = props;
|
|
448
|
+
const allProps = props;
|
|
449
|
+
let handlingFocusGuard = false;
|
|
450
|
+
let markedReadyForMouseLeave = false;
|
|
451
|
+
let touchActive = false;
|
|
452
|
+
let windowFocusTimeout;
|
|
453
|
+
const viewportElement = createMemo(() => store.track().viewport);
|
|
454
|
+
const isEmpty = createMemo(() => selectors.isEmpty(store.track()));
|
|
455
|
+
const toasts = createMemo(() => selectors.toasts(store.track()));
|
|
456
|
+
const focused = createMemo(() => selectors.focused(store.track()));
|
|
457
|
+
const expanded = createMemo(() => selectors.expanded(store.track()));
|
|
458
|
+
const prevFocusElement = createMemo(() => selectors.prevFocusElement(store.track()));
|
|
459
|
+
const frontmostHeight = createMemo(() => toasts()[0]?.height);
|
|
460
|
+
const hasTransitioningToasts = createMemo(() => toasts().some((toast) => toast.transitionStatus === "ending"));
|
|
461
|
+
const highPriorityToasts = createMemo(() => toasts().filter((toast) => toast.priority === "high"));
|
|
462
|
+
createEffect(() => ({
|
|
463
|
+
empty: isEmpty(),
|
|
464
|
+
viewport: viewportElement()
|
|
465
|
+
}), ({ empty, viewport }) => {
|
|
466
|
+
if (!viewport || empty) return;
|
|
467
|
+
const element = viewport;
|
|
468
|
+
const win = ownerWindow(element);
|
|
469
|
+
const doc = ownerDocument(element);
|
|
470
|
+
function handleGlobalKeyDown(event) {
|
|
471
|
+
if (event.key === "F6" && getEventTarget(event) !== element) {
|
|
472
|
+
event.preventDefault();
|
|
473
|
+
store.set("prevFocusElement", activeElement(doc));
|
|
474
|
+
element.focus({ preventScroll: true });
|
|
475
|
+
store.pauseTimers();
|
|
476
|
+
store.set("focused", true);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
function handleWindowBlur(event) {
|
|
480
|
+
if (getEventTarget(event) !== win) return;
|
|
481
|
+
store.set("isWindowFocused", false);
|
|
482
|
+
store.pauseTimers();
|
|
483
|
+
}
|
|
484
|
+
function handleWindowFocus(event) {
|
|
485
|
+
if (event.relatedTarget) return;
|
|
486
|
+
const target = getEventTarget(event);
|
|
487
|
+
const activeEl = activeElement(ownerDocument(element));
|
|
488
|
+
if (target === win || !contains(element, target) || !isFocusVisible(activeEl)) store.resumeTimers();
|
|
489
|
+
clearTimeout(windowFocusTimeout);
|
|
490
|
+
windowFocusTimeout = setTimeout(() => store.set("isWindowFocused", true), 0);
|
|
491
|
+
}
|
|
492
|
+
win.addEventListener("keydown", handleGlobalKeyDown);
|
|
493
|
+
win.addEventListener("blur", handleWindowBlur, true);
|
|
494
|
+
win.addEventListener("focus", handleWindowFocus, true);
|
|
495
|
+
doc.addEventListener("pointerdown", store.handleDocumentPointerDown, true);
|
|
496
|
+
return () => {
|
|
497
|
+
win.removeEventListener("keydown", handleGlobalKeyDown);
|
|
498
|
+
win.removeEventListener("blur", handleWindowBlur, true);
|
|
499
|
+
win.removeEventListener("focus", handleWindowFocus, true);
|
|
500
|
+
doc.removeEventListener("pointerdown", store.handleDocumentPointerDown, true);
|
|
501
|
+
clearTimeout(windowFocusTimeout);
|
|
502
|
+
};
|
|
503
|
+
});
|
|
504
|
+
function handleFocusGuard(event) {
|
|
505
|
+
handlingFocusGuard = true;
|
|
506
|
+
const firstFocusableToast = event.relatedTarget === store.state.viewport ? untrack(toasts).find((toast) => toast.transitionStatus !== "ending" && !toast.limited) : void 0;
|
|
507
|
+
if (firstFocusableToast) firstFocusableToast.element?.focus();
|
|
508
|
+
else store.restoreFocusToPrevElement();
|
|
509
|
+
}
|
|
510
|
+
function handleKeyDown(event) {
|
|
511
|
+
if (event.key === "Tab" && event.shiftKey && getEventTarget(event) === store.state.viewport) {
|
|
512
|
+
event.preventDefault();
|
|
513
|
+
store.restoreFocusToPrevElement();
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function flushMouseLeave() {
|
|
517
|
+
if (store.state.toasts.some((toast) => toast.transitionStatus === "ending") || touchActive || !markedReadyForMouseLeave) return;
|
|
518
|
+
if (store.state.isWindowFocused) store.resumeTimers();
|
|
519
|
+
store.set("hovering", false);
|
|
520
|
+
markedReadyForMouseLeave = false;
|
|
521
|
+
}
|
|
522
|
+
createEffect(() => hasTransitioningToasts(), () => {
|
|
523
|
+
flushMouseLeave();
|
|
524
|
+
});
|
|
525
|
+
function handleMouseEnter() {
|
|
526
|
+
store.pauseTimers();
|
|
527
|
+
store.set("hovering", true);
|
|
528
|
+
markedReadyForMouseLeave = false;
|
|
529
|
+
}
|
|
530
|
+
function resumeTimersIfWindowFocused() {
|
|
531
|
+
if (store.state.isWindowFocused) store.resumeTimers();
|
|
532
|
+
}
|
|
533
|
+
function handleMouseLeave() {
|
|
534
|
+
markedReadyForMouseLeave = true;
|
|
535
|
+
flushMouseLeave();
|
|
536
|
+
}
|
|
537
|
+
function handlePointerDown(event) {
|
|
538
|
+
if (event.pointerType === "touch") touchActive = true;
|
|
539
|
+
}
|
|
540
|
+
function handlePointerEnd(event) {
|
|
541
|
+
if (event.pointerType !== "touch") return;
|
|
542
|
+
touchActive = false;
|
|
543
|
+
flushMouseLeave();
|
|
544
|
+
}
|
|
545
|
+
function handleFocus() {
|
|
546
|
+
if (handlingFocusGuard) {
|
|
547
|
+
handlingFocusGuard = false;
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
if (untrack(focused)) return;
|
|
551
|
+
if (isFocusVisible(activeElement(ownerDocument(store.state.viewport)))) {
|
|
552
|
+
store.set("focused", true);
|
|
553
|
+
store.pauseTimers();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
function handleBlur(event) {
|
|
557
|
+
if (!untrack(focused) || contains(store.state.viewport, event.relatedTarget)) return;
|
|
558
|
+
store.set("focused", false);
|
|
559
|
+
resumeTimersIfWindowFocused();
|
|
560
|
+
}
|
|
561
|
+
const state = createMemo(() => ({ expanded: expanded() }));
|
|
562
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
563
|
+
const styleValue = createMemo(() => mergeToastStyles({ "--toast-frontmost-height": frontmostHeight() ? `${frontmostHeight()}px` : void 0 }, resolveStyle(props.style, state())));
|
|
564
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
565
|
+
const showFocusGuard = createMemo(() => !isEmpty() && Boolean(prevFocusElement()));
|
|
566
|
+
const others = omit(allProps, "as", "children", "class", "onBlur", "onClick", "onFocus", "onKeyDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onPointerCancel", "onPointerDown", "onPointerUp", "ref", "style");
|
|
567
|
+
const onBlur = composeEventHandlers(() => internalProps.onBlur, () => handleBlur);
|
|
568
|
+
const onClick = composeEventHandlers(() => internalProps.onClick, () => handleFocus);
|
|
569
|
+
const onFocus = composeEventHandlers(() => internalProps.onFocus, () => handleFocus);
|
|
570
|
+
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown, () => handleKeyDown);
|
|
571
|
+
const onMouseEnter = composeEventHandlers(() => internalProps.onMouseEnter, () => handleMouseEnter);
|
|
572
|
+
const onMouseMove = composeEventHandlers(() => internalProps.onMouseMove, () => handleMouseEnter);
|
|
573
|
+
const onMouseLeave = composeEventHandlers(() => internalProps.onMouseLeave, () => handleMouseLeave);
|
|
574
|
+
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown, () => handlePointerDown);
|
|
575
|
+
const onPointerUp = composeEventHandlers(() => internalProps.onPointerUp, () => handlePointerEnd);
|
|
576
|
+
const onPointerCancel = composeEventHandlers(() => internalProps.onPointerCancel, () => handlePointerEnd);
|
|
577
|
+
return [
|
|
578
|
+
Show({
|
|
579
|
+
get when() {
|
|
580
|
+
return showFocusGuard();
|
|
581
|
+
},
|
|
582
|
+
get children() {
|
|
583
|
+
return FocusGuard({ onFocus: handleFocusGuard });
|
|
584
|
+
}
|
|
585
|
+
}),
|
|
586
|
+
Dynamic(mergeProps({
|
|
587
|
+
get component() {
|
|
588
|
+
return props.as ?? "div";
|
|
589
|
+
},
|
|
590
|
+
ref: [store.setViewport, internalProps.ref],
|
|
591
|
+
tabIndex: -1,
|
|
592
|
+
role: "region",
|
|
593
|
+
"aria-live": "polite",
|
|
594
|
+
"aria-atomic": "false",
|
|
595
|
+
"aria-relevant": "additions text",
|
|
596
|
+
"aria-label": "Notifications",
|
|
597
|
+
get ["class"]() {
|
|
598
|
+
return classValue();
|
|
599
|
+
},
|
|
600
|
+
get style() {
|
|
601
|
+
return styleValue();
|
|
602
|
+
},
|
|
603
|
+
onBlur,
|
|
604
|
+
onClick,
|
|
605
|
+
onFocus,
|
|
606
|
+
onKeyDown,
|
|
607
|
+
onMouseEnter,
|
|
608
|
+
onMouseLeave,
|
|
609
|
+
onMouseMove,
|
|
610
|
+
onPointerCancel,
|
|
611
|
+
onPointerDown,
|
|
612
|
+
onPointerUp
|
|
613
|
+
}, stateAttributes, others, { get children() {
|
|
614
|
+
return [
|
|
615
|
+
Show({
|
|
616
|
+
get when() {
|
|
617
|
+
return showFocusGuard();
|
|
618
|
+
},
|
|
619
|
+
get children() {
|
|
620
|
+
return FocusGuard({ onFocus: handleFocusGuard });
|
|
621
|
+
}
|
|
622
|
+
}),
|
|
623
|
+
memo(() => {
|
|
624
|
+
return escape(props.children);
|
|
625
|
+
}),
|
|
626
|
+
Show({
|
|
627
|
+
get when() {
|
|
628
|
+
return showFocusGuard();
|
|
629
|
+
},
|
|
630
|
+
get children() {
|
|
631
|
+
return FocusGuard({ onFocus: handleFocusGuard });
|
|
632
|
+
}
|
|
633
|
+
})
|
|
634
|
+
];
|
|
635
|
+
} })),
|
|
636
|
+
Show({
|
|
637
|
+
get when() {
|
|
638
|
+
return memo(() => {
|
|
639
|
+
return !focused();
|
|
640
|
+
})() && highPriorityToasts().length > 0;
|
|
641
|
+
},
|
|
642
|
+
get children() {
|
|
643
|
+
return _v$ = ssrHydrationKey(), _v$2 = escape(For({
|
|
644
|
+
get each() {
|
|
645
|
+
return highPriorityToasts();
|
|
646
|
+
},
|
|
647
|
+
keyed: (toast) => toast.id,
|
|
648
|
+
children: (toast) => {
|
|
649
|
+
var _v$3, _v$4, _v$5;
|
|
650
|
+
return _v$3 = ssrHydrationKey(), _v$4 = () => {
|
|
651
|
+
return escape(toast().title);
|
|
652
|
+
}, _v$5 = () => {
|
|
653
|
+
return escape(toast().description);
|
|
654
|
+
}, ssr(_tmpl$2, _v$3, _v$4, _v$5);
|
|
655
|
+
}
|
|
656
|
+
})), ssr(_tmpl$, _v$, ssrStyle(visuallyHidden), _v$2);
|
|
657
|
+
}
|
|
658
|
+
})
|
|
659
|
+
];
|
|
660
|
+
}
|
|
661
|
+
//#endregion
|
|
662
|
+
//#region src/toast/root/ToastRootContext.ts
|
|
663
|
+
var MISSING_CONTEXT$1 = Symbol("ToastRootContext");
|
|
664
|
+
var ToastRootContext = createContext(MISSING_CONTEXT$1);
|
|
665
|
+
function useToastRootContext() {
|
|
666
|
+
const context = useContext(ToastRootContext);
|
|
667
|
+
if (context === MISSING_CONTEXT$1) throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");
|
|
668
|
+
return context;
|
|
669
|
+
}
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region src/toast/root/ToastRoot.tsx
|
|
672
|
+
var toastRootStateAttributesMapping = {
|
|
673
|
+
...transitionStatusMapping,
|
|
674
|
+
swipeDirection(value) {
|
|
675
|
+
return value ? { "data-swipe-direction": value } : null;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
var SWIPE_THRESHOLD = 40;
|
|
679
|
+
var REVERSE_CANCEL_THRESHOLD = 10;
|
|
680
|
+
var OPPOSITE_DIRECTION_DAMPING_FACTOR = .5;
|
|
681
|
+
var MIN_DRAG_THRESHOLD = 1;
|
|
682
|
+
var INTERACTIVE_SELECTOR = `button,a,input,textarea,[role="button"],${`${BASE_UI_SWIPE_IGNORE_SELECTOR},${LEGACY_SWIPE_IGNORE_SELECTOR}`}`;
|
|
683
|
+
var DEFAULT_SWIPE_DIRECTION = ["down", "right"];
|
|
684
|
+
/** Groups all parts of an individual toast. */
|
|
685
|
+
function ToastRoot(props) {
|
|
686
|
+
const store = useToastProviderContext();
|
|
687
|
+
const internalProps = props;
|
|
688
|
+
const allProps = props;
|
|
689
|
+
const toast = () => internalProps.toast;
|
|
690
|
+
const isAnchored = () => toast().positionerProps?.anchor !== void 0;
|
|
691
|
+
const swipeDirections = createMemo(() => {
|
|
692
|
+
if (isAnchored()) return [];
|
|
693
|
+
const value = internalProps.swipeDirection ?? DEFAULT_SWIPE_DIRECTION;
|
|
694
|
+
return Array.isArray(value) ? value : [value];
|
|
695
|
+
});
|
|
696
|
+
const swipeEnabled = createMemo(() => swipeDirections().length > 0);
|
|
697
|
+
const [rootElement, setRootElement] = createSignal(null, { ownedWrite: true });
|
|
698
|
+
const [currentSwipeDirection, setCurrentSwipeDirection] = createSignal(void 0, { ownedWrite: true });
|
|
699
|
+
const [isSwiping, setIsSwiping] = createSignal(false, { ownedWrite: true });
|
|
700
|
+
const [isRealSwipe, setIsRealSwipe] = createSignal(false, { ownedWrite: true });
|
|
701
|
+
const [dragOffset, setDragOffset] = createSignal({
|
|
702
|
+
x: 0,
|
|
703
|
+
y: 0
|
|
704
|
+
}, { ownedWrite: true });
|
|
705
|
+
const [initialTransform, setInitialTransform] = createSignal({
|
|
706
|
+
x: 0,
|
|
707
|
+
y: 0,
|
|
708
|
+
scale: 1
|
|
709
|
+
}, { ownedWrite: true });
|
|
710
|
+
const [titleId, setTitleId] = createSignal(void 0, { ownedWrite: true });
|
|
711
|
+
const [descriptionId, setDescriptionId] = createSignal(void 0, { ownedWrite: true });
|
|
712
|
+
const [lockedDirection, setLockedDirection] = createSignal(null, { ownedWrite: true });
|
|
713
|
+
let lastToastId;
|
|
714
|
+
let dragStartPos = {
|
|
715
|
+
x: 0,
|
|
716
|
+
y: 0
|
|
717
|
+
};
|
|
718
|
+
let initialTransformRef = {
|
|
719
|
+
x: 0,
|
|
720
|
+
y: 0,
|
|
721
|
+
scale: 1
|
|
722
|
+
};
|
|
723
|
+
let intendedSwipeDirection;
|
|
724
|
+
let maxSwipeDisplacement = 0;
|
|
725
|
+
let cancelledSwipe = false;
|
|
726
|
+
let swipeCancelBaseline = {
|
|
727
|
+
x: 0,
|
|
728
|
+
y: 0
|
|
729
|
+
};
|
|
730
|
+
let isFirstPointerMove = false;
|
|
731
|
+
let dragOffsetRef = {
|
|
732
|
+
x: 0,
|
|
733
|
+
y: 0
|
|
734
|
+
};
|
|
735
|
+
let activePointerId = null;
|
|
736
|
+
let dragAbortController = null;
|
|
737
|
+
const toastId = createMemo(() => toast().id);
|
|
738
|
+
const transitionStatus = createMemo(() => toast().transitionStatus);
|
|
739
|
+
const isOpen = createMemo(() => transitionStatus() !== "ending");
|
|
740
|
+
const domIndex = createMemo(() => selectors.toastIndex(store.track(), toast().id));
|
|
741
|
+
const visibleIndex = createMemo(() => selectors.toastVisibleIndex(store.track(), toast().id));
|
|
742
|
+
const offsetY = createMemo(() => selectors.toastOffsetY(store.track(), toast().id));
|
|
743
|
+
const focused = createMemo(() => selectors.focused(store.track()));
|
|
744
|
+
const expanded = createMemo(() => selectors.expanded(store.track()));
|
|
745
|
+
createEffect(() => ({
|
|
746
|
+
open: isOpen(),
|
|
747
|
+
element: rootElement()
|
|
748
|
+
}), ({ open, element }) => {
|
|
749
|
+
if (!element) return;
|
|
750
|
+
const controller = new AbortController();
|
|
751
|
+
runOnceAnimationsFinish(element, () => {
|
|
752
|
+
const current = untrack(toast);
|
|
753
|
+
if (current.transitionStatus === "ending") store.removeToast(current.id);
|
|
754
|
+
}, controller.signal, { waitForStartingStyleRemoved: open });
|
|
755
|
+
return () => controller.abort();
|
|
756
|
+
});
|
|
757
|
+
/**
|
|
758
|
+
* Recalculates the natural height of the toast and updates it in the toast manager. The store
|
|
759
|
+
* ignores this write while the toast is transitioning out.
|
|
760
|
+
*/
|
|
761
|
+
function recalculateHeight(flushSync = false) {
|
|
762
|
+
const element = untrack(rootElement);
|
|
763
|
+
if (!element) return;
|
|
764
|
+
const previousHeight = element.style.height;
|
|
765
|
+
element.style.height = "auto";
|
|
766
|
+
const height = element.offsetHeight;
|
|
767
|
+
element.style.height = previousHeight;
|
|
768
|
+
store.updateToastInternal(untrack(toast).id, {
|
|
769
|
+
element,
|
|
770
|
+
height,
|
|
771
|
+
transitionStatus: void 0
|
|
772
|
+
});
|
|
773
|
+
if (flushSync) flush();
|
|
774
|
+
}
|
|
775
|
+
createEffect(() => ({
|
|
776
|
+
id: toastId(),
|
|
777
|
+
status: transitionStatus()
|
|
778
|
+
}), ({ id, status }) => {
|
|
779
|
+
const previousToastId = lastToastId;
|
|
780
|
+
if (status !== "starting" && previousToastId === id) return;
|
|
781
|
+
if (previousToastId !== void 0) {
|
|
782
|
+
setCurrentSwipeDirection(void 0);
|
|
783
|
+
setInitialTransform({
|
|
784
|
+
x: 0,
|
|
785
|
+
y: 0,
|
|
786
|
+
scale: 1
|
|
787
|
+
});
|
|
788
|
+
setResolvedDragOffset({
|
|
789
|
+
x: 0,
|
|
790
|
+
y: 0
|
|
791
|
+
});
|
|
792
|
+
}
|
|
793
|
+
lastToastId = id;
|
|
794
|
+
recalculateHeight();
|
|
795
|
+
});
|
|
796
|
+
onCleanup(() => {
|
|
797
|
+
dragAbortController?.abort();
|
|
798
|
+
});
|
|
799
|
+
function setResolvedDragOffset(nextDragOffset) {
|
|
800
|
+
dragOffsetRef = nextDragOffset;
|
|
801
|
+
setDragOffset(nextDragOffset);
|
|
802
|
+
}
|
|
803
|
+
function applyDirectionalDamping(deltaX, deltaY) {
|
|
804
|
+
const directions = untrack(swipeDirections);
|
|
805
|
+
const damp = (delta) => delta > 0 ? delta ** OPPOSITE_DIRECTION_DAMPING_FACTOR : -(Math.abs(delta) ** OPPOSITE_DIRECTION_DAMPING_FACTOR);
|
|
806
|
+
const dampX = deltaX > 0 && !directions.includes("right") || deltaX < 0 && !directions.includes("left");
|
|
807
|
+
const dampY = deltaY > 0 && !directions.includes("down") || deltaY < 0 && !directions.includes("up");
|
|
808
|
+
return {
|
|
809
|
+
x: dampX ? damp(deltaX) : deltaX,
|
|
810
|
+
y: dampY ? damp(deltaY) : deltaY
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
function handleSwipeEnd(event) {
|
|
814
|
+
if (event.pointerId !== activePointerId) return;
|
|
815
|
+
activePointerId = null;
|
|
816
|
+
dragAbortController?.abort();
|
|
817
|
+
dragAbortController = null;
|
|
818
|
+
setIsSwiping(false);
|
|
819
|
+
setIsRealSwipe(false);
|
|
820
|
+
setLockedDirection(null);
|
|
821
|
+
const resolvedInitialTransform = initialTransformRef;
|
|
822
|
+
if (event.type === "pointercancel" || cancelledSwipe) {
|
|
823
|
+
setResolvedDragOffset({
|
|
824
|
+
x: resolvedInitialTransform.x,
|
|
825
|
+
y: resolvedInitialTransform.y
|
|
826
|
+
});
|
|
827
|
+
setCurrentSwipeDirection(void 0);
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
const resolvedDragOffset = dragOffsetRef;
|
|
831
|
+
const deltaX = resolvedDragOffset.x - resolvedInitialTransform.x;
|
|
832
|
+
const deltaY = resolvedDragOffset.y - resolvedInitialTransform.y;
|
|
833
|
+
let dismissDirection;
|
|
834
|
+
for (const direction of untrack(swipeDirections)) if (getDisplacement(direction, deltaX, deltaY) > SWIPE_THRESHOLD) {
|
|
835
|
+
dismissDirection = direction;
|
|
836
|
+
break;
|
|
837
|
+
}
|
|
838
|
+
if (dismissDirection) {
|
|
839
|
+
setCurrentSwipeDirection(dismissDirection);
|
|
840
|
+
store.closeToast(untrack(toast).id);
|
|
841
|
+
} else {
|
|
842
|
+
setResolvedDragOffset({
|
|
843
|
+
x: resolvedInitialTransform.x,
|
|
844
|
+
y: resolvedInitialTransform.y
|
|
845
|
+
});
|
|
846
|
+
setCurrentSwipeDirection(void 0);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
function handlePointerDown(event) {
|
|
850
|
+
if (event.button !== 0) return;
|
|
851
|
+
if (event.pointerType === "touch") store.pauseTimers();
|
|
852
|
+
if (getEventTarget(event)?.closest(INTERACTIVE_SELECTOR)) return;
|
|
853
|
+
cancelledSwipe = false;
|
|
854
|
+
intendedSwipeDirection = void 0;
|
|
855
|
+
maxSwipeDisplacement = 0;
|
|
856
|
+
activePointerId = event.pointerId;
|
|
857
|
+
dragStartPos = {
|
|
858
|
+
x: event.clientX,
|
|
859
|
+
y: event.clientY
|
|
860
|
+
};
|
|
861
|
+
swipeCancelBaseline = dragStartPos;
|
|
862
|
+
const element = event.currentTarget;
|
|
863
|
+
const transform = getElementTransform(element);
|
|
864
|
+
initialTransformRef = transform;
|
|
865
|
+
setInitialTransform(transform);
|
|
866
|
+
setResolvedDragOffset({
|
|
867
|
+
x: transform.x,
|
|
868
|
+
y: transform.y
|
|
869
|
+
});
|
|
870
|
+
store.set("hovering", true);
|
|
871
|
+
setIsSwiping(true);
|
|
872
|
+
setIsRealSwipe(false);
|
|
873
|
+
setLockedDirection(null);
|
|
874
|
+
isFirstPointerMove = true;
|
|
875
|
+
dragAbortController?.abort();
|
|
876
|
+
const controller = new AbortController();
|
|
877
|
+
dragAbortController = controller;
|
|
878
|
+
const doc = ownerDocument(element);
|
|
879
|
+
doc.addEventListener("pointerup", handleSwipeEnd, { signal: controller.signal });
|
|
880
|
+
doc.addEventListener("pointercancel", handleSwipeEnd, { signal: controller.signal });
|
|
881
|
+
element.setPointerCapture?.(event.pointerId);
|
|
882
|
+
}
|
|
883
|
+
function handlePointerMove(event) {
|
|
884
|
+
if (event.pointerId !== activePointerId) return;
|
|
885
|
+
event.preventDefault();
|
|
886
|
+
if (isFirstPointerMove) {
|
|
887
|
+
dragStartPos = {
|
|
888
|
+
x: event.clientX,
|
|
889
|
+
y: event.clientY
|
|
890
|
+
};
|
|
891
|
+
isFirstPointerMove = false;
|
|
892
|
+
}
|
|
893
|
+
const { clientY, clientX, movementX, movementY } = event;
|
|
894
|
+
const directions = untrack(swipeDirections);
|
|
895
|
+
if (movementY < 0 && clientY > swipeCancelBaseline.y || movementY > 0 && clientY < swipeCancelBaseline.y) swipeCancelBaseline = {
|
|
896
|
+
x: swipeCancelBaseline.x,
|
|
897
|
+
y: clientY
|
|
898
|
+
};
|
|
899
|
+
if (movementX < 0 && clientX > swipeCancelBaseline.x || movementX > 0 && clientX < swipeCancelBaseline.x) swipeCancelBaseline = {
|
|
900
|
+
x: clientX,
|
|
901
|
+
y: swipeCancelBaseline.y
|
|
902
|
+
};
|
|
903
|
+
const deltaX = clientX - dragStartPos.x;
|
|
904
|
+
const deltaY = clientY - dragStartPos.y;
|
|
905
|
+
const cancelDeltaY = clientY - swipeCancelBaseline.y;
|
|
906
|
+
const cancelDeltaX = clientX - swipeCancelBaseline.x;
|
|
907
|
+
let resolvedLockedDirection = untrack(lockedDirection);
|
|
908
|
+
if (!untrack(isRealSwipe)) {
|
|
909
|
+
if (Math.sqrt(deltaX * deltaX + deltaY * deltaY) >= MIN_DRAG_THRESHOLD) {
|
|
910
|
+
setIsRealSwipe(true);
|
|
911
|
+
const hasHorizontal = directions.includes("left") || directions.includes("right");
|
|
912
|
+
const hasVertical = directions.includes("up") || directions.includes("down");
|
|
913
|
+
if (hasHorizontal && hasVertical) {
|
|
914
|
+
resolvedLockedDirection = Math.abs(deltaX) > Math.abs(deltaY) ? "horizontal" : "vertical";
|
|
915
|
+
setLockedDirection(resolvedLockedDirection);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
let candidate;
|
|
920
|
+
if (!intendedSwipeDirection) {
|
|
921
|
+
if (resolvedLockedDirection === "vertical") {
|
|
922
|
+
if (deltaY > 0) candidate = "down";
|
|
923
|
+
else if (deltaY < 0) candidate = "up";
|
|
924
|
+
} else if (resolvedLockedDirection === "horizontal") {
|
|
925
|
+
if (deltaX > 0) candidate = "right";
|
|
926
|
+
else if (deltaX < 0) candidate = "left";
|
|
927
|
+
} else if (Math.abs(deltaX) >= Math.abs(deltaY)) candidate = deltaX > 0 ? "right" : "left";
|
|
928
|
+
else candidate = deltaY > 0 ? "down" : "up";
|
|
929
|
+
if (candidate && directions.includes(candidate)) {
|
|
930
|
+
intendedSwipeDirection = candidate;
|
|
931
|
+
maxSwipeDisplacement = getDisplacement(candidate, deltaX, deltaY);
|
|
932
|
+
setCurrentSwipeDirection(candidate);
|
|
933
|
+
}
|
|
934
|
+
} else {
|
|
935
|
+
const direction = intendedSwipeDirection;
|
|
936
|
+
const currentDisplacement = getDisplacement(direction, cancelDeltaX, cancelDeltaY);
|
|
937
|
+
if (currentDisplacement > SWIPE_THRESHOLD) {
|
|
938
|
+
cancelledSwipe = false;
|
|
939
|
+
setCurrentSwipeDirection(direction);
|
|
940
|
+
} else if (!(directions.includes("left") && directions.includes("right")) && !(directions.includes("up") && directions.includes("down")) && maxSwipeDisplacement - currentDisplacement >= REVERSE_CANCEL_THRESHOLD) cancelledSwipe = true;
|
|
941
|
+
}
|
|
942
|
+
const dampedDelta = applyDirectionalDamping(deltaX, deltaY);
|
|
943
|
+
let newOffsetX = initialTransformRef.x;
|
|
944
|
+
let newOffsetY = initialTransformRef.y;
|
|
945
|
+
const hasHorizontalDir = directions.includes("left") || directions.includes("right");
|
|
946
|
+
const hasVerticalDir = directions.includes("up") || directions.includes("down");
|
|
947
|
+
if (resolvedLockedDirection !== "vertical" && hasHorizontalDir) newOffsetX += dampedDelta.x;
|
|
948
|
+
if (resolvedLockedDirection !== "horizontal" && hasVerticalDir) newOffsetY += dampedDelta.y;
|
|
949
|
+
setResolvedDragOffset({
|
|
950
|
+
x: newOffsetX,
|
|
951
|
+
y: newOffsetY
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
function handleKeyDown(event) {
|
|
955
|
+
if (event.key !== "Escape") return;
|
|
956
|
+
const element = untrack(rootElement);
|
|
957
|
+
if (!element || !contains(element, activeElement(ownerDocument(element)))) return;
|
|
958
|
+
store.closeToast(untrack(toast).id);
|
|
959
|
+
}
|
|
960
|
+
createEffect(() => ({
|
|
961
|
+
enabled: swipeEnabled(),
|
|
962
|
+
element: rootElement()
|
|
963
|
+
}), ({ enabled, element }) => {
|
|
964
|
+
if (!enabled || !element) return;
|
|
965
|
+
function preventDefaultTouchMove(event) {
|
|
966
|
+
if (activePointerId === null || !contains(element, getEventTarget(event))) return;
|
|
967
|
+
event.preventDefault();
|
|
968
|
+
}
|
|
969
|
+
element.addEventListener("touchmove", preventDefaultTouchMove, { passive: false });
|
|
970
|
+
return () => element.removeEventListener("touchmove", preventDefaultTouchMove);
|
|
971
|
+
});
|
|
972
|
+
function getDragStyles() {
|
|
973
|
+
const offset = dragOffset();
|
|
974
|
+
const transform = initialTransform();
|
|
975
|
+
const deltaX = offset.x - transform.x;
|
|
976
|
+
const deltaY = offset.y - transform.y;
|
|
977
|
+
return {
|
|
978
|
+
transition: isSwiping() ? "none" : void 0,
|
|
979
|
+
transform: isSwiping() ? `translateX(${offset.x}px) translateY(${offset.y}px) scale(${transform.scale})` : void 0,
|
|
980
|
+
"--toast-swipe-movement-x": `${deltaX}px`,
|
|
981
|
+
"--toast-swipe-movement-y": `${deltaY}px`
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
const isHighPriority = createMemo(() => toast().priority === "high");
|
|
985
|
+
const state = createMemo(() => ({
|
|
986
|
+
transitionStatus: toast().transitionStatus,
|
|
987
|
+
expanded: expanded(),
|
|
988
|
+
limited: toast().limited || false,
|
|
989
|
+
type: toast().type,
|
|
990
|
+
swiping: isSwiping(),
|
|
991
|
+
swipeDirection: currentSwipeDirection()
|
|
992
|
+
}));
|
|
993
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
994
|
+
const styleValue = createMemo(() => mergeToastStyles({
|
|
995
|
+
...getDragStyles(),
|
|
996
|
+
"--toast-index": String(toast().transitionStatus === "ending" ? domIndex() : visibleIndex()),
|
|
997
|
+
"--toast-offset-y": `${offsetY()}px`,
|
|
998
|
+
"--toast-height": toast().height ? `${toast().height}px` : void 0
|
|
999
|
+
}, resolveStyle(props.style, state())));
|
|
1000
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state(), toastRootStateAttributesMapping));
|
|
1001
|
+
const others = omit(allProps, "as", "class", "onKeyDown", "onPointerCancel", "onPointerDown", "onPointerMove", "onPointerUp", "ref", "style", "swipeDirection", "toast");
|
|
1002
|
+
const onKeyDown = composeEventHandlers(() => internalProps.onKeyDown, () => handleKeyDown);
|
|
1003
|
+
const onPointerDown = composeEventHandlers(() => internalProps.onPointerDown, () => untrack(() => swipeEnabled() ? handlePointerDown : void 0));
|
|
1004
|
+
const onPointerMove = composeEventHandlers(() => internalProps.onPointerMove, () => untrack(() => swipeEnabled() ? handlePointerMove : void 0));
|
|
1005
|
+
const onPointerUp = composeEventHandlers(() => internalProps.onPointerUp, () => untrack(() => swipeEnabled() ? handleSwipeEnd : void 0));
|
|
1006
|
+
const onPointerCancel = composeEventHandlers(() => internalProps.onPointerCancel, () => untrack(() => swipeEnabled() ? handleSwipeEnd : void 0));
|
|
1007
|
+
return ToastRootContext({
|
|
1008
|
+
value: {
|
|
1009
|
+
toast,
|
|
1010
|
+
setTitleId,
|
|
1011
|
+
setDescriptionId,
|
|
1012
|
+
visibleIndex,
|
|
1013
|
+
expanded,
|
|
1014
|
+
recalculateHeight
|
|
1015
|
+
},
|
|
1016
|
+
get children() {
|
|
1017
|
+
return Dynamic(mergeProps({
|
|
1018
|
+
get component() {
|
|
1019
|
+
return props.as ?? "div";
|
|
1020
|
+
},
|
|
1021
|
+
ref: [((element) => setRootElement(element)), internalProps.ref],
|
|
1022
|
+
get role() {
|
|
1023
|
+
return isHighPriority() ? "alertdialog" : "dialog";
|
|
1024
|
+
},
|
|
1025
|
+
tabIndex: 0,
|
|
1026
|
+
"aria-modal": "false",
|
|
1027
|
+
get ["aria-labelledby"]() {
|
|
1028
|
+
return titleId();
|
|
1029
|
+
},
|
|
1030
|
+
get ["aria-describedby"]() {
|
|
1031
|
+
return descriptionId();
|
|
1032
|
+
},
|
|
1033
|
+
get ["aria-hidden"]() {
|
|
1034
|
+
return isHighPriority() && !focused() ? "true" : void 0;
|
|
1035
|
+
},
|
|
1036
|
+
get inert() {
|
|
1037
|
+
return toast().limited || void 0;
|
|
1038
|
+
},
|
|
1039
|
+
get ["class"]() {
|
|
1040
|
+
return classValue();
|
|
1041
|
+
},
|
|
1042
|
+
get style() {
|
|
1043
|
+
return styleValue();
|
|
1044
|
+
},
|
|
1045
|
+
onKeyDown,
|
|
1046
|
+
onPointerDown,
|
|
1047
|
+
onPointerMove,
|
|
1048
|
+
onPointerUp,
|
|
1049
|
+
onPointerCancel
|
|
1050
|
+
}, stateAttributes, others));
|
|
1051
|
+
}
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region src/toast/content/ToastContent.tsx
|
|
1056
|
+
/** A container for the contents of a toast. Its size drives the measured toast height. */
|
|
1057
|
+
function ToastContent(props) {
|
|
1058
|
+
const context = useToastRootContext();
|
|
1059
|
+
const internalProps = props;
|
|
1060
|
+
const allProps = props;
|
|
1061
|
+
const [contentElement, setContentElement] = createSignal(null, { ownedWrite: true });
|
|
1062
|
+
createEffect(() => contentElement(), (element) => {
|
|
1063
|
+
context.recalculateHeight();
|
|
1064
|
+
if (!element || typeof ResizeObserver !== "function" || typeof MutationObserver !== "function") return;
|
|
1065
|
+
const resizeObserver = new ResizeObserver(() => context.recalculateHeight(true));
|
|
1066
|
+
const mutationObserver = new MutationObserver(() => context.recalculateHeight(true));
|
|
1067
|
+
resizeObserver.observe(element);
|
|
1068
|
+
mutationObserver.observe(element, {
|
|
1069
|
+
childList: true,
|
|
1070
|
+
subtree: true,
|
|
1071
|
+
characterData: true
|
|
1072
|
+
});
|
|
1073
|
+
return () => {
|
|
1074
|
+
resizeObserver.disconnect();
|
|
1075
|
+
mutationObserver.disconnect();
|
|
1076
|
+
};
|
|
1077
|
+
});
|
|
1078
|
+
const state = createMemo(() => ({
|
|
1079
|
+
expanded: context.expanded(),
|
|
1080
|
+
behind: context.visibleIndex() > 0
|
|
1081
|
+
}));
|
|
1082
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1083
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1084
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1085
|
+
const others = omit(allProps, "as", "class", "ref", "style");
|
|
1086
|
+
return Dynamic(mergeProps({
|
|
1087
|
+
get component() {
|
|
1088
|
+
return props.as ?? "div";
|
|
1089
|
+
},
|
|
1090
|
+
ref: [((element) => setContentElement(element)), internalProps.ref],
|
|
1091
|
+
get ["class"]() {
|
|
1092
|
+
return classValue();
|
|
1093
|
+
},
|
|
1094
|
+
get style() {
|
|
1095
|
+
return styleValue();
|
|
1096
|
+
}
|
|
1097
|
+
}, stateAttributes, others));
|
|
1098
|
+
}
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region src/toast/utils/isRenderableNode.ts
|
|
1101
|
+
/**
|
|
1102
|
+
* Mirrors Base UI's renderable-node check for resolved Solid children: `null`,
|
|
1103
|
+
* `undefined`, booleans, and the empty string render nothing, and an array is
|
|
1104
|
+
* renderable when any entry is.
|
|
1105
|
+
*/
|
|
1106
|
+
function isRenderableNode(node) {
|
|
1107
|
+
if (node == null || typeof node === "boolean" || node === "") return false;
|
|
1108
|
+
if (Array.isArray(node)) return node.some(isRenderableNode);
|
|
1109
|
+
return true;
|
|
1110
|
+
}
|
|
1111
|
+
//#endregion
|
|
1112
|
+
//#region src/toast/utils/createToastLabelPart.ts
|
|
1113
|
+
/**
|
|
1114
|
+
* Shared logic for `Toast.Title` and `Toast.Description`, which differ only by the rendered tag,
|
|
1115
|
+
* the fallback content, and which id setter they register with. The part mounts only while it
|
|
1116
|
+
* carries renderable content, and registers its id with the root for that time.
|
|
1117
|
+
*/
|
|
1118
|
+
function createToastLabelPart(props, part) {
|
|
1119
|
+
const context = useToastRootContext();
|
|
1120
|
+
const setId = part === "title" ? context.setTitleId : context.setDescriptionId;
|
|
1121
|
+
const generatedId = `base-ui-${createUniqueId()}`;
|
|
1122
|
+
const id = createMemo(() => props.id || generatedId);
|
|
1123
|
+
const content = children(() => props.children ?? (part === "title" ? context.toast().title : context.toast().description));
|
|
1124
|
+
const shouldRender = createMemo(() => isRenderableNode(content()));
|
|
1125
|
+
createEffect(() => shouldRender() ? id() : void 0, (current) => {
|
|
1126
|
+
if (current === void 0) return;
|
|
1127
|
+
setId(current);
|
|
1128
|
+
return () => setId((existing) => existing === current ? void 0 : existing);
|
|
1129
|
+
});
|
|
1130
|
+
return {
|
|
1131
|
+
id,
|
|
1132
|
+
content,
|
|
1133
|
+
shouldRender,
|
|
1134
|
+
type: () => context.toast().type
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
//#endregion
|
|
1138
|
+
//#region src/toast/description/ToastDescription.tsx
|
|
1139
|
+
/**
|
|
1140
|
+
* A description that describes the toast. Can be used as the default message for the toast when
|
|
1141
|
+
* no title is provided. Renders nothing when it has no content.
|
|
1142
|
+
*/
|
|
1143
|
+
function ToastDescription(props) {
|
|
1144
|
+
const internalProps = props;
|
|
1145
|
+
const allProps = props;
|
|
1146
|
+
const part = createToastLabelPart(props, "description");
|
|
1147
|
+
const state = createMemo(() => ({ type: part.type() }));
|
|
1148
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1149
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1150
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1151
|
+
const others = omit(allProps, "as", "children", "class", "id", "ref", "style");
|
|
1152
|
+
return Show({
|
|
1153
|
+
get when() {
|
|
1154
|
+
return part.shouldRender();
|
|
1155
|
+
},
|
|
1156
|
+
get children() {
|
|
1157
|
+
return Dynamic(mergeProps({
|
|
1158
|
+
get component() {
|
|
1159
|
+
return props.as ?? "p";
|
|
1160
|
+
},
|
|
1161
|
+
ref: [internalProps.ref],
|
|
1162
|
+
get id() {
|
|
1163
|
+
return part.id();
|
|
1164
|
+
},
|
|
1165
|
+
get ["class"]() {
|
|
1166
|
+
return classValue();
|
|
1167
|
+
},
|
|
1168
|
+
get style() {
|
|
1169
|
+
return styleValue();
|
|
1170
|
+
}
|
|
1171
|
+
}, stateAttributes, others, { get children() {
|
|
1172
|
+
return part.content();
|
|
1173
|
+
} }));
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
}
|
|
1177
|
+
//#endregion
|
|
1178
|
+
//#region src/toast/title/ToastTitle.tsx
|
|
1179
|
+
/** A title that labels the toast. Renders nothing when it has no content. */
|
|
1180
|
+
function ToastTitle(props) {
|
|
1181
|
+
const internalProps = props;
|
|
1182
|
+
const allProps = props;
|
|
1183
|
+
const part = createToastLabelPart(props, "title");
|
|
1184
|
+
const state = createMemo(() => ({ type: part.type() }));
|
|
1185
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1186
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1187
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1188
|
+
const others = omit(allProps, "as", "children", "class", "id", "ref", "style");
|
|
1189
|
+
return Show({
|
|
1190
|
+
get when() {
|
|
1191
|
+
return part.shouldRender();
|
|
1192
|
+
},
|
|
1193
|
+
get children() {
|
|
1194
|
+
return Dynamic(mergeProps({
|
|
1195
|
+
get component() {
|
|
1196
|
+
return props.as ?? "h2";
|
|
1197
|
+
},
|
|
1198
|
+
ref: [internalProps.ref],
|
|
1199
|
+
get id() {
|
|
1200
|
+
return part.id();
|
|
1201
|
+
},
|
|
1202
|
+
get ["class"]() {
|
|
1203
|
+
return classValue();
|
|
1204
|
+
},
|
|
1205
|
+
get style() {
|
|
1206
|
+
return styleValue();
|
|
1207
|
+
}
|
|
1208
|
+
}, stateAttributes, others, { get children() {
|
|
1209
|
+
return part.content();
|
|
1210
|
+
} }));
|
|
1211
|
+
}
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
//#endregion
|
|
1215
|
+
//#region src/toast/close/ToastClose.tsx
|
|
1216
|
+
/** Closes the toast when clicked. */
|
|
1217
|
+
function ToastClose(props) {
|
|
1218
|
+
const store = useToastProviderContext();
|
|
1219
|
+
const context = useToastRootContext();
|
|
1220
|
+
const internalProps = props;
|
|
1221
|
+
const allProps = props;
|
|
1222
|
+
const [hasFocus, setHasFocus] = createSignal(false, { ownedWrite: true });
|
|
1223
|
+
const disabled = createMemo(() => internalProps.disabled ?? false);
|
|
1224
|
+
const nativeButton = createMemo(() => internalProps.nativeButton ?? true);
|
|
1225
|
+
const state = createMemo(() => ({ type: context.toast().type }));
|
|
1226
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1227
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1228
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1229
|
+
const others = omit(allProps, "as", "class", "disabled", "nativeButton", "onBlur", "onClick", "onFocus", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "ref", "style");
|
|
1230
|
+
function handleClick() {
|
|
1231
|
+
store.closeToast(context.toast().id);
|
|
1232
|
+
}
|
|
1233
|
+
const onClick = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onClick, () => handleClick);
|
|
1234
|
+
const onFocus = composeEventHandlers(() => internalProps.onFocus, () => () => setHasFocus(true));
|
|
1235
|
+
const onBlur = composeEventHandlers(() => internalProps.onBlur, () => () => setHasFocus(false));
|
|
1236
|
+
const onPointerDown = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onPointerDown);
|
|
1237
|
+
const onMouseDown = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onMouseDown);
|
|
1238
|
+
const onKeyDown = composeEventHandlers(() => untrack(() => disabled() ? preventDisabledButtonKeyDown : void 0), () => internalProps.onKeyDown, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyDown));
|
|
1239
|
+
const onKeyUp = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onKeyUp, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp));
|
|
1240
|
+
return Dynamic(mergeProps({
|
|
1241
|
+
get component() {
|
|
1242
|
+
return props.as ?? "button";
|
|
1243
|
+
},
|
|
1244
|
+
ref: [internalProps.ref],
|
|
1245
|
+
get type() {
|
|
1246
|
+
return nativeButton() ? "button" : void 0;
|
|
1247
|
+
},
|
|
1248
|
+
get role() {
|
|
1249
|
+
return nativeButton() ? void 0 : "button";
|
|
1250
|
+
},
|
|
1251
|
+
get tabIndex() {
|
|
1252
|
+
return !nativeButton() && disabled() ? -1 : 0;
|
|
1253
|
+
},
|
|
1254
|
+
get disabled() {
|
|
1255
|
+
return (memo(() => {
|
|
1256
|
+
return !!nativeButton();
|
|
1257
|
+
})() ? disabled() : nativeButton()) || void 0;
|
|
1258
|
+
},
|
|
1259
|
+
get ["aria-disabled"]() {
|
|
1260
|
+
return !nativeButton() && disabled() ? "true" : void 0;
|
|
1261
|
+
},
|
|
1262
|
+
get ["aria-hidden"]() {
|
|
1263
|
+
return !context.expanded() && !hasFocus() ? "true" : "false";
|
|
1264
|
+
},
|
|
1265
|
+
get ["class"]() {
|
|
1266
|
+
return classValue();
|
|
1267
|
+
},
|
|
1268
|
+
get style() {
|
|
1269
|
+
return styleValue();
|
|
1270
|
+
},
|
|
1271
|
+
onBlur,
|
|
1272
|
+
onClick,
|
|
1273
|
+
onFocus,
|
|
1274
|
+
onKeyDown,
|
|
1275
|
+
onKeyUp,
|
|
1276
|
+
onMouseDown,
|
|
1277
|
+
onPointerDown
|
|
1278
|
+
}, stateAttributes, others));
|
|
1279
|
+
}
|
|
1280
|
+
//#endregion
|
|
1281
|
+
//#region src/toast/action/ToastAction.tsx
|
|
1282
|
+
/**
|
|
1283
|
+
* Performs an action when clicked. Renders nothing when neither the toast nor the part supplies
|
|
1284
|
+
* action content.
|
|
1285
|
+
*/
|
|
1286
|
+
function ToastAction(props) {
|
|
1287
|
+
const context = useToastRootContext();
|
|
1288
|
+
const internalProps = props;
|
|
1289
|
+
const allProps = props;
|
|
1290
|
+
const actionProps = () => context.toast().actionProps;
|
|
1291
|
+
const content = children(() => actionProps()?.children ?? props.children);
|
|
1292
|
+
const shouldRender = createMemo(() => isRenderableNode(content()));
|
|
1293
|
+
const disabled = createMemo(() => internalProps.disabled ?? false);
|
|
1294
|
+
const nativeButton = createMemo(() => internalProps.nativeButton ?? true);
|
|
1295
|
+
const state = createMemo(() => ({ type: context.toast().type }));
|
|
1296
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1297
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state()));
|
|
1298
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1299
|
+
const others = omit(allProps, "as", "children", "class", "disabled", "nativeButton", "onClick", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown", "ref", "style");
|
|
1300
|
+
const managerProps = createMemo(() => {
|
|
1301
|
+
const value = actionProps();
|
|
1302
|
+
if (!value) return;
|
|
1303
|
+
return omit(value, "children", "onClick", "onKeyDown", "onKeyUp", "onMouseDown", "onPointerDown");
|
|
1304
|
+
});
|
|
1305
|
+
const onClick = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onClick, () => actionProps()?.onClick);
|
|
1306
|
+
const onPointerDown = composeEventHandlers(() => untrack(() => disabled() ? preventButtonInteraction : void 0), () => internalProps.onPointerDown, () => actionProps()?.onPointerDown);
|
|
1307
|
+
const onMouseDown = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onMouseDown, () => actionProps()?.onMouseDown);
|
|
1308
|
+
const onKeyDown = composeEventHandlers(() => untrack(() => disabled() ? preventDisabledButtonKeyDown : void 0), () => internalProps.onKeyDown, () => actionProps()?.onKeyDown, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyDown));
|
|
1309
|
+
const onKeyUp = composeEventHandlers(() => untrack(() => disabled() ? stopButtonInteraction : void 0), () => internalProps.onKeyUp, () => actionProps()?.onKeyUp, () => untrack(() => nativeButton() ? void 0 : handleNonNativeButtonKeyUp));
|
|
1310
|
+
return Show({
|
|
1311
|
+
get when() {
|
|
1312
|
+
return shouldRender();
|
|
1313
|
+
},
|
|
1314
|
+
get children() {
|
|
1315
|
+
return Dynamic(mergeProps({
|
|
1316
|
+
get component() {
|
|
1317
|
+
return props.as ?? "button";
|
|
1318
|
+
},
|
|
1319
|
+
ref: [internalProps.ref],
|
|
1320
|
+
get type() {
|
|
1321
|
+
return nativeButton() ? "button" : void 0;
|
|
1322
|
+
},
|
|
1323
|
+
get role() {
|
|
1324
|
+
return nativeButton() ? void 0 : "button";
|
|
1325
|
+
},
|
|
1326
|
+
get tabIndex() {
|
|
1327
|
+
return !nativeButton() && disabled() ? -1 : 0;
|
|
1328
|
+
},
|
|
1329
|
+
get disabled() {
|
|
1330
|
+
return (memo(() => {
|
|
1331
|
+
return !!nativeButton();
|
|
1332
|
+
})() ? disabled() : nativeButton()) || void 0;
|
|
1333
|
+
},
|
|
1334
|
+
get ["aria-disabled"]() {
|
|
1335
|
+
return !nativeButton() && disabled() ? "true" : void 0;
|
|
1336
|
+
},
|
|
1337
|
+
get ["class"]() {
|
|
1338
|
+
return classValue();
|
|
1339
|
+
},
|
|
1340
|
+
get style() {
|
|
1341
|
+
return styleValue();
|
|
1342
|
+
},
|
|
1343
|
+
onClick,
|
|
1344
|
+
onKeyDown,
|
|
1345
|
+
onKeyUp,
|
|
1346
|
+
onMouseDown,
|
|
1347
|
+
onPointerDown
|
|
1348
|
+
}, stateAttributes, others, managerProps, { get children() {
|
|
1349
|
+
return content();
|
|
1350
|
+
} }));
|
|
1351
|
+
}
|
|
1352
|
+
});
|
|
1353
|
+
}
|
|
1354
|
+
//#endregion
|
|
1355
|
+
//#region src/toast/portal/ToastPortal.tsx
|
|
1356
|
+
/**
|
|
1357
|
+
* A portal element that moves the viewport to a different part of the DOM. By default, the
|
|
1358
|
+
* portal element is appended to `<body>`.
|
|
1359
|
+
*/
|
|
1360
|
+
function ToastPortal(props) {
|
|
1361
|
+
const internalProps = props;
|
|
1362
|
+
const allProps = props;
|
|
1363
|
+
const state = {};
|
|
1364
|
+
const classValue = createMemo(() => resolveClass(props.class, state));
|
|
1365
|
+
const styleValue = createMemo(() => resolveStyle(props.style, state));
|
|
1366
|
+
const others = omit(allProps, "as", "class", "container", "ref", "style");
|
|
1367
|
+
return PopupPortal(mergeProps({
|
|
1368
|
+
get as() {
|
|
1369
|
+
return props.as;
|
|
1370
|
+
},
|
|
1371
|
+
lite: true,
|
|
1372
|
+
get container() {
|
|
1373
|
+
return internalProps.container;
|
|
1374
|
+
},
|
|
1375
|
+
ref: (element) => {
|
|
1376
|
+
if (internalProps.ref) setRef(internalProps.ref, element);
|
|
1377
|
+
},
|
|
1378
|
+
get ["class"]() {
|
|
1379
|
+
return classValue();
|
|
1380
|
+
},
|
|
1381
|
+
get style() {
|
|
1382
|
+
return styleValue();
|
|
1383
|
+
}
|
|
1384
|
+
}, others, { get children() {
|
|
1385
|
+
return props.children;
|
|
1386
|
+
} }));
|
|
1387
|
+
}
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/toast/positioner/ToastPositionerContext.ts
|
|
1390
|
+
var MISSING_CONTEXT = Symbol("ToastPositionerContext");
|
|
1391
|
+
var ToastPositionerContext = createContext(MISSING_CONTEXT);
|
|
1392
|
+
function useToastPositionerContext() {
|
|
1393
|
+
const context = useContext(ToastPositionerContext);
|
|
1394
|
+
if (context === MISSING_CONTEXT) throw new Error("Base UI: ToastPositionerContext is missing. ToastPositioner parts must be placed within <Toast.Positioner>.");
|
|
1395
|
+
return context;
|
|
1396
|
+
}
|
|
1397
|
+
//#endregion
|
|
1398
|
+
//#region src/toast/positioner/ToastPositioner.tsx
|
|
1399
|
+
var EMPTY_POSITIONER_PROPS = {};
|
|
1400
|
+
/** Positions the toast against the anchor. */
|
|
1401
|
+
function ToastPositioner(props) {
|
|
1402
|
+
const store = useToastProviderContext();
|
|
1403
|
+
const direction = useDirection();
|
|
1404
|
+
const internalProps = props;
|
|
1405
|
+
const allProps = props;
|
|
1406
|
+
const [element, setElement] = createSignal(null, { ownedWrite: true });
|
|
1407
|
+
const toast = () => internalProps.toast;
|
|
1408
|
+
const positionerProps = () => toast().positionerProps ?? EMPTY_POSITIONER_PROPS;
|
|
1409
|
+
const anchor = createMemo(() => {
|
|
1410
|
+
const value = internalProps.anchor ?? positionerProps().anchor;
|
|
1411
|
+
return isElement(value) ? value : null;
|
|
1412
|
+
});
|
|
1413
|
+
const positioning = createAnchorPositioning({
|
|
1414
|
+
reference: anchor,
|
|
1415
|
+
floating: element,
|
|
1416
|
+
mounted: () => true,
|
|
1417
|
+
direction,
|
|
1418
|
+
positionMethod: () => internalProps.positionMethod ?? positionerProps().positionMethod ?? "absolute",
|
|
1419
|
+
side: () => internalProps.side ?? positionerProps().side ?? "top",
|
|
1420
|
+
sideOffset: () => internalProps.sideOffset ?? positionerProps().sideOffset ?? 0,
|
|
1421
|
+
align: () => internalProps.align ?? positionerProps().align ?? "center",
|
|
1422
|
+
alignOffset: () => internalProps.alignOffset ?? positionerProps().alignOffset ?? 0,
|
|
1423
|
+
collisionBoundary: () => internalProps.collisionBoundary ?? positionerProps().collisionBoundary ?? "clipping-ancestors",
|
|
1424
|
+
collisionPadding: () => internalProps.collisionPadding ?? positionerProps().collisionPadding ?? 5,
|
|
1425
|
+
arrowPadding: () => internalProps.arrowPadding ?? positionerProps().arrowPadding ?? 5,
|
|
1426
|
+
sticky: () => internalProps.sticky ?? positionerProps().sticky ?? false,
|
|
1427
|
+
disableAnchorTracking: () => internalProps.disableAnchorTracking ?? positionerProps().disableAnchorTracking ?? false,
|
|
1428
|
+
collisionAvoidance: () => internalProps.collisionAvoidance ?? positionerProps().collisionAvoidance ?? { fallbackAxisSide: "end" }
|
|
1429
|
+
});
|
|
1430
|
+
const domIndex = createMemo(() => selectors.toastIndex(store.track(), toast().id));
|
|
1431
|
+
const visibleIndex = createMemo(() => selectors.toastVisibleIndex(store.track(), toast().id));
|
|
1432
|
+
const state = createMemo(() => ({
|
|
1433
|
+
side: positioning.renderedSide(),
|
|
1434
|
+
align: positioning.renderedAlign(),
|
|
1435
|
+
anchorHidden: positioning.anchorHidden()
|
|
1436
|
+
}));
|
|
1437
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1438
|
+
const styleValue = createMemo(() => mergeToastStyles({
|
|
1439
|
+
...positioning.styles(),
|
|
1440
|
+
"--toast-index": String(toast().transitionStatus === "ending" ? domIndex() : visibleIndex()),
|
|
1441
|
+
...toast().transitionStatus === "starting" ? { transition: "none" } : void 0
|
|
1442
|
+
}, resolveStyle(props.style, state())));
|
|
1443
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state(), popupStateMapping));
|
|
1444
|
+
const others = omit(allProps, "align", "alignOffset", "anchor", "arrowPadding", "as", "class", "collisionAvoidance", "collisionBoundary", "collisionPadding", "disableAnchorTracking", "positionMethod", "ref", "side", "sideOffset", "sticky", "style", "toast");
|
|
1445
|
+
return ToastPositionerContext({
|
|
1446
|
+
value: positioning,
|
|
1447
|
+
get children() {
|
|
1448
|
+
return Dynamic(mergeProps({
|
|
1449
|
+
get component() {
|
|
1450
|
+
return props.as ?? "div";
|
|
1451
|
+
},
|
|
1452
|
+
ref: [((value) => setElement(value)), internalProps.ref],
|
|
1453
|
+
role: "presentation",
|
|
1454
|
+
get ["class"]() {
|
|
1455
|
+
return classValue();
|
|
1456
|
+
},
|
|
1457
|
+
get style() {
|
|
1458
|
+
return styleValue();
|
|
1459
|
+
}
|
|
1460
|
+
}, stateAttributes, others));
|
|
1461
|
+
}
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
//#endregion
|
|
1465
|
+
//#region src/toast/arrow/ToastArrow.tsx
|
|
1466
|
+
/** Displays an element positioned against the toast anchor. */
|
|
1467
|
+
function ToastArrow(props) {
|
|
1468
|
+
const positioner = useToastPositionerContext();
|
|
1469
|
+
const internalProps = props;
|
|
1470
|
+
const allProps = props;
|
|
1471
|
+
const state = createMemo(() => ({
|
|
1472
|
+
side: positioner.renderedSide(),
|
|
1473
|
+
align: positioner.renderedAlign(),
|
|
1474
|
+
uncentered: positioner.arrowUncentered()
|
|
1475
|
+
}));
|
|
1476
|
+
const classValue = createMemo(() => resolveClass(props.class, state()));
|
|
1477
|
+
const styleValue = createMemo(() => mergeToastStyles(positioner.arrowStyles(), resolveStyle(props.style, state())));
|
|
1478
|
+
const stateAttributes = createMemo(() => getStateAttributesProps(state()));
|
|
1479
|
+
const others = omit(allProps, "as", "class", "ref", "style");
|
|
1480
|
+
let arrowElement = null;
|
|
1481
|
+
onCleanup(() => {
|
|
1482
|
+
if (arrowElement) positioner.setArrowElement(null);
|
|
1483
|
+
});
|
|
1484
|
+
return Dynamic(mergeProps({
|
|
1485
|
+
get component() {
|
|
1486
|
+
return props.as ?? "div";
|
|
1487
|
+
},
|
|
1488
|
+
ref: [((element) => {
|
|
1489
|
+
arrowElement = element;
|
|
1490
|
+
positioner.setArrowElement(element);
|
|
1491
|
+
}), internalProps.ref],
|
|
1492
|
+
"aria-hidden": "true",
|
|
1493
|
+
get ["class"]() {
|
|
1494
|
+
return classValue();
|
|
1495
|
+
},
|
|
1496
|
+
get style() {
|
|
1497
|
+
return styleValue();
|
|
1498
|
+
}
|
|
1499
|
+
}, stateAttributes, others));
|
|
1500
|
+
}
|
|
1501
|
+
//#endregion
|
|
1502
|
+
//#region src/toast/index.parts.ts
|
|
1503
|
+
var index_parts_exports = /* @__PURE__ */ __exportAll({
|
|
1504
|
+
Action: () => ToastAction,
|
|
1505
|
+
Arrow: () => ToastArrow,
|
|
1506
|
+
Close: () => ToastClose,
|
|
1507
|
+
Content: () => ToastContent,
|
|
1508
|
+
Description: () => ToastDescription,
|
|
1509
|
+
Portal: () => ToastPortal,
|
|
1510
|
+
Positioner: () => ToastPositioner,
|
|
1511
|
+
Provider: () => ToastProvider,
|
|
1512
|
+
Root: () => ToastRoot,
|
|
1513
|
+
Title: () => ToastTitle,
|
|
1514
|
+
Viewport: () => ToastViewport
|
|
1515
|
+
});
|
|
1516
|
+
//#endregion
|
|
1517
|
+
//#region src/toast/useToastManager.ts
|
|
1518
|
+
/** Returns an accessor for the toasts along with methods to manage them. */
|
|
1519
|
+
function useToastManager() {
|
|
1520
|
+
const store = useToastProviderContext();
|
|
1521
|
+
return {
|
|
1522
|
+
toasts: store.access(selectors.toasts),
|
|
1523
|
+
add: store.addToast,
|
|
1524
|
+
close: store.closeToast,
|
|
1525
|
+
update: store.updateToast,
|
|
1526
|
+
promise: store.promiseToast
|
|
1527
|
+
};
|
|
1528
|
+
}
|
|
1529
|
+
//#endregion
|
|
1530
|
+
//#region src/toast/createToastManager.ts
|
|
1531
|
+
/** Creates a toast manager usable outside of a component. */
|
|
1532
|
+
function createToastManager() {
|
|
1533
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1534
|
+
function emit(data) {
|
|
1535
|
+
listeners.forEach((listener) => listener(data));
|
|
1536
|
+
}
|
|
1537
|
+
return {
|
|
1538
|
+
" subscribe": function subscribe(listener) {
|
|
1539
|
+
listeners.add(listener);
|
|
1540
|
+
return () => {
|
|
1541
|
+
listeners.delete(listener);
|
|
1542
|
+
};
|
|
1543
|
+
},
|
|
1544
|
+
add(options) {
|
|
1545
|
+
const id = options.id || generateToastId();
|
|
1546
|
+
emit({
|
|
1547
|
+
action: "add",
|
|
1548
|
+
options: {
|
|
1549
|
+
...options,
|
|
1550
|
+
id,
|
|
1551
|
+
transitionStatus: "starting"
|
|
1552
|
+
}
|
|
1553
|
+
});
|
|
1554
|
+
return id;
|
|
1555
|
+
},
|
|
1556
|
+
close(id) {
|
|
1557
|
+
emit({
|
|
1558
|
+
action: "close",
|
|
1559
|
+
options: { id }
|
|
1560
|
+
});
|
|
1561
|
+
},
|
|
1562
|
+
update(id, updates) {
|
|
1563
|
+
emit({
|
|
1564
|
+
action: "update",
|
|
1565
|
+
options: {
|
|
1566
|
+
...updates,
|
|
1567
|
+
id
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
},
|
|
1571
|
+
promise(promiseValue, options) {
|
|
1572
|
+
let handledPromise = promiseValue;
|
|
1573
|
+
emit({
|
|
1574
|
+
action: "promise",
|
|
1575
|
+
options: {
|
|
1576
|
+
...options,
|
|
1577
|
+
promise: promiseValue,
|
|
1578
|
+
setPromise(promise) {
|
|
1579
|
+
handledPromise = promise;
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
return handledPromise;
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
//#endregion
|
|
1588
|
+
export { index_parts_exports as Toast, createToastManager, useToastManager };
|