@etus/design-system 2.0.3 → 2.0.4
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/lib/assets/{Accordion-BLDionAq.js → Accordion-CgX8ogo_.js} +1 -1
- package/lib/assets/Accordion-Cokk9UmL.js +1 -0
- package/lib/assets/{ActionCard-Dnm8wc-V.js → ActionCard-B-V6OXi2.js} +1 -1
- package/lib/assets/{ActionCard-BWmyJT_9.js → ActionCard-CpTo683T.js} +1 -1
- package/lib/assets/{Alert-VaDDaJmV.js → Alert-Dc5Ipl49.js} +1 -1
- package/lib/assets/{Alert-D-09BScY.js → Alert-DpuvR7Gh.js} +1 -1
- package/lib/assets/AutoComplete-DEgPj8oQ.js +1 -0
- package/lib/assets/AutoComplete-DrfrItoU.js +1 -0
- package/lib/assets/{Badge-xSUPZkRF.js → Badge-BTv66y-P.js} +1 -1
- package/lib/assets/{Badge-Te4ff3ej.js → Badge-BY7G9c3q.js} +1 -1
- package/lib/assets/{Breadcrumb-CUVLzPPD.js → Breadcrumb-CRYd3qok.js} +1 -1
- package/lib/assets/Breadcrumb-DL8hjLV6.js +1 -0
- package/lib/assets/{Button-PxUMi4c4.js → Button-BQvl5kpf.js} +1 -1
- package/lib/assets/{Button-1lnlGEU9.js → Button-Dwf5lfho.js} +1 -1
- package/lib/assets/{Calendar-E1QPtZO1.js → Calendar-BQaEwrsF.js} +1 -1
- package/lib/assets/{Calendar-CI3EoS57.js → Calendar-zXDN1__a.js} +1 -1
- package/lib/assets/{Carousel-iZhiqHr1.js → Carousel-CaBBanzf.js} +1 -1
- package/lib/assets/{Carousel-Cne2rOoP.js → Carousel-Uh7hPUN_.js} +1 -1
- package/lib/assets/Checkbox-BWJvfeIk.js +1 -0
- package/lib/assets/Checkbox-JLPQNtg3.js +1 -0
- package/lib/assets/{ColorPicker-BsrGOt2x.js → ColorPicker-Bzm0PUlr.js} +1 -1
- package/lib/assets/ColorPicker-Xbh84tU0.js +1 -0
- package/lib/assets/{Confirm-D9ue91JY.js → Confirm-KPLTzyjU.js} +1 -1
- package/lib/assets/{Confirm-D5SQRnzs.js → Confirm-Lumw2IlY.js} +1 -1
- package/lib/assets/{Crop-COi25GCt.js → Crop-B9fz9sta.js} +1 -1
- package/lib/assets/{Crop-DXU8IEzK.js → Crop-DXLiWLOd.js} +1 -1
- package/lib/assets/{DatePicker-DBb7Pq4-.js → DatePicker-BZZOmgy2.js} +1 -1
- package/lib/assets/{DatePicker-BqHgn0jP.js → DatePicker-XARoRV8B.js} +1 -1
- package/lib/assets/DesignSystemProvider-B5BmSsFQ.js +1 -0
- package/lib/assets/DesignSystemProvider-B8zl9xux.js +1 -0
- package/lib/assets/{Dialog-lFnC79hF.js → Dialog-CANR3qfF.js} +1 -1
- package/lib/assets/{Dialog-TzFU7H7M.js → Dialog-CIliTshU.js} +1 -1
- package/lib/assets/{Drawer-BShyg2Md.js → Drawer-C-7lHBee.js} +1 -1
- package/lib/assets/{Drawer-BRhAt1cp.js → Drawer-g_VGKzC1.js} +1 -1
- package/lib/assets/{Dropdown-DOmq6yld.js → Dropdown-CBST4NE-.js} +1 -1
- package/lib/assets/{Dropdown-Di_QSp14.js → Dropdown-CBzhBfRR.js} +1 -1
- package/lib/assets/{ExpandableContainer-BRU7oRQZ.js → ExpandableContainer-BSfYcFgO.js} +1 -1
- package/lib/assets/{ExpandableContainer-T1N4IU4P.js → ExpandableContainer-DGBcw0Ik.js} +1 -1
- package/lib/assets/FileUpload-BXuSjel2.js +1 -0
- package/lib/assets/FileUpload-Cf0IwAqv.js +1 -0
- package/lib/assets/{Filter-BpZb369c.js → Filter-BFhE2_vm.js} +1 -1
- package/lib/assets/{Filter-QMWutHly.js → Filter-BNsFkb0d.js} +1 -1
- package/lib/assets/FloatCard-BPnvYKAf.js +1 -0
- package/lib/assets/FloatCard-DFWCAqct.js +1 -0
- package/lib/assets/{History-B8JQmONY.js → History-B95JCO0V.js} +1 -1
- package/lib/assets/{History-BBHRpFWw.js → History-DSyVWbgM.js} +1 -1
- package/lib/assets/IconCard-BIo3NGP9.js +1 -0
- package/lib/assets/{IconCard-DkDRKG8a.js → IconCard-BcpGzA7H.js} +1 -1
- package/lib/assets/{Image-CkMVrVxf.js → Image-BeChQusm.js} +1 -1
- package/lib/assets/{Image-CoinvfQ-.js → Image-DIpgRX3S.js} +1 -1
- package/lib/assets/Input-6RCSE6Th.js +1 -0
- package/lib/assets/{Input-DZ17y4L_.js → Input-vP6bFyaR.js} +1 -1
- package/lib/assets/{Label-DhQPcDeH.js → Label-BJz4_LAM.js} +1 -1
- package/lib/assets/{Label-AiZCfFq1.js → Label-Cf7QR6aU.js} +1 -1
- package/lib/assets/{MetricCard-Du95xvGv.js → MetricCard-CNzWzVtC.js} +1 -1
- package/lib/assets/{MetricCard-BKni_xcO.js → MetricCard-FKlK70fO.js} +1 -1
- package/lib/assets/Navbar-BFnZ7r7n.js +1 -0
- package/lib/assets/Navbar-CJJHIVPe.js +1 -0
- package/lib/assets/{PINInput-DymwFX1G.js → PINInput-BZ2cUZD7.js} +1 -1
- package/lib/assets/PINInput-DjOD8zox.js +1 -0
- package/lib/assets/Pagination-BZ7T7ovo.js +1 -0
- package/lib/assets/Pagination-CRjhLGmz.js +1 -0
- package/lib/assets/Profile-BOI2HJdk.js +1 -0
- package/lib/assets/Profile-DmxYAlkH.js +1 -0
- package/lib/assets/ProgressBar-Dt3BM1By.js +1 -0
- package/lib/assets/ProgressBar-yU5kgRNC.js +1 -0
- package/lib/assets/Radio-CIau508J.js +1 -0
- package/lib/assets/Radio-D_F0H3rA.js +1 -0
- package/lib/assets/{RichTextEditor-DR1hYKQF.js → RichTextEditor-Cbwzf2_-.js} +1 -1
- package/lib/assets/{RichTextEditor-L3swXum0.js → RichTextEditor-DUwJE_w7.js} +1 -1
- package/lib/assets/RoundMenu-BDFa4iPw.js +1 -0
- package/lib/assets/RoundMenu-CZH8GKm7.js +1 -0
- package/lib/assets/{Select-Bqw3ZPOg.js → Select-C22GZDi3.js} +1 -1
- package/lib/assets/{Select-B7JnRTcc.js → Select-ClQjvlOH.js} +1 -1
- package/lib/assets/{SelectContainer-HFSZpyH5.js → SelectContainer-Cdc2A3ug.js} +1 -1
- package/lib/assets/{SelectContainer-BRSv1LpP.js → SelectContainer-DxvxE0To.js} +1 -1
- package/lib/assets/{Sidebar-Br7HMLj5.js → Sidebar-5um1VXma.js} +1 -1
- package/lib/assets/{Sidebar-CBg_ZIzm.js → Sidebar-j0HRabnU.js} +1 -1
- package/lib/assets/{Slider-C1q6E2k3.js → Slider-CoW0LpN4.js} +1 -1
- package/lib/assets/{Slider-CcOR39o6.js → Slider-Cw3LF4rd.js} +1 -1
- package/lib/assets/StatusBadge-C-iDd_iG.js +1 -0
- package/lib/assets/StatusBadge-D_TJRM6K.js +1 -0
- package/lib/assets/{Stepper-C6YCuF1p.js → Stepper-BZpdS_YS.js} +1 -1
- package/lib/assets/{Stepper-C8kEYcc4.js → Stepper-CqasewYa.js} +1 -1
- package/lib/assets/{Switch-MRgqLSwE.js → Switch-DS7-Oe5_.js} +1 -1
- package/lib/assets/{Switch-DfaIhPgH.js → Switch-vPQCLtCB.js} +1 -1
- package/lib/assets/Tab-B3fsvwqU.js +1 -0
- package/lib/assets/{Tab-2xegrzwU.js → Tab-CwD8WOmL.js} +1 -1
- package/lib/assets/{Table-B8ifx_k_.js → Table-DO2ydeAg.js} +1 -1
- package/lib/assets/Table-i091bzIO.js +1 -0
- package/lib/assets/{TagInput-CuDUKx0K.js → TagInput-Dn1zaxMR.js} +1 -1
- package/lib/assets/{TagInput-B4odE2Wm.js → TagInput-whDstjnp.js} +1 -1
- package/lib/assets/{TagSelect-DvtjzgB6.js → TagSelect-B6OFPZIK.js} +1 -1
- package/lib/assets/{TagSelect-DQbDaMr-.js → TagSelect-DqrCzbRk.js} +1 -1
- package/lib/assets/{Textarea-BtSNZ8Gp.js → Textarea-C6tDl9c6.js} +1 -1
- package/lib/assets/Textarea-DbeW4hl8.js +1 -0
- package/lib/assets/{Toast-CY1qe4HT.js → Toast-DpOdaMvB.js} +1 -1
- package/lib/assets/{Toast-BP80UdpJ.js → Toast-eYVEvn0Y.js} +1 -1
- package/lib/assets/Toggle-CcQCT-2K.js +1 -0
- package/lib/assets/Toggle-Jram9Bhs.js +1 -0
- package/lib/assets/{Tooltip-DVq7Ij0P.js → Tooltip-CGZ7svxq.js} +1 -1
- package/lib/assets/Tooltip-pqZN7nfJ.js +1 -0
- package/lib/assets/{Tree-BbVjt78W.js → Tree-CITWOibE.js} +1 -1
- package/lib/assets/{Tree-BWFRKUwY.js → Tree-Cus6NgUD.js} +1 -1
- package/lib/assets/style-D3Zs5TV5.css +1 -0
- package/lib/components/Accordion/index.cjs.js +1 -1
- package/lib/components/Accordion/index.es.js +1 -1
- package/lib/components/ActionCard/index.cjs.js +1 -1
- package/lib/components/ActionCard/index.es.js +1 -1
- package/lib/components/Alert/index.cjs.js +1 -1
- package/lib/components/Alert/index.es.js +1 -1
- package/lib/components/AutoComplete/index.cjs.js +1 -1
- package/lib/components/AutoComplete/index.es.js +1 -1
- package/lib/components/Avatar/index.cjs.js +1 -1
- package/lib/components/Avatar/index.es.js +1 -1
- package/lib/components/Badge/index.cjs.js +1 -1
- package/lib/components/Badge/index.es.js +1 -1
- package/lib/components/Breadcrumb/index.cjs.js +1 -1
- package/lib/components/Breadcrumb/index.es.js +1 -1
- package/lib/components/Button/index.cjs.js +1 -1
- package/lib/components/Button/index.es.js +1 -1
- package/lib/components/Calendar/index.cjs.js +1 -1
- package/lib/components/Calendar/index.es.js +1 -1
- package/lib/components/Card/index.cjs.js +1 -1
- package/lib/components/Card/index.es.js +1 -1
- package/lib/components/Carousel/index.cjs.js +1 -1
- package/lib/components/Carousel/index.es.js +1 -1
- package/lib/components/Checkbox/index.cjs.js +1 -1
- package/lib/components/Checkbox/index.es.js +1 -1
- package/lib/components/ColorPicker/index.cjs.js +1 -1
- package/lib/components/ColorPicker/index.es.js +1 -1
- package/lib/components/Confirm/index.cjs.js +1 -1
- package/lib/components/Confirm/index.es.js +1 -1
- package/lib/components/Connector/index.cjs.js +1 -1
- package/lib/components/Connector/index.es.js +1 -1
- package/lib/components/Crop/index.cjs.js +1 -1
- package/lib/components/Crop/index.es.js +1 -1
- package/lib/components/DatePicker/index.cjs.js +1 -1
- package/lib/components/DatePicker/index.es.js +1 -1
- package/lib/components/Dialog/index.cjs.js +1 -1
- package/lib/components/Dialog/index.es.js +1 -1
- package/lib/components/Drawer/index.cjs.js +1 -1
- package/lib/components/Drawer/index.es.js +1 -1
- package/lib/components/Dropdown/index.cjs.js +1 -1
- package/lib/components/Dropdown/index.es.js +1 -1
- package/lib/components/FileUpload/index.cjs.js +1 -1
- package/lib/components/FileUpload/index.es.js +1 -1
- package/lib/components/Filter/index.cjs.js +1 -1
- package/lib/components/Filter/index.es.js +1 -1
- package/lib/components/FloatCard/index.cjs.js +1 -1
- package/lib/components/FloatCard/index.es.js +1 -1
- package/lib/components/History/index.cjs.js +1 -1
- package/lib/components/History/index.es.js +1 -1
- package/lib/components/IconCard/index.cjs.js +1 -1
- package/lib/components/IconCard/index.es.js +1 -1
- package/lib/components/Image/index.cjs.js +1 -1
- package/lib/components/Image/index.es.js +1 -1
- package/lib/components/Input/index.cjs.js +1 -1
- package/lib/components/Input/index.es.js +1 -1
- package/lib/components/MetricCard/index.cjs.js +1 -1
- package/lib/components/MetricCard/index.es.js +1 -1
- package/lib/components/Navbar/index.cjs.js +1 -1
- package/lib/components/Navbar/index.es.js +1 -1
- package/lib/components/PINInput/index.cjs.js +1 -1
- package/lib/components/PINInput/index.es.js +1 -1
- package/lib/components/Pagination/index.cjs.js +1 -1
- package/lib/components/Pagination/index.es.js +1 -1
- package/lib/components/Profile/index.cjs.js +1 -1
- package/lib/components/Profile/index.es.js +1 -1
- package/lib/components/ProgressBar/index.cjs.js +1 -1
- package/lib/components/ProgressBar/index.es.js +1 -1
- package/lib/components/Radio/index.cjs.js +1 -1
- package/lib/components/Radio/index.es.js +1 -1
- package/lib/components/RadioGroup/index.cjs.js +1 -1
- package/lib/components/RadioGroup/index.es.js +1 -1
- package/lib/components/RichTextEditor/index.cjs.js +1 -1
- package/lib/components/RichTextEditor/index.es.js +1 -1
- package/lib/components/RoundMenu/index.cjs.js +1 -1
- package/lib/components/RoundMenu/index.es.js +1 -1
- package/lib/components/Select/index.cjs.js +1 -1
- package/lib/components/Select/index.es.js +1 -1
- package/lib/components/Separator/index.cjs.js +1 -1
- package/lib/components/Separator/index.es.js +1 -1
- package/lib/components/Sidebar/index.cjs.js +1 -1
- package/lib/components/Sidebar/index.es.js +1 -1
- package/lib/components/Skeleton/index.cjs.js +1 -1
- package/lib/components/Skeleton/index.es.js +1 -1
- package/lib/components/Slider/index.cjs.js +1 -1
- package/lib/components/Slider/index.es.js +1 -1
- package/lib/components/Spinner/index.cjs.js +1 -1
- package/lib/components/Spinner/index.es.js +1 -1
- package/lib/components/StatusBadge/index.cjs.js +1 -1
- package/lib/components/StatusBadge/index.es.js +1 -1
- package/lib/components/Stepper/index.cjs.js +1 -1
- package/lib/components/Stepper/index.es.js +1 -1
- package/lib/components/Switch/index.cjs.js +1 -1
- package/lib/components/Switch/index.es.js +1 -1
- package/lib/components/Tab/index.cjs.js +1 -1
- package/lib/components/Tab/index.es.js +1 -1
- package/lib/components/Table/index.cjs.js +1 -1
- package/lib/components/Table/index.es.js +1 -1
- package/lib/components/TagInput/index.cjs.js +1 -1
- package/lib/components/TagInput/index.es.js +1 -1
- package/lib/components/TagSelect/index.cjs.js +1 -1
- package/lib/components/TagSelect/index.es.js +1 -1
- package/lib/components/Textarea/index.cjs.js +1 -1
- package/lib/components/Textarea/index.es.js +1 -1
- package/lib/components/Toast/index.cjs.js +1 -1
- package/lib/components/Toast/index.es.js +1 -1
- package/lib/components/Toggle/index.cjs.js +1 -1
- package/lib/components/Toggle/index.es.js +1 -1
- package/lib/components/ToggleGroup/index.cjs.js +1 -1
- package/lib/components/ToggleGroup/index.es.js +1 -1
- package/lib/components/Tooltip/index.cjs.js +1 -1
- package/lib/components/Tooltip/index.es.js +1 -1
- package/lib/components/Tree/index.cjs.js +1 -1
- package/lib/components/Tree/index.es.js +1 -1
- package/lib/design-system.cjs.js +1 -1
- package/lib/design-system.css +1 -1
- package/lib/design-system.es.js +1 -1
- package/lib/design-system.umd.js +3 -3
- package/lib/index.css +1 -1
- package/lib/providers/index.cjs.js +1 -1
- package/lib/providers/index.es.js +1 -1
- package/package.json +2 -2
- package/lib/Accordion.css +0 -1
- package/lib/ActionCard.css +0 -1
- package/lib/Alert.css +0 -1
- package/lib/AutoComplete.css +0 -1
- package/lib/Badge.css +0 -1
- package/lib/Breadcrumb.css +0 -1
- package/lib/Button.css +0 -1
- package/lib/Calendar.css +0 -1
- package/lib/Carousel.css +0 -1
- package/lib/Checkbox.css +0 -1
- package/lib/ColorPicker.css +0 -1
- package/lib/Crop.css +0 -1
- package/lib/DatePicker.css +0 -1
- package/lib/Dialog.css +0 -1
- package/lib/Drawer.css +0 -1
- package/lib/Dropdown.css +0 -1
- package/lib/ExpandableContainer.css +0 -1
- package/lib/FileUpload.css +0 -1
- package/lib/Filter.css +0 -1
- package/lib/FloatCard.css +0 -1
- package/lib/History.css +0 -1
- package/lib/IconCard.css +0 -1
- package/lib/Image.css +0 -1
- package/lib/Input.css +0 -1
- package/lib/Label.css +0 -1
- package/lib/MetricCard.css +0 -1
- package/lib/Navbar.css +0 -1
- package/lib/Option.css +0 -1
- package/lib/Overlay.css +0 -1
- package/lib/PINInput.css +0 -1
- package/lib/Pagination.css +0 -1
- package/lib/Profile.css +0 -1
- package/lib/ProgressBar.css +0 -1
- package/lib/Radio.css +0 -1
- package/lib/RichTextEditor.css +0 -1
- package/lib/RoundMenu.css +0 -1
- package/lib/Select.css +0 -1
- package/lib/SelectContainer.css +0 -1
- package/lib/SelectContent.css +0 -1
- package/lib/Sidebar.css +0 -1
- package/lib/Slider.css +0 -1
- package/lib/StatusBadge.css +0 -1
- package/lib/Stepper.css +0 -1
- package/lib/Switch.css +0 -1
- package/lib/Tab.css +0 -1
- package/lib/Table.css +0 -1
- package/lib/TagInput.css +0 -1
- package/lib/TagSelect.css +0 -1
- package/lib/Textarea.css +0 -1
- package/lib/Toast.css +0 -1
- package/lib/Toggle.css +0 -1
- package/lib/Tooltip.css +0 -1
- package/lib/Tree.css +0 -1
- package/lib/assets/Accordion-BFrTxcI9.css +0 -1
- package/lib/assets/Accordion-CgoVX19v.js +0 -1
- package/lib/assets/ActionCard-BZb91dIW.css +0 -1
- package/lib/assets/Alert-DduoTaDO.css +0 -1
- package/lib/assets/AutoComplete-0HbU6b9V.js +0 -1
- package/lib/assets/AutoComplete-C0EjtIQ-.js +0 -1
- package/lib/assets/AutoComplete-DHFGDgEQ.css +0 -1
- package/lib/assets/Badge-GYjsY_3C.css +0 -1
- package/lib/assets/Breadcrumb-DbGhoBPp.js +0 -1
- package/lib/assets/Breadcrumb-zzZevNgV.css +0 -1
- package/lib/assets/Button-CrBBrgy5.css +0 -1
- package/lib/assets/Calendar-gS7wEU5v.css +0 -1
- package/lib/assets/Carousel-Dvr9ATv2.css +0 -1
- package/lib/assets/Checkbox-2PgbPjFv.js +0 -1
- package/lib/assets/Checkbox-Cj_gicnB.css +0 -1
- package/lib/assets/Checkbox-yFotY5Bn.js +0 -1
- package/lib/assets/ColorPicker-BNr6Tiux.css +0 -1
- package/lib/assets/ColorPicker-C8kkPONG.js +0 -1
- package/lib/assets/Crop-WBOMB0XF.css +0 -1
- package/lib/assets/DatePicker-Cv2SfuC2.css +0 -1
- package/lib/assets/DesignSystemProvider-DPbBh8_F.js +0 -1
- package/lib/assets/DesignSystemProvider-EOq0hjf5.js +0 -1
- package/lib/assets/Dialog-99dphHY5.css +0 -1
- package/lib/assets/Drawer-CxCCzcyW.css +0 -1
- package/lib/assets/Dropdown-BeObPypj.css +0 -1
- package/lib/assets/ExpandableContainer-BsNA9KWk.css +0 -1
- package/lib/assets/FileUpload-BLhvkuKS.js +0 -1
- package/lib/assets/FileUpload-Bn2hN30U.css +0 -1
- package/lib/assets/FileUpload-Cc6WNrgH.js +0 -1
- package/lib/assets/Filter-Deq8WR7s.css +0 -1
- package/lib/assets/FloatCard-BgZPzHss.css +0 -1
- package/lib/assets/FloatCard-CpyZ6Sv2.js +0 -1
- package/lib/assets/FloatCard-hzT_yVsi.js +0 -1
- package/lib/assets/History-DqZMdgvF.css +0 -1
- package/lib/assets/IconCard-BlV7E9dX.css +0 -1
- package/lib/assets/IconCard-CP-P2jyn.js +0 -1
- package/lib/assets/Image-DT7JkEC_.css +0 -1
- package/lib/assets/Input-C0RH5m66.js +0 -1
- package/lib/assets/Input-vjtA9tbV.css +0 -1
- package/lib/assets/Label-CQM-qY-2.css +0 -1
- package/lib/assets/MetricCard-Dkv9xWP4.css +0 -1
- package/lib/assets/Navbar-Ba75bp5L.css +0 -1
- package/lib/assets/Navbar-BaVZCyqJ.js +0 -1
- package/lib/assets/Navbar-DXhNGOsj.js +0 -1
- package/lib/assets/Option-C3y81jtN.css +0 -1
- package/lib/assets/Overlay-CV1mFJt6.css +0 -1
- package/lib/assets/PINInput-B5Xok4so.css +0 -1
- package/lib/assets/PINInput-Bh9Jd3rB.js +0 -1
- package/lib/assets/Pagination-B5AR5_SP.js +0 -1
- package/lib/assets/Pagination-BeKkkgRb.css +0 -1
- package/lib/assets/Pagination-CbOpAka-.js +0 -1
- package/lib/assets/Profile-Bww3-jQ7.js +0 -1
- package/lib/assets/Profile-CV7wdM8h.css +0 -1
- package/lib/assets/Profile-Z0DOVCs2.js +0 -1
- package/lib/assets/ProgressBar-ClBOwZKj.css +0 -1
- package/lib/assets/ProgressBar-OifG1zbb.js +0 -1
- package/lib/assets/ProgressBar-_D7Nifw6.js +0 -1
- package/lib/assets/Radio-BmQ4hiBf.js +0 -1
- package/lib/assets/Radio-DFcsNAYE.css +0 -1
- package/lib/assets/Radio-HxZNKwDn.js +0 -1
- package/lib/assets/RichTextEditor-ZfE5A8C0.css +0 -1
- package/lib/assets/RoundMenu-BSoV9q6V.js +0 -1
- package/lib/assets/RoundMenu-CgxYetqt.js +0 -1
- package/lib/assets/RoundMenu-llkS0uLX.css +0 -1
- package/lib/assets/Select-Czly_-sH.css +0 -1
- package/lib/assets/SelectContainer-BlWVlFUV.css +0 -1
- package/lib/assets/SelectContent-CMJbFlkr.css +0 -1
- package/lib/assets/Sidebar-CJmPvQ0E.css +0 -1
- package/lib/assets/Slider-CKHyJwpq.css +0 -1
- package/lib/assets/StatusBadge-1hF5CQM2.js +0 -1
- package/lib/assets/StatusBadge-DxIUZ75l.css +0 -1
- package/lib/assets/StatusBadge-bK6dJmfs.js +0 -1
- package/lib/assets/Stepper-e-nPkc4n.css +0 -1
- package/lib/assets/Switch-BbmBI4t-.css +0 -1
- package/lib/assets/Tab-BWTafykp.css +0 -1
- package/lib/assets/Tab-r87Om7ti.js +0 -1
- package/lib/assets/Table-Bb_pB7xr.css +0 -1
- package/lib/assets/Table-BrRdo0rx.js +0 -1
- package/lib/assets/TagInput-D2zgaR5F.css +0 -1
- package/lib/assets/TagSelect-BFudFHoc.css +0 -1
- package/lib/assets/Textarea-3aSTtzWW.css +0 -1
- package/lib/assets/Textarea-CDPRSwRY.js +0 -1
- package/lib/assets/Toast-CtUhQGfE.css +0 -1
- package/lib/assets/Toggle-BGajQcLP.js +0 -1
- package/lib/assets/Toggle-D51xo3o6.css +0 -1
- package/lib/assets/Toggle-ftaewjeK.js +0 -1
- package/lib/assets/Tooltip-DW188jnW.css +0 -1
- package/lib/assets/Tooltip-chSVIpvZ.js +0 -1
- package/lib/assets/Tree-BU5IfND5.css +0 -1
- package/lib/assets/index-B86NDK_5.css +0 -1
- package/lib/assets/index-BmQ-r8Ut.css +0 -1
- package/lib/assets/index-CfBpf7CU.css +0 -1
- package/lib/assets/index-DTN8b1mo.css +0 -1
- package/lib/assets/index-DTWUsnKp.css +0 -1
- package/lib/assets/index-DVIEtHZd.css +0 -1
- package/lib/assets/index-ZXHbiWno.css +0 -1
- package/lib/assets/main-BaReR0qp.css +0 -1
- package/lib/index2.css +0 -1
- package/lib/index3.css +0 -1
- package/lib/index4.css +0 -1
- package/lib/index5.css +0 -1
- package/lib/index6.css +0 -1
- package/lib/index7.css +0 -1
- package/lib/index8.css +0 -1
- /package/lib/assets/{Option-B-lvFxi7.js → Option-7LkwQa_J.js} +0 -0
- /package/lib/assets/{Option-C3L7jFYC.js → Option-BU2gWM4H.js} +0 -0
- /package/lib/assets/{Overlay-D0w6z3ie.js → Overlay-BKXhsLBt.js} +0 -0
- /package/lib/assets/{Overlay-D_ULC3j5.js → Overlay-BY8zon2o.js} +0 -0
- /package/lib/assets/{SelectContent-CXvWzOVg.js → SelectContent-C3qydYaT.js} +0 -0
- /package/lib/assets/{SelectContent-SGkP4IfD.js → SelectContent-Dc47jokE.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{c as n}from"./clsx-B-dksMZM.js";import{Icon as N}from"../components/Icon/index.es.js";import{T as I}from"./Tooltip-pqZN7nfJ.js";import{f as w}from"./index-C-RplXeX.js";import{useState as F,useEffect as L}from"react";const v="_stepBar_1ck9k_2",y="_progressBar_1ck9k_2",H="_step_1ck9k_2",q="_small_1ck9k_2",P="_progressLabel_1ck9k_2",W="_progressIcon_1ck9k_2",C="_medium_1ck9k_2",E="_large_1ck9k_2",M="_progressHolder_1ck9k_2",A="_progressFill_1ck9k_2",R="_filled_1ck9k_2",V="_neutralBg_1ck9k_2",$="_info_1ck9k_2",D="_success_1ck9k_2",G="_warning_1ck9k_2",J="_danger_1ck9k_2",K="_neutral_1ck9k_2",O="_indeterminate_1ck9k_2",Q="_query_1ck9k_2",s={stepBar:v,progressBar:y,step:H,small:q,progressLabel:P,progressIcon:W,medium:C,large:E,progressHolder:M,progressFill:A,filled:R,neutralBg:V,info:$,success:D,warning:G,danger:J,neutral:K,indeterminate:O,query:Q};function ss({value:a=0,size:i="medium",type:g="primary",color:t="",icon:d="",infoMessage:m="",steps:c=0,animationType:o,displayPercentage:k,neutralBackground:_=!1,iconSlot:p,className:u}){const[b,x]=F(!1);L(()=>{x(!0)},[]);const l=(()=>{let e=a*100;return c?e=a/c*100:o&&(e=50),Math.max(0,Math.min(100,e))+"%"})(),f=()=>!b||_||!t?"":w(t),j=!o&&(d||p),h=r.jsx(r.Fragment,{children:p??r.jsx(N,{name:d})});return c?r.jsx("div",{className:n(s.stepBar,"progress-bar",s[i],s[g],_&&s.neutralBg,u),children:Array.from({length:c},(e,B)=>B+1).map(e=>r.jsx("div",{className:n(s.step,e<=a&&s.filled,_&&s.neutralBg),style:{background:e<=a?t:f(),width:`${100/c}%`}},e))}):r.jsxs("div",{className:n(s.progressBar,s[i],s[g],_&&s.neutralBg,u),style:{background:f()},children:[r.jsxs("div",{className:s.progressHolder,children:[r.jsx("div",{className:n(s.progressFill,s[i],o&&s[o]),style:{background:t,width:l},children:k==="bar"&&!o&&r.jsx("label",{className:s.progressLabel,children:l})}),k==="center"&&!o&&r.jsx("label",{className:n(s.progressLabel,"absolute"),children:l})]}),j&&(m?r.jsx(I,{className:s.progressIcon,style:{left:l,color:t},labelValue:m,position:"bottom",children:h}):r.jsx("div",{className:s.progressIcon,style:{left:l,color:t},children:h}))]})}export{ss as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-u17CrQMm.js";import{createContext as z,useContext as A}from"react";import{c as v}from"./clsx-B-dksMZM.js";import{useControllable as L}from"../hooks/useControllable.es.js";import{i as g}from"./index-C-RplXeX.js";const S="_radioGroup_166p9_2",T="_horizontal_166p9_2",y="_vertical_166p9_2",N={radioGroup:S,horizontal:T,vertical:y},R=z(null);function Q({value:l,defaultValue:u,onChange:C,vertical:m=!1,disabled:h=!1,options:i,labelKey:j="label",valueKey:_="value",getObject:a=!1,children:p,className:r}){const[s,x]=L({value:l,defaultValue:u,onChange:C});function f(e){if(a&&i){const d=i.find(k=>n(k)===e);if(d!==void 0){x(d);return}}x(e)}function c(e){return g(e)?e[j]:String(e)}function n(e){return g(e)?e[_]:e}function b(e){return g(e)?e.disabled??!1:!1}const G=a&&g(s)?s[_]:s;return t.jsx(R.Provider,{value:{selected:G,disabled:h,select:f},children:t.jsx("div",{className:v(N.radioGroup,"radio-group",m?N.vertical:N.horizontal,r),children:i?i.map(e=>{const d=n(e);return t.jsx(q,{groupValue:d,disabled:b(e),children:c(e)},d)}):p})})}const I="_radio_1gg7x_2",V="_onboarding_1gg7x_2",D="_outerCircle_1gg7x_2",E="_radioLabel_1gg7x_2",F="_radioText_1gg7x_2",O="_selected_1gg7x_2",P="_disabled_1gg7x_2",U="_innerCircle_1gg7x_2",$="_innerCircleActive_1gg7x_2",o={radio:I,onboarding:V,outerCircle:D,radioLabel:E,radioText:F,selected:O,disabled:P,innerCircle:U,innerCircleActive:$};function q({id:l,name:u,value:C,defaultValue:m,onChange:h,groupValue:i,disabled:j,variant:_="default",children:a,className:p}){const r=A(R),[s,x]=L({value:r&&i!==void 0?void 0:C,defaultValue:r&&i!==void 0?void 0:m??!1,onChange:r&&i!==void 0?void 0:h}),f=r!==null&&i!==void 0,c=f?r.selected===i:s??!1,n=(r?.disabled??!1)||(j??!1);function b(){n||(f?r.select(i):x(!0))}const G=a?l||u?t.jsx("label",{htmlFor:l||u,className:v(o.radioLabel,"cursor-[inherit]"),children:a}):t.jsx("div",{className:o.radioText,children:a}):null;return t.jsxs("div",{id:l,role:"radio","aria-checked":c,"aria-disabled":n,className:v(o.radio,"radio",o[_],c&&o.selected,n&&o.disabled,p),onClick:b,children:[t.jsx("span",{tabIndex:0,className:o.outerCircle,onKeyUp:e=>{e.key===" "&&b()},children:t.jsx("span",{className:v(o.innerCircle,c&&o.innerCircleActive)})}),G]})}export{q as R,Q as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("./jsx-runtime-BubrbI3X.js"),G=require("react"),C=require("./clsx-C11secjj.js"),N=require("../hooks/useControllable.cjs.js"),g=require("./index-B4fH-h2h.js"),z="_radioGroup_166p9_2",A="_horizontal_166p9_2",O="_vertical_166p9_2",E={radioGroup:z,horizontal:A,vertical:O},k=G.createContext(null);function S({value:l,defaultValue:u,onChange:v,vertical:j=!1,disabled:m=!1,options:t,labelKey:R="label",valueKey:x="value",getObject:r=!1,children:h,className:s}){const[a,_]=N.useControllable({value:l,defaultValue:u,onChange:v});function b(e){if(r&&t){const d=t.find(L=>o(L)===e);if(d!==void 0){_(d);return}}_(e)}function c(e){return g.isObject(e)?e[R]:String(e)}function o(e){return g.isObject(e)?e[x]:e}function f(e){return g.isObject(e)?e.disabled??!1:!1}const p=r&&g.isObject(a)?a[x]:a;return n.jsxRuntimeExports.jsx(k.Provider,{value:{selected:p,disabled:m,select:b},children:n.jsxRuntimeExports.jsx("div",{className:C.clsx(E.radioGroup,"radio-group",j?E.vertical:E.horizontal,s),children:t?t.map(e=>{const d=o(e);return n.jsxRuntimeExports.jsx(q,{groupValue:d,disabled:f(e),children:c(e)},d)}):h})})}const T="_radio_1gg7x_2",y="_onboarding_1gg7x_2",I="_outerCircle_1gg7x_2",V="_radioLabel_1gg7x_2",D="_radioText_1gg7x_2",F="_selected_1gg7x_2",P="_disabled_1gg7x_2",U="_innerCircle_1gg7x_2",$="_innerCircleActive_1gg7x_2",i={radio:T,onboarding:y,outerCircle:I,radioLabel:V,radioText:D,selected:F,disabled:P,innerCircle:U,innerCircleActive:$};function q({id:l,name:u,value:v,defaultValue:j,onChange:m,groupValue:t,disabled:R,variant:x="default",children:r,className:h}){const s=G.useContext(k),[a,_]=N.useControllable({value:s&&t!==void 0?void 0:v,defaultValue:s&&t!==void 0?void 0:j??!1,onChange:s&&t!==void 0?void 0:m}),b=s!==null&&t!==void 0,c=b?s.selected===t:a??!1,o=(s?.disabled??!1)||(R??!1);function f(){o||(b?s.select(t):_(!0))}const p=r?l||u?n.jsxRuntimeExports.jsx("label",{htmlFor:l||u,className:C.clsx(i.radioLabel,"cursor-[inherit]"),children:r}):n.jsxRuntimeExports.jsx("div",{className:i.radioText,children:r}):null;return n.jsxRuntimeExports.jsxs("div",{id:l,role:"radio","aria-checked":c,"aria-disabled":o,className:C.clsx(i.radio,"radio",i[x],c&&i.selected,o&&i.disabled,h),onClick:f,children:[n.jsxRuntimeExports.jsx("span",{tabIndex:0,className:i.outerCircle,onKeyUp:e=>{e.key===" "&&f()},children:n.jsxRuntimeExports.jsx("span",{className:C.clsx(i.innerCircle,c&&i.innerCircleActive)})}),p]})}exports.Radio=q;exports.RadioGroup=S;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-u17CrQMm.js";import{useState as k,useEffect as X,useRef as H,useCallback as me}from"react";import{c as q}from"./clsx-B-dksMZM.js";import{useControllable as Ie}from"../hooks/useControllable.es.js";import{f as $,v as Pe}from"./index-C-RplXeX.js";import{L as Fe}from"./Label-AiZCfFq1.js";import{Icon as D}from"../components/Icon/index.es.js";import{S as He}from"./Select-B7JnRTcc.js";import{C as qe}from"./ColorPicker-BsrGOt2x.js";import{B as U}from"./Button-1lnlGEU9.js";import{F as Oe}from"./FloatCard-hzT_yVsi.js";import{D as Ue}from"./Dialog-lFnC79hF.js";import{T as Ge}from"./Tooltip-chSVIpvZ.js";const Ve="_richTextEditor_zftxo_2",Ke="_noBorder_zftxo_2",We="_toolbar_zftxo_2",$e="_toolbarGroup_zftxo_2",Xe="_toolbarBtn_zftxo_2",Ze="_toolbarBtnActive_zftxo_2",Je="_editorContent_zftxo_2",Qe="_focus_zftxo_2",Ye="_disabled_zftxo_2",et="_error_zftxo_2",tt="_errorMessage_zftxo_2",nt="_colorPicker_zftxo_2",ot="_customColorPicker_zftxo_2",rt="_colorColumn_zftxo_2",st="_colorGrid_zftxo_2",ct="_colorRow_zftxo_2",lt="_customRole_zftxo_2",at="_colorOption_zftxo_2",it="_colorDivider_zftxo_2",ut="_addColorBtn_zftxo_2",dt="_customColorActions_zftxo_2",ft="_imageInput_zftxo_2",mt="_linkDialogContent_zftxo_2",ht="_linkInput_zftxo_2",pt="_linkDialogActions_zftxo_2",s={richTextEditor:Ve,noBorder:Ke,toolbar:We,toolbarGroup:$e,toolbarBtn:Xe,toolbarBtnActive:Ze,editorContent:Je,focus:Qe,disabled:Ye,error:et,errorMessage:tt,colorPicker:nt,customColorPicker:ot,colorColumn:rt,colorGrid:st,colorRow:ct,customRole:lt,colorOption:at,colorDivider:it,addColorBtn:ut,customColorActions:dt,imageInput:ft,linkDialogContent:mt,linkInput:ht,linkDialogActions:pt};function gt(i){let m=0,h=0,p=0;if(i.startsWith("rgb(")){const c=i.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);c&&(m=parseInt(c[1]),h=parseInt(c[2]),p=parseInt(c[3]))}else if(i.startsWith("hsl(")){const c=i.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(c){const y=parseInt(c[1])/360,C=parseInt(c[2])/100,A=parseInt(c[3])/100,R=(x,T,N)=>(N<0&&(N+=1),N>1&&(N-=1),N<1/6?x+(T-x)*6*N:N<1/2?T:N<2/3?x+(T-x)*(2/3-N)*6:x);if(C===0)m=h=p=A;else{const x=A<.5?A*(1+C):A+C-A*C,T=2*A-x;m=R(T,x,y+1/3),h=R(T,x,y),p=R(T,x,y-1/3)}m=Math.round(m*255),h=Math.round(h*255),p=Math.round(p*255)}}else if(i.startsWith("#")){const c=i.replace("#","");/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/i.test(c)&&(m=parseInt(c.substring(0,2),16),h=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16))}return(.299*m+.587*h+.114*p)/255<.5?"text-white":"text-black"}function he({color:i,selected:m,onClick:h,className:p}){const d=gt(i);return o.jsx("div",{className:q(s.colorOption,p),style:{backgroundColor:i},onClick:()=>h?.(i),children:m&&o.jsx(D,{name:"check",className:d})})}function Ct(){const i=[],m=[];for(let c=10;c>=0;c--)m.push($("#000000",c/10));i.push(m);const h=["hsl(0, 100%, 50%)","hsl(30, 100%, 50%)","hsl(60, 100%, 50%)","hsl(90, 100%, 50%)","hsl(120, 100%, 50%)","hsl(150, 100%, 50%)","hsl(180, 100%, 50%)","hsl(210, 100%, 50%)","hsl(240, 100%, 50%)","hsl(270, 100%, 50%)","hsl(300, 100%, 50%)"];i.push(h);const p=[];for(let c=0;c<3;c++){const y=[];h.forEach(C=>y.push($(C,c*.2+.2))),p.push(y)}i.push(...p);const d=[];for(let c=2;c>=0;c--){const y=[];h.forEach(C=>y.push($(C,c*.2+.2,[0,0,0]))),d.push(y)}return i.push(...d),i}function pe({value:i,expanded:m,custom:h,onValueChange:p,onExpandedChange:d,onCustomChange:c,children:y}){const[C,A]=k(!1),[R,x]=k(i),[T,N]=k(!1);X(()=>{N(!0)},[]);const G=T?Ct():[];function I(_){p(_),x(_),d(!1)}function v(){p(R),h.includes(R)||c([...h,R]),setTimeout(()=>A(!1))}function n(){setTimeout(()=>A(!1))}return o.jsx(Oe,{value:m,onChange:d,card:o.jsx("div",{className:q(s.colorPicker,C&&s.customColorPicker),children:C?o.jsxs(o.Fragment,{children:[o.jsx(qe,{value:R,onChange:x,noShadow:!0}),o.jsxs("div",{className:s.customColorActions,children:[o.jsx(U,{variant:"plain",color:"neutral",size:"small",onClick:n,children:"Cancel"}),o.jsx(U,{size:"small",onClick:v,children:"Add"})]})]}):o.jsxs("div",{className:s.colorColumn,children:[o.jsx("div",{className:s.colorGrid,children:G.map((_,b)=>o.jsx("div",{className:s.colorRow,children:_.map(g=>o.jsx(he,{color:g,selected:i===g,onClick:I},g))},b))}),o.jsx("hr",{className:s.colorDivider}),o.jsxs("div",{className:q(s.colorRow,s.customRole),children:[o.jsx("div",{className:s.addColorBtn,title:"Add custom color",onClick:()=>A(!0),children:o.jsx(D,{name:"add_circle",className:"text-neutral-interactive-default cursor-pointer"})}),h.map(_=>o.jsx(he,{color:_,selected:i===_,onClick:I},_))]})]})}),children:y})}const xt=["b","i","u","strong","em","br","div","ul","ol","li","blockquote","a","img","span","font"],yt=["style","href","src","alt","title","color"],ge=Array.from({length:10},(i,m)=>m*4+12);function Ce(i){const h=new DOMParser().parseFromString(i,"text/html"),p=document.createElement("div");for(const d of Array.from(h.body.childNodes)){const c=xe(d);c&&p.appendChild(c)}return p.innerHTML}function xe(i){if(i.nodeType===Node.TEXT_NODE)return i;if(i.nodeType!==Node.ELEMENT_NODE)return null;const m=i,h=m.tagName.toLowerCase();if(!xt.includes(h))return document.createTextNode(m.textContent||"");const p=document.createElement(h);for(const d of Array.from(m.attributes))yt.includes(d.name)&&p.setAttribute(d.name,d.value);for(const d of Array.from(m.childNodes)){const c=xe(d);c&&p.appendChild(c)}return p}function _t(i){return i.replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function Bt({value:i,defaultValue:m,onChange:h,placeholder:p,disabled:d=!1,labelValue:c,errorMessage:y,hasError:C=!1,infoMessage:A,required:R=!1,minHeight:x="200px",maxHeight:T="400px",noBorder:N=!1,className:G}){const[I,v]=Ie({value:i,defaultValue:m??"",onChange:h}),n=H(null),_=H(null),b=H([]),g=H(-1),M=H(!1),[Z,J]=k(!1),[ye,_e]=k({}),[be,V]=k(16),[ke,Ne]=k("#000000"),[Q,Y]=k(!1),[Se,je]=k("#ffffff"),[ee,te]=k(!1),[ne,oe]=k([]),[Ae,O]=k(!1),[z,K]=k(""),[re,P]=k(""),w=me(e=>{if(M.current)return;const t=_t(e);b.current[g.current]!==t&&(g.current<b.current.length-1&&(b.current=b.current.slice(0,g.current+1)),b.current.push(t),g.current=b.current.length-1,b.current.length>50&&(b.current.shift(),g.current--))},[]);function B(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);n.current?.contains(t.commonAncestorContainer)&&(_.current=t.cloneRange())}catch{_.current=null}}function F(){try{const e=window.getSelection();if(!_.current||!n.current||!e)return;n.current.focus(),e.removeAllRanges();const t=_.current;if(n.current.contains(t.commonAncestorContainer))e.addRange(t);else{const r=document.createRange();r.setStart(n.current,0),r.collapse(!0),e.addRange(r)}}catch{_.current=null}}function se(e){if(!n.current||!e||e.rangeCount===0)return!1;try{const t=e.getRangeAt(0);return n.current.contains(t.startContainer)&&n.current.contains(t.endContainer)&&n.current.contains(t.commonAncestorContainer)}catch{return!1}}const S=me(()=>{_e({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikeThrough:document.queryCommandState("strikeThrough"),insertUnorderedList:document.queryCommandState("insertUnorderedList"),insertOrderedList:document.queryCommandState("insertOrderedList"),justifyLeft:document.queryCommandState("justifyLeft"),justifyCenter:document.queryCommandState("justifyCenter"),justifyRight:document.queryCommandState("justifyRight"),justifyFull:document.queryCommandState("justifyFull")});const e=window.getSelection();if(!e||e.rangeCount===0||!n.current)return;let t=e.getRangeAt(0).startContainer,r=!1;for(;t&&t!==n.current;){if(t.nodeType===Node.ELEMENT_NODE){const a=window.getComputedStyle(t),u=parseInt(a.fontSize),l=ge.find(f=>Math.abs(f-u)<=1);if(l){V(l),r=!0;break}}t=t.parentNode}r||V(16)},[]);function ce(){if(!n.current)return;const e=getComputedStyle(n.current).getPropertyValue("--spacing-base");n.current.querySelectorAll("ul, ol").forEach(t=>{const r=t;r.style.listStyleType=t.tagName.toLowerCase()==="ul"?"disc":"decimal",r.style.paddingLeft=e,r.style.listStylePosition="outside"}),n.current.querySelectorAll("li").forEach(t=>{t.style.display="list-item",t.style.listStylePosition="outside"})}function le(e){if(!n.current||!e.length)return;const t=getComputedStyle(n.current),r=t.getPropertyValue("--border-width-sm"),a=t.getPropertyValue("--primary-border-default"),u=t.getPropertyValue("--primary-surface-default"),l=t.getPropertyValue("--spacing-base"),f=t.getPropertyValue("--spacing-xxs"),E=t.getPropertyValue("--border-radius-sm");e.forEach(L=>{L.style.borderLeft=`${r} solid ${a}`,L.style.fontStyle="italic",L.style.backgroundColor=u,L.style.padding=l,L.style.margin=`${f} 0`,L.style.borderRadius=`0 ${E} ${E} 0`,L.style.position="relative"})}function ae(){requestAnimationFrame(()=>{if(!n.current)return;ce();const e=n.current.querySelectorAll("blockquote");e.length&&le(Array.from(e))})}X(()=>{n.current&&(n.current.innerHTML=Ce(I??""),ae(),w(I??""))},[]),X(()=>{!n.current||n.current.innerHTML===i||(n.current.innerHTML=Ce(i??""),ae())},[i]);function Re(e,t){const r=window.getSelection();if(!(d||!n.current||!se(r))){F();try{document.execCommand(e,!1,t)}catch{}if(n.current?.focus(),S(),(e==="insertUnorderedList"||e==="insertOrderedList")&&setTimeout(()=>ce()),n.current){const a=n.current.innerHTML;v(a),w(a)}}}function Te(e){if(d||!n.current)return;const t=typeof e=="object"?e.value:e;F();const r=window.getSelection();if(!r||r.rangeCount===0)return;const a=r.getRangeAt(0);if(a.collapsed){const l=document.createElement("span");l.style.fontSize=t+"px",l.textContent="",a.insertNode(l),a.setStartAfter(l),a.collapse(!0)}else{const l=a.extractContents(),f=document.createElement("span");f.style.fontSize=t+"px",f.appendChild(l),a.insertNode(f),a.selectNodeContents(f)}r.removeAllRanges(),r.addRange(a),n.current.focus(),V(t);const u=n.current.innerHTML;v(u),w(u),S()}function ie(e,t){if(!window.getSelection()||d||!n.current)return;F();try{document.execCommand(t,!1,e)}catch{}n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}function ue(){if(g.current<=0||!n.current)return;M.current=!0,g.current--;const e=b.current[g.current];n.current.innerHTML=e,v(e),M.current=!1,n.current.focus(),S()}function de(){if(g.current>=b.current.length-1||!n.current)return;M.current=!0,g.current++;const e=b.current[g.current];n.current.innerHTML=e,v(e),M.current=!1,n.current.focus(),S()}function ve(){if(d)return;B();const e=window.getSelection();e&&!e.isCollapsed&&Z?P(e.toString()):P(""),O(!0)}function W(){if(!(!z.trim()||!Pe(z.trim())))try{F();const e=window.getSelection();if(!e||!n.current)return;let t;e.rangeCount===0?(t=document.createRange(),n.current.lastChild?t.setStartAfter(n.current.lastChild):t.setStart(n.current,0),t.collapse(!0)):t=e.getRangeAt(0);const r=document.createElement("a");r.href=z.trim(),r.target="_blank",r.rel="noopener noreferrer",r.textContent=re.trim()||z.trim(),t.collapsed||t.deleteContents(),t.insertNode(r),t.setStartAfter(r),t.collapse(!0),e.removeAllRanges(),e.addRange(t),O(!1),K(""),P(""),n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}catch{}}function Le(e){const t=e.target.files;!t||!n.current||(Array.from(t).forEach(r=>{if(n.current)try{const a=URL.createObjectURL(r);F();const u=window.getSelection();if(!u)return;let l;u.rangeCount===0?(l=document.createRange(),n.current.lastChild?l.setStartAfter(n.current.lastChild):l.setStart(n.current,0),l.collapse(!0)):l=u.getRangeAt(0);const f=document.createElement("img"),E=getComputedStyle(n.current);f.src=a,f.alt=r.name,f.style.maxWidth="100%",f.style.height="auto",f.style.borderRadius=E.getPropertyValue("--border-radius-sm"),f.style.margin=E.getPropertyValue("--spacing-base"),l.collapsed||l.deleteContents(),l.insertNode(f),l.setStartAfter(f),l.collapse(!0),u.removeAllRanges(),u.addRange(l),n.current.focus();const L=n.current.innerHTML;v(L),w(L),S()}catch{}}),e.target.value="")}function we(){if(d||!n.current)return;const e=window.getSelection();if(!(!e||e.rangeCount===0))try{const t=e.getRangeAt(0),r=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement?.closest("blockquote"):t.startContainer?.closest?.("blockquote");if(r){const u=r.parentNode;if(!u)return;const l=document.createElement("div");l.innerHTML=r.innerHTML,u.replaceChild(l,r);const f=document.createRange();f.selectNodeContents(l),e.removeAllRanges(),e.addRange(f)}else{const u=document.createElement("blockquote");if(le([u]),t.collapsed)u.innerHTML="Type your quote here...";else{const f=t.extractContents();if(f.childNodes.length===1&&f.firstChild?.nodeType===Node.TEXT_NODE){const E=document.createElement("span");E.appendChild(f),u.appendChild(E)}else u.appendChild(f)}t.insertNode(u);const l=document.createRange();l.selectNodeContents(u),e.removeAllRanges(),e.addRange(l)}n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}catch{}}function fe(){if(M.current||!n.current)return;const e=n.current.innerHTML;v(e),w(e),S()}function Ee(e){if(!d){if(e.ctrlKey&&!e.shiftKey&&e.key==="z"){e.preventDefault(),ue();return}if(e.ctrlKey&&(e.shiftKey&&e.key==="Z"||e.key==="y")){e.preventDefault(),de();return}if(e.key==="Tab"){e.preventDefault();const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0);let a=r.startContainer,u=!1;for(;a&&a!==n.current;){if(a.nodeType===Node.ELEMENT_NODE){const l=a.tagName?.toLowerCase();if(["li","ul","ol"].includes(l)){u=!0;break}}a=a.parentNode}if(u&&!e.shiftKey)document.execCommand("indent",!1);else if(u&&e.shiftKey)document.execCommand("outdent",!1);else if(!e.shiftKey){const l=document.createElement("span");l.classList.add("tab"),l.innerHTML=" ",r.deleteContents(),r.insertNode(l),r.setStartAfter(l)}}["Enter","Tab","Backspace"].includes(e.key)&&(fe(),S())}}function De(){J(!0),S()}function Be(){J(!1)}function Me(e){if(d)return;const t=window.getSelection();se(t)||e.preventDefault()}function j(e,t,r,a){return o.jsx(Ge,{position:"bottom",labelValue:r,children:o.jsx("button",{className:q(s.toolbarBtn,ye[e]&&s.toolbarBtnActive),title:r,onMouseDown:u=>{u.preventDefault(),B()},onClick:()=>a?a():Re(e),children:o.jsx(D,{name:t})},e)})}const ze=q(s.richTextEditor,Z&&s.focus,d&&s.disabled,C&&s.error,N&&s.noBorder,G);return o.jsxs("div",{className:ze,children:[c&&o.jsx(Fe,{labelValue:c,infoMessage:A,required:R,className:"mb-xxs"}),o.jsxs("div",{className:s.toolbar,children:[o.jsxs("div",{className:s.toolbarGroup,children:[o.jsx("button",{className:s.toolbarBtn,title:"Undo (Ctrl+Z)",disabled:g.current<=0,onMouseDown:e=>e.preventDefault(),onClick:ue,children:o.jsx(D,{name:"undo"})}),o.jsx("button",{className:s.toolbarBtn,title:"Redo (Ctrl+Y)",disabled:g.current>=b.current.length-1,onMouseDown:e=>e.preventDefault(),onClick:de,children:o.jsx(D,{name:"redo"})})]}),o.jsx("div",{className:s.toolbarGroup,children:o.jsx(He,{value:be,onChange:Te,options:ge.map(e=>({label:String(e),value:e})),disabled:d})}),o.jsxs("div",{className:s.toolbarGroup,children:[j("bold","format_bold","Bold (Ctrl+B)"),j("italic","format_italic","Italic (Ctrl+I)"),j("underline","format_underlined","Underline (Ctrl+U)"),j("strikeThrough","strikethrough_s","Strikethrough")]}),o.jsxs("div",{className:s.toolbarGroup,children:[o.jsx(pe,{value:ke,expanded:Q,custom:ne,onValueChange:e=>{Ne(e),ie(e,"foreColor")},onExpandedChange:e=>{e&&B(),Y(e)},onCustomChange:oe,children:o.jsx("button",{className:s.toolbarBtn,title:"Text color",onMouseDown:e=>{e.preventDefault(),B()},onClick:()=>Y(!Q),children:o.jsx(D,{name:"format_color_text"})})}),o.jsx(pe,{value:Se,expanded:ee,custom:ne,onValueChange:e=>{je(e),ie(e,"backColor")},onExpandedChange:e=>{e&&B(),te(e)},onCustomChange:oe,children:o.jsx("button",{className:s.toolbarBtn,title:"Background color",onMouseDown:e=>{e.preventDefault(),B()},onClick:()=>te(!ee),children:o.jsx(D,{name:"format_color_fill"})})})]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("insertUnorderedList","format_list_bulleted","Bulleted list"),j("insertOrderedList","format_list_numbered","Numbered list")]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("justifyLeft","format_align_left","Align left"),j("justifyCenter","format_align_center","Align center"),j("justifyRight","format_align_right","Align right"),j("justifyFull","format_align_justify","Justify")]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("createLink","link","Insert link",ve),o.jsxs("button",{className:s.toolbarBtn,title:"Insert image",onMouseDown:e=>{e.preventDefault(),B()},children:[o.jsx(D,{name:"image"}),o.jsx("input",{type:"file",accept:"image/*",className:s.imageInput,onChange:Le})]}),j("insertBlockquote","format_quote","Quote",we)]}),o.jsx("div",{className:s.toolbarGroup,children:j("removeFormat","format_clear","Remove formatting")})]}),o.jsx("div",{ref:n,className:s.editorContent,role:"textbox",style:{minHeight:x,maxHeight:T},contentEditable:!d,"data-placeholder":p,"aria-label":c,"aria-required":R,"aria-invalid":C,onInput:fe,onFocus:De,onBlur:Be,onKeyDown:Ee,onKeyUp:S,onMouseUp:S,onPaste:Me}),o.jsx(Ue,{value:Ae,onChange:O,children:o.jsxs("div",{className:s.linkDialogContent,children:[o.jsx("input",{type:"text",placeholder:"URL (e.g. https://example.com)",value:z,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput,autoFocus:!0}),o.jsx("input",{type:"text",placeholder:"Link text (optional)",value:re,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput}),o.jsxs("div",{className:s.linkDialogActions,children:[o.jsx(U,{className:s.linkCancelBtn,variant:"plain",color:"neutral",onClick:()=>{O(!1),K(""),P("")},children:"Cancel"}),o.jsx(U,{className:s.linkInsertBtn,disabled:!z.trim(),onClick:W,children:"Insert Link"})]})]})}),C&&y&&o.jsx("small",{className:s.errorMessage,children:y})]})}export{Bt as R};
|
|
1
|
+
import{j as o}from"./jsx-runtime-u17CrQMm.js";import{useState as k,useEffect as X,useRef as H,useCallback as me}from"react";import{c as q}from"./clsx-B-dksMZM.js";import{useControllable as Ie}from"../hooks/useControllable.es.js";import{f as $,v as Pe}from"./index-C-RplXeX.js";import{L as Fe}from"./Label-Cf7QR6aU.js";import{Icon as D}from"../components/Icon/index.es.js";import{S as He}from"./Select-ClQjvlOH.js";import{C as qe}from"./ColorPicker-Bzm0PUlr.js";import{B as U}from"./Button-Dwf5lfho.js";import{F as Oe}from"./FloatCard-DFWCAqct.js";import{D as Ue}from"./Dialog-CANR3qfF.js";import{T as Ge}from"./Tooltip-pqZN7nfJ.js";const Ve="_richTextEditor_zftxo_2",Ke="_noBorder_zftxo_2",We="_toolbar_zftxo_2",$e="_toolbarGroup_zftxo_2",Xe="_toolbarBtn_zftxo_2",Ze="_toolbarBtnActive_zftxo_2",Je="_editorContent_zftxo_2",Qe="_focus_zftxo_2",Ye="_disabled_zftxo_2",et="_error_zftxo_2",tt="_errorMessage_zftxo_2",nt="_colorPicker_zftxo_2",ot="_customColorPicker_zftxo_2",rt="_colorColumn_zftxo_2",st="_colorGrid_zftxo_2",ct="_colorRow_zftxo_2",lt="_customRole_zftxo_2",at="_colorOption_zftxo_2",it="_colorDivider_zftxo_2",ut="_addColorBtn_zftxo_2",dt="_customColorActions_zftxo_2",ft="_imageInput_zftxo_2",mt="_linkDialogContent_zftxo_2",ht="_linkInput_zftxo_2",pt="_linkDialogActions_zftxo_2",s={richTextEditor:Ve,noBorder:Ke,toolbar:We,toolbarGroup:$e,toolbarBtn:Xe,toolbarBtnActive:Ze,editorContent:Je,focus:Qe,disabled:Ye,error:et,errorMessage:tt,colorPicker:nt,customColorPicker:ot,colorColumn:rt,colorGrid:st,colorRow:ct,customRole:lt,colorOption:at,colorDivider:it,addColorBtn:ut,customColorActions:dt,imageInput:ft,linkDialogContent:mt,linkInput:ht,linkDialogActions:pt};function gt(i){let m=0,h=0,p=0;if(i.startsWith("rgb(")){const c=i.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);c&&(m=parseInt(c[1]),h=parseInt(c[2]),p=parseInt(c[3]))}else if(i.startsWith("hsl(")){const c=i.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(c){const y=parseInt(c[1])/360,C=parseInt(c[2])/100,A=parseInt(c[3])/100,R=(x,T,N)=>(N<0&&(N+=1),N>1&&(N-=1),N<1/6?x+(T-x)*6*N:N<1/2?T:N<2/3?x+(T-x)*(2/3-N)*6:x);if(C===0)m=h=p=A;else{const x=A<.5?A*(1+C):A+C-A*C,T=2*A-x;m=R(T,x,y+1/3),h=R(T,x,y),p=R(T,x,y-1/3)}m=Math.round(m*255),h=Math.round(h*255),p=Math.round(p*255)}}else if(i.startsWith("#")){const c=i.replace("#","");/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/i.test(c)&&(m=parseInt(c.substring(0,2),16),h=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16))}return(.299*m+.587*h+.114*p)/255<.5?"text-white":"text-black"}function he({color:i,selected:m,onClick:h,className:p}){const d=gt(i);return o.jsx("div",{className:q(s.colorOption,p),style:{backgroundColor:i},onClick:()=>h?.(i),children:m&&o.jsx(D,{name:"check",className:d})})}function Ct(){const i=[],m=[];for(let c=10;c>=0;c--)m.push($("#000000",c/10));i.push(m);const h=["hsl(0, 100%, 50%)","hsl(30, 100%, 50%)","hsl(60, 100%, 50%)","hsl(90, 100%, 50%)","hsl(120, 100%, 50%)","hsl(150, 100%, 50%)","hsl(180, 100%, 50%)","hsl(210, 100%, 50%)","hsl(240, 100%, 50%)","hsl(270, 100%, 50%)","hsl(300, 100%, 50%)"];i.push(h);const p=[];for(let c=0;c<3;c++){const y=[];h.forEach(C=>y.push($(C,c*.2+.2))),p.push(y)}i.push(...p);const d=[];for(let c=2;c>=0;c--){const y=[];h.forEach(C=>y.push($(C,c*.2+.2,[0,0,0]))),d.push(y)}return i.push(...d),i}function pe({value:i,expanded:m,custom:h,onValueChange:p,onExpandedChange:d,onCustomChange:c,children:y}){const[C,A]=k(!1),[R,x]=k(i),[T,N]=k(!1);X(()=>{N(!0)},[]);const G=T?Ct():[];function I(_){p(_),x(_),d(!1)}function v(){p(R),h.includes(R)||c([...h,R]),setTimeout(()=>A(!1))}function n(){setTimeout(()=>A(!1))}return o.jsx(Oe,{value:m,onChange:d,card:o.jsx("div",{className:q(s.colorPicker,C&&s.customColorPicker),children:C?o.jsxs(o.Fragment,{children:[o.jsx(qe,{value:R,onChange:x,noShadow:!0}),o.jsxs("div",{className:s.customColorActions,children:[o.jsx(U,{variant:"plain",color:"neutral",size:"small",onClick:n,children:"Cancel"}),o.jsx(U,{size:"small",onClick:v,children:"Add"})]})]}):o.jsxs("div",{className:s.colorColumn,children:[o.jsx("div",{className:s.colorGrid,children:G.map((_,b)=>o.jsx("div",{className:s.colorRow,children:_.map(g=>o.jsx(he,{color:g,selected:i===g,onClick:I},g))},b))}),o.jsx("hr",{className:s.colorDivider}),o.jsxs("div",{className:q(s.colorRow,s.customRole),children:[o.jsx("div",{className:s.addColorBtn,title:"Add custom color",onClick:()=>A(!0),children:o.jsx(D,{name:"add_circle",className:"text-neutral-interactive-default cursor-pointer"})}),h.map(_=>o.jsx(he,{color:_,selected:i===_,onClick:I},_))]})]})}),children:y})}const xt=["b","i","u","strong","em","br","div","ul","ol","li","blockquote","a","img","span","font"],yt=["style","href","src","alt","title","color"],ge=Array.from({length:10},(i,m)=>m*4+12);function Ce(i){const h=new DOMParser().parseFromString(i,"text/html"),p=document.createElement("div");for(const d of Array.from(h.body.childNodes)){const c=xe(d);c&&p.appendChild(c)}return p.innerHTML}function xe(i){if(i.nodeType===Node.TEXT_NODE)return i;if(i.nodeType!==Node.ELEMENT_NODE)return null;const m=i,h=m.tagName.toLowerCase();if(!xt.includes(h))return document.createTextNode(m.textContent||"");const p=document.createElement(h);for(const d of Array.from(m.attributes))yt.includes(d.name)&&p.setAttribute(d.name,d.value);for(const d of Array.from(m.childNodes)){const c=xe(d);c&&p.appendChild(c)}return p}function _t(i){return i.replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function Bt({value:i,defaultValue:m,onChange:h,placeholder:p,disabled:d=!1,labelValue:c,errorMessage:y,hasError:C=!1,infoMessage:A,required:R=!1,minHeight:x="200px",maxHeight:T="400px",noBorder:N=!1,className:G}){const[I,v]=Ie({value:i,defaultValue:m??"",onChange:h}),n=H(null),_=H(null),b=H([]),g=H(-1),M=H(!1),[Z,J]=k(!1),[ye,_e]=k({}),[be,V]=k(16),[ke,Ne]=k("#000000"),[Q,Y]=k(!1),[Se,je]=k("#ffffff"),[ee,te]=k(!1),[ne,oe]=k([]),[Ae,O]=k(!1),[z,K]=k(""),[re,P]=k(""),w=me(e=>{if(M.current)return;const t=_t(e);b.current[g.current]!==t&&(g.current<b.current.length-1&&(b.current=b.current.slice(0,g.current+1)),b.current.push(t),g.current=b.current.length-1,b.current.length>50&&(b.current.shift(),g.current--))},[]);function B(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);n.current?.contains(t.commonAncestorContainer)&&(_.current=t.cloneRange())}catch{_.current=null}}function F(){try{const e=window.getSelection();if(!_.current||!n.current||!e)return;n.current.focus(),e.removeAllRanges();const t=_.current;if(n.current.contains(t.commonAncestorContainer))e.addRange(t);else{const r=document.createRange();r.setStart(n.current,0),r.collapse(!0),e.addRange(r)}}catch{_.current=null}}function se(e){if(!n.current||!e||e.rangeCount===0)return!1;try{const t=e.getRangeAt(0);return n.current.contains(t.startContainer)&&n.current.contains(t.endContainer)&&n.current.contains(t.commonAncestorContainer)}catch{return!1}}const S=me(()=>{_e({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikeThrough:document.queryCommandState("strikeThrough"),insertUnorderedList:document.queryCommandState("insertUnorderedList"),insertOrderedList:document.queryCommandState("insertOrderedList"),justifyLeft:document.queryCommandState("justifyLeft"),justifyCenter:document.queryCommandState("justifyCenter"),justifyRight:document.queryCommandState("justifyRight"),justifyFull:document.queryCommandState("justifyFull")});const e=window.getSelection();if(!e||e.rangeCount===0||!n.current)return;let t=e.getRangeAt(0).startContainer,r=!1;for(;t&&t!==n.current;){if(t.nodeType===Node.ELEMENT_NODE){const a=window.getComputedStyle(t),u=parseInt(a.fontSize),l=ge.find(f=>Math.abs(f-u)<=1);if(l){V(l),r=!0;break}}t=t.parentNode}r||V(16)},[]);function ce(){if(!n.current)return;const e=getComputedStyle(n.current).getPropertyValue("--spacing-base");n.current.querySelectorAll("ul, ol").forEach(t=>{const r=t;r.style.listStyleType=t.tagName.toLowerCase()==="ul"?"disc":"decimal",r.style.paddingLeft=e,r.style.listStylePosition="outside"}),n.current.querySelectorAll("li").forEach(t=>{t.style.display="list-item",t.style.listStylePosition="outside"})}function le(e){if(!n.current||!e.length)return;const t=getComputedStyle(n.current),r=t.getPropertyValue("--border-width-sm"),a=t.getPropertyValue("--primary-border-default"),u=t.getPropertyValue("--primary-surface-default"),l=t.getPropertyValue("--spacing-base"),f=t.getPropertyValue("--spacing-xxs"),E=t.getPropertyValue("--border-radius-sm");e.forEach(L=>{L.style.borderLeft=`${r} solid ${a}`,L.style.fontStyle="italic",L.style.backgroundColor=u,L.style.padding=l,L.style.margin=`${f} 0`,L.style.borderRadius=`0 ${E} ${E} 0`,L.style.position="relative"})}function ae(){requestAnimationFrame(()=>{if(!n.current)return;ce();const e=n.current.querySelectorAll("blockquote");e.length&&le(Array.from(e))})}X(()=>{n.current&&(n.current.innerHTML=Ce(I??""),ae(),w(I??""))},[]),X(()=>{!n.current||n.current.innerHTML===i||(n.current.innerHTML=Ce(i??""),ae())},[i]);function Re(e,t){const r=window.getSelection();if(!(d||!n.current||!se(r))){F();try{document.execCommand(e,!1,t)}catch{}if(n.current?.focus(),S(),(e==="insertUnorderedList"||e==="insertOrderedList")&&setTimeout(()=>ce()),n.current){const a=n.current.innerHTML;v(a),w(a)}}}function Te(e){if(d||!n.current)return;const t=typeof e=="object"?e.value:e;F();const r=window.getSelection();if(!r||r.rangeCount===0)return;const a=r.getRangeAt(0);if(a.collapsed){const l=document.createElement("span");l.style.fontSize=t+"px",l.textContent="",a.insertNode(l),a.setStartAfter(l),a.collapse(!0)}else{const l=a.extractContents(),f=document.createElement("span");f.style.fontSize=t+"px",f.appendChild(l),a.insertNode(f),a.selectNodeContents(f)}r.removeAllRanges(),r.addRange(a),n.current.focus(),V(t);const u=n.current.innerHTML;v(u),w(u),S()}function ie(e,t){if(!window.getSelection()||d||!n.current)return;F();try{document.execCommand(t,!1,e)}catch{}n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}function ue(){if(g.current<=0||!n.current)return;M.current=!0,g.current--;const e=b.current[g.current];n.current.innerHTML=e,v(e),M.current=!1,n.current.focus(),S()}function de(){if(g.current>=b.current.length-1||!n.current)return;M.current=!0,g.current++;const e=b.current[g.current];n.current.innerHTML=e,v(e),M.current=!1,n.current.focus(),S()}function ve(){if(d)return;B();const e=window.getSelection();e&&!e.isCollapsed&&Z?P(e.toString()):P(""),O(!0)}function W(){if(!(!z.trim()||!Pe(z.trim())))try{F();const e=window.getSelection();if(!e||!n.current)return;let t;e.rangeCount===0?(t=document.createRange(),n.current.lastChild?t.setStartAfter(n.current.lastChild):t.setStart(n.current,0),t.collapse(!0)):t=e.getRangeAt(0);const r=document.createElement("a");r.href=z.trim(),r.target="_blank",r.rel="noopener noreferrer",r.textContent=re.trim()||z.trim(),t.collapsed||t.deleteContents(),t.insertNode(r),t.setStartAfter(r),t.collapse(!0),e.removeAllRanges(),e.addRange(t),O(!1),K(""),P(""),n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}catch{}}function Le(e){const t=e.target.files;!t||!n.current||(Array.from(t).forEach(r=>{if(n.current)try{const a=URL.createObjectURL(r);F();const u=window.getSelection();if(!u)return;let l;u.rangeCount===0?(l=document.createRange(),n.current.lastChild?l.setStartAfter(n.current.lastChild):l.setStart(n.current,0),l.collapse(!0)):l=u.getRangeAt(0);const f=document.createElement("img"),E=getComputedStyle(n.current);f.src=a,f.alt=r.name,f.style.maxWidth="100%",f.style.height="auto",f.style.borderRadius=E.getPropertyValue("--border-radius-sm"),f.style.margin=E.getPropertyValue("--spacing-base"),l.collapsed||l.deleteContents(),l.insertNode(f),l.setStartAfter(f),l.collapse(!0),u.removeAllRanges(),u.addRange(l),n.current.focus();const L=n.current.innerHTML;v(L),w(L),S()}catch{}}),e.target.value="")}function we(){if(d||!n.current)return;const e=window.getSelection();if(!(!e||e.rangeCount===0))try{const t=e.getRangeAt(0),r=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement?.closest("blockquote"):t.startContainer?.closest?.("blockquote");if(r){const u=r.parentNode;if(!u)return;const l=document.createElement("div");l.innerHTML=r.innerHTML,u.replaceChild(l,r);const f=document.createRange();f.selectNodeContents(l),e.removeAllRanges(),e.addRange(f)}else{const u=document.createElement("blockquote");if(le([u]),t.collapsed)u.innerHTML="Type your quote here...";else{const f=t.extractContents();if(f.childNodes.length===1&&f.firstChild?.nodeType===Node.TEXT_NODE){const E=document.createElement("span");E.appendChild(f),u.appendChild(E)}else u.appendChild(f)}t.insertNode(u);const l=document.createRange();l.selectNodeContents(u),e.removeAllRanges(),e.addRange(l)}n.current.focus();const a=n.current.innerHTML;v(a),w(a),S()}catch{}}function fe(){if(M.current||!n.current)return;const e=n.current.innerHTML;v(e),w(e),S()}function Ee(e){if(!d){if(e.ctrlKey&&!e.shiftKey&&e.key==="z"){e.preventDefault(),ue();return}if(e.ctrlKey&&(e.shiftKey&&e.key==="Z"||e.key==="y")){e.preventDefault(),de();return}if(e.key==="Tab"){e.preventDefault();const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0);let a=r.startContainer,u=!1;for(;a&&a!==n.current;){if(a.nodeType===Node.ELEMENT_NODE){const l=a.tagName?.toLowerCase();if(["li","ul","ol"].includes(l)){u=!0;break}}a=a.parentNode}if(u&&!e.shiftKey)document.execCommand("indent",!1);else if(u&&e.shiftKey)document.execCommand("outdent",!1);else if(!e.shiftKey){const l=document.createElement("span");l.classList.add("tab"),l.innerHTML=" ",r.deleteContents(),r.insertNode(l),r.setStartAfter(l)}}["Enter","Tab","Backspace"].includes(e.key)&&(fe(),S())}}function De(){J(!0),S()}function Be(){J(!1)}function Me(e){if(d)return;const t=window.getSelection();se(t)||e.preventDefault()}function j(e,t,r,a){return o.jsx(Ge,{position:"bottom",labelValue:r,children:o.jsx("button",{className:q(s.toolbarBtn,ye[e]&&s.toolbarBtnActive),title:r,onMouseDown:u=>{u.preventDefault(),B()},onClick:()=>a?a():Re(e),children:o.jsx(D,{name:t})},e)})}const ze=q(s.richTextEditor,"rich-text-editor",Z&&s.focus,d&&s.disabled,C&&s.error,N&&s.noBorder,G);return o.jsxs("div",{className:ze,children:[c&&o.jsx(Fe,{labelValue:c,infoMessage:A,required:R,className:"mb-xxs"}),o.jsxs("div",{className:s.toolbar,children:[o.jsxs("div",{className:s.toolbarGroup,children:[o.jsx("button",{className:s.toolbarBtn,title:"Undo (Ctrl+Z)",disabled:g.current<=0,onMouseDown:e=>e.preventDefault(),onClick:ue,children:o.jsx(D,{name:"undo"})}),o.jsx("button",{className:s.toolbarBtn,title:"Redo (Ctrl+Y)",disabled:g.current>=b.current.length-1,onMouseDown:e=>e.preventDefault(),onClick:de,children:o.jsx(D,{name:"redo"})})]}),o.jsx("div",{className:s.toolbarGroup,children:o.jsx(He,{value:be,onChange:Te,options:ge.map(e=>({label:String(e),value:e})),disabled:d})}),o.jsxs("div",{className:s.toolbarGroup,children:[j("bold","format_bold","Bold (Ctrl+B)"),j("italic","format_italic","Italic (Ctrl+I)"),j("underline","format_underlined","Underline (Ctrl+U)"),j("strikeThrough","strikethrough_s","Strikethrough")]}),o.jsxs("div",{className:s.toolbarGroup,children:[o.jsx(pe,{value:ke,expanded:Q,custom:ne,onValueChange:e=>{Ne(e),ie(e,"foreColor")},onExpandedChange:e=>{e&&B(),Y(e)},onCustomChange:oe,children:o.jsx("button",{className:s.toolbarBtn,title:"Text color",onMouseDown:e=>{e.preventDefault(),B()},onClick:()=>Y(!Q),children:o.jsx(D,{name:"format_color_text"})})}),o.jsx(pe,{value:Se,expanded:ee,custom:ne,onValueChange:e=>{je(e),ie(e,"backColor")},onExpandedChange:e=>{e&&B(),te(e)},onCustomChange:oe,children:o.jsx("button",{className:s.toolbarBtn,title:"Background color",onMouseDown:e=>{e.preventDefault(),B()},onClick:()=>te(!ee),children:o.jsx(D,{name:"format_color_fill"})})})]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("insertUnorderedList","format_list_bulleted","Bulleted list"),j("insertOrderedList","format_list_numbered","Numbered list")]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("justifyLeft","format_align_left","Align left"),j("justifyCenter","format_align_center","Align center"),j("justifyRight","format_align_right","Align right"),j("justifyFull","format_align_justify","Justify")]}),o.jsxs("div",{className:s.toolbarGroup,children:[j("createLink","link","Insert link",ve),o.jsxs("button",{className:s.toolbarBtn,title:"Insert image",onMouseDown:e=>{e.preventDefault(),B()},children:[o.jsx(D,{name:"image"}),o.jsx("input",{type:"file",accept:"image/*",className:s.imageInput,onChange:Le})]}),j("insertBlockquote","format_quote","Quote",we)]}),o.jsx("div",{className:s.toolbarGroup,children:j("removeFormat","format_clear","Remove formatting")})]}),o.jsx("div",{ref:n,className:s.editorContent,role:"textbox",style:{minHeight:x,maxHeight:T},contentEditable:!d,"data-placeholder":p,"aria-label":c,"aria-required":R,"aria-invalid":C,onInput:fe,onFocus:De,onBlur:Be,onKeyDown:Ee,onKeyUp:S,onMouseUp:S,onPaste:Me}),o.jsx(Ue,{value:Ae,onChange:O,children:o.jsxs("div",{className:s.linkDialogContent,children:[o.jsx("input",{type:"text",placeholder:"URL (e.g. https://example.com)",value:z,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput,autoFocus:!0}),o.jsx("input",{type:"text",placeholder:"Link text (optional)",value:re,onChange:e=>P(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput}),o.jsxs("div",{className:s.linkDialogActions,children:[o.jsx(U,{className:s.linkCancelBtn,variant:"plain",color:"neutral",onClick:()=>{O(!1),K(""),P("")},children:"Cancel"}),o.jsx(U,{className:s.linkInsertBtn,disabled:!z.trim(),onClick:W,children:"Insert Link"})]})]})}),C&&y&&o.jsx("small",{className:s.errorMessage,children:y})]})}export{Bt as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./jsx-runtime-BubrbI3X.js"),h=require("react"),F=require("./clsx-C11secjj.js"),Ie=require("../hooks/useControllable.cjs.js"),O=require("./index-B4fH-h2h.js"),Be=require("./Label-DhQPcDeH.js"),D=require("../components/Icon/index.cjs.js"),Me=require("./Select-Bqw3ZPOg.js"),ze=require("./ColorPicker-C8kkPONG.js"),U=require("./Button-PxUMi4c4.js"),qe=require("./FloatCard-CpyZ6Sv2.js"),Pe=require("./Dialog-TzFU7H7M.js"),Fe=require("./Tooltip-DVq7Ij0P.js"),He="_richTextEditor_zftxo_2",Oe="_noBorder_zftxo_2",Ue="_toolbar_zftxo_2",Ge="_toolbarGroup_zftxo_2",Ve="_toolbarBtn_zftxo_2",Ke="_toolbarBtnActive_zftxo_2",We="_editorContent_zftxo_2",$e="_focus_zftxo_2",Xe="_disabled_zftxo_2",Ze="_error_zftxo_2",Je="_errorMessage_zftxo_2",Qe="_colorPicker_zftxo_2",Ye="_customColorPicker_zftxo_2",et="_colorColumn_zftxo_2",tt="_colorGrid_zftxo_2",nt="_colorRow_zftxo_2",ot="_customRole_zftxo_2",rt="_colorOption_zftxo_2",st="_colorDivider_zftxo_2",ct="_addColorBtn_zftxo_2",it="_customColorActions_zftxo_2",lt="_imageInput_zftxo_2",at="_linkDialogContent_zftxo_2",ut="_linkInput_zftxo_2",dt="_linkDialogActions_zftxo_2",s={richTextEditor:He,noBorder:Oe,toolbar:Ue,toolbarGroup:Ge,toolbarBtn:Ve,toolbarBtnActive:Ke,editorContent:We,focus:$e,disabled:Xe,error:Ze,errorMessage:Je,colorPicker:Qe,customColorPicker:Ye,colorColumn:et,colorGrid:tt,colorRow:nt,customRole:ot,colorOption:rt,colorDivider:st,addColorBtn:ct,customColorActions:it,imageInput:lt,linkDialogContent:at,linkInput:ut,linkDialogActions:dt};function mt(a){let f=0,x=0,p=0;if(a.startsWith("rgb(")){const c=a.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);c&&(f=parseInt(c[1]),x=parseInt(c[2]),p=parseInt(c[3]))}else if(a.startsWith("hsl(")){const c=a.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(c){const j=parseInt(c[1])/360,C=parseInt(c[2])/100,S=parseInt(c[3])/100,N=(y,A,E)=>(E<0&&(E+=1),E>1&&(E-=1),E<1/6?y+(A-y)*6*E:E<1/2?A:E<2/3?y+(A-y)*(2/3-E)*6:y);if(C===0)f=x=p=S;else{const y=S<.5?S*(1+C):S+C-S*C,A=2*S-y;f=N(A,y,j+1/3),x=N(A,y,j),p=N(A,y,j-1/3)}f=Math.round(f*255),x=Math.round(x*255),p=Math.round(p*255)}}else if(a.startsWith("#")){const c=a.replace("#","");/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/i.test(c)&&(f=parseInt(c.substring(0,2),16),x=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16))}return(.299*f+.587*x+.114*p)/255<.5?"text-white":"text-black"}function de({color:a,selected:f,onClick:x,className:p}){const d=mt(a);return o.jsxRuntimeExports.jsx("div",{className:F.clsx(s.colorOption,p),style:{backgroundColor:a},onClick:()=>x?.(a),children:f&&o.jsxRuntimeExports.jsx(D.Icon,{name:"check",className:d})})}function ft(){const a=[],f=[];for(let c=10;c>=0;c--)f.push(O.blendColors("#000000",c/10));a.push(f);const x=["hsl(0, 100%, 50%)","hsl(30, 100%, 50%)","hsl(60, 100%, 50%)","hsl(90, 100%, 50%)","hsl(120, 100%, 50%)","hsl(150, 100%, 50%)","hsl(180, 100%, 50%)","hsl(210, 100%, 50%)","hsl(240, 100%, 50%)","hsl(270, 100%, 50%)","hsl(300, 100%, 50%)"];a.push(x);const p=[];for(let c=0;c<3;c++){const j=[];x.forEach(C=>j.push(O.blendColors(C,c*.2+.2))),p.push(j)}a.push(...p);const d=[];for(let c=2;c>=0;c--){const j=[];x.forEach(C=>j.push(O.blendColors(C,c*.2+.2,[0,0,0]))),d.push(j)}return a.push(...d),a}function me({value:a,expanded:f,custom:x,onValueChange:p,onExpandedChange:d,onCustomChange:c,children:j}){const[C,S]=h.useState(!1),[N,y]=h.useState(a),[A,E]=h.useState(!1);h.useEffect(()=>{E(!0)},[]);const G=A?ft():[];function z(R){p(R),y(R),d(!1)}function T(){p(N),x.includes(N)||c([...x,N]),setTimeout(()=>S(!1))}function n(){setTimeout(()=>S(!1))}return o.jsxRuntimeExports.jsx(qe.FloatCard,{value:f,onChange:d,card:o.jsxRuntimeExports.jsx("div",{className:F.clsx(s.colorPicker,C&&s.customColorPicker),children:C?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(ze.ColorPicker,{value:N,onChange:y,noShadow:!0}),o.jsxRuntimeExports.jsxs("div",{className:s.customColorActions,children:[o.jsxRuntimeExports.jsx(U.Button,{variant:"plain",color:"neutral",size:"small",onClick:n,children:"Cancel"}),o.jsxRuntimeExports.jsx(U.Button,{size:"small",onClick:T,children:"Add"})]})]}):o.jsxRuntimeExports.jsxs("div",{className:s.colorColumn,children:[o.jsxRuntimeExports.jsx("div",{className:s.colorGrid,children:G.map((R,_)=>o.jsxRuntimeExports.jsx("div",{className:s.colorRow,children:R.map(g=>o.jsxRuntimeExports.jsx(de,{color:g,selected:a===g,onClick:z},g))},_))}),o.jsxRuntimeExports.jsx("hr",{className:s.colorDivider}),o.jsxRuntimeExports.jsxs("div",{className:F.clsx(s.colorRow,s.customRole),children:[o.jsxRuntimeExports.jsx("div",{className:s.addColorBtn,title:"Add custom color",onClick:()=>S(!0),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"add_circle",className:"text-neutral-interactive-default cursor-pointer"})}),x.map(R=>o.jsxRuntimeExports.jsx(de,{color:R,selected:a===R,onClick:z},R))]})]})}),children:j})}const xt=["b","i","u","strong","em","br","div","ul","ol","li","blockquote","a","img","span","font"],pt=["style","href","src","alt","title","color"],fe=Array.from({length:10},(a,f)=>f*4+12);function xe(a){const x=new DOMParser().parseFromString(a,"text/html"),p=document.createElement("div");for(const d of Array.from(x.body.childNodes)){const c=pe(d);c&&p.appendChild(c)}return p.innerHTML}function pe(a){if(a.nodeType===Node.TEXT_NODE)return a;if(a.nodeType!==Node.ELEMENT_NODE)return null;const f=a,x=f.tagName.toLowerCase();if(!xt.includes(x))return document.createTextNode(f.textContent||"");const p=document.createElement(x);for(const d of Array.from(f.attributes))pt.includes(d.name)&&p.setAttribute(d.name,d.value);for(const d of Array.from(f.childNodes)){const c=pe(d);c&&p.appendChild(c)}return p}function ht(a){return a.replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function gt({value:a,defaultValue:f,onChange:x,placeholder:p,disabled:d=!1,labelValue:c,errorMessage:j,hasError:C=!1,infoMessage:S,required:N=!1,minHeight:y="200px",maxHeight:A="400px",noBorder:E=!1,className:G}){const[z,T]=Ie.useControllable({value:a,defaultValue:f??"",onChange:x}),n=h.useRef(null),R=h.useRef(null),_=h.useRef([]),g=h.useRef(-1),B=h.useRef(!1),[$,X]=h.useState(!1),[he,ge]=h.useState({}),[Ce,V]=h.useState(16),[ye,je]=h.useState("#000000"),[Z,J]=h.useState(!1),[Re,_e]=h.useState("#ffffff"),[Q,Y]=h.useState(!1),[ee,te]=h.useState([]),[Ee,H]=h.useState(!1),[M,K]=h.useState(""),[ne,q]=h.useState(""),v=h.useCallback(e=>{if(B.current)return;const t=ht(e);_.current[g.current]!==t&&(g.current<_.current.length-1&&(_.current=_.current.slice(0,g.current+1)),_.current.push(t),g.current=_.current.length-1,_.current.length>50&&(_.current.shift(),g.current--))},[]);function I(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);n.current?.contains(t.commonAncestorContainer)&&(R.current=t.cloneRange())}catch{R.current=null}}function P(){try{const e=window.getSelection();if(!R.current||!n.current||!e)return;n.current.focus(),e.removeAllRanges();const t=R.current;if(n.current.contains(t.commonAncestorContainer))e.addRange(t);else{const r=document.createRange();r.setStart(n.current,0),r.collapse(!0),e.addRange(r)}}catch{R.current=null}}function oe(e){if(!n.current||!e||e.rangeCount===0)return!1;try{const t=e.getRangeAt(0);return n.current.contains(t.startContainer)&&n.current.contains(t.endContainer)&&n.current.contains(t.commonAncestorContainer)}catch{return!1}}const b=h.useCallback(()=>{ge({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikeThrough:document.queryCommandState("strikeThrough"),insertUnorderedList:document.queryCommandState("insertUnorderedList"),insertOrderedList:document.queryCommandState("insertOrderedList"),justifyLeft:document.queryCommandState("justifyLeft"),justifyCenter:document.queryCommandState("justifyCenter"),justifyRight:document.queryCommandState("justifyRight"),justifyFull:document.queryCommandState("justifyFull")});const e=window.getSelection();if(!e||e.rangeCount===0||!n.current)return;let t=e.getRangeAt(0).startContainer,r=!1;for(;t&&t!==n.current;){if(t.nodeType===Node.ELEMENT_NODE){const l=window.getComputedStyle(t),u=parseInt(l.fontSize),i=fe.find(m=>Math.abs(m-u)<=1);if(i){V(i),r=!0;break}}t=t.parentNode}r||V(16)},[]);function re(){if(!n.current)return;const e=getComputedStyle(n.current).getPropertyValue("--spacing-base");n.current.querySelectorAll("ul, ol").forEach(t=>{const r=t;r.style.listStyleType=t.tagName.toLowerCase()==="ul"?"disc":"decimal",r.style.paddingLeft=e,r.style.listStylePosition="outside"}),n.current.querySelectorAll("li").forEach(t=>{t.style.display="list-item",t.style.listStylePosition="outside"})}function se(e){if(!n.current||!e.length)return;const t=getComputedStyle(n.current),r=t.getPropertyValue("--border-width-sm"),l=t.getPropertyValue("--primary-border-default"),u=t.getPropertyValue("--primary-surface-default"),i=t.getPropertyValue("--spacing-base"),m=t.getPropertyValue("--spacing-xxs"),w=t.getPropertyValue("--border-radius-sm");e.forEach(L=>{L.style.borderLeft=`${r} solid ${l}`,L.style.fontStyle="italic",L.style.backgroundColor=u,L.style.padding=i,L.style.margin=`${m} 0`,L.style.borderRadius=`0 ${w} ${w} 0`,L.style.position="relative"})}function ce(){requestAnimationFrame(()=>{if(!n.current)return;re();const e=n.current.querySelectorAll("blockquote");e.length&&se(Array.from(e))})}h.useEffect(()=>{n.current&&(n.current.innerHTML=xe(z??""),ce(),v(z??""))},[]),h.useEffect(()=>{!n.current||n.current.innerHTML===a||(n.current.innerHTML=xe(a??""),ce())},[a]);function be(e,t){const r=window.getSelection();if(!(d||!n.current||!oe(r))){P();try{document.execCommand(e,!1,t)}catch{}if(n.current?.focus(),b(),(e==="insertUnorderedList"||e==="insertOrderedList")&&setTimeout(()=>re()),n.current){const l=n.current.innerHTML;T(l),v(l)}}}function ke(e){if(d||!n.current)return;const t=typeof e=="object"?e.value:e;P();const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);if(l.collapsed){const i=document.createElement("span");i.style.fontSize=t+"px",i.textContent="",l.insertNode(i),l.setStartAfter(i),l.collapse(!0)}else{const i=l.extractContents(),m=document.createElement("span");m.style.fontSize=t+"px",m.appendChild(i),l.insertNode(m),l.selectNodeContents(m)}r.removeAllRanges(),r.addRange(l),n.current.focus(),V(t);const u=n.current.innerHTML;T(u),v(u),b()}function ie(e,t){if(!window.getSelection()||d||!n.current)return;P();try{document.execCommand(t,!1,e)}catch{}n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}function le(){if(g.current<=0||!n.current)return;B.current=!0,g.current--;const e=_.current[g.current];n.current.innerHTML=e,T(e),B.current=!1,n.current.focus(),b()}function ae(){if(g.current>=_.current.length-1||!n.current)return;B.current=!0,g.current++;const e=_.current[g.current];n.current.innerHTML=e,T(e),B.current=!1,n.current.focus(),b()}function Se(){if(d)return;I();const e=window.getSelection();e&&!e.isCollapsed&&$?q(e.toString()):q(""),H(!0)}function W(){if(!(!M.trim()||!O.isValidUrl(M.trim())))try{P();const e=window.getSelection();if(!e||!n.current)return;let t;e.rangeCount===0?(t=document.createRange(),n.current.lastChild?t.setStartAfter(n.current.lastChild):t.setStart(n.current,0),t.collapse(!0)):t=e.getRangeAt(0);const r=document.createElement("a");r.href=M.trim(),r.target="_blank",r.rel="noopener noreferrer",r.textContent=ne.trim()||M.trim(),t.collapsed||t.deleteContents(),t.insertNode(r),t.setStartAfter(r),t.collapse(!0),e.removeAllRanges(),e.addRange(t),H(!1),K(""),q(""),n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}catch{}}function Ne(e){const t=e.target.files;!t||!n.current||(Array.from(t).forEach(r=>{if(n.current)try{const l=URL.createObjectURL(r);P();const u=window.getSelection();if(!u)return;let i;u.rangeCount===0?(i=document.createRange(),n.current.lastChild?i.setStartAfter(n.current.lastChild):i.setStart(n.current,0),i.collapse(!0)):i=u.getRangeAt(0);const m=document.createElement("img"),w=getComputedStyle(n.current);m.src=l,m.alt=r.name,m.style.maxWidth="100%",m.style.height="auto",m.style.borderRadius=w.getPropertyValue("--border-radius-sm"),m.style.margin=w.getPropertyValue("--spacing-base"),i.collapsed||i.deleteContents(),i.insertNode(m),i.setStartAfter(m),i.collapse(!0),u.removeAllRanges(),u.addRange(i),n.current.focus();const L=n.current.innerHTML;T(L),v(L),b()}catch{}}),e.target.value="")}function Ae(){if(d||!n.current)return;const e=window.getSelection();if(!(!e||e.rangeCount===0))try{const t=e.getRangeAt(0),r=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement?.closest("blockquote"):t.startContainer?.closest?.("blockquote");if(r){const u=r.parentNode;if(!u)return;const i=document.createElement("div");i.innerHTML=r.innerHTML,u.replaceChild(i,r);const m=document.createRange();m.selectNodeContents(i),e.removeAllRanges(),e.addRange(m)}else{const u=document.createElement("blockquote");if(se([u]),t.collapsed)u.innerHTML="Type your quote here...";else{const m=t.extractContents();if(m.childNodes.length===1&&m.firstChild?.nodeType===Node.TEXT_NODE){const w=document.createElement("span");w.appendChild(m),u.appendChild(w)}else u.appendChild(m)}t.insertNode(u);const i=document.createRange();i.selectNodeContents(u),e.removeAllRanges(),e.addRange(i)}n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}catch{}}function ue(){if(B.current||!n.current)return;const e=n.current.innerHTML;T(e),v(e),b()}function Te(e){if(!d){if(e.ctrlKey&&!e.shiftKey&&e.key==="z"){e.preventDefault(),le();return}if(e.ctrlKey&&(e.shiftKey&&e.key==="Z"||e.key==="y")){e.preventDefault(),ae();return}if(e.key==="Tab"){e.preventDefault();const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0);let l=r.startContainer,u=!1;for(;l&&l!==n.current;){if(l.nodeType===Node.ELEMENT_NODE){const i=l.tagName?.toLowerCase();if(["li","ul","ol"].includes(i)){u=!0;break}}l=l.parentNode}if(u&&!e.shiftKey)document.execCommand("indent",!1);else if(u&&e.shiftKey)document.execCommand("outdent",!1);else if(!e.shiftKey){const i=document.createElement("span");i.classList.add("tab"),i.innerHTML=" ",r.deleteContents(),r.insertNode(i),r.setStartAfter(i)}}["Enter","Tab","Backspace"].includes(e.key)&&(ue(),b())}}function Le(){X(!0),b()}function ve(){X(!1)}function we(e){if(d)return;const t=window.getSelection();oe(t)||e.preventDefault()}function k(e,t,r,l){return o.jsxRuntimeExports.jsx(Fe.Tooltip,{position:"bottom",labelValue:r,children:o.jsxRuntimeExports.jsx("button",{className:F.clsx(s.toolbarBtn,he[e]&&s.toolbarBtnActive),title:r,onMouseDown:u=>{u.preventDefault(),I()},onClick:()=>l?l():be(e),children:o.jsxRuntimeExports.jsx(D.Icon,{name:t})},e)})}const De=F.clsx(s.richTextEditor,$&&s.focus,d&&s.disabled,C&&s.error,E&&s.noBorder,G);return o.jsxRuntimeExports.jsxs("div",{className:De,children:[c&&o.jsxRuntimeExports.jsx(Be.Label,{labelValue:c,infoMessage:S,required:N,className:"mb-xxs"}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbar,children:[o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Undo (Ctrl+Z)",disabled:g.current<=0,onMouseDown:e=>e.preventDefault(),onClick:le,children:o.jsxRuntimeExports.jsx(D.Icon,{name:"undo"})}),o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Redo (Ctrl+Y)",disabled:g.current>=_.current.length-1,onMouseDown:e=>e.preventDefault(),onClick:ae,children:o.jsxRuntimeExports.jsx(D.Icon,{name:"redo"})})]}),o.jsxRuntimeExports.jsx("div",{className:s.toolbarGroup,children:o.jsxRuntimeExports.jsx(Me.Select,{value:Ce,onChange:ke,options:fe.map(e=>({label:String(e),value:e})),disabled:d})}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("bold","format_bold","Bold (Ctrl+B)"),k("italic","format_italic","Italic (Ctrl+I)"),k("underline","format_underlined","Underline (Ctrl+U)"),k("strikeThrough","strikethrough_s","Strikethrough")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[o.jsxRuntimeExports.jsx(me,{value:ye,expanded:Z,custom:ee,onValueChange:e=>{je(e),ie(e,"foreColor")},onExpandedChange:e=>{e&&I(),J(e)},onCustomChange:te,children:o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Text color",onMouseDown:e=>{e.preventDefault(),I()},onClick:()=>J(!Z),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"format_color_text"})})}),o.jsxRuntimeExports.jsx(me,{value:Re,expanded:Q,custom:ee,onValueChange:e=>{_e(e),ie(e,"backColor")},onExpandedChange:e=>{e&&I(),Y(e)},onCustomChange:te,children:o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Background color",onMouseDown:e=>{e.preventDefault(),I()},onClick:()=>Y(!Q),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"format_color_fill"})})})]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("insertUnorderedList","format_list_bulleted","Bulleted list"),k("insertOrderedList","format_list_numbered","Numbered list")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("justifyLeft","format_align_left","Align left"),k("justifyCenter","format_align_center","Align center"),k("justifyRight","format_align_right","Align right"),k("justifyFull","format_align_justify","Justify")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("createLink","link","Insert link",Se),o.jsxRuntimeExports.jsxs("button",{className:s.toolbarBtn,title:"Insert image",onMouseDown:e=>{e.preventDefault(),I()},children:[o.jsxRuntimeExports.jsx(D.Icon,{name:"image"}),o.jsxRuntimeExports.jsx("input",{type:"file",accept:"image/*",className:s.imageInput,onChange:Ne})]}),k("insertBlockquote","format_quote","Quote",Ae)]}),o.jsxRuntimeExports.jsx("div",{className:s.toolbarGroup,children:k("removeFormat","format_clear","Remove formatting")})]}),o.jsxRuntimeExports.jsx("div",{ref:n,className:s.editorContent,role:"textbox",style:{minHeight:y,maxHeight:A},contentEditable:!d,"data-placeholder":p,"aria-label":c,"aria-required":N,"aria-invalid":C,onInput:ue,onFocus:Le,onBlur:ve,onKeyDown:Te,onKeyUp:b,onMouseUp:b,onPaste:we}),o.jsxRuntimeExports.jsx(Pe.Dialog,{value:Ee,onChange:H,children:o.jsxRuntimeExports.jsxs("div",{className:s.linkDialogContent,children:[o.jsxRuntimeExports.jsx("input",{type:"text",placeholder:"URL (e.g. https://example.com)",value:M,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput,autoFocus:!0}),o.jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Link text (optional)",value:ne,onChange:e=>q(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput}),o.jsxRuntimeExports.jsxs("div",{className:s.linkDialogActions,children:[o.jsxRuntimeExports.jsx(U.Button,{className:s.linkCancelBtn,variant:"plain",color:"neutral",onClick:()=>{H(!1),K(""),q("")},children:"Cancel"}),o.jsxRuntimeExports.jsx(U.Button,{className:s.linkInsertBtn,disabled:!M.trim(),onClick:W,children:"Insert Link"})]})]})}),C&&j&&o.jsxRuntimeExports.jsx("small",{className:s.errorMessage,children:j})]})}exports.RichTextEditor=gt;
|
|
1
|
+
"use strict";const o=require("./jsx-runtime-BubrbI3X.js"),h=require("react"),F=require("./clsx-C11secjj.js"),Ie=require("../hooks/useControllable.cjs.js"),O=require("./index-B4fH-h2h.js"),Be=require("./Label-BJz4_LAM.js"),D=require("../components/Icon/index.cjs.js"),Me=require("./Select-C22GZDi3.js"),ze=require("./ColorPicker-Xbh84tU0.js"),U=require("./Button-BQvl5kpf.js"),qe=require("./FloatCard-BPnvYKAf.js"),Pe=require("./Dialog-CIliTshU.js"),Fe=require("./Tooltip-CGZ7svxq.js"),He="_richTextEditor_zftxo_2",Oe="_noBorder_zftxo_2",Ue="_toolbar_zftxo_2",Ge="_toolbarGroup_zftxo_2",Ve="_toolbarBtn_zftxo_2",Ke="_toolbarBtnActive_zftxo_2",We="_editorContent_zftxo_2",$e="_focus_zftxo_2",Xe="_disabled_zftxo_2",Ze="_error_zftxo_2",Je="_errorMessage_zftxo_2",Qe="_colorPicker_zftxo_2",Ye="_customColorPicker_zftxo_2",et="_colorColumn_zftxo_2",tt="_colorGrid_zftxo_2",nt="_colorRow_zftxo_2",ot="_customRole_zftxo_2",rt="_colorOption_zftxo_2",st="_colorDivider_zftxo_2",ct="_addColorBtn_zftxo_2",it="_customColorActions_zftxo_2",lt="_imageInput_zftxo_2",at="_linkDialogContent_zftxo_2",ut="_linkInput_zftxo_2",dt="_linkDialogActions_zftxo_2",s={richTextEditor:He,noBorder:Oe,toolbar:Ue,toolbarGroup:Ge,toolbarBtn:Ve,toolbarBtnActive:Ke,editorContent:We,focus:$e,disabled:Xe,error:Ze,errorMessage:Je,colorPicker:Qe,customColorPicker:Ye,colorColumn:et,colorGrid:tt,colorRow:nt,customRole:ot,colorOption:rt,colorDivider:st,addColorBtn:ct,customColorActions:it,imageInput:lt,linkDialogContent:at,linkInput:ut,linkDialogActions:dt};function mt(a){let f=0,x=0,p=0;if(a.startsWith("rgb(")){const c=a.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);c&&(f=parseInt(c[1]),x=parseInt(c[2]),p=parseInt(c[3]))}else if(a.startsWith("hsl(")){const c=a.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)/);if(c){const j=parseInt(c[1])/360,C=parseInt(c[2])/100,S=parseInt(c[3])/100,N=(y,A,E)=>(E<0&&(E+=1),E>1&&(E-=1),E<1/6?y+(A-y)*6*E:E<1/2?A:E<2/3?y+(A-y)*(2/3-E)*6:y);if(C===0)f=x=p=S;else{const y=S<.5?S*(1+C):S+C-S*C,A=2*S-y;f=N(A,y,j+1/3),x=N(A,y,j),p=N(A,y,j-1/3)}f=Math.round(f*255),x=Math.round(x*255),p=Math.round(p*255)}}else if(a.startsWith("#")){const c=a.replace("#","");/^[0-9A-Fa-f]{6}([0-9A-Fa-f]{2})?$/i.test(c)&&(f=parseInt(c.substring(0,2),16),x=parseInt(c.substring(2,4),16),p=parseInt(c.substring(4,6),16))}return(.299*f+.587*x+.114*p)/255<.5?"text-white":"text-black"}function de({color:a,selected:f,onClick:x,className:p}){const d=mt(a);return o.jsxRuntimeExports.jsx("div",{className:F.clsx(s.colorOption,p),style:{backgroundColor:a},onClick:()=>x?.(a),children:f&&o.jsxRuntimeExports.jsx(D.Icon,{name:"check",className:d})})}function ft(){const a=[],f=[];for(let c=10;c>=0;c--)f.push(O.blendColors("#000000",c/10));a.push(f);const x=["hsl(0, 100%, 50%)","hsl(30, 100%, 50%)","hsl(60, 100%, 50%)","hsl(90, 100%, 50%)","hsl(120, 100%, 50%)","hsl(150, 100%, 50%)","hsl(180, 100%, 50%)","hsl(210, 100%, 50%)","hsl(240, 100%, 50%)","hsl(270, 100%, 50%)","hsl(300, 100%, 50%)"];a.push(x);const p=[];for(let c=0;c<3;c++){const j=[];x.forEach(C=>j.push(O.blendColors(C,c*.2+.2))),p.push(j)}a.push(...p);const d=[];for(let c=2;c>=0;c--){const j=[];x.forEach(C=>j.push(O.blendColors(C,c*.2+.2,[0,0,0]))),d.push(j)}return a.push(...d),a}function me({value:a,expanded:f,custom:x,onValueChange:p,onExpandedChange:d,onCustomChange:c,children:j}){const[C,S]=h.useState(!1),[N,y]=h.useState(a),[A,E]=h.useState(!1);h.useEffect(()=>{E(!0)},[]);const G=A?ft():[];function z(R){p(R),y(R),d(!1)}function T(){p(N),x.includes(N)||c([...x,N]),setTimeout(()=>S(!1))}function n(){setTimeout(()=>S(!1))}return o.jsxRuntimeExports.jsx(qe.FloatCard,{value:f,onChange:d,card:o.jsxRuntimeExports.jsx("div",{className:F.clsx(s.colorPicker,C&&s.customColorPicker),children:C?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx(ze.ColorPicker,{value:N,onChange:y,noShadow:!0}),o.jsxRuntimeExports.jsxs("div",{className:s.customColorActions,children:[o.jsxRuntimeExports.jsx(U.Button,{variant:"plain",color:"neutral",size:"small",onClick:n,children:"Cancel"}),o.jsxRuntimeExports.jsx(U.Button,{size:"small",onClick:T,children:"Add"})]})]}):o.jsxRuntimeExports.jsxs("div",{className:s.colorColumn,children:[o.jsxRuntimeExports.jsx("div",{className:s.colorGrid,children:G.map((R,_)=>o.jsxRuntimeExports.jsx("div",{className:s.colorRow,children:R.map(g=>o.jsxRuntimeExports.jsx(de,{color:g,selected:a===g,onClick:z},g))},_))}),o.jsxRuntimeExports.jsx("hr",{className:s.colorDivider}),o.jsxRuntimeExports.jsxs("div",{className:F.clsx(s.colorRow,s.customRole),children:[o.jsxRuntimeExports.jsx("div",{className:s.addColorBtn,title:"Add custom color",onClick:()=>S(!0),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"add_circle",className:"text-neutral-interactive-default cursor-pointer"})}),x.map(R=>o.jsxRuntimeExports.jsx(de,{color:R,selected:a===R,onClick:z},R))]})]})}),children:j})}const xt=["b","i","u","strong","em","br","div","ul","ol","li","blockquote","a","img","span","font"],pt=["style","href","src","alt","title","color"],fe=Array.from({length:10},(a,f)=>f*4+12);function xe(a){const x=new DOMParser().parseFromString(a,"text/html"),p=document.createElement("div");for(const d of Array.from(x.body.childNodes)){const c=pe(d);c&&p.appendChild(c)}return p.innerHTML}function pe(a){if(a.nodeType===Node.TEXT_NODE)return a;if(a.nodeType!==Node.ELEMENT_NODE)return null;const f=a,x=f.tagName.toLowerCase();if(!xt.includes(x))return document.createTextNode(f.textContent||"");const p=document.createElement(x);for(const d of Array.from(f.attributes))pt.includes(d.name)&&p.setAttribute(d.name,d.value);for(const d of Array.from(f.childNodes)){const c=pe(d);c&&p.appendChild(c)}return p}function ht(a){return a.replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function gt({value:a,defaultValue:f,onChange:x,placeholder:p,disabled:d=!1,labelValue:c,errorMessage:j,hasError:C=!1,infoMessage:S,required:N=!1,minHeight:y="200px",maxHeight:A="400px",noBorder:E=!1,className:G}){const[z,T]=Ie.useControllable({value:a,defaultValue:f??"",onChange:x}),n=h.useRef(null),R=h.useRef(null),_=h.useRef([]),g=h.useRef(-1),B=h.useRef(!1),[$,X]=h.useState(!1),[he,ge]=h.useState({}),[Ce,V]=h.useState(16),[ye,je]=h.useState("#000000"),[Z,J]=h.useState(!1),[Re,_e]=h.useState("#ffffff"),[Q,Y]=h.useState(!1),[ee,te]=h.useState([]),[Ee,H]=h.useState(!1),[M,K]=h.useState(""),[ne,q]=h.useState(""),v=h.useCallback(e=>{if(B.current)return;const t=ht(e);_.current[g.current]!==t&&(g.current<_.current.length-1&&(_.current=_.current.slice(0,g.current+1)),_.current.push(t),g.current=_.current.length-1,_.current.length>50&&(_.current.shift(),g.current--))},[]);function I(){try{const e=window.getSelection();if(!e||e.rangeCount===0)return;const t=e.getRangeAt(0);n.current?.contains(t.commonAncestorContainer)&&(R.current=t.cloneRange())}catch{R.current=null}}function P(){try{const e=window.getSelection();if(!R.current||!n.current||!e)return;n.current.focus(),e.removeAllRanges();const t=R.current;if(n.current.contains(t.commonAncestorContainer))e.addRange(t);else{const r=document.createRange();r.setStart(n.current,0),r.collapse(!0),e.addRange(r)}}catch{R.current=null}}function oe(e){if(!n.current||!e||e.rangeCount===0)return!1;try{const t=e.getRangeAt(0);return n.current.contains(t.startContainer)&&n.current.contains(t.endContainer)&&n.current.contains(t.commonAncestorContainer)}catch{return!1}}const b=h.useCallback(()=>{ge({bold:document.queryCommandState("bold"),italic:document.queryCommandState("italic"),underline:document.queryCommandState("underline"),strikeThrough:document.queryCommandState("strikeThrough"),insertUnorderedList:document.queryCommandState("insertUnorderedList"),insertOrderedList:document.queryCommandState("insertOrderedList"),justifyLeft:document.queryCommandState("justifyLeft"),justifyCenter:document.queryCommandState("justifyCenter"),justifyRight:document.queryCommandState("justifyRight"),justifyFull:document.queryCommandState("justifyFull")});const e=window.getSelection();if(!e||e.rangeCount===0||!n.current)return;let t=e.getRangeAt(0).startContainer,r=!1;for(;t&&t!==n.current;){if(t.nodeType===Node.ELEMENT_NODE){const l=window.getComputedStyle(t),u=parseInt(l.fontSize),i=fe.find(m=>Math.abs(m-u)<=1);if(i){V(i),r=!0;break}}t=t.parentNode}r||V(16)},[]);function re(){if(!n.current)return;const e=getComputedStyle(n.current).getPropertyValue("--spacing-base");n.current.querySelectorAll("ul, ol").forEach(t=>{const r=t;r.style.listStyleType=t.tagName.toLowerCase()==="ul"?"disc":"decimal",r.style.paddingLeft=e,r.style.listStylePosition="outside"}),n.current.querySelectorAll("li").forEach(t=>{t.style.display="list-item",t.style.listStylePosition="outside"})}function se(e){if(!n.current||!e.length)return;const t=getComputedStyle(n.current),r=t.getPropertyValue("--border-width-sm"),l=t.getPropertyValue("--primary-border-default"),u=t.getPropertyValue("--primary-surface-default"),i=t.getPropertyValue("--spacing-base"),m=t.getPropertyValue("--spacing-xxs"),w=t.getPropertyValue("--border-radius-sm");e.forEach(L=>{L.style.borderLeft=`${r} solid ${l}`,L.style.fontStyle="italic",L.style.backgroundColor=u,L.style.padding=i,L.style.margin=`${m} 0`,L.style.borderRadius=`0 ${w} ${w} 0`,L.style.position="relative"})}function ce(){requestAnimationFrame(()=>{if(!n.current)return;re();const e=n.current.querySelectorAll("blockquote");e.length&&se(Array.from(e))})}h.useEffect(()=>{n.current&&(n.current.innerHTML=xe(z??""),ce(),v(z??""))},[]),h.useEffect(()=>{!n.current||n.current.innerHTML===a||(n.current.innerHTML=xe(a??""),ce())},[a]);function be(e,t){const r=window.getSelection();if(!(d||!n.current||!oe(r))){P();try{document.execCommand(e,!1,t)}catch{}if(n.current?.focus(),b(),(e==="insertUnorderedList"||e==="insertOrderedList")&&setTimeout(()=>re()),n.current){const l=n.current.innerHTML;T(l),v(l)}}}function ke(e){if(d||!n.current)return;const t=typeof e=="object"?e.value:e;P();const r=window.getSelection();if(!r||r.rangeCount===0)return;const l=r.getRangeAt(0);if(l.collapsed){const i=document.createElement("span");i.style.fontSize=t+"px",i.textContent="",l.insertNode(i),l.setStartAfter(i),l.collapse(!0)}else{const i=l.extractContents(),m=document.createElement("span");m.style.fontSize=t+"px",m.appendChild(i),l.insertNode(m),l.selectNodeContents(m)}r.removeAllRanges(),r.addRange(l),n.current.focus(),V(t);const u=n.current.innerHTML;T(u),v(u),b()}function ie(e,t){if(!window.getSelection()||d||!n.current)return;P();try{document.execCommand(t,!1,e)}catch{}n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}function le(){if(g.current<=0||!n.current)return;B.current=!0,g.current--;const e=_.current[g.current];n.current.innerHTML=e,T(e),B.current=!1,n.current.focus(),b()}function ae(){if(g.current>=_.current.length-1||!n.current)return;B.current=!0,g.current++;const e=_.current[g.current];n.current.innerHTML=e,T(e),B.current=!1,n.current.focus(),b()}function Se(){if(d)return;I();const e=window.getSelection();e&&!e.isCollapsed&&$?q(e.toString()):q(""),H(!0)}function W(){if(!(!M.trim()||!O.isValidUrl(M.trim())))try{P();const e=window.getSelection();if(!e||!n.current)return;let t;e.rangeCount===0?(t=document.createRange(),n.current.lastChild?t.setStartAfter(n.current.lastChild):t.setStart(n.current,0),t.collapse(!0)):t=e.getRangeAt(0);const r=document.createElement("a");r.href=M.trim(),r.target="_blank",r.rel="noopener noreferrer",r.textContent=ne.trim()||M.trim(),t.collapsed||t.deleteContents(),t.insertNode(r),t.setStartAfter(r),t.collapse(!0),e.removeAllRanges(),e.addRange(t),H(!1),K(""),q(""),n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}catch{}}function Ne(e){const t=e.target.files;!t||!n.current||(Array.from(t).forEach(r=>{if(n.current)try{const l=URL.createObjectURL(r);P();const u=window.getSelection();if(!u)return;let i;u.rangeCount===0?(i=document.createRange(),n.current.lastChild?i.setStartAfter(n.current.lastChild):i.setStart(n.current,0),i.collapse(!0)):i=u.getRangeAt(0);const m=document.createElement("img"),w=getComputedStyle(n.current);m.src=l,m.alt=r.name,m.style.maxWidth="100%",m.style.height="auto",m.style.borderRadius=w.getPropertyValue("--border-radius-sm"),m.style.margin=w.getPropertyValue("--spacing-base"),i.collapsed||i.deleteContents(),i.insertNode(m),i.setStartAfter(m),i.collapse(!0),u.removeAllRanges(),u.addRange(i),n.current.focus();const L=n.current.innerHTML;T(L),v(L),b()}catch{}}),e.target.value="")}function Ae(){if(d||!n.current)return;const e=window.getSelection();if(!(!e||e.rangeCount===0))try{const t=e.getRangeAt(0),r=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement?.closest("blockquote"):t.startContainer?.closest?.("blockquote");if(r){const u=r.parentNode;if(!u)return;const i=document.createElement("div");i.innerHTML=r.innerHTML,u.replaceChild(i,r);const m=document.createRange();m.selectNodeContents(i),e.removeAllRanges(),e.addRange(m)}else{const u=document.createElement("blockquote");if(se([u]),t.collapsed)u.innerHTML="Type your quote here...";else{const m=t.extractContents();if(m.childNodes.length===1&&m.firstChild?.nodeType===Node.TEXT_NODE){const w=document.createElement("span");w.appendChild(m),u.appendChild(w)}else u.appendChild(m)}t.insertNode(u);const i=document.createRange();i.selectNodeContents(u),e.removeAllRanges(),e.addRange(i)}n.current.focus();const l=n.current.innerHTML;T(l),v(l),b()}catch{}}function ue(){if(B.current||!n.current)return;const e=n.current.innerHTML;T(e),v(e),b()}function Te(e){if(!d){if(e.ctrlKey&&!e.shiftKey&&e.key==="z"){e.preventDefault(),le();return}if(e.ctrlKey&&(e.shiftKey&&e.key==="Z"||e.key==="y")){e.preventDefault(),ae();return}if(e.key==="Tab"){e.preventDefault();const t=window.getSelection();if(!t||t.rangeCount===0)return;const r=t.getRangeAt(0);let l=r.startContainer,u=!1;for(;l&&l!==n.current;){if(l.nodeType===Node.ELEMENT_NODE){const i=l.tagName?.toLowerCase();if(["li","ul","ol"].includes(i)){u=!0;break}}l=l.parentNode}if(u&&!e.shiftKey)document.execCommand("indent",!1);else if(u&&e.shiftKey)document.execCommand("outdent",!1);else if(!e.shiftKey){const i=document.createElement("span");i.classList.add("tab"),i.innerHTML=" ",r.deleteContents(),r.insertNode(i),r.setStartAfter(i)}}["Enter","Tab","Backspace"].includes(e.key)&&(ue(),b())}}function Le(){X(!0),b()}function ve(){X(!1)}function we(e){if(d)return;const t=window.getSelection();oe(t)||e.preventDefault()}function k(e,t,r,l){return o.jsxRuntimeExports.jsx(Fe.Tooltip,{position:"bottom",labelValue:r,children:o.jsxRuntimeExports.jsx("button",{className:F.clsx(s.toolbarBtn,he[e]&&s.toolbarBtnActive),title:r,onMouseDown:u=>{u.preventDefault(),I()},onClick:()=>l?l():be(e),children:o.jsxRuntimeExports.jsx(D.Icon,{name:t})},e)})}const De=F.clsx(s.richTextEditor,"rich-text-editor",$&&s.focus,d&&s.disabled,C&&s.error,E&&s.noBorder,G);return o.jsxRuntimeExports.jsxs("div",{className:De,children:[c&&o.jsxRuntimeExports.jsx(Be.Label,{labelValue:c,infoMessage:S,required:N,className:"mb-xxs"}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbar,children:[o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Undo (Ctrl+Z)",disabled:g.current<=0,onMouseDown:e=>e.preventDefault(),onClick:le,children:o.jsxRuntimeExports.jsx(D.Icon,{name:"undo"})}),o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Redo (Ctrl+Y)",disabled:g.current>=_.current.length-1,onMouseDown:e=>e.preventDefault(),onClick:ae,children:o.jsxRuntimeExports.jsx(D.Icon,{name:"redo"})})]}),o.jsxRuntimeExports.jsx("div",{className:s.toolbarGroup,children:o.jsxRuntimeExports.jsx(Me.Select,{value:Ce,onChange:ke,options:fe.map(e=>({label:String(e),value:e})),disabled:d})}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("bold","format_bold","Bold (Ctrl+B)"),k("italic","format_italic","Italic (Ctrl+I)"),k("underline","format_underlined","Underline (Ctrl+U)"),k("strikeThrough","strikethrough_s","Strikethrough")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[o.jsxRuntimeExports.jsx(me,{value:ye,expanded:Z,custom:ee,onValueChange:e=>{je(e),ie(e,"foreColor")},onExpandedChange:e=>{e&&I(),J(e)},onCustomChange:te,children:o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Text color",onMouseDown:e=>{e.preventDefault(),I()},onClick:()=>J(!Z),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"format_color_text"})})}),o.jsxRuntimeExports.jsx(me,{value:Re,expanded:Q,custom:ee,onValueChange:e=>{_e(e),ie(e,"backColor")},onExpandedChange:e=>{e&&I(),Y(e)},onCustomChange:te,children:o.jsxRuntimeExports.jsx("button",{className:s.toolbarBtn,title:"Background color",onMouseDown:e=>{e.preventDefault(),I()},onClick:()=>Y(!Q),children:o.jsxRuntimeExports.jsx(D.Icon,{name:"format_color_fill"})})})]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("insertUnorderedList","format_list_bulleted","Bulleted list"),k("insertOrderedList","format_list_numbered","Numbered list")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("justifyLeft","format_align_left","Align left"),k("justifyCenter","format_align_center","Align center"),k("justifyRight","format_align_right","Align right"),k("justifyFull","format_align_justify","Justify")]}),o.jsxRuntimeExports.jsxs("div",{className:s.toolbarGroup,children:[k("createLink","link","Insert link",Se),o.jsxRuntimeExports.jsxs("button",{className:s.toolbarBtn,title:"Insert image",onMouseDown:e=>{e.preventDefault(),I()},children:[o.jsxRuntimeExports.jsx(D.Icon,{name:"image"}),o.jsxRuntimeExports.jsx("input",{type:"file",accept:"image/*",className:s.imageInput,onChange:Ne})]}),k("insertBlockquote","format_quote","Quote",Ae)]}),o.jsxRuntimeExports.jsx("div",{className:s.toolbarGroup,children:k("removeFormat","format_clear","Remove formatting")})]}),o.jsxRuntimeExports.jsx("div",{ref:n,className:s.editorContent,role:"textbox",style:{minHeight:y,maxHeight:A},contentEditable:!d,"data-placeholder":p,"aria-label":c,"aria-required":N,"aria-invalid":C,onInput:ue,onFocus:Le,onBlur:ve,onKeyDown:Te,onKeyUp:b,onMouseUp:b,onPaste:we}),o.jsxRuntimeExports.jsx(Pe.Dialog,{value:Ee,onChange:H,children:o.jsxRuntimeExports.jsxs("div",{className:s.linkDialogContent,children:[o.jsxRuntimeExports.jsx("input",{type:"text",placeholder:"URL (e.g. https://example.com)",value:M,onChange:e=>K(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput,autoFocus:!0}),o.jsxRuntimeExports.jsx("input",{type:"text",placeholder:"Link text (optional)",value:ne,onChange:e=>q(e.target.value),onKeyDown:e=>{e.key==="Enter"&&W()},className:s.linkInput}),o.jsxRuntimeExports.jsxs("div",{className:s.linkDialogActions,children:[o.jsxRuntimeExports.jsx(U.Button,{className:s.linkCancelBtn,variant:"plain",color:"neutral",onClick:()=>{H(!1),K(""),q("")},children:"Cancel"}),o.jsxRuntimeExports.jsx(U.Button,{className:s.linkInsertBtn,disabled:!M.trim(),onClick:W,children:"Insert Link"})]})]})}),C&&j&&o.jsxRuntimeExports.jsx("small",{className:s.errorMessage,children:j})]})}exports.RichTextEditor=gt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const r=require("./jsx-runtime-BubrbI3X.js"),j=require("react"),l=require("./clsx-C11secjj.js"),d=require("./Button-BQvl5kpf.js"),f="_roundMenu_1f5g9_2",h="_menuItem_1f5g9_2",R="_collapsed_1f5g9_2",I="_trigger_1f5g9_2",s={roundMenu:f,menuItem:h,collapsed:R,trigger:I};function E({options:a,iconKey:i="icon",labelKey:u="label",radius:o=80,className:x}){const[n,m]=j.useState(!1);function g(e,t){const c=2*Math.PI*e/t-Math.PI/2,_=Math.cos(c)*o,M=Math.sin(c)*o;return{transform:`translate3d(${_}px, ${M}px, 0)`}}return r.jsxRuntimeExports.jsxs("div",{className:l.clsx(s.roundMenu,"round-menu",x),children:[a.map((e,t)=>{const c=n?g(t,a.length):void 0;return r.jsxRuntimeExports.jsx("div",{className:l.clsx(s.menuItem,!n&&s.collapsed),style:c,"aria-label":e[u]??e.label,title:e[u]??e.label,children:r.jsxRuntimeExports.jsx(d.Button,{round:!0,background:e.background,icon:e[i]??e.icon,onClick:e.onClick,children:e[u]??e.label})},t)}),r.jsxRuntimeExports.jsx(d.Button,{round:!0,className:l.clsx(s.trigger,n&&s.expanded),onClick:()=>m(e=>!e),color:n?"neutral":"success",icon:n?"close":"add"})]})}exports.RoundMenu=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as c}from"./jsx-runtime-u17CrQMm.js";import{useState as M}from"react";import{c as l}from"./clsx-B-dksMZM.js";import{B as d}from"./Button-Dwf5lfho.js";const h="_roundMenu_1f5g9_2",p="_menuItem_1f5g9_2",I="_collapsed_1f5g9_2",j="_trigger_1f5g9_2",s={roundMenu:h,menuItem:p,collapsed:I,trigger:j};function E({options:o,iconKey:m="icon",labelKey:a="label",radius:u=80,className:i}){const[n,g]=M(!1);function x(e,t){const r=2*Math.PI*e/t-Math.PI/2,f=Math.cos(r)*u,_=Math.sin(r)*u;return{transform:`translate3d(${f}px, ${_}px, 0)`}}return c.jsxs("div",{className:l(s.roundMenu,"round-menu",i),children:[o.map((e,t)=>{const r=n?x(t,o.length):void 0;return c.jsx("div",{className:l(s.menuItem,!n&&s.collapsed),style:r,"aria-label":e[a]??e.label,title:e[a]??e.label,children:c.jsx(d,{round:!0,background:e.background,icon:e[m]??e.icon,onClick:e.onClick,children:e[a]??e.label})},t)}),c.jsx(d,{round:!0,className:l(s.trigger,n&&s.expanded),onClick:()=>g(e=>!e),color:n?"neutral":"success",icon:n?"close":"add"})]})}export{E as R};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("./jsx-runtime-BubrbI3X.js"),F=require("react"),b=require("./clsx-C11secjj.js"),U=require("../hooks/useControllable.cjs.js"),G=require("./index-B4fH-h2h.js"),he=require("./SelectContainer-
|
|
1
|
+
"use strict";const o=require("./jsx-runtime-BubrbI3X.js"),F=require("react"),b=require("./clsx-C11secjj.js"),U=require("../hooks/useControllable.cjs.js"),G=require("./index-B4fH-h2h.js"),he=require("./SelectContainer-Cdc2A3ug.js"),ge=require("./SelectContent-C3qydYaT.js"),je=require("./Option-7LkwQa_J.js"),Ce=require("./Checkbox-JLPQNtg3.js"),pe=require("./Button-BQvl5kpf.js"),ye="_optionContent_dkzu4_2",me="_displayLabel_dkzu4_2",be="_selectCount_dkzu4_2",h={optionContent:ye,displayLabel:me,selectCount:be};function Ee({value:J,defaultValue:u,onChange:P,options:f=[],labelKey:Q="label",valueKey:W="value",multiple:s=!1,searchable:g=!1,clearable:X=!1,disabled:j=!1,labelValue:Y="",getObject:Z=!1,isError:w=!1,errorMessage:$="",infoMessage:V="",required:ee=!1,placeholder:D,secondary:E=!1,icon:ne,expanded:te,onExpandedChange:se,renderSearchLabel:q,renderOption:O,renderStatus:S,renderStatusLabel:_,renderActions:L,renderClearLabel:z,children:k,className:re}){const oe=s?Array.isArray(u)?u:u!=null?[u]:[]:Array.isArray(u)?u[0]:u??null,[t,y]=U.useControllable({value:J,defaultValue:oe,onChange:P}),[v,le]=F.useState(""),[a,C]=U.useControllable({value:te,defaultValue:!1,onChange:se}),[m,c]=F.useState(-1);function x(e){return G.isObject(e)?e[Q]:String(e??"")}function l(e){return G.isObject(e)?e[W]:e}function A(e){return s?(Array.isArray(t)?t:[]).some(r=>l(r)===l(e)):l(t)===l(e)}function I(e){if(j)return;const n=Z?e:l(e);if(s){const r=Array.isArray(t)?[...t]:[],p=r.findIndex(N=>l(N)===l(e));p!==-1?r.splice(p,1):r.push(n),y(r)}else y(n),C(!1),c(-1)}function ae(){y(s?[]:null)}const i=g&&v?f.filter(e=>x(e).toLowerCase().includes(v.toLowerCase())):f;function ce(){if(s){const n=Array.isArray(t)?t:[];return n.length===0?"":n.map(r=>{const p=f.find(N=>l(N)===l(r));return x(p||r)}).join(", ")}if(t==null)return"";const e=f.find(n=>l(n)===l(t));return x(e||t)}const H=ce(),R=s?Array.isArray(t)&&t.length>0:t!=null;function ie(e){if(!j)switch(e.key){case"ArrowDown":e.preventDefault(),a?c(n=>n<i.length-1?n+1:n):(C(!0),c(0));break;case"ArrowUp":e.preventDefault(),a?c(n=>n>0?n-1:n):(C(!0),c(i.length-1));break;case"Home":e.preventDefault(),a&&i.length>0&&c(0);break;case"End":e.preventDefault(),a&&i.length>0&&c(i.length-1);break;case"Enter":e.preventDefault(),a&&m>=0&&m<i.length&&I(i[m]);break;case"Escape":e.preventDefault(),C(!1),c(-1);break}}function B(e){C(e),e||c(-1)}const K=typeof k=="function",M=K?void 0:k,T=s&&Array.isArray(t)&&t.length>0&&!j&&(!a&&g||!g);let d;(!a||!g)&&(R&&S?d=S(t,f):T?d=_?_(t.length):o.jsxRuntimeExports.jsx("span",{className:"font-bold",children:"Selected"}):H&&!s?d=o.jsxRuntimeExports.jsx("span",{className:h.displayLabel,children:H}):R||(M?d=o.jsxRuntimeExports.jsx("span",{className:b.clsx(h.displayLabel,"text-neutral-foreground-low"),children:M}):D&&(d=o.jsxRuntimeExports.jsx("span",{className:b.clsx(h.displayLabel,"text-neutral-foreground-low"),children:D}))));function ue(e,n){const r=A(e);return K?k(e,n,r):O?O(e,r):o.jsxRuntimeExports.jsx("span",{children:x(e)})}const fe=i.map((e,n)=>o.jsxRuntimeExports.jsxs(je.Option,{selected:!s&&A(e),disabled:e?.disabled,secondary:E,noHover:s,className:b.clsx(h.optionContent,n===m&&h.highlighted),onClick:()=>I(e),children:[s&&o.jsxRuntimeExports.jsx(Ce.Checkbox,{value:A(e),className:"pointer-events-none"}),ue(e,n)]},n)),xe=L?L():X?o.jsxRuntimeExports.jsx(pe.Button,{variant:"plain",size:"small",onClick:ae,children:z?z():"Clear"}):void 0,de=T&&s?o.jsxRuntimeExports.jsx("span",{className:h.selectCount,children:t.length}):void 0;return o.jsxRuntimeExports.jsx("div",{className:"select",onKeyDown:ie,children:o.jsxRuntimeExports.jsx(he.SelectContainer,{value:a,onChange:B,labelValue:Y,disabled:j,isError:w,errorMessage:$,infoMessage:V,required:ee,secondary:E,options:fe,actions:xe,complement:de,className:b.clsx("select-content",re),children:o.jsxRuntimeExports.jsx(ge.SelectContent,{value:v,onChange:e=>le(e),expanded:a,onExpandedChange:e=>B(e),searchable:g,disabled:j,isError:w,secondary:E,icon:ne,searchLabel:q?q():void 0,status:d,options:R?f:void 0})})})}exports.Select=Ee;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{useState as U}from"react";import{c as v}from"./clsx-B-dksMZM.js";import{useControllable as q}from"../hooks/useControllable.es.js";import{i as G}from"./index-C-RplXeX.js";import{S as
|
|
1
|
+
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{useState as U}from"react";import{c as v}from"./clsx-B-dksMZM.js";import{useControllable as q}from"../hooks/useControllable.es.js";import{i as G}from"./index-C-RplXeX.js";import{S as me}from"./SelectContainer-DxvxE0To.js";import{S as ge}from"./SelectContent-Dc47jokE.js";import{O as xe}from"./Option-BU2gWM4H.js";import{C as pe}from"./Checkbox-BWJvfeIk.js";import{B as ye}from"./Button-Dwf5lfho.js";const Ce="_optionContent_dkzu4_2",je="_displayLabel_dkzu4_2",ve="_selectCount_dkzu4_2",m={optionContent:Ce,displayLabel:je,selectCount:ve};function ze({value:J,defaultValue:f,onChange:P,options:d=[],labelKey:Q="label",valueKey:W="value",multiple:t=!1,searchable:g=!1,clearable:X=!1,disabled:x=!1,labelValue:Y="",getObject:Z=!1,isError:L=!1,errorMessage:$="",infoMessage:V="",required:ee=!1,placeholder:O,secondary:A=!1,icon:ne,expanded:se,onExpandedChange:te,renderSearchLabel:S,renderOption:_,renderStatus:z,renderStatusLabel:E,renderActions:I,renderClearLabel:H,children:N,className:ae}){const re=t?Array.isArray(f)?f:f!=null?[f]:[]:Array.isArray(f)?f[0]:f??null,[s,C]=q({value:J,defaultValue:re,onChange:P}),[b,oe]=U(""),[l,p]=q({value:se,defaultValue:!1,onChange:te}),[j,c]=U(-1);function u(e){return G(e)?e[Q]:String(e??"")}function o(e){return G(e)?e[W]:e}function k(e){return t?(Array.isArray(s)?s:[]).some(a=>o(a)===o(e)):o(s)===o(e)}function B(e){if(x)return;const n=Z?e:o(e);if(t){const a=Array.isArray(s)?[...s]:[],y=a.findIndex(D=>o(D)===o(e));y!==-1?a.splice(y,1):a.push(n),C(a)}else C(n),p(!1),c(-1)}function le(){C(t?[]:null)}const i=g&&b?d.filter(e=>u(e).toLowerCase().includes(b.toLowerCase())):d;function ce(){if(t){const n=Array.isArray(s)?s:[];return n.length===0?"":n.map(a=>{const y=d.find(D=>o(D)===o(a));return u(y||a)}).join(", ")}if(s==null)return"";const e=d.find(n=>o(n)===o(s));return u(e||s)}const K=ce(),w=t?Array.isArray(s)&&s.length>0:s!=null;function ie(e){if(!x)switch(e.key){case"ArrowDown":e.preventDefault(),l?c(n=>n<i.length-1?n+1:n):(p(!0),c(0));break;case"ArrowUp":e.preventDefault(),l?c(n=>n>0?n-1:n):(p(!0),c(i.length-1));break;case"Home":e.preventDefault(),l&&i.length>0&&c(0);break;case"End":e.preventDefault(),l&&i.length>0&&c(i.length-1);break;case"Enter":e.preventDefault(),l&&j>=0&&j<i.length&&B(i[j]);break;case"Escape":e.preventDefault(),p(!1),c(-1);break}}function M(e){p(e),e||c(-1)}const R=typeof N=="function",T=R?void 0:N,F=t&&Array.isArray(s)&&s.length>0&&!x&&(!l&&g||!g);let h;(!l||!g)&&(w&&z?h=z(s,d):F?h=E?E(s.length):r.jsx("span",{className:"font-bold",children:"Selected"}):K&&!t?h=r.jsx("span",{className:m.displayLabel,children:K}):w||(T?h=r.jsx("span",{className:v(m.displayLabel,"text-neutral-foreground-low"),children:T}):O&&(h=r.jsx("span",{className:v(m.displayLabel,"text-neutral-foreground-low"),children:O}))));function fe(e,n){const a=k(e);return R?N(e,n,a):_?_(e,a):r.jsx("span",{children:u(e)})}const de=i.map((e,n)=>r.jsxs(xe,{selected:!t&&k(e),disabled:e?.disabled,secondary:A,noHover:t,className:v(m.optionContent,n===j&&m.highlighted),onClick:()=>B(e),children:[t&&r.jsx(pe,{value:k(e),className:"pointer-events-none"}),fe(e,n)]},n)),ue=I?I():X?r.jsx(ye,{variant:"plain",size:"small",onClick:le,children:H?H():"Clear"}):void 0,he=F&&t?r.jsx("span",{className:m.selectCount,children:s.length}):void 0;return r.jsx("div",{className:"select",onKeyDown:ie,children:r.jsx(me,{value:l,onChange:M,labelValue:Y,disabled:x,isError:L,errorMessage:$,infoMessage:V,required:ee,secondary:A,options:de,actions:ue,complement:he,className:v("select-content",ae),children:r.jsx(ge,{value:b,onChange:e=>oe(e),expanded:l,onExpandedChange:e=>M(e),searchable:g,disabled:x,isError:L,secondary:A,icon:ne,searchLabel:S?S():void 0,status:h,options:w?d:void 0})})})}export{ze as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),r=require("react"),i=require("./clsx-C11secjj.js"),G=require("../hooks/useControllable.cjs.js"),H=require("./ExpandableContainer-
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),r=require("react"),i=require("./clsx-C11secjj.js"),G=require("../hooks/useControllable.cjs.js"),H=require("./ExpandableContainer-BSfYcFgO.js");function J({value:E,defaultValue:R,onChange:j,labelValue:v="",absolute:C=!1,disabled:a=!1,isError:q=!1,errorMessage:N="",infoMessage:O="",required:g=!1,closeOnBlur:w=!0,dontHaveMaxHeight:u=!1,maxHeight:z="40px",minWidth:S="15em",secondary:x=!1,hideArrow:T=!1,disableLabelAutoWidth:k=!1,icon:y,children:D,complement:I,leadingComplement:L,label:M,content:_,options:$,actions:f,className:A}){const[d,B]=G.useControllable({value:E,defaultValue:R}),o=a?!1:d??!1,m=r.useRef(o);m.current=o;const b=r.useRef(null),t=r.useRef(null);function c(){t.current&&(t.current.style.maxHeight=m.current?`${t.current.scrollHeight+1}px`:"0px")}return r.useEffect(()=>{const s=b.current;if(!s)return;const n=s.querySelector(".label-container"),p=t.current,l=new ResizeObserver(()=>c()),h=new MutationObserver(()=>c());n&&(h.observe(n,{characterData:!0,subtree:!0,childList:!0}),l.observe(n,{box:"border-box"})),p&&l.observe(p,{box:"border-box"});const F=setTimeout(()=>c(),200);return()=>{l.disconnect(),h.disconnect(),clearTimeout(F)}},[]),r.useEffect(()=>{c()}),e.jsxRuntimeExports.jsx("div",{ref:b,children:e.jsxRuntimeExports.jsx(H.ExpandableContainer,{className:i.clsx("select-container",A),value:d,onChange:(s,n)=>{B(s),j?.(s,n)},absolute:C,labelValue:v,closeOnBlur:w,disabled:a,isError:q,errorMessage:N,infoMessage:O,required:g,maxHeight:z,minWidth:S,secondary:x,hideArrow:T,disableLabelAutoWidth:k,label:M,complement:I,leadingComplement:L,icon:y,content:e.jsxRuntimeExports.jsx("div",{ref:t,className:"content-wrapper",children:e.jsxRuntimeExports.jsxs("div",{className:i.clsx("sc-content","transition-translate",{secondary:x,expanded:o,"has-max-height":!u}),children:[_||e.jsxRuntimeExports.jsx("ul",{role:"list",className:i.clsx("options-list",{"p-xxs [&>*]:p-xs":!u}),children:$}),f&&e.jsxRuntimeExports.jsx("div",{className:"sc-actions",tabIndex:0,children:f})]})}),children:D})})}exports.SelectContainer=J;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{useRef as a,useEffect as E}from"react";import{c as l}from"./clsx-B-dksMZM.js";import{useControllable as J}from"../hooks/useControllable.es.js";import{E as K}from"./ExpandableContainer-
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{useRef as a,useEffect as E}from"react";import{c as l}from"./clsx-B-dksMZM.js";import{useControllable as J}from"../hooks/useControllable.es.js";import{E as K}from"./ExpandableContainer-DGBcw0Ik.js";function X({value:j,defaultValue:v,onChange:R,labelValue:N="",absolute:C=!1,disabled:i=!1,isError:O=!1,errorMessage:g="",infoMessage:w="",required:z=!1,closeOnBlur:S=!0,dontHaveMaxHeight:f=!1,maxHeight:T="40px",minWidth:q="15em",secondary:u=!1,hideArrow:y=!1,disableLabelAutoWidth:D=!1,icon:I,children:L,complement:M,leadingComplement:$,label:k,content:A,options:B,actions:x,className:F}){const[m,G]=J({value:j,defaultValue:v}),o=i?!1:m??!1,d=a(o);d.current=o;const p=a(null),t=a(null);function n(){t.current&&(t.current.style.maxHeight=d.current?`${t.current.scrollHeight+1}px`:"0px")}return E(()=>{const r=p.current;if(!r)return;const s=r.querySelector(".label-container"),b=t.current,c=new ResizeObserver(()=>n()),h=new MutationObserver(()=>n());s&&(h.observe(s,{characterData:!0,subtree:!0,childList:!0}),c.observe(s,{box:"border-box"})),b&&c.observe(b,{box:"border-box"});const H=setTimeout(()=>n(),200);return()=>{c.disconnect(),h.disconnect(),clearTimeout(H)}},[]),E(()=>{n()}),e.jsx("div",{ref:p,children:e.jsx(K,{className:l("select-container",F),value:m,onChange:(r,s)=>{G(r),R?.(r,s)},absolute:C,labelValue:N,closeOnBlur:S,disabled:i,isError:O,errorMessage:g,infoMessage:w,required:z,maxHeight:T,minWidth:q,secondary:u,hideArrow:y,disableLabelAutoWidth:D,label:k,complement:M,leadingComplement:$,icon:I,content:e.jsx("div",{ref:t,className:"content-wrapper",children:e.jsxs("div",{className:l("sc-content","transition-translate",{secondary:u,expanded:o,"has-max-height":!f}),children:[A||e.jsx("ul",{role:"list",className:l("options-list",{"p-xxs [&>*]:p-xs":!f}),children:B}),x&&e.jsx("div",{className:"sc-actions",tabIndex:0,children:x})]})}),children:L})})}export{X as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./jsx-runtime-u17CrQMm.js";import{createContext as U,useState as L,useRef as z,useEffect as A,useContext as F}from"react";import{useControllable as D}from"../hooks/useControllable.es.js";import{p as G,i as J}from"./index-C-RplXeX.js";const M="_sidebar_1bq5p_2",Q="_collapsed_1bq5p_2",X="_expanded_1bq5p_2",Y="_optionsList_1bq5p_2",Z="_optionsContainer_1bq5p_2",ee="_bottomOptions_1bq5p_2",ne="_option_1bq5p_2",te="_optionActive_1bq5p_2",se="_optionIcon_1bq5p_2",ie="_optionLabel_1bq5p_2",oe="_optionLink_1bq5p_2",ae="_disabled_1bq5p_2",le="_subPanel_1bq5p_2",re="_subPanelHidden_1bq5p_2",ce="_subPanelVisible_1bq5p_2",de="_subOption_1bq5p_2",ue="_subOptionActive_1bq5p_2",be="_subOptionIcon_1bq5p_2",pe="_subOptionLabel_1bq5p_2",he="_subOptionChevron_1bq5p_2",fe="_rotated_1bq5p_2",_e="_subOptionLink_1bq5p_2",t={sidebar:M,collapsed:Q,expanded:X,optionsList:Y,optionsContainer:Z,bottomOptions:ee,option:ne,optionActive:te,optionIcon:se,optionLabel:ie,optionLink:oe,disabled:ae,subPanel:le,subPanelHidden:re,subPanelVisible:ce,subOption:de,subOptionActive:ue,subOptionIcon:be,subOptionLabel:pe,subOptionChevron:he,rotated:fe,subOptionLink:_e};let j=null;try{j=require("react-router-dom").Link}catch{}const E=U({currentValue:void 0,onChange:()=>{}});function m(e){return J(e)?e.value:e}function q(e){return e?e.startsWith("/")?e:"/"+e:""}function W({option:e,depth:x,parentPath:C=""}){const[b,r]=L(!1),{currentValue:f,onChange:v}=F(E);let a=C;e.path&&(!a.endsWith("/")&&!e.path.startsWith("/")?a+="/":a.endsWith("/")&&e.path.startsWith("/")&&(a=a.slice(0,-1)),a+=e.path);const c=!!(e.options&&e.options.length);function d(l=e){return m(f)===m(l)||!!l.options&&l.options.some(_=>d(_))}const p=d();function u(l){e.disabled||(c?r(_=>!_):v(e))}function P(l){l.key==="Enter"&&u()}const g=[t.subOption,p?t.subOptionActive:"",b?t.subOptionExpanded:"",e.disabled?t.disabled:""].filter(Boolean).join(" "),k={paddingLeft:`${x*16+16}px`},O=s.jsxs("div",{className:g,style:k,tabIndex:0,onClick:u,onKeyUp:P,role:c?"button":void 0,children:[e.icon&&s.jsx("span",{className:`${t.subOptionIcon} material-symbols-rounded`,children:e.icon}),s.jsx("span",{className:t.subOptionLabel,children:e.label}),c&&s.jsx("span",{className:`${t.subOptionChevron} material-symbols-rounded${b?` ${t.rotated}`:""}`,children:"keyboard_arrow_down"})]});let h;return c?h=O:j&&e.path?h=s.jsx(j,{to:a,tabIndex:0,className:t.subOptionLink,onClick:()=>v(e),children:O}):e.path?h=s.jsx("a",{href:a,tabIndex:0,className:t.subOptionLink,children:O}):h=O,s.jsxs(s.Fragment,{children:[h,c&&b&&e.options?.map(l=>s.jsx(W,{option:l,depth:x+1,parentPath:a},l.value))]})}function me({option:e,sidebarExpanded:x,onRailClick:C,activeParentValue:b}){const r=!!(e.options&&e.options.length),f=m(e)===m(b),v=[t.option,f?t.optionActive:"",e.disabled?t.disabled:""].filter(Boolean).join(" ");function a(){e.disabled||C(e)}function c(p){p.key==="Enter"&&a()}const d=s.jsxs("div",{className:v,tabIndex:0,onClick:a,onKeyUp:c,role:r?"button":void 0,"aria-expanded":r?f:void 0,children:[s.jsx("span",{className:t.optionIcon,children:e.icon&&s.jsx("span",{className:"material-symbols-rounded",children:e.icon})}),x&&s.jsx("span",{className:t.optionLabel,children:e.label})]});return r?d:j&&e.path?s.jsx(j,{to:q(e.path),tabIndex:0,className:t.optionLink,children:d}):e.path?s.jsx("a",{href:q(e.path),tabIndex:0,className:t.optionLink,children:d}):d}function je({value:e,defaultValue:x,onChange:C,expanded:b=!1,options:r,getObject:f=!1,className:v}){const[a,c]=D({value:e,defaultValue:x,onChange:C}),[d,p]=L(!1),[u,P]=L(void 0),[g,k]=L("100vh"),O=z(null);A(()=>{function n(){const i=document.querySelector(".navbar")?.getBoundingClientRect()?.height;k(i?`calc(100vh - ${i}px)`:"100vh")}return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),A(()=>{const n=h(r);n&&_(n)},[]);function h(n,i=""){for(const o of n){const S=l(i,o.path);if(G(S))return o;const V=h(o.options||[],S);if(V)return V}}function l(n,i){if(!i)return n;let o=n;return!o.endsWith("/")&&!i.startsWith("/")?o+="/":o.endsWith("/")&&i.startsWith("/")&&(o=o.slice(0,-1)),o+i}function _(n){if(n.disabled)return;const i=f?n:m(n);c(i)}function N(n,i){return n.find(o=>m(o)===m(i)?!0:!!N(o.options||[],i))}const B=N(r,a),w=r.filter(n=>!n.bottom),y=r.filter(n=>n.bottom);function H(n){if(n.disabled)return;!!(n.options&&n.options.length)?u?.value===n.value?p(o=>!o):(P(n),p(!0)):(p(!1),_(n))}function R(n){const i=n.relatedTarget,o=n.currentTarget;(!i||!o.contains(i))&&p(!1)}const $=[t.sidebar,b?t.expanded:t.collapsed,v].filter(Boolean).join(" "),K=[t.subPanel,d?t.subPanelVisible:t.subPanelHidden].filter(Boolean).join(" "),T={currentValue:a,onChange:_,getObject:f};function I(n){return s.jsx(me,{option:n,sidebarExpanded:b,onRailClick:H,activeParentValue:B},n.value)}return s.jsx(E.Provider,{value:T,children:s.jsxs("div",{ref:O,className:$,style:{height:g},tabIndex:0,onBlur:R,children:[s.jsxs("div",{className:t.optionsList,children:[s.jsx("div",{className:t.optionsContainer,children:w.map(I)}),y.length>0&&s.jsx("div",{className:t.bottomOptions,children:y.map(I)})]}),s.jsx("div",{className:K,children:u&&u.options&&u.options.length>0&&u.options.map(n=>s.jsx(W,{option:n,depth:0,parentPath:q(u.path)},n.value))})]})})}export{je as S};
|
|
1
|
+
import{j as s}from"./jsx-runtime-u17CrQMm.js";import{createContext as U,useState as L,useRef as z,useEffect as A,useContext as F}from"react";import{useControllable as D}from"../hooks/useControllable.es.js";import{p as G,i as J}from"./index-C-RplXeX.js";const M="_sidebar_1bq5p_2",Q="_collapsed_1bq5p_2",X="_expanded_1bq5p_2",Y="_optionsList_1bq5p_2",Z="_optionsContainer_1bq5p_2",ee="_bottomOptions_1bq5p_2",ne="_option_1bq5p_2",te="_optionActive_1bq5p_2",se="_optionIcon_1bq5p_2",ie="_optionLabel_1bq5p_2",oe="_optionLink_1bq5p_2",ae="_disabled_1bq5p_2",le="_subPanel_1bq5p_2",re="_subPanelHidden_1bq5p_2",ce="_subPanelVisible_1bq5p_2",de="_subOption_1bq5p_2",ue="_subOptionActive_1bq5p_2",be="_subOptionIcon_1bq5p_2",pe="_subOptionLabel_1bq5p_2",he="_subOptionChevron_1bq5p_2",fe="_rotated_1bq5p_2",_e="_subOptionLink_1bq5p_2",t={sidebar:M,collapsed:Q,expanded:X,optionsList:Y,optionsContainer:Z,bottomOptions:ee,option:ne,optionActive:te,optionIcon:se,optionLabel:ie,optionLink:oe,disabled:ae,subPanel:le,subPanelHidden:re,subPanelVisible:ce,subOption:de,subOptionActive:ue,subOptionIcon:be,subOptionLabel:pe,subOptionChevron:he,rotated:fe,subOptionLink:_e};let j=null;try{j=require("react-router-dom").Link}catch{}const E=U({currentValue:void 0,onChange:()=>{}});function m(e){return J(e)?e.value:e}function q(e){return e?e.startsWith("/")?e:"/"+e:""}function W({option:e,depth:x,parentPath:C=""}){const[b,r]=L(!1),{currentValue:f,onChange:v}=F(E);let a=C;e.path&&(!a.endsWith("/")&&!e.path.startsWith("/")?a+="/":a.endsWith("/")&&e.path.startsWith("/")&&(a=a.slice(0,-1)),a+=e.path);const c=!!(e.options&&e.options.length);function d(l=e){return m(f)===m(l)||!!l.options&&l.options.some(_=>d(_))}const p=d();function u(l){e.disabled||(c?r(_=>!_):v(e))}function P(l){l.key==="Enter"&&u()}const g=[t.subOption,p?t.subOptionActive:"",b?t.subOptionExpanded:"",e.disabled?t.disabled:""].filter(Boolean).join(" "),k={paddingLeft:`${x*16+16}px`},O=s.jsxs("div",{className:g,style:k,tabIndex:0,onClick:u,onKeyUp:P,role:c?"button":void 0,children:[e.icon&&s.jsx("span",{className:`${t.subOptionIcon} material-symbols-rounded`,children:e.icon}),s.jsx("span",{className:t.subOptionLabel,children:e.label}),c&&s.jsx("span",{className:`${t.subOptionChevron} material-symbols-rounded${b?` ${t.rotated}`:""}`,children:"keyboard_arrow_down"})]});let h;return c?h=O:j&&e.path?h=s.jsx(j,{to:a,tabIndex:0,className:t.subOptionLink,onClick:()=>v(e),children:O}):e.path?h=s.jsx("a",{href:a,tabIndex:0,className:t.subOptionLink,children:O}):h=O,s.jsxs(s.Fragment,{children:[h,c&&b&&e.options?.map(l=>s.jsx(W,{option:l,depth:x+1,parentPath:a},l.value))]})}function me({option:e,sidebarExpanded:x,onRailClick:C,activeParentValue:b}){const r=!!(e.options&&e.options.length),f=m(e)===m(b),v=[t.option,f?t.optionActive:"",e.disabled?t.disabled:""].filter(Boolean).join(" ");function a(){e.disabled||C(e)}function c(p){p.key==="Enter"&&a()}const d=s.jsxs("div",{className:v,tabIndex:0,onClick:a,onKeyUp:c,role:r?"button":void 0,"aria-expanded":r?f:void 0,children:[s.jsx("span",{className:t.optionIcon,children:e.icon&&s.jsx("span",{className:"material-symbols-rounded",children:e.icon})}),x&&s.jsx("span",{className:t.optionLabel,children:e.label})]});return r?d:j&&e.path?s.jsx(j,{to:q(e.path),tabIndex:0,className:t.optionLink,children:d}):e.path?s.jsx("a",{href:q(e.path),tabIndex:0,className:t.optionLink,children:d}):d}function je({value:e,defaultValue:x,onChange:C,expanded:b=!1,options:r,getObject:f=!1,className:v}){const[a,c]=D({value:e,defaultValue:x,onChange:C}),[d,p]=L(!1),[u,P]=L(void 0),[g,k]=L("100vh"),O=z(null);A(()=>{function n(){const i=document.querySelector(".navbar")?.getBoundingClientRect()?.height;k(i?`calc(100vh - ${i}px)`:"100vh")}return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),A(()=>{const n=h(r);n&&_(n)},[]);function h(n,i=""){for(const o of n){const S=l(i,o.path);if(G(S))return o;const V=h(o.options||[],S);if(V)return V}}function l(n,i){if(!i)return n;let o=n;return!o.endsWith("/")&&!i.startsWith("/")?o+="/":o.endsWith("/")&&i.startsWith("/")&&(o=o.slice(0,-1)),o+i}function _(n){if(n.disabled)return;const i=f?n:m(n);c(i)}function N(n,i){return n.find(o=>m(o)===m(i)?!0:!!N(o.options||[],i))}const B=N(r,a),w=r.filter(n=>!n.bottom),y=r.filter(n=>n.bottom);function H(n){if(n.disabled)return;!!(n.options&&n.options.length)?u?.value===n.value?p(o=>!o):(P(n),p(!0)):(p(!1),_(n))}function R(n){const i=n.relatedTarget,o=n.currentTarget;(!i||!o.contains(i))&&p(!1)}const $=[t.sidebar,"sidebar",b?t.expanded:t.collapsed,v].filter(Boolean).join(" "),K=[t.subPanel,d?t.subPanelVisible:t.subPanelHidden].filter(Boolean).join(" "),T={currentValue:a,onChange:_,getObject:f};function I(n){return s.jsx(me,{option:n,sidebarExpanded:b,onRailClick:H,activeParentValue:B},n.value)}return s.jsx(E.Provider,{value:T,children:s.jsxs("div",{ref:O,className:$,style:{height:g},tabIndex:0,onBlur:R,children:[s.jsxs("div",{className:t.optionsList,children:[s.jsx("div",{className:t.optionsContainer,children:w.map(I)}),y.length>0&&s.jsx("div",{className:t.bottomOptions,children:y.map(I)})]}),s.jsx("div",{className:K,children:u&&u.options&&u.options.length>0&&u.options.map(n=>s.jsx(W,{option:n,depth:0,parentPath:q(u.path)},n.value))})]})})}export{je as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-BubrbI3X.js"),p=require("react"),U=require("../hooks/useControllable.cjs.js"),S=require("./index-B4fH-h2h.js"),z="_sidebar_1bq5p_2",F="_collapsed_1bq5p_2",D="_expanded_1bq5p_2",G="_optionsList_1bq5p_2",J="_optionsContainer_1bq5p_2",M="_bottomOptions_1bq5p_2",Q="_option_1bq5p_2",X="_optionActive_1bq5p_2",Y="_optionIcon_1bq5p_2",Z="_optionLabel_1bq5p_2",ee="_optionLink_1bq5p_2",te="_disabled_1bq5p_2",ne="_subPanel_1bq5p_2",se="_subPanelHidden_1bq5p_2",ie="_subPanelVisible_1bq5p_2",oe="_subOption_1bq5p_2",ae="_subOptionActive_1bq5p_2",re="_subOptionIcon_1bq5p_2",le="_subOptionLabel_1bq5p_2",ce="_subOptionChevron_1bq5p_2",ue="_rotated_1bq5p_2",de="_subOptionLink_1bq5p_2",n={sidebar:z,collapsed:F,expanded:D,optionsList:G,optionsContainer:J,bottomOptions:M,option:Q,optionActive:X,optionIcon:Y,optionLabel:Z,optionLink:ee,disabled:te,subPanel:ne,subPanelHidden:se,subPanelVisible:ie,subOption:oe,subOptionActive:ae,subOptionIcon:re,subOptionLabel:le,subOptionChevron:ce,rotated:ue,subOptionLink:de};let E=null;try{E=require("react-router-dom").Link}catch{}const V=p.createContext({currentValue:void 0,onChange:()=>{}});function m(e){return S.isObject(e)?e.value:e}function k(e){return e?e.startsWith("/")?e:"/"+e:""}function A({option:e,depth:j,parentPath:C=""}){const[b,l]=p.useState(!1),{currentValue:f,onChange:v}=p.useContext(V);let a=C;e.path&&(!a.endsWith("/")&&!e.path.startsWith("/")?a+="/":a.endsWith("/")&&e.path.startsWith("/")&&(a=a.slice(0,-1)),a+=e.path);const c=!!(e.options&&e.options.length);function u(r=e){return m(f)===m(r)||!!r.options&&r.options.some(_=>u(_))}const x=u();function d(r){e.disabled||(c?l(_=>!_):v(e))}function R(r){r.key==="Enter"&&d()}const q=[n.subOption,x?n.subOptionActive:"",b?n.subOptionExpanded:"",e.disabled?n.disabled:""].filter(Boolean).join(" "),L={paddingLeft:`${j*16+16}px`},O=s.jsxRuntimeExports.jsxs("div",{className:q,style:L,tabIndex:0,onClick:d,onKeyUp:R,role:c?"button":void 0,children:[e.icon&&s.jsxRuntimeExports.jsx("span",{className:`${n.subOptionIcon} material-symbols-rounded`,children:e.icon}),s.jsxRuntimeExports.jsx("span",{className:n.subOptionLabel,children:e.label}),c&&s.jsxRuntimeExports.jsx("span",{className:`${n.subOptionChevron} material-symbols-rounded${b?` ${n.rotated}`:""}`,children:"keyboard_arrow_down"})]});let h;return c?h=O:E&&e.path?h=s.jsxRuntimeExports.jsx(E,{to:a,tabIndex:0,className:n.subOptionLink,onClick:()=>v(e),children:O}):e.path?h=s.jsxRuntimeExports.jsx("a",{href:a,tabIndex:0,className:n.subOptionLink,children:O}):h=O,s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h,c&&b&&e.options?.map(r=>s.jsxRuntimeExports.jsx(A,{option:r,depth:j+1,parentPath:a},r.value))]})}function pe({option:e,sidebarExpanded:j,onRailClick:C,activeParentValue:b}){const l=!!(e.options&&e.options.length),f=m(e)===m(b),v=[n.option,f?n.optionActive:"",e.disabled?n.disabled:""].filter(Boolean).join(" ");function a(){e.disabled||C(e)}function c(x){x.key==="Enter"&&a()}const u=s.jsxRuntimeExports.jsxs("div",{className:v,tabIndex:0,onClick:a,onKeyUp:c,role:l?"button":void 0,"aria-expanded":l?f:void 0,children:[s.jsxRuntimeExports.jsx("span",{className:n.optionIcon,children:e.icon&&s.jsxRuntimeExports.jsx("span",{className:"material-symbols-rounded",children:e.icon})}),j&&s.jsxRuntimeExports.jsx("span",{className:n.optionLabel,children:e.label})]});return l?u:E&&e.path?s.jsxRuntimeExports.jsx(E,{to:k(e.path),tabIndex:0,className:n.optionLink,children:u}):e.path?s.jsxRuntimeExports.jsx("a",{href:k(e.path),tabIndex:0,className:n.optionLink,children:u}):u}function be({value:e,defaultValue:j,onChange:C,expanded:b=!1,options:l,getObject:f=!1,className:v}){const[a,c]=U.useControllable({value:e,defaultValue:j,onChange:C}),[u,x]=p.useState(!1),[d,R]=p.useState(void 0),[q,L]=p.useState("100vh"),O=p.useRef(null);p.useEffect(()=>{function t(){const i=document.querySelector(".navbar")?.getBoundingClientRect()?.height;L(i?`calc(100vh - ${i}px)`:"100vh")}return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),p.useEffect(()=>{const t=h(l);t&&_(t)},[]);function h(t,i=""){for(const o of t){const y=r(i,o.path);if(S.checkPath(y))return o;const I=h(o.options||[],y);if(I)return I}}function r(t,i){if(!i)return t;let o=t;return!o.endsWith("/")&&!i.startsWith("/")?o+="/":o.endsWith("/")&&i.startsWith("/")&&(o=o.slice(0,-1)),o+i}function _(t){if(t.disabled)return;const i=f?t:m(t);c(i)}function P(t,i){return t.find(o=>m(o)===m(i)?!0:!!P(o.options||[],i))}const W=P(l,a),B=l.filter(t=>!t.bottom),g=l.filter(t=>t.bottom);function w(t){if(t.disabled)return;!!(t.options&&t.options.length)?d?.value===t.value?x(o=>!o):(R(t),x(!0)):(x(!1),_(t))}function H(t){const i=t.relatedTarget,o=t.currentTarget;(!i||!o.contains(i))&&x(!1)}const $=[n.sidebar,b?n.expanded:n.collapsed,v].filter(Boolean).join(" "),K=[n.subPanel,u?n.subPanelVisible:n.subPanelHidden].filter(Boolean).join(" "),T={currentValue:a,onChange:_,getObject:f};function N(t){return s.jsxRuntimeExports.jsx(pe,{option:t,sidebarExpanded:b,onRailClick:w,activeParentValue:W},t.value)}return s.jsxRuntimeExports.jsx(V.Provider,{value:T,children:s.jsxRuntimeExports.jsxs("div",{ref:O,className:$,style:{height:q},tabIndex:0,onBlur:H,children:[s.jsxRuntimeExports.jsxs("div",{className:n.optionsList,children:[s.jsxRuntimeExports.jsx("div",{className:n.optionsContainer,children:B.map(N)}),g.length>0&&s.jsxRuntimeExports.jsx("div",{className:n.bottomOptions,children:g.map(N)})]}),s.jsxRuntimeExports.jsx("div",{className:K,children:d&&d.options&&d.options.length>0&&d.options.map(t=>s.jsxRuntimeExports.jsx(A,{option:t,depth:0,parentPath:k(d.path)},t.value))})]})})}exports.Sidebar=be;
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-BubrbI3X.js"),p=require("react"),U=require("../hooks/useControllable.cjs.js"),S=require("./index-B4fH-h2h.js"),z="_sidebar_1bq5p_2",F="_collapsed_1bq5p_2",D="_expanded_1bq5p_2",G="_optionsList_1bq5p_2",J="_optionsContainer_1bq5p_2",M="_bottomOptions_1bq5p_2",Q="_option_1bq5p_2",X="_optionActive_1bq5p_2",Y="_optionIcon_1bq5p_2",Z="_optionLabel_1bq5p_2",ee="_optionLink_1bq5p_2",te="_disabled_1bq5p_2",ne="_subPanel_1bq5p_2",se="_subPanelHidden_1bq5p_2",ie="_subPanelVisible_1bq5p_2",oe="_subOption_1bq5p_2",ae="_subOptionActive_1bq5p_2",re="_subOptionIcon_1bq5p_2",le="_subOptionLabel_1bq5p_2",ce="_subOptionChevron_1bq5p_2",ue="_rotated_1bq5p_2",de="_subOptionLink_1bq5p_2",n={sidebar:z,collapsed:F,expanded:D,optionsList:G,optionsContainer:J,bottomOptions:M,option:Q,optionActive:X,optionIcon:Y,optionLabel:Z,optionLink:ee,disabled:te,subPanel:ne,subPanelHidden:se,subPanelVisible:ie,subOption:oe,subOptionActive:ae,subOptionIcon:re,subOptionLabel:le,subOptionChevron:ce,rotated:ue,subOptionLink:de};let E=null;try{E=require("react-router-dom").Link}catch{}const V=p.createContext({currentValue:void 0,onChange:()=>{}});function m(e){return S.isObject(e)?e.value:e}function k(e){return e?e.startsWith("/")?e:"/"+e:""}function A({option:e,depth:j,parentPath:C=""}){const[b,l]=p.useState(!1),{currentValue:f,onChange:v}=p.useContext(V);let a=C;e.path&&(!a.endsWith("/")&&!e.path.startsWith("/")?a+="/":a.endsWith("/")&&e.path.startsWith("/")&&(a=a.slice(0,-1)),a+=e.path);const c=!!(e.options&&e.options.length);function u(r=e){return m(f)===m(r)||!!r.options&&r.options.some(_=>u(_))}const x=u();function d(r){e.disabled||(c?l(_=>!_):v(e))}function R(r){r.key==="Enter"&&d()}const q=[n.subOption,x?n.subOptionActive:"",b?n.subOptionExpanded:"",e.disabled?n.disabled:""].filter(Boolean).join(" "),L={paddingLeft:`${j*16+16}px`},O=s.jsxRuntimeExports.jsxs("div",{className:q,style:L,tabIndex:0,onClick:d,onKeyUp:R,role:c?"button":void 0,children:[e.icon&&s.jsxRuntimeExports.jsx("span",{className:`${n.subOptionIcon} material-symbols-rounded`,children:e.icon}),s.jsxRuntimeExports.jsx("span",{className:n.subOptionLabel,children:e.label}),c&&s.jsxRuntimeExports.jsx("span",{className:`${n.subOptionChevron} material-symbols-rounded${b?` ${n.rotated}`:""}`,children:"keyboard_arrow_down"})]});let h;return c?h=O:E&&e.path?h=s.jsxRuntimeExports.jsx(E,{to:a,tabIndex:0,className:n.subOptionLink,onClick:()=>v(e),children:O}):e.path?h=s.jsxRuntimeExports.jsx("a",{href:a,tabIndex:0,className:n.subOptionLink,children:O}):h=O,s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[h,c&&b&&e.options?.map(r=>s.jsxRuntimeExports.jsx(A,{option:r,depth:j+1,parentPath:a},r.value))]})}function pe({option:e,sidebarExpanded:j,onRailClick:C,activeParentValue:b}){const l=!!(e.options&&e.options.length),f=m(e)===m(b),v=[n.option,f?n.optionActive:"",e.disabled?n.disabled:""].filter(Boolean).join(" ");function a(){e.disabled||C(e)}function c(x){x.key==="Enter"&&a()}const u=s.jsxRuntimeExports.jsxs("div",{className:v,tabIndex:0,onClick:a,onKeyUp:c,role:l?"button":void 0,"aria-expanded":l?f:void 0,children:[s.jsxRuntimeExports.jsx("span",{className:n.optionIcon,children:e.icon&&s.jsxRuntimeExports.jsx("span",{className:"material-symbols-rounded",children:e.icon})}),j&&s.jsxRuntimeExports.jsx("span",{className:n.optionLabel,children:e.label})]});return l?u:E&&e.path?s.jsxRuntimeExports.jsx(E,{to:k(e.path),tabIndex:0,className:n.optionLink,children:u}):e.path?s.jsxRuntimeExports.jsx("a",{href:k(e.path),tabIndex:0,className:n.optionLink,children:u}):u}function be({value:e,defaultValue:j,onChange:C,expanded:b=!1,options:l,getObject:f=!1,className:v}){const[a,c]=U.useControllable({value:e,defaultValue:j,onChange:C}),[u,x]=p.useState(!1),[d,R]=p.useState(void 0),[q,L]=p.useState("100vh"),O=p.useRef(null);p.useEffect(()=>{function t(){const i=document.querySelector(".navbar")?.getBoundingClientRect()?.height;L(i?`calc(100vh - ${i}px)`:"100vh")}return t(),window.addEventListener("resize",t),()=>window.removeEventListener("resize",t)},[]),p.useEffect(()=>{const t=h(l);t&&_(t)},[]);function h(t,i=""){for(const o of t){const y=r(i,o.path);if(S.checkPath(y))return o;const I=h(o.options||[],y);if(I)return I}}function r(t,i){if(!i)return t;let o=t;return!o.endsWith("/")&&!i.startsWith("/")?o+="/":o.endsWith("/")&&i.startsWith("/")&&(o=o.slice(0,-1)),o+i}function _(t){if(t.disabled)return;const i=f?t:m(t);c(i)}function P(t,i){return t.find(o=>m(o)===m(i)?!0:!!P(o.options||[],i))}const W=P(l,a),B=l.filter(t=>!t.bottom),g=l.filter(t=>t.bottom);function w(t){if(t.disabled)return;!!(t.options&&t.options.length)?d?.value===t.value?x(o=>!o):(R(t),x(!0)):(x(!1),_(t))}function H(t){const i=t.relatedTarget,o=t.currentTarget;(!i||!o.contains(i))&&x(!1)}const $=[n.sidebar,"sidebar",b?n.expanded:n.collapsed,v].filter(Boolean).join(" "),K=[n.subPanel,u?n.subPanelVisible:n.subPanelHidden].filter(Boolean).join(" "),T={currentValue:a,onChange:_,getObject:f};function N(t){return s.jsxRuntimeExports.jsx(pe,{option:t,sidebarExpanded:b,onRailClick:w,activeParentValue:W},t.value)}return s.jsxRuntimeExports.jsx(V.Provider,{value:T,children:s.jsxRuntimeExports.jsxs("div",{ref:O,className:$,style:{height:q},tabIndex:0,onBlur:H,children:[s.jsxRuntimeExports.jsxs("div",{className:n.optionsList,children:[s.jsxRuntimeExports.jsx("div",{className:n.optionsContainer,children:B.map(N)}),g.length>0&&s.jsxRuntimeExports.jsx("div",{className:n.bottomOptions,children:g.map(N)})]}),s.jsxRuntimeExports.jsx("div",{className:K,children:d&&d.options&&d.options.length>0&&d.options.map(t=>s.jsxRuntimeExports.jsx(A,{option:t,depth:0,parentPath:k(d.path)},t.value))})]})})}exports.Sidebar=be;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as b}from"./jsx-runtime-u17CrQMm.js";import Mt,{useState as X,useRef as C,useCallback as V,useEffect as k}from"react";import{c as q}from"./clsx-B-dksMZM.js";import{useControllable as wt}from"../hooks/useControllable.es.js";import{T as yt}from"./Tooltip-
|
|
1
|
+
import{j as b}from"./jsx-runtime-u17CrQMm.js";import Mt,{useState as X,useRef as C,useCallback as V,useEffect as k}from"react";import{c as q}from"./clsx-B-dksMZM.js";import{useControllable as wt}from"../hooks/useControllable.es.js";import{T as yt}from"./Tooltip-pqZN7nfJ.js";import{f as bt}from"./index-C-RplXeX.js";const Ct="_slider_rw7q0_2",xt="_small_rw7q0_2",St="_medium_rw7q0_2",Bt="_large_rw7q0_2",kt="_vertical_rw7q0_2",qt="_disabled_rw7q0_2",At="_stepSlider_rw7q0_2",Rt="_neutralBg_rw7q0_2",Tt="_track_rw7q0_2",Vt="_fillBar_rw7q0_2",Et="_fillBarVertical_rw7q0_2",Nt="_haveFillColors_rw7q0_2",Ht="_cursor_rw7q0_2",Dt="_dragging_rw7q0_2",Lt="_stepsContainer_rw7q0_2",Pt="_step_rw7q0_2",Wt="_stepActive_rw7q0_2",jt="_stepNeutral_rw7q0_2",Yt="_stepMarker_rw7q0_2",Ft="_stepMarkerActive_rw7q0_2",Xt="_stepMarkerNeutral_rw7q0_2",o={slider:Ct,small:xt,medium:St,large:Bt,vertical:kt,disabled:qt,stepSlider:At,neutralBg:Rt,track:Tt,fillBar:Vt,fillBarVertical:Et,haveFillColors:Nt,cursor:Ht,dragging:Dt,stepsContainer:Lt,step:Pt,stepActive:Wt,stepNeutral:jt,stepMarker:Yt,stepMarkerActive:Ft,stepMarkerNeutral:Xt},It=Mt.forwardRef(function(rt,A){const{value:I,onChange:nt,size:z="medium",max:a=0,unit:ot="",color:w="",showTooltip:st=!1,disabled:x=!1,vertical:_=!1,fillColors:v,isRange:m=!1,steps:d,neutralBackground:E=!1,className:it}=rt,lt=I!==void 0,[y,U]=wt({value:I,defaultValue:m?[0,0]:0,onChange:nt}),[$,G]=X([!1,!1]),[at,ct]=X(!1),[S,W]=X(void 0),N=C(null),J=C(null),B=C([]),j=C([!1,!1]),H=C(y),K=C(()=>{}),Y=C(()=>{}),O=C(()=>{}),ut=V(t=>{N.current=t,typeof A=="function"?A(t):A&&(A.current=t)},[A]);k(()=>{ct(!0),H.current=y},[y]);function ft(){return!at||E||!w?"":bt(w)}function F(t){return t===void 0?[0,0]:Array.isArray(t)?[t[0],t[1]]:[t,t]}function h(t){return!a||a===0?Math.min(1,Math.max(0,t)):Math.min(1,Math.max(0,t/a))}function dt(t){return!a||a===0?t:t*a}function Q(t){return!d||!d.length?t:d.map(r=>a?r.value/a:r.value).reduce((r,s)=>Math.abs(s-t)<Math.abs(r-t)?s:r)}const D=V(()=>{const t=N.current,e=J.current;if(!t)return;const r=F(H.current),s=m?[h(r[0]),h(r[1])]:[h(r[0])],c=B.current;if(c.forEach((n,i)=>{if(!n)return;const g=s[i]??0;if(_){const f=t.clientHeight,u=Math.min(f,Math.max(0,f*g)),p=getComputedStyle(n).getPropertyValue("--border-width-xs"),l=parseFloat(p)/2||0;n.style.bottom=r[i]<(a*.99||.99)||d&&d.length?u-n.clientHeight/3-l+"px":u-n.clientHeight-l+"px",n.style.left="50%"}else{const f=t.clientWidth,u=Math.min(f,Math.max(0,f*g)),p=getComputedStyle(n).getPropertyValue("--border-width-xs"),l=parseFloat(p)/2||0;n.style.left=r[i]<(a*.99||.99)||d&&d.length?u-n.clientWidth/3-l+"px":u-n.clientWidth-l+"px",n.style.bottom="50%"}}),!!e)if(_){const n=t.clientHeight,i=c.map(l=>l?l.clientHeight/2:0),f=c.map(l=>l?l.offsetTop:0).map((l,T)=>n-l-i[T]),u=m?Math.min(...f):0,p=Math.max(0,Math.max(...f));e.style.bottom=u+"px",e.style.height=Math.abs(p-u)+"px",e.style.left="50%",e.style.width="100%"}else{const n=c.filter(Boolean);if(!n.length)return;const i=n.map(u=>u.offsetLeft+u.clientWidth/3),g=m?Math.min(...i):0,f=Math.max(...i);e.style.left=g+"px",e.style.width=Math.abs(f-g)+n[0].clientWidth/6+"px",e.style.bottom="50%",e.style.height="100%"}},[m,_,a,d]),R=V(t=>{const e=[!1,!1];e[t]=!0,j.current=e,G([...e])},[]),L=V((t,e)=>{const r=N.current;r&&j.current.forEach((s,c)=>{if(!s)return;const n=B.current[c];if(!n)return;let i;if(_){const p=r.getBoundingClientRect(),l=r.clientHeight-n.clientHeight,T=e-n.clientHeight/2-p.top,P=l,vt=Math.min(P,Math.max(0,P-T));i=Q(vt/(l||1))}else{const p=r.getBoundingClientRect(),l=r.clientWidth-n.clientWidth,T=t-n.clientWidth/2-p.left,P=Math.min(l,Math.max(0,T));i=Q(P/(l||1))}const g=dt(i),f=F(H.current);let u;if(m){const p=[...f];p[c]=g,u=p}else u=g;H.current=u,U(u),W(u),setTimeout(()=>D(),0)})},[m,_,a,d,U,D]),ht=V(()=>{j.current=[!1,!1],G([!1,!1]),lt||W(void 0)},[]);k(()=>{if(S===void 0)return;(Array.isArray(S)&&Array.isArray(y)?S[0]===y[0]&&S[1]===y[1]:S===y)&&W(void 0)},[y,S]),k(()=>{K.current=t=>L(t.clientX,t.clientY),Y.current=ht,O.current=t=>{t.touches[0]&&L(t.touches[0].clientX,t.touches[0].clientY)}}),k(()=>{const t=c=>K.current(c),e=()=>Y.current(),r=c=>O.current(c),s=()=>Y.current();return window.addEventListener("mousemove",t),window.addEventListener("mouseup",e),window.addEventListener("touchmove",r),window.addEventListener("touchend",s),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",e),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",s)}},[]),k(()=>{const t=setTimeout(()=>D(),200);return()=>clearTimeout(t)},[]),k(()=>{const t=setTimeout(()=>D(),100);return()=>clearTimeout(t)},[y,z,_]);const gt=t=>{const e=ot||"%";return`${t.toFixed(1)}${e}`},mt=m?2:1,M=F(S??y),pt=t=>{const e=a?t.value/a:t.value,r={};return _?r.bottom=e*100+"%":r.left=e*100+"%",r},_t=t=>{const e=a?t.value/a:t.value;if(m){const r=Math.min(h(M[0]),h(M[1])),s=Math.max(h(M[0]),h(M[1]));return e>=r&&e<=s}return e>=0&&e<=h(M[0])},Z=(t,e)=>{if(!e||x)return{};if(v&&v.length){const r=a?t.value/a:t.value,s=m?Math.min(h(M[0]),h(M[1])):0,n=(m?Math.max(h(M[0]),h(M[1])):h(M[0]))-s;if(n<=0)return{};const i=(r-s)/n,g=Math.min(v.length-1,Math.max(0,Math.floor(i*v.length)));return{backgroundColor:v[g]}}return w?{backgroundColor:w}:{}},tt={};w&&!(v&&v.length)&&!x&&(tt.backgroundColor=w);const et=t=>{const e={};return w&&!x&&(e.borderColor=w),e};return b.jsxs("div",{ref:ut,className:q(o.slider,"slider",o[z],_?o.vertical:o.horizontal,x&&o.disabled,d&&d.length&&o.stepSlider,E&&o.neutralBg,it),style:{background:ft()},"aria-disabled":x,onMouseDown:t=>{if(x)return;const e=N.current;if(!e)return;let r=0;if(m&&B.current.length>1){let s=1/0;B.current.forEach((c,n)=>{if(c)if(_){const i=e.getBoundingClientRect(),g=e.clientHeight-c.offsetTop-c.clientHeight/2,f=Math.abs(e.clientHeight-(t.clientY-i.top)-g);f<s&&(s=f,r=n)}else{const i=Math.abs(c.offsetLeft-(t.clientX-e.getBoundingClientRect().left));i<s&&(s=i,r=n)}})}R(r),L(t.clientX,t.clientY)},onTouchStart:t=>{x||t.touches[0]&&L(t.touches[0].clientX,t.touches[0].clientY)},children:[b.jsx("div",{ref:J,className:q(o.fillBar,_&&o.fillBarVertical,v&&v.length&&o.haveFillColors),style:tt,children:v&&v.map((t,e)=>b.jsx("div",{style:{background:t,width:"100%",height:"100%"}},e))}),Array.from({length:mt}).map((t,e)=>st?b.jsx(yt,{labelValue:gt(M[e]),position:_?"right":"top",children:b.jsx("div",{ref:r=>{B.current[e]=r},className:q(o.cursor,$[e]&&o.dragging,w&&o.coloredCursor),style:et(),onMouseDown:r=>{r.stopPropagation(),R(e)},onTouchStart:r=>{r.stopPropagation(),R(e)}})},e):b.jsx("div",{ref:r=>{B.current[e]=r},className:q(o.cursor,$[e]&&o.dragging,w&&o.coloredCursor),style:et(),onMouseDown:r=>{r.stopPropagation(),R(e)},onTouchStart:r=>{r.stopPropagation(),R(e)}},e)),d&&d.map((t,e)=>{const r=_t(t);return b.jsx("div",{className:q(o.step,r&&o.stepActive,E&&o.stepNeutral),style:{...pt(t),...Z(t,r)},children:b.jsx("div",{className:q(o.stepMarker,r&&o.stepMarkerActive,E&&!r&&o.stepMarkerNeutral),style:Z(t,r)})},e)})]})});It.displayName="Slider";export{It as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const b=require("./jsx-runtime-BubrbI3X.js"),n=require("react"),k=require("./clsx-C11secjj.js"),_t=require("../hooks/useControllable.cjs.js"),vt=require("./Tooltip-
|
|
1
|
+
"use strict";const b=require("./jsx-runtime-BubrbI3X.js"),n=require("react"),k=require("./clsx-C11secjj.js"),_t=require("../hooks/useControllable.cjs.js"),vt=require("./Tooltip-CGZ7svxq.js"),Mt=require("./index-B4fH-h2h.js"),wt="_slider_rw7q0_2",xt="_small_rw7q0_2",yt="_medium_rw7q0_2",bt="_large_rw7q0_2",Ct="_vertical_rw7q0_2",Rt="_disabled_rw7q0_2",St="_stepSlider_rw7q0_2",kt="_neutralBg_rw7q0_2",Et="_track_rw7q0_2",qt="_fillBar_rw7q0_2",Bt="_fillBarVertical_rw7q0_2",At="_haveFillColors_rw7q0_2",Tt="_cursor_rw7q0_2",Vt="_dragging_rw7q0_2",jt="_stepsContainer_rw7q0_2",Nt="_step_rw7q0_2",Ht="_stepActive_rw7q0_2",Dt="_stepNeutral_rw7q0_2",Lt="_stepMarker_rw7q0_2",Pt="_stepMarkerActive_rw7q0_2",Wt="_stepMarkerNeutral_rw7q0_2",o={slider:wt,small:xt,medium:yt,large:bt,vertical:Ct,disabled:Rt,stepSlider:St,neutralBg:kt,track:Et,fillBar:qt,fillBarVertical:Bt,haveFillColors:At,cursor:Tt,dragging:Vt,stepsContainer:jt,step:Nt,stepActive:Ht,stepNeutral:Dt,stepMarker:Lt,stepMarkerActive:Pt,stepMarkerNeutral:Wt},Z=n.forwardRef(function(tt,E){const{value:Y,onChange:et,size:F="medium",max:a=0,unit:rt="",color:x="",showTooltip:st=!1,disabled:C=!1,vertical:v=!1,fillColors:M,isRange:p=!1,steps:h,neutralBackground:A=!1,className:nt}=tt,ot=Y!==void 0,[y,X]=_t.useControllable({value:Y,defaultValue:p?[0,0]:0,onChange:et}),[I,z]=n.useState([!1,!1]),[lt,it]=n.useState(!1),[R,D]=n.useState(void 0),T=n.useRef(null),U=n.useRef(null),S=n.useRef([]),L=n.useRef([!1,!1]),V=n.useRef(y),$=n.useRef(()=>{}),P=n.useRef(()=>{}),G=n.useRef(()=>{}),ct=n.useCallback(t=>{T.current=t,typeof E=="function"?E(t):E&&(E.current=t)},[E]);n.useEffect(()=>{it(!0),V.current=y},[y]);function at(){return!lt||A||!x?"":Mt.blendColors(x)}function W(t){return t===void 0?[0,0]:Array.isArray(t)?[t[0],t[1]]:[t,t]}function g(t){return!a||a===0?Math.min(1,Math.max(0,t)):Math.min(1,Math.max(0,t/a))}function ut(t){return!a||a===0?t:t*a}function J(t){return!h||!h.length?t:h.map(r=>a?r.value/a:r.value).reduce((r,l)=>Math.abs(l-t)<Math.abs(r-t)?l:r)}const j=n.useCallback(()=>{const t=T.current,e=U.current;if(!t)return;const r=W(V.current),l=p?[g(r[0]),g(r[1])]:[g(r[0])],u=S.current;if(u.forEach((s,i)=>{if(!s)return;const m=l[i]??0;if(v){const d=t.clientHeight,f=Math.min(d,Math.max(0,d*m)),_=getComputedStyle(s).getPropertyValue("--border-width-xs"),c=parseFloat(_)/2||0;s.style.bottom=r[i]<(a*.99||.99)||h&&h.length?f-s.clientHeight/3-c+"px":f-s.clientHeight-c+"px",s.style.left="50%"}else{const d=t.clientWidth,f=Math.min(d,Math.max(0,d*m)),_=getComputedStyle(s).getPropertyValue("--border-width-xs"),c=parseFloat(_)/2||0;s.style.left=r[i]<(a*.99||.99)||h&&h.length?f-s.clientWidth/3-c+"px":f-s.clientWidth-c+"px",s.style.bottom="50%"}}),!!e)if(v){const s=t.clientHeight,i=u.map(c=>c?c.clientHeight/2:0),d=u.map(c=>c?c.offsetTop:0).map((c,B)=>s-c-i[B]),f=p?Math.min(...d):0,_=Math.max(0,Math.max(...d));e.style.bottom=f+"px",e.style.height=Math.abs(_-f)+"px",e.style.left="50%",e.style.width="100%"}else{const s=u.filter(Boolean);if(!s.length)return;const i=s.map(f=>f.offsetLeft+f.clientWidth/3),m=p?Math.min(...i):0,d=Math.max(...i);e.style.left=m+"px",e.style.width=Math.abs(d-m)+s[0].clientWidth/6+"px",e.style.bottom="50%",e.style.height="100%"}},[p,v,a,h]),q=n.useCallback(t=>{const e=[!1,!1];e[t]=!0,L.current=e,z([...e])},[]),N=n.useCallback((t,e)=>{const r=T.current;r&&L.current.forEach((l,u)=>{if(!l)return;const s=S.current[u];if(!s)return;let i;if(v){const _=r.getBoundingClientRect(),c=r.clientHeight-s.clientHeight,B=e-s.clientHeight/2-_.top,H=c,pt=Math.min(H,Math.max(0,H-B));i=J(pt/(c||1))}else{const _=r.getBoundingClientRect(),c=r.clientWidth-s.clientWidth,B=t-s.clientWidth/2-_.left,H=Math.min(c,Math.max(0,B));i=J(H/(c||1))}const m=ut(i),d=W(V.current);let f;if(p){const _=[...d];_[u]=m,f=_}else f=m;V.current=f,X(f),D(f),setTimeout(()=>j(),0)})},[p,v,a,h,X,j]),ft=n.useCallback(()=>{L.current=[!1,!1],z([!1,!1]),ot||D(void 0)},[]);n.useEffect(()=>{if(R===void 0)return;(Array.isArray(R)&&Array.isArray(y)?R[0]===y[0]&&R[1]===y[1]:R===y)&&D(void 0)},[y,R]),n.useEffect(()=>{$.current=t=>N(t.clientX,t.clientY),P.current=ft,G.current=t=>{t.touches[0]&&N(t.touches[0].clientX,t.touches[0].clientY)}}),n.useEffect(()=>{const t=u=>$.current(u),e=()=>P.current(),r=u=>G.current(u),l=()=>P.current();return window.addEventListener("mousemove",t),window.addEventListener("mouseup",e),window.addEventListener("touchmove",r),window.addEventListener("touchend",l),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("mouseup",e),window.removeEventListener("touchmove",r),window.removeEventListener("touchend",l)}},[]),n.useEffect(()=>{const t=setTimeout(()=>j(),200);return()=>clearTimeout(t)},[]),n.useEffect(()=>{const t=setTimeout(()=>j(),100);return()=>clearTimeout(t)},[y,F,v]);const dt=t=>{const e=rt||"%";return`${t.toFixed(1)}${e}`},ht=p?2:1,w=W(R??y),gt=t=>{const e=a?t.value/a:t.value,r={};return v?r.bottom=e*100+"%":r.left=e*100+"%",r},mt=t=>{const e=a?t.value/a:t.value;if(p){const r=Math.min(g(w[0]),g(w[1])),l=Math.max(g(w[0]),g(w[1]));return e>=r&&e<=l}return e>=0&&e<=g(w[0])},K=(t,e)=>{if(!e||C)return{};if(M&&M.length){const r=a?t.value/a:t.value,l=p?Math.min(g(w[0]),g(w[1])):0,s=(p?Math.max(g(w[0]),g(w[1])):g(w[0]))-l;if(s<=0)return{};const i=(r-l)/s,m=Math.min(M.length-1,Math.max(0,Math.floor(i*M.length)));return{backgroundColor:M[m]}}return x?{backgroundColor:x}:{}},O={};x&&!(M&&M.length)&&!C&&(O.backgroundColor=x);const Q=t=>{const e={};return x&&!C&&(e.borderColor=x),e};return b.jsxRuntimeExports.jsxs("div",{ref:ct,className:k.clsx(o.slider,"slider",o[F],v?o.vertical:o.horizontal,C&&o.disabled,h&&h.length&&o.stepSlider,A&&o.neutralBg,nt),style:{background:at()},"aria-disabled":C,onMouseDown:t=>{if(C)return;const e=T.current;if(!e)return;let r=0;if(p&&S.current.length>1){let l=1/0;S.current.forEach((u,s)=>{if(u)if(v){const i=e.getBoundingClientRect(),m=e.clientHeight-u.offsetTop-u.clientHeight/2,d=Math.abs(e.clientHeight-(t.clientY-i.top)-m);d<l&&(l=d,r=s)}else{const i=Math.abs(u.offsetLeft-(t.clientX-e.getBoundingClientRect().left));i<l&&(l=i,r=s)}})}q(r),N(t.clientX,t.clientY)},onTouchStart:t=>{C||t.touches[0]&&N(t.touches[0].clientX,t.touches[0].clientY)},children:[b.jsxRuntimeExports.jsx("div",{ref:U,className:k.clsx(o.fillBar,v&&o.fillBarVertical,M&&M.length&&o.haveFillColors),style:O,children:M&&M.map((t,e)=>b.jsxRuntimeExports.jsx("div",{style:{background:t,width:"100%",height:"100%"}},e))}),Array.from({length:ht}).map((t,e)=>st?b.jsxRuntimeExports.jsx(vt.Tooltip,{labelValue:dt(w[e]),position:v?"right":"top",children:b.jsxRuntimeExports.jsx("div",{ref:r=>{S.current[e]=r},className:k.clsx(o.cursor,I[e]&&o.dragging,x&&o.coloredCursor),style:Q(),onMouseDown:r=>{r.stopPropagation(),q(e)},onTouchStart:r=>{r.stopPropagation(),q(e)}})},e):b.jsxRuntimeExports.jsx("div",{ref:r=>{S.current[e]=r},className:k.clsx(o.cursor,I[e]&&o.dragging,x&&o.coloredCursor),style:Q(),onMouseDown:r=>{r.stopPropagation(),q(e)},onTouchStart:r=>{r.stopPropagation(),q(e)}},e)),h&&h.map((t,e)=>{const r=mt(t);return b.jsxRuntimeExports.jsx("div",{className:k.clsx(o.step,r&&o.stepActive,A&&o.stepNeutral),style:{...gt(t),...K(t,r)},children:b.jsxRuntimeExports.jsx("div",{className:k.clsx(o.stepMarker,r&&o.stepMarkerActive,A&&!r&&o.stepMarkerNeutral),style:K(t,r)})},e)})]})});Z.displayName="Slider";exports.Slider=Z;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const m=require("./jsx-runtime-BubrbI3X.js"),g=require("./clsx-C11secjj.js"),x=require("./Badge-BY7G9c3q.js"),y="_statusBadge_xd68m_2",l="_primary_xd68m_2",f="_info_xd68m_2",B="_success_xd68m_2",h="_warning_xd68m_2",p="_danger_xd68m_2",j="_neutral_xd68m_2",q="_secondary_xd68m_2",v="_heavy_xd68m_2",s={statusBadge:y,primary:l,info:f,success:B,warning:h,danger:p,neutral:j,secondary:q,heavy:v};function w({labelValue:a="",color:t="primary",size:n="medium",type:e="default",loading:r=!1,closeable:c=!1,icon:d="",isAppendedIcon:_=!1,children:u,className:o,onClose:i}){return m.jsxRuntimeExports.jsx(x.Badge,{className:g.clsx(s.statusBadge,"status-badge",s[t],s[e],o),labelValue:a,type:e,size:n,loading:r,closeable:c,icon:d,isAppendedIcon:_,onClose:i,children:u||a})}exports.StatusBadge=w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as u}from"./jsx-runtime-u17CrQMm.js";import{c as x}from"./clsx-B-dksMZM.js";import{B as g}from"./Badge-BTv66y-P.js";const f="_statusBadge_xd68m_2",y="_primary_xd68m_2",l="_info_xd68m_2",p="_success_xd68m_2",B="_warning_xd68m_2",h="_danger_xd68m_2",j="_neutral_xd68m_2",v="_secondary_xd68m_2",w="_heavy_xd68m_2",s={statusBadge:f,primary:y,info:l,success:p,warning:B,danger:h,neutral:j,secondary:v,heavy:w};function R({labelValue:a="",color:n="primary",size:r="medium",type:t="default",loading:e=!1,closeable:_=!1,icon:d="",isAppendedIcon:o=!1,children:c,className:m,onClose:i}){return u.jsx(g,{className:x(s.statusBadge,"status-badge",s[n],s[t],m),labelValue:a,type:t,size:r,loading:e,closeable:_,icon:d,isAppendedIcon:o,onClose:i,children:c||a})}export{R as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const n=require("./jsx-runtime-BubrbI3X.js"),j=require("react"),u=require("./clsx-C11secjj.js"),w=require("../hooks/useControllable.cjs.js"),p=require("./index-B4fH-h2h.js"),V=require("../components/Icon/index.cjs.js"),y="_stepper_iqqeu_2",B="_stepContainer_iqqeu_2",L="_noClick_iqqeu_2",A="_step_iqqeu_2",D="_small_iqqeu_2",F="_large_iqqeu_2",G="_past_iqqeu_2",H="_active_iqqeu_2",J="_future_iqqeu_2",K="_label_iqqeu_2",P="_connector_iqqeu_2",s={stepper:y,stepContainer:B,noClick:L,step:A,small:D,large:F,past:G,active:H,future:J,label:K,connector:P};function Q({value:f,onChange:d,options:l,labelKey:g="label",valueKey:b="label",iconKey:C="icon",size:i="medium",getObject:S=!1,noClick:m=!1,allowSkip:v=!1,className:h}){const[c,R]=w.useControllable({value:f,defaultValue:void 0,onChange:d}),q=o(c),[a,x]=j.useState(()=>Math.max(0,q!=-1?q:0));j.useEffect(()=>{const e=o(f);e!=-1&&x(e)},[c]);function o(e){return l.findIndex(t=>r(t)==r(e))}function E(e){return p.isObject(e)?e[g]:e}function r(e){return p.isObject(e)?e[b]:e}function I(e){return p.isObject(e)?e[C]:"image"}function N(e){const t=c??0;return e===t?"active":e<t||e<=a?"past":"future"}function k(e){return e<a?"past":"future"}function M(e,t){if(!m){const _=o(c);if(!v&&t-_>1)return;x(O=>Math.max(O,t)),R(S?e:r(e))}}return n.jsxRuntimeExports.jsx("div",{className:u.clsx(s.stepper,h),children:l.map((e,t)=>{const _=N(t);return n.jsxRuntimeExports.jsxs("div",{className:u.clsx("flex items-center",l[t+1]?"w-full":"w-fit",i,s[i]),children:[n.jsxRuntimeExports.jsxs("div",{className:u.clsx(s.stepContainer,m&&s.noClick),onClick:()=>M(e,t),children:[n.jsxRuntimeExports.jsx("div",{className:u.clsx(s[i],s[_],s.step,r(c)==r(e)&&s.active,{[s.past]:t<a,[s.future]:t>a}),children:n.jsxRuntimeExports.jsx(V.Icon,{className:"stepper-icon",name:I(e)})}),n.jsxRuntimeExports.jsx("span",{className:s.label,children:E(e)})]}),l[t+1]&&n.jsxRuntimeExports.jsx("div",{className:u.clsx(s.connector,s[k(t)])})]},t)})})}exports.Stepper=Q;
|
|
1
|
+
"use strict";const n=require("./jsx-runtime-BubrbI3X.js"),j=require("react"),u=require("./clsx-C11secjj.js"),w=require("../hooks/useControllable.cjs.js"),p=require("./index-B4fH-h2h.js"),V=require("../components/Icon/index.cjs.js"),y="_stepper_iqqeu_2",B="_stepContainer_iqqeu_2",L="_noClick_iqqeu_2",A="_step_iqqeu_2",D="_small_iqqeu_2",F="_large_iqqeu_2",G="_past_iqqeu_2",H="_active_iqqeu_2",J="_future_iqqeu_2",K="_label_iqqeu_2",P="_connector_iqqeu_2",s={stepper:y,stepContainer:B,noClick:L,step:A,small:D,large:F,past:G,active:H,future:J,label:K,connector:P};function Q({value:f,onChange:d,options:l,labelKey:g="label",valueKey:b="label",iconKey:C="icon",size:i="medium",getObject:S=!1,noClick:m=!1,allowSkip:v=!1,className:h}){const[c,R]=w.useControllable({value:f,defaultValue:void 0,onChange:d}),q=o(c),[a,x]=j.useState(()=>Math.max(0,q!=-1?q:0));j.useEffect(()=>{const e=o(f);e!=-1&&x(e)},[c]);function o(e){return l.findIndex(t=>r(t)==r(e))}function E(e){return p.isObject(e)?e[g]:e}function r(e){return p.isObject(e)?e[b]:e}function I(e){return p.isObject(e)?e[C]:"image"}function N(e){const t=c??0;return e===t?"active":e<t||e<=a?"past":"future"}function k(e){return e<a?"past":"future"}function M(e,t){if(!m){const _=o(c);if(!v&&t-_>1)return;x(O=>Math.max(O,t)),R(S?e:r(e))}}return n.jsxRuntimeExports.jsx("div",{className:u.clsx(s.stepper,"stepper",h),children:l.map((e,t)=>{const _=N(t);return n.jsxRuntimeExports.jsxs("div",{className:u.clsx("flex items-center",l[t+1]?"w-full":"w-fit",i,s[i]),children:[n.jsxRuntimeExports.jsxs("div",{className:u.clsx(s.stepContainer,m&&s.noClick),onClick:()=>M(e,t),children:[n.jsxRuntimeExports.jsx("div",{className:u.clsx(s[i],s[_],s.step,r(c)==r(e)&&s.active,{[s.past]:t<a,[s.future]:t>a}),children:n.jsxRuntimeExports.jsx(V.Icon,{className:"stepper-icon",name:I(e)})}),n.jsxRuntimeExports.jsx("span",{className:s.label,children:E(e)})]}),l[t+1]&&n.jsxRuntimeExports.jsx("div",{className:u.clsx(s.connector,s[k(t)])})]},t)})})}exports.Stepper=Q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{useState as V,useEffect as y}from"react";import{c as a}from"./clsx-B-dksMZM.js";import{useControllable as B}from"../hooks/useControllable.es.js";import{i as _}from"./index-C-RplXeX.js";import{Icon as L}from"../components/Icon/index.es.js";const O="_stepper_iqqeu_2",R="_stepContainer_iqqeu_2",A="_noClick_iqqeu_2",D="_step_iqqeu_2",F="_small_iqqeu_2",G="_large_iqqeu_2",H="_past_iqqeu_2",J="_active_iqqeu_2",K="_future_iqqeu_2",P="_label_iqqeu_2",Q="_connector_iqqeu_2",s={stepper:O,stepContainer:R,noClick:A,step:D,small:F,large:G,past:H,active:J,future:K,label:P,connector:Q};function $({value:m,onChange:d,options:l,labelKey:S="label",valueKey:C="label",iconKey:b="icon",size:i="medium",getObject:j=!1,noClick:p=!1,allowSkip:v=!1,className:h}){const[c,x]=B({value:m,defaultValue:void 0,onChange:d}),q=o(c),[u,g]=V(()=>Math.max(0,q!=-1?q:0));y(()=>{const e=o(m);e!=-1&&g(e)},[c]);function o(e){return l.findIndex(t=>n(t)==n(e))}function N(e){return _(e)?e[S]:e}function n(e){return _(e)?e[C]:e}function I(e){return _(e)?e[b]:"image"}function k(e){const t=c??0;return e===t?"active":e<t||e<=u?"past":"future"}function M(e){return e<u?"past":"future"}function w(e,t){if(!p){const f=o(c);if(!v&&t-f>1)return;g(E=>Math.max(E,t)),x(j?e:n(e))}}return r.jsx("div",{className:a(s.stepper,h),children:l.map((e,t)=>{const f=k(t);return r.jsxs("div",{className:a("flex items-center",l[t+1]?"w-full":"w-fit",i,s[i]),children:[r.jsxs("div",{className:a(s.stepContainer,p&&s.noClick),onClick:()=>w(e,t),children:[r.jsx("div",{className:a(s[i],s[f],s.step,n(c)==n(e)&&s.active,{[s.past]:t<u,[s.future]:t>u}),children:r.jsx(L,{className:"stepper-icon",name:I(e)})}),r.jsx("span",{className:s.label,children:N(e)})]}),l[t+1]&&r.jsx("div",{className:a(s.connector,s[M(t)])})]},t)})})}export{$ as S};
|
|
1
|
+
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{useState as V,useEffect as y}from"react";import{c as a}from"./clsx-B-dksMZM.js";import{useControllable as B}from"../hooks/useControllable.es.js";import{i as _}from"./index-C-RplXeX.js";import{Icon as L}from"../components/Icon/index.es.js";const O="_stepper_iqqeu_2",R="_stepContainer_iqqeu_2",A="_noClick_iqqeu_2",D="_step_iqqeu_2",F="_small_iqqeu_2",G="_large_iqqeu_2",H="_past_iqqeu_2",J="_active_iqqeu_2",K="_future_iqqeu_2",P="_label_iqqeu_2",Q="_connector_iqqeu_2",s={stepper:O,stepContainer:R,noClick:A,step:D,small:F,large:G,past:H,active:J,future:K,label:P,connector:Q};function $({value:m,onChange:d,options:l,labelKey:S="label",valueKey:C="label",iconKey:b="icon",size:i="medium",getObject:j=!1,noClick:p=!1,allowSkip:v=!1,className:h}){const[c,x]=B({value:m,defaultValue:void 0,onChange:d}),q=o(c),[u,g]=V(()=>Math.max(0,q!=-1?q:0));y(()=>{const e=o(m);e!=-1&&g(e)},[c]);function o(e){return l.findIndex(t=>n(t)==n(e))}function N(e){return _(e)?e[S]:e}function n(e){return _(e)?e[C]:e}function I(e){return _(e)?e[b]:"image"}function k(e){const t=c??0;return e===t?"active":e<t||e<=u?"past":"future"}function M(e){return e<u?"past":"future"}function w(e,t){if(!p){const f=o(c);if(!v&&t-f>1)return;g(E=>Math.max(E,t)),x(j?e:n(e))}}return r.jsx("div",{className:a(s.stepper,"stepper",h),children:l.map((e,t)=>{const f=k(t);return r.jsxs("div",{className:a("flex items-center",l[t+1]?"w-full":"w-fit",i,s[i]),children:[r.jsxs("div",{className:a(s.stepContainer,p&&s.noClick),onClick:()=>w(e,t),children:[r.jsx("div",{className:a(s[i],s[f],s.step,n(c)==n(e)&&s.active,{[s.past]:t<u,[s.future]:t>u}),children:r.jsx(L,{className:"stepper-icon",name:I(e)})}),r.jsx("span",{className:s.label,children:N(e)})]}),l[t+1]&&r.jsx("div",{className:a(s.connector,s[M(t)])})]},t)})})}export{$ as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./jsx-runtime-u17CrQMm.js";import{c as a}from"./clsx-B-dksMZM.js";import{useControllable as p}from"../hooks/useControllable.es.js";const x="_rhs_1pjii_2",d="_disabled_1pjii_2",f="_track_1pjii_2",v="_active_1pjii_2",k="_thumb_1pjii_2",w="_thumbActive_1pjii_2",t={switch:"_switch_1pjii_2",rhs:x,disabled:d,track:f,active:v,thumb:k,thumbActive:w};function V({id:r,name:l,value:n,defaultValue:o,onChange:u,rhs:h=!1,disabled:e=!1,children:c,className:_}){const[i,m]=p({value:n,defaultValue:o??!1,onChange:u});function b(){e||m(!i)}const j=()=>c?r||l?s.jsx("label",{htmlFor:r||l,className:"text-xs cursor-[inherit]",children:c}):s.jsx("span",{className:"text-xs",children:c}):null;return s.jsxs("div",{role:"switch","aria-checked":!!i,"aria-disabled":e,className:a(t.switch,h&&t.rhs,e&&t.disabled,_),onClick:b,children:[s.jsx("div",{className:a(t.track,i&&t.active),children:s.jsx("div",{className:a(t.thumb,i&&t.thumbActive)})}),j()]})}export{V as S};
|
|
1
|
+
import{j as s}from"./jsx-runtime-u17CrQMm.js";import{c as a}from"./clsx-B-dksMZM.js";import{useControllable as p}from"../hooks/useControllable.es.js";const x="_rhs_1pjii_2",d="_disabled_1pjii_2",f="_track_1pjii_2",v="_active_1pjii_2",k="_thumb_1pjii_2",w="_thumbActive_1pjii_2",t={switch:"_switch_1pjii_2",rhs:x,disabled:d,track:f,active:v,thumb:k,thumbActive:w};function V({id:r,name:l,value:n,defaultValue:o,onChange:u,rhs:h=!1,disabled:e=!1,children:c,className:_}){const[i,m]=p({value:n,defaultValue:o??!1,onChange:u});function b(){e||m(!i)}const j=()=>c?r||l?s.jsx("label",{htmlFor:r||l,className:"text-xs cursor-[inherit]",children:c}):s.jsx("span",{className:"text-xs",children:c}):null;return s.jsxs("div",{role:"switch","aria-checked":!!i,"aria-disabled":e,className:a(t.switch,"switch",h&&t.rhs,e&&t.disabled,_),onClick:b,children:[s.jsx("div",{className:a(t.track,i&&t.active),children:s.jsx("div",{className:a(t.thumb,i&&t.thumbActive)})}),j()]})}export{V as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("./jsx-runtime-BubrbI3X.js"),r=require("./clsx-C11secjj.js"),b=require("../hooks/useControllable.cjs.js"),p="_rhs_1pjii_2",d="_disabled_1pjii_2",v="_track_1pjii_2",f="_active_1pjii_2",k="_thumb_1pjii_2",w="_thumbActive_1pjii_2",t={switch:"_switch_1pjii_2",rhs:p,disabled:d,track:v,active:f,thumb:k,thumbActive:w};function R({id:a,name:l,value:n,defaultValue:u,onChange:o,rhs:
|
|
1
|
+
"use strict";const s=require("./jsx-runtime-BubrbI3X.js"),r=require("./clsx-C11secjj.js"),b=require("../hooks/useControllable.cjs.js"),p="_rhs_1pjii_2",d="_disabled_1pjii_2",v="_track_1pjii_2",f="_active_1pjii_2",k="_thumb_1pjii_2",w="_thumbActive_1pjii_2",t={switch:"_switch_1pjii_2",rhs:p,disabled:d,track:v,active:f,thumb:k,thumbActive:w};function R({id:a,name:l,value:n,defaultValue:u,onChange:o,rhs:h=!1,disabled:i=!1,children:c,className:x}){const[e,_]=b.useControllable({value:n,defaultValue:u??!1,onChange:o});function m(){i||_(!e)}const j=()=>c?a||l?s.jsxRuntimeExports.jsx("label",{htmlFor:a||l,className:"text-xs cursor-[inherit]",children:c}):s.jsxRuntimeExports.jsx("span",{className:"text-xs",children:c}):null;return s.jsxRuntimeExports.jsxs("div",{role:"switch","aria-checked":!!e,"aria-disabled":i,className:r.clsx(t.switch,"switch",h&&t.rhs,i&&t.disabled,x),onClick:m,children:[s.jsxRuntimeExports.jsx("div",{className:r.clsx(t.track,e&&t.active),children:s.jsxRuntimeExports.jsx("div",{className:r.clsx(t.thumb,e&&t.thumbActive)})}),j()]})}exports.Switch=R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{c as s}from"./clsx-B-dksMZM.js";import{useControllable as g}from"../hooks/useControllable.es.js";import{Icon as o}from"../components/Icon/index.es.js";const h="_container_1g3ce_2",v="_notCard_1g3ce_2",C="_tabButton_1g3ce_2",p="_icon_1g3ce_2",N="_active_1g3ce_2",n={container:h,notCard:v,tabButton:C,icon:p,active:N};function w({value:r,defaultValue:l,onChange:i,options:m=[],labelKey:f="label",isIcon:_=!1,notCard:d=!1,children:u,className:x}){const[b,j]=g({value:r,defaultValue:l??0,onChange:i});function c(t){return typeof t=="string"?t:t[f]}return e.jsxs("div",{className:s(n.container,"tab",d&&n.notCard,x),children:[e.jsx("div",{className:"flex font-bold text-sm gap-xs w-fit",children:m.map((t,a)=>e.jsx("button",{className:s(n.tabButton,b===a&&n.active),onClick:()=>j(a),children:typeof t=="object"&&t.icon?e.jsxs(e.Fragment,{children:[e.jsx(o,{name:t.icon,className:n.icon}),e.jsx("span",{children:c(t)})]}):_&&typeof t=="string"?e.jsx(o,{name:t,className:n.icon}):e.jsx("span",{children:c(t)})},a))}),u]})}export{w as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),o=require("./clsx-C11secjj.js"),g=require("../hooks/useControllable.cjs.js"),a=require("../components/Icon/index.cjs.js"),R="_container_1g3ce_2",p="_notCard_1g3ce_2",E="_tabButton_1g3ce_2",h="_icon_1g3ce_2",C="_active_1g3ce_2",s={container:R,notCard:p,tabButton:E,icon:h,active:C};function v({value:r,defaultValue:i,onChange:l,options:x=[],labelKey:u="label",isIcon:m=!1,notCard:j=!1,children:_,className:d}){const[b,f]=g.useControllable({value:r,defaultValue:i??0,onChange:l});function c(t){return typeof t=="string"?t:t[u]}return e.jsxRuntimeExports.jsxs("div",{className:o.clsx(s.container,j&&s.notCard,d),children:[e.jsxRuntimeExports.jsx("div",{className:"flex font-bold text-sm gap-xs w-fit",children:x.map((t,n)=>e.jsxRuntimeExports.jsx("button",{className:o.clsx(s.tabButton,b===n&&s.active),onClick:()=>f(n),children:typeof t=="object"&&t.icon?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(a.Icon,{name:t.icon,className:s.icon}),e.jsxRuntimeExports.jsx("span",{children:c(t)})]}):m&&typeof t=="string"?e.jsxRuntimeExports.jsx(a.Icon,{name:t,className:s.icon}):e.jsxRuntimeExports.jsx("span",{children:c(t)})},n))}),_]})}exports.Tab=v;
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),o=require("./clsx-C11secjj.js"),g=require("../hooks/useControllable.cjs.js"),a=require("../components/Icon/index.cjs.js"),R="_container_1g3ce_2",p="_notCard_1g3ce_2",E="_tabButton_1g3ce_2",h="_icon_1g3ce_2",C="_active_1g3ce_2",s={container:R,notCard:p,tabButton:E,icon:h,active:C};function v({value:r,defaultValue:i,onChange:l,options:x=[],labelKey:u="label",isIcon:m=!1,notCard:j=!1,children:_,className:d}){const[b,f]=g.useControllable({value:r,defaultValue:i??0,onChange:l});function c(t){return typeof t=="string"?t:t[u]}return e.jsxRuntimeExports.jsxs("div",{className:o.clsx(s.container,"tab",j&&s.notCard,d),children:[e.jsxRuntimeExports.jsx("div",{className:"flex font-bold text-sm gap-xs w-fit",children:x.map((t,n)=>e.jsxRuntimeExports.jsx("button",{className:o.clsx(s.tabButton,b===n&&s.active),onClick:()=>f(n),children:typeof t=="object"&&t.icon?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(a.Icon,{name:t.icon,className:s.icon}),e.jsxRuntimeExports.jsx("span",{children:c(t)})]}):m&&typeof t=="string"?e.jsxRuntimeExports.jsx(a.Icon,{name:t,className:s.icon}):e.jsxRuntimeExports.jsx("span",{children:c(t)})},n))}),_]})}exports.Tab=v;
|