lynote-ui 0.0.1
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/README.md +24 -0
- package/dist/CompositeItem-DKYDWwo1.js +30 -0
- package/dist/CompositeItem-DKYDWwo1.js.map +1 -0
- package/dist/CompositeItem-DqbuwxxP.mjs +31 -0
- package/dist/CompositeItem-DqbuwxxP.mjs.map +1 -0
- package/dist/CompositeList-CLP_jD9H.js +151 -0
- package/dist/CompositeList-CLP_jD9H.js.map +1 -0
- package/dist/CompositeList-CM71m-RA.mjs +135 -0
- package/dist/CompositeList-CM71m-RA.mjs.map +1 -0
- package/dist/CompositeRoot-Clz7hqk6.mjs +291 -0
- package/dist/CompositeRoot-Clz7hqk6.mjs.map +1 -0
- package/dist/CompositeRoot-DhWDFM9v.js +307 -0
- package/dist/CompositeRoot-DhWDFM9v.js.map +1 -0
- package/dist/DialogRoot-C_3aVl-g.mjs +69 -0
- package/dist/DialogRoot-C_3aVl-g.mjs.map +1 -0
- package/dist/DialogRoot-D_7sM8HI.js +85 -0
- package/dist/DialogRoot-D_7sM8HI.js.map +1 -0
- package/dist/DialogTrigger-BqeNq2F6.mjs +532 -0
- package/dist/DialogTrigger-BqeNq2F6.mjs.map +1 -0
- package/dist/DialogTrigger-CgBPTG9W.js +548 -0
- package/dist/DialogTrigger-CgBPTG9W.js.map +1 -0
- package/dist/DirectionContext-BaCziR5k.mjs +12 -0
- package/dist/DirectionContext-BaCziR5k.mjs.map +1 -0
- package/dist/DirectionContext-BsZvU9q3.js +28 -0
- package/dist/DirectionContext-BsZvU9q3.js.map +1 -0
- package/dist/DirectionProvider-DaKrURtH.js +36 -0
- package/dist/DirectionProvider-DaKrURtH.js.map +1 -0
- package/dist/DirectionProvider-ttyWmQjZ.mjs +20 -0
- package/dist/DirectionProvider-ttyWmQjZ.mjs.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.mjs +13 -0
- package/dist/FieldItemContext-DRVgx-D1.mjs.map +1 -0
- package/dist/FieldItemContext-K2sFjft8.js +29 -0
- package/dist/FieldItemContext-K2sFjft8.js.map +1 -0
- package/dist/FloatingPortalLite-CEKehtqV.js +50 -0
- package/dist/FloatingPortalLite-CEKehtqV.js.map +1 -0
- package/dist/FloatingPortalLite-CsPfJ360.mjs +33 -0
- package/dist/FloatingPortalLite-CsPfJ360.mjs.map +1 -0
- package/dist/FormItem-BmgGAecB.mjs +185 -0
- package/dist/FormItem-BmgGAecB.mjs.map +1 -0
- package/dist/FormItem-xksTqxKD.js +200 -0
- package/dist/FormItem-xksTqxKD.js.map +1 -0
- package/dist/InternalBackdrop-B3WuVcuG.js +1021 -0
- package/dist/InternalBackdrop-B3WuVcuG.js.map +1 -0
- package/dist/InternalBackdrop-C7vtdMWQ.mjs +1005 -0
- package/dist/InternalBackdrop-C7vtdMWQ.mjs.map +1 -0
- package/dist/LabelableContext-DLLBESLn.mjs +213 -0
- package/dist/LabelableContext-DLLBESLn.mjs.map +1 -0
- package/dist/LabelableContext-DYy4DAX3.js +230 -0
- package/dist/LabelableContext-DYy4DAX3.js.map +1 -0
- package/dist/MenuSubmenuTrigger-95oBD6Dx.js +1659 -0
- package/dist/MenuSubmenuTrigger-95oBD6Dx.js.map +1 -0
- package/dist/MenuSubmenuTrigger-Bnw6ycbc.mjs +1643 -0
- package/dist/MenuSubmenuTrigger-Bnw6ycbc.mjs.map +1 -0
- package/dist/Separator-BKPk5Lcn.js +43 -0
- package/dist/Separator-BKPk5Lcn.js.map +1 -0
- package/dist/Separator-Dvb0TS9E.mjs +27 -0
- package/dist/Separator-Dvb0TS9E.mjs.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.mjs +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.mjs.map +1 -0
- package/dist/ToolbarRootContext-C8eU2VAC.js +27 -0
- package/dist/ToolbarRootContext-C8eU2VAC.js.map +1 -0
- package/dist/accordion/index.d.ts +6 -0
- package/dist/accordion/index.js +618 -0
- package/dist/accordion/index.js.map +1 -0
- package/dist/accordion/index.mjs +601 -0
- package/dist/accordion/index.mjs.map +1 -0
- package/dist/alert/index.d.ts +11 -0
- package/dist/alert/index.js +78 -0
- package/dist/alert/index.js.map +1 -0
- package/dist/alert/index.mjs +78 -0
- package/dist/alert/index.mjs.map +1 -0
- package/dist/alert-dialog/index.d.ts +18 -0
- package/dist/alert-dialog/index.js +240 -0
- package/dist/alert-dialog/index.js.map +1 -0
- package/dist/alert-dialog/index.mjs +223 -0
- package/dist/alert-dialog/index.mjs.map +1 -0
- package/dist/aspect-ratio/index.d.ts +4 -0
- package/dist/aspect-ratio/index.js +23 -0
- package/dist/aspect-ratio/index.js.map +1 -0
- package/dist/aspect-ratio/index.mjs +23 -0
- package/dist/aspect-ratio/index.mjs.map +1 -0
- package/dist/avatar/index.d.ts +11 -0
- package/dist/avatar/index.js +287 -0
- package/dist/avatar/index.js.map +1 -0
- package/dist/avatar/index.mjs +270 -0
- package/dist/avatar/index.mjs.map +1 -0
- package/dist/badge/index.d.ts +9 -0
- package/dist/badge/index.js +48 -0
- package/dist/badge/index.js.map +1 -0
- package/dist/badge/index.mjs +48 -0
- package/dist/badge/index.mjs.map +1 -0
- package/dist/breadcrumb/index.d.ts +10 -0
- package/dist/breadcrumb/index.js +123 -0
- package/dist/breadcrumb/index.js.map +1 -0
- package/dist/breadcrumb/index.mjs +123 -0
- package/dist/breadcrumb/index.mjs.map +1 -0
- package/dist/button/index.d.ts +9 -0
- package/dist/button/index.js +99 -0
- package/dist/button/index.js.map +1 -0
- package/dist/button/index.mjs +82 -0
- package/dist/button/index.mjs.map +1 -0
- package/dist/button-group/index.d.ts +12 -0
- package/dist/button-group/index.js +83 -0
- package/dist/button-group/index.js.map +1 -0
- package/dist/button-group/index.mjs +83 -0
- package/dist/button-group/index.mjs.map +1 -0
- package/dist/calendar/index.d.ts +10 -0
- package/dist/calendar/index.js +205 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/index.mjs +188 -0
- package/dist/calendar/index.mjs.map +1 -0
- package/dist/card/index.d.ts +11 -0
- package/dist/card/index.js +102 -0
- package/dist/card/index.js.map +1 -0
- package/dist/card/index.mjs +102 -0
- package/dist/card/index.mjs.map +1 -0
- package/dist/carousel/index.d.ts +28 -0
- package/dist/carousel/index.js +217 -0
- package/dist/carousel/index.js.map +1 -0
- package/dist/carousel/index.mjs +200 -0
- package/dist/carousel/index.mjs.map +1 -0
- package/dist/chart/index.d.ts +44 -0
- package/dist/chart/index.js +272 -0
- package/dist/chart/index.js.map +1 -0
- package/dist/chart/index.mjs +254 -0
- package/dist/chart/index.mjs.map +1 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/index.js +425 -0
- package/dist/checkbox/index.js.map +1 -0
- package/dist/checkbox/index.mjs +408 -0
- package/dist/checkbox/index.mjs.map +1 -0
- package/dist/clamp-CRAygR8_.mjs +17 -0
- package/dist/clamp-CRAygR8_.mjs.map +1 -0
- package/dist/clamp-Cl34OJjs.js +33 -0
- package/dist/clamp-Cl34OJjs.js.map +1 -0
- package/dist/collapsible/index.d.ts +5 -0
- package/dist/collapsible/index.js +244 -0
- package/dist/collapsible/index.js.map +1 -0
- package/dist/collapsible/index.mjs +227 -0
- package/dist/collapsible/index.mjs.map +1 -0
- package/dist/combobox/index.d.ts +24 -0
- package/dist/combobox/index.js +294 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/combobox/index.mjs +277 -0
- package/dist/combobox/index.mjs.map +1 -0
- package/dist/command/index.d.ts +19 -0
- package/dist/command/index.js +174 -0
- package/dist/command/index.js.map +1 -0
- package/dist/command/index.mjs +174 -0
- package/dist/command/index.mjs.map +1 -0
- package/dist/composite-54CI9F0V.mjs +346 -0
- package/dist/composite-54CI9F0V.mjs.map +1 -0
- package/dist/composite-B6lEHrCV.mjs +119 -0
- package/dist/composite-B6lEHrCV.mjs.map +1 -0
- package/dist/composite-BT0EMBUB.js +118 -0
- package/dist/composite-BT0EMBUB.js.map +1 -0
- package/dist/composite-DhXBXmhV.js +345 -0
- package/dist/composite-DhXBXmhV.js.map +1 -0
- package/dist/constants-DAVIOz2s.js +18 -0
- package/dist/constants-DAVIOz2s.js.map +1 -0
- package/dist/constants-Dfh7hQez.mjs +19 -0
- package/dist/constants-Dfh7hQez.mjs.map +1 -0
- package/dist/context-menu/index.d.ts +29 -0
- package/dist/context-menu/index.js +458 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/context-menu/index.mjs +441 -0
- package/dist/context-menu/index.mjs.map +1 -0
- package/dist/createBaseUIEventDetails-CRQSf9K3.mjs +79 -0
- package/dist/createBaseUIEventDetails-CRQSf9K3.mjs.map +1 -0
- package/dist/createBaseUIEventDetails-D39y2D9R.js +78 -0
- package/dist/createBaseUIEventDetails-D39y2D9R.js.map +1 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/index.js +47 -0
- package/dist/date-picker/index.js.map +1 -0
- package/dist/date-picker/index.mjs +30 -0
- package/dist/date-picker/index.mjs.map +1 -0
- package/dist/detectBrowser-CT93wuqL.mjs +64 -0
- package/dist/detectBrowser-CT93wuqL.mjs.map +1 -0
- package/dist/detectBrowser-j_AUpd7-.js +63 -0
- package/dist/detectBrowser-j_AUpd7-.js.map +1 -0
- package/dist/dialog/index.d.ts +17 -0
- package/dist/dialog/index.js +153 -0
- package/dist/dialog/index.js.map +1 -0
- package/dist/dialog/index.mjs +153 -0
- package/dist/dialog/index.mjs.map +1 -0
- package/dist/direction/index.d.ts +1 -0
- package/dist/direction/index.js +7 -0
- package/dist/direction/index.js.map +1 -0
- package/dist/direction/index.mjs +7 -0
- package/dist/direction/index.mjs.map +1 -0
- package/dist/drawer/index.d.ts +13 -0
- package/dist/drawer/index.js +128 -0
- package/dist/drawer/index.js.map +1 -0
- package/dist/drawer/index.mjs +128 -0
- package/dist/drawer/index.mjs.map +1 -0
- package/dist/dropdown-menu/index.d.ts +29 -0
- package/dist/dropdown-menu/index.js +573 -0
- package/dist/dropdown-menu/index.js.map +1 -0
- package/dist/dropdown-menu/index.mjs +555 -0
- package/dist/dropdown-menu/index.mjs.map +1 -0
- package/dist/element-BtC-M4rb.mjs +103 -0
- package/dist/element-BtC-M4rb.mjs.map +1 -0
- package/dist/element-DAAyJrnp.js +102 -0
- package/dist/element-DAAyJrnp.js.map +1 -0
- package/dist/empty/index.d.ts +12 -0
- package/dist/empty/index.js +103 -0
- package/dist/empty/index.js.map +1 -0
- package/dist/empty/index.mjs +103 -0
- package/dist/empty/index.mjs.map +1 -0
- package/dist/event-BHxKjfyi.js +43 -0
- package/dist/event-BHxKjfyi.js.map +1 -0
- package/dist/event-CcyVszlp.mjs +44 -0
- package/dist/event-CcyVszlp.mjs.map +1 -0
- package/dist/field/index.d.ts +25 -0
- package/dist/field/index.js +219 -0
- package/dist/field/index.js.map +1 -0
- package/dist/field/index.mjs +219 -0
- package/dist/field/index.mjs.map +1 -0
- package/dist/floating-ui.utils-CMX6M1P8.js +149 -0
- package/dist/floating-ui.utils-CMX6M1P8.js.map +1 -0
- package/dist/floating-ui.utils-DoPG3M8C.mjs +150 -0
- package/dist/floating-ui.utils-DoPG3M8C.mjs.map +1 -0
- package/dist/floating-ui.utils.dom-BAD07kLX.mjs +176 -0
- package/dist/floating-ui.utils.dom-BAD07kLX.mjs.map +1 -0
- package/dist/floating-ui.utils.dom-djqmdyxg.js +175 -0
- package/dist/floating-ui.utils.dom-djqmdyxg.js.map +1 -0
- package/dist/form/components/Form.d.ts +4 -0
- package/dist/form/components/FormControl.d.ts +3 -0
- package/dist/form/components/FormDescription.d.ts +3 -0
- package/dist/form/components/FormField.d.ts +3 -0
- package/dist/form/components/FormItem.d.ts +7 -0
- package/dist/form/components/FormLabel.d.ts +3 -0
- package/dist/form/components/FormMessage.d.ts +4 -0
- package/dist/form/components/variants.d.ts +6 -0
- package/dist/form/context/index.d.ts +4 -0
- package/dist/form/hooks/useFormField.d.ts +14 -0
- package/dist/form/index.d.ts +11 -0
- package/dist/form/index.js +19 -0
- package/dist/form/index.js.map +1 -0
- package/dist/form/index.mjs +13 -0
- package/dist/form/index.mjs.map +1 -0
- package/dist/form/type.d.ts +48 -0
- package/dist/getEmptyRootContext-CBrvBF2x.mjs +17 -0
- package/dist/getEmptyRootContext-CBrvBF2x.mjs.map +1 -0
- package/dist/getEmptyRootContext-DrOPobKp.js +16 -0
- package/dist/getEmptyRootContext-DrOPobKp.js.map +1 -0
- package/dist/getPseudoElementBounds-CN2-zcsN.js +29 -0
- package/dist/getPseudoElementBounds-CN2-zcsN.js.map +1 -0
- package/dist/getPseudoElementBounds-i4YX-qQ2.mjs +30 -0
- package/dist/getPseudoElementBounds-i4YX-qQ2.mjs.map +1 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hover-card/index.d.ts +5 -0
- package/dist/hover-card/index.js +501 -0
- package/dist/hover-card/index.js.map +1 -0
- package/dist/hover-card/index.mjs +483 -0
- package/dist/hover-card/index.mjs.map +1 -0
- package/dist/index-B3i3Mf61.mjs +147 -0
- package/dist/index-B3i3Mf61.mjs.map +1 -0
- package/dist/index-zBgD3uv6.js +163 -0
- package/dist/index-zBgD3uv6.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.js +393 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +384 -0
- package/dist/index.mjs.map +1 -0
- package/dist/inertValue-gSeyz2Lm.js +10 -0
- package/dist/inertValue-gSeyz2Lm.js.map +1 -0
- package/dist/inertValue-t5QI1CFn.mjs +11 -0
- package/dist/inertValue-t5QI1CFn.mjs.map +1 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.js +167 -0
- package/dist/input/index.js.map +1 -0
- package/dist/input/index.mjs +150 -0
- package/dist/input/index.mjs.map +1 -0
- package/dist/input-group/index.d.ts +19 -0
- package/dist/input-group/index.js +146 -0
- package/dist/input-group/index.js.map +1 -0
- package/dist/input-group/index.mjs +146 -0
- package/dist/input-group/index.mjs.map +1 -0
- package/dist/input-otp/index.d.ts +11 -0
- package/dist/input-otp/index.js +84 -0
- package/dist/input-otp/index.js.map +1 -0
- package/dist/input-otp/index.mjs +67 -0
- package/dist/input-otp/index.mjs.map +1 -0
- package/dist/isElementDisabled-2KG8-O4B.mjs +7 -0
- package/dist/isElementDisabled-2KG8-O4B.mjs.map +1 -0
- package/dist/isElementDisabled-p2fc38Eq.js +6 -0
- package/dist/isElementDisabled-p2fc38Eq.js.map +1 -0
- package/dist/item/index.d.ts +23 -0
- package/dist/item/index.js +196 -0
- package/dist/item/index.js.map +1 -0
- package/dist/item/index.mjs +196 -0
- package/dist/item/index.mjs.map +1 -0
- package/dist/jsx-runtime-CPzt8Nmm.js +321 -0
- package/dist/jsx-runtime-CPzt8Nmm.js.map +1 -0
- package/dist/jsx-runtime-Dog7MAYX.mjs +322 -0
- package/dist/jsx-runtime-Dog7MAYX.mjs.map +1 -0
- package/dist/kbd/index.d.ts +3 -0
- package/dist/kbd/index.js +30 -0
- package/dist/kbd/index.js.map +1 -0
- package/dist/kbd/index.mjs +30 -0
- package/dist/kbd/index.mjs.map +1 -0
- package/dist/label/index.d.ts +3 -0
- package/dist/label/index.js +19 -0
- package/dist/label/index.js.map +1 -0
- package/dist/label/index.mjs +19 -0
- package/dist/label/index.mjs.map +1 -0
- package/dist/lib/cva.d.ts +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/menubar/index.d.ts +29 -0
- package/dist/menubar/index.js +365 -0
- package/dist/menubar/index.js.map +1 -0
- package/dist/menubar/index.mjs +348 -0
- package/dist/menubar/index.mjs.map +1 -0
- package/dist/native-select/index.d.ts +8 -0
- package/dist/native-select/index.js +54 -0
- package/dist/native-select/index.js.map +1 -0
- package/dist/native-select/index.mjs +54 -0
- package/dist/native-select/index.mjs.map +1 -0
- package/dist/navigation-menu/index.d.ts +12 -0
- package/dist/navigation-menu/index.js +1702 -0
- package/dist/navigation-menu/index.js.map +1 -0
- package/dist/navigation-menu/index.mjs +1684 -0
- package/dist/navigation-menu/index.mjs.map +1 -0
- package/dist/owner-Cf_X0F_A.mjs +7 -0
- package/dist/owner-Cf_X0F_A.mjs.map +1 -0
- package/dist/owner-DohlhdQa.js +6 -0
- package/dist/owner-DohlhdQa.js.map +1 -0
- package/dist/pagination/index.d.ts +17 -0
- package/dist/pagination/index.js +129 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/pagination/index.mjs +129 -0
- package/dist/pagination/index.mjs.map +1 -0
- package/dist/popover/index.d.ts +12 -0
- package/dist/popover/index.js +83 -0
- package/dist/popover/index.js.map +1 -0
- package/dist/popover/index.mjs +83 -0
- package/dist/popover/index.mjs.map +1 -0
- package/dist/popupStateMapping-DKN5mXrh.js +2694 -0
- package/dist/popupStateMapping-DKN5mXrh.js.map +1 -0
- package/dist/popupStateMapping-Dvf6vjid.mjs +2678 -0
- package/dist/popupStateMapping-Dvf6vjid.mjs.map +1 -0
- package/dist/progress/index.d.ts +7 -0
- package/dist/progress/index.js +315 -0
- package/dist/progress/index.js.map +1 -0
- package/dist/progress/index.mjs +298 -0
- package/dist/progress/index.mjs.map +1 -0
- package/dist/radio-group/index.d.ts +5 -0
- package/dist/radio-group/index.js +549 -0
- package/dist/radio-group/index.js.map +1 -0
- package/dist/radio-group/index.mjs +532 -0
- package/dist/radio-group/index.mjs.map +1 -0
- package/dist/resizable/index.d.ts +7 -0
- package/dist/resizable/index.js +63 -0
- package/dist/resizable/index.js.map +1 -0
- package/dist/resizable/index.mjs +46 -0
- package/dist/resizable/index.mjs.map +1 -0
- package/dist/resolveAriaLabelledBy-BOrKNO_y.js +10 -0
- package/dist/resolveAriaLabelledBy-BOrKNO_y.js.map +1 -0
- package/dist/resolveAriaLabelledBy-JxsTST5s.mjs +11 -0
- package/dist/resolveAriaLabelledBy-JxsTST5s.mjs.map +1 -0
- package/dist/safePolygon-ClN7sX4N.mjs +710 -0
- package/dist/safePolygon-ClN7sX4N.mjs.map +1 -0
- package/dist/safePolygon-DzT-LXP_.js +727 -0
- package/dist/safePolygon-DzT-LXP_.js.map +1 -0
- package/dist/safeReact-V1Amqcv9.mjs +8 -0
- package/dist/safeReact-V1Amqcv9.mjs.map +1 -0
- package/dist/safeReact-j2phwwP4.js +24 -0
- package/dist/safeReact-j2phwwP4.js.map +1 -0
- package/dist/scroll-area/index.d.ts +4 -0
- package/dist/scroll-area/index.js +1017 -0
- package/dist/scroll-area/index.js.map +1 -0
- package/dist/scroll-area/index.mjs +1000 -0
- package/dist/scroll-area/index.mjs.map +1 -0
- package/dist/select/index.d.ts +15 -0
- package/dist/select/index.js +2311 -0
- package/dist/select/index.js.map +1 -0
- package/dist/select/index.mjs +2293 -0
- package/dist/select/index.mjs.map +1 -0
- package/dist/separator/index.d.ts +3 -0
- package/dist/separator/index.js +25 -0
- package/dist/separator/index.js.map +1 -0
- package/dist/separator/index.mjs +25 -0
- package/dist/separator/index.mjs.map +1 -0
- package/dist/serializeValue-BLvnTy3o.mjs +17 -0
- package/dist/serializeValue-BLvnTy3o.mjs.map +1 -0
- package/dist/serializeValue-rMlAxdiX.js +16 -0
- package/dist/serializeValue-rMlAxdiX.js.map +1 -0
- package/dist/sheet/index.d.ts +14 -0
- package/dist/sheet/index.js +135 -0
- package/dist/sheet/index.js.map +1 -0
- package/dist/sheet/index.mjs +135 -0
- package/dist/sheet/index.mjs.map +1 -0
- package/dist/sidebar/index.d.ts +64 -0
- package/dist/sidebar/index.js +671 -0
- package/dist/sidebar/index.js.map +1 -0
- package/dist/sidebar/index.mjs +654 -0
- package/dist/sidebar/index.mjs.map +1 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +16 -0
- package/dist/skeleton/index.js.map +1 -0
- package/dist/skeleton/index.mjs +16 -0
- package/dist/skeleton/index.mjs.map +1 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/index.js +1361 -0
- package/dist/slider/index.js.map +1 -0
- package/dist/slider/index.mjs +1344 -0
- package/dist/slider/index.mjs.map +1 -0
- package/dist/sonner/index.d.ts +3 -0
- package/dist/sonner/index.js +10 -0
- package/dist/sonner/index.js.map +1 -0
- package/dist/sonner/index.mjs +7 -0
- package/dist/sonner/index.mjs.map +1 -0
- package/dist/sonner/sonner.d.ts +3 -0
- package/dist/sonner-Ctpa1LLR.js +36 -0
- package/dist/sonner-Ctpa1LLR.js.map +1 -0
- package/dist/sonner-D0rALbMy.mjs +37 -0
- package/dist/sonner-D0rALbMy.mjs.map +1 -0
- package/dist/spinner/index.d.ts +2 -0
- package/dist/spinner/index.js +10 -0
- package/dist/spinner/index.js.map +1 -0
- package/dist/spinner/index.mjs +10 -0
- package/dist/spinner/index.mjs.map +1 -0
- package/dist/style.css +6284 -0
- package/dist/styles-BY9BExrL.js +17 -0
- package/dist/styles-BY9BExrL.js.map +1 -0
- package/dist/styles-DGdX19B5.mjs +18 -0
- package/dist/styles-DGdX19B5.mjs.map +1 -0
- package/dist/switch/index.d.ts +5 -0
- package/dist/switch/index.js +306 -0
- package/dist/switch/index.js.map +1 -0
- package/dist/switch/index.mjs +289 -0
- package/dist/switch/index.mjs.map +1 -0
- package/dist/table/index.d.ts +10 -0
- package/dist/table/index.js +115 -0
- package/dist/table/index.js.map +1 -0
- package/dist/table/index.mjs +115 -0
- package/dist/table/index.mjs.map +1 -0
- package/dist/tabs/index.d.ts +11 -0
- package/dist/tabs/index.js +718 -0
- package/dist/tabs/index.js.map +1 -0
- package/dist/tabs/index.mjs +701 -0
- package/dist/tabs/index.mjs.map +1 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/index.js +19 -0
- package/dist/textarea/index.js.map +1 -0
- package/dist/textarea/index.mjs +19 -0
- package/dist/textarea/index.mjs.map +1 -0
- package/dist/toggle/index.d.ts +9 -0
- package/dist/toggle/index.js +9 -0
- package/dist/toggle/index.js.map +1 -0
- package/dist/toggle/index.mjs +9 -0
- package/dist/toggle/index.mjs.map +1 -0
- package/dist/toggle-group/index.d.ts +10 -0
- package/dist/toggle-group/index.js +199 -0
- package/dist/toggle-group/index.js.map +1 -0
- package/dist/toggle-group/index.mjs +182 -0
- package/dist/toggle-group/index.mjs.map +1 -0
- package/dist/tooltip/index.d.ts +6 -0
- package/dist/tooltip/index.js +940 -0
- package/dist/tooltip/index.js.map +1 -0
- package/dist/tooltip/index.mjs +922 -0
- package/dist/tooltip/index.mjs.map +1 -0
- package/dist/useAnchorPositioning-DEkPt210.mjs +2213 -0
- package/dist/useAnchorPositioning-DEkPt210.mjs.map +1 -0
- package/dist/useAnchorPositioning-jXRh4g8d.js +2229 -0
- package/dist/useAnchorPositioning-jXRh4g8d.js.map +1 -0
- package/dist/useAnimationFrame-Bgt4Euiv.js +100 -0
- package/dist/useAnimationFrame-Bgt4Euiv.js.map +1 -0
- package/dist/useAnimationFrame-CJsjFUv3.mjs +101 -0
- package/dist/useAnimationFrame-CJsjFUv3.mjs.map +1 -0
- package/dist/useAriaLabelledBy-AZCBHH3a.js +63 -0
- package/dist/useAriaLabelledBy-AZCBHH3a.js.map +1 -0
- package/dist/useAriaLabelledBy-Chelmb26.mjs +47 -0
- package/dist/useAriaLabelledBy-Chelmb26.mjs.map +1 -0
- package/dist/useBaseUiId-Dd6rCWZj.mjs +30 -0
- package/dist/useBaseUiId-Dd6rCWZj.mjs.map +1 -0
- package/dist/useBaseUiId-ZDgjliOe.js +46 -0
- package/dist/useBaseUiId-ZDgjliOe.js.map +1 -0
- package/dist/useButton-CcvYPR5H.js +246 -0
- package/dist/useButton-CcvYPR5H.js.map +1 -0
- package/dist/useButton-DbBdV6Ig.mjs +230 -0
- package/dist/useButton-DbBdV6Ig.mjs.map +1 -0
- package/dist/useClick-1DLd7znk.mjs +97 -0
- package/dist/useClick-1DLd7znk.mjs.map +1 -0
- package/dist/useClick-wsFFnZw6.js +113 -0
- package/dist/useClick-wsFFnZw6.js.map +1 -0
- package/dist/useCollapsiblePanel-DIdAXCDX.mjs +439 -0
- package/dist/useCollapsiblePanel-DIdAXCDX.mjs.map +1 -0
- package/dist/useCollapsiblePanel-OP0gCAiW.js +455 -0
- package/dist/useCollapsiblePanel-OP0gCAiW.js.map +1 -0
- package/dist/useCompositeItem-CP0qNLGv.mjs +43 -0
- package/dist/useCompositeItem-CP0qNLGv.mjs.map +1 -0
- package/dist/useCompositeItem-F8jky_8M.js +59 -0
- package/dist/useCompositeItem-F8jky_8M.js.map +1 -0
- package/dist/useCompositeListItem-CPSGNf6p.js +116 -0
- package/dist/useCompositeListItem-CPSGNf6p.js.map +1 -0
- package/dist/useCompositeListItem-CvqgwmCe.mjs +100 -0
- package/dist/useCompositeListItem-CvqgwmCe.mjs.map +1 -0
- package/dist/useControlled-DITi2kHX.mjs +38 -0
- package/dist/useControlled-DITi2kHX.mjs.map +1 -0
- package/dist/useControlled-DTjTIpeU.js +54 -0
- package/dist/useControlled-DTjTIpeU.js.map +1 -0
- package/dist/useFocus-BonLJ9UY.js +162 -0
- package/dist/useFocus-BonLJ9UY.js.map +1 -0
- package/dist/useFocus-D2m1G1R7.mjs +146 -0
- package/dist/useFocus-D2m1G1R7.mjs.map +1 -0
- package/dist/useIsoLayoutEffect-CAx-dEZM.mjs +8 -0
- package/dist/useIsoLayoutEffect-CAx-dEZM.mjs.map +1 -0
- package/dist/useIsoLayoutEffect-CYDr9Bko.js +24 -0
- package/dist/useIsoLayoutEffect-CYDr9Bko.js.map +1 -0
- package/dist/useLabelableId-BMQMbGuJ.mjs +67 -0
- package/dist/useLabelableId-BMQMbGuJ.mjs.map +1 -0
- package/dist/useLabelableId-C-dL4hfJ.js +83 -0
- package/dist/useLabelableId-C-dL4hfJ.js.map +1 -0
- package/dist/useOnFirstRender-BYSeF6Y1.js +28 -0
- package/dist/useOnFirstRender-BYSeF6Y1.js.map +1 -0
- package/dist/useOnFirstRender-_PvKQsmi.mjs +12 -0
- package/dist/useOnFirstRender-_PvKQsmi.mjs.map +1 -0
- package/dist/useOnMount-CzmIG4WC.js +25 -0
- package/dist/useOnMount-CzmIG4WC.js.map +1 -0
- package/dist/useOnMount-DN6FnE-7.mjs +9 -0
- package/dist/useOnMount-DN6FnE-7.mjs.map +1 -0
- package/dist/useOpenChangeComplete-B0xZNwMu.js +194 -0
- package/dist/useOpenChangeComplete-B0xZNwMu.js.map +1 -0
- package/dist/useOpenChangeComplete-DbPLu-k9.mjs +177 -0
- package/dist/useOpenChangeComplete-DbPLu-k9.mjs.map +1 -0
- package/dist/useRender-DKDvf6kd.mjs +8 -0
- package/dist/useRender-DKDvf6kd.mjs.map +1 -0
- package/dist/useRender-PucZeh4Y.js +7 -0
- package/dist/useRender-PucZeh4Y.js.map +1 -0
- package/dist/useRenderElement-CtyURhhF.js +427 -0
- package/dist/useRenderElement-CtyURhhF.js.map +1 -0
- package/dist/useRenderElement-DtkRtCHE.mjs +412 -0
- package/dist/useRenderElement-DtkRtCHE.mjs.map +1 -0
- package/dist/useRole-CuVJ_Qa_.js +125 -0
- package/dist/useRole-CuVJ_Qa_.js.map +1 -0
- package/dist/useRole-DzRWctvj.mjs +109 -0
- package/dist/useRole-DzRWctvj.mjs.map +1 -0
- package/dist/useStableCallback-8_xI9oDo.mjs +40 -0
- package/dist/useStableCallback-8_xI9oDo.mjs.map +1 -0
- package/dist/useStableCallback-CfE_knIO.js +56 -0
- package/dist/useStableCallback-CfE_knIO.js.map +1 -0
- package/dist/useSyncedFloatingRootContext-BhwJbN5C.js +237 -0
- package/dist/useSyncedFloatingRootContext-BhwJbN5C.js.map +1 -0
- package/dist/useSyncedFloatingRootContext-BiC-l-Yp.mjs +221 -0
- package/dist/useSyncedFloatingRootContext-BiC-l-Yp.mjs.map +1 -0
- package/dist/useTimeout-CSlJ10_7.js +45 -0
- package/dist/useTimeout-CSlJ10_7.js.map +1 -0
- package/dist/useTimeout-DP0d-UkF.mjs +46 -0
- package/dist/useTimeout-DP0d-UkF.mjs.map +1 -0
- package/dist/useTypeahead-De1veul8.mjs +697 -0
- package/dist/useTypeahead-De1veul8.mjs.map +1 -0
- package/dist/useTypeahead-JL7mFfnS.js +713 -0
- package/dist/useTypeahead-JL7mFfnS.js.map +1 -0
- package/dist/useValueAsRef-BPI-p5A3.mjs +22 -0
- package/dist/useValueAsRef-BPI-p5A3.mjs.map +1 -0
- package/dist/useValueAsRef-uSzmRbW_.js +21 -0
- package/dist/useValueAsRef-uSzmRbW_.js.map +1 -0
- package/dist/useValueChanged-CEUlHhs5.mjs +20 -0
- package/dist/useValueChanged-CEUlHhs5.mjs.map +1 -0
- package/dist/useValueChanged-CvJls2Pv.js +36 -0
- package/dist/useValueChanged-CvJls2Pv.js.map +1 -0
- package/dist/utils-H80jjgLf.mjs +9 -0
- package/dist/utils-H80jjgLf.mjs.map +1 -0
- package/dist/utils-ij3i9zTT.js +8 -0
- package/dist/utils-ij3i9zTT.js.map +1 -0
- package/dist/valueToPercent-CfYnVMaY.js +39 -0
- package/dist/valueToPercent-CfYnVMaY.js.map +1 -0
- package/dist/valueToPercent-DxMnLf8t.mjs +40 -0
- package/dist/valueToPercent-DxMnLf8t.mjs.map +1 -0
- package/dist/visuallyHidden-D_sL9-70.mjs +25 -0
- package/dist/visuallyHidden-D_sL9-70.mjs.map +1 -0
- package/dist/visuallyHidden-Dkg-c0_K.js +24 -0
- package/dist/visuallyHidden-Dkg-c0_K.js.map +1 -0
- package/package.json +382 -0
|
@@ -0,0 +1,1361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../jsx-runtime-CPzt8Nmm.js");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const owner = require("../owner-DohlhdQa.js");
|
|
6
|
+
const useControlled = require("../useControlled-DTjTIpeU.js");
|
|
7
|
+
const useStableCallback = require("../useStableCallback-CfE_knIO.js");
|
|
8
|
+
const useValueAsRef = require("../useValueAsRef-uSzmRbW_.js");
|
|
9
|
+
const useIsoLayoutEffect = require("../useIsoLayoutEffect-CYDr9Bko.js");
|
|
10
|
+
const useRenderElement = require("../useRenderElement-CtyURhhF.js");
|
|
11
|
+
const createBaseUIEventDetails = require("../createBaseUIEventDetails-D39y2D9R.js");
|
|
12
|
+
const useValueChanged = require("../useValueChanged-CvJls2Pv.js");
|
|
13
|
+
const useBaseUiId = require("../useBaseUiId-ZDgjliOe.js");
|
|
14
|
+
const clamp = require("../clamp-Cl34OJjs.js");
|
|
15
|
+
const CompositeList = require("../CompositeList-CLP_jD9H.js");
|
|
16
|
+
const LabelableContext = require("../LabelableContext-DYy4DAX3.js");
|
|
17
|
+
const resolveAriaLabelledBy = require("../resolveAriaLabelledBy-BOrKNO_y.js");
|
|
18
|
+
const element = require("../element-DAAyJrnp.js");
|
|
19
|
+
const floatingUi_utils_dom = require("../floating-ui.utils.dom-djqmdyxg.js");
|
|
20
|
+
const useAnimationFrame = require("../useAnimationFrame-Bgt4Euiv.js");
|
|
21
|
+
const DirectionContext = require("../DirectionContext-BsZvU9q3.js");
|
|
22
|
+
const useOnMount = require("../useOnMount-CzmIG4WC.js");
|
|
23
|
+
const valueToPercent = require("../valueToPercent-CfYnVMaY.js");
|
|
24
|
+
const visuallyHidden = require("../visuallyHidden-Dkg-c0_K.js");
|
|
25
|
+
const composite = require("../composite-BT0EMBUB.js");
|
|
26
|
+
const useCompositeListItem = require("../useCompositeListItem-CPSGNf6p.js");
|
|
27
|
+
const useLabelableId = require("../useLabelableId-C-dL4hfJ.js");
|
|
28
|
+
const utils = require("../utils-ij3i9zTT.js");
|
|
29
|
+
function _interopNamespaceDefault(e) {
|
|
30
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
31
|
+
if (e) {
|
|
32
|
+
for (const k in e) {
|
|
33
|
+
if (k !== "default") {
|
|
34
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
35
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: () => e[k]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
n.default = e;
|
|
43
|
+
return Object.freeze(n);
|
|
44
|
+
}
|
|
45
|
+
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
46
|
+
function areArraysEqual(array1, array2, itemComparer = (a, b) => a === b) {
|
|
47
|
+
return array1.length === array2.length && array1.every((value, index) => itemComparer(value, array2[index]));
|
|
48
|
+
}
|
|
49
|
+
function asc(a, b) {
|
|
50
|
+
return a - b;
|
|
51
|
+
}
|
|
52
|
+
function replaceArrayItemAtIndex(array, index, newValue) {
|
|
53
|
+
const output = array.slice();
|
|
54
|
+
output[index] = newValue;
|
|
55
|
+
return output.sort(asc);
|
|
56
|
+
}
|
|
57
|
+
function getSliderValue(valueInput, index, min, max, range, values) {
|
|
58
|
+
let newValue = valueInput;
|
|
59
|
+
newValue = clamp.clamp(newValue, min, max);
|
|
60
|
+
if (range) {
|
|
61
|
+
newValue = replaceArrayItemAtIndex(
|
|
62
|
+
values,
|
|
63
|
+
index,
|
|
64
|
+
// Bound the new value to the thumb's neighbours.
|
|
65
|
+
clamp.clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return newValue;
|
|
69
|
+
}
|
|
70
|
+
function validateMinimumDistance(values, step, minStepsBetweenValues) {
|
|
71
|
+
if (!Array.isArray(values)) {
|
|
72
|
+
return true;
|
|
73
|
+
}
|
|
74
|
+
const distances = values.reduce((acc, val, index, vals) => {
|
|
75
|
+
if (index === vals.length - 1) {
|
|
76
|
+
return acc;
|
|
77
|
+
}
|
|
78
|
+
acc.push(Math.abs(val - vals[index + 1]));
|
|
79
|
+
return acc;
|
|
80
|
+
}, []);
|
|
81
|
+
return Math.min(...distances) >= step * minStepsBetweenValues;
|
|
82
|
+
}
|
|
83
|
+
const sliderStateAttributesMapping = {
|
|
84
|
+
activeThumbIndex: () => null,
|
|
85
|
+
max: () => null,
|
|
86
|
+
min: () => null,
|
|
87
|
+
minStepsBetweenValues: () => null,
|
|
88
|
+
step: () => null,
|
|
89
|
+
values: () => null,
|
|
90
|
+
...LabelableContext.fieldValidityMapping
|
|
91
|
+
};
|
|
92
|
+
const SliderRootContext = /* @__PURE__ */ React__namespace.createContext(void 0);
|
|
93
|
+
if (process.env.NODE_ENV !== "production") SliderRootContext.displayName = "SliderRootContext";
|
|
94
|
+
function useSliderRootContext() {
|
|
95
|
+
const context = React__namespace.useContext(SliderRootContext);
|
|
96
|
+
if (context === void 0) {
|
|
97
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: SliderRootContext is missing. Slider parts must be placed within <Slider.Root>." : useRenderElement.formatErrorMessage(62));
|
|
98
|
+
}
|
|
99
|
+
return context;
|
|
100
|
+
}
|
|
101
|
+
function getSliderChangeEventReason(event) {
|
|
102
|
+
return "key" in event ? createBaseUIEventDetails.keyboard : createBaseUIEventDetails.inputChange;
|
|
103
|
+
}
|
|
104
|
+
function areValuesEqual(newValue, oldValue) {
|
|
105
|
+
if (typeof newValue === "number" && typeof oldValue === "number") {
|
|
106
|
+
return newValue === oldValue;
|
|
107
|
+
}
|
|
108
|
+
if (Array.isArray(newValue) && Array.isArray(oldValue)) {
|
|
109
|
+
return areArraysEqual(newValue, oldValue);
|
|
110
|
+
}
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
const SliderRoot = /* @__PURE__ */ React__namespace.forwardRef(function SliderRoot2(componentProps, forwardedRef) {
|
|
114
|
+
const {
|
|
115
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
116
|
+
className,
|
|
117
|
+
defaultValue,
|
|
118
|
+
disabled: disabledProp = false,
|
|
119
|
+
id: idProp,
|
|
120
|
+
format,
|
|
121
|
+
largeStep = 10,
|
|
122
|
+
locale,
|
|
123
|
+
render,
|
|
124
|
+
max = 100,
|
|
125
|
+
min = 0,
|
|
126
|
+
minStepsBetweenValues = 0,
|
|
127
|
+
name: nameProp,
|
|
128
|
+
onValueChange: onValueChangeProp,
|
|
129
|
+
onValueCommitted: onValueCommittedProp,
|
|
130
|
+
orientation = "horizontal",
|
|
131
|
+
step = 1,
|
|
132
|
+
thumbCollisionBehavior = "push",
|
|
133
|
+
thumbAlignment = "center",
|
|
134
|
+
value: valueProp,
|
|
135
|
+
...elementProps
|
|
136
|
+
} = componentProps;
|
|
137
|
+
const id = useBaseUiId.useBaseUiId(idProp);
|
|
138
|
+
const defaultLabelId = resolveAriaLabelledBy.getDefaultLabelId(id);
|
|
139
|
+
const onValueChange = useStableCallback.useStableCallback(onValueChangeProp);
|
|
140
|
+
const onValueCommitted = useStableCallback.useStableCallback(onValueCommittedProp);
|
|
141
|
+
const {
|
|
142
|
+
clearErrors
|
|
143
|
+
} = LabelableContext.useFormContext();
|
|
144
|
+
const {
|
|
145
|
+
state: fieldState,
|
|
146
|
+
disabled: fieldDisabled,
|
|
147
|
+
name: fieldName,
|
|
148
|
+
setTouched,
|
|
149
|
+
setDirty,
|
|
150
|
+
validityData,
|
|
151
|
+
shouldValidateOnChange,
|
|
152
|
+
validation
|
|
153
|
+
} = LabelableContext.useFieldRootContext();
|
|
154
|
+
const {
|
|
155
|
+
labelId: fieldLabelId
|
|
156
|
+
} = LabelableContext.useLabelableContext();
|
|
157
|
+
const [labelId, setLabelId] = React__namespace.useState();
|
|
158
|
+
const ariaLabelledby = ariaLabelledByProp ?? resolveAriaLabelledBy.resolveAriaLabelledBy(fieldLabelId, labelId);
|
|
159
|
+
const disabled = fieldDisabled || disabledProp;
|
|
160
|
+
const name = fieldName ?? nameProp;
|
|
161
|
+
const [valueUnwrapped, setValueUnwrapped] = useControlled.useControlled({
|
|
162
|
+
controlled: valueProp,
|
|
163
|
+
default: defaultValue ?? min,
|
|
164
|
+
name: "Slider"
|
|
165
|
+
});
|
|
166
|
+
const sliderRef = React__namespace.useRef(null);
|
|
167
|
+
const controlRef = React__namespace.useRef(null);
|
|
168
|
+
const thumbRefs = React__namespace.useRef([]);
|
|
169
|
+
const pressedInputRef = React__namespace.useRef(null);
|
|
170
|
+
const pressedThumbCenterOffsetRef = React__namespace.useRef(null);
|
|
171
|
+
const pressedThumbIndexRef = React__namespace.useRef(-1);
|
|
172
|
+
const pressedValuesRef = React__namespace.useRef(null);
|
|
173
|
+
const lastChangedValueRef = React__namespace.useRef(null);
|
|
174
|
+
const lastChangeReasonRef = React__namespace.useRef("none");
|
|
175
|
+
const formatOptionsRef = useValueAsRef.useValueAsRef(format);
|
|
176
|
+
const [active, setActiveState] = React__namespace.useState(-1);
|
|
177
|
+
const [lastUsedThumbIndex, setLastUsedThumbIndex] = React__namespace.useState(-1);
|
|
178
|
+
const [dragging, setDragging] = React__namespace.useState(false);
|
|
179
|
+
const [thumbMap, setThumbMap] = React__namespace.useState(() => /* @__PURE__ */ new Map());
|
|
180
|
+
const [indicatorPosition, setIndicatorPosition] = React__namespace.useState([void 0, void 0]);
|
|
181
|
+
const setActive = useStableCallback.useStableCallback((value) => {
|
|
182
|
+
setActiveState(value);
|
|
183
|
+
if (value !== -1) {
|
|
184
|
+
setLastUsedThumbIndex(value);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
LabelableContext.useField({
|
|
188
|
+
id,
|
|
189
|
+
commit: validation.commit,
|
|
190
|
+
value: valueUnwrapped,
|
|
191
|
+
controlRef,
|
|
192
|
+
name,
|
|
193
|
+
getValue: () => valueUnwrapped
|
|
194
|
+
});
|
|
195
|
+
useValueChanged.useValueChanged(valueUnwrapped, () => {
|
|
196
|
+
clearErrors(name);
|
|
197
|
+
if (shouldValidateOnChange()) {
|
|
198
|
+
validation.commit(valueUnwrapped);
|
|
199
|
+
} else {
|
|
200
|
+
validation.commit(valueUnwrapped, true);
|
|
201
|
+
}
|
|
202
|
+
const initialValue = validityData.initialValue;
|
|
203
|
+
let isDirty;
|
|
204
|
+
if (Array.isArray(valueUnwrapped) && Array.isArray(initialValue)) {
|
|
205
|
+
isDirty = !areArraysEqual(valueUnwrapped, initialValue);
|
|
206
|
+
} else {
|
|
207
|
+
isDirty = valueUnwrapped !== initialValue;
|
|
208
|
+
}
|
|
209
|
+
setDirty(isDirty);
|
|
210
|
+
});
|
|
211
|
+
const registerFieldControlRef = useStableCallback.useStableCallback((element2) => {
|
|
212
|
+
if (element2) {
|
|
213
|
+
controlRef.current = element2;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
const range = Array.isArray(valueUnwrapped);
|
|
217
|
+
const values = React__namespace.useMemo(() => {
|
|
218
|
+
if (!range) {
|
|
219
|
+
return [clamp.clamp(valueUnwrapped, min, max)];
|
|
220
|
+
}
|
|
221
|
+
return valueUnwrapped.slice().sort(asc);
|
|
222
|
+
}, [max, min, range, valueUnwrapped]);
|
|
223
|
+
const setValue = useStableCallback.useStableCallback((newValue, details) => {
|
|
224
|
+
if (Number.isNaN(newValue) || areValuesEqual(newValue, valueUnwrapped)) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
const changeDetails = details ?? createBaseUIEventDetails.createChangeEventDetails(createBaseUIEventDetails.none, void 0, void 0, {
|
|
228
|
+
activeThumbIndex: -1
|
|
229
|
+
});
|
|
230
|
+
lastChangeReasonRef.current = changeDetails.reason;
|
|
231
|
+
const nativeEvent = changeDetails.event;
|
|
232
|
+
const EventConstructor = nativeEvent.constructor ?? Event;
|
|
233
|
+
const clonedEvent = new EventConstructor(nativeEvent.type, nativeEvent);
|
|
234
|
+
Object.defineProperty(clonedEvent, "target", {
|
|
235
|
+
writable: true,
|
|
236
|
+
value: {
|
|
237
|
+
value: newValue,
|
|
238
|
+
name
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
changeDetails.event = clonedEvent;
|
|
242
|
+
lastChangedValueRef.current = newValue;
|
|
243
|
+
onValueChange(newValue, changeDetails);
|
|
244
|
+
if (changeDetails.isCanceled) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
setValueUnwrapped(newValue);
|
|
248
|
+
});
|
|
249
|
+
const handleInputChange = useStableCallback.useStableCallback((valueInput, index, event) => {
|
|
250
|
+
const newValue = getSliderValue(valueInput, index, min, max, range, values);
|
|
251
|
+
if (validateMinimumDistance(newValue, step, minStepsBetweenValues)) {
|
|
252
|
+
const reason = getSliderChangeEventReason(event);
|
|
253
|
+
setValue(newValue, createBaseUIEventDetails.createChangeEventDetails(reason, event.nativeEvent, void 0, {
|
|
254
|
+
activeThumbIndex: index
|
|
255
|
+
}));
|
|
256
|
+
setTouched(true);
|
|
257
|
+
const nextValue = lastChangedValueRef.current ?? newValue;
|
|
258
|
+
onValueCommitted(nextValue, createBaseUIEventDetails.createGenericEventDetails(reason, event.nativeEvent));
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
if (process.env.NODE_ENV !== "production") {
|
|
262
|
+
if (min >= max) {
|
|
263
|
+
useRenderElement.warn("Slider `max` must be greater than `min`.");
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
useIsoLayoutEffect.useIsoLayoutEffect(() => {
|
|
267
|
+
var _a;
|
|
268
|
+
const activeEl = element.activeElement(owner.ownerDocument(sliderRef.current));
|
|
269
|
+
if (disabled && activeEl && ((_a = sliderRef.current) == null ? void 0 : _a.contains(activeEl))) {
|
|
270
|
+
activeEl.blur();
|
|
271
|
+
}
|
|
272
|
+
}, [disabled]);
|
|
273
|
+
if (disabled && active !== -1) {
|
|
274
|
+
setActive(-1);
|
|
275
|
+
}
|
|
276
|
+
const state = React__namespace.useMemo(() => ({
|
|
277
|
+
...fieldState,
|
|
278
|
+
activeThumbIndex: active,
|
|
279
|
+
disabled,
|
|
280
|
+
dragging,
|
|
281
|
+
orientation,
|
|
282
|
+
max,
|
|
283
|
+
min,
|
|
284
|
+
minStepsBetweenValues,
|
|
285
|
+
step,
|
|
286
|
+
values
|
|
287
|
+
}), [fieldState, active, disabled, dragging, max, min, minStepsBetweenValues, orientation, step, values]);
|
|
288
|
+
const contextValue = React__namespace.useMemo(() => ({
|
|
289
|
+
active,
|
|
290
|
+
controlRef,
|
|
291
|
+
disabled,
|
|
292
|
+
dragging,
|
|
293
|
+
validation,
|
|
294
|
+
formatOptionsRef,
|
|
295
|
+
handleInputChange,
|
|
296
|
+
indicatorPosition,
|
|
297
|
+
inset: thumbAlignment !== "center",
|
|
298
|
+
labelId: ariaLabelledby,
|
|
299
|
+
rootLabelId: defaultLabelId,
|
|
300
|
+
largeStep,
|
|
301
|
+
lastUsedThumbIndex,
|
|
302
|
+
lastChangedValueRef,
|
|
303
|
+
lastChangeReasonRef,
|
|
304
|
+
locale,
|
|
305
|
+
max,
|
|
306
|
+
min,
|
|
307
|
+
minStepsBetweenValues,
|
|
308
|
+
name,
|
|
309
|
+
onValueCommitted,
|
|
310
|
+
orientation,
|
|
311
|
+
pressedInputRef,
|
|
312
|
+
pressedThumbCenterOffsetRef,
|
|
313
|
+
pressedThumbIndexRef,
|
|
314
|
+
pressedValuesRef,
|
|
315
|
+
registerFieldControlRef,
|
|
316
|
+
renderBeforeHydration: thumbAlignment === "edge",
|
|
317
|
+
setActive,
|
|
318
|
+
setDragging,
|
|
319
|
+
setIndicatorPosition,
|
|
320
|
+
setLabelId,
|
|
321
|
+
setValue,
|
|
322
|
+
state,
|
|
323
|
+
step,
|
|
324
|
+
thumbCollisionBehavior,
|
|
325
|
+
thumbMap,
|
|
326
|
+
thumbRefs,
|
|
327
|
+
values
|
|
328
|
+
}), [active, controlRef, ariaLabelledby, defaultLabelId, disabled, dragging, validation, formatOptionsRef, handleInputChange, indicatorPosition, largeStep, lastUsedThumbIndex, lastChangedValueRef, lastChangeReasonRef, locale, max, min, minStepsBetweenValues, name, onValueCommitted, orientation, pressedInputRef, pressedThumbCenterOffsetRef, pressedThumbIndexRef, pressedValuesRef, registerFieldControlRef, setActive, setDragging, setIndicatorPosition, setLabelId, setValue, state, step, thumbCollisionBehavior, thumbAlignment, thumbMap, thumbRefs, values]);
|
|
329
|
+
const element$1 = useRenderElement.useRenderElement("div", componentProps, {
|
|
330
|
+
state,
|
|
331
|
+
ref: [forwardedRef, sliderRef],
|
|
332
|
+
props: [{
|
|
333
|
+
"aria-labelledby": ariaLabelledby,
|
|
334
|
+
id,
|
|
335
|
+
role: "group"
|
|
336
|
+
}, validation.getValidationProps, elementProps],
|
|
337
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
338
|
+
});
|
|
339
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(SliderRootContext.Provider, {
|
|
340
|
+
value: contextValue,
|
|
341
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(CompositeList.CompositeList, {
|
|
342
|
+
elementsRef: thumbRefs,
|
|
343
|
+
onMapChange: setThumbMap,
|
|
344
|
+
children: element$1
|
|
345
|
+
})
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
if (process.env.NODE_ENV !== "production") SliderRoot.displayName = "SliderRoot";
|
|
349
|
+
function getMidpoint(element2) {
|
|
350
|
+
const rect = element2.getBoundingClientRect();
|
|
351
|
+
return {
|
|
352
|
+
x: (rect.left + rect.right) / 2,
|
|
353
|
+
y: (rect.top + rect.bottom) / 2
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function getDecimalPrecision(num) {
|
|
357
|
+
if (Math.abs(num) < 1) {
|
|
358
|
+
const parts = num.toExponential().split("e-");
|
|
359
|
+
const matissaDecimalPart = parts[0].split(".")[1];
|
|
360
|
+
return (matissaDecimalPart ? matissaDecimalPart.length : 0) + parseInt(parts[1], 10);
|
|
361
|
+
}
|
|
362
|
+
const decimalPart = num.toString().split(".")[1];
|
|
363
|
+
return decimalPart ? decimalPart.length : 0;
|
|
364
|
+
}
|
|
365
|
+
function roundValueToStep(value, step, min) {
|
|
366
|
+
const nearest = Math.round((value - min) / step) * step + min;
|
|
367
|
+
return Number(nearest.toFixed(getDecimalPrecision(step)));
|
|
368
|
+
}
|
|
369
|
+
function getPushedThumbValues({
|
|
370
|
+
values,
|
|
371
|
+
index,
|
|
372
|
+
nextValue,
|
|
373
|
+
min,
|
|
374
|
+
max,
|
|
375
|
+
step,
|
|
376
|
+
minStepsBetweenValues,
|
|
377
|
+
initialValues
|
|
378
|
+
}) {
|
|
379
|
+
if (values.length === 0) {
|
|
380
|
+
return [];
|
|
381
|
+
}
|
|
382
|
+
const nextValues = values.slice();
|
|
383
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
384
|
+
const lastIndex = nextValues.length - 1;
|
|
385
|
+
const baseInitialValues = initialValues ?? values;
|
|
386
|
+
const indexMin = min + index * minValueDifference;
|
|
387
|
+
const indexMax = max - (lastIndex - index) * minValueDifference;
|
|
388
|
+
nextValues[index] = clamp.clamp(nextValue, indexMin, indexMax);
|
|
389
|
+
for (let i = index + 1; i <= lastIndex; i += 1) {
|
|
390
|
+
const minAllowed = nextValues[i - 1] + minValueDifference;
|
|
391
|
+
const maxAllowed = max - (lastIndex - i) * minValueDifference;
|
|
392
|
+
const initialValue = baseInitialValues[i] ?? nextValues[i];
|
|
393
|
+
let candidate = Math.max(nextValues[i], minAllowed);
|
|
394
|
+
if (initialValue < candidate) {
|
|
395
|
+
candidate = Math.max(initialValue, minAllowed);
|
|
396
|
+
}
|
|
397
|
+
nextValues[i] = clamp.clamp(candidate, minAllowed, maxAllowed);
|
|
398
|
+
}
|
|
399
|
+
for (let i = index - 1; i >= 0; i -= 1) {
|
|
400
|
+
const maxAllowed = nextValues[i + 1] - minValueDifference;
|
|
401
|
+
const minAllowed = min + i * minValueDifference;
|
|
402
|
+
const initialValue = baseInitialValues[i] ?? nextValues[i];
|
|
403
|
+
let candidate = Math.min(nextValues[i], maxAllowed);
|
|
404
|
+
if (initialValue > candidate) {
|
|
405
|
+
candidate = Math.min(initialValue, maxAllowed);
|
|
406
|
+
}
|
|
407
|
+
nextValues[i] = clamp.clamp(candidate, minAllowed, maxAllowed);
|
|
408
|
+
}
|
|
409
|
+
for (let i = 0; i <= lastIndex; i += 1) {
|
|
410
|
+
nextValues[i] = Number(nextValues[i].toFixed(12));
|
|
411
|
+
}
|
|
412
|
+
return nextValues;
|
|
413
|
+
}
|
|
414
|
+
function resolveThumbCollision({
|
|
415
|
+
behavior,
|
|
416
|
+
values,
|
|
417
|
+
currentValues,
|
|
418
|
+
initialValues,
|
|
419
|
+
pressedIndex,
|
|
420
|
+
nextValue,
|
|
421
|
+
min,
|
|
422
|
+
max,
|
|
423
|
+
step,
|
|
424
|
+
minStepsBetweenValues
|
|
425
|
+
}) {
|
|
426
|
+
const activeValues = currentValues ?? values;
|
|
427
|
+
const baselineValues = initialValues ?? values;
|
|
428
|
+
const range = activeValues.length > 1;
|
|
429
|
+
if (!range) {
|
|
430
|
+
return {
|
|
431
|
+
value: nextValue,
|
|
432
|
+
thumbIndex: 0,
|
|
433
|
+
didSwap: false
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
const minValueDifference = step * minStepsBetweenValues;
|
|
437
|
+
switch (behavior) {
|
|
438
|
+
case "swap": {
|
|
439
|
+
const pressedInitialValue = activeValues[pressedIndex];
|
|
440
|
+
const epsilon = 1e-7;
|
|
441
|
+
const candidateValues = activeValues.slice();
|
|
442
|
+
const previousNeighbor = candidateValues[pressedIndex - 1];
|
|
443
|
+
const nextNeighbor = candidateValues[pressedIndex + 1];
|
|
444
|
+
const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
|
|
445
|
+
const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
|
|
446
|
+
const constrainedValue = clamp.clamp(nextValue, lowerBound, upperBound);
|
|
447
|
+
const pressedValueAfterClamp = Number(constrainedValue.toFixed(12));
|
|
448
|
+
candidateValues[pressedIndex] = pressedValueAfterClamp;
|
|
449
|
+
const movingForward = nextValue > pressedInitialValue;
|
|
450
|
+
const movingBackward = nextValue < pressedInitialValue;
|
|
451
|
+
const shouldSwapForward = movingForward && nextNeighbor != null && nextValue >= nextNeighbor - epsilon;
|
|
452
|
+
const shouldSwapBackward = movingBackward && previousNeighbor != null && nextValue <= previousNeighbor + epsilon;
|
|
453
|
+
if (!shouldSwapForward && !shouldSwapBackward) {
|
|
454
|
+
return {
|
|
455
|
+
value: candidateValues,
|
|
456
|
+
thumbIndex: pressedIndex,
|
|
457
|
+
didSwap: false
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
const targetIndex = shouldSwapForward ? pressedIndex + 1 : pressedIndex - 1;
|
|
461
|
+
const initialValuesForPush = candidateValues.map((_, index) => {
|
|
462
|
+
if (index === pressedIndex) {
|
|
463
|
+
return pressedValueAfterClamp;
|
|
464
|
+
}
|
|
465
|
+
const baseline = baselineValues[index];
|
|
466
|
+
if (baseline != null) {
|
|
467
|
+
return baseline;
|
|
468
|
+
}
|
|
469
|
+
return activeValues[index];
|
|
470
|
+
});
|
|
471
|
+
let nextValueForTarget = nextValue;
|
|
472
|
+
if (shouldSwapForward) {
|
|
473
|
+
nextValueForTarget = Math.max(nextValue, candidateValues[targetIndex]);
|
|
474
|
+
} else {
|
|
475
|
+
nextValueForTarget = Math.min(nextValue, candidateValues[targetIndex]);
|
|
476
|
+
}
|
|
477
|
+
const adjustedValues = getPushedThumbValues({
|
|
478
|
+
values: candidateValues,
|
|
479
|
+
index: targetIndex,
|
|
480
|
+
nextValue: nextValueForTarget,
|
|
481
|
+
min,
|
|
482
|
+
max,
|
|
483
|
+
step,
|
|
484
|
+
minStepsBetweenValues,
|
|
485
|
+
initialValues: initialValuesForPush
|
|
486
|
+
});
|
|
487
|
+
const neighborIndex = shouldSwapForward ? targetIndex - 1 : targetIndex + 1;
|
|
488
|
+
if (neighborIndex >= 0 && neighborIndex < adjustedValues.length) {
|
|
489
|
+
const previousValue = adjustedValues[neighborIndex - 1];
|
|
490
|
+
const nextValueAfter = adjustedValues[neighborIndex + 1];
|
|
491
|
+
let neighborLowerBound = previousValue != null ? previousValue + minValueDifference : min;
|
|
492
|
+
neighborLowerBound = Math.max(neighborLowerBound, min + neighborIndex * minValueDifference);
|
|
493
|
+
let neighborUpperBound = nextValueAfter != null ? nextValueAfter - minValueDifference : max;
|
|
494
|
+
neighborUpperBound = Math.min(neighborUpperBound, max - (adjustedValues.length - 1 - neighborIndex) * minValueDifference);
|
|
495
|
+
const restoredValue = clamp.clamp(pressedValueAfterClamp, neighborLowerBound, neighborUpperBound);
|
|
496
|
+
adjustedValues[neighborIndex] = Number(restoredValue.toFixed(12));
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
value: adjustedValues,
|
|
500
|
+
thumbIndex: targetIndex,
|
|
501
|
+
didSwap: true
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
case "push": {
|
|
505
|
+
const nextValues = getPushedThumbValues({
|
|
506
|
+
values: activeValues,
|
|
507
|
+
index: pressedIndex,
|
|
508
|
+
nextValue,
|
|
509
|
+
min,
|
|
510
|
+
max,
|
|
511
|
+
step,
|
|
512
|
+
minStepsBetweenValues
|
|
513
|
+
});
|
|
514
|
+
return {
|
|
515
|
+
value: nextValues,
|
|
516
|
+
thumbIndex: pressedIndex,
|
|
517
|
+
didSwap: false
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
case "none":
|
|
521
|
+
default: {
|
|
522
|
+
const candidateValues = activeValues.slice();
|
|
523
|
+
const previousNeighbor = candidateValues[pressedIndex - 1];
|
|
524
|
+
const nextNeighbor = candidateValues[pressedIndex + 1];
|
|
525
|
+
const lowerBound = previousNeighbor != null ? previousNeighbor + minValueDifference : min;
|
|
526
|
+
const upperBound = nextNeighbor != null ? nextNeighbor - minValueDifference : max;
|
|
527
|
+
const constrainedValue = clamp.clamp(nextValue, lowerBound, upperBound);
|
|
528
|
+
candidateValues[pressedIndex] = Number(constrainedValue.toFixed(12));
|
|
529
|
+
return {
|
|
530
|
+
value: candidateValues,
|
|
531
|
+
thumbIndex: pressedIndex,
|
|
532
|
+
didSwap: false
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
const INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
|
|
538
|
+
function getControlOffset(styles, vertical) {
|
|
539
|
+
if (!styles) {
|
|
540
|
+
return {
|
|
541
|
+
start: 0,
|
|
542
|
+
end: 0
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
function parseSize(value) {
|
|
546
|
+
const parsed = value != null ? parseFloat(value) : 0;
|
|
547
|
+
return Number.isNaN(parsed) ? 0 : parsed;
|
|
548
|
+
}
|
|
549
|
+
const start = !vertical ? "InlineStart" : "Top";
|
|
550
|
+
const end = !vertical ? "InlineEnd" : "Bottom";
|
|
551
|
+
return {
|
|
552
|
+
start: parseSize(styles[`border${start}Width`]) + parseSize(styles[`padding${start}`]),
|
|
553
|
+
end: parseSize(styles[`border${end}Width`]) + parseSize(styles[`padding${end}`])
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
function getFingerCoords(event, touchIdRef) {
|
|
557
|
+
if (touchIdRef.current != null && event.changedTouches) {
|
|
558
|
+
const touchEvent = event;
|
|
559
|
+
for (let i = 0; i < touchEvent.changedTouches.length; i += 1) {
|
|
560
|
+
const touch = touchEvent.changedTouches[i];
|
|
561
|
+
if (touch.identifier === touchIdRef.current) {
|
|
562
|
+
return {
|
|
563
|
+
x: touch.clientX,
|
|
564
|
+
y: touch.clientY
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
return {
|
|
571
|
+
x: event.clientX,
|
|
572
|
+
y: event.clientY
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
const SliderControl = /* @__PURE__ */ React__namespace.forwardRef(function SliderControl2(componentProps, forwardedRef) {
|
|
576
|
+
const {
|
|
577
|
+
render: renderProp,
|
|
578
|
+
className,
|
|
579
|
+
...elementProps
|
|
580
|
+
} = componentProps;
|
|
581
|
+
const {
|
|
582
|
+
disabled,
|
|
583
|
+
dragging,
|
|
584
|
+
inset,
|
|
585
|
+
lastChangedValueRef,
|
|
586
|
+
lastChangeReasonRef,
|
|
587
|
+
max,
|
|
588
|
+
min,
|
|
589
|
+
minStepsBetweenValues,
|
|
590
|
+
onValueCommitted,
|
|
591
|
+
orientation,
|
|
592
|
+
pressedInputRef,
|
|
593
|
+
pressedThumbCenterOffsetRef,
|
|
594
|
+
pressedThumbIndexRef,
|
|
595
|
+
pressedValuesRef,
|
|
596
|
+
registerFieldControlRef,
|
|
597
|
+
renderBeforeHydration,
|
|
598
|
+
setActive,
|
|
599
|
+
setDragging,
|
|
600
|
+
setValue,
|
|
601
|
+
state,
|
|
602
|
+
step,
|
|
603
|
+
thumbCollisionBehavior,
|
|
604
|
+
thumbRefs,
|
|
605
|
+
values
|
|
606
|
+
} = useSliderRootContext();
|
|
607
|
+
const direction = DirectionContext.useDirection();
|
|
608
|
+
const range = values.length > 1;
|
|
609
|
+
const vertical = orientation === "vertical";
|
|
610
|
+
const controlRef = React__namespace.useRef(null);
|
|
611
|
+
const stylesRef = React__namespace.useRef(null);
|
|
612
|
+
const setStylesRef = useStableCallback.useStableCallback((element2) => {
|
|
613
|
+
if (element2 && stylesRef.current == null) {
|
|
614
|
+
if (stylesRef.current == null) {
|
|
615
|
+
stylesRef.current = getComputedStyle(element2);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
const touchIdRef = React__namespace.useRef(null);
|
|
620
|
+
const moveCountRef = React__namespace.useRef(0);
|
|
621
|
+
const insetThumbOffsetRef = React__namespace.useRef(0);
|
|
622
|
+
const latestValuesRef = useValueAsRef.useValueAsRef(values);
|
|
623
|
+
const updatePressedThumb = useStableCallback.useStableCallback((nextIndex) => {
|
|
624
|
+
if (pressedThumbIndexRef.current !== nextIndex) {
|
|
625
|
+
pressedThumbIndexRef.current = nextIndex;
|
|
626
|
+
}
|
|
627
|
+
const thumbElement = thumbRefs.current[nextIndex];
|
|
628
|
+
if (!thumbElement) {
|
|
629
|
+
pressedThumbCenterOffsetRef.current = null;
|
|
630
|
+
pressedInputRef.current = null;
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
pressedInputRef.current = thumbElement.querySelector('input[type="range"]');
|
|
634
|
+
});
|
|
635
|
+
const getFingerState = useStableCallback.useStableCallback((fingerCoords) => {
|
|
636
|
+
const control = controlRef.current;
|
|
637
|
+
if (!control) {
|
|
638
|
+
return null;
|
|
639
|
+
}
|
|
640
|
+
const {
|
|
641
|
+
width,
|
|
642
|
+
height,
|
|
643
|
+
bottom,
|
|
644
|
+
left,
|
|
645
|
+
right
|
|
646
|
+
} = control.getBoundingClientRect();
|
|
647
|
+
const controlOffset = getControlOffset(stylesRef.current, vertical);
|
|
648
|
+
const insetThumbOffset = insetThumbOffsetRef.current;
|
|
649
|
+
const controlSize = (vertical ? height : width) - controlOffset.start - controlOffset.end - insetThumbOffset * 2;
|
|
650
|
+
const thumbCenterOffset = pressedThumbCenterOffsetRef.current ?? 0;
|
|
651
|
+
const fingerX = fingerCoords.x - thumbCenterOffset;
|
|
652
|
+
const fingerY = fingerCoords.y - thumbCenterOffset;
|
|
653
|
+
const valueSize = vertical ? bottom - fingerY - controlOffset.end : (direction === "rtl" ? right - fingerX : fingerX - left) - controlOffset.start;
|
|
654
|
+
const valueRescaled = clamp.clamp((valueSize - insetThumbOffset) / controlSize, 0, 1);
|
|
655
|
+
let newValue = (max - min) * valueRescaled + min;
|
|
656
|
+
newValue = roundValueToStep(newValue, step, min);
|
|
657
|
+
newValue = clamp.clamp(newValue, min, max);
|
|
658
|
+
if (!range) {
|
|
659
|
+
return {
|
|
660
|
+
value: newValue,
|
|
661
|
+
thumbIndex: 0,
|
|
662
|
+
didSwap: false
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
const thumbIndex = pressedThumbIndexRef.current;
|
|
666
|
+
if (thumbIndex < 0) {
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
const collisionResult = resolveThumbCollision({
|
|
670
|
+
behavior: thumbCollisionBehavior,
|
|
671
|
+
values,
|
|
672
|
+
currentValues: latestValuesRef.current ?? values,
|
|
673
|
+
initialValues: pressedValuesRef.current,
|
|
674
|
+
pressedIndex: thumbIndex,
|
|
675
|
+
nextValue: newValue,
|
|
676
|
+
min,
|
|
677
|
+
max,
|
|
678
|
+
step,
|
|
679
|
+
minStepsBetweenValues
|
|
680
|
+
});
|
|
681
|
+
if (thumbCollisionBehavior === "swap" && collisionResult.didSwap) {
|
|
682
|
+
updatePressedThumb(collisionResult.thumbIndex);
|
|
683
|
+
} else {
|
|
684
|
+
pressedThumbIndexRef.current = collisionResult.thumbIndex;
|
|
685
|
+
}
|
|
686
|
+
return collisionResult;
|
|
687
|
+
});
|
|
688
|
+
const startPressing = useStableCallback.useStableCallback((fingerCoords) => {
|
|
689
|
+
pressedValuesRef.current = range ? values.slice() : null;
|
|
690
|
+
latestValuesRef.current = values;
|
|
691
|
+
const pressedThumbIndex = pressedThumbIndexRef.current;
|
|
692
|
+
let closestThumbIndex = pressedThumbIndex;
|
|
693
|
+
if (pressedThumbIndex > -1 && pressedThumbIndex < values.length) {
|
|
694
|
+
if (values[pressedThumbIndex] === max) {
|
|
695
|
+
let candidateIndex = pressedThumbIndex;
|
|
696
|
+
while (candidateIndex > 0 && values[candidateIndex - 1] === max) {
|
|
697
|
+
candidateIndex -= 1;
|
|
698
|
+
}
|
|
699
|
+
closestThumbIndex = candidateIndex;
|
|
700
|
+
}
|
|
701
|
+
} else {
|
|
702
|
+
const axis = !vertical ? "x" : "y";
|
|
703
|
+
let minDistance;
|
|
704
|
+
closestThumbIndex = -1;
|
|
705
|
+
for (let i = 0; i < thumbRefs.current.length; i += 1) {
|
|
706
|
+
const thumbEl = thumbRefs.current[i];
|
|
707
|
+
if (floatingUi_utils_dom.isElement(thumbEl)) {
|
|
708
|
+
const midpoint = getMidpoint(thumbEl);
|
|
709
|
+
const distance = Math.abs(fingerCoords[axis] - midpoint[axis]);
|
|
710
|
+
if (minDistance === void 0 || distance <= minDistance) {
|
|
711
|
+
closestThumbIndex = i;
|
|
712
|
+
minDistance = distance;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
if (closestThumbIndex > -1 && closestThumbIndex !== pressedThumbIndex) {
|
|
718
|
+
updatePressedThumb(closestThumbIndex);
|
|
719
|
+
}
|
|
720
|
+
if (inset) {
|
|
721
|
+
const thumbEl = thumbRefs.current[closestThumbIndex];
|
|
722
|
+
if (floatingUi_utils_dom.isElement(thumbEl)) {
|
|
723
|
+
const thumbRect = thumbEl.getBoundingClientRect();
|
|
724
|
+
const side = !vertical ? "width" : "height";
|
|
725
|
+
insetThumbOffsetRef.current = thumbRect[side] / 2;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
const focusThumb = useStableCallback.useStableCallback((thumbIndex) => {
|
|
730
|
+
var _a, _b, _c;
|
|
731
|
+
(_c = (_b = (_a = thumbRefs.current) == null ? void 0 : _a[thumbIndex]) == null ? void 0 : _b.querySelector('input[type="range"]')) == null ? void 0 : _c.focus({
|
|
732
|
+
preventScroll: true
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
const handleTouchMove = useStableCallback.useStableCallback((nativeEvent) => {
|
|
736
|
+
const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
|
|
737
|
+
if (fingerCoords == null) {
|
|
738
|
+
return;
|
|
739
|
+
}
|
|
740
|
+
moveCountRef.current += 1;
|
|
741
|
+
if (nativeEvent.type === "pointermove" && nativeEvent.buttons === 0) {
|
|
742
|
+
handleTouchEnd(nativeEvent);
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
745
|
+
const finger = getFingerState(fingerCoords);
|
|
746
|
+
if (finger == null) {
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
749
|
+
if (validateMinimumDistance(finger.value, step, minStepsBetweenValues)) {
|
|
750
|
+
if (!dragging && moveCountRef.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
|
|
751
|
+
setDragging(true);
|
|
752
|
+
}
|
|
753
|
+
setValue(finger.value, createBaseUIEventDetails.createChangeEventDetails(createBaseUIEventDetails.drag, nativeEvent, void 0, {
|
|
754
|
+
activeThumbIndex: finger.thumbIndex
|
|
755
|
+
}));
|
|
756
|
+
latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
|
|
757
|
+
if (finger.didSwap) {
|
|
758
|
+
focusThumb(finger.thumbIndex);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
function handleTouchEnd(nativeEvent) {
|
|
763
|
+
var _a, _b;
|
|
764
|
+
setActive(-1);
|
|
765
|
+
setDragging(false);
|
|
766
|
+
pressedInputRef.current = null;
|
|
767
|
+
pressedThumbCenterOffsetRef.current = null;
|
|
768
|
+
const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
|
|
769
|
+
const finger = fingerCoords != null ? getFingerState(fingerCoords) : null;
|
|
770
|
+
if (finger != null) {
|
|
771
|
+
const commitReason = lastChangeReasonRef.current;
|
|
772
|
+
onValueCommitted(lastChangedValueRef.current ?? finger.value, createBaseUIEventDetails.createGenericEventDetails(commitReason, nativeEvent));
|
|
773
|
+
}
|
|
774
|
+
if ("pointerType" in nativeEvent && ((_a = controlRef.current) == null ? void 0 : _a.hasPointerCapture(nativeEvent.pointerId))) {
|
|
775
|
+
(_b = controlRef.current) == null ? void 0 : _b.releasePointerCapture(nativeEvent.pointerId);
|
|
776
|
+
}
|
|
777
|
+
pressedThumbIndexRef.current = -1;
|
|
778
|
+
touchIdRef.current = null;
|
|
779
|
+
pressedValuesRef.current = null;
|
|
780
|
+
stopListening();
|
|
781
|
+
}
|
|
782
|
+
const handleTouchStart = useStableCallback.useStableCallback((nativeEvent) => {
|
|
783
|
+
if (disabled) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
const touch = nativeEvent.changedTouches[0];
|
|
787
|
+
if (touch != null) {
|
|
788
|
+
touchIdRef.current = touch.identifier;
|
|
789
|
+
}
|
|
790
|
+
const fingerCoords = getFingerCoords(nativeEvent, touchIdRef);
|
|
791
|
+
if (fingerCoords != null) {
|
|
792
|
+
startPressing(fingerCoords);
|
|
793
|
+
const finger = getFingerState(fingerCoords);
|
|
794
|
+
if (finger == null) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
focusThumb(finger.thumbIndex);
|
|
798
|
+
setValue(finger.value, createBaseUIEventDetails.createChangeEventDetails(createBaseUIEventDetails.trackPress, nativeEvent, void 0, {
|
|
799
|
+
activeThumbIndex: finger.thumbIndex
|
|
800
|
+
}));
|
|
801
|
+
latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
|
|
802
|
+
if (finger.didSwap) {
|
|
803
|
+
focusThumb(finger.thumbIndex);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
moveCountRef.current = 0;
|
|
807
|
+
const doc = owner.ownerDocument(controlRef.current);
|
|
808
|
+
doc.addEventListener("touchmove", handleTouchMove, {
|
|
809
|
+
passive: true
|
|
810
|
+
});
|
|
811
|
+
doc.addEventListener("touchend", handleTouchEnd, {
|
|
812
|
+
passive: true
|
|
813
|
+
});
|
|
814
|
+
});
|
|
815
|
+
const stopListening = useStableCallback.useStableCallback(() => {
|
|
816
|
+
const doc = owner.ownerDocument(controlRef.current);
|
|
817
|
+
doc.removeEventListener("pointermove", handleTouchMove);
|
|
818
|
+
doc.removeEventListener("pointerup", handleTouchEnd);
|
|
819
|
+
doc.removeEventListener("touchmove", handleTouchMove);
|
|
820
|
+
doc.removeEventListener("touchend", handleTouchEnd);
|
|
821
|
+
pressedValuesRef.current = null;
|
|
822
|
+
});
|
|
823
|
+
const focusFrame = useAnimationFrame.useAnimationFrame();
|
|
824
|
+
React__namespace.useEffect(() => {
|
|
825
|
+
const control = controlRef.current;
|
|
826
|
+
if (!control) {
|
|
827
|
+
return () => stopListening();
|
|
828
|
+
}
|
|
829
|
+
control.addEventListener("touchstart", handleTouchStart, {
|
|
830
|
+
passive: true
|
|
831
|
+
});
|
|
832
|
+
return () => {
|
|
833
|
+
control.removeEventListener("touchstart", handleTouchStart);
|
|
834
|
+
focusFrame.cancel();
|
|
835
|
+
stopListening();
|
|
836
|
+
};
|
|
837
|
+
}, [stopListening, handleTouchStart, controlRef, focusFrame]);
|
|
838
|
+
React__namespace.useEffect(() => {
|
|
839
|
+
if (disabled) {
|
|
840
|
+
stopListening();
|
|
841
|
+
}
|
|
842
|
+
}, [disabled, stopListening]);
|
|
843
|
+
const element$1 = useRenderElement.useRenderElement("div", componentProps, {
|
|
844
|
+
state,
|
|
845
|
+
ref: [forwardedRef, registerFieldControlRef, controlRef, setStylesRef],
|
|
846
|
+
props: [{
|
|
847
|
+
["data-base-ui-slider-control"]: renderBeforeHydration ? "" : void 0,
|
|
848
|
+
onPointerDown(event) {
|
|
849
|
+
const control = controlRef.current;
|
|
850
|
+
if (!control || disabled || event.defaultPrevented || !floatingUi_utils_dom.isElement(event.target) || // Only handle left clicks
|
|
851
|
+
event.button !== 0) {
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
const fingerCoords = getFingerCoords(event, touchIdRef);
|
|
855
|
+
if (fingerCoords != null) {
|
|
856
|
+
startPressing(fingerCoords);
|
|
857
|
+
const finger = getFingerState(fingerCoords);
|
|
858
|
+
if (finger == null) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
861
|
+
const pressedOnFocusedThumb = element.contains(thumbRefs.current[finger.thumbIndex], element.activeElement(owner.ownerDocument(control)));
|
|
862
|
+
if (pressedOnFocusedThumb) {
|
|
863
|
+
event.preventDefault();
|
|
864
|
+
} else {
|
|
865
|
+
focusFrame.request(() => {
|
|
866
|
+
focusThumb(finger.thumbIndex);
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
setDragging(true);
|
|
870
|
+
const pressedOnAnyThumb = pressedThumbCenterOffsetRef.current != null;
|
|
871
|
+
if (!pressedOnAnyThumb) {
|
|
872
|
+
setValue(finger.value, createBaseUIEventDetails.createChangeEventDetails(createBaseUIEventDetails.trackPress, event.nativeEvent, void 0, {
|
|
873
|
+
activeThumbIndex: finger.thumbIndex
|
|
874
|
+
}));
|
|
875
|
+
latestValuesRef.current = Array.isArray(finger.value) ? finger.value : [finger.value];
|
|
876
|
+
if (finger.didSwap) {
|
|
877
|
+
focusThumb(finger.thumbIndex);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
if (event.nativeEvent.pointerId) {
|
|
882
|
+
control.setPointerCapture(event.nativeEvent.pointerId);
|
|
883
|
+
}
|
|
884
|
+
moveCountRef.current = 0;
|
|
885
|
+
const doc = owner.ownerDocument(controlRef.current);
|
|
886
|
+
doc.addEventListener("pointermove", handleTouchMove, {
|
|
887
|
+
passive: true
|
|
888
|
+
});
|
|
889
|
+
doc.addEventListener("pointerup", handleTouchEnd, {
|
|
890
|
+
once: true
|
|
891
|
+
});
|
|
892
|
+
},
|
|
893
|
+
tabIndex: -1
|
|
894
|
+
}, elementProps],
|
|
895
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
896
|
+
});
|
|
897
|
+
return element$1;
|
|
898
|
+
});
|
|
899
|
+
if (process.env.NODE_ENV !== "production") SliderControl.displayName = "SliderControl";
|
|
900
|
+
const SliderTrack = /* @__PURE__ */ React__namespace.forwardRef(function SliderTrack2(componentProps, forwardedRef) {
|
|
901
|
+
const {
|
|
902
|
+
render,
|
|
903
|
+
className,
|
|
904
|
+
...elementProps
|
|
905
|
+
} = componentProps;
|
|
906
|
+
const {
|
|
907
|
+
state
|
|
908
|
+
} = useSliderRootContext();
|
|
909
|
+
const element2 = useRenderElement.useRenderElement("div", componentProps, {
|
|
910
|
+
state,
|
|
911
|
+
ref: forwardedRef,
|
|
912
|
+
props: [{
|
|
913
|
+
style: {
|
|
914
|
+
position: "relative"
|
|
915
|
+
}
|
|
916
|
+
}, elementProps],
|
|
917
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
918
|
+
});
|
|
919
|
+
return element2;
|
|
920
|
+
});
|
|
921
|
+
if (process.env.NODE_ENV !== "production") SliderTrack.displayName = "SliderTrack";
|
|
922
|
+
let SliderThumbDataAttributes = /* @__PURE__ */ (function(SliderThumbDataAttributes2) {
|
|
923
|
+
SliderThumbDataAttributes2["index"] = "data-index";
|
|
924
|
+
SliderThumbDataAttributes2["dragging"] = "data-dragging";
|
|
925
|
+
SliderThumbDataAttributes2["orientation"] = "data-orientation";
|
|
926
|
+
SliderThumbDataAttributes2["disabled"] = "data-disabled";
|
|
927
|
+
SliderThumbDataAttributes2["valid"] = "data-valid";
|
|
928
|
+
SliderThumbDataAttributes2["invalid"] = "data-invalid";
|
|
929
|
+
SliderThumbDataAttributes2["touched"] = "data-touched";
|
|
930
|
+
SliderThumbDataAttributes2["dirty"] = "data-dirty";
|
|
931
|
+
SliderThumbDataAttributes2["focused"] = "data-focused";
|
|
932
|
+
return SliderThumbDataAttributes2;
|
|
933
|
+
})({});
|
|
934
|
+
const script = '!function(){const t=document.currentScript?.parentElement;if(!t)return;const e=t.closest("[data-base-ui-slider-control]");if(!e)return;const r=e.querySelector("[data-base-ui-slider-indicator]"),i=e.getBoundingClientRect(),n="vertical"===e.getAttribute("data-orientation")?"height":"width",o=e.querySelectorAll(\'input[type="range"]\'),l=o.length>1,s=o.length-1;let a=null,u=null;for(let t=0;t<o.length;t+=1){const e=o[t],y=parseFloat(e.getAttribute("value")??"");if(Number.isNaN(y))return;const c=e.parentElement;if(!c)return;const p=parseFloat(e.getAttribute("max")??"100"),g=parseFloat(e.getAttribute("min")??"0"),b=c?.getBoundingClientRect(),d=i[n]-b[n],m=100*(y-g)/(p-g),v=(b[n]/2+d*m/100)/i[n]*100;c.style.setProperty("--position",`${v}%`),Number.isFinite(v)&&(c.style.removeProperty("visibility"),r&&(0===t?(a=v,r.style.setProperty("--start-position",`${v}%`),l||r.style.removeProperty("visibility")):t===s&&(u=v-(a??0),r.style.setProperty("--end-position",`${v}%`),r.style.setProperty("--relative-size",`${u}%`),r.style.removeProperty("visibility"))))}}();';
|
|
935
|
+
const PAGE_UP = "PageUp";
|
|
936
|
+
const PAGE_DOWN = "PageDown";
|
|
937
|
+
const ALL_KEYS = /* @__PURE__ */ new Set([composite.ARROW_UP, composite.ARROW_DOWN, composite.ARROW_LEFT, composite.ARROW_RIGHT, composite.HOME, composite.END, PAGE_UP, PAGE_DOWN]);
|
|
938
|
+
function getDefaultAriaValueText(values, index, format, locale) {
|
|
939
|
+
if (index < 0) {
|
|
940
|
+
return void 0;
|
|
941
|
+
}
|
|
942
|
+
if (values.length === 2) {
|
|
943
|
+
if (index === 0) {
|
|
944
|
+
return `${valueToPercent.formatNumber(values[index], locale, format)} start range`;
|
|
945
|
+
}
|
|
946
|
+
return `${valueToPercent.formatNumber(values[index], locale, format)} end range`;
|
|
947
|
+
}
|
|
948
|
+
return format ? valueToPercent.formatNumber(values[index], locale, format) : void 0;
|
|
949
|
+
}
|
|
950
|
+
function getNewValue(thumbValue, step, direction, min, max) {
|
|
951
|
+
return direction === 1 ? Math.min(thumbValue + step, max) : Math.max(thumbValue - step, min);
|
|
952
|
+
}
|
|
953
|
+
const SliderThumb = /* @__PURE__ */ React__namespace.forwardRef(function SliderThumb2(componentProps, forwardedRef) {
|
|
954
|
+
const {
|
|
955
|
+
render,
|
|
956
|
+
children: childrenProp,
|
|
957
|
+
className,
|
|
958
|
+
"aria-describedby": ariaDescribedByProp,
|
|
959
|
+
"aria-label": ariaLabelProp,
|
|
960
|
+
"aria-labelledby": ariaLabelledByProp,
|
|
961
|
+
disabled: disabledProp = false,
|
|
962
|
+
getAriaLabel: getAriaLabelProp,
|
|
963
|
+
getAriaValueText: getAriaValueTextProp,
|
|
964
|
+
id: idProp,
|
|
965
|
+
index: indexProp,
|
|
966
|
+
inputRef: inputRefProp,
|
|
967
|
+
onBlur: onBlurProp,
|
|
968
|
+
onFocus: onFocusProp,
|
|
969
|
+
onKeyDown: onKeyDownProp,
|
|
970
|
+
tabIndex: tabIndexProp,
|
|
971
|
+
...elementProps
|
|
972
|
+
} = componentProps;
|
|
973
|
+
const {
|
|
974
|
+
nonce
|
|
975
|
+
} = clamp.useCSPContext();
|
|
976
|
+
const id = useBaseUiId.useBaseUiId(idProp);
|
|
977
|
+
const {
|
|
978
|
+
active: activeIndex,
|
|
979
|
+
lastUsedThumbIndex,
|
|
980
|
+
controlRef,
|
|
981
|
+
disabled: contextDisabled,
|
|
982
|
+
validation,
|
|
983
|
+
formatOptionsRef,
|
|
984
|
+
handleInputChange,
|
|
985
|
+
inset,
|
|
986
|
+
labelId,
|
|
987
|
+
largeStep,
|
|
988
|
+
locale,
|
|
989
|
+
max,
|
|
990
|
+
min,
|
|
991
|
+
minStepsBetweenValues,
|
|
992
|
+
name,
|
|
993
|
+
orientation,
|
|
994
|
+
pressedInputRef,
|
|
995
|
+
pressedThumbCenterOffsetRef,
|
|
996
|
+
pressedThumbIndexRef,
|
|
997
|
+
renderBeforeHydration,
|
|
998
|
+
setActive,
|
|
999
|
+
setIndicatorPosition,
|
|
1000
|
+
state,
|
|
1001
|
+
step,
|
|
1002
|
+
values: sliderValues
|
|
1003
|
+
} = useSliderRootContext();
|
|
1004
|
+
const direction = DirectionContext.useDirection();
|
|
1005
|
+
const disabled = disabledProp || contextDisabled;
|
|
1006
|
+
const range = sliderValues.length > 1;
|
|
1007
|
+
const vertical = orientation === "vertical";
|
|
1008
|
+
const rtl = direction === "rtl";
|
|
1009
|
+
const {
|
|
1010
|
+
setTouched,
|
|
1011
|
+
setFocused,
|
|
1012
|
+
validationMode
|
|
1013
|
+
} = LabelableContext.useFieldRootContext();
|
|
1014
|
+
const thumbRef = React__namespace.useRef(null);
|
|
1015
|
+
const inputRef = React__namespace.useRef(null);
|
|
1016
|
+
const defaultInputId = useBaseUiId.useBaseUiId();
|
|
1017
|
+
const labelableId = useLabelableId.useLabelableId();
|
|
1018
|
+
const inputId = range ? defaultInputId : labelableId;
|
|
1019
|
+
const thumbMetadata = React__namespace.useMemo(() => ({
|
|
1020
|
+
inputId
|
|
1021
|
+
}), [inputId]);
|
|
1022
|
+
const {
|
|
1023
|
+
ref: listItemRef,
|
|
1024
|
+
index: compositeIndex
|
|
1025
|
+
} = useCompositeListItem.useCompositeListItem({
|
|
1026
|
+
metadata: thumbMetadata
|
|
1027
|
+
});
|
|
1028
|
+
const index = !range ? 0 : indexProp ?? compositeIndex;
|
|
1029
|
+
const last = index === sliderValues.length - 1;
|
|
1030
|
+
const thumbValue = sliderValues[index];
|
|
1031
|
+
const thumbValuePercent = valueToPercent.valueToPercent(thumbValue, min, max);
|
|
1032
|
+
const [isMounted, setIsMounted] = React__namespace.useState(false);
|
|
1033
|
+
const [positionPercent, setPositionPercent] = React__namespace.useState();
|
|
1034
|
+
useOnMount.useOnMount(() => setIsMounted(true));
|
|
1035
|
+
const safeLastUsedThumbIndex = lastUsedThumbIndex >= 0 && lastUsedThumbIndex < sliderValues.length ? lastUsedThumbIndex : -1;
|
|
1036
|
+
const getInsetPosition = useStableCallback.useStableCallback(() => {
|
|
1037
|
+
const control = controlRef.current;
|
|
1038
|
+
const thumb = thumbRef.current;
|
|
1039
|
+
if (!control || !thumb) {
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
1043
|
+
const controlRect = control.getBoundingClientRect();
|
|
1044
|
+
const side = vertical ? "height" : "width";
|
|
1045
|
+
const controlSize = controlRect[side] - thumbRect[side];
|
|
1046
|
+
const thumbOffsetFromControlEdge = thumbRect[side] / 2 + controlSize * thumbValuePercent / 100;
|
|
1047
|
+
const nextPositionPercent = thumbOffsetFromControlEdge / controlRect[side] * 100;
|
|
1048
|
+
setPositionPercent(nextPositionPercent);
|
|
1049
|
+
if (index === 0) {
|
|
1050
|
+
setIndicatorPosition((prevPosition) => [nextPositionPercent, prevPosition[1]]);
|
|
1051
|
+
} else if (last) {
|
|
1052
|
+
setIndicatorPosition((prevPosition) => [prevPosition[0], nextPositionPercent]);
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
useIsoLayoutEffect.useIsoLayoutEffect(() => {
|
|
1056
|
+
if (inset) {
|
|
1057
|
+
queueMicrotask(getInsetPosition);
|
|
1058
|
+
}
|
|
1059
|
+
}, [getInsetPosition, inset]);
|
|
1060
|
+
useIsoLayoutEffect.useIsoLayoutEffect(() => {
|
|
1061
|
+
if (inset) {
|
|
1062
|
+
getInsetPosition();
|
|
1063
|
+
}
|
|
1064
|
+
}, [getInsetPosition, inset, thumbValuePercent]);
|
|
1065
|
+
const getThumbStyle = React__namespace.useCallback(() => {
|
|
1066
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
1067
|
+
const crossOffsetProperty = vertical ? "left" : "top";
|
|
1068
|
+
let zIndex;
|
|
1069
|
+
if (range) {
|
|
1070
|
+
if (activeIndex === index) {
|
|
1071
|
+
zIndex = 2;
|
|
1072
|
+
} else if (safeLastUsedThumbIndex === index) {
|
|
1073
|
+
zIndex = 1;
|
|
1074
|
+
}
|
|
1075
|
+
} else if (activeIndex === index) {
|
|
1076
|
+
zIndex = 1;
|
|
1077
|
+
}
|
|
1078
|
+
if (!inset) {
|
|
1079
|
+
if (!Number.isFinite(thumbValuePercent)) {
|
|
1080
|
+
return visuallyHidden.visuallyHidden;
|
|
1081
|
+
}
|
|
1082
|
+
return {
|
|
1083
|
+
position: "absolute",
|
|
1084
|
+
[startEdge]: `${thumbValuePercent}%`,
|
|
1085
|
+
[crossOffsetProperty]: "50%",
|
|
1086
|
+
translate: `${(vertical || !rtl ? -1 : 1) * 50}% ${(vertical ? 1 : -1) * 50}%`,
|
|
1087
|
+
zIndex
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
return {
|
|
1091
|
+
["--position"]: `${positionPercent}%`,
|
|
1092
|
+
visibility: renderBeforeHydration && !isMounted || positionPercent === void 0 ? "hidden" : void 0,
|
|
1093
|
+
position: "absolute",
|
|
1094
|
+
[startEdge]: "var(--position)",
|
|
1095
|
+
[crossOffsetProperty]: "50%",
|
|
1096
|
+
translate: `${(vertical || !rtl ? -1 : 1) * 50}% ${(vertical ? 1 : -1) * 50}%`,
|
|
1097
|
+
zIndex
|
|
1098
|
+
};
|
|
1099
|
+
}, [activeIndex, index, inset, isMounted, positionPercent, range, renderBeforeHydration, rtl, safeLastUsedThumbIndex, thumbValuePercent, vertical]);
|
|
1100
|
+
let cssWritingMode;
|
|
1101
|
+
if (orientation === "vertical") {
|
|
1102
|
+
cssWritingMode = rtl ? "vertical-rl" : "vertical-lr";
|
|
1103
|
+
}
|
|
1104
|
+
const ariaLabel = typeof getAriaLabelProp === "function" ? getAriaLabelProp(index) : ariaLabelProp;
|
|
1105
|
+
const inputProps = useRenderElement.mergeProps({
|
|
1106
|
+
"aria-label": ariaLabel,
|
|
1107
|
+
"aria-labelledby": ariaLabelledByProp ?? (ariaLabel == null ? labelId : void 0),
|
|
1108
|
+
"aria-describedby": ariaDescribedByProp,
|
|
1109
|
+
"aria-orientation": orientation,
|
|
1110
|
+
"aria-valuenow": thumbValue,
|
|
1111
|
+
"aria-valuetext": typeof getAriaValueTextProp === "function" ? getAriaValueTextProp(valueToPercent.formatNumber(thumbValue, locale, formatOptionsRef.current ?? void 0), thumbValue, index) : getDefaultAriaValueText(sliderValues, index, formatOptionsRef.current ?? void 0, locale),
|
|
1112
|
+
disabled,
|
|
1113
|
+
id: inputId,
|
|
1114
|
+
max,
|
|
1115
|
+
min,
|
|
1116
|
+
name,
|
|
1117
|
+
onChange(event) {
|
|
1118
|
+
handleInputChange(event.target.valueAsNumber, index, event);
|
|
1119
|
+
},
|
|
1120
|
+
onFocus() {
|
|
1121
|
+
setActive(index);
|
|
1122
|
+
setFocused(true);
|
|
1123
|
+
},
|
|
1124
|
+
onBlur() {
|
|
1125
|
+
if (!thumbRef.current) {
|
|
1126
|
+
return;
|
|
1127
|
+
}
|
|
1128
|
+
setActive(-1);
|
|
1129
|
+
setTouched(true);
|
|
1130
|
+
setFocused(false);
|
|
1131
|
+
if (validationMode === "onBlur") {
|
|
1132
|
+
validation.commit(getSliderValue(thumbValue, index, min, max, range, sliderValues));
|
|
1133
|
+
}
|
|
1134
|
+
},
|
|
1135
|
+
onKeyDown(event) {
|
|
1136
|
+
if (!ALL_KEYS.has(event.key)) {
|
|
1137
|
+
return;
|
|
1138
|
+
}
|
|
1139
|
+
if (composite.COMPOSITE_KEYS.has(event.key)) {
|
|
1140
|
+
event.stopPropagation();
|
|
1141
|
+
}
|
|
1142
|
+
let newValue = null;
|
|
1143
|
+
const roundedValue = roundValueToStep(thumbValue, step, min);
|
|
1144
|
+
switch (event.key) {
|
|
1145
|
+
case composite.ARROW_UP:
|
|
1146
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, 1, min, max);
|
|
1147
|
+
break;
|
|
1148
|
+
case composite.ARROW_RIGHT:
|
|
1149
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, rtl ? -1 : 1, min, max);
|
|
1150
|
+
break;
|
|
1151
|
+
case composite.ARROW_DOWN:
|
|
1152
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, -1, min, max);
|
|
1153
|
+
break;
|
|
1154
|
+
case composite.ARROW_LEFT:
|
|
1155
|
+
newValue = getNewValue(roundedValue, event.shiftKey ? largeStep : step, rtl ? 1 : -1, min, max);
|
|
1156
|
+
break;
|
|
1157
|
+
case PAGE_UP:
|
|
1158
|
+
newValue = getNewValue(roundedValue, largeStep, 1, min, max);
|
|
1159
|
+
break;
|
|
1160
|
+
case PAGE_DOWN:
|
|
1161
|
+
newValue = getNewValue(roundedValue, largeStep, -1, min, max);
|
|
1162
|
+
break;
|
|
1163
|
+
case composite.END:
|
|
1164
|
+
newValue = max;
|
|
1165
|
+
if (range) {
|
|
1166
|
+
newValue = Number.isFinite(sliderValues[index + 1]) ? sliderValues[index + 1] - step * minStepsBetweenValues : max;
|
|
1167
|
+
}
|
|
1168
|
+
break;
|
|
1169
|
+
case composite.HOME:
|
|
1170
|
+
newValue = min;
|
|
1171
|
+
if (range) {
|
|
1172
|
+
newValue = Number.isFinite(sliderValues[index - 1]) ? sliderValues[index - 1] + step * minStepsBetweenValues : min;
|
|
1173
|
+
}
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
if (newValue !== null) {
|
|
1177
|
+
handleInputChange(newValue, index, event);
|
|
1178
|
+
event.preventDefault();
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
step,
|
|
1182
|
+
style: {
|
|
1183
|
+
...visuallyHidden.visuallyHidden,
|
|
1184
|
+
// So that VoiceOver's focus indicator matches the thumb's dimensions
|
|
1185
|
+
width: "100%",
|
|
1186
|
+
height: "100%",
|
|
1187
|
+
writingMode: cssWritingMode
|
|
1188
|
+
},
|
|
1189
|
+
tabIndex: tabIndexProp ?? void 0,
|
|
1190
|
+
type: "range",
|
|
1191
|
+
value: thumbValue ?? ""
|
|
1192
|
+
}, validation.getInputValidationProps);
|
|
1193
|
+
const mergedInputRef = useRenderElement.useMergedRefs(inputRef, validation.inputRef, inputRefProp);
|
|
1194
|
+
const element2 = useRenderElement.useRenderElement("div", componentProps, {
|
|
1195
|
+
state,
|
|
1196
|
+
ref: [forwardedRef, listItemRef, thumbRef],
|
|
1197
|
+
props: [{
|
|
1198
|
+
[SliderThumbDataAttributes.index]: index,
|
|
1199
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(React__namespace.Fragment, {
|
|
1200
|
+
children: [childrenProp, /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("input", {
|
|
1201
|
+
ref: mergedInputRef,
|
|
1202
|
+
...inputProps
|
|
1203
|
+
}), inset && !isMounted && renderBeforeHydration && // this must be rendered with the last thumb to ensure all
|
|
1204
|
+
// preceding thumbs are already rendered in the DOM
|
|
1205
|
+
last && /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx("script", {
|
|
1206
|
+
nonce,
|
|
1207
|
+
dangerouslySetInnerHTML: {
|
|
1208
|
+
__html: script
|
|
1209
|
+
},
|
|
1210
|
+
suppressHydrationWarning: true
|
|
1211
|
+
})]
|
|
1212
|
+
}),
|
|
1213
|
+
id,
|
|
1214
|
+
onBlur: onBlurProp,
|
|
1215
|
+
onFocus: onFocusProp,
|
|
1216
|
+
onPointerDown(event) {
|
|
1217
|
+
pressedThumbIndexRef.current = index;
|
|
1218
|
+
if (thumbRef.current != null) {
|
|
1219
|
+
const axis = orientation === "horizontal" ? "x" : "y";
|
|
1220
|
+
const midpoint = getMidpoint(thumbRef.current);
|
|
1221
|
+
const offset = (orientation === "horizontal" ? event.clientX : event.clientY) - midpoint[axis];
|
|
1222
|
+
pressedThumbCenterOffsetRef.current = offset;
|
|
1223
|
+
}
|
|
1224
|
+
if (inputRef.current != null && pressedInputRef.current !== inputRef.current) {
|
|
1225
|
+
pressedInputRef.current = inputRef.current;
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
style: getThumbStyle(),
|
|
1229
|
+
suppressHydrationWarning: renderBeforeHydration || void 0,
|
|
1230
|
+
tabIndex: -1
|
|
1231
|
+
}, elementProps],
|
|
1232
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
1233
|
+
});
|
|
1234
|
+
return element2;
|
|
1235
|
+
});
|
|
1236
|
+
if (process.env.NODE_ENV !== "production") SliderThumb.displayName = "SliderThumb";
|
|
1237
|
+
function getInsetStyles(vertical, range, start, end, renderBeforeHydration, mounted) {
|
|
1238
|
+
const visibility = start === void 0 || range && end === void 0 ? "hidden" : void 0;
|
|
1239
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
1240
|
+
const mainSide = vertical ? "height" : "width";
|
|
1241
|
+
const crossSide = vertical ? "width" : "height";
|
|
1242
|
+
const styles = {
|
|
1243
|
+
visibility: renderBeforeHydration && !mounted ? "hidden" : visibility,
|
|
1244
|
+
position: vertical ? "absolute" : "relative",
|
|
1245
|
+
[crossSide]: "inherit"
|
|
1246
|
+
};
|
|
1247
|
+
styles["--start-position"] = `${start ?? 0}%`;
|
|
1248
|
+
if (!range) {
|
|
1249
|
+
styles[startEdge] = 0;
|
|
1250
|
+
styles[mainSide] = "var(--start-position)";
|
|
1251
|
+
return styles;
|
|
1252
|
+
}
|
|
1253
|
+
styles["--relative-size"] = `${(end ?? 0) - (start ?? 0)}%`;
|
|
1254
|
+
styles[startEdge] = "var(--start-position)";
|
|
1255
|
+
styles[mainSide] = "var(--relative-size)";
|
|
1256
|
+
return styles;
|
|
1257
|
+
}
|
|
1258
|
+
function getCenteredStyles(vertical, range, start, end) {
|
|
1259
|
+
const startEdge = vertical ? "bottom" : "insetInlineStart";
|
|
1260
|
+
const mainSide = vertical ? "height" : "width";
|
|
1261
|
+
const crossSide = vertical ? "width" : "height";
|
|
1262
|
+
const styles = {
|
|
1263
|
+
position: vertical ? "absolute" : "relative",
|
|
1264
|
+
[crossSide]: "inherit"
|
|
1265
|
+
};
|
|
1266
|
+
if (!range) {
|
|
1267
|
+
styles[startEdge] = 0;
|
|
1268
|
+
styles[mainSide] = `${start}%`;
|
|
1269
|
+
return styles;
|
|
1270
|
+
}
|
|
1271
|
+
const size = end - start;
|
|
1272
|
+
styles[startEdge] = `${start}%`;
|
|
1273
|
+
styles[mainSide] = `${size}%`;
|
|
1274
|
+
return styles;
|
|
1275
|
+
}
|
|
1276
|
+
const SliderIndicator = /* @__PURE__ */ React__namespace.forwardRef(function SliderIndicator2(componentProps, forwardedRef) {
|
|
1277
|
+
const {
|
|
1278
|
+
render,
|
|
1279
|
+
className,
|
|
1280
|
+
...elementProps
|
|
1281
|
+
} = componentProps;
|
|
1282
|
+
const {
|
|
1283
|
+
indicatorPosition,
|
|
1284
|
+
inset,
|
|
1285
|
+
max,
|
|
1286
|
+
min,
|
|
1287
|
+
orientation,
|
|
1288
|
+
renderBeforeHydration,
|
|
1289
|
+
state,
|
|
1290
|
+
values
|
|
1291
|
+
} = useSliderRootContext();
|
|
1292
|
+
const [isMounted, setIsMounted] = React__namespace.useState(false);
|
|
1293
|
+
useOnMount.useOnMount(() => setIsMounted(true));
|
|
1294
|
+
const vertical = orientation === "vertical";
|
|
1295
|
+
const range = values.length > 1;
|
|
1296
|
+
const style = inset ? getInsetStyles(vertical, range, indicatorPosition[0], indicatorPosition[1], renderBeforeHydration, isMounted) : getCenteredStyles(vertical, range, valueToPercent.valueToPercent(values[0], min, max), valueToPercent.valueToPercent(values[values.length - 1], min, max));
|
|
1297
|
+
const element2 = useRenderElement.useRenderElement("div", componentProps, {
|
|
1298
|
+
state,
|
|
1299
|
+
ref: forwardedRef,
|
|
1300
|
+
props: [{
|
|
1301
|
+
["data-base-ui-slider-indicator"]: renderBeforeHydration ? "" : void 0,
|
|
1302
|
+
style,
|
|
1303
|
+
suppressHydrationWarning: renderBeforeHydration || void 0
|
|
1304
|
+
}, elementProps],
|
|
1305
|
+
stateAttributesMapping: sliderStateAttributesMapping
|
|
1306
|
+
});
|
|
1307
|
+
return element2;
|
|
1308
|
+
});
|
|
1309
|
+
if (process.env.NODE_ENV !== "production") SliderIndicator.displayName = "SliderIndicator";
|
|
1310
|
+
function Slider({
|
|
1311
|
+
className,
|
|
1312
|
+
defaultValue,
|
|
1313
|
+
value,
|
|
1314
|
+
min = 0,
|
|
1315
|
+
max = 100,
|
|
1316
|
+
...props
|
|
1317
|
+
}) {
|
|
1318
|
+
const _values = React__namespace.useMemo(
|
|
1319
|
+
() => Array.isArray(value) ? value : Array.isArray(defaultValue) ? defaultValue : [min, max],
|
|
1320
|
+
[value, defaultValue, min, max]
|
|
1321
|
+
);
|
|
1322
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
1323
|
+
SliderRoot,
|
|
1324
|
+
{
|
|
1325
|
+
className: utils.cn("data-horizontal:w-full data-vertical:h-full", className),
|
|
1326
|
+
"data-slot": "slider",
|
|
1327
|
+
defaultValue,
|
|
1328
|
+
value,
|
|
1329
|
+
min,
|
|
1330
|
+
max,
|
|
1331
|
+
thumbAlignment: "edge",
|
|
1332
|
+
...props,
|
|
1333
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(SliderControl, { className: "relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col", children: [
|
|
1334
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
1335
|
+
SliderTrack,
|
|
1336
|
+
{
|
|
1337
|
+
"data-slot": "slider-track",
|
|
1338
|
+
className: "relative grow overflow-hidden rounded-full bg-muted select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1",
|
|
1339
|
+
children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
1340
|
+
SliderIndicator,
|
|
1341
|
+
{
|
|
1342
|
+
"data-slot": "slider-range",
|
|
1343
|
+
className: "bg-primary select-none data-horizontal:h-full data-vertical:w-full"
|
|
1344
|
+
}
|
|
1345
|
+
)
|
|
1346
|
+
}
|
|
1347
|
+
),
|
|
1348
|
+
Array.from({ length: _values.length }, (_, index) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
1349
|
+
SliderThumb,
|
|
1350
|
+
{
|
|
1351
|
+
"data-slot": "slider-thumb",
|
|
1352
|
+
className: "relative block size-3 shrink-0 rounded-full border border-ring bg-white ring-ring/50 transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
|
|
1353
|
+
},
|
|
1354
|
+
index
|
|
1355
|
+
))
|
|
1356
|
+
] })
|
|
1357
|
+
}
|
|
1358
|
+
);
|
|
1359
|
+
}
|
|
1360
|
+
exports.Slider = Slider;
|
|
1361
|
+
//# sourceMappingURL=index.js.map
|