@etus/design-system 2.0.2 → 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-CgX8ogo_.js +1 -0
- package/lib/assets/Accordion-Cokk9UmL.js +1 -0
- package/lib/assets/ActionCard-B-V6OXi2.js +1 -0
- package/lib/assets/ActionCard-CpTo683T.js +1 -0
- package/lib/assets/Alert-Dc5Ipl49.js +1 -0
- package/lib/assets/Alert-DpuvR7Gh.js +1 -0
- package/lib/assets/AutoComplete-DEgPj8oQ.js +1 -0
- package/lib/assets/AutoComplete-DrfrItoU.js +1 -0
- package/lib/assets/Badge-BTv66y-P.js +1 -0
- package/lib/assets/Badge-BY7G9c3q.js +1 -0
- package/lib/assets/Breadcrumb-CRYd3qok.js +1 -0
- package/lib/assets/Breadcrumb-DL8hjLV6.js +1 -0
- package/lib/assets/Button-BQvl5kpf.js +1 -0
- package/lib/assets/Button-Dwf5lfho.js +1 -0
- package/lib/assets/Calendar-BQaEwrsF.js +1 -0
- package/lib/assets/Calendar-zXDN1__a.js +1 -0
- package/lib/assets/Carousel-CaBBanzf.js +1 -0
- package/lib/assets/Carousel-Uh7hPUN_.js +1 -0
- package/lib/assets/Checkbox-BWJvfeIk.js +1 -0
- package/lib/assets/Checkbox-JLPQNtg3.js +1 -0
- package/lib/assets/ColorPicker-Bzm0PUlr.js +1 -0
- package/lib/assets/ColorPicker-Xbh84tU0.js +1 -0
- package/lib/assets/Confirm-KPLTzyjU.js +1 -0
- package/lib/assets/Confirm-Lumw2IlY.js +1 -0
- package/lib/assets/Crop-B9fz9sta.js +1 -0
- package/lib/assets/Crop-DXLiWLOd.js +1 -0
- package/lib/assets/DatePicker-BZZOmgy2.js +1 -0
- package/lib/assets/DatePicker-XARoRV8B.js +1 -0
- package/lib/assets/DesignSystemProvider-B5BmSsFQ.js +1 -0
- package/lib/assets/DesignSystemProvider-B8zl9xux.js +1 -0
- package/lib/assets/Dialog-CANR3qfF.js +1 -0
- package/lib/assets/Dialog-CIliTshU.js +1 -0
- package/lib/assets/Drawer-C-7lHBee.js +1 -0
- package/lib/assets/Drawer-g_VGKzC1.js +1 -0
- package/lib/assets/Dropdown-CBST4NE-.js +1 -0
- package/lib/assets/Dropdown-CBzhBfRR.js +1 -0
- package/lib/assets/ExpandableContainer-BSfYcFgO.js +1 -0
- package/lib/assets/ExpandableContainer-DGBcw0Ik.js +1 -0
- package/lib/assets/FileUpload-BXuSjel2.js +1 -0
- package/lib/assets/FileUpload-Cf0IwAqv.js +1 -0
- package/lib/assets/Filter-BFhE2_vm.js +1 -0
- package/lib/assets/Filter-BNsFkb0d.js +1 -0
- package/lib/assets/FloatCard-BPnvYKAf.js +1 -0
- package/lib/assets/FloatCard-DFWCAqct.js +1 -0
- package/lib/assets/History-B95JCO0V.js +1 -0
- package/lib/assets/History-DSyVWbgM.js +1 -0
- package/lib/assets/IconCard-BIo3NGP9.js +1 -0
- package/lib/assets/IconCard-BcpGzA7H.js +1 -0
- package/lib/assets/Image-BeChQusm.js +1 -0
- package/lib/assets/Image-DIpgRX3S.js +1 -0
- package/lib/assets/Input-6RCSE6Th.js +1 -0
- package/lib/assets/Input-vP6bFyaR.js +1 -0
- package/lib/assets/Label-BJz4_LAM.js +1 -0
- package/lib/assets/Label-Cf7QR6aU.js +1 -0
- package/lib/assets/MetricCard-CNzWzVtC.js +1 -0
- package/lib/assets/MetricCard-FKlK70fO.js +1 -0
- package/lib/assets/Navbar-BFnZ7r7n.js +1 -0
- package/lib/assets/Navbar-CJJHIVPe.js +1 -0
- package/lib/assets/Option-7LkwQa_J.js +1 -0
- package/lib/assets/Option-BU2gWM4H.js +1 -0
- package/lib/assets/Overlay-BKXhsLBt.js +1 -0
- package/lib/assets/Overlay-BY8zon2o.js +1 -0
- package/lib/assets/PINInput-BZ2cUZD7.js +1 -0
- 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-Cbwzf2_-.js +1 -0
- package/lib/assets/RichTextEditor-DUwJE_w7.js +1 -0
- package/lib/assets/RoundMenu-BDFa4iPw.js +1 -0
- package/lib/assets/RoundMenu-CZH8GKm7.js +1 -0
- package/lib/assets/Select-C22GZDi3.js +1 -0
- package/lib/assets/Select-ClQjvlOH.js +1 -0
- package/lib/assets/SelectContainer-Cdc2A3ug.js +1 -0
- package/lib/assets/SelectContainer-DxvxE0To.js +1 -0
- package/lib/assets/SelectContent-C3qydYaT.js +1 -0
- package/lib/assets/SelectContent-Dc47jokE.js +1 -0
- package/lib/assets/Sidebar-5um1VXma.js +1 -0
- package/lib/assets/Sidebar-j0HRabnU.js +1 -0
- package/lib/assets/Slider-CoW0LpN4.js +1 -0
- package/lib/assets/Slider-Cw3LF4rd.js +1 -0
- package/lib/assets/StatusBadge-C-iDd_iG.js +1 -0
- package/lib/assets/StatusBadge-D_TJRM6K.js +1 -0
- package/lib/assets/Stepper-BZpdS_YS.js +1 -0
- package/lib/assets/Stepper-CqasewYa.js +1 -0
- package/lib/assets/Switch-DS7-Oe5_.js +1 -0
- package/lib/assets/Switch-vPQCLtCB.js +1 -0
- package/lib/assets/Tab-B3fsvwqU.js +1 -0
- package/lib/assets/Tab-CwD8WOmL.js +1 -0
- package/lib/assets/Table-DO2ydeAg.js +1 -0
- package/lib/assets/Table-i091bzIO.js +1 -0
- package/lib/assets/TagInput-Dn1zaxMR.js +1 -0
- package/lib/assets/TagInput-whDstjnp.js +1 -0
- package/lib/assets/TagSelect-B6OFPZIK.js +1 -0
- package/lib/assets/TagSelect-DqrCzbRk.js +1 -0
- package/lib/assets/Textarea-C6tDl9c6.js +1 -0
- package/lib/assets/Textarea-DbeW4hl8.js +1 -0
- package/lib/assets/Toast-DpOdaMvB.js +1 -0
- package/lib/assets/Toast-eYVEvn0Y.js +1 -0
- package/lib/assets/Toggle-CcQCT-2K.js +1 -0
- package/lib/assets/Toggle-Jram9Bhs.js +1 -0
- package/lib/assets/Tooltip-CGZ7svxq.js +1 -0
- package/lib/assets/Tooltip-pqZN7nfJ.js +1 -0
- package/lib/assets/Tree-CITWOibE.js +1 -0
- package/lib/assets/Tree-Cus6NgUD.js +1 -0
- package/lib/assets/index-B4fH-h2h.js +4 -0
- package/lib/assets/index-C-RplXeX.js +4 -0
- package/lib/assets/jsx-runtime-BubrbI3X.js +1 -0
- package/lib/assets/jsx-runtime-u17CrQMm.js +1 -0
- 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/Icon/index.cjs.js +1 -1
- package/lib/components/Icon/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/hooks/useClickOutside.cjs.js +1 -1
- package/lib/hooks/useClickOutside.es.js +1 -1
- package/lib/hooks/useControllable.es.js +1 -1
- package/lib/hooks/useTransition.es.js +1 -1
- 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 +3 -3
- package/lib/ColorPicker.css +0 -1
- package/lib/Container.css +0 -1
- package/lib/Dialog.css +0 -1
- package/lib/Drawer.css +0 -1
- package/lib/Dropdown.css +0 -1
- package/lib/FloatCard.css +0 -1
- package/lib/Input.css +0 -1
- package/lib/Label.css +0 -1
- package/lib/Option.css +0 -1
- package/lib/Overlay.css +0 -1
- package/lib/PINInput.css +0 -1
- package/lib/SelectContainer.css +0 -1
- package/lib/SelectContent.css +0 -1
- package/lib/Slider.css +0 -1
- package/lib/Stepper.css +0 -1
- package/lib/Textarea.css +0 -1
- package/lib/Toast.css +0 -1
- package/lib/Tooltip.css +0 -1
- package/lib/assets/ColorPicker-BNr6Tiux.css +0 -1
- package/lib/assets/ColorPicker-BzlgPz70.js +0 -1
- package/lib/assets/ColorPicker-DRs5fhzn.js +0 -1
- package/lib/assets/Confirm-BE6kYeL-.js +0 -1
- package/lib/assets/Confirm-Dh3P9z1Y.js +0 -1
- package/lib/assets/Container-BsNA9KWk.css +0 -1
- package/lib/assets/Dialog-99dphHY5.css +0 -1
- package/lib/assets/Drawer-CxCCzcyW.css +0 -1
- package/lib/assets/Dropdown-CBRpgE72.css +0 -1
- package/lib/assets/FloatCard-BGxNbGZp.js +0 -1
- package/lib/assets/FloatCard-BgZPzHss.css +0 -1
- package/lib/assets/FloatCard-Ci8mP8y4.js +0 -1
- package/lib/assets/Input-BRokEqU3.js +0 -1
- package/lib/assets/Input-vjtA9tbV.css +0 -1
- package/lib/assets/Input-xnq3TVKa.js +0 -1
- package/lib/assets/Label-BTtohMHb.js +0 -1
- package/lib/assets/Label-CQM-qY-2.css +0 -1
- package/lib/assets/Label-bwrT7VIV.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-deYOmkvM.js +0 -1
- package/lib/assets/PINInput-sc5bHYA7.js +0 -1
- package/lib/assets/RichTextEditor-BorOBshN.js +0 -1
- package/lib/assets/RichTextEditor-kBX-T9zz.js +0 -1
- package/lib/assets/SelectContainer-BlWVlFUV.css +0 -1
- package/lib/assets/SelectContent-CMJbFlkr.css +0 -1
- package/lib/assets/Sidebar-0DxOZadF.js +0 -1
- package/lib/assets/Sidebar-CPpl8WM2.js +0 -1
- package/lib/assets/Slider-CKHyJwpq.css +0 -1
- package/lib/assets/Slider-DManJgem.js +0 -1
- package/lib/assets/Slider-DPMaQG2C.js +0 -1
- package/lib/assets/Stepper-BKI03jce.css +0 -1
- package/lib/assets/Textarea-3aSTtzWW.css +0 -1
- package/lib/assets/Textarea-CFobhecb.js +0 -1
- package/lib/assets/Textarea-foQgQnsz.js +0 -1
- package/lib/assets/Toast-CtUhQGfE.css +0 -1
- package/lib/assets/Toast-DIAVNK5L.js +0 -1
- package/lib/assets/Toast-w4v5o8DT.js +0 -1
- package/lib/assets/Tooltip-DW188jnW.css +0 -1
- package/lib/assets/Tooltip-DbBhUsGz.js +0 -1
- package/lib/assets/Tooltip-Diruxnme.js +0 -1
- package/lib/assets/Tree-BbX0rS-d.js +0 -1
- package/lib/assets/Tree-DNsiZzdg.js +0 -1
- package/lib/assets/colors-C7f-Usn5.css +0 -1
- package/lib/assets/index-B_deyTVk.js +0 -1
- package/lib/assets/index-CX6wEu92.js +0 -1
- package/lib/assets/index-CfBpf7CU.css +0 -1
- package/lib/assets/index-DTWUsnKp.css +0 -1
- package/lib/assets/main-BaReR0qp.css +0 -1
- package/lib/colors.css +0 -1
- package/lib/index2.css +0 -1
- package/lib/index3.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),i=require("react"),le=require("./ColorPicker-Xbh84tU0.js"),ie=require("./FloatCard-BPnvYKAf.js"),c=require("./clsx-C11secjj.js"),ae=require("../hooks/useControllable.cjs.js"),B=require("./Label-BJz4_LAM.js"),x=require("../components/Icon/index.cjs.js"),_=require("./index-B4fH-h2h.js"),ce="_input_1a8ld_2",ue="_inputContainer_1a8ld_2",de="_focused_1a8ld_2",xe="_error_1a8ld_2",pe="_disabled_1a8ld_2",me="_inputContent_1a8ld_2",fe="_left_1a8ld_2",je="_center_1a8ld_2",he="_right_1a8ld_2",_e="_labelRow_1a8ld_2",Re="_counter_1a8ld_2",be="_errorMessage_1a8ld_2",Ee="_numberArrows_1a8ld_2",r={input:ce,inputContainer:ue,focused:de,error:xe,disabled:pe,inputContent:me,left:fe,center:je,right:he,labelRow:_e,counter:Re,errorMessage:be,numberArrows:Ee};function U({children:m}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:m})}function D({children:m}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:m})}const C=i.forwardRef(function(H,f){const{value:O,defaultValue:T,onChange:W,labelValue:j,type:t="text",mask:w,max:o,min:a,step:I=1,errorMessage:h,infoMessage:V,disabled:u=!1,isError:z=!1,required:y=!1,placeholder:G="",textAlign:k,tooltipMinWidth:M,icon:q,appendIcon:S,onFocus:J,onBlur:K,children:Q,className:F}=H,[l,p]=ae.useControllable({value:O,defaultValue:T??"",onChange:W}),[X,A]=i.useState(!1),[Y,R]=i.useState(!1),[b,Z]=i.useState(!1),[d,P]=i.useState(""),$=i.useRef(null),L=n=>{$.current=n,typeof f=="function"?f(n):f&&(f.current=n)};let E=null,v=null;i.Children.forEach(Q,n=>{if(!i.isValidElement(n))return;const s=n.props;n.type===U&&(E=s.children),n.type===D&&(v=s.children)});const ee=t==="password"?b?"text":"password":t==="number"||t==="search"||t==="email"||t==="url"||t==="domain"||t==="color"?"text":t;function se(n){let s=n.target.value;if(w&&t==="text"&&(s=_.applyMask(s,w)),o&&t==="text"&&(s=s.slice(0,o)),t==="number"){const N=Number(s);isNaN(N)||(a!=null&&N<a?s=String(a):o!=null&&N>o&&(s=String(o)))}p(s)}function ne(){A(!0),J?.()}function te(){A(!1);const n=l??"";if(t==="email")R(!_.isValidEmail(n));else if(t==="domain"){const s=!n||_.isValidDomain(n);R(!s),P(n&&!s?"Invalid domain":"")}else if(t==="url"){const s=!n||_.isValidUrl(n);R(!s),P(n&&!s?"Invalid URL":"")}K?.()}function re(){const s=((isNaN(Number(l))?0:Number(l))*1e3+(I||1)*1e3)/1e3;p(String(o!=null?Math.min(s,o):s))}function oe(){const s=((isNaN(Number(l))?0:Number(l))*1e3-(I||1)*1e3)/1e3;p(String(a!=null?Math.max(s,a):s))}const g=z||Y;if(t==="color"){const n=l??"#000000ff";return e.jsxRuntimeExports.jsxs("div",{className:c.clsx(r.input,F),children:[(j||o!==void 0)&&e.jsxRuntimeExports.jsx("div",{className:r.labelRow,children:e.jsxRuntimeExports.jsx(B.Label,{labelValue:j,infoMessage:V,tooltipMinWidth:M,required:y})}),e.jsxRuntimeExports.jsxs("div",{className:c.clsx(r.inputContainer,"flex items-center",u&&r.disabled),children:[e.jsxRuntimeExports.jsx("input",{ref:L,type:"text",className:c.clsx(r.inputContent),value:n,onChange:s=>{p(s.target.value)},disabled:u,placeholder:"#000000ff"}),e.jsxRuntimeExports.jsx(ie.FloatCard,{card:e.jsxRuntimeExports.jsx(le.ColorPicker,{value:n,onChange:s=>p(s)}),children:e.jsxRuntimeExports.jsx("button",{type:"button",style:{width:"1.5em",height:"1.5em",background:n,border:"1px solid var(--color-neutral-default, #ccc)",borderRadius:"4px",cursor:u?"not-allowed":"pointer",flexShrink:0},disabled:u,"aria-label":"Open color picker"})})]}),(h||d)&&(g||!!d)&&e.jsxRuntimeExports.jsx("p",{className:r.errorMessage,children:h||d})]})}return e.jsxRuntimeExports.jsxs("div",{className:c.clsx(r.input,"input",F),children:[(j||o!==void 0)&&e.jsxRuntimeExports.jsxs("div",{className:r.labelRow,children:[e.jsxRuntimeExports.jsx(B.Label,{labelValue:j,infoMessage:V,tooltipMinWidth:M,required:y}),t==="text"&&o!==void 0&&e.jsxRuntimeExports.jsxs("span",{className:r.counter,children:[(l??"").length,"/",o]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center h-fit",children:[e.jsxRuntimeExports.jsxs("div",{className:c.clsx(r.inputContainer,"flex-1",X&&r.focused,g&&r.error,u&&r.disabled),children:[t==="search"?e.jsxRuntimeExports.jsx(x.Icon,{name:"search",className:"text-neutral-foreground-low"}):q?e.jsxRuntimeExports.jsx(x.Icon,{name:q}):E||null,e.jsxRuntimeExports.jsx("input",{ref:L,type:ee,className:c.clsx(r.inputContent,k&&r[k]),value:l??"",onChange:se,onFocus:ne,onBlur:te,placeholder:G,disabled:u,spellCheck:!1}),t==="password"?e.jsxRuntimeExports.jsx(x.Icon,{name:b?"visibility_off":"visibility",className:"cursor-pointer",onClick:()=>Z(!b)}):S?e.jsxRuntimeExports.jsx(x.Icon,{name:S}):v||null]}),t==="number"&&e.jsxRuntimeExports.jsxs("div",{className:c.clsx(r.numberArrows,"ml-xxs"),children:[e.jsxRuntimeExports.jsx(x.Icon,{name:"arrow_drop_up",className:"arrow-icon",onClick:re}),e.jsxRuntimeExports.jsx(x.Icon,{name:"arrow_drop_down",className:"arrow-icon",onClick:oe})]})]}),(h||d)&&(g||!!d)&&e.jsxRuntimeExports.jsx("p",{className:r.errorMessage,children:h||d})]})});C.PrependIcon=U;C.AppendIcon=D;exports.Input=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import C,{useState as _,useRef as ae}from"react";import{C as le}from"./ColorPicker-Bzm0PUlr.js";import{F as ie}from"./FloatCard-DFWCAqct.js";import{c as i}from"./clsx-B-dksMZM.js";import{useControllable as ce}from"../hooks/useControllable.es.js";import{L}from"./Label-Cf7QR6aU.js";import{Icon as d}from"../components/Icon/index.es.js";import{t as ue,s as de,u as me,v as pe}from"./index-C-RplXeX.js";const fe="_input_1a8ld_2",xe="_inputContainer_1a8ld_2",he="_focused_1a8ld_2",_e="_error_1a8ld_2",be="_disabled_1a8ld_2",ve="_inputContent_1a8ld_2",ge="_left_1a8ld_2",Ne="_center_1a8ld_2",je="_right_1a8ld_2",we="_labelRow_1a8ld_2",Ce="_counter_1a8ld_2",Ve="_errorMessage_1a8ld_2",Ie="_numberArrows_1a8ld_2",t={input:fe,inputContainer:xe,focused:he,error:_e,disabled:be,inputContent:ve,left:ge,center:Ne,right:je,labelRow:we,counter:Ce,errorMessage:Ve,numberArrows:Ie};function U({children:p}){return e.jsx(e.Fragment,{children:p})}function q({children:p}){return e.jsx(e.Fragment,{children:p})}const D=C.forwardRef(function(H,f){const{value:O,defaultValue:T,onChange:W,labelValue:x,type:s="text",mask:V,max:o,min:l,step:I=1,errorMessage:h,infoMessage:y,disabled:c=!1,isError:z=!1,required:R=!1,placeholder:G="",textAlign:M,tooltipMinWidth:k,icon:E,appendIcon:F,onFocus:J,onBlur:K,children:Q,className:A}=H,[a,m]=ce({value:O,defaultValue:T??"",onChange:W}),[X,S]=_(!1),[Y,b]=_(!1),[v,Z]=_(!1),[u,P]=_(""),$=ae(null),B=r=>{$.current=r,typeof f=="function"?f(r):f&&(f.current=r)};let g=null,N=null;C.Children.forEach(Q,r=>{if(!C.isValidElement(r))return;const n=r.props;r.type===U&&(g=n.children),r.type===q&&(N=n.children)});const ee=s==="password"?v?"text":"password":s==="number"||s==="search"||s==="email"||s==="url"||s==="domain"||s==="color"?"text":s;function ne(r){let n=r.target.value;if(V&&s==="text"&&(n=de(n,V)),o&&s==="text"&&(n=n.slice(0,o)),s==="number"){const w=Number(n);isNaN(w)||(l!=null&&w<l?n=String(l):o!=null&&w>o&&(n=String(o)))}m(n)}function re(){S(!0),J?.()}function se(){S(!1);const r=a??"";if(s==="email")b(!ue(r));else if(s==="domain"){const n=!r||me(r);b(!n),P(r&&!n?"Invalid domain":"")}else if(s==="url"){const n=!r||pe(r);b(!n),P(r&&!n?"Invalid URL":"")}K?.()}function te(){const n=((isNaN(Number(a))?0:Number(a))*1e3+(I||1)*1e3)/1e3;m(String(o!=null?Math.min(n,o):n))}function oe(){const n=((isNaN(Number(a))?0:Number(a))*1e3-(I||1)*1e3)/1e3;m(String(l!=null?Math.max(n,l):n))}const j=z||Y;if(s==="color"){const r=a??"#000000ff";return e.jsxs("div",{className:i(t.input,A),children:[(x||o!==void 0)&&e.jsx("div",{className:t.labelRow,children:e.jsx(L,{labelValue:x,infoMessage:y,tooltipMinWidth:k,required:R})}),e.jsxs("div",{className:i(t.inputContainer,"flex items-center",c&&t.disabled),children:[e.jsx("input",{ref:B,type:"text",className:i(t.inputContent),value:r,onChange:n=>{m(n.target.value)},disabled:c,placeholder:"#000000ff"}),e.jsx(ie,{card:e.jsx(le,{value:r,onChange:n=>m(n)}),children:e.jsx("button",{type:"button",style:{width:"1.5em",height:"1.5em",background:r,border:"1px solid var(--color-neutral-default, #ccc)",borderRadius:"4px",cursor:c?"not-allowed":"pointer",flexShrink:0},disabled:c,"aria-label":"Open color picker"})})]}),(h||u)&&(j||!!u)&&e.jsx("p",{className:t.errorMessage,children:h||u})]})}return e.jsxs("div",{className:i(t.input,"input",A),children:[(x||o!==void 0)&&e.jsxs("div",{className:t.labelRow,children:[e.jsx(L,{labelValue:x,infoMessage:y,tooltipMinWidth:k,required:R}),s==="text"&&o!==void 0&&e.jsxs("span",{className:t.counter,children:[(a??"").length,"/",o]})]}),e.jsxs("div",{className:"flex items-center h-fit",children:[e.jsxs("div",{className:i(t.inputContainer,"flex-1",X&&t.focused,j&&t.error,c&&t.disabled),children:[s==="search"?e.jsx(d,{name:"search",className:"text-neutral-foreground-low"}):E?e.jsx(d,{name:E}):g||null,e.jsx("input",{ref:B,type:ee,className:i(t.inputContent,M&&t[M]),value:a??"",onChange:ne,onFocus:re,onBlur:se,placeholder:G,disabled:c,spellCheck:!1}),s==="password"?e.jsx(d,{name:v?"visibility_off":"visibility",className:"cursor-pointer",onClick:()=>Z(!v)}):F?e.jsx(d,{name:F}):N||null]}),s==="number"&&e.jsxs("div",{className:i(t.numberArrows,"ml-xxs"),children:[e.jsx(d,{name:"arrow_drop_up",className:"arrow-icon",onClick:te}),e.jsx(d,{name:"arrow_drop_down",className:"arrow-icon",onClick:oe})]})]}),(h||u)&&(j||!!u)&&e.jsx("p",{className:t.errorMessage,children:h||u})]})});D.PrependIcon=U;D.AppendIcon=q;export{D as I};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),x=require("./Tooltip-CGZ7svxq.js"),o=require("../components/Icon/index.cjs.js");function l({labelValue:s,infoMessage:n,tooltipMinWidth:t,required:r,className:i}){return s?e.jsxRuntimeExports.jsxs("h5",{className:`inline-flex items-center text-sm font-semibold leading-xs${i?` ${i}`:""}`,children:[s,r&&e.jsxRuntimeExports.jsx("span",{className:"text-primary-foreground-low ml-xxs",children:"*"}),n&&e.jsxRuntimeExports.jsxs(x.Tooltip,{className:"ml-xxs",children:[e.jsxRuntimeExports.jsx(x.Tooltip.Label,{children:e.jsxRuntimeExports.jsx("p",{className:"p-xxs text-neutral-foreground-negative",style:t?{minWidth:t}:void 0,children:n})}),e.jsxRuntimeExports.jsx(o.Icon,{name:"info",className:"info-icon"})]})]}):null}exports.Label=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{T as o}from"./Tooltip-pqZN7nfJ.js";import{Icon as x}from"../components/Icon/index.es.js";function c({labelValue:s,infoMessage:n,tooltipMinWidth:r,required:t,className:i}){return s?e.jsxs("h5",{className:`inline-flex items-center text-sm font-semibold leading-xs${i?` ${i}`:""}`,children:[s,t&&e.jsx("span",{className:"text-primary-foreground-low ml-xxs",children:"*"}),n&&e.jsxs(o,{className:"ml-xxs",children:[e.jsx(o.Label,{children:e.jsx("p",{className:"p-xxs text-neutral-foreground-negative",style:r?{minWidth:r}:void 0,children:n})}),e.jsx(x,{name:"info",className:"info-icon"})]})]}):null}export{c as L};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),r=require("./clsx-C11secjj.js"),u=require("react"),q=require("../components/Card/index.cjs.js"),h=require("../components/Icon/index.cjs.js"),I=require("./Tooltip-CGZ7svxq.js"),f=require("../components/Skeleton/index.cjs.js"),V="_metricCard_1rh9k_2",L="_headerRow_1rh9k_2",M="_contentRow_1rh9k_2",F="_primary_1rh9k_2",W="_infoLabel_1rh9k_2",$="_info_1rh9k_2",H="_informative_1rh9k_2",z="_success_1rh9k_2",A="_warning_1rh9k_2",B="_danger_1rh9k_2",G="_dashed_1rh9k_2",J="_secondary_1rh9k_2",K="_cardTitle_1rh9k_2",O="_cardValue_1rh9k_2",P="_small_1rh9k_2",Q="_cardDescription_1rh9k_2",U="_infoIcon_1rh9k_2",X="_infoText_1rh9k_2",Y="_skeleton_1rh9k_2",Z="_header_1rh9k_2",nn="_contentSkeleton_1rh9k_2",en="_medium_1rh9k_2",tn="_large_1rh9k_2",rn="_bold_1rh9k_2",n={metricCard:V,headerRow:L,contentRow:M,primary:F,infoLabel:W,info:$,informative:H,success:z,warning:A,danger:B,dashed:G,secondary:J,cardTitle:K,cardValue:O,"info-primary":"_info-primary_1rh9k_2","info-informative":"_info-informative_1rh9k_2","info-info":"_info-info_1rh9k_2","info-success":"_info-success_1rh9k_2","info-warning":"_info-warning_1rh9k_2","info-danger":"_info-danger_1rh9k_2","info-neutral":"_info-neutral_1rh9k_2",small:P,cardDescription:Q,infoIcon:U,infoText:X,skeleton:Y,header:Z,contentSkeleton:nn,medium:en,large:tn,bold:rn};function p({children:t}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t})}function c({title:t="",description:s="",value:k="",icon:a="",color:j="neutral",type:R="default",size:E="medium",infoMessage:_="",infoType:d="neutral",tooltipMinWidth:sn="none",loading:o=!1,noTooltip:C=!1,boldTitle:w=!1,titleSlot:x,valueSlot:g,descriptionSlot:S,content:N,info:T,children:b,className:y}){const l=[],m=[];u.Children.forEach(b,i=>{u.isValidElement(i)&&i.type===p?l.push(i):m.push(i)});const v=S||(l.length>0?l:null),D=(t||a||x)&&!o;return e.jsxRuntimeExports.jsxs(q.Card,{className:r.clsx(n.metricCard,"metric-card",n[R],n[j],n[E],y),children:[D?e.jsxRuntimeExports.jsxs("div",{className:n.headerRow,children:[a&&e.jsxRuntimeExports.jsx(h.Icon,{name:a,className:n.icon}),x||e.jsxRuntimeExports.jsx("p",{className:r.clsx(n.cardTitle,w&&n.bold),children:t}),T||_&&(C?e.jsxRuntimeExports.jsx("p",{className:r.clsx(n.infoText,n.infoLabel,n[`info-${d}`]),children:_}):e.jsxRuntimeExports.jsx(I.Tooltip,{labelValue:_,children:e.jsxRuntimeExports.jsx(h.Icon,{name:"info",className:r.clsx(n.infoIcon,n.infoLabel,n[`info-${d}`])})}))]}):o?e.jsxRuntimeExports.jsx(f.Skeleton,{className:r.clsx(n.skeleton,n.header)}):null,o?e.jsxRuntimeExports.jsx(f.Skeleton,{className:r.clsx(n.skeleton,n.contentSkeleton)}):N||e.jsxRuntimeExports.jsxs("div",{className:n.contentRow,children:[g||e.jsxRuntimeExports.jsx("p",{className:n.cardValue,children:k}),v||e.jsxRuntimeExports.jsx("p",{className:n.cardDescription,children:s})]}),!o&&m]})}c.TitleSlot=function({children:s}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s})};c.Content=function({children:s}){return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s})};c.DescriptionSlot=p;exports.MetricCard=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{c as o}from"./clsx-B-dksMZM.js";import{Children as V,isValidElement as I}from"react";import{Card as L}from"../components/Card/index.es.js";import{Icon as f}from"../components/Icon/index.es.js";import{T as M}from"./Tooltip-pqZN7nfJ.js";import{Skeleton as k}from"../components/Skeleton/index.es.js";const E="_metricCard_1rh9k_2",F="_headerRow_1rh9k_2",W="_contentRow_1rh9k_2",$="_primary_1rh9k_2",H="_infoLabel_1rh9k_2",q="_info_1rh9k_2",z="_informative_1rh9k_2",A="_success_1rh9k_2",B="_warning_1rh9k_2",G="_danger_1rh9k_2",J="_dashed_1rh9k_2",K="_secondary_1rh9k_2",O="_cardTitle_1rh9k_2",P="_cardValue_1rh9k_2",Q="_small_1rh9k_2",U="_cardDescription_1rh9k_2",X="_infoIcon_1rh9k_2",Y="_infoText_1rh9k_2",Z="_skeleton_1rh9k_2",nn="_header_1rh9k_2",en="_contentSkeleton_1rh9k_2",rn="_medium_1rh9k_2",on="_large_1rh9k_2",tn="_bold_1rh9k_2",n={metricCard:E,headerRow:F,contentRow:W,primary:$,infoLabel:H,info:q,informative:z,success:A,warning:B,danger:G,dashed:J,secondary:K,cardTitle:O,cardValue:P,"info-primary":"_info-primary_1rh9k_2","info-informative":"_info-informative_1rh9k_2","info-info":"_info-info_1rh9k_2","info-success":"_info-success_1rh9k_2","info-warning":"_info-warning_1rh9k_2","info-danger":"_info-danger_1rh9k_2","info-neutral":"_info-neutral_1rh9k_2",small:Q,cardDescription:U,infoIcon:X,infoText:Y,skeleton:Z,header:nn,contentSkeleton:en,medium:rn,large:on,bold:tn};function u({children:r}){return e.jsx(e.Fragment,{children:r})}function l({title:r="",description:t="",value:p="",icon:a="",color:x="neutral",type:j="default",size:w="medium",infoMessage:c="",infoType:d="neutral",tooltipMinWidth:sn="none",loading:s=!1,noTooltip:g=!1,boldTitle:C=!1,titleSlot:m,valueSlot:N,descriptionSlot:T,content:b,info:S,children:y,className:R}){const _=[],h=[];V.forEach(y,i=>{I(i)&&i.type===u?_.push(i):h.push(i)});const v=T||(_.length>0?_:null),D=(r||a||m)&&!s;return e.jsxs(L,{className:o(n.metricCard,"metric-card",n[j],n[x],n[w],R),children:[D?e.jsxs("div",{className:n.headerRow,children:[a&&e.jsx(f,{name:a,className:n.icon}),m||e.jsx("p",{className:o(n.cardTitle,C&&n.bold),children:r}),S||c&&(g?e.jsx("p",{className:o(n.infoText,n.infoLabel,n[`info-${d}`]),children:c}):e.jsx(M,{labelValue:c,children:e.jsx(f,{name:"info",className:o(n.infoIcon,n.infoLabel,n[`info-${d}`])})}))]}):s?e.jsx(k,{className:o(n.skeleton,n.header)}):null,s?e.jsx(k,{className:o(n.skeleton,n.contentSkeleton)}):b||e.jsxs("div",{className:n.contentRow,children:[N||e.jsx("p",{className:n.cardValue,children:p}),v||e.jsx("p",{className:n.cardDescription,children:t})]}),!s&&h]})}l.TitleSlot=function({children:t}){return e.jsx(e.Fragment,{children:t})};l.Content=function({children:t}){return e.jsx(e.Fragment,{children:t})};l.DescriptionSlot=u;export{l as M};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const t=require("./jsx-runtime-BubrbI3X.js"),u=require("./clsx-C11secjj.js"),c=require("./Dropdown-CBST4NE-.js"),d=require("../components/Avatar/index.cjs.js"),m=require("./FloatCard-BPnvYKAf.js"),_=require("../components/Icon/index.cjs.js"),f="_navbar_13gv0_2",R="_left_13gv0_2",E="_right_13gv0_2",v="_logoSection_13gv0_2",h="_title_13gv0_2",g="_divider_13gv0_2",D="_notificationButton_13gv0_2",w="_avatarWrapper_13gv0_2",s={navbar:f,left:R,right:E,logoSection:v,title:h,divider:g,notificationButton:D,avatarWrapper:w};function N(){return t.jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"41",height:"40",viewBox:"0 0 41 40",fill:"none",children:[t.jsxRuntimeExports.jsx("path",{d:"M40.5 20C40.5 8.95431 31.5457 0 20.5 0C9.4543 0 0.5 8.95431 0.5 20C0.5 31.0457 9.4543 40 20.5 40C31.5457 40 40.5 31.0457 40.5 20Z",fill:"url(#paint0_linear_2159_846)"}),t.jsxRuntimeExports.jsx("path",{d:"M38.1604 20.0001C38.1604 10.2455 30.2528 2.33789 20.4982 2.33789C10.7436 2.33789 2.83594 10.2455 2.83594 20.0001C2.83594 29.7547 10.7436 37.6624 20.4982 37.6624C30.2528 37.6624 38.1604 29.7547 38.1604 20.0001Z",stroke:"#FAFAFA",strokeWidth:"2.40312",strokeMiterlimit:"10"}),t.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7876 20.902C14.5933 20.621 13.7248 19.9 13.4321 19.578C13.4632 18.9264 13.5596 18.2779 13.7211 17.645C14.195 15.7975 15.2189 14.1677 16.6794 12.9329C17.7002 12.0698 18.867 11.4478 20.0525 11.132C21.2271 10.8195 22.397 10.8101 23.4349 11.1056C24.19 11.3202 24.8504 11.6857 25.3957 12.1911C25.969 12.723 26.3885 13.3839 26.6402 14.1568C27.3332 16.2811 26.5672 18.7911 24.6421 20.7086C23.4473 21.8967 21.9278 22.7458 20.2467 23.1626C19.3424 23.3865 18.4024 23.4814 17.4547 23.4425C17.1338 23.4302 16.8062 23.4034 16.4837 23.3603C16.0632 22.5175 15.8461 21.3699 15.7876 20.902ZM15.7876 20.902C15.6835 20.0032 15.7114 19.0882 15.9352 18.2188C16.291 16.8332 17.0585 15.6109 18.1539 14.6856C18.9183 14.0402 19.7775 13.5768 20.6398 13.3481C21.4167 13.1413 22.1671 13.1289 22.8087 13.3124C23.3868 13.4756 24.1434 13.88 24.4666 14.8722C24.6686 15.4911 24.6499 16.2018 24.4122 16.928C24.1605 17.6916 23.6835 18.4396 23.0294 19.0897C22.1298 19.987 20.977 20.6277 19.6983 20.945C19.0037 21.1161 18.2797 21.1891 17.5479 21.1596C16.9575 21.1363 16.3874 21.0576 15.7876 20.902Z",fill:"url(#paint1_angular_2159_846)"}),t.jsxRuntimeExports.jsx("path",{d:"M21.6728 29.3941C21.9944 29.4284 22.3315 29.4455 22.6796 29.4455V29.4408C25.1018 29.4408 28.0399 28.5839 29.9603 26.1283C30.3487 25.6307 30.2617 24.9107 29.7645 24.5219C29.2674 24.1331 28.5495 24.2202 28.1595 24.7178C27.4106 25.6742 26.3945 26.3663 25.1422 26.7706C23.7625 27.217 22.5211 27.1781 21.9042 27.1143C21.1585 27.0381 20.4515 26.8562 19.8021 26.5716C19.19 26.3041 18.6244 25.9464 18.1225 25.5063C17.4476 24.9146 16.8919 24.1848 16.4834 23.3589C15.9235 23.2992 14.5917 23.0367 13.752 22.5469C13.7846 22.6759 13.8218 22.8019 13.8607 22.9295C14.3812 24.6199 15.3367 26.1082 16.6201 27.2309C17.299 27.825 18.0635 28.3102 18.8901 28.671C19.757 29.0504 20.6923 29.2931 21.6728 29.3941Z",fill:"white"}),t.jsxRuntimeExports.jsx("path",{d:"M13.4321 19.5783C13.0794 19.2859 12.7236 18.9406 12.416 18.5472C12.0275 18.0496 11.3081 17.9625 10.811 18.3513C10.3138 18.74 10.2268 19.4601 10.6152 19.9577C11.636 21.264 12.9939 22.1302 13.7522 22.5486C13.6351 22.1973 13.4321 21.1239 13.4321 19.5783Z",fill:"url(#paint2_linear_2159_846)"}),t.jsxRuntimeExports.jsx("path",{d:"M13.4321 19.5781C13.7248 19.9001 14.5933 20.6211 15.7876 20.9021C15.8461 21.37 16.0632 22.5176 16.4837 23.3604C15.9237 23.3007 14.592 23.0383 13.7522 22.5484C13.6351 22.1971 13.4321 21.1237 13.4321 19.5781Z",fill:"white"}),t.jsxRuntimeExports.jsxs("defs",{children:[t.jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_2159_846",x1:"34.6407",y1:"5.85756",x2:"6.35756",y2:"34.1424",gradientUnits:"userSpaceOnUse",children:[t.jsxRuntimeExports.jsx("stop",{stopColor:"#97D991"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.11",stopColor:"#92D691"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.22",stopColor:"#86D091"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.33",stopColor:"#74C691"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.42",stopColor:"#6DC192"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.55",stopColor:"#5CB597"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.66",stopColor:"#47A79E"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.74",stopColor:"#3B9C98"}),t.jsxRuntimeExports.jsx("stop",{offset:"0.89",stopColor:"#1E7F88"}),t.jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#02657A"})]}),t.jsxRuntimeExports.jsxs("radialGradient",{id:"paint1_angular_2159_846",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(20.1617 17.1708) rotate(139.686) scale(8.34625 8.94344)",children:[t.jsxRuntimeExports.jsx("stop",{stopColor:"white"}),t.jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#DDDDDD"})]}),t.jsxRuntimeExports.jsxs("linearGradient",{id:"paint2_linear_2159_846",x1:"10.8995",y1:"18.5312",x2:"13.7097",y2:"21.3414",gradientUnits:"userSpaceOnUse",children:[t.jsxRuntimeExports.jsx("stop",{stopColor:"white"}),t.jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"#D9D9D9"})]})]})]})}function b({options:i=[],value:n,onChange:x,logo:a,title:o,profile:e,notifications:p,showNotifications:l=!0,actions:r,children:j,className:C}){return t.jsxRuntimeExports.jsxs("nav",{className:u.clsx(s.navbar,"navbar",C),role:"navigation",children:[t.jsxRuntimeExports.jsxs("div",{className:s.left,children:[t.jsxRuntimeExports.jsxs("div",{className:s.logoSection,children:[a||t.jsxRuntimeExports.jsx(N,{}),o&&t.jsxRuntimeExports.jsx("span",{className:s.title,children:o})]}),t.jsxRuntimeExports.jsx("div",{className:s.divider}),j||t.jsxRuntimeExports.jsx(c.Dropdown,{options:i,value:n,onChange:x})]}),t.jsxRuntimeExports.jsx("div",{className:s.right,children:r||t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[l&&t.jsxRuntimeExports.jsx(m.FloatCard,{card:p,children:t.jsxRuntimeExports.jsx("button",{className:s.notificationButton,type:"button","aria-label":"Notifications",children:t.jsxRuntimeExports.jsx(_.Icon,{name:"notifications"})})}),t.jsxRuntimeExports.jsx("div",{className:s.avatarWrapper,children:t.jsxRuntimeExports.jsx(d.Avatar,{name:e?.name,src:e?.src})})]})})]})}exports.Navbar=b;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-u17CrQMm.js";import{c as x}from"./clsx-B-dksMZM.js";import{D as f}from"./Dropdown-CBzhBfRR.js";import{Avatar as _}from"../components/Avatar/index.es.js";import{F as j}from"./FloatCard-DFWCAqct.js";import{Icon as v}from"../components/Icon/index.es.js";const h="_navbar_13gv0_2",g="_left_13gv0_2",m="_right_13gv0_2",u="_logoSection_13gv0_2",D="_title_13gv0_2",w="_divider_13gv0_2",N="_notificationButton_13gv0_2",b="_avatarWrapper_13gv0_2",s={navbar:h,left:g,right:m,logoSection:u,title:D,divider:w,notificationButton:N,avatarWrapper:b};function M(){return t.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"41",height:"40",viewBox:"0 0 41 40",fill:"none",children:[t.jsx("path",{d:"M40.5 20C40.5 8.95431 31.5457 0 20.5 0C9.4543 0 0.5 8.95431 0.5 20C0.5 31.0457 9.4543 40 20.5 40C31.5457 40 40.5 31.0457 40.5 20Z",fill:"url(#paint0_linear_2159_846)"}),t.jsx("path",{d:"M38.1604 20.0001C38.1604 10.2455 30.2528 2.33789 20.4982 2.33789C10.7436 2.33789 2.83594 10.2455 2.83594 20.0001C2.83594 29.7547 10.7436 37.6624 20.4982 37.6624C30.2528 37.6624 38.1604 29.7547 38.1604 20.0001Z",stroke:"#FAFAFA",strokeWidth:"2.40312",strokeMiterlimit:"10"}),t.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.7876 20.902C14.5933 20.621 13.7248 19.9 13.4321 19.578C13.4632 18.9264 13.5596 18.2779 13.7211 17.645C14.195 15.7975 15.2189 14.1677 16.6794 12.9329C17.7002 12.0698 18.867 11.4478 20.0525 11.132C21.2271 10.8195 22.397 10.8101 23.4349 11.1056C24.19 11.3202 24.8504 11.6857 25.3957 12.1911C25.969 12.723 26.3885 13.3839 26.6402 14.1568C27.3332 16.2811 26.5672 18.7911 24.6421 20.7086C23.4473 21.8967 21.9278 22.7458 20.2467 23.1626C19.3424 23.3865 18.4024 23.4814 17.4547 23.4425C17.1338 23.4302 16.8062 23.4034 16.4837 23.3603C16.0632 22.5175 15.8461 21.3699 15.7876 20.902ZM15.7876 20.902C15.6835 20.0032 15.7114 19.0882 15.9352 18.2188C16.291 16.8332 17.0585 15.6109 18.1539 14.6856C18.9183 14.0402 19.7775 13.5768 20.6398 13.3481C21.4167 13.1413 22.1671 13.1289 22.8087 13.3124C23.3868 13.4756 24.1434 13.88 24.4666 14.8722C24.6686 15.4911 24.6499 16.2018 24.4122 16.928C24.1605 17.6916 23.6835 18.4396 23.0294 19.0897C22.1298 19.987 20.977 20.6277 19.6983 20.945C19.0037 21.1161 18.2797 21.1891 17.5479 21.1596C16.9575 21.1363 16.3874 21.0576 15.7876 20.902Z",fill:"url(#paint1_angular_2159_846)"}),t.jsx("path",{d:"M21.6728 29.3941C21.9944 29.4284 22.3315 29.4455 22.6796 29.4455V29.4408C25.1018 29.4408 28.0399 28.5839 29.9603 26.1283C30.3487 25.6307 30.2617 24.9107 29.7645 24.5219C29.2674 24.1331 28.5495 24.2202 28.1595 24.7178C27.4106 25.6742 26.3945 26.3663 25.1422 26.7706C23.7625 27.217 22.5211 27.1781 21.9042 27.1143C21.1585 27.0381 20.4515 26.8562 19.8021 26.5716C19.19 26.3041 18.6244 25.9464 18.1225 25.5063C17.4476 24.9146 16.8919 24.1848 16.4834 23.3589C15.9235 23.2992 14.5917 23.0367 13.752 22.5469C13.7846 22.6759 13.8218 22.8019 13.8607 22.9295C14.3812 24.6199 15.3367 26.1082 16.6201 27.2309C17.299 27.825 18.0635 28.3102 18.8901 28.671C19.757 29.0504 20.6923 29.2931 21.6728 29.3941Z",fill:"white"}),t.jsx("path",{d:"M13.4321 19.5783C13.0794 19.2859 12.7236 18.9406 12.416 18.5472C12.0275 18.0496 11.3081 17.9625 10.811 18.3513C10.3138 18.74 10.2268 19.4601 10.6152 19.9577C11.636 21.264 12.9939 22.1302 13.7522 22.5486C13.6351 22.1973 13.4321 21.1239 13.4321 19.5783Z",fill:"url(#paint2_linear_2159_846)"}),t.jsx("path",{d:"M13.4321 19.5781C13.7248 19.9001 14.5933 20.6211 15.7876 20.9021C15.8461 21.37 16.0632 22.5176 16.4837 23.3604C15.9237 23.3007 14.592 23.0383 13.7522 22.5484C13.6351 22.1971 13.4321 21.1237 13.4321 19.5781Z",fill:"white"}),t.jsxs("defs",{children:[t.jsxs("linearGradient",{id:"paint0_linear_2159_846",x1:"34.6407",y1:"5.85756",x2:"6.35756",y2:"34.1424",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:"#97D991"}),t.jsx("stop",{offset:"0.11",stopColor:"#92D691"}),t.jsx("stop",{offset:"0.22",stopColor:"#86D091"}),t.jsx("stop",{offset:"0.33",stopColor:"#74C691"}),t.jsx("stop",{offset:"0.42",stopColor:"#6DC192"}),t.jsx("stop",{offset:"0.55",stopColor:"#5CB597"}),t.jsx("stop",{offset:"0.66",stopColor:"#47A79E"}),t.jsx("stop",{offset:"0.74",stopColor:"#3B9C98"}),t.jsx("stop",{offset:"0.89",stopColor:"#1E7F88"}),t.jsx("stop",{offset:"1",stopColor:"#02657A"})]}),t.jsxs("radialGradient",{id:"paint1_angular_2159_846",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(20.1617 17.1708) rotate(139.686) scale(8.34625 8.94344)",children:[t.jsx("stop",{stopColor:"white"}),t.jsx("stop",{offset:"1",stopColor:"#DDDDDD"})]}),t.jsxs("linearGradient",{id:"paint2_linear_2159_846",x1:"10.8995",y1:"18.5312",x2:"13.7097",y2:"21.3414",gradientUnits:"userSpaceOnUse",children:[t.jsx("stop",{stopColor:"white"}),t.jsx("stop",{offset:"1",stopColor:"#D9D9D9"})]})]})]})}function U({options:a=[],value:e,onChange:n,logo:l,title:o,profile:r,notifications:C,showNotifications:p=!0,actions:i,children:c,className:d}){return t.jsxs("nav",{className:x(s.navbar,"navbar",d),role:"navigation",children:[t.jsxs("div",{className:s.left,children:[t.jsxs("div",{className:s.logoSection,children:[l||t.jsx(M,{}),o&&t.jsx("span",{className:s.title,children:o})]}),t.jsx("div",{className:s.divider}),c||t.jsx(f,{options:a,value:e,onChange:n})]}),t.jsx("div",{className:s.right,children:i||t.jsxs(t.Fragment,{children:[p&&t.jsx(j,{card:C,children:t.jsx("button",{className:s.notificationButton,type:"button","aria-label":"Notifications",children:t.jsx(v,{name:"notifications"})})}),t.jsx("div",{className:s.avatarWrapper,children:t.jsx(_,{name:r?.name,src:r?.src})})]})})]})}export{U as N};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const c=require("./jsx-runtime-BubrbI3X.js"),l=require("./clsx-C11secjj.js");function a({selected:n=!1,disabled:e=!1,secondary:s=!1,noHover:t=!1,children:o,className:i,onClick:r}){return c.jsxRuntimeExports.jsx("div",{role:"option",tabIndex:0,className:l.clsx("option-container",{selected:n,disabled:e,secondary:s,noHover:t},i),onClick:e?void 0:r,children:o})}exports.Option=a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{c as f}from"./clsx-B-dksMZM.js";function c({selected:s=!1,disabled:o=!1,secondary:t=!1,noHover:n=!1,children:a,className:e,onClick:i}){return r.jsx("div",{role:"option",tabIndex:0,className:f("option-container",{selected:s,disabled:o,secondary:t,noHover:n},e),onClick:o?void 0:i,children:a})}export{c as O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./jsx-runtime-u17CrQMm.js";import{createPortal as n}from"react-dom";import{c}from"./clsx-B-dksMZM.js";import"react";import{useTransition as l}from"../hooks/useTransition.es.js";function j({value:t=!1,zIndex:o=1e3,onClick:e,children:s,className:i}){const{isMounted:a,isActive:m}=l(t,{duration:500});return r.jsx(r.Fragment,{children:a&&n(r.jsxs(r.Fragment,{children:[r.jsx("div",{className:c("overlay-backdrop",m&&"active",i),style:{zIndex:o},onClick:e}),s]}),document.body)})}export{j as O};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),c=require("react-dom"),a=require("./clsx-C11secjj.js");require("react");const x=require("../hooks/useTransition.cjs.js");function l({value:s=!1,zIndex:t=1e3,onClick:r,children:i,className:n}){const{isMounted:o,isActive:u}=x.useTransition(s,{duration:500});return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:o&&c.createPortal(e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx("div",{className:a.clsx("overlay-backdrop",u&&"active",n),style:{zIndex:t},onClick:r}),i]}),document.body)})}exports.Overlay=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as l}from"./jsx-runtime-u17CrQMm.js";import j,{useState as H,useRef as D,useEffect as R,useImperativeHandle as J}from"react";import{c as A}from"./clsx-B-dksMZM.js";const S="_pinInput_1l2sp_2",T="_field_1l2sp_2",q="_filled_1l2sp_2",z="_separator_1l2sp_2",G="_disabled_1l2sp_2",u={pinInput:S,field:T,filled:q,separator:z,disabled:G},X=j.forwardRef(function({value:n,defaultValue:V,onChange:m,onComplete:_,length:r=6,disabled:y=!1,placeholder:b,separator:v,type:h="text",otp:F=!1,className:N},P){const i=n!==void 0,[o,f]=H(()=>{const e=i?n:V??"";return Array.from({length:r},(t,s)=>e?.[s]??"")}),c=D([]);R(()=>{i&&n!==void 0&&f(Array.from({length:r},(e,t)=>n[t]??""))},[n,i,r]);const w=D("");R(()=>{const e=o.join("");e!==w.current&&(w.current=e,m?.(e),e.length===r&&o.every(t=>t!=="")&&_?.(e))},[o,r,m,_]),J(P,()=>({focus:()=>{const e=o.findIndex(t=>!t);c.current[e!==-1?e:0]?.focus()},clear:()=>{f(Array(r).fill("")),c.current[0]?.focus()}}));function I(e,t){const s=[...o];return s[e]=t,f(s),s}function k(e,t){const a=e.target.value.slice(-1);I(t,a),a&&t<r-1&&c.current[t+1]?.focus()}function E(e,t){if(e.key==="Backspace")if(!o[t]&&t>0){const s=c.current[t-1];s&&(s.focus(),s.select())}else I(t,"");else e.key==="ArrowLeft"&&t>0?(e.preventDefault(),c.current[t-1]?.focus()):e.key==="ArrowRight"&&t<r-1&&(e.preventDefault(),c.current[t+1]?.focus())}async function C(e,t){e.preventDefault();let s;try{s=await navigator.clipboard.readText()}catch{s=e.clipboardData.getData("text")}const a=[...o];s.split("").slice(0,r-t).forEach((p,d)=>{a[t+d]=p}),f(a);const L=a.reduce((p,d,B)=>d?B:p,t),M=Math.min(L+1,r-1);c.current[M]?.focus()}function K(e){e.target.select()}return l.jsx("div",{className:A(u.pinInput,"pin-input",N),children:Array.from({length:r},(e,t)=>l.jsxs(j.Fragment,{children:[v!==void 0&&t>0&&t%v===0&&l.jsx("span",{className:u.separator,children:"-"}),l.jsx("input",{ref:s=>{c.current[t]=s},className:A(u.field,o[t]&&u.filled,y&&u.disabled),value:o[t]||"",onChange:s=>k(s,t),onKeyDown:s=>E(s,t),onPaste:s=>C(s,t),onFocus:K,type:h,inputMode:"numeric",maxLength:1,placeholder:b,disabled:y,autoComplete:F?"one-time-code":void 0})]},t))})});export{X as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const f=require("./jsx-runtime-BubrbI3X.js"),o=require("react"),w=require("./clsx-C11secjj.js"),K="_pinInput_1l2sp_2",L="_field_1l2sp_2",M="_filled_1l2sp_2",B="_separator_1l2sp_2",H="_disabled_1l2sp_2",i={pinInput:K,field:L,filled:M,separator:B,disabled:H},J=o.forwardRef(function({value:u,defaultValue:E,onChange:_,onComplete:y,length:r=6,disabled:v=!1,placeholder:D,separator:I,type:A="text",otp:N=!1,className:V},b){const p=u!==void 0,[c,l]=o.useState(()=>{const e=p?u:E??"";return Array.from({length:r},(t,s)=>e?.[s]??"")}),n=o.useRef([]);o.useEffect(()=>{p&&u!==void 0&&l(Array.from({length:r},(e,t)=>u[t]??""))},[u,p,r]);const R=o.useRef("");o.useEffect(()=>{const e=c.join("");e!==R.current&&(R.current=e,_?.(e),e.length===r&&c.every(t=>t!=="")&&y?.(e))},[c,r,_,y]),o.useImperativeHandle(b,()=>({focus:()=>{const e=c.findIndex(t=>!t);n.current[e!==-1?e:0]?.focus()},clear:()=>{l(Array(r).fill("")),n.current[0]?.focus()}}));function j(e,t){const s=[...c];return s[e]=t,l(s),s}function h(e,t){const a=e.target.value.slice(-1);j(t,a),a&&t<r-1&&n.current[t+1]?.focus()}function F(e,t){if(e.key==="Backspace")if(!c[t]&&t>0){const s=n.current[t-1];s&&(s.focus(),s.select())}else j(t,"");else e.key==="ArrowLeft"&&t>0?(e.preventDefault(),n.current[t-1]?.focus()):e.key==="ArrowRight"&&t<r-1&&(e.preventDefault(),n.current[t+1]?.focus())}async function P(e,t){e.preventDefault();let s;try{s=await navigator.clipboard.readText()}catch{s=e.clipboardData.getData("text")}const a=[...c];s.split("").slice(0,r-t).forEach((d,m)=>{a[t+m]=d}),l(a);const x=a.reduce((d,m,C)=>m?C:d,t),q=Math.min(x+1,r-1);n.current[q]?.focus()}function k(e){e.target.select()}return f.jsxRuntimeExports.jsx("div",{className:w.clsx(i.pinInput,"pin-input",V),children:Array.from({length:r},(e,t)=>f.jsxRuntimeExports.jsxs(o.Fragment,{children:[I!==void 0&&t>0&&t%I===0&&f.jsxRuntimeExports.jsx("span",{className:i.separator,children:"-"}),f.jsxRuntimeExports.jsx("input",{ref:s=>{n.current[t]=s},className:w.clsx(i.field,c[t]&&i.filled,v&&i.disabled),value:c[t]||"",onChange:s=>h(s,t),onKeyDown:s=>F(s,t),onPaste:s=>P(s,t),onFocus:k,type:A,inputMode:"numeric",maxLength:1,placeholder:D,disabled:v,autoComplete:N?"one-time-code":void 0})]},t))})});exports.PINInput=J;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const i=require("./jsx-runtime-BubrbI3X.js"),m=require("react"),x=require("./clsx-C11secjj.js"),_=require("../hooks/useControllable.cjs.js"),p=require("../components/Icon/index.cjs.js"),j="_pagination_t8vwo_2",f="_pageButton_t8vwo_2",b="_active_t8vwo_2",R="_ellipsis_t8vwo_2",B="_navButton_t8vwo_2",E="_navIcon_t8vwo_2",e={pagination:j,pageButton:f,active:b,ellipsis:R,navButton:B,navIcon:E};function N(o,n){const t=[];if(n<1)return t;for(let s=1;s<=n;s++)s===1||s===n||o===1&&s<4||o===n&&s>=n-2||o-1===s||o+1===s||o===s?t.push(s):(o<=n-2&&s===n-1&&n>3||o>2&&n>3&&s===2)&&t.push(-1);for(let s=0;s<2;s++){const a=t.findIndex(c=>c===-1);a!==-1&&t[a+1]-t[a-1]===2&&(t[a]=t[a-1]+1)}return t}function I({value:o,defaultValue:n,onChange:t,length:s,className:a}){const[c,r]=_.useControllable({value:o,defaultValue:n??1,onChange:t});if(m.useEffect(()=>{c!==void 0&&s>=1&&c>s&&r(s)},[s]),s<1)return null;const v=N(c??1,s),l=c??1;return i.jsxRuntimeExports.jsxs("div",{className:x.clsx(e.pagination,"pagination",a),children:[i.jsxRuntimeExports.jsx("button",{className:e.navButton,disabled:l===1,onClick:()=>r(l-1),"aria-label":"Previous page",children:i.jsxRuntimeExports.jsx(p.Icon,{name:"chevron_left",className:x.clsx(e.navIcon)})}),i.jsxRuntimeExports.jsx("div",{className:"flex",children:v.map((u,d)=>i.jsxRuntimeExports.jsx("div",{className:"flex gap-xs",children:u===-1?i.jsxRuntimeExports.jsx("button",{className:x.clsx(e.pageButton,e.ellipsis),disabled:!0,children:"..."}):i.jsxRuntimeExports.jsx("button",{className:x.clsx(e.pageButton,u===l&&e.active),onClick:()=>r(u),children:u})},`${u}-${d}`))}),i.jsxRuntimeExports.jsx("button",{className:e.navButton,disabled:l===s,onClick:()=>r(l+1),"aria-label":"Next page",children:i.jsxRuntimeExports.jsx(p.Icon,{name:"chevron_right",className:x.clsx(e.navIcon)})})]})}exports.Pagination=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as n}from"./jsx-runtime-u17CrQMm.js";import{useEffect as f}from"react";import{c as u}from"./clsx-B-dksMZM.js";import{useControllable as _}from"../hooks/useControllable.es.js";import{Icon as p}from"../components/Icon/index.es.js";const x="_pagination_t8vwo_2",b="_pageButton_t8vwo_2",j="_active_t8vwo_2",B="_ellipsis_t8vwo_2",N="_navButton_t8vwo_2",I="_navIcon_t8vwo_2",t={pagination:x,pageButton:b,active:j,ellipsis:B,navButton:N,navIcon:I};function w(i,o){const a=[];if(o<1)return a;for(let s=1;s<=o;s++)s===1||s===o||i===1&&s<4||i===o&&s>=o-2||i-1===s||i+1===s||i===s?a.push(s):(i<=o-2&&s===o-1&&o>3||i>2&&o>3&&s===2)&&a.push(-1);for(let s=0;s<2;s++){const e=a.findIndex(c=>c===-1);e!==-1&&a[e+1]-a[e-1]===2&&(a[e]=a[e-1]+1)}return a}function y({value:i,defaultValue:o,onChange:a,length:s,className:e}){const[c,v]=_({value:i,defaultValue:o??1,onChange:a});if(f(()=>{c!==void 0&&s>=1&&c>s&&v(s)},[s]),s<1)return null;const d=w(c??1,s),l=c??1;return n.jsxs("div",{className:u(t.pagination,"pagination",e),children:[n.jsx("button",{className:t.navButton,disabled:l===1,onClick:()=>v(l-1),"aria-label":"Previous page",children:n.jsx(p,{name:"chevron_left",className:u(t.navIcon)})}),n.jsx("div",{className:"flex",children:d.map((r,m)=>n.jsx("div",{className:"flex gap-xs",children:r===-1?n.jsx("button",{className:u(t.pageButton,t.ellipsis),disabled:!0,children:"..."}):n.jsx("button",{className:u(t.pageButton,r===l&&t.active),onClick:()=>v(r),children:r})},`${r}-${m}`))}),n.jsx("button",{className:t.navButton,disabled:l===s,onClick:()=>v(l+1),"aria-label":"Next page",children:n.jsx(p,{name:"chevron_right",className:u(t.navIcon)})})]})}export{y as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),x=require("react"),n=require("./clsx-C11secjj.js"),y=require("../components/Avatar/index.cjs.js"),W=require("./Button-BQvl5kpf.js"),g=require("../components/Icon/index.cjs.js"),X=require("../hooks/useControllable.cjs.js"),Y="_profile_19nii_2",Z="_absolute_19nii_2",$="_dropdown_19nii_2",ee="_disabled_19nii_2",te="_trigger_19nii_2",se="_profileOption_19nii_2",ne="_profileOptionAction_19nii_2",ie="_searchIcon_19nii_2",re="_inputDefault_19nii_2",s={profile:Y,absolute:Z,dropdown:$,disabled:ee,trigger:te,profileOption:se,profileOptionAction:ne,searchIcon:ie,inputDefault:re};function O(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function le({value:o,defaultValue:w,onChange:C,name:i,picture:f,options:c=[],labelKey:I="label",valueKey:S="value",absolute:A=!1,disabled:v=!1,getObject:k=!1,className:q,editLabel:L="Edit profile",editOptionLabel:D="Edit account",logoutLabel:z="Logout",privacyPolicyLabel:P="Privacy Policy",termsOfUseLabel:V="Terms of use",onLogout:B,onEdit:F,onEditOption:M,onPrivacyPolicy:J,onTermsOfUse:T,renderOption:E}){const[r,G]=X.useControllable({value:o,defaultValue:w,onChange:C}),[R,p]=x.useState(!1),[m,H]=x.useState(""),[K,_]=x.useState(!1),j=x.useRef(null);x.useEffect(()=>{function t(l){j.current&&!j.current.contains(l.target)&&p(!1)}return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[]);function a(t){return O(t)?String(t[I]??""):String(t??"")}function h(t){return O(t)?t[S]:t}const u=c.find(t=>String(h(t))===String(h(r))),d=m?c.filter(t=>a(t).toLowerCase().includes(m.toLowerCase())):c;function Q(t){p(!1);const l=k?t:h(t);G(l)}function U(){v||p(t=>!t)}const N=r&&u&&a(u)||i;return e.jsxRuntimeExports.jsxs("div",{ref:j,className:n.clsx(s.profile,"profile",A&&s.absolute,v&&s.disabled,q),children:[!R&&e.jsxRuntimeExports.jsxs("div",{className:n.clsx(s.trigger,"flex items-center gap-xs text-2xl mr-xxs text-neutral-interaction-default"),onClick:U,children:[e.jsxRuntimeExports.jsx(y.Avatar,{name:i,src:f,size:"small",alt:"profile picture"}),e.jsxRuntimeExports.jsx("p",{className:"text-sm font-bold",children:N})]}),R&&e.jsxRuntimeExports.jsxs("div",{className:s.dropdown,children:[e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center gap-xs text-9xl px-xs py-sm text-neutral-interaction-default",children:[e.jsxRuntimeExports.jsx(y.Avatar,{name:i,src:f,size:"large",alt:"profile picture"}),!!(r&&a(u)&&i)&&e.jsxRuntimeExports.jsx("p",{className:"text-sm text-center",children:i}),(r&&a(u)||i)&&e.jsxRuntimeExports.jsx("h4",{className:"text-3xl font-bold m-xxs text-center",children:N}),e.jsxRuntimeExports.jsx(W.Button,{type:"submit",color:"primary",onClick:F,className:"m-xxs truncate",disabled:!i&&!f,children:L})]}),c&&c.length>0&&e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center text-neutral-interaction-default",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center w-full relative",children:[e.jsxRuntimeExports.jsx(g.Icon,{name:"search",className:n.clsx(s.searchIcon,K&&"text-primary-interaction-default")}),e.jsxRuntimeExports.jsx("input",{type:"search",value:m,onChange:t=>H(t.target.value),className:s.inputDefault,onFocus:()=>_(!0),onBlur:()=>_(!1),placeholder:"Search"})]}),e.jsxRuntimeExports.jsx("div",{className:n.clsx("w-full text-neutral-interaction-default",d.length>4&&"pr-xxs py-xxs"),children:e.jsxRuntimeExports.jsx("div",{className:"w-full flex flex-col divide-y-xxs divide-neutral-default font-bold max-h-[12em] overflow-auto custom-scroll",children:d.map((t,l)=>{const b=JSON.stringify(r||{})===JSON.stringify(t||{});return e.jsxRuntimeExports.jsx("div",{className:n.clsx(s.profileOption,"justify-start w-full [&>*]:text-sm hover:bg-neutral-surface-highlight"),onClick:()=>Q(t),children:E?E({option:t,index:l,active:b}):e.jsxRuntimeExports.jsx("p",{className:n.clsx("text-sm",b&&"[&>*]:underline"),children:a(t)})},l)})})})]}),e.jsxRuntimeExports.jsxs("div",{className:n.clsx("flex flex-col divide-y-xxs divide-neutral-default",d&&d.length?"border-t-xxs border-t-neutral-default":""),children:[!!r&&e.jsxRuntimeExports.jsxs("div",{className:n.clsx(s.profileOption,s.profileOptionAction,"text-neutral-interaction-default hover:bg-neutral-surface-highlight"),onClick:M,children:[e.jsxRuntimeExports.jsx(g.Icon,{name:"person",size:"xl"}),e.jsxRuntimeExports.jsx("p",{className:"text-sm font-bold",children:D})]}),e.jsxRuntimeExports.jsxs("div",{className:n.clsx(s.profileOption,s.profileOptionAction,"text-danger-interaction-default hover:bg-danger-surface-default"),onClick:B,children:[e.jsxRuntimeExports.jsx(g.Icon,{name:"logout",size:"xl"}),e.jsxRuntimeExports.jsx("p",{className:"text-sm font-bold",children:z})]})]}),e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-center px-xs py-sm pt-xl text-neutral-interaction-default font-bold text-xxs gap-5 [&>*]:cursor-pointer",children:[e.jsxRuntimeExports.jsx("p",{onClick:J,className:"hover:underline",children:P}),e.jsxRuntimeExports.jsx("p",{onClick:T,className:"hover:underline",children:V})]})]})]})}exports.Profile=le;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{useState as g,useRef as W,useEffect as X}from"react";import{c as l}from"./clsx-B-dksMZM.js";import{Avatar as w}from"../components/Avatar/index.es.js";import{B as Y}from"./Button-Dwf5lfho.js";import{Icon as j}from"../components/Icon/index.es.js";import{useControllable as Z}from"../hooks/useControllable.es.js";const $="_profile_19nii_2",ee="_absolute_19nii_2",te="_dropdown_19nii_2",se="_disabled_19nii_2",le="_trigger_19nii_2",ne="_profileOption_19nii_2",re="_profileOptionAction_19nii_2",ie="_searchIcon_19nii_2",oe="_inputDefault_19nii_2",s={profile:$,absolute:ee,dropdown:te,disabled:se,trigger:le,profileOption:ne,profileOptionAction:re,searchIcon:ie,inputDefault:oe};function C(o){return o!==null&&typeof o=="object"&&!Array.isArray(o)}function me({value:o,defaultValue:S,onChange:A,name:n,picture:f,options:a=[],labelKey:I="label",valueKey:k="value",absolute:E=!1,disabled:v=!1,getObject:L=!1,className:D,editLabel:z="Edit profile",editOptionLabel:P="Edit account",logoutLabel:V="Logout",privacyPolicyLabel:B="Privacy Policy",termsOfUseLabel:F="Terms of use",onLogout:M,onEdit:R,onEditOption:J,onPrivacyPolicy:T,onTermsOfUse:q,renderOption:N}){const[r,G]=Z({value:o,defaultValue:S,onChange:A}),[_,x]=g(!1),[p,H]=g(""),[K,b]=g(!1),m=W(null);X(()=>{function t(i){m.current&&!m.current.contains(i.target)&&x(!1)}return document.addEventListener("mousedown",t),()=>{document.removeEventListener("mousedown",t)}},[]);function c(t){return C(t)?String(t[I]??""):String(t??"")}function h(t){return C(t)?t[k]:t}const d=a.find(t=>String(h(t))===String(h(r))),u=p?a.filter(t=>c(t).toLowerCase().includes(p.toLowerCase())):a;function Q(t){x(!1);const i=L?t:h(t);G(i)}function U(){v||x(t=>!t)}const y=r&&d&&c(d)||n;return e.jsxs("div",{ref:m,className:l(s.profile,"profile",E&&s.absolute,v&&s.disabled,D),children:[!_&&e.jsxs("div",{className:l(s.trigger,"flex items-center gap-xs text-2xl mr-xxs text-neutral-interaction-default"),onClick:U,children:[e.jsx(w,{name:n,src:f,size:"small",alt:"profile picture"}),e.jsx("p",{className:"text-sm font-bold",children:y})]}),_&&e.jsxs("div",{className:s.dropdown,children:[e.jsxs("div",{className:"flex flex-col items-center gap-xs text-9xl px-xs py-sm text-neutral-interaction-default",children:[e.jsx(w,{name:n,src:f,size:"large",alt:"profile picture"}),!!(r&&c(d)&&n)&&e.jsx("p",{className:"text-sm text-center",children:n}),(r&&c(d)||n)&&e.jsx("h4",{className:"text-3xl font-bold m-xxs text-center",children:y}),e.jsx(Y,{type:"submit",color:"primary",onClick:R,className:"m-xxs truncate",disabled:!n&&!f,children:z})]}),a&&a.length>0&&e.jsxs("div",{className:"flex flex-col items-center text-neutral-interaction-default",children:[e.jsxs("div",{className:"flex items-center w-full relative",children:[e.jsx(j,{name:"search",className:l(s.searchIcon,K&&"text-primary-interaction-default")}),e.jsx("input",{type:"search",value:p,onChange:t=>H(t.target.value),className:s.inputDefault,onFocus:()=>b(!0),onBlur:()=>b(!1),placeholder:"Search"})]}),e.jsx("div",{className:l("w-full text-neutral-interaction-default",u.length>4&&"pr-xxs py-xxs"),children:e.jsx("div",{className:"w-full flex flex-col divide-y-xxs divide-neutral-default font-bold max-h-[12em] overflow-auto custom-scroll",children:u.map((t,i)=>{const O=JSON.stringify(r||{})===JSON.stringify(t||{});return e.jsx("div",{className:l(s.profileOption,"justify-start w-full [&>*]:text-sm hover:bg-neutral-surface-highlight"),onClick:()=>Q(t),children:N?N({option:t,index:i,active:O}):e.jsx("p",{className:l("text-sm",O&&"[&>*]:underline"),children:c(t)})},i)})})})]}),e.jsxs("div",{className:l("flex flex-col divide-y-xxs divide-neutral-default",u&&u.length?"border-t-xxs border-t-neutral-default":""),children:[!!r&&e.jsxs("div",{className:l(s.profileOption,s.profileOptionAction,"text-neutral-interaction-default hover:bg-neutral-surface-highlight"),onClick:J,children:[e.jsx(j,{name:"person",size:"xl"}),e.jsx("p",{className:"text-sm font-bold",children:P})]}),e.jsxs("div",{className:l(s.profileOption,s.profileOptionAction,"text-danger-interaction-default hover:bg-danger-surface-default"),onClick:M,children:[e.jsx(j,{name:"logout",size:"xl"}),e.jsx("p",{className:"text-sm font-bold",children:V})]})]}),e.jsxs("div",{className:"flex items-center justify-center px-xs py-sm pt-xl text-neutral-interaction-default font-bold text-xxs gap-5 [&>*]:cursor-pointer",children:[e.jsx("p",{onClick:T,className:"hover:underline",children:B}),e.jsx("p",{onClick:q,className:"hover:underline",children:F})]})]})]})}export{me as P};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),l=require("./clsx-C11secjj.js"),E=require("../components/Icon/index.cjs.js"),q=require("./Tooltip-CGZ7svxq.js"),I=require("./index-B4fH-h2h.js"),f=require("react"),N="_stepBar_1ck9k_2",w="_progressBar_1ck9k_2",F="_step_1ck9k_2",L="_small_1ck9k_2",v="_progressLabel_1ck9k_2",y="_progressIcon_1ck9k_2",H="_medium_1ck9k_2",P="_large_1ck9k_2",W="_progressHolder_1ck9k_2",C="_progressFill_1ck9k_2",M="_filled_1ck9k_2",A="_neutralBg_1ck9k_2",V="_info_1ck9k_2",$="_success_1ck9k_2",D="_warning_1ck9k_2",G="_danger_1ck9k_2",J="_neutral_1ck9k_2",K="_indeterminate_1ck9k_2",O="_query_1ck9k_2",s={stepBar:N,progressBar:w,step:F,small:L,progressLabel:v,progressIcon:y,medium:H,large:P,progressHolder:W,progressFill:C,filled:M,neutralBg:A,info:V,success:$,warning:D,danger:G,neutral:J,indeterminate:K,query:O};function Q({value:i=0,size:a="medium",type:u="primary",color:t="",icon:x="",infoMessage:g="",steps:o=0,animationType:n,displayPercentage:d,neutralBackground:_=!1,iconSlot:m,className:k}){const[h,b]=f.useState(!1);f.useEffect(()=>{b(!0)},[]);const c=(()=>{let r=i*100;return o?r=i/o*100:n&&(r=50),Math.max(0,Math.min(100,r))+"%"})(),p=()=>!h||_||!t?"":I.blendColors(t),R=!n&&(x||m),j=e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:m??e.jsxRuntimeExports.jsx(E.Icon,{name:x})});return o?e.jsxRuntimeExports.jsx("div",{className:l.clsx(s.stepBar,"progress-bar",s[a],s[u],_&&s.neutralBg,k),children:Array.from({length:o},(r,B)=>B+1).map(r=>e.jsxRuntimeExports.jsx("div",{className:l.clsx(s.step,r<=i&&s.filled,_&&s.neutralBg),style:{background:r<=i?t:p(),width:`${100/o}%`}},r))}):e.jsxRuntimeExports.jsxs("div",{className:l.clsx(s.progressBar,s[a],s[u],_&&s.neutralBg,k),style:{background:p()},children:[e.jsxRuntimeExports.jsxs("div",{className:s.progressHolder,children:[e.jsxRuntimeExports.jsx("div",{className:l.clsx(s.progressFill,s[a],n&&s[n]),style:{background:t,width:c},children:d==="bar"&&!n&&e.jsxRuntimeExports.jsx("label",{className:s.progressLabel,children:c})}),d==="center"&&!n&&e.jsxRuntimeExports.jsx("label",{className:l.clsx(s.progressLabel,"absolute"),children:c})]}),R&&(g?e.jsxRuntimeExports.jsx(q.Tooltip,{className:s.progressIcon,style:{left:c,color:t},labelValue:g,position:"bottom",children:j}):e.jsxRuntimeExports.jsx("div",{className:s.progressIcon,style:{left:c,color:t},children:j}))]})}exports.ProgressBar=Q;
|
|
@@ -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;
|
|
@@ -0,0 +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-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};
|
|
@@ -0,0 +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-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};
|
|
@@ -0,0 +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-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;
|
|
@@ -0,0 +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 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};
|
|
@@ -0,0 +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-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;
|
|
@@ -0,0 +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-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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./jsx-runtime-BubrbI3X.js"),m=require("react"),t=require("./clsx-C11secjj.js"),j=require("../hooks/useControllable.cjs.js"),x=require("../components/Icon/index.cjs.js");function M({value:p,defaultValue:f="",onChange:h,options:R,icon:a,expanded:c,defaultExpanded:d,onExpandedChange:g,searchable:E=!1,disabled:s=!1,isError:o=!1,secondary:C=!1,searchLabel:N,status:v,appendIcon:u,className:q}){const[i,k]=j.useControllable({value:p,defaultValue:f,onChange:n=>h?.(n,{index:-1})}),[r,I]=j.useControllable({value:c,defaultValue:d,onChange:n=>g?.(n,{source:"click"})}),l=m.useRef(null);return m.useEffect(()=>{c&&!s&&l.current&&l.current.focus()},[c,s]),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[a&&e.jsxRuntimeExports.jsx(x.Icon,{name:a,className:t.clsx("sc-icon",{expanded:r,disabled:s,error:o})}),e.jsxRuntimeExports.jsxs("span",{className:t.clsx("flex items-center gap-xs truncate text-sm flex-1",q,{"text-neutral-foreground-low":!R}),children:[E&&!s&&e.jsxRuntimeExports.jsxs("div",{className:t.clsx("flex items-center text-neutral-foreground-high w-full",{secondary:C,hidden:!r}),onClick:()=>I(!0),children:[e.jsxRuntimeExports.jsx(x.Icon,{name:"search",className:t.clsx("sc-icon",{expanded:r,disabled:s,error:o})}),!i?.length&&e.jsxRuntimeExports.jsx("div",{className:"relative pointer-events-none",children:e.jsxRuntimeExports.jsx("span",{className:"search-placeholder",children:N||"Search"})}),e.jsxRuntimeExports.jsx("input",{ref:l,type:"search",className:"search",disabled:s,value:i??"",onChange:n=>k(n.target.value)}),u&&e.jsxRuntimeExports.jsx(x.Icon,{name:u,className:t.clsx("sc-icon",{expanded:r,disabled:s,error:o})})]}),v]})]})}exports.SelectContent=M;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import{useRef as w,useEffect as y}from"react";import{c as r}from"./clsx-B-dksMZM.js";import{useControllable as x}from"../hooks/useControllable.es.js";import{Icon as o}from"../components/Icon/index.es.js";function A({value:i,defaultValue:h="",onChange:p,options:d,icon:m,expanded:a,defaultExpanded:j,onExpandedChange:g,searchable:N=!1,disabled:s=!1,isError:c=!1,secondary:v=!1,searchLabel:C,status:M,appendIcon:u,className:R}){const[f,S]=x({value:i,defaultValue:h,onChange:n=>p?.(n,{index:-1})}),[t,k]=x({value:a,defaultValue:j,onChange:n=>g?.(n,{source:"click"})}),l=w(null);return y(()=>{a&&!s&&l.current&&l.current.focus()},[a,s]),e.jsxs(e.Fragment,{children:[m&&e.jsx(o,{name:m,className:r("sc-icon",{expanded:t,disabled:s,error:c})}),e.jsxs("span",{className:r("flex items-center gap-xs truncate text-sm flex-1",R,{"text-neutral-foreground-low":!d}),children:[N&&!s&&e.jsxs("div",{className:r("flex items-center text-neutral-foreground-high w-full",{secondary:v,hidden:!t}),onClick:()=>k(!0),children:[e.jsx(o,{name:"search",className:r("sc-icon",{expanded:t,disabled:s,error:c})}),!f?.length&&e.jsx("div",{className:"relative pointer-events-none",children:e.jsx("span",{className:"search-placeholder",children:C||"Search"})}),e.jsx("input",{ref:l,type:"search",className:"search",disabled:s,value:f??"",onChange:n=>S(n.target.value)}),u&&e.jsx(o,{name:u,className:r("sc-icon",{expanded:t,disabled:s,error:c})})]}),M]})]})}export{A as S};
|
|
@@ -0,0 +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,"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};
|
|
@@ -0,0 +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,"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;
|
|
@@ -0,0 +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-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};
|
|
@@ -0,0 +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-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};
|
|
@@ -0,0 +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,"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;
|
|
@@ -0,0 +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,"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};
|
|
@@ -0,0 +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,"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};
|
|
@@ -0,0 +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: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};
|
|
@@ -0,0 +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,"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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-u17CrQMm.js";import B,{useState as S}from"react";import{c as f}from"./clsx-B-dksMZM.js";import{useControllable as Q}from"../hooks/useControllable.es.js";import{P as Te}from"./Pagination-CRjhLGmz.js";import{Skeleton as F}from"../components/Skeleton/index.es.js";import{C as U}from"./Checkbox-BWJvfeIk.js";import{Icon as Le}from"../components/Icon/index.es.js";import{S as Ie}from"./Select-ClQjvlOH.js";const Pe="_table_xchde_2",ke="_tableContent_xchde_2",Ae="_noShadow_xchde_2",Fe="_headerFixed_xchde_2",Re="_tableStyle_xchde_2",Be="_firstTh_xchde_2",De="_lastTh_xchde_2",Ee="_pointerNone_xchde_2",Ve="_hoverBg_xchde_2",He="_bgWhite_xchde_2",We="_sortable_xchde_2",$e="_thContent_xchde_2",Me="_thLabel_xchde_2",qe="_sortIcon_xchde_2",ze="_sortIconRotated_xchde_2",Ge="_sortIconActive_xchde_2",Je="_row_xchde_2",Qe="_cell_xchde_2",Ue="_rowHover_xchde_2",Xe="_skeletonCell_xchde_2",Ye="_footer_xchde_2",Ze="_footerLeft_xchde_2",Ke="_footerLabel_xchde_2",s={table:Pe,tableContent:ke,noShadow:Ae,headerFixed:Fe,tableStyle:Re,firstTh:Be,lastTh:De,pointerNone:Ee,hoverBg:Ve,bgWhite:He,sortable:We,thContent:$e,thLabel:Me,sortIcon:qe,sortIconRotated:ze,sortIconActive:Ge,row:Je,cell:Qe,rowHover:Ue,skeletonCell:Xe,footer:Ye,footerLeft:Ze,footerLabel:Ke};function Oe(a,d,h){return[...a].sort((g,m)=>{const n=g[d],r=m[d];if(typeof n=="string"&&typeof r=="string"){const x=n.toLowerCase(),i=r.toLowerCase();return h?x.localeCompare(i):i.localeCompare(x)}else{if(typeof n=="number"&&typeof r=="number")return h?n-r:r-n;if(n instanceof Date&&r instanceof Date)return h?n.getTime()-r.getTime():r.getTime()-n.getTime();{const x=String(n).toLowerCase(),i=String(r).toLowerCase();return h?x.localeCompare(i):i.localeCompare(x)}}})}function R(a,d){return B.Children.toArray(a).find(m=>B.isValidElement(m)&&m.type===d)||null}function X({children:a}){return e.jsx(e.Fragment,{children:a})}function Y({children:a}){return e.jsx(e.Fragment,{children:a})}function Z({children:a}){return e.jsx(e.Fragment,{children:a})}function D({columns:a,items:d,sortOptions:h,page:g,defaultPage:m,itemsPerPage:n,defaultItemsPerPage:r,numberOfItems:x,renderPaginationInBackEnd:i=!1,hideFooter:K=!1,isHeaderFixed:O=!1,enableSelection:C=!1,enableAggregation:u=!1,loading:w=!1,noShadow:ee=!1,hasHover:te=!1,onPageChange:se,onItemsPerPageChange:oe,onSortBy:le,onPageItems:E,onSelectAll:ae,onSelectRow:ne,renderAggregation:re,renderSelect:V,renderActions:v,renderChilds:H,renderEmptyState:ce,renderFooter:W,renderItemsPerPage:he,renderShowingPage:$,children:T,className:de}){const[ie,M]=Q({value:g,defaultValue:m??1,onChange:se}),[fe,xe]=Q({value:n,defaultValue:r??10,onChange:oe}),[b,_e]=S(h?.by||null),[L,me]=S(()=>{const t={};return a.forEach(o=>{t[o.value]=o.value===h?.by?!!h?.desc:!1}),t}),[pe,I]=S(new Set),[je,ue]=S(!1),p=ie??1,_=fe??10,P=b?Oe(d,b,L[b]??!1):d,k=i?x??0:P?.length??0,be=Math.ceil(k/_),N=i?P:P.slice((p-1)*_,p*_),q=p===1?1:(p-1)*_+1,z=(p-1)*_+N.length;let j=a.length;C&&j++,u&&j++;const A=R(T,X),G=R(T,Y),ge=R(T,Z),y=!!v||!!A;y&&j++;const Ce=[5,10,20,50,100],ve=t=>{if(!t.sortable)return;const o=t.value,l=b===o?!L[o]:!1;_e(o),me(c=>({...c,[o]:l})),le?.(o,l)},Ne=(t,o)=>{I(l=>{const c=new Set(l),J=c.has(t);return J?c.delete(t):c.add(t),ne?.(o,!J),c})},ye=t=>{const o=!!t;ue(o),I(o?new Set(N.map((l,c)=>c)):new Set),d?.forEach(l=>{l.selected=o}),ae?.(o)},Se=t=>{M(t),E?.(t,_)},we=t=>{xe(t||10),M(1),E?.(1,t)};return e.jsxs("div",{className:f(s.table,"table",de),children:[e.jsx("div",{className:f(s.tableContent,ee&&s.noShadow,O&&s.headerFixed),children:e.jsxs("table",{className:s.tableStyle,children:[w?e.jsx("thead",{children:e.jsx("tr",{children:Array.from({length:j||3}).map((t,o)=>e.jsx("th",{className:s.skeletonCell,children:e.jsx(F,{})},o))})}):e.jsx("thead",{children:e.jsxs("tr",{children:[u&&e.jsx("th",{className:f(s.firstTh,s.pointerNone),style:{width:"2%"}}),C&&e.jsx("th",{className:f(!u&&s.firstTh,s.hoverBg),style:{width:"2%"},children:e.jsx(U,{value:je,onChange:ye})}),a.map((t,o)=>e.jsx("th",{style:{width:t.width??"fit-content"},className:f(s.sortable,o===0&&!C&&!u&&s.firstTh,!a[o+1]&&!y&&s.lastTh,!t.sortable&&s.pointerNone),onClick:()=>ve(t),children:e.jsxs("div",{className:s.thContent,style:{justifyContent:t.align??"flex-start"},children:[e.jsx("p",{className:s.thLabel,children:t.label}),t.sortable&&e.jsx("span",{className:f(s.sortIcon,L[t.value]&&s.sortIconRotated,t.value===b&&s.sortIconActive),children:e.jsx(Le,{name:"arrow_upward"})})]})},t.value)),y&&e.jsx("th",{style:{flex:1},className:f(s.pointerNone,s.bgWhite)})]})}),w||!N.length?e.jsx("tbody",{children:w?Array.from({length:10}).map((t,o)=>e.jsxs("tr",{children:[Array.from({length:j||3}).map((l,c)=>e.jsx("td",{className:s.skeletonCell,children:e.jsx(F,{})},c)),y&&e.jsx("td",{className:s.skeletonCell,children:e.jsx(F,{})})]},`skeleton-${o}`)):e.jsx("tr",{children:e.jsx("td",{colSpan:j,children:ce?.()||ge||null})})}):e.jsx("tbody",{children:N.map((t,o)=>e.jsxs(B.Fragment,{children:[e.jsxs("tr",{className:f(s.row,te&&s.rowHover),children:[u&&e.jsx("td",{className:s.cell,children:re?.(t,o)}),C&&e.jsx("td",{className:s.cell,children:V?V(t,o):e.jsx(U,{value:pe.has(o),onChange:()=>Ne(o,t)})}),a.map(l=>e.jsx("td",{className:s.cell,style:{textAlign:l.align==="center"?"center":l.align==="flex-end"?"right":"left"},children:l.render?l.render(t[l.value],t,o):t[l.value]},l.value)),v&&e.jsx("td",{className:s.cell,children:v(t,o)}),!v&&A&&e.jsx("td",{className:s.cell,children:A})]}),t.expanded&&H&&H(t,o)]},o))}),(W||G)&&e.jsx("tfoot",{children:W?.()||G})]})}),!K&&e.jsxs("footer",{className:s.footer,children:[e.jsxs("div",{className:s.footerLeft,children:[e.jsx("p",{className:s.footerLabel,children:he?.()||"Items per page"}),e.jsx(Ie,{value:_,options:Ce,onChange:t=>we(t)})]}),e.jsx(Te,{value:p,onChange:Se,length:be}),e.jsx("div",{children:e.jsx("p",{className:s.footerLabel,children:$?$(q,z,k):`Showing ${q}-${z} of ${k}`})})]})]})}D.Actions=X;D.Footer=Y;D.EmptyState=Z;export{D as T};
|