@techzyapp/ui-library 1.0.42 → 1.0.43
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/dist/AdminRoot-BLHvXCvL.js +101 -0
- package/dist/AdminRoot-BLHvXCvL.js.map +1 -0
- package/dist/AdminRoot-D_g_TW30.cjs +2 -0
- package/dist/AdminRoot-D_g_TW30.cjs.map +1 -0
- package/dist/{Alert-C8BBxL_7.cjs → Alert-B4XZDk16.cjs} +2 -2
- package/dist/{Alert-C8BBxL_7.cjs.map → Alert-B4XZDk16.cjs.map} +1 -1
- package/dist/{Alert-D6oBxBdP.js → Alert-D5E1PLkV.js} +3 -3
- package/dist/{Alert-D6oBxBdP.js.map → Alert-D5E1PLkV.js.map} +1 -1
- package/dist/{Breadcrumbs-B-olYVdw.cjs → Breadcrumbs-DSUxcp6u.cjs} +2 -2
- package/dist/{Breadcrumbs-B-olYVdw.cjs.map → Breadcrumbs-DSUxcp6u.cjs.map} +1 -1
- package/dist/{Breadcrumbs-cXET6OM5.js → Breadcrumbs-M31xyok8.js} +3 -3
- package/dist/{Breadcrumbs-cXET6OM5.js.map → Breadcrumbs-M31xyok8.js.map} +1 -1
- package/dist/{Button-0ZgdNjX-.js → Button-CtADzomU.js} +2 -2
- package/dist/{Button-0ZgdNjX-.js.map → Button-CtADzomU.js.map} +1 -1
- package/dist/{Button-CwrDiZek.cjs → Button-Q_5uA-zc.cjs} +2 -2
- package/dist/{Button-CwrDiZek.cjs.map → Button-Q_5uA-zc.cjs.map} +1 -1
- package/dist/{Calendar-d3CX5UJp.cjs → Calendar-BbbtMsZs.cjs} +2 -2
- package/dist/{Calendar-d3CX5UJp.cjs.map → Calendar-BbbtMsZs.cjs.map} +1 -1
- package/dist/{Calendar-CxzdnzdK.js → Calendar-CHLCv2s9.js} +3 -3
- package/dist/{Calendar-CxzdnzdK.js.map → Calendar-CHLCv2s9.js.map} +1 -1
- package/dist/{Card-CjqStov5.js → Card-Br9IB0yM.js} +3 -3
- package/dist/{Card-CjqStov5.js.map → Card-Br9IB0yM.js.map} +1 -1
- package/dist/{Card-CxnUoWsi.cjs → Card-CntRsQfm.cjs} +2 -2
- package/dist/{Card-CxnUoWsi.cjs.map → Card-CntRsQfm.cjs.map} +1 -1
- package/dist/{Chip-BkU3yx6G.cjs → Chip-CrBizrvG.cjs} +2 -2
- package/dist/{Chip-BkU3yx6G.cjs.map → Chip-CrBizrvG.cjs.map} +1 -1
- package/dist/{Chip-CzJjbaKx.js → Chip-DYZ5w7VM.js} +2 -2
- package/dist/{Chip-CzJjbaKx.js.map → Chip-DYZ5w7VM.js.map} +1 -1
- package/dist/{CodeBlock-BHcvQrs9.js → CodeBlock-B6Eqc4HR.js} +3 -3
- package/dist/{CodeBlock-BHcvQrs9.js.map → CodeBlock-B6Eqc4HR.js.map} +1 -1
- package/dist/{CodeBlock-DRBQ_S5t.cjs → CodeBlock-DW4uaZXM.cjs} +2 -2
- package/dist/{CodeBlock-DRBQ_S5t.cjs.map → CodeBlock-DW4uaZXM.cjs.map} +1 -1
- package/dist/{ColorPicker-BQKFdTNr.js → ColorPicker-GsKIqJu8.js} +3 -3
- package/dist/{ColorPicker-BQKFdTNr.js.map → ColorPicker-GsKIqJu8.js.map} +1 -1
- package/dist/{ColorPicker-BzCEMN7B.cjs → ColorPicker-nhWd_nOW.cjs} +2 -2
- package/dist/{ColorPicker-BzCEMN7B.cjs.map → ColorPicker-nhWd_nOW.cjs.map} +1 -1
- package/dist/{ColorPickerPanel-DKTKC9KH.js → ColorPickerPanel-BEcZePcT.js} +2 -2
- package/dist/{ColorPickerPanel-DKTKC9KH.js.map → ColorPickerPanel-BEcZePcT.js.map} +1 -1
- package/dist/{ColorPickerPanel-kl2jUix-.cjs → ColorPickerPanel-BeAu83S6.cjs} +2 -2
- package/dist/{ColorPickerPanel-kl2jUix-.cjs.map → ColorPickerPanel-BeAu83S6.cjs.map} +1 -1
- package/dist/{ColorRamp-n7muILK3.cjs → ColorRamp-C-zRPhHj.cjs} +2 -2
- package/dist/{ColorRamp-n7muILK3.cjs.map → ColorRamp-C-zRPhHj.cjs.map} +1 -1
- package/dist/{ColorRamp-yfMyJCyx.js → ColorRamp-CeNgd8wF.js} +2 -2
- package/dist/{ColorRamp-yfMyJCyx.js.map → ColorRamp-CeNgd8wF.js.map} +1 -1
- package/dist/ConfigProvider-Ci9Q2HLF.cjs +2 -0
- package/dist/ConfigProvider-Ci9Q2HLF.cjs.map +1 -0
- package/dist/{ConfigProvider-D61cpCz-.js → ConfigProvider-Dqfu7UBU.js} +133 -126
- package/dist/ConfigProvider-Dqfu7UBU.js.map +1 -0
- package/dist/{CopyButton-ecxn-ghi.js → CopyButton-Bidt2Vgp.js} +3 -3
- package/dist/{CopyButton-ecxn-ghi.js.map → CopyButton-Bidt2Vgp.js.map} +1 -1
- package/dist/{CopyButton-DlSi82gv.cjs → CopyButton-Chr7SP5i.cjs} +2 -2
- package/dist/{CopyButton-DlSi82gv.cjs.map → CopyButton-Chr7SP5i.cjs.map} +1 -1
- package/dist/{DatePicker-BjZ_P21i.cjs → DatePicker-4rb34nPR.cjs} +2 -2
- package/dist/{DatePicker-BjZ_P21i.cjs.map → DatePicker-4rb34nPR.cjs.map} +1 -1
- package/dist/{DatePicker-CAGpJbDi.js → DatePicker-D7ZMOhWn.js} +4 -4
- package/dist/{DatePicker-CAGpJbDi.js.map → DatePicker-D7ZMOhWn.js.map} +1 -1
- package/dist/{DateTimePicker-DZqWQeUL.cjs → DateTimePicker-CVFzKzyA.cjs} +2 -2
- package/dist/{DateTimePicker-DZqWQeUL.cjs.map → DateTimePicker-CVFzKzyA.cjs.map} +1 -1
- package/dist/{DateTimePicker-BJmF0Su6.js → DateTimePicker-gDxM2CGy.js} +7 -7
- package/dist/{DateTimePicker-BJmF0Su6.js.map → DateTimePicker-gDxM2CGy.js.map} +1 -1
- package/dist/{DescriptionList-CvPDn-kh.cjs → DescriptionList-BBvfABps.cjs} +2 -2
- package/dist/{DescriptionList-CvPDn-kh.cjs.map → DescriptionList-BBvfABps.cjs.map} +1 -1
- package/dist/{DescriptionList-Knq5eCiY.js → DescriptionList-Die3lRBW.js} +4 -4
- package/dist/{DescriptionList-Knq5eCiY.js.map → DescriptionList-Die3lRBW.js.map} +1 -1
- package/dist/{EmptyState-CX1g47y_.cjs → EmptyState-D5EKQjX1.cjs} +2 -2
- package/dist/{EmptyState-CX1g47y_.cjs.map → EmptyState-D5EKQjX1.cjs.map} +1 -1
- package/dist/{EmptyState-Dqtpmtje.js → EmptyState-DRgER10x.js} +2 -2
- package/dist/{EmptyState-Dqtpmtje.js.map → EmptyState-DRgER10x.js.map} +1 -1
- package/dist/{ErrorBoundary-Dos7VLb-.js → ErrorBoundary-CLfE2NjU.js} +3 -3
- package/dist/{ErrorBoundary-Dos7VLb-.js.map → ErrorBoundary-CLfE2NjU.js.map} +1 -1
- package/dist/{ErrorBoundary-B8KwWXXp.cjs → ErrorBoundary-DVcGWZd8.cjs} +2 -2
- package/dist/{ErrorBoundary-B8KwWXXp.cjs.map → ErrorBoundary-DVcGWZd8.cjs.map} +1 -1
- package/dist/{ErrorState-CwCqd2PU.cjs → ErrorState-DJDQbHZY.cjs} +2 -2
- package/dist/{ErrorState-CwCqd2PU.cjs.map → ErrorState-DJDQbHZY.cjs.map} +1 -1
- package/dist/{ErrorState-KhzrGIJ-.js → ErrorState-Dqw0AvmB.js} +7 -7
- package/dist/{ErrorState-KhzrGIJ-.js.map → ErrorState-Dqw0AvmB.js.map} +1 -1
- package/dist/{FileCard-DEc10T2G.cjs → FileCard-BqMproT9.cjs} +2 -2
- package/dist/{FileCard-DEc10T2G.cjs.map → FileCard-BqMproT9.cjs.map} +1 -1
- package/dist/{FileCard-SSuFS13E.js → FileCard-kVnjcSlk.js} +3 -3
- package/dist/{FileCard-SSuFS13E.js.map → FileCard-kVnjcSlk.js.map} +1 -1
- package/dist/{FileUploader-D58_6kDA.cjs → FileUploader-BimFH5d8.cjs} +2 -2
- package/dist/{FileUploader-D58_6kDA.cjs.map → FileUploader-BimFH5d8.cjs.map} +1 -1
- package/dist/{FileUploader-DfYOBFa4.js → FileUploader-LJIMh5_b.js} +5 -5
- package/dist/{FileUploader-DfYOBFa4.js.map → FileUploader-LJIMh5_b.js.map} +1 -1
- package/dist/{FullscreenToggle-I_In47BB.js → FullscreenToggle-BuQonKW8.js} +3 -3
- package/dist/{FullscreenToggle-I_In47BB.js.map → FullscreenToggle-BuQonKW8.js.map} +1 -1
- package/dist/{FullscreenToggle-Po769CoC.cjs → FullscreenToggle-CWlOXLss.cjs} +2 -2
- package/dist/{FullscreenToggle-Po769CoC.cjs.map → FullscreenToggle-CWlOXLss.cjs.map} +1 -1
- package/dist/{IconButton-D9MCwRK_.js → IconButton-BoURJOUD.js} +2 -2
- package/dist/{IconButton-D9MCwRK_.js.map → IconButton-BoURJOUD.js.map} +1 -1
- package/dist/{IconButton-CxSXEYce.cjs → IconButton-CiDPeKM4.cjs} +2 -2
- package/dist/{IconButton-CxSXEYce.cjs.map → IconButton-CiDPeKM4.cjs.map} +1 -1
- package/dist/{Loader-5zp2MPm5.cjs → Loader-CAmRn8Oj.cjs} +2 -2
- package/dist/{Loader-5zp2MPm5.cjs.map → Loader-CAmRn8Oj.cjs.map} +1 -1
- package/dist/{Loader-Bluu6z0-.js → Loader-CnTuddK7.js} +2 -2
- package/dist/{Loader-Bluu6z0-.js.map → Loader-CnTuddK7.js.map} +1 -1
- package/dist/{LocationPicker-CGHXTIml.cjs → LocationPicker-BwQ6ULMF.cjs} +2 -2
- package/dist/{LocationPicker-CGHXTIml.cjs.map → LocationPicker-BwQ6ULMF.cjs.map} +1 -1
- package/dist/{LocationPicker-hULpHBVG.js → LocationPicker-Cns3fkYI.js} +6 -6
- package/dist/{LocationPicker-hULpHBVG.js.map → LocationPicker-Cns3fkYI.js.map} +1 -1
- package/dist/{Modal-C6Zgwz_6.js → Modal-CYcVOzID.js} +3 -3
- package/dist/{Modal-C6Zgwz_6.js.map → Modal-CYcVOzID.js.map} +1 -1
- package/dist/{Modal-D9_OG53G.cjs → Modal-DwY3jGHE.cjs} +2 -2
- package/dist/{Modal-D9_OG53G.cjs.map → Modal-DwY3jGHE.cjs.map} +1 -1
- package/dist/{MultiSelect-BdPvjiTj.cjs → MultiSelect-DJ6tRseY.cjs} +2 -2
- package/dist/{MultiSelect-BdPvjiTj.cjs.map → MultiSelect-DJ6tRseY.cjs.map} +1 -1
- package/dist/{MultiSelect-CHLMpim4.js → MultiSelect-svEVZNbp.js} +4 -4
- package/dist/{MultiSelect-CHLMpim4.js.map → MultiSelect-svEVZNbp.js.map} +1 -1
- package/dist/{NumberField-BlpFmetF.js → NumberField-9ekoB1wS.js} +3 -3
- package/dist/{NumberField-BlpFmetF.js.map → NumberField-9ekoB1wS.js.map} +1 -1
- package/dist/{NumberField-C-FZ-uRI.cjs → NumberField-sokUuuBR.cjs} +2 -2
- package/dist/{NumberField-C-FZ-uRI.cjs.map → NumberField-sokUuuBR.cjs.map} +1 -1
- package/dist/{OtpField-D4-r7I0A.js → OtpField-DA7zJwy9.js} +2 -2
- package/dist/{OtpField-D4-r7I0A.js.map → OtpField-DA7zJwy9.js.map} +1 -1
- package/dist/{OtpField-Drjy2wwq.cjs → OtpField-DlkGju72.cjs} +2 -2
- package/dist/{OtpField-Drjy2wwq.cjs.map → OtpField-DlkGju72.cjs.map} +1 -1
- package/dist/{PageError-DXUOkE14.cjs → PageError-DUN5PzDF.cjs} +2 -2
- package/dist/{PageError-DXUOkE14.cjs.map → PageError-DUN5PzDF.cjs.map} +1 -1
- package/dist/{PageError-DyDj1wQZ.js → PageError-vD8Dpfns.js} +5 -5
- package/dist/{PageError-DyDj1wQZ.js.map → PageError-vD8Dpfns.js.map} +1 -1
- package/dist/{PageLayout-CoG0AaUs.cjs → PageLayout-BesuKuX6.cjs} +2 -2
- package/dist/{PageLayout-CoG0AaUs.cjs.map → PageLayout-BesuKuX6.cjs.map} +1 -1
- package/dist/{PageLayout-nsJa8CbT.js → PageLayout-CdObvxt7.js} +4 -4
- package/dist/{PageLayout-nsJa8CbT.js.map → PageLayout-CdObvxt7.js.map} +1 -1
- package/dist/{PageNotFound-BNNwMkwE.js → PageNotFound-Cc5eZ6w3.js} +5 -5
- package/dist/{PageNotFound-BNNwMkwE.js.map → PageNotFound-Cc5eZ6w3.js.map} +1 -1
- package/dist/{PageNotFound-CGSxT_n9.cjs → PageNotFound-CfOAhmJ-.cjs} +2 -2
- package/dist/{PageNotFound-CGSxT_n9.cjs.map → PageNotFound-CfOAhmJ-.cjs.map} +1 -1
- package/dist/{Pagination-CZtewveA.cjs → Pagination-CAD9_Nr_.cjs} +2 -2
- package/dist/{Pagination-CZtewveA.cjs.map → Pagination-CAD9_Nr_.cjs.map} +1 -1
- package/dist/{Pagination-tuWRnGwR.js → Pagination-CX0S1RrF.js} +2 -2
- package/dist/{Pagination-tuWRnGwR.js.map → Pagination-CX0S1RrF.js.map} +1 -1
- package/dist/{PaletteField-CTPl3D43.js → PaletteField-CVIwl2nV.js} +3 -3
- package/dist/{PaletteField-CTPl3D43.js.map → PaletteField-CVIwl2nV.js.map} +1 -1
- package/dist/{PaletteField-PDcu2vUp.cjs → PaletteField-CpiEkXcB.cjs} +2 -2
- package/dist/{PaletteField-PDcu2vUp.cjs.map → PaletteField-CpiEkXcB.cjs.map} +1 -1
- package/dist/{PhoneField-BPYg5ZHW.cjs → PhoneField-Dlnnv4DU.cjs} +2 -2
- package/dist/{PhoneField-BPYg5ZHW.cjs.map → PhoneField-Dlnnv4DU.cjs.map} +1 -1
- package/dist/{PhoneField-pdWDCszb.js → PhoneField-xHLTU-o5.js} +4 -4
- package/dist/{PhoneField-pdWDCszb.js.map → PhoneField-xHLTU-o5.js.map} +1 -1
- package/dist/{Popconfirm-cNpJmkuR.cjs → Popconfirm-Chlm_M5T.cjs} +2 -2
- package/dist/{Popconfirm-cNpJmkuR.cjs.map → Popconfirm-Chlm_M5T.cjs.map} +1 -1
- package/dist/{Popconfirm-CMVzLaC_.js → Popconfirm-DIlygJY8.js} +3 -3
- package/dist/{Popconfirm-CMVzLaC_.js.map → Popconfirm-DIlygJY8.js.map} +1 -1
- package/dist/{Progress-BNEFGn-O.js → Progress-BAEhawtj.js} +2 -2
- package/dist/{Progress-BNEFGn-O.js.map → Progress-BAEhawtj.js.map} +1 -1
- package/dist/{Progress-x12Rkh06.cjs → Progress-DqvKmyQW.cjs} +2 -2
- package/dist/{Progress-x12Rkh06.cjs.map → Progress-DqvKmyQW.cjs.map} +1 -1
- package/dist/{QrCode-CrNJZV_8.js → QrCode-D7BTYcW2.js} +2 -2
- package/dist/{QrCode-CrNJZV_8.js.map → QrCode-D7BTYcW2.js.map} +1 -1
- package/dist/{QrCode-TcQQE0h7.cjs → QrCode-Dqsk49vX.cjs} +2 -2
- package/dist/{QrCode-TcQQE0h7.cjs.map → QrCode-Dqsk49vX.cjs.map} +1 -1
- package/dist/{RemoveDialog-ARFp1UJM.js → RemoveDialog-CQIm9GTH.js} +5 -5
- package/dist/{RemoveDialog-ARFp1UJM.js.map → RemoveDialog-CQIm9GTH.js.map} +1 -1
- package/dist/{RemoveDialog-IWOAQFNK.cjs → RemoveDialog-DZ-EqIfS.cjs} +2 -2
- package/dist/{RemoveDialog-IWOAQFNK.cjs.map → RemoveDialog-DZ-EqIfS.cjs.map} +1 -1
- package/dist/{RichTextEditor-C9jT2cLl.cjs → RichTextEditor-Ba1G_qXu.cjs} +2 -2
- package/dist/{RichTextEditor-C9jT2cLl.cjs.map → RichTextEditor-Ba1G_qXu.cjs.map} +1 -1
- package/dist/{RichTextEditor-DrwJUEYz.js → RichTextEditor-CJcbxQ6H.js} +7 -7
- package/dist/{RichTextEditor-DrwJUEYz.js.map → RichTextEditor-CJcbxQ6H.js.map} +1 -1
- package/dist/{RootLayout-CZ2GQ8XA.js → RootLayout-Cl98ghy1.js} +14 -14
- package/dist/RootLayout-Cl98ghy1.js.map +1 -0
- package/dist/{RootLayout-DStUP263.cjs → RootLayout-s_Q_kSoS.cjs} +2 -2
- package/dist/RootLayout-s_Q_kSoS.cjs.map +1 -0
- package/dist/{Select-C2DIfuoB.cjs → Select-BrjXCXtl.cjs} +2 -2
- package/dist/{Select-C2DIfuoB.cjs.map → Select-BrjXCXtl.cjs.map} +1 -1
- package/dist/{Select-KGsA8PbI.js → Select-CG8UJL9R.js} +3 -3
- package/dist/{Select-KGsA8PbI.js.map → Select-CG8UJL9R.js.map} +1 -1
- package/dist/{Sidebar-_pcwxdd8.js → Sidebar-CbPr34jd.js} +3 -3
- package/dist/{Sidebar-_pcwxdd8.js.map → Sidebar-CbPr34jd.js.map} +1 -1
- package/dist/{Sidebar-wK1_xaY_.cjs → Sidebar-DLlqHvQJ.cjs} +2 -2
- package/dist/{Sidebar-wK1_xaY_.cjs.map → Sidebar-DLlqHvQJ.cjs.map} +1 -1
- package/dist/{Slider-Cpc5_dPl.js → Slider-B5iG-HSw.js} +2 -2
- package/dist/{Slider-Cpc5_dPl.js.map → Slider-B5iG-HSw.js.map} +1 -1
- package/dist/{Slider-CXAz9SUY.cjs → Slider-DTnui01g.cjs} +2 -2
- package/dist/{Slider-CXAz9SUY.cjs.map → Slider-DTnui01g.cjs.map} +1 -1
- package/dist/{SpeedDial-SMMfes9f.js → SpeedDial-Be3SHkzw.js} +2 -2
- package/dist/{SpeedDial-SMMfes9f.js.map → SpeedDial-Be3SHkzw.js.map} +1 -1
- package/dist/{SpeedDial-BT_boD06.cjs → SpeedDial-i5kxikmt.cjs} +2 -2
- package/dist/{SpeedDial-BT_boD06.cjs.map → SpeedDial-i5kxikmt.cjs.map} +1 -1
- package/dist/{Stepper-CR0Mlkq7.js → Stepper-BDQt-oVG.js} +2 -2
- package/dist/{Stepper-CR0Mlkq7.js.map → Stepper-BDQt-oVG.js.map} +1 -1
- package/dist/{Stepper-BmA_DjTS.cjs → Stepper-e8qBsKYW.cjs} +2 -2
- package/dist/{Stepper-BmA_DjTS.cjs.map → Stepper-e8qBsKYW.cjs.map} +1 -1
- package/dist/{Table-BkjY1Lwt.cjs → Table-C14fRX1U.cjs} +2 -2
- package/dist/{Table-BkjY1Lwt.cjs.map → Table-C14fRX1U.cjs.map} +1 -1
- package/dist/{Table-D-F68lcm.js → Table-ChdM_vyi.js} +16 -16
- package/dist/{Table-D-F68lcm.js.map → Table-ChdM_vyi.js.map} +1 -1
- package/dist/{Tabs-DP0aZ5TB.js → Tabs-BxZrgozI.js} +2 -2
- package/dist/{Tabs-DP0aZ5TB.js.map → Tabs-BxZrgozI.js.map} +1 -1
- package/dist/{Tabs-Cgp6D1WP.cjs → Tabs-C4kB1yfG.cjs} +2 -2
- package/dist/{Tabs-Cgp6D1WP.cjs.map → Tabs-C4kB1yfG.cjs.map} +1 -1
- package/dist/{TagsField-9nKu6ZW4.cjs → TagsField-Bg5BcQU-.cjs} +2 -2
- package/dist/{TagsField-9nKu6ZW4.cjs.map → TagsField-Bg5BcQU-.cjs.map} +1 -1
- package/dist/{TagsField-CcY9MTMw.js → TagsField-DWlIt7XO.js} +4 -4
- package/dist/{TagsField-CcY9MTMw.js.map → TagsField-DWlIt7XO.js.map} +1 -1
- package/dist/{TextField-C5MgCQIV.cjs → TextField-B-xqoDZR.cjs} +2 -2
- package/dist/{TextField-C5MgCQIV.cjs.map → TextField-B-xqoDZR.cjs.map} +1 -1
- package/dist/{TextField-0WvJsHhA.js → TextField-Dwx5GPxz.js} +3 -3
- package/dist/{TextField-0WvJsHhA.js.map → TextField-Dwx5GPxz.js.map} +1 -1
- package/dist/{ThemeToggle-DmCePuTy.js → ThemeToggle-CK2USfgx.js} +3 -3
- package/dist/{ThemeToggle-DmCePuTy.js.map → ThemeToggle-CK2USfgx.js.map} +1 -1
- package/dist/{ThemeToggle-BvcCxRpF.cjs → ThemeToggle-DFgv1bsh.cjs} +2 -2
- package/dist/{ThemeToggle-BvcCxRpF.cjs.map → ThemeToggle-DFgv1bsh.cjs.map} +1 -1
- package/dist/{TimeColumns-Q-vsHFZU.cjs → TimeColumns-B8KTj-tc.cjs} +2 -2
- package/dist/{TimeColumns-Q-vsHFZU.cjs.map → TimeColumns-B8KTj-tc.cjs.map} +1 -1
- package/dist/{TimeColumns-WJRHQuFv.js → TimeColumns-BWcuu3l7.js} +2 -2
- package/dist/{TimeColumns-WJRHQuFv.js.map → TimeColumns-BWcuu3l7.js.map} +1 -1
- package/dist/{TimePicker-CvbQFzBf.cjs → TimePicker-DjL15hz1.cjs} +2 -2
- package/dist/{TimePicker-CvbQFzBf.cjs.map → TimePicker-DjL15hz1.cjs.map} +1 -1
- package/dist/{TimePicker-DJDuSxAg.js → TimePicker-YMVHevpZ.js} +5 -5
- package/dist/{TimePicker-DJDuSxAg.js.map → TimePicker-YMVHevpZ.js.map} +1 -1
- package/dist/Toaster-9hZ5MuW7.cjs +2 -0
- package/dist/Toaster-9hZ5MuW7.cjs.map +1 -0
- package/dist/Toaster-pHN2pxrU.js +64 -0
- package/dist/Toaster-pHN2pxrU.js.map +1 -0
- package/dist/{TranslatedFields-DKXznBtD.js → TranslatedFields-BpWU5ZcG.js} +11 -11
- package/dist/{TranslatedFields-DKXznBtD.js.map → TranslatedFields-BpWU5ZcG.js.map} +1 -1
- package/dist/{TranslatedFields-CuK5KKzE.cjs → TranslatedFields-SvS37hab.cjs} +2 -2
- package/dist/{TranslatedFields-CuK5KKzE.cjs.map → TranslatedFields-SvS37hab.cjs.map} +1 -1
- package/dist/{UserCard-DbudGMvG.cjs → UserCard-VPaexedS.cjs} +2 -2
- package/dist/{UserCard-DbudGMvG.cjs.map → UserCard-VPaexedS.cjs.map} +1 -1
- package/dist/{UserCard-UG_Cwe-Y.js → UserCard-cmZrMvwL.js} +3 -3
- package/dist/{UserCard-UG_Cwe-Y.js.map → UserCard-cmZrMvwL.js.map} +1 -1
- package/dist/app/AdminRoot.d.cts +11 -3
- package/dist/app/AdminRoot.d.ts +11 -3
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Card/index.cjs +1 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Chip/index.cjs +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/ColorPicker/index.cjs +1 -1
- package/dist/components/ColorPicker/index.js +1 -1
- package/dist/components/ColorRamp/index.cjs +1 -1
- package/dist/components/ColorRamp/index.js +1 -1
- package/dist/components/CopyButton/index.cjs +1 -1
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DateTimePicker/index.cjs +1 -1
- package/dist/components/DateTimePicker/index.js +1 -1
- package/dist/components/DescriptionList/index.cjs +1 -1
- package/dist/components/DescriptionList/index.js +1 -1
- package/dist/components/EmptyState/index.cjs +1 -1
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/ErrorState/ErrorBoundary.d.cts +1 -1
- package/dist/components/ErrorState/ErrorBoundary.d.ts +1 -1
- package/dist/components/ErrorState/index.cjs +1 -1
- package/dist/components/ErrorState/index.js +2 -2
- package/dist/components/FileCard/index.cjs +1 -1
- package/dist/components/FileCard/index.js +1 -1
- package/dist/components/FileUploader/index.cjs +1 -1
- package/dist/components/FileUploader/index.js +1 -1
- package/dist/components/FullscreenToggle/index.cjs +1 -1
- package/dist/components/FullscreenToggle/index.js +1 -1
- package/dist/components/IconButton/index.cjs +1 -1
- package/dist/components/IconButton/index.js +1 -1
- package/dist/components/Loader/index.cjs +1 -1
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/LocationPicker/index.cjs +1 -1
- package/dist/components/LocationPicker/index.js +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/MultiSelect/index.cjs +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OtpField/index.cjs +1 -1
- package/dist/components/OtpField/index.js +1 -1
- package/dist/components/PageError/index.cjs +1 -1
- package/dist/components/PageError/index.js +1 -1
- package/dist/components/PageLayout/index.cjs +1 -1
- package/dist/components/PageLayout/index.js +1 -1
- package/dist/components/PageNotFound/index.cjs +1 -1
- package/dist/components/PageNotFound/index.js +1 -1
- package/dist/components/Pagination/index.cjs +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PaletteField/index.cjs +1 -1
- package/dist/components/PaletteField/index.js +1 -1
- package/dist/components/PhoneField/index.cjs +1 -1
- package/dist/components/PhoneField/index.js +1 -1
- package/dist/components/Popconfirm/index.cjs +1 -1
- package/dist/components/Popconfirm/index.js +1 -1
- package/dist/components/Progress/index.cjs +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/QrCode/index.cjs +1 -1
- package/dist/components/QrCode/index.js +1 -1
- package/dist/components/RemoveDialog/index.cjs +1 -1
- package/dist/components/RemoveDialog/index.js +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RootLayout/RootLayout.d.cts +3 -2
- package/dist/components/RootLayout/RootLayout.d.ts +3 -2
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Sidebar/index.cjs +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/Slider/index.cjs +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/SpeedDial/index.cjs +1 -1
- package/dist/components/SpeedDial/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.cjs +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/TagsField/index.cjs +1 -1
- package/dist/components/TagsField/index.js +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/ThemeToggle/index.cjs +1 -1
- package/dist/components/ThemeToggle/index.js +1 -1
- package/dist/components/TimePicker/index.cjs +1 -1
- package/dist/components/TimePicker/index.js +1 -1
- package/dist/components/Toast/Toaster.d.cts +10 -4
- package/dist/components/Toast/Toaster.d.ts +10 -4
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TranslatedFields/index.cjs +1 -1
- package/dist/components/TranslatedFields/index.js +1 -1
- package/dist/components/UserCard/index.cjs +1 -1
- package/dist/components/UserCard/index.js +1 -1
- package/dist/entries/app.cjs +1 -1
- package/dist/entries/app.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +51 -51
- package/dist/entries/i18n.cjs +1 -1
- package/dist/entries/i18n.js +1 -1
- package/dist/entries/theme.cjs +1 -1
- package/dist/entries/theme.d.cts +2 -2
- package/dist/entries/theme.d.ts +2 -2
- package/dist/entries/theme.js +14 -13
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +236 -235
- package/dist/theme/ConfigProvider.d.cts +20 -0
- package/dist/theme/ConfigProvider.d.ts +20 -0
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/{useHomeTo-DQj9tVZI.js → useHomeTo-DdmOGy09.js} +2 -2
- package/dist/{useHomeTo-DQj9tVZI.js.map → useHomeTo-DdmOGy09.js.map} +1 -1
- package/dist/{useHomeTo-BaM7kBDh.cjs → useHomeTo-HCkVzGTu.cjs} +2 -2
- package/dist/{useHomeTo-BaM7kBDh.cjs.map → useHomeTo-HCkVzGTu.cjs.map} +1 -1
- package/dist/{useOptionMenu-BKC1y6oj.cjs → useOptionMenu-BqCj10_a.cjs} +2 -2
- package/dist/{useOptionMenu-BKC1y6oj.cjs.map → useOptionMenu-BqCj10_a.cjs.map} +1 -1
- package/dist/{useOptionMenu-Dom1-bqm.js → useOptionMenu-EiyIkC3E.js} +3 -3
- package/dist/{useOptionMenu-Dom1-bqm.js.map → useOptionMenu-EiyIkC3E.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminRoot-DufZpgdm.js +0 -100
- package/dist/AdminRoot-DufZpgdm.js.map +0 -1
- package/dist/AdminRoot-DwJ5jdXr.cjs +0 -2
- package/dist/AdminRoot-DwJ5jdXr.cjs.map +0 -1
- package/dist/ConfigProvider-BaiTKZKC.cjs +0 -2
- package/dist/ConfigProvider-BaiTKZKC.cjs.map +0 -1
- package/dist/ConfigProvider-D61cpCz-.js.map +0 -1
- package/dist/RootLayout-CZ2GQ8XA.js.map +0 -1
- package/dist/RootLayout-DStUP263.cjs.map +0 -1
- package/dist/Toaster-Bb5YEN5j.js +0 -63
- package/dist/Toaster-Bb5YEN5j.js.map +0 -1
- package/dist/Toaster-Dy1AonLa.cjs +0 -2
- package/dist/Toaster-Dy1AonLa.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress-BNEFGn-O.js","sources":["../src/components/Progress/Progress.tsx"],"sourcesContent":["import { forwardRef, useId, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport styles from './Progress.module.css'\n\nexport type ProgressVariant = 'linear' | 'circular'\nexport type ProgressSize = 'sm' | 'md' | 'lg'\n\n/** Percentages (0–100) at which the color switches automatically — quota UX. */\nexport interface ProgressThresholds {\n /** From this percentage on, the bar turns `warning`. */\n warning?: number\n /** From this percentage on, the bar turns `error`. */\n error?: number\n}\n\nexport interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Current value, `0`–`max`. Omit it for an **indeterminate** progress (a moving bar / spinning arc). */\n value?: number\n /** The value that means \"done\". Defaults to `100`. */\n max?: number\n /** `linear` (default) — a bar; `circular` — a ring. */\n variant?: ProgressVariant\n /** Linear: bar thickness 4 / 6 / 8 px. Circular: ring 32 / 48 / 64 px. Defaults to `md`. */\n size?: ProgressSize\n /** Theme color of the fill. Defaults to `accent`. */\n color?: ThemeColor\n /** A caption — above the bar (left) for linear, under the ring for circular. Labels the progressbar. */\n label?: ReactNode\n /**\n * Show the value: `true` → the percentage (\"42%\"); a function → your own text, e.g.\n * `(v, max) => `${v} GB of ${max} GB``. Linear: right of the caption; circular: inside the ring.\n */\n showValue?: boolean | ((value: number, max: number) => ReactNode)\n /** A second, lighter bar behind the fill (buffered / pending amount), `0`–`max`. Linear only. */\n buffer?: number\n /** Diagonal stripes on the fill. Linear only. */\n striped?: boolean\n /** Animate the stripes (implies `striped`). Linear only. Off under `prefers-reduced-motion`. */\n animated?: boolean\n /** Switch the color automatically by percentage (e.g. `{ warning: 80, error: 95 }` for a quota). */\n thresholds?: ProgressThresholds\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\n\n/**\n * A progress indicator — **linear** (a bar) or **circular** (a ring) — for uploads, wizard steps, quotas and\n * background jobs. Determinate with `value` / `max`, or **indeterminate** without `value` (a moving bar / a\n * spinning arc). An optional caption (`label`) and value readout (`showValue` — the percentage or your own\n * formatter), a lighter `buffer` bar, `striped` / `animated` fills, and `thresholds` that turn the fill\n * `warning` / `error` as it fills up. Tinted by `color` through the shared `--tz-btn-rgb` pattern; the track is\n * `primary-shade200`, the bar is pill-rounded (so the global `square` shape flattens it). A11y:\n * `role=\"progressbar\"` with `aria-valuemin/max/now` + `aria-valuetext`, labelled by the caption (or a\n * localized \"Progress\"); indeterminate drops `aria-valuenow` and sets `aria-busy`. Motion stops under\n * `prefers-reduced-motion`. Token-only. `forwardRef` to the root `<div>`.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n value,\n max = 100,\n variant = 'linear',\n size = 'md',\n color = 'accent',\n label,\n showValue = false,\n buffer,\n striped = false,\n animated = false,\n thresholds,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const labelId = useId()\n const indeterminate = value == null\n const safeMax = max > 0 ? max : 100\n const current = indeterminate ? 0 : clamp(value, 0, safeMax)\n const pct = (current / safeMax) * 100\n const bufferPct = buffer == null ? undefined : (clamp(buffer, 0, safeMax) / safeMax) * 100\n\n // quota UX: the fill turns warning / error as it crosses the thresholds (error wins)\n const resolvedColor: ThemeColor =\n !indeterminate && thresholds?.error != null && pct >= thresholds.error\n ? 'error'\n : !indeterminate && thresholds?.warning != null && pct >= thresholds.warning\n ? 'warning'\n : color\n\n const valueText = indeterminate\n ? undefined\n : typeof showValue === 'function'\n ? showValue(current, safeMax)\n : showValue\n ? `${Math.round(pct)}%`\n : undefined\n const ariaValueText = indeterminate\n ? t('common.loading')\n : typeof valueText === 'string'\n ? valueText\n : `${Math.round(pct)}%`\n\n const a11y = {\n role: 'progressbar',\n 'aria-valuemin': 0,\n 'aria-valuemax': safeMax,\n 'aria-valuenow': indeterminate ? undefined : current,\n 'aria-valuetext': ariaValueText,\n 'aria-busy': indeterminate || undefined,\n ...(label != null ? { 'aria-labelledby': labelId } : { 'aria-label': t('progress.label') }),\n } as const\n\n const rootStyle = {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n ...style,\n } as CSSProperties\n\n if (variant === 'circular') {\n // pathLength=100 makes the dash math a plain percentage\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.circular, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n <div className={clsx(styles.ring, indeterminate && styles.spinning)} {...a11y}>\n <svg viewBox=\"0 0 36 36\" className={styles.svg} aria-hidden=\"true\">\n <circle className={styles.ringTrack} cx=\"18\" cy=\"18\" r=\"15.5\" pathLength={100} />\n <circle\n className={styles.ringFill}\n cx=\"18\"\n cy=\"18\"\n r=\"15.5\"\n pathLength={100}\n strokeDasharray={indeterminate ? '28 72' : `${pct} ${100 - pct}`}\n />\n </svg>\n {valueText != null && <span className={styles.ringValue}>{valueText}</span>}\n </div>\n {label != null && (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n )}\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.linear, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n {(label != null || valueText != null) && (\n <div className={styles.header}>\n {label != null ? (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n ) : (\n <span />\n )}\n {valueText != null && <span className={styles.value}>{valueText}</span>}\n </div>\n )}\n <div className={clsx(styles.track, indeterminate && styles.indeterminate)} {...a11y}>\n {bufferPct != null && !indeterminate && (\n <div className={styles.buffer} style={{ width: `${bufferPct}%` }} />\n )}\n <div\n className={clsx(\n styles.fill,\n (striped || animated) && styles.striped,\n animated && styles.animated,\n )}\n style={indeterminate ? undefined : { width: `${pct}%` }}\n />\n </div>\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","Progress","forwardRef","value","max","variant","size","color","label","showValue","buffer","striped","animated","thresholds","className","style","props","ref","t","useT","labelId","useId","indeterminate","safeMax","current","pct","bufferPct","resolvedColor","valueText","ariaValueText","a11y","rootStyle","jsxs","clsx","styles","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CMA,IAAQ,CAACC,GAAWC,GAAYC,MAAe,KAAK,IAAIA,GAAI,KAAK,IAAID,GAAID,CAAC,CAAC,GAapEG,KAAWC,EAA0C,SAChE;AAAA,EACE,OAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA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,EAAC,UAAK,WAAWD,EAAO,OAAQ,UAAAN,EAAA,CAAU;AAAA,QAAA,GAClE;AAAA,QAEF,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAKC,EAAO,OAAOZ,KAAiBY,EAAO,aAAa,GAAI,GAAGJ,GAC5E,UAAA;AAAA,UAAAJ,KAAa,QAAQ,CAACJ,KACrB,gBAAAa,EAAC,SAAI,WAAWD,EAAO,QAAQ,OAAO,EAAE,OAAO,GAAGR,CAAS,OAAO;AAAA,UAEpE,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWF;AAAA,gBACTC,EAAO;AAAA,iBACNvB,KAAWC,MAAasB,EAAO;AAAA,gBAChCtB,KAAYsB,EAAO;AAAA,cAAA;AAAA,cAErB,OAAOZ,IAAgB,SAAY,EAAE,OAAO,GAAGG,CAAG,IAAA;AAAA,YAAI;AAAA,UAAA;AAAA,QACxD,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"Progress-BAEhawtj.js","sources":["../src/components/Progress/Progress.tsx"],"sourcesContent":["import { forwardRef, useId, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport styles from './Progress.module.css'\n\nexport type ProgressVariant = 'linear' | 'circular'\nexport type ProgressSize = 'sm' | 'md' | 'lg'\n\n/** Percentages (0–100) at which the color switches automatically — quota UX. */\nexport interface ProgressThresholds {\n /** From this percentage on, the bar turns `warning`. */\n warning?: number\n /** From this percentage on, the bar turns `error`. */\n error?: number\n}\n\nexport interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Current value, `0`–`max`. Omit it for an **indeterminate** progress (a moving bar / spinning arc). */\n value?: number\n /** The value that means \"done\". Defaults to `100`. */\n max?: number\n /** `linear` (default) — a bar; `circular` — a ring. */\n variant?: ProgressVariant\n /** Linear: bar thickness 4 / 6 / 8 px. Circular: ring 32 / 48 / 64 px. Defaults to `md`. */\n size?: ProgressSize\n /** Theme color of the fill. Defaults to `accent`. */\n color?: ThemeColor\n /** A caption — above the bar (left) for linear, under the ring for circular. Labels the progressbar. */\n label?: ReactNode\n /**\n * Show the value: `true` → the percentage (\"42%\"); a function → your own text, e.g.\n * `(v, max) => `${v} GB of ${max} GB``. Linear: right of the caption; circular: inside the ring.\n */\n showValue?: boolean | ((value: number, max: number) => ReactNode)\n /** A second, lighter bar behind the fill (buffered / pending amount), `0`–`max`. Linear only. */\n buffer?: number\n /** Diagonal stripes on the fill. Linear only. */\n striped?: boolean\n /** Animate the stripes (implies `striped`). Linear only. Off under `prefers-reduced-motion`. */\n animated?: boolean\n /** Switch the color automatically by percentage (e.g. `{ warning: 80, error: 95 }` for a quota). */\n thresholds?: ProgressThresholds\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\n\n/**\n * A progress indicator — **linear** (a bar) or **circular** (a ring) — for uploads, wizard steps, quotas and\n * background jobs. Determinate with `value` / `max`, or **indeterminate** without `value` (a moving bar / a\n * spinning arc). An optional caption (`label`) and value readout (`showValue` — the percentage or your own\n * formatter), a lighter `buffer` bar, `striped` / `animated` fills, and `thresholds` that turn the fill\n * `warning` / `error` as it fills up. Tinted by `color` through the shared `--tz-btn-rgb` pattern; the track is\n * `primary-shade200`, the bar is pill-rounded (so the global `square` shape flattens it). A11y:\n * `role=\"progressbar\"` with `aria-valuemin/max/now` + `aria-valuetext`, labelled by the caption (or a\n * localized \"Progress\"); indeterminate drops `aria-valuenow` and sets `aria-busy`. Motion stops under\n * `prefers-reduced-motion`. Token-only. `forwardRef` to the root `<div>`.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n value,\n max = 100,\n variant = 'linear',\n size = 'md',\n color = 'accent',\n label,\n showValue = false,\n buffer,\n striped = false,\n animated = false,\n thresholds,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const labelId = useId()\n const indeterminate = value == null\n const safeMax = max > 0 ? max : 100\n const current = indeterminate ? 0 : clamp(value, 0, safeMax)\n const pct = (current / safeMax) * 100\n const bufferPct = buffer == null ? undefined : (clamp(buffer, 0, safeMax) / safeMax) * 100\n\n // quota UX: the fill turns warning / error as it crosses the thresholds (error wins)\n const resolvedColor: ThemeColor =\n !indeterminate && thresholds?.error != null && pct >= thresholds.error\n ? 'error'\n : !indeterminate && thresholds?.warning != null && pct >= thresholds.warning\n ? 'warning'\n : color\n\n const valueText = indeterminate\n ? undefined\n : typeof showValue === 'function'\n ? showValue(current, safeMax)\n : showValue\n ? `${Math.round(pct)}%`\n : undefined\n const ariaValueText = indeterminate\n ? t('common.loading')\n : typeof valueText === 'string'\n ? valueText\n : `${Math.round(pct)}%`\n\n const a11y = {\n role: 'progressbar',\n 'aria-valuemin': 0,\n 'aria-valuemax': safeMax,\n 'aria-valuenow': indeterminate ? undefined : current,\n 'aria-valuetext': ariaValueText,\n 'aria-busy': indeterminate || undefined,\n ...(label != null ? { 'aria-labelledby': labelId } : { 'aria-label': t('progress.label') }),\n } as const\n\n const rootStyle = {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n ...style,\n } as CSSProperties\n\n if (variant === 'circular') {\n // pathLength=100 makes the dash math a plain percentage\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.circular, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n <div className={clsx(styles.ring, indeterminate && styles.spinning)} {...a11y}>\n <svg viewBox=\"0 0 36 36\" className={styles.svg} aria-hidden=\"true\">\n <circle className={styles.ringTrack} cx=\"18\" cy=\"18\" r=\"15.5\" pathLength={100} />\n <circle\n className={styles.ringFill}\n cx=\"18\"\n cy=\"18\"\n r=\"15.5\"\n pathLength={100}\n strokeDasharray={indeterminate ? '28 72' : `${pct} ${100 - pct}`}\n />\n </svg>\n {valueText != null && <span className={styles.ringValue}>{valueText}</span>}\n </div>\n {label != null && (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n )}\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.linear, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n {(label != null || valueText != null) && (\n <div className={styles.header}>\n {label != null ? (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n ) : (\n <span />\n )}\n {valueText != null && <span className={styles.value}>{valueText}</span>}\n </div>\n )}\n <div className={clsx(styles.track, indeterminate && styles.indeterminate)} {...a11y}>\n {bufferPct != null && !indeterminate && (\n <div className={styles.buffer} style={{ width: `${bufferPct}%` }} />\n )}\n <div\n className={clsx(\n styles.fill,\n (striped || animated) && styles.striped,\n animated && styles.animated,\n )}\n style={indeterminate ? undefined : { width: `${pct}%` }}\n />\n </div>\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","Progress","forwardRef","value","max","variant","size","color","label","showValue","buffer","striped","animated","thresholds","className","style","props","ref","t","useT","labelId","useId","indeterminate","safeMax","current","pct","bufferPct","resolvedColor","valueText","ariaValueText","a11y","rootStyle","jsxs","clsx","styles","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CMA,IAAQ,CAACC,GAAWC,GAAYC,MAAe,KAAK,IAAIA,GAAI,KAAK,IAAID,GAAID,CAAC,CAAC,GAapEG,KAAWC,EAA0C,SAChE;AAAA,EACE,OAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,SAAAC,IAAU;AAAA,EACV,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,OAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,UAAAC,IAAW;AAAA,EACX,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJC,IAAUC,EAAA,GACVC,IAAgBnB,KAAS,MACzBoB,IAAUnB,I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F,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAKC,EAAO,OAAOZ,KAAiBY,EAAO,aAAa,GAAI,GAAGJ,GAC5E,UAAA;AAAA,UAAAJ,KAAa,QAAQ,CAACJ,KACrB,gBAAAa,EAAC,SAAI,WAAWD,EAAO,QAAQ,OAAO,EAAE,OAAO,GAAGR,CAAS,OAAO;AAAA,UAEpE,gBAAAS;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWF;AAAA,gBACTC,EAAO;AAAA,iBACNvB,KAAWC,MAAasB,EAAO;AAAA,gBAChCtB,KAAYsB,EAAO;AAAA,cAAA;AAAA,cAErB,OAAOZ,IAAgB,SAAY,EAAE,OAAO,GAAGG,CAAG,IAAA;AAAA,YAAI;AAAA,UAAA;AAAA,QACxD,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),w=require("react"),o=require("clsx"),h=require("./ConfigProvider-
|
|
2
|
-
//# sourceMappingURL=Progress-
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),w=require("react"),o=require("clsx"),h=require("./ConfigProvider-Ci9Q2HLF.cjs"),C="_root_1uzzo_4",I="_caption_1uzzo_11",L="_value_1uzzo_16",R="_linear_1uzzo_23",B="_sm_1uzzo_28",D="_md_1uzzo_31",S="_lg_1uzzo_34",A="_header_1uzzo_38",E="_track_1uzzo_45",G="_buffer_1uzzo_52",H="_fill_1uzzo_53",J="_striped_1uzzo_69",K="_animated_1uzzo_82",O="_indeterminate_1uzzo_95",Q="_circular_1uzzo_109",U="_ring_1uzzo_128",W="_svg_1uzzo_136",X="_ringTrack_1uzzo_144",Y="_ringFill_1uzzo_145",Z="_ringValue_1uzzo_159",nn="_spinning_1uzzo_165",n={root:C,caption:I,value:L,linear:R,sm:B,md:D,lg:S,header:A,track:E,buffer:G,fill:H,striped:J,animated:K,"pg-stripes":"_pg-stripes_1uzzo_1",indeterminate:O,"pg-sweep":"_pg-sweep_1uzzo_1",circular:Q,ring:U,svg:W,ringTrack:X,ringFill:Y,ringValue:Z,spinning:nn,"pg-spin":"_pg-spin_1uzzo_1"},T=(d,l,u)=>Math.min(u,Math.max(l,d)),rn=w.forwardRef(function({value:l,max:u=100,variant:$="linear",size:p="md",color:M="accent",label:c,showValue:_=!1,buffer:m,striped:P=!1,animated:v=!1,thresholds:i,className:x,style:q,...f},j){const y=h.useT(),g=w.useId(),s=l==null,t=u>0?u:100,z=s?0:T(l,0,t),a=z/t*100,N=m==null?void 0:T(m,0,t)/t*100,F=!s&&(i==null?void 0:i.error)!=null&&a>=i.error?"error":!s&&(i==null?void 0:i.warning)!=null&&a>=i.warning?"warning":M,e=s?void 0:typeof _=="function"?_(z,t):_?`${Math.round(a)}%`:void 0,V=s?y("common.loading"):typeof e=="string"?e:`${Math.round(a)}%`,b={role:"progressbar","aria-valuemin":0,"aria-valuemax":t,"aria-valuenow":s?void 0:z,"aria-valuetext":V,"aria-busy":s||void 0,...c!=null?{"aria-labelledby":g}:{"aria-label":y("progress.label")}},k={"--tz-btn-rgb":`var(--tz-color-${F}-rgb)`,...q};return $==="circular"?r.jsxs("div",{ref:j,className:o.clsx(n.root,n.circular,n[p],x),style:k,...f,children:[r.jsxs("div",{className:o.clsx(n.ring,s&&n.spinning),...b,children:[r.jsxs("svg",{viewBox:"0 0 36 36",className:n.svg,"aria-hidden":"true",children:[r.jsx("circle",{className:n.ringTrack,cx:"18",cy:"18",r:"15.5",pathLength:100}),r.jsx("circle",{className:n.ringFill,cx:"18",cy:"18",r:"15.5",pathLength:100,strokeDasharray:s?"28 72":`${a} ${100-a}`})]}),e!=null&&r.jsx("span",{className:n.ringValue,children:e})]}),c!=null&&r.jsx("span",{id:g,className:n.caption,children:c})]}):r.jsxs("div",{ref:j,className:o.clsx(n.root,n.linear,n[p],x),style:k,...f,children:[(c!=null||e!=null)&&r.jsxs("div",{className:n.header,children:[c!=null?r.jsx("span",{id:g,className:n.caption,children:c}):r.jsx("span",{}),e!=null&&r.jsx("span",{className:n.value,children:e})]}),r.jsxs("div",{className:o.clsx(n.track,s&&n.indeterminate),...b,children:[N!=null&&!s&&r.jsx("div",{className:n.buffer,style:{width:`${N}%`}}),r.jsx("div",{className:o.clsx(n.fill,(P||v)&&n.striped,v&&n.animated),style:s?void 0:{width:`${a}%`}})]})]})});exports.Progress=rn;
|
|
2
|
+
//# sourceMappingURL=Progress-DqvKmyQW.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress-x12Rkh06.cjs","sources":["../src/components/Progress/Progress.tsx"],"sourcesContent":["import { forwardRef, useId, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport styles from './Progress.module.css'\n\nexport type ProgressVariant = 'linear' | 'circular'\nexport type ProgressSize = 'sm' | 'md' | 'lg'\n\n/** Percentages (0–100) at which the color switches automatically — quota UX. */\nexport interface ProgressThresholds {\n /** From this percentage on, the bar turns `warning`. */\n warning?: number\n /** From this percentage on, the bar turns `error`. */\n error?: number\n}\n\nexport interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Current value, `0`–`max`. Omit it for an **indeterminate** progress (a moving bar / spinning arc). */\n value?: number\n /** The value that means \"done\". Defaults to `100`. */\n max?: number\n /** `linear` (default) — a bar; `circular` — a ring. */\n variant?: ProgressVariant\n /** Linear: bar thickness 4 / 6 / 8 px. Circular: ring 32 / 48 / 64 px. Defaults to `md`. */\n size?: ProgressSize\n /** Theme color of the fill. Defaults to `accent`. */\n color?: ThemeColor\n /** A caption — above the bar (left) for linear, under the ring for circular. Labels the progressbar. */\n label?: ReactNode\n /**\n * Show the value: `true` → the percentage (\"42%\"); a function → your own text, e.g.\n * `(v, max) => `${v} GB of ${max} GB``. Linear: right of the caption; circular: inside the ring.\n */\n showValue?: boolean | ((value: number, max: number) => ReactNode)\n /** A second, lighter bar behind the fill (buffered / pending amount), `0`–`max`. Linear only. */\n buffer?: number\n /** Diagonal stripes on the fill. Linear only. */\n striped?: boolean\n /** Animate the stripes (implies `striped`). Linear only. Off under `prefers-reduced-motion`. */\n animated?: boolean\n /** Switch the color automatically by percentage (e.g. `{ warning: 80, error: 95 }` for a quota). */\n thresholds?: ProgressThresholds\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\n\n/**\n * A progress indicator — **linear** (a bar) or **circular** (a ring) — for uploads, wizard steps, quotas and\n * background jobs. Determinate with `value` / `max`, or **indeterminate** without `value` (a moving bar / a\n * spinning arc). An optional caption (`label`) and value readout (`showValue` — the percentage or your own\n * formatter), a lighter `buffer` bar, `striped` / `animated` fills, and `thresholds` that turn the fill\n * `warning` / `error` as it fills up. Tinted by `color` through the shared `--tz-btn-rgb` pattern; the track is\n * `primary-shade200`, the bar is pill-rounded (so the global `square` shape flattens it). A11y:\n * `role=\"progressbar\"` with `aria-valuemin/max/now` + `aria-valuetext`, labelled by the caption (or a\n * localized \"Progress\"); indeterminate drops `aria-valuenow` and sets `aria-busy`. Motion stops under\n * `prefers-reduced-motion`. Token-only. `forwardRef` to the root `<div>`.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n value,\n max = 100,\n variant = 'linear',\n size = 'md',\n color = 'accent',\n label,\n showValue = false,\n buffer,\n striped = false,\n animated = false,\n thresholds,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const labelId = useId()\n const indeterminate = value == null\n const safeMax = max > 0 ? max : 100\n const current = indeterminate ? 0 : clamp(value, 0, safeMax)\n const pct = (current / safeMax) * 100\n const bufferPct = buffer == null ? undefined : (clamp(buffer, 0, safeMax) / safeMax) * 100\n\n // quota UX: the fill turns warning / error as it crosses the thresholds (error wins)\n const resolvedColor: ThemeColor =\n !indeterminate && thresholds?.error != null && pct >= thresholds.error\n ? 'error'\n : !indeterminate && thresholds?.warning != null && pct >= thresholds.warning\n ? 'warning'\n : color\n\n const valueText = indeterminate\n ? undefined\n : typeof showValue === 'function'\n ? showValue(current, safeMax)\n : showValue\n ? `${Math.round(pct)}%`\n : undefined\n const ariaValueText = indeterminate\n ? t('common.loading')\n : typeof valueText === 'string'\n ? valueText\n : `${Math.round(pct)}%`\n\n const a11y = {\n role: 'progressbar',\n 'aria-valuemin': 0,\n 'aria-valuemax': safeMax,\n 'aria-valuenow': indeterminate ? undefined : current,\n 'aria-valuetext': ariaValueText,\n 'aria-busy': indeterminate || undefined,\n ...(label != null ? { 'aria-labelledby': labelId } : { 'aria-label': t('progress.label') }),\n } as const\n\n const rootStyle = {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n ...style,\n } as CSSProperties\n\n if (variant === 'circular') {\n // pathLength=100 makes the dash math a plain percentage\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.circular, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n <div className={clsx(styles.ring, indeterminate && styles.spinning)} {...a11y}>\n <svg viewBox=\"0 0 36 36\" className={styles.svg} aria-hidden=\"true\">\n <circle className={styles.ringTrack} cx=\"18\" cy=\"18\" r=\"15.5\" pathLength={100} />\n <circle\n className={styles.ringFill}\n cx=\"18\"\n cy=\"18\"\n r=\"15.5\"\n pathLength={100}\n strokeDasharray={indeterminate ? '28 72' : `${pct} ${100 - pct}`}\n />\n </svg>\n {valueText != null && <span className={styles.ringValue}>{valueText}</span>}\n </div>\n {label != null && (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n )}\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.linear, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n {(label != null || valueText != null) && (\n <div className={styles.header}>\n {label != null ? (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n ) : (\n <span />\n )}\n {valueText != null && <span className={styles.value}>{valueText}</span>}\n </div>\n )}\n <div className={clsx(styles.track, indeterminate && styles.indeterminate)} {...a11y}>\n {bufferPct != null && !indeterminate && (\n <div className={styles.buffer} style={{ width: `${bufferPct}%` }} />\n )}\n <div\n className={clsx(\n styles.fill,\n (striped || animated) && styles.striped,\n animated && styles.animated,\n )}\n style={indeterminate ? undefined : { width: `${pct}%` }}\n />\n </div>\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","Progress","forwardRef","value","max","variant","size","color","label","showValue","buffer","striped","animated","thresholds","className","style","props","ref","t","useT","labelId","useId","indeterminate","safeMax","current","pct","bufferPct","resolvedColor","valueText","ariaValueText","a11y","rootStyle","jsxs","clsx","styles","jsx"],"mappings":"m2BA4CMA,EAAQ,CAACC,EAAWC,EAAYC,IAAe,KAAK,IAAIA,EAAI,KAAK,IAAID,EAAID,CAAC,CAAC,EAapEG,GAAWC,EAAAA,WAA0C,SAChE,CACE,MAAAC,EACA,IAAAC,EAAM,IACN,QAAAC,EAAU,SACV,KAAAC,EAAO,KACP,MAAAC,EAAQ,SACR,MAAAC,EACA,UAAAC,EAAY,GACZ,OAAAC,EACA,QAAAC,EAAU,GACV,SAAAC,EAAW,GACX,WAAAC,EACA,UAAAC,EACA,MAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAUC,EAAAA,MAAA,EACVC,EAAgBnB,GAAS,KACzBoB,EAAUnB,EAAM,EAAIA,EAAM,IAC1BoB,EAAUF,EAAgB,EAAIzB,EAAMM,EAAO,EAAGoB,CAAO,EACrDE,EAAOD,EAAUD,EAAW,IAC5BG,EAAYhB,GAAU,KAAO,OAAab,EAAMa,EAAQ,EAAGa,CAAO,EAAIA,EAAW,IAGjFI,EACJ,CAACL,IAAiBT,GAAA,YAAAA,EAAY,QAAS,MAAQY,GAAOZ,EAAW,MAC7D,QACA,CAACS,IAAiBT,GAAA,YAAAA,EAAY,UAAW,MAAQY,GAAOZ,EAAW,QACjE,UACAN,EAEFqB,EAAYN,EACd,OACA,OAAOb,GAAc,WACnBA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A,CAAK,GAAIf,EAAS,UAAWc,EAAO,QAClC,SAAA1B,CAAA,CACH,CAAA,CAAA,CAAA,EAONwB,EAAAA,KAAC,MAAA,CACC,IAAAf,EACA,UAAWgB,EAAAA,KAAKC,EAAO,KAAMA,EAAO,OAAQA,EAAO5B,CAAI,EAAGQ,CAAS,EACnE,MAAOiB,EACN,GAAGf,EAEF,SAAA,EAAAR,GAAS,MAAQoB,GAAa,cAC7B,MAAA,CAAI,UAAWM,EAAO,OACpB,SAAA,CAAA1B,GAAS,KACR2B,EAAAA,IAAC,OAAA,CAAK,GAAIf,EAAS,UAAWc,EAAO,QAClC,SAAA1B,CAAA,CACH,EAEA2B,EAAAA,IAAC,OAAA,EAAK,EAEPP,GAAa,MAAQO,EAAAA,IAAC,QAAK,UAAWD,EAAO,MAAQ,SAAAN,CAAA,CAAU,CAAA,EAClE,EAEFI,EAAAA,KAAC,MAAA,CAAI,UAAWC,EAAAA,KAAKC,EAAO,MAAOZ,GAAiBY,EAAO,aAAa,EAAI,GAAGJ,EAC5E,SAAA,CAAAJ,GAAa,MAAQ,CAACJ,GACrBa,EAAAA,IAAC,OAAI,UAAWD,EAAO,OAAQ,MAAO,CAAE,MAAO,GAAGR,CAAS,KAAO,EAEpES,EAAAA,IAAC,MAAA,CACC,UAAWF,EAAAA,KACTC,EAAO,MACNvB,GAAWC,IAAasB,EAAO,QAChCtB,GAAYsB,EAAO,QAAA,EAErB,MAAOZ,EAAgB,OAAY,CAAE,MAAO,GAAGG,CAAG,GAAA,CAAI,CAAA,CACxD,CAAA,CACF,CAAA,CAAA,CAAA,CAGN,CAAC"}
|
|
1
|
+
{"version":3,"file":"Progress-DqvKmyQW.cjs","sources":["../src/components/Progress/Progress.tsx"],"sourcesContent":["import { forwardRef, useId, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport styles from './Progress.module.css'\n\nexport type ProgressVariant = 'linear' | 'circular'\nexport type ProgressSize = 'sm' | 'md' | 'lg'\n\n/** Percentages (0–100) at which the color switches automatically — quota UX. */\nexport interface ProgressThresholds {\n /** From this percentage on, the bar turns `warning`. */\n warning?: number\n /** From this percentage on, the bar turns `error`. */\n error?: number\n}\n\nexport interface ProgressProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Current value, `0`–`max`. Omit it for an **indeterminate** progress (a moving bar / spinning arc). */\n value?: number\n /** The value that means \"done\". Defaults to `100`. */\n max?: number\n /** `linear` (default) — a bar; `circular` — a ring. */\n variant?: ProgressVariant\n /** Linear: bar thickness 4 / 6 / 8 px. Circular: ring 32 / 48 / 64 px. Defaults to `md`. */\n size?: ProgressSize\n /** Theme color of the fill. Defaults to `accent`. */\n color?: ThemeColor\n /** A caption — above the bar (left) for linear, under the ring for circular. Labels the progressbar. */\n label?: ReactNode\n /**\n * Show the value: `true` → the percentage (\"42%\"); a function → your own text, e.g.\n * `(v, max) => `${v} GB of ${max} GB``. Linear: right of the caption; circular: inside the ring.\n */\n showValue?: boolean | ((value: number, max: number) => ReactNode)\n /** A second, lighter bar behind the fill (buffered / pending amount), `0`–`max`. Linear only. */\n buffer?: number\n /** Diagonal stripes on the fill. Linear only. */\n striped?: boolean\n /** Animate the stripes (implies `striped`). Linear only. Off under `prefers-reduced-motion`. */\n animated?: boolean\n /** Switch the color automatically by percentage (e.g. `{ warning: 80, error: 95 }` for a quota). */\n thresholds?: ProgressThresholds\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(hi, Math.max(lo, n))\n\n/**\n * A progress indicator — **linear** (a bar) or **circular** (a ring) — for uploads, wizard steps, quotas and\n * background jobs. Determinate with `value` / `max`, or **indeterminate** without `value` (a moving bar / a\n * spinning arc). An optional caption (`label`) and value readout (`showValue` — the percentage or your own\n * formatter), a lighter `buffer` bar, `striped` / `animated` fills, and `thresholds` that turn the fill\n * `warning` / `error` as it fills up. Tinted by `color` through the shared `--tz-btn-rgb` pattern; the track is\n * `primary-shade200`, the bar is pill-rounded (so the global `square` shape flattens it). A11y:\n * `role=\"progressbar\"` with `aria-valuemin/max/now` + `aria-valuetext`, labelled by the caption (or a\n * localized \"Progress\"); indeterminate drops `aria-valuenow` and sets `aria-busy`. Motion stops under\n * `prefers-reduced-motion`. Token-only. `forwardRef` to the root `<div>`.\n */\nexport const Progress = forwardRef<HTMLDivElement, ProgressProps>(function Progress(\n {\n value,\n max = 100,\n variant = 'linear',\n size = 'md',\n color = 'accent',\n label,\n showValue = false,\n buffer,\n striped = false,\n animated = false,\n thresholds,\n className,\n style,\n ...props\n },\n ref,\n) {\n const t = useT()\n const labelId = useId()\n const indeterminate = value == null\n const safeMax = max > 0 ? max : 100\n const current = indeterminate ? 0 : clamp(value, 0, safeMax)\n const pct = (current / safeMax) * 100\n const bufferPct = buffer == null ? undefined : (clamp(buffer, 0, safeMax) / safeMax) * 100\n\n // quota UX: the fill turns warning / error as it crosses the thresholds (error wins)\n const resolvedColor: ThemeColor =\n !indeterminate && thresholds?.error != null && pct >= thresholds.error\n ? 'error'\n : !indeterminate && thresholds?.warning != null && pct >= thresholds.warning\n ? 'warning'\n : color\n\n const valueText = indeterminate\n ? undefined\n : typeof showValue === 'function'\n ? showValue(current, safeMax)\n : showValue\n ? `${Math.round(pct)}%`\n : undefined\n const ariaValueText = indeterminate\n ? t('common.loading')\n : typeof valueText === 'string'\n ? valueText\n : `${Math.round(pct)}%`\n\n const a11y = {\n role: 'progressbar',\n 'aria-valuemin': 0,\n 'aria-valuemax': safeMax,\n 'aria-valuenow': indeterminate ? undefined : current,\n 'aria-valuetext': ariaValueText,\n 'aria-busy': indeterminate || undefined,\n ...(label != null ? { 'aria-labelledby': labelId } : { 'aria-label': t('progress.label') }),\n } as const\n\n const rootStyle = {\n '--tz-btn-rgb': `var(--tz-color-${resolvedColor}-rgb)`,\n ...style,\n } as CSSProperties\n\n if (variant === 'circular') {\n // pathLength=100 makes the dash math a plain percentage\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.circular, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n <div className={clsx(styles.ring, indeterminate && styles.spinning)} {...a11y}>\n <svg viewBox=\"0 0 36 36\" className={styles.svg} aria-hidden=\"true\">\n <circle className={styles.ringTrack} cx=\"18\" cy=\"18\" r=\"15.5\" pathLength={100} />\n <circle\n className={styles.ringFill}\n cx=\"18\"\n cy=\"18\"\n r=\"15.5\"\n pathLength={100}\n strokeDasharray={indeterminate ? '28 72' : `${pct} ${100 - pct}`}\n />\n </svg>\n {valueText != null && <span className={styles.ringValue}>{valueText}</span>}\n </div>\n {label != null && (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n )}\n </div>\n )\n }\n\n return (\n <div\n ref={ref}\n className={clsx(styles.root, styles.linear, styles[size], className)}\n style={rootStyle}\n {...props}\n >\n {(label != null || valueText != null) && (\n <div className={styles.header}>\n {label != null ? (\n <span id={labelId} className={styles.caption}>\n {label}\n </span>\n ) : (\n <span />\n )}\n {valueText != null && <span className={styles.value}>{valueText}</span>}\n </div>\n )}\n <div className={clsx(styles.track, indeterminate && styles.indeterminate)} {...a11y}>\n {bufferPct != null && !indeterminate && (\n <div className={styles.buffer} style={{ width: `${bufferPct}%` }} />\n )}\n <div\n className={clsx(\n styles.fill,\n (striped || animated) && styles.striped,\n animated && styles.animated,\n )}\n style={indeterminate ? undefined : { width: `${pct}%` }}\n />\n </div>\n </div>\n )\n})\n"],"names":["clamp","n","lo","hi","Progress","forwardRef","value","max","variant","size","color","label","showValue","buffer","striped","animated","thresholds","className","style","props","ref","t","useT","labelId","useId","indeterminate","safeMax","current","pct","bufferPct","resolvedColor","valueText","ariaValueText","a11y","rootStyle","jsxs","clsx","styles","jsx"],"mappings":"m2BA4CMA,EAAQ,CAACC,EAAWC,EAAYC,IAAe,KAAK,IAAIA,EAAI,KAAK,IAAID,EAAID,CAAC,CAAC,EAapEG,GAAWC,EAAAA,WAA0C,SAChE,CACE,MAAAC,EACA,IAAAC,EAAM,IACN,QAAAC,EAAU,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,UAAWC,EAAAA,KAAKC,EAAO,MAAOZ,GAAiBY,EAAO,aAAa,EAAI,GAAGJ,EAC5E,SAAA,CAAAJ,GAAa,MAAQ,CAACJ,GACrBa,EAAAA,IAAC,OAAI,UAAWD,EAAO,OAAQ,MAAO,CAAE,MAAO,GAAGR,CAAS,KAAO,EAEpES,EAAAA,IAAC,MAAA,CACC,UAAWF,EAAAA,KACTC,EAAO,MACNvB,GAAWC,IAAasB,EAAO,QAChCtB,GAAYsB,EAAO,QAAA,EAErB,MAAOZ,EAAgB,OAAY,CAAE,MAAO,GAAGG,CAAG,GAAA,CAAI,CAAA,CACxD,CAAA,CACF,CAAA,CAAA,CAAA,CAGN,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { clsx as N } from "clsx";
|
|
|
4
4
|
import { u as P, o as R } from "./useOptionalPeer-49f3XcO5.js";
|
|
5
5
|
import { S as T } from "./Skeleton-_-uGax2j.js";
|
|
6
6
|
import { T as V } from "./Typography-ChSuxgkc.js";
|
|
7
|
-
import { a as j } from "./ConfigProvider-
|
|
7
|
+
import { a as j } from "./ConfigProvider-Dqfu7UBU.js";
|
|
8
8
|
const z = "_root_15ibt_1", G = "_framed_15ibt_12", M = "_code_15ibt_30", k = "_caption_15ibt_35", t = {
|
|
9
9
|
root: z,
|
|
10
10
|
framed: G,
|
|
@@ -78,4 +78,4 @@ const z = "_root_15ibt_1", G = "_framed_15ibt_12", M = "_code_15ibt_30", k = "_c
|
|
|
78
78
|
export {
|
|
79
79
|
I as Q
|
|
80
80
|
};
|
|
81
|
-
//# sourceMappingURL=QrCode-
|
|
81
|
+
//# sourceMappingURL=QrCode-D7BTYcW2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrCode-
|
|
1
|
+
{"version":3,"file":"QrCode-D7BTYcW2.js","sources":["../src/components/QrCode/QrCode.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport type * as QrLibModule from 'qrcode.react'\nimport { optionalPeer, useOptionalPeer } from '../../hooks/useOptionalPeer'\nimport { Skeleton } from '../Skeleton'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport styles from './QrCode.module.css'\n\nexport type QrCodeLevel = 'L' | 'M' | 'Q' | 'H'\n\nexport interface QrCodeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** The encoded text (URL, `otpauth://…` URI, plain string). Required. */\n value: string\n /** Rendered edge length in px. Default `180`. */\n size?: number\n /** Error-correction level. Default `'M'` (`'H'` when `image` is set, so the logo can cover the middle). */\n level?: QrCodeLevel\n /** Module (foreground) tint — a theme token. Default `'text'` (so it follows light/dark). */\n color?: ThemeColor | 'text'\n /** Quiet zone in modules. Default `2`. */\n margin?: number\n /**\n * Optional centre image (a brand mark), as a URL or `{ src, width?, height?, excavate? }`.\n * `excavate` clears the modules under it (default `true`). Sizes default to ~22% of `size`.\n */\n image?: string | { src: string; width?: number; height?: number; excavate?: boolean }\n /** Caption rendered under the code (muted, centred) — e.g. \"Scan with your authenticator app\". */\n caption?: ReactNode\n /**\n * Wrap the code in a soft `surface` frame with padding and radius, so it sits cleanly on the\n * page `background`. Default `true`. Pass `false` for a bare SVG.\n */\n framed?: boolean\n /**\n * Accessible name. Defaults to the localized `qrCode.label` (\"QR code\"). The `value` is never exposed\n * as text by this component.\n */\n 'aria-label'?: string\n}\n\n/**\n * A QR code, rendered as a crisp **SVG** — wraps the optional peer **`qrcode.react`** (`npm i\n * qrcode.react`) so apps don't pull in their own encoder. The modules take a theme `color` token\n * (default `text`) via the `--tz-qr-fg` var; `framed` (default) wraps the code in a soft, elevated card.\n *\n * **Scannability:** a framed code always sits on a **white** card in both light and dark mode, and its\n * default modules stay **dark** in both — a QR must be dark-on-light to read reliably, so the frame is\n * kept white even in dark mode (a deliberate literal-color exception, like `CodeBlock`'s dark surface).\n * A custom `color` is honored as-is (pick one dark enough to scan). The wrapper is `role=\"img\"` with an\n * `aria-label`; the SVG itself is `aria-hidden`, so the encoded `value` is never read out as text.\n */\n/** @internal — exported for tests */\nexport const qrPeer = optionalPeer<typeof QrLibModule>(\n 'qrcode.react',\n 'QrCode',\n () => import('qrcode.react'),\n)\n\nexport const QrCode = forwardRef<HTMLDivElement, QrCodeProps>(function QrCode(\n {\n value,\n size = 180,\n level,\n color = 'text',\n margin = 2,\n image,\n caption,\n framed = true,\n className,\n style,\n 'aria-label': ariaLabelProp,\n ...props\n },\n ref,\n) {\n const t = useT()\n const ariaLabel = ariaLabelProp ?? t('qrCode.label')\n // `qrcode.react` is an optional peer, loaded lazily (never imported statically — apps without it must\n // still build + run from the barrel). Until it's ready a same-size skeleton holds the spot; if it isn't\n // installed the spot stays empty and an install hint is logged.\n const { module: qrLib, failed } = useOptionalPeer(qrPeer)\n const QRCodeSVG = qrLib?.QRCodeSVG\n\n // 'H' error correction by default when a centre image is present, so the logo can cover the middle\n // without breaking the code; otherwise 'M'. An explicit `level` always wins.\n const resolvedLevel: QrCodeLevel = level ?? (image ? 'H' : 'M')\n\n const imageSettings =\n image != null\n ? (() => {\n const img = typeof image === 'string' ? { src: image } : image\n const dim = Math.round(size * 0.22)\n return {\n src: img.src,\n width: img.width ?? dim,\n height: img.height ?? dim,\n excavate: img.excavate ?? true,\n }\n })()\n : undefined\n\n // The foreground (modules) follows the `color` token via `--tz-qr-fg`. The default `text` is left to\n // CSS (so `.framed` can force dark modules on the white card in dark mode); a custom token is pinned\n // inline, so it wins over that CSS fallback and is rendered exactly as asked.\n const fgVar = color === 'text' ? undefined : { '--tz-qr-fg': `var(--tz-color-${color})` }\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={ariaLabel}\n className={clsx(styles.root, framed && styles.framed, className)}\n style={{ ...fgVar, ...style } as CSSProperties}\n {...props}\n >\n {QRCodeSVG ? (\n <QRCodeSVG\n className={styles.code}\n value={value}\n size={size}\n level={resolvedLevel}\n marginSize={margin}\n // colors flow through CSS vars so `.framed` can guarantee contrast per theme (see the module)\n fgColor=\"var(--tz-qr-fg)\"\n bgColor=\"var(--tz-qr-bg)\"\n imageSettings={imageSettings}\n aria-hidden\n />\n ) : (\n <Skeleton\n variant=\"rect\"\n width={size}\n height={size}\n animation={failed ? false : 'shimmer'}\n className={styles.code}\n />\n )}\n {caption != null && (\n <Typography variant=\"caption\" color=\"muted\" className={styles.caption}>\n {caption}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["qrPeer","optionalPeer","QrCode","forwardRef","value","size","level","color","margin","image","caption","framed","className","style","ariaLabelProp","props","ref","t","useT","ariaLabel","qrLib","failed","useOptionalPeer","QRCodeSVG","resolvedLevel","imageSettings","img","dim","fgVar","jsxs","clsx","styles","jsx","Skeleton","Typography"],"mappings":";;;;;;;;;;;;GAqDaA,IAASC;AAAA,EACpB;AAAA,EACA;AAAA,EACA,MAAM,OAAO,cAAc;AAC7B,GAEaC,IAASC,EAAwC,SAC5D;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAcC;AAAA,EACd,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJC,IAAYL,KAAiBG,EAAE,cAAc,GAI7C,EAAE,QAAQG,GAAO,QAAAC,EAAA,IAAWC,EAAgBtB,CAAM,GAClDuB,IAAYH,KAAA,gBAAAA,EAAO,WAInBI,IAA6BlB,MAAUG,IAAQ,MAAM,MAErDgB,IACJhB,KAAS,QACJ,MAAM;AACL,UAAMiB,IAAM,OAAOjB,KAAU,WAAW,EAAE,KAAKA,MAAUA,GACnDkB,IAAM,KAAK,MAAMtB,IAAO,IAAI;AAClC,WAAO;AAAA,MACL,KAAKqB,EAAI;AAAA,MACT,OAAOA,EAAI,SAASC;AAAA,MACpB,QAAQD,EAAI,UAAUC;AAAA,MACtB,UAAUD,EAAI,YAAY;AAAA,IAAA;AAAA,EAE9B,OACA,QAKAE,IAAQrB,MAAU,SAAS,SAAY,EAAE,cAAc,kBAAkBA,CAAK,IAAA;AAEpF,SACE,gBAAAsB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAb;AAAA,MACA,MAAK;AAAA,MACL,cAAYG;AAAA,MACZ,WAAWW,EAAKC,EAAO,MAAMpB,KAAUoB,EAAO,QAAQnB,CAAS;AAAA,MAC/D,OAAO,EAAE,GAAGgB,GAAO,GAAGf,EAAA;AAAA,MACrB,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAQ,IACC,gBAAAS;AAAA,UAACT;AAAA,UAAA;AAAA,YACC,WAAWQ,EAAO;AAAA,YAClB,OAAA3B;AAAA,YACA,MAAAC;AAAA,YACA,OAAOmB;AAAA,YACP,YAAYhB;AAAA,YAEZ,SAAQ;AAAA,YACR,SAAQ;AAAA,YACR,eAAAiB;AAAA,YACA,eAAW;AAAA,UAAA;AAAA,QAAA,IAGb,gBAAAO;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,SAAQ;AAAA,YACR,OAAO5B;AAAA,YACP,QAAQA;AAAA,YACR,WAAWgB,IAAS,KAAQ;AAAA,YAC5B,WAAWU,EAAO;AAAA,UAAA;AAAA,QAAA;AAAA,QAGrBrB,KAAW,QACV,gBAAAsB,EAACE,GAAA,EAAW,SAAQ,WAAU,OAAM,SAAQ,WAAWH,EAAO,SAC3D,UAAArB,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var w=Object.create;var m=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var k=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!V.call(e,o)&&o!==r&&m(e,o,{get:()=>t[o],enumerable:!(a=N(t,o))||a.enumerable});return e};var z=(e,t,r)=>(r=e!=null?w(T(e)):{},k(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e));const i=require("react/jsx-runtime"),G=require("react"),M=require("clsx"),f=require("./useOptionalPeer-9Fkx5Leb.cjs"),O=require("./Skeleton-DK0lAjS9.cjs"),H=require("./Typography-d97DdbNd.cjs"),L=require("./ConfigProvider-
|
|
2
|
-
//# sourceMappingURL=QrCode-
|
|
1
|
+
"use strict";var w=Object.create;var m=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var k=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of R(t))!V.call(e,o)&&o!==r&&m(e,o,{get:()=>t[o],enumerable:!(a=N(t,o))||a.enumerable});return e};var z=(e,t,r)=>(r=e!=null?w(T(e)):{},k(t||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e));const i=require("react/jsx-runtime"),G=require("react"),M=require("clsx"),f=require("./useOptionalPeer-9Fkx5Leb.cjs"),O=require("./Skeleton-DK0lAjS9.cjs"),H=require("./Typography-d97DdbNd.cjs"),L=require("./ConfigProvider-Ci9Q2HLF.cjs"),$="_root_15ibt_1",A="_framed_15ibt_12",B="_code_15ibt_30",D="_caption_15ibt_35",s={root:$,framed:A,code:B,caption:D},E=f.optionalPeer("qrcode.react","QrCode",()=>import("qrcode.react")),F=G.forwardRef(function({value:t,size:r=180,level:a,color:o="text",margin:g=2,image:c,caption:d,framed:v=!0,className:p,style:q,"aria-label":_,...x},C){const b=L.useT(),y=_??b("qrCode.label"),{module:l,failed:Q}=f.useOptionalPeer(E),u=l==null?void 0:l.QRCodeSVG,S=a??(c?"H":"M"),j=c!=null?(()=>{const n=typeof c=="string"?{src:c}:c,h=Math.round(r*.22);return{src:n.src,width:n.width??h,height:n.height??h,excavate:n.excavate??!0}})():void 0,P=o==="text"?void 0:{"--tz-qr-fg":`var(--tz-color-${o})`};return i.jsxs("div",{ref:C,role:"img","aria-label":y,className:M.clsx(s.root,v&&s.framed,p),style:{...P,...q},...x,children:[u?i.jsx(u,{className:s.code,value:t,size:r,level:S,marginSize:g,fgColor:"var(--tz-qr-fg)",bgColor:"var(--tz-qr-bg)",imageSettings:j,"aria-hidden":!0}):i.jsx(O.Skeleton,{variant:"rect",width:r,height:r,animation:Q?!1:"shimmer",className:s.code}),d!=null&&i.jsx(H.Typography,{variant:"caption",color:"muted",className:s.caption,children:d})]})});exports.QrCode=F;
|
|
2
|
+
//# sourceMappingURL=QrCode-Dqsk49vX.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrCode-
|
|
1
|
+
{"version":3,"file":"QrCode-Dqsk49vX.cjs","sources":["../src/components/QrCode/QrCode.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport type * as QrLibModule from 'qrcode.react'\nimport { optionalPeer, useOptionalPeer } from '../../hooks/useOptionalPeer'\nimport { Skeleton } from '../Skeleton'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport styles from './QrCode.module.css'\n\nexport type QrCodeLevel = 'L' | 'M' | 'Q' | 'H'\n\nexport interface QrCodeProps extends Omit<HTMLAttributes<HTMLDivElement>, 'color'> {\n /** The encoded text (URL, `otpauth://…` URI, plain string). Required. */\n value: string\n /** Rendered edge length in px. Default `180`. */\n size?: number\n /** Error-correction level. Default `'M'` (`'H'` when `image` is set, so the logo can cover the middle). */\n level?: QrCodeLevel\n /** Module (foreground) tint — a theme token. Default `'text'` (so it follows light/dark). */\n color?: ThemeColor | 'text'\n /** Quiet zone in modules. Default `2`. */\n margin?: number\n /**\n * Optional centre image (a brand mark), as a URL or `{ src, width?, height?, excavate? }`.\n * `excavate` clears the modules under it (default `true`). Sizes default to ~22% of `size`.\n */\n image?: string | { src: string; width?: number; height?: number; excavate?: boolean }\n /** Caption rendered under the code (muted, centred) — e.g. \"Scan with your authenticator app\". */\n caption?: ReactNode\n /**\n * Wrap the code in a soft `surface` frame with padding and radius, so it sits cleanly on the\n * page `background`. Default `true`. Pass `false` for a bare SVG.\n */\n framed?: boolean\n /**\n * Accessible name. Defaults to the localized `qrCode.label` (\"QR code\"). The `value` is never exposed\n * as text by this component.\n */\n 'aria-label'?: string\n}\n\n/**\n * A QR code, rendered as a crisp **SVG** — wraps the optional peer **`qrcode.react`** (`npm i\n * qrcode.react`) so apps don't pull in their own encoder. The modules take a theme `color` token\n * (default `text`) via the `--tz-qr-fg` var; `framed` (default) wraps the code in a soft, elevated card.\n *\n * **Scannability:** a framed code always sits on a **white** card in both light and dark mode, and its\n * default modules stay **dark** in both — a QR must be dark-on-light to read reliably, so the frame is\n * kept white even in dark mode (a deliberate literal-color exception, like `CodeBlock`'s dark surface).\n * A custom `color` is honored as-is (pick one dark enough to scan). The wrapper is `role=\"img\"` with an\n * `aria-label`; the SVG itself is `aria-hidden`, so the encoded `value` is never read out as text.\n */\n/** @internal — exported for tests */\nexport const qrPeer = optionalPeer<typeof QrLibModule>(\n 'qrcode.react',\n 'QrCode',\n () => import('qrcode.react'),\n)\n\nexport const QrCode = forwardRef<HTMLDivElement, QrCodeProps>(function QrCode(\n {\n value,\n size = 180,\n level,\n color = 'text',\n margin = 2,\n image,\n caption,\n framed = true,\n className,\n style,\n 'aria-label': ariaLabelProp,\n ...props\n },\n ref,\n) {\n const t = useT()\n const ariaLabel = ariaLabelProp ?? t('qrCode.label')\n // `qrcode.react` is an optional peer, loaded lazily (never imported statically — apps without it must\n // still build + run from the barrel). Until it's ready a same-size skeleton holds the spot; if it isn't\n // installed the spot stays empty and an install hint is logged.\n const { module: qrLib, failed } = useOptionalPeer(qrPeer)\n const QRCodeSVG = qrLib?.QRCodeSVG\n\n // 'H' error correction by default when a centre image is present, so the logo can cover the middle\n // without breaking the code; otherwise 'M'. An explicit `level` always wins.\n const resolvedLevel: QrCodeLevel = level ?? (image ? 'H' : 'M')\n\n const imageSettings =\n image != null\n ? (() => {\n const img = typeof image === 'string' ? { src: image } : image\n const dim = Math.round(size * 0.22)\n return {\n src: img.src,\n width: img.width ?? dim,\n height: img.height ?? dim,\n excavate: img.excavate ?? true,\n }\n })()\n : undefined\n\n // The foreground (modules) follows the `color` token via `--tz-qr-fg`. The default `text` is left to\n // CSS (so `.framed` can force dark modules on the white card in dark mode); a custom token is pinned\n // inline, so it wins over that CSS fallback and is rendered exactly as asked.\n const fgVar = color === 'text' ? undefined : { '--tz-qr-fg': `var(--tz-color-${color})` }\n\n return (\n <div\n ref={ref}\n role=\"img\"\n aria-label={ariaLabel}\n className={clsx(styles.root, framed && styles.framed, className)}\n style={{ ...fgVar, ...style } as CSSProperties}\n {...props}\n >\n {QRCodeSVG ? (\n <QRCodeSVG\n className={styles.code}\n value={value}\n size={size}\n level={resolvedLevel}\n marginSize={margin}\n // colors flow through CSS vars so `.framed` can guarantee contrast per theme (see the module)\n fgColor=\"var(--tz-qr-fg)\"\n bgColor=\"var(--tz-qr-bg)\"\n imageSettings={imageSettings}\n aria-hidden\n />\n ) : (\n <Skeleton\n variant=\"rect\"\n width={size}\n height={size}\n animation={failed ? false : 'shimmer'}\n className={styles.code}\n />\n )}\n {caption != null && (\n <Typography variant=\"caption\" color=\"muted\" className={styles.caption}>\n {caption}\n </Typography>\n )}\n </div>\n )\n})\n"],"names":["qrPeer","optionalPeer","QrCode","forwardRef","value","size","level","color","margin","image","caption","framed","className","style","ariaLabelProp","props","ref","t","useT","ariaLabel","qrLib","failed","useOptionalPeer","QRCodeSVG","resolvedLevel","imageSettings","img","dim","fgVar","jsxs","clsx","styles","jsx","Skeleton","Typography"],"mappings":"0zBAqDaA,EAASC,EAAAA,aACpB,eACA,SACA,IAAM,OAAO,cAAc,CAC7B,EAEaC,EAASC,EAAAA,WAAwC,SAC5D,CACE,MA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BrB,GAAW,MACVsB,EAAAA,IAACE,EAAAA,WAAA,CAAW,QAAQ,UAAU,MAAM,QAAQ,UAAWH,EAAO,QAC3D,SAAArB,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as o, jsxs as l, Fragment as T } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as R, useState as _, useRef as E, useId as I } from "react";
|
|
3
3
|
import { B as O } from "./Blockquote-Ma-2naET.js";
|
|
4
|
-
import { B as v } from "./Button-
|
|
4
|
+
import { B as v } from "./Button-CtADzomU.js";
|
|
5
5
|
import { C as S } from "./Code-DaEpXHfF.js";
|
|
6
6
|
import { b as B } from "./Icon-D5TxgfCc.js";
|
|
7
|
-
import { M as j } from "./Modal-
|
|
8
|
-
import { T as F } from "./TextField-
|
|
7
|
+
import { M as j } from "./Modal-CYcVOzID.js";
|
|
8
|
+
import { T as F } from "./TextField-Dwx5GPxz.js";
|
|
9
9
|
import { T as L } from "./Typography-ChSuxgkc.js";
|
|
10
|
-
import { a as k } from "./ConfigProvider-
|
|
10
|
+
import { a as k } from "./ConfigProvider-Dqfu7UBU.js";
|
|
11
11
|
const M = "_modalBody_1nqut_5", K = "_body_1nqut_4", P = "_iconBox_1nqut_20", A = "_confirm_1nqut_37", G = "_phrase_1nqut_45", a = {
|
|
12
12
|
modalBody: M,
|
|
13
13
|
body: K,
|
|
@@ -106,4 +106,4 @@ function H({ text: u }) {
|
|
|
106
106
|
export {
|
|
107
107
|
eo as R
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=RemoveDialog-
|
|
109
|
+
//# sourceMappingURL=RemoveDialog-CQIm9GTH.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveDialog-
|
|
1
|
+
{"version":3,"file":"RemoveDialog-CQIm9GTH.js","sources":["../src/components/RemoveDialog/RemoveDialog.tsx"],"sourcesContent":["import { forwardRef, useId, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { useT } from '../../theme'\nimport { Blockquote } from '../Blockquote'\nimport { Button } from '../Button'\nimport { Code } from '../Code'\nimport { Icon } from '../Icon'\nimport { Modal } from '../Modal'\nimport { TextField } from '../TextField'\nimport { Typography } from '../Typography'\nimport styles from './RemoveDialog.module.css'\n\nexport interface RemoveDialogProps {\n /** Whether the dialog is open. */\n open: boolean\n /** Called on Cancel, the × button, backdrop, or Escape (ignored while a confirm is in flight). */\n onClose: () => void\n /**\n * The destructive action. May be async — while its promise is pending the Delete button shows a\n * loader and the dialog locks (no dismiss); on success the dialog **auto-closes**, on rejection it\n * stays open so the user can retry (surface the error yourself, e.g. a toast).\n */\n onConfirm: () => void | Promise<void>\n /** Header title. Defaults to `\"Remove\"`. */\n title?: ReactNode\n /** Body prompt shown under the icon. Defaults to `\"Are you sure you want to delete?\"`. */\n message?: ReactNode\n /** Confirm (destructive) button label. Defaults to `\"Delete\"`. */\n confirmLabel?: string\n /** Cancel button label. Defaults to `\"Cancel\"`. */\n cancelLabel?: string\n /** External loading override — combined with the internal async-confirm state. */\n loading?: boolean\n /**\n * **Type-to-confirm** for high-risk deletes: the user must type this exact text (e.g. `\"remove user\"`)\n * into a field before Delete enables. Case-sensitive; surrounding whitespace is ignored. The field is\n * focused on open, cleared on every open, and Enter confirms once it matches.\n */\n confirmText?: string\n}\n\n/**\n * A ready-made delete confirmation — a thin convenience wrapper over `Modal` for the ubiquitous\n * \"Are you sure you want to delete?\" prompt. Hardcodes the destructive flavor (a `Trash` glyph in a\n * soft error circle + an `error` Delete button); just wire `open` / `onClose` / `onConfirm`. An async\n * `onConfirm` drives the button loader and locks dismissal, then auto-closes on success. `confirmText`\n * adds **type-to-confirm**: Delete stays disabled until the user types that exact text. Built on\n * `Modal`, so it inherits the portal, scroll-lock, focus-trap, and backdrop/Escape dismissal.\n *\n * @example\n * const { isOpen, open, close } = useDisclosure()\n * <RemoveDialog open={isOpen} onClose={close} onConfirm={() => deleteItem(id)} />\n */\nexport const RemoveDialog = forwardRef<HTMLDivElement, RemoveDialogProps>(function RemoveDialog(\n {\n open,\n onClose,\n onConfirm,\n title,\n message,\n confirmLabel,\n cancelLabel,\n loading = false,\n confirmText,\n },\n ref,\n) {\n const t = useT()\n const [submitting, setSubmitting] = useState(false)\n const busy = loading || submitting\n\n // type-to-confirm — cleared every time the dialog opens (\"adjust state on prop change\", no effect)\n const [typed, setTyped] = useState('')\n const wasOpen = useRef(open)\n if (wasOpen.current !== open) {\n wasOpen.current = open\n if (open) setTyped('')\n }\n const matches = confirmText == null || typed.trim() === confirmText.trim()\n const promptId = useId()\n\n // dismissal is blocked while the confirm is running (so the delete can't be abandoned mid-flight)\n const handleClose = () => {\n if (!busy) onClose()\n }\n\n const handleConfirm = async () => {\n if (!matches || busy) return\n try {\n setSubmitting(true)\n await onConfirm()\n onClose() // auto-close on success\n } catch {\n // keep the dialog open on failure so the user can retry; the consumer surfaces the error\n } finally {\n setSubmitting(false)\n }\n }\n\n return (\n <Modal\n ref={ref}\n open={open}\n onClose={handleClose}\n size=\"sm\"\n bodyClassName={styles.modalBody}\n title={title ?? t('removeDialog.title')}\n showCloseButton={!busy}\n closeOnBackdrop={!busy}\n closeOnEscape={!busy}\n footer={\n <>\n <Button variant=\"text\" size=\"sm\" onClick={handleClose} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button\n color=\"error\"\n variant=\"filled\"\n size=\"sm\"\n onClick={handleConfirm}\n loading={busy}\n disabled={!matches}\n >\n {confirmLabel ?? t('common.delete')}\n </Button>\n </>\n }\n >\n <div className={styles.body}>\n <div className={styles.iconBox} aria-hidden>\n <Icon name=\"Trash\" />\n </div>\n <Typography align=\"center\">{message ?? t('removeDialog.message')}</Typography>\n {confirmText != null && (\n <div className={styles.confirm}>\n {/* the instruction, as an error-tinted quote — it also names the field (aria-labelledby) */}\n <Blockquote id={promptId} size=\"sm\" color=\"error\">\n <TypeToConfirmLabel text={confirmText} />\n </Blockquote>\n <TextField\n aria-labelledby={promptId}\n placeholder={confirmText}\n value={typed}\n onChange={(event) => setTyped(event.target.value)}\n onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n void handleConfirm()\n }\n }}\n // a green tick once the phrase matches — the field confirms itself before Delete does\n adornment={typed && matches ? <Icon name=\"TickCircle\" color=\"success\" /> : undefined}\n adornmentPosition=\"right\"\n disabled={busy}\n size=\"sm\"\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n />\n </div>\n )}\n </div>\n </Modal>\n )\n})\n\n/** \"Type {text} to confirm\" with the text set as inline `Code`, so the exact phrase stands out. */\nfunction TypeToConfirmLabel({ text }: { text: string }) {\n const t = useT()\n // translate with a sentinel in place of {text}, then split around it to slot the Code element in\n const SENTINEL = '\\u0000'\n const [before, after = ''] = t('removeDialog.typeToConfirm', { text: SENTINEL }).split(SENTINEL)\n return (\n <>\n {before}\n <Code size=\"sm\" color=\"error\" className={styles.phrase}>\n {text}\n </Code>\n {after}\n </>\n )\n}\n"],"names":["RemoveDialog","forwardRef","open","onClose","onConfirm","title","message","confirmLabel","cancelLabel","loading","confirmText","ref","t","useT","submitting","setSubmitting","useState","busy","typed","setTyped","wasOpen","useRef","matches","promptId","useId","handleClose","handleConfirm","jsx","Modal","styles","jsxs","Fragment","Button","Icon","Typography","Blockquote","TypeToConfirmLabel","TextField","event","text","SENTINEL","before","after","Code"],"mappings":";;;;;;;;;;;;;;;;GAoDaA,KAAeC,EAA8C,SACxE;AAAA,EACE,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,aAAAC;AACF,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJ,CAACC,GAAYC,CAAa,IAAIC,EAAS,EAAK,GAC5CC,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,EACG,UAAA;AAAA,IAAAU;AAAA,IACD,gBAAAd,EAACgB,KAAK,MAAK,MAAK,OAAM,SAAQ,WAAWd,EAAO,QAC7C,UAAAU,EAAA,CACH;AAAA,IACCG;AAAA,EAAA,GACH;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),r=require("react"),z=require("./Blockquote-BWGxIL_V.cjs"),C=require("./Button-
|
|
2
|
-
//# sourceMappingURL=RemoveDialog-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),r=require("react"),z=require("./Blockquote-BWGxIL_V.cjs"),C=require("./Button-Q_5uA-zc.cjs"),N=require("./Code-CUdpWlY5.cjs"),j=require("./Icon-B6lz-V0A.cjs"),I=require("./Modal-DwY3jGHE.cjs"),R=require("./TextField-B-xqoDZR.cjs"),w=require("./Typography-d97DdbNd.cjs"),v=require("./ConfigProvider-Ci9Q2HLF.cjs"),E="_modalBody_1nqut_5",F="_body_1nqut_4",S="_iconBox_1nqut_20",O="_confirm_1nqut_37",L="_phrase_1nqut_45",i={modalBody:E,body:F,iconBox:S,confirm:O,phrase:L},M=r.forwardRef(function({open:s,onClose:t,onConfirm:l,title:d,message:b,confirmLabel:B,cancelLabel:_,loading:T=!1,confirmText:n},k){const c=v.useT(),[D,h]=r.useState(!1),o=T||D,[u,y]=r.useState(""),x=r.useRef(s);x.current!==s&&(x.current=s,s&&y(""));const m=n==null||u.trim()===n.trim(),g=r.useId(),p=()=>{o||t()},q=async()=>{if(!(!m||o))try{h(!0),await l(),t()}catch{}finally{h(!1)}};return e.jsx(I.Modal,{ref:k,open:s,onClose:p,size:"sm",bodyClassName:i.modalBody,title:d??c("removeDialog.title"),showCloseButton:!o,closeOnBackdrop:!o,closeOnEscape:!o,footer:e.jsxs(e.Fragment,{children:[e.jsx(C.Button,{variant:"text",size:"sm",onClick:p,disabled:o,children:_??c("common.cancel")}),e.jsx(C.Button,{color:"error",variant:"filled",size:"sm",onClick:q,loading:o,disabled:!m,children:B??c("common.delete")})]}),children:e.jsxs("div",{className:i.body,children:[e.jsx("div",{className:i.iconBox,"aria-hidden":!0,children:e.jsx(j.Icon,{name:"Trash"})}),e.jsx(w.Typography,{align:"center",children:b??c("removeDialog.message")}),n!=null&&e.jsxs("div",{className:i.confirm,children:[e.jsx(z.Blockquote,{id:g,size:"sm",color:"error",children:e.jsx(P,{text:n})}),e.jsx(R.TextField,{"aria-labelledby":g,placeholder:n,value:u,onChange:a=>y(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),q())},adornment:u&&m?e.jsx(j.Icon,{name:"TickCircle",color:"success"}):void 0,adornmentPosition:"right",disabled:o,size:"sm",autoComplete:"off",autoCapitalize:"off",autoCorrect:"off",spellCheck:!1})]})]})})});function P({text:f}){const s=v.useT(),t="\0",[l,d=""]=s("removeDialog.typeToConfirm",{text:t}).split(t);return e.jsxs(e.Fragment,{children:[l,e.jsx(N.Code,{size:"sm",color:"error",className:i.phrase,children:f}),d]})}exports.RemoveDialog=M;
|
|
2
|
+
//# sourceMappingURL=RemoveDialog-DZ-EqIfS.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoveDialog-
|
|
1
|
+
{"version":3,"file":"RemoveDialog-DZ-EqIfS.cjs","sources":["../src/components/RemoveDialog/RemoveDialog.tsx"],"sourcesContent":["import { forwardRef, useId, useRef, useState, type KeyboardEvent, type ReactNode } from 'react'\nimport { useT } from '../../theme'\nimport { Blockquote } from '../Blockquote'\nimport { Button } from '../Button'\nimport { Code } from '../Code'\nimport { Icon } from '../Icon'\nimport { Modal } from '../Modal'\nimport { TextField } from '../TextField'\nimport { Typography } from '../Typography'\nimport styles from './RemoveDialog.module.css'\n\nexport interface RemoveDialogProps {\n /** Whether the dialog is open. */\n open: boolean\n /** Called on Cancel, the × button, backdrop, or Escape (ignored while a confirm is in flight). */\n onClose: () => void\n /**\n * The destructive action. May be async — while its promise is pending the Delete button shows a\n * loader and the dialog locks (no dismiss); on success the dialog **auto-closes**, on rejection it\n * stays open so the user can retry (surface the error yourself, e.g. a toast).\n */\n onConfirm: () => void | Promise<void>\n /** Header title. Defaults to `\"Remove\"`. */\n title?: ReactNode\n /** Body prompt shown under the icon. Defaults to `\"Are you sure you want to delete?\"`. */\n message?: ReactNode\n /** Confirm (destructive) button label. Defaults to `\"Delete\"`. */\n confirmLabel?: string\n /** Cancel button label. Defaults to `\"Cancel\"`. */\n cancelLabel?: string\n /** External loading override — combined with the internal async-confirm state. */\n loading?: boolean\n /**\n * **Type-to-confirm** for high-risk deletes: the user must type this exact text (e.g. `\"remove user\"`)\n * into a field before Delete enables. Case-sensitive; surrounding whitespace is ignored. The field is\n * focused on open, cleared on every open, and Enter confirms once it matches.\n */\n confirmText?: string\n}\n\n/**\n * A ready-made delete confirmation — a thin convenience wrapper over `Modal` for the ubiquitous\n * \"Are you sure you want to delete?\" prompt. Hardcodes the destructive flavor (a `Trash` glyph in a\n * soft error circle + an `error` Delete button); just wire `open` / `onClose` / `onConfirm`. An async\n * `onConfirm` drives the button loader and locks dismissal, then auto-closes on success. `confirmText`\n * adds **type-to-confirm**: Delete stays disabled until the user types that exact text. Built on\n * `Modal`, so it inherits the portal, scroll-lock, focus-trap, and backdrop/Escape dismissal.\n *\n * @example\n * const { isOpen, open, close } = useDisclosure()\n * <RemoveDialog open={isOpen} onClose={close} onConfirm={() => deleteItem(id)} />\n */\nexport const RemoveDialog = forwardRef<HTMLDivElement, RemoveDialogProps>(function RemoveDialog(\n {\n open,\n onClose,\n onConfirm,\n title,\n message,\n confirmLabel,\n cancelLabel,\n loading = false,\n confirmText,\n },\n ref,\n) {\n const t = useT()\n const [submitting, setSubmitting] = useState(false)\n const busy = loading || submitting\n\n // type-to-confirm — cleared every time the dialog opens (\"adjust state on prop change\", no effect)\n const [typed, setTyped] = useState('')\n const wasOpen = useRef(open)\n if (wasOpen.current !== open) {\n wasOpen.current = open\n if (open) setTyped('')\n }\n const matches = confirmText == null || typed.trim() === confirmText.trim()\n const promptId = useId()\n\n // dismissal is blocked while the confirm is running (so the delete can't be abandoned mid-flight)\n const handleClose = () => {\n if (!busy) onClose()\n }\n\n const handleConfirm = async () => {\n if (!matches || busy) return\n try {\n setSubmitting(true)\n await onConfirm()\n onClose() // auto-close on success\n } catch {\n // keep the dialog open on failure so the user can retry; the consumer surfaces the error\n } finally {\n setSubmitting(false)\n }\n }\n\n return (\n <Modal\n ref={ref}\n open={open}\n onClose={handleClose}\n size=\"sm\"\n bodyClassName={styles.modalBody}\n title={title ?? t('removeDialog.title')}\n showCloseButton={!busy}\n closeOnBackdrop={!busy}\n closeOnEscape={!busy}\n footer={\n <>\n <Button variant=\"text\" size=\"sm\" onClick={handleClose} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button\n color=\"error\"\n variant=\"filled\"\n size=\"sm\"\n onClick={handleConfirm}\n loading={busy}\n disabled={!matches}\n >\n {confirmLabel ?? t('common.delete')}\n </Button>\n </>\n }\n >\n <div className={styles.body}>\n <div className={styles.iconBox} aria-hidden>\n <Icon name=\"Trash\" />\n </div>\n <Typography align=\"center\">{message ?? t('removeDialog.message')}</Typography>\n {confirmText != null && (\n <div className={styles.confirm}>\n {/* the instruction, as an error-tinted quote — it also names the field (aria-labelledby) */}\n <Blockquote id={promptId} size=\"sm\" color=\"error\">\n <TypeToConfirmLabel text={confirmText} />\n </Blockquote>\n <TextField\n aria-labelledby={promptId}\n placeholder={confirmText}\n value={typed}\n onChange={(event) => setTyped(event.target.value)}\n onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n void handleConfirm()\n }\n }}\n // a green tick once the phrase matches — the field confirms itself before Delete does\n adornment={typed && matches ? <Icon name=\"TickCircle\" color=\"success\" /> : undefined}\n adornmentPosition=\"right\"\n disabled={busy}\n size=\"sm\"\n autoComplete=\"off\"\n autoCapitalize=\"off\"\n autoCorrect=\"off\"\n spellCheck={false}\n />\n </div>\n )}\n </div>\n </Modal>\n )\n})\n\n/** \"Type {text} to confirm\" with the text set as inline `Code`, so the exact phrase stands out. */\nfunction TypeToConfirmLabel({ text }: { text: string }) {\n const t = useT()\n // translate with a sentinel in place of {text}, then split around it to slot the Code element in\n const SENTINEL = '\\u0000'\n const [before, after = ''] = t('removeDialog.typeToConfirm', { text: SENTINEL }).split(SENTINEL)\n return (\n <>\n {before}\n <Code size=\"sm\" color=\"error\" className={styles.phrase}>\n {text}\n </Code>\n {after}\n </>\n )\n}\n"],"names":["RemoveDialog","forwardRef","open","onClose","onConfirm","title","message","confirmLabel","cancelLabel","loading","confirmText","ref","t","useT","submitting","setSubmitting","useState","busy","typed","setTyped","wasOpen","useRef","matches","promptId","useId","handleClose","handleConfirm","jsx","Modal","styles","jsxs","Fragment","Button","Icon","Typography","Blockquote","TypeToConfirmLabel","TextField","event","text","SENTINEL","before","after","Code"],"mappings":"ygBAoDaA,EAAeC,EAAAA,WAA8C,SACxE,CACE,KAAAC,EACA,QAAAC,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,EACA,aAAAC,EACA,YAAAC,EACA,QAAAC,EAAU,GACV,YAAAC,CACF,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJ,CAACC,EAAYC,CAAa,EAAIC,EAAAA,SAAS,EAAK,EAC5CC,EAAOR,GAAWK,EAGlB,CAACI,EAAOC,CAAQ,EAAIH,EAAAA,SAAS,EAAE,EAC/BI,EAAUC,EAAAA,OAAOnB,CAAI,EACvBkB,EAAQ,UAAYlB,IACtBkB,EAAQ,QAAUlB,EACdA,KAAe,EAAE,GAEvB,MAAMoB,EAAUZ,GAAe,MAAQQ,EAAM,KAAA,IAAWR,EAAY,KAAA,EAC9Da,EAAWC,EAAAA,MAAA,EAGXC,EAAc,IAAM,CACnBR,GAAMd,EAAA,CACb,EAEMuB,EAAgB,SAAY,CAChC,GAAI,GAACJ,GAAWL,GAChB,GAAI,CACFF,EAAc,EAAI,EAClB,MAAMX,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M,MAAQ,UAChBA,EAAM,eAAA,EACDZ,EAAA,EAET,EAEA,UAAWR,GAASI,EAAUK,EAAAA,IAACM,EAAAA,MAAK,KAAK,aAAa,MAAM,SAAA,CAAU,EAAK,OAC3E,kBAAkB,QAClB,SAAUhB,EACV,KAAK,KACL,aAAa,MACb,eAAe,MACf,YAAY,MACZ,WAAY,EAAA,CAAA,CACd,CAAA,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,CAGN,CAAC,EAGD,SAASmB,EAAmB,CAAE,KAAAG,GAA0B,CACtD,MAAM3B,EAAIC,EAAAA,KAAA,EAEJ2B,EAAW,KACX,CAACC,EAAQC,EAAQ,EAAE,EAAI9B,EAAE,6BAA8B,CAAE,KAAM4B,CAAA,CAAU,EAAE,MAAMA,CAAQ,EAC/F,OACEV,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAU,EACDd,EAAAA,IAACgB,EAAAA,MAAK,KAAK,KAAK,MAAM,QAAQ,UAAWd,EAAO,OAC7C,SAAAU,CAAA,CACH,EACCG,CAAA,EACH,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),u=require("react"),Be=require("clsx"),a=require("lexical"),Ue=require("@lexical/react/LexicalComposer"),Le=require("@lexical/react/LexicalComposerContext"),Fe=require("@lexical/react/LexicalRichTextPlugin"),Pe=require("@lexical/react/LexicalContentEditable"),He=require("@lexical/react/LexicalErrorBoundary"),Ve=require("@lexical/react/LexicalHistoryPlugin"),ze=require("@lexical/react/LexicalListPlugin"),Ge=require("@lexical/react/LexicalCheckListPlugin"),We=require("@lexical/react/LexicalLinkPlugin"),Ke=require("@lexical/react/LexicalMarkdownShortcutPlugin"),ce=require("@lexical/markdown"),w=require("@lexical/rich-text"),I=require("@lexical/list"),F=require("@lexical/link"),ve=require("@lexical/html"),Je=require("./formContext-bTWrqdEV.cjs"),ye=require("./Typography-d97DdbNd.cjs"),Qe=require("./toastStore-B4Tk2Xk7.cjs"),R=require("@lexical/selection"),D=require("@lexical/utils"),K=require("./Button-CwrDiZek.cjs"),Se=require("./ColorPickerPanel-kl2jUix-.cjs"),$=require("./Divider-CzbhdCiD.cjs"),ae=require("./Dropdown-CMjURWYd.cjs"),Xe=require("./FloatingPanel-tGCG2nhA.cjs"),g=require("./Icon-B6lz-V0A.cjs"),q=require("./IconButton-CxSXEYce.cjs"),J=require("./ListItem-DkCYXucd.cjs"),Ye=require("./Modal-D9_OG53G.cjs"),Ze=require("./TextField-C5MgCQIV.cjs"),de=require("./ConfigProvider-BaiTKZKC.cjs"),et=/^(?:https?:|mailto:|tel:|ftp:|#|\/|\?|\.)/i,tt=/^[a-z][a-z0-9+.-]*:/i;function me(o){const e=o.trim();return e===""?"":et.test(e)||!tt.test(e)?e:"#"}function be(o){const e=o.trim();if(/^data:(?:image|video)\//i.test(e)||/^blob:/i.test(e))return e;const i=me(e);return i==="#"?"":i}function rt(o){return o instanceof HTMLImageElement&&o.src?{node:Q(o.getAttribute("src")??o.src,o.alt)}:null}class X extends a.DecoratorNode{static getType(){return"tz-image"}static clone(e){return new X(e.__src,e.__alt,e.__key)}constructor(e,i="",n){super(n),this.__src=be(e),this.__alt=i}static importJSON(e){return Q(e.src,e.alt)}exportJSON(){return{...super.exportJSON(),type:"tz-image",version:1,src:this.__src,alt:this.__alt}}static importDOM(){return{img:()=>({conversion:rt,priority:0})}}exportDOM(){const e=document.createElement("img");return e.setAttribute("src",this.__src),e.setAttribute("alt",this.__alt),{element:e}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__alt}decorate(){return r.jsx("img",{src:this.__src,alt:this.__alt,draggable:!1})}}function Q(o,e=""){return a.$applyNodeReplacement(new X(o,e))}function Ne(o){return/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i.test(o)}function nt(o){const e=o.match(/(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{11})/);if(e)return`https://www.youtube.com/embed/${e[1]}`;const i=o.match(/vimeo\.com\/(?:video\/)?(\d+)/);return i?`https://player.vimeo.com/video/${i[1]}`:o}function Te(o){var i;const e=o.getAttribute("src")||((i=o.querySelector("source"))==null?void 0:i.getAttribute("src"));return e?{node:pe(e)}:null}class Y extends a.DecoratorNode{static getType(){return"tz-video"}static clone(e){return new Y(e.__src,e.__key)}constructor(e,i){super(i),this.__src=be(e)}static importJSON(e){return pe(e.src)}exportJSON(){return{...super.exportJSON(),type:"tz-video",version:1,src:this.__src}}static importDOM(){return{iframe:()=>({conversion:Te,priority:0}),video:()=>({conversion:Te,priority:0})}}exportDOM(){if(Ne(this.__src)){const i=document.createElement("video");return i.setAttribute("src",this.__src),i.setAttribute("controls","true"),{element:i}}const e=document.createElement("iframe");return e.setAttribute("src",this.__src),e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),{element:e}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}getSrc(){return this.__src}decorate(){return Ne(this.__src)?r.jsx("video",{src:this.__src,controls:!0}):r.jsx(ot,{src:this.__src})}}function ot({src:o}){const e=de.useT();return r.jsx("div",{className:"tz-rte-embed",children:r.jsx("iframe",{src:o,title:e("rte.embeddedVideo"),frameBorder:0,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}function pe(o){return a.$applyNodeReplacement(new Y(nt(o)))}const it="_editor_16j1l_1",lt="_label_16j1l_9",st="_required_16j1l_15",ct="_helper_16j1l_18",at="_control_16j1l_24",ut="_error_16j1l_38",dt="_disabled_16j1l_45",mt="_toolbar_16j1l_51",pt="_sm_16j1l_67",ht="_md_16j1l_71",_t="_lg_16j1l_75",ft="_colorGlyph_16j1l_81",xt="_colorBar_16j1l_89",gt="_shell_16j1l_107",jt="_content_16j1l_110",yt="_placeholder_16j1l_123",St="_paragraph_16j1l_146",Nt="_h1_16j1l_152",Tt="_h2_16j1l_153",Ct="_h3_16j1l_154",Et="_h4_16j1l_155",Lt="_h5_16j1l_156",vt="_h6_16j1l_157",bt="_quote_16j1l_176",kt="_ul_16j1l_183",Mt="_ol_16j1l_188",Rt="_li_16j1l_193",It="_nestedLi_16j1l_196",Ot="_liChecked_16j1l_200",At="_liUnchecked_16j1l_201",Dt="_link_16j1l_238",$t="_bold_16j1l_245",qt="_italic_16j1l_248",wt="_underline_16j1l_251",Bt="_strike_16j1l_254",Ut="_codeInline_16j1l_260",s={editor:it,label:lt,required:st,helper:ct,control:at,error:ut,disabled:dt,toolbar:mt,sm:pt,md:ht,lg:_t,colorGlyph:ft,colorBar:xt,shell:gt,content:jt,placeholder:yt,paragraph:St,h1:Nt,h2:Tt,h3:Ct,h4:Et,h5:Lt,h6:vt,quote:bt,ul:kt,ol:Mt,li:Rt,nestedLi:It,liChecked:Ot,liUnchecked:At,link:Dt,bold:$t,italic:qt,underline:wt,strike:Bt,codeInline:Ut},Ft={paragraph:"Paragraph",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",quote:"Quote",bullet:"Bullet List",number:"Numbered List",check:"Check List"},Pt=[{type:"paragraph",icon:"Text"},{type:"h1",icon:"Hashtag"},{type:"h2",icon:"Hashtag"},{type:"h3",icon:"Hashtag"}],Ht=[{value:"left",labelKey:"rte.alignLeft",icon:"TextalignLeft"},{value:"center",labelKey:"rte.alignCenter",icon:"TextalignCenter"},{value:"right",labelKey:"rte.alignRight",icon:"TextalignRight"}],Vt=["10px","12px","13px","14px","16px","18px","20px"],zt={sm:"12px",md:"13px",lg:"16px"};function Gt({color:o,size:e}){return r.jsxs("span",{className:s.colorGlyph,children:[r.jsx(g.Icon,{name:"Brush",size:e}),r.jsx("span",{className:s.colorBar,style:{borderColor:`transparent transparent ${o||"currentColor"} transparent`},"aria-hidden":"true"})]})}function Wt({size:o,disabled:e,onImageUpload:i}){const n=de.useT(),p=t=>Ft[t]??t,[l]=Le.useLexicalComposerContext(),m=u.useRef(null),[j,d]=u.useState(!1),[_,T]=u.useState(!1),[f,x]=u.useState(!1),[y,C]=u.useState(!1),[Z,ee]=u.useState(""),[L,O]=u.useState("paragraph"),[P,te]=u.useState("left"),[E,S]=u.useState(""),[A,B]=u.useState(""),[H,V]=u.useState(!1),U=u.useRef(null),[re,z]=u.useState(!1),[ne,N]=u.useState(!1),[h,oe]=u.useState(null),[he,_e]=u.useState(""),ie=u.useCallback(()=>{const t=a.$getSelection();if(!a.$isRangeSelection(t))return;d(t.hasFormat("bold")),T(t.hasFormat("italic")),x(t.hasFormat("underline")),B(R.$getSelectionStyleValueForProperty(t,"color","")),S(R.$getSelectionStyleValueForProperty(t,"font-size",""));const c=t.anchor.getNode(),k=c.getParent(),b=F.$isLinkNode(c)?c:F.$isLinkNode(k)?k:null;C(b!==null),ee((b==null?void 0:b.getURL())??"");const M=c.getKey()==="root"?c:D.$findMatchingParent(c,we=>{const je=we.getParent();return je===null||je.getKey()==="root"})??c.getTopLevelElement();te(a.$isElementNode(M)&&M.getFormatType()||"left");const W=D.$getNearestNodeOfType(c,I.ListNode);W?O(W.getListType()):w.$isHeadingNode(M)?O(M.getTag()):w.$isQuoteNode(M)?O("quote"):O("paragraph")},[]);u.useEffect(()=>D.mergeRegister(l.registerUpdateListener(({editorState:t})=>t.read(ie)),l.registerCommand(a.SELECTION_CHANGE_COMMAND,()=>(ie(),!1),a.COMMAND_PRIORITY_LOW),l.registerCommand(a.CAN_UNDO_COMMAND,t=>(z(t),!1),a.COMMAND_PRIORITY_LOW),l.registerCommand(a.CAN_REDO_COMMAND,t=>(N(t),!1),a.COMMAND_PRIORITY_LOW)),[l,ie]);const le=t=>l.dispatchCommand(a.FORMAT_TEXT_COMMAND,t),ke=t=>l.dispatchCommand(a.FORMAT_ELEMENT_COMMAND,t),Me=t=>{B(t),l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&R.$patchStyleText(c,{color:t||null})})},Re=t=>{S(t),l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&R.$patchStyleText(c,{"font-size":t||null})})},G=t=>{if(t==="bullet"||t==="number"||t==="check"){if(L===t)l.dispatchCommand(I.REMOVE_LIST_COMMAND,void 0);else{const c=t==="bullet"?I.INSERT_UNORDERED_LIST_COMMAND:t==="number"?I.INSERT_ORDERED_LIST_COMMAND:I.INSERT_CHECK_LIST_COMMAND;l.dispatchCommand(c,void 0)}return}l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&(t==="paragraph"?R.$setBlocksType(c,()=>a.$createParagraphNode()):t==="quote"?R.$setBlocksType(c,()=>w.$createQuoteNode()):R.$setBlocksType(c,()=>w.$createHeadingNode(t)))})},Ie=()=>G(L==="quote"?"paragraph":"quote"),se=(t,c="")=>{_e(c),oe(t)},fe=()=>oe(null),Oe=()=>{h==null||h.onConfirm(he.trim()),oe(null)},Ae=()=>se({icon:"Link2",title:n("rte.linkTitle"),label:n("rte.linkUrl"),placeholder:"https://example.com",confirmLabel:n(y?"common.update":"common.insert"),onConfirm:t=>l.dispatchCommand(F.TOGGLE_LINK_COMMAND,t===""?null:me(t))},Z),De=()=>se({icon:"GalleryAdd",title:n("rte.imageTitle"),label:n("rte.imageUrl"),placeholder:"https://example.com/image.jpg",confirmLabel:n("common.insert"),onConfirm:t=>{t&&l.update(()=>D.$insertNodeToNearestRoot(Q(t)))}}),$e=async t=>{var k;const c=(k=t.target.files)==null?void 0:k[0];if(t.target.value="",!!c)try{const b=i?await i(c):await Kt(c);l.update(()=>D.$insertNodeToNearestRoot(Q(b,c.name)))}catch{Qe.toast.error(n("rte.imageError"))}},qe=()=>se({icon:"VideoSquare",title:n("rte.videoTitle"),label:n("rte.videoUrl"),placeholder:n("rte.videoUrlPlaceholder"),confirmLabel:n("common.insert"),onConfirm:t=>{t&&l.update(()=>D.$insertNodeToNearestRoot(pe(t)))}}),v=(t,c,k,b,M)=>r.jsx(q.IconButton,{variant:t?"filled":"text",color:"primary",size:o,disabled:e,"aria-label":c,"aria-pressed":t,onMouseDown:W=>W.preventDefault(),onClick:k,children:b},M),xe=L.startsWith("h")?L:"paragraph",ge=E||zt[o];return r.jsxs("div",{className:s.toolbar,role:"toolbar","aria-label":n("rte.formatting"),"aria-orientation":"horizontal",children:[r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e||!re,"aria-label":n("rte.undo"),onMouseDown:t=>t.preventDefault(),onClick:()=>l.dispatchCommand(a.UNDO_COMMAND,void 0),children:r.jsx(g.Icon,{name:"UndoArrow"})}),r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e||!ne,"aria-label":n("rte.redo"),onMouseDown:t=>t.preventDefault(),onClick:()=>l.dispatchCommand(a.REDO_COMMAND,void 0),children:r.jsx(g.Icon,{name:"RedoArrow"})}),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(ae.Dropdown,{size:o,disabled:e,minWidth:!1,trigger:r.jsx(K.Button,{variant:"text",color:"primary",size:o,disabled:e,endIcon:r.jsx(g.Icon,{name:"ArrowDown4"}),"aria-label":n("rte.fontSize"),onMouseDown:t=>t.preventDefault(),children:ge}),children:Vt.map(t=>r.jsx(J.ListItem,{clickable:!0,selected:t===ge,onClick:()=>Re(t),children:t},t))}),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(ae.Dropdown,{size:o,disabled:e,trigger:r.jsx(K.Button,{variant:"text",color:"primary",size:o,disabled:e,endIcon:r.jsx(g.Icon,{name:"ArrowDown4"}),onMouseDown:t=>t.preventDefault(),children:p(xe)}),children:Pt.map(t=>r.jsx(J.ListItem,{clickable:!0,selected:xe===t.type,icon:t.icon,onClick:()=>G(t.type),children:p(t.type)},t.type))}),r.jsx($.Divider,{orientation:"vertical"}),v(j,n("rte.bold"),()=>le("bold"),r.jsx(g.Icon,{name:"TextBold"})),v(_,n("rte.italic"),()=>le("italic"),r.jsx(g.Icon,{name:"TextItalic"})),v(f,n("rte.underline"),()=>le("underline"),r.jsx(g.Icon,{name:"TextUnderline"})),r.jsx($.Divider,{orientation:"vertical"}),v(L==="bullet",n("rte.bulletList"),()=>G("bullet"),r.jsx(g.Icon,{name:"ListBullet"})),v(L==="number",n("rte.numberedList"),()=>G("number"),r.jsx(g.Icon,{name:"ListNumber"})),v(L==="quote",n("rte.quote"),Ie,r.jsx(g.Icon,{name:"QuoteUp"})),r.jsx($.Divider,{orientation:"vertical"}),Ht.map(t=>v(P===t.value,n(t.labelKey),()=>ke(t.value),r.jsx(g.Icon,{name:t.icon}),t.value)),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(q.IconButton,{ref:U,variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.textColor"),"aria-expanded":H,onMouseDown:t=>t.preventDefault(),onClick:()=>V(t=>!t),children:r.jsx(Gt,{color:A})}),r.jsx(Xe.FloatingPanel,{open:H,triggerRef:U,onClose:t=>{var c;V(!1),t&&((c=U.current)==null||c.focus())},role:"dialog",ariaLabel:n("rte.textColor"),width:232,children:r.jsx(Se.ColorPickerPanel,{value:A||Se.DEFAULT_SWATCHES[0],onChange:Me,clearable:!1})}),v(y,n("rte.link"),Ae,r.jsx(g.Icon,{name:"Link2"})),r.jsxs(ae.Dropdown,{size:o,disabled:e,minWidth:!1,trigger:r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.insertImage"),children:r.jsx(g.Icon,{name:"GalleryAdd"})}),children:[r.jsx(J.ListItem,{clickable:!0,icon:"GalleryImport",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},children:n("rte.uploadImage")}),r.jsx(J.ListItem,{clickable:!0,icon:"Link",onClick:De,children:n("rte.imageByUrl")})]}),r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.insertVideo"),onClick:qe,children:r.jsx(g.Icon,{name:"VideoSquare"})}),r.jsx("input",{ref:m,type:"file",accept:"image/*",hidden:!0,onChange:$e,"aria-hidden":"true",tabIndex:-1}),r.jsx(Ye.Modal,{open:h!==null,onClose:fe,size:"sm",icon:h==null?void 0:h.icon,title:h==null?void 0:h.title,footer:r.jsxs(r.Fragment,{children:[r.jsx(K.Button,{variant:"text",size:"sm",onClick:fe,children:n("common.cancel")}),r.jsx(K.Button,{type:"submit",size:"sm",form:"rte-url-form",children:(h==null?void 0:h.confirmLabel)??n("common.insert")})]}),children:r.jsx("form",{id:"rte-url-form",onSubmit:t=>{t.preventDefault(),Oe()},children:r.jsx(Ze.TextField,{label:h==null?void 0:h.label,placeholder:h==null?void 0:h.placeholder,value:he,onChange:t=>_e(t.target.value)})})})]})}function Kt(o){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>i(n.error),n.readAsDataURL(o)})}const Jt={paragraph:s.paragraph,heading:{h1:s.h1,h2:s.h2,h3:s.h3,h4:s.h4,h5:s.h5,h6:s.h6},quote:s.quote,list:{ul:s.ul,ol:s.ol,listitem:s.li,listitemChecked:s.liChecked,listitemUnchecked:s.liUnchecked,nested:{listitem:s.nestedLi}},link:s.link,text:{bold:s.bold,italic:s.italic,underline:s.underline,strikethrough:s.strike,code:s.codeInline}},Qt=[w.HeadingNode,w.QuoteNode,I.ListNode,I.ListItemNode,F.LinkNode,X,Y],Xt=[...ce.ELEMENT_TRANSFORMERS,...ce.TEXT_FORMAT_TRANSFORMERS,...ce.TEXT_MATCH_TRANSFORMERS],Yt=["color","font-size"],Zt={span:o=>{var i,n;const e=(n=(i=a.TextNode.importDOM())==null?void 0:i.span)==null?void 0:n.call(i,o);return{priority:1,conversion:p=>{const l=(e==null?void 0:e.conversion(p))??{node:null},m=Yt.flatMap(d=>{const _=p.style.getPropertyValue(d);return _?[[d,_]]:[]});if(m.length===0)return l;const j=l.forChild;return{...l,forChild:(d,_)=>{const T=j?j(d,_):d;if(a.$isTextNode(T)){const f={...a.getStyleObjectFromCSS(T.getStyle())};for(const[x,y]of m)f[x]=y;T.setStyle(Object.entries(f).map(([x,y])=>`${x}: ${y};`).join(" "))}return T}}}}}},er=new Set(["A","B","CODE","EM","I","MARK","S","SPAN","STRONG","SUB","SUP","U"]);function tr(o){const e=o.split(";").map(i=>i.trim()).filter(i=>i&&!/^white-space\s*:\s*pre-wrap$/i.test(i));return e.length?`${e.join("; ")};`:null}function rr(o){const e=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);let i=!0,n=!1,p=null;const l=()=>{p&&p.data.endsWith(" ")&&(p.data=`${p.data.slice(0,-1)} `),p=null,i=!0,n=!1};for(let m=e.nextNode();m;m=e.nextNode()){if(m.nodeType===Node.ELEMENT_NODE){er.has(m.tagName)||l();continue}const j=m;if(!j.data)continue;let d="";for(const _ of j.data)_===" "&&(i||n)?(d+=" ",n=!1):(d+=_,n=_===" "),i=!1;j.data=d,p=j}l()}function nr(o){if(typeof document>"u")return o;const e=document.createElement("template");e.innerHTML=o;const i=e.content;return i.querySelectorAll("[class]").forEach(n=>n.removeAttribute("class")),i.querySelectorAll("[style]").forEach(n=>{var l;if((l=n.textContent)!=null&&l.includes(" "))return;const p=tr(n.getAttribute("style")??"");p?n.setAttribute("style",p):n.removeAttribute("style")}),i.querySelectorAll("span").forEach(n=>{n.attributes.length===0&&n.replaceWith(...n.childNodes)}),i.normalize(),rr(i),e.innerHTML}function or(){const o=a.$getRoot(),e=o.getFirstChild();return o.getChildrenSize()<=1&&(e===null||a.$isParagraphNode(e)&&e.getChildrenSize()===0)}function Ce(o,e){const i=a.$getRoot();if(i.clear(),e){const n=new DOMParser().parseFromString(e,"text/html"),p=ve.$generateNodesFromDOM(o,n);i.select(),a.$insertNodes(p)}i.getChildrenSize()===0&&i.append(a.$createParagraphNode()),a.$setSelection(null)}const ue="tz-external-value";function Ee(o){return or()?"":nr(ve.$generateHtmlFromNodes(o,null))}function ir({value:o,defaultValue:e,onChange:i,onReady:n,disabled:p}){const[l]=Le.useLexicalComposerContext(),m=u.useRef(void 0),j=u.useRef(i);j.current=i;const d=u.useRef(n);d.current=n;const _=u.useRef(!1),T=f=>{var x;_.current||(_.current=!0,(x=d.current)==null||x.call(d,f))};return u.useEffect(()=>l.setEditable(!p),[l,p]),u.useEffect(()=>l.registerNodeTransform(F.LinkNode,f=>{const x=f.getURL(),y=me(x);y!==x&&f.setURL(y)}),[l]),u.useEffect(()=>{if(o===void 0){if(!e){m.current="",T("");return}m.current=e,l.update(()=>Ce(l,e),{tag:["history-merge",ue]})}},[]),u.useEffect(()=>{o===void 0||o===m.current||(m.current=o,l.update(()=>Ce(l,o),{tag:["history-merge",ue]}))},[l,o]),u.useEffect(()=>l.registerUpdateListener(({dirtyElements:f,dirtyLeaves:x,tags:y})=>{if(y.has(ue)){l.read(()=>{const C=Ee(l);m.current=C,T(C)});return}f.size===0&&x.size===0||l.read(()=>{const C=Ee(l);C!==m.current&&(m.current=C,j.current(C))})}),[l]),null}const lr=u.forwardRef(function({label:e,size:i="md",error:n,helperText:p,required:l=!1,disabled:m=!1,placeholder:j,name:d,value:_,defaultValue:T,onChange:f,onReady:x,onImageUpload:y,minHeight:C=220,"aria-label":Z,className:ee,style:L},O){const P=de.useT(),te=Z??P("rte.label"),E=Je.useFormContext(),S=E&&d?E.field(d):void 0,A=n??(S==null?void 0:S.error)??!1,B=p??(S==null?void 0:S.helperText),H=E&&d?E.values[d]:void 0,V=_!==void 0?_:E&&d?String(H??""):void 0,U=u.useCallback(N=>{E&&d&&E.setValue(d,N),f==null||f(N)},[E,d,f]),re=N=>S==null?void 0:S.onBlur(N),z=u.useRef(null);u.useEffect(()=>{const N=z.current;N&&(d?N.setAttribute("name",d):N.removeAttribute("name"))},[d]);const ne={namespace:"tz-rich-text-editor",theme:Jt,nodes:Qt,html:{import:Zt},editable:!m,onError:N=>{throw N}};return r.jsxs("div",{ref:O,className:Be.clsx(s.editor,s[i],A&&s.error,m&&s.disabled,ee),style:{"--tz-rte-min-height":`${C}px`,...L},children:[e!=null&&r.jsxs("div",{className:s.label,children:[r.jsx(ye.Typography,{as:"span",variant:"bodySmall",color:"muted",children:e}),l&&r.jsx("span",{className:s.required,"aria-hidden":"true",children:"*"})]}),r.jsx("div",{className:s.control,children:r.jsxs(Ue.LexicalComposer,{initialConfig:ne,children:[r.jsx(Wt,{size:i,disabled:m,onImageUpload:y}),r.jsx("div",{className:s.shell,children:r.jsx(Fe.RichTextPlugin,{contentEditable:r.jsx(Pe.ContentEditable,{ref:z,className:s.content,"aria-label":te,"aria-invalid":A||void 0,onBlur:re}),placeholder:r.jsx("div",{className:s.placeholder,children:j??P("rte.placeholder")}),ErrorBoundary:He.LexicalErrorBoundary})}),r.jsx(Ve.HistoryPlugin,{}),r.jsx(ze.ListPlugin,{}),r.jsx(Ge.CheckListPlugin,{}),r.jsx(We.LinkPlugin,{}),r.jsx(Ke.MarkdownShortcutPlugin,{transformers:Xt}),r.jsx(ir,{value:V,defaultValue:T,onChange:U,onReady:x,disabled:m})]})}),B!=null&&r.jsx(ye.Typography,{as:"span",variant:"bodySmall",color:A?"error":"muted",className:s.helper,children:B})]})});exports.RichTextEditor=lr;
|
|
2
|
-
//# sourceMappingURL=RichTextEditor-
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),u=require("react"),Be=require("clsx"),a=require("lexical"),Ue=require("@lexical/react/LexicalComposer"),Le=require("@lexical/react/LexicalComposerContext"),Fe=require("@lexical/react/LexicalRichTextPlugin"),Pe=require("@lexical/react/LexicalContentEditable"),He=require("@lexical/react/LexicalErrorBoundary"),Ve=require("@lexical/react/LexicalHistoryPlugin"),ze=require("@lexical/react/LexicalListPlugin"),Ge=require("@lexical/react/LexicalCheckListPlugin"),We=require("@lexical/react/LexicalLinkPlugin"),Ke=require("@lexical/react/LexicalMarkdownShortcutPlugin"),ce=require("@lexical/markdown"),w=require("@lexical/rich-text"),I=require("@lexical/list"),F=require("@lexical/link"),ve=require("@lexical/html"),Je=require("./formContext-bTWrqdEV.cjs"),ye=require("./Typography-d97DdbNd.cjs"),Qe=require("./toastStore-B4Tk2Xk7.cjs"),R=require("@lexical/selection"),D=require("@lexical/utils"),K=require("./Button-Q_5uA-zc.cjs"),Se=require("./ColorPickerPanel-BeAu83S6.cjs"),$=require("./Divider-CzbhdCiD.cjs"),ae=require("./Dropdown-CMjURWYd.cjs"),Xe=require("./FloatingPanel-tGCG2nhA.cjs"),g=require("./Icon-B6lz-V0A.cjs"),q=require("./IconButton-CiDPeKM4.cjs"),J=require("./ListItem-DkCYXucd.cjs"),Ye=require("./Modal-DwY3jGHE.cjs"),Ze=require("./TextField-B-xqoDZR.cjs"),de=require("./ConfigProvider-Ci9Q2HLF.cjs"),et=/^(?:https?:|mailto:|tel:|ftp:|#|\/|\?|\.)/i,tt=/^[a-z][a-z0-9+.-]*:/i;function me(o){const e=o.trim();return e===""?"":et.test(e)||!tt.test(e)?e:"#"}function be(o){const e=o.trim();if(/^data:(?:image|video)\//i.test(e)||/^blob:/i.test(e))return e;const i=me(e);return i==="#"?"":i}function rt(o){return o instanceof HTMLImageElement&&o.src?{node:Q(o.getAttribute("src")??o.src,o.alt)}:null}class X extends a.DecoratorNode{static getType(){return"tz-image"}static clone(e){return new X(e.__src,e.__alt,e.__key)}constructor(e,i="",n){super(n),this.__src=be(e),this.__alt=i}static importJSON(e){return Q(e.src,e.alt)}exportJSON(){return{...super.exportJSON(),type:"tz-image",version:1,src:this.__src,alt:this.__alt}}static importDOM(){return{img:()=>({conversion:rt,priority:0})}}exportDOM(){const e=document.createElement("img");return e.setAttribute("src",this.__src),e.setAttribute("alt",this.__alt),{element:e}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}getSrc(){return this.__src}getAltText(){return this.__alt}decorate(){return r.jsx("img",{src:this.__src,alt:this.__alt,draggable:!1})}}function Q(o,e=""){return a.$applyNodeReplacement(new X(o,e))}function Ne(o){return/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i.test(o)}function nt(o){const e=o.match(/(?:youtube\.com\/(?:watch\?(?:.*&)?v=|embed\/|shorts\/)|youtu\.be\/)([\w-]{11})/);if(e)return`https://www.youtube.com/embed/${e[1]}`;const i=o.match(/vimeo\.com\/(?:video\/)?(\d+)/);return i?`https://player.vimeo.com/video/${i[1]}`:o}function Te(o){var i;const e=o.getAttribute("src")||((i=o.querySelector("source"))==null?void 0:i.getAttribute("src"));return e?{node:pe(e)}:null}class Y extends a.DecoratorNode{static getType(){return"tz-video"}static clone(e){return new Y(e.__src,e.__key)}constructor(e,i){super(i),this.__src=be(e)}static importJSON(e){return pe(e.src)}exportJSON(){return{...super.exportJSON(),type:"tz-video",version:1,src:this.__src}}static importDOM(){return{iframe:()=>({conversion:Te,priority:0}),video:()=>({conversion:Te,priority:0})}}exportDOM(){if(Ne(this.__src)){const i=document.createElement("video");return i.setAttribute("src",this.__src),i.setAttribute("controls","true"),{element:i}}const e=document.createElement("iframe");return e.setAttribute("src",this.__src),e.setAttribute("frameborder","0"),e.setAttribute("allowfullscreen","true"),e.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),{element:e}}createDOM(){const e=document.createElement("div");return e.style.display="contents",e}updateDOM(){return!1}getSrc(){return this.__src}decorate(){return Ne(this.__src)?r.jsx("video",{src:this.__src,controls:!0}):r.jsx(ot,{src:this.__src})}}function ot({src:o}){const e=de.useT();return r.jsx("div",{className:"tz-rte-embed",children:r.jsx("iframe",{src:o,title:e("rte.embeddedVideo"),frameBorder:0,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}function pe(o){return a.$applyNodeReplacement(new Y(nt(o)))}const it="_editor_16j1l_1",lt="_label_16j1l_9",st="_required_16j1l_15",ct="_helper_16j1l_18",at="_control_16j1l_24",ut="_error_16j1l_38",dt="_disabled_16j1l_45",mt="_toolbar_16j1l_51",pt="_sm_16j1l_67",ht="_md_16j1l_71",_t="_lg_16j1l_75",ft="_colorGlyph_16j1l_81",xt="_colorBar_16j1l_89",gt="_shell_16j1l_107",jt="_content_16j1l_110",yt="_placeholder_16j1l_123",St="_paragraph_16j1l_146",Nt="_h1_16j1l_152",Tt="_h2_16j1l_153",Ct="_h3_16j1l_154",Et="_h4_16j1l_155",Lt="_h5_16j1l_156",vt="_h6_16j1l_157",bt="_quote_16j1l_176",kt="_ul_16j1l_183",Mt="_ol_16j1l_188",Rt="_li_16j1l_193",It="_nestedLi_16j1l_196",Ot="_liChecked_16j1l_200",At="_liUnchecked_16j1l_201",Dt="_link_16j1l_238",$t="_bold_16j1l_245",qt="_italic_16j1l_248",wt="_underline_16j1l_251",Bt="_strike_16j1l_254",Ut="_codeInline_16j1l_260",s={editor:it,label:lt,required:st,helper:ct,control:at,error:ut,disabled:dt,toolbar:mt,sm:pt,md:ht,lg:_t,colorGlyph:ft,colorBar:xt,shell:gt,content:jt,placeholder:yt,paragraph:St,h1:Nt,h2:Tt,h3:Ct,h4:Et,h5:Lt,h6:vt,quote:bt,ul:kt,ol:Mt,li:Rt,nestedLi:It,liChecked:Ot,liUnchecked:At,link:Dt,bold:$t,italic:qt,underline:wt,strike:Bt,codeInline:Ut},Ft={paragraph:"Paragraph",h1:"Heading 1",h2:"Heading 2",h3:"Heading 3",quote:"Quote",bullet:"Bullet List",number:"Numbered List",check:"Check List"},Pt=[{type:"paragraph",icon:"Text"},{type:"h1",icon:"Hashtag"},{type:"h2",icon:"Hashtag"},{type:"h3",icon:"Hashtag"}],Ht=[{value:"left",labelKey:"rte.alignLeft",icon:"TextalignLeft"},{value:"center",labelKey:"rte.alignCenter",icon:"TextalignCenter"},{value:"right",labelKey:"rte.alignRight",icon:"TextalignRight"}],Vt=["10px","12px","13px","14px","16px","18px","20px"],zt={sm:"12px",md:"13px",lg:"16px"};function Gt({color:o,size:e}){return r.jsxs("span",{className:s.colorGlyph,children:[r.jsx(g.Icon,{name:"Brush",size:e}),r.jsx("span",{className:s.colorBar,style:{borderColor:`transparent transparent ${o||"currentColor"} transparent`},"aria-hidden":"true"})]})}function Wt({size:o,disabled:e,onImageUpload:i}){const n=de.useT(),p=t=>Ft[t]??t,[l]=Le.useLexicalComposerContext(),m=u.useRef(null),[j,d]=u.useState(!1),[_,T]=u.useState(!1),[f,x]=u.useState(!1),[y,C]=u.useState(!1),[Z,ee]=u.useState(""),[L,O]=u.useState("paragraph"),[P,te]=u.useState("left"),[E,S]=u.useState(""),[A,B]=u.useState(""),[H,V]=u.useState(!1),U=u.useRef(null),[re,z]=u.useState(!1),[ne,N]=u.useState(!1),[h,oe]=u.useState(null),[he,_e]=u.useState(""),ie=u.useCallback(()=>{const t=a.$getSelection();if(!a.$isRangeSelection(t))return;d(t.hasFormat("bold")),T(t.hasFormat("italic")),x(t.hasFormat("underline")),B(R.$getSelectionStyleValueForProperty(t,"color","")),S(R.$getSelectionStyleValueForProperty(t,"font-size",""));const c=t.anchor.getNode(),k=c.getParent(),b=F.$isLinkNode(c)?c:F.$isLinkNode(k)?k:null;C(b!==null),ee((b==null?void 0:b.getURL())??"");const M=c.getKey()==="root"?c:D.$findMatchingParent(c,we=>{const je=we.getParent();return je===null||je.getKey()==="root"})??c.getTopLevelElement();te(a.$isElementNode(M)&&M.getFormatType()||"left");const W=D.$getNearestNodeOfType(c,I.ListNode);W?O(W.getListType()):w.$isHeadingNode(M)?O(M.getTag()):w.$isQuoteNode(M)?O("quote"):O("paragraph")},[]);u.useEffect(()=>D.mergeRegister(l.registerUpdateListener(({editorState:t})=>t.read(ie)),l.registerCommand(a.SELECTION_CHANGE_COMMAND,()=>(ie(),!1),a.COMMAND_PRIORITY_LOW),l.registerCommand(a.CAN_UNDO_COMMAND,t=>(z(t),!1),a.COMMAND_PRIORITY_LOW),l.registerCommand(a.CAN_REDO_COMMAND,t=>(N(t),!1),a.COMMAND_PRIORITY_LOW)),[l,ie]);const le=t=>l.dispatchCommand(a.FORMAT_TEXT_COMMAND,t),ke=t=>l.dispatchCommand(a.FORMAT_ELEMENT_COMMAND,t),Me=t=>{B(t),l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&R.$patchStyleText(c,{color:t||null})})},Re=t=>{S(t),l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&R.$patchStyleText(c,{"font-size":t||null})})},G=t=>{if(t==="bullet"||t==="number"||t==="check"){if(L===t)l.dispatchCommand(I.REMOVE_LIST_COMMAND,void 0);else{const c=t==="bullet"?I.INSERT_UNORDERED_LIST_COMMAND:t==="number"?I.INSERT_ORDERED_LIST_COMMAND:I.INSERT_CHECK_LIST_COMMAND;l.dispatchCommand(c,void 0)}return}l.update(()=>{const c=a.$getSelection();a.$isRangeSelection(c)&&(t==="paragraph"?R.$setBlocksType(c,()=>a.$createParagraphNode()):t==="quote"?R.$setBlocksType(c,()=>w.$createQuoteNode()):R.$setBlocksType(c,()=>w.$createHeadingNode(t)))})},Ie=()=>G(L==="quote"?"paragraph":"quote"),se=(t,c="")=>{_e(c),oe(t)},fe=()=>oe(null),Oe=()=>{h==null||h.onConfirm(he.trim()),oe(null)},Ae=()=>se({icon:"Link2",title:n("rte.linkTitle"),label:n("rte.linkUrl"),placeholder:"https://example.com",confirmLabel:n(y?"common.update":"common.insert"),onConfirm:t=>l.dispatchCommand(F.TOGGLE_LINK_COMMAND,t===""?null:me(t))},Z),De=()=>se({icon:"GalleryAdd",title:n("rte.imageTitle"),label:n("rte.imageUrl"),placeholder:"https://example.com/image.jpg",confirmLabel:n("common.insert"),onConfirm:t=>{t&&l.update(()=>D.$insertNodeToNearestRoot(Q(t)))}}),$e=async t=>{var k;const c=(k=t.target.files)==null?void 0:k[0];if(t.target.value="",!!c)try{const b=i?await i(c):await Kt(c);l.update(()=>D.$insertNodeToNearestRoot(Q(b,c.name)))}catch{Qe.toast.error(n("rte.imageError"))}},qe=()=>se({icon:"VideoSquare",title:n("rte.videoTitle"),label:n("rte.videoUrl"),placeholder:n("rte.videoUrlPlaceholder"),confirmLabel:n("common.insert"),onConfirm:t=>{t&&l.update(()=>D.$insertNodeToNearestRoot(pe(t)))}}),v=(t,c,k,b,M)=>r.jsx(q.IconButton,{variant:t?"filled":"text",color:"primary",size:o,disabled:e,"aria-label":c,"aria-pressed":t,onMouseDown:W=>W.preventDefault(),onClick:k,children:b},M),xe=L.startsWith("h")?L:"paragraph",ge=E||zt[o];return r.jsxs("div",{className:s.toolbar,role:"toolbar","aria-label":n("rte.formatting"),"aria-orientation":"horizontal",children:[r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e||!re,"aria-label":n("rte.undo"),onMouseDown:t=>t.preventDefault(),onClick:()=>l.dispatchCommand(a.UNDO_COMMAND,void 0),children:r.jsx(g.Icon,{name:"UndoArrow"})}),r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e||!ne,"aria-label":n("rte.redo"),onMouseDown:t=>t.preventDefault(),onClick:()=>l.dispatchCommand(a.REDO_COMMAND,void 0),children:r.jsx(g.Icon,{name:"RedoArrow"})}),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(ae.Dropdown,{size:o,disabled:e,minWidth:!1,trigger:r.jsx(K.Button,{variant:"text",color:"primary",size:o,disabled:e,endIcon:r.jsx(g.Icon,{name:"ArrowDown4"}),"aria-label":n("rte.fontSize"),onMouseDown:t=>t.preventDefault(),children:ge}),children:Vt.map(t=>r.jsx(J.ListItem,{clickable:!0,selected:t===ge,onClick:()=>Re(t),children:t},t))}),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(ae.Dropdown,{size:o,disabled:e,trigger:r.jsx(K.Button,{variant:"text",color:"primary",size:o,disabled:e,endIcon:r.jsx(g.Icon,{name:"ArrowDown4"}),onMouseDown:t=>t.preventDefault(),children:p(xe)}),children:Pt.map(t=>r.jsx(J.ListItem,{clickable:!0,selected:xe===t.type,icon:t.icon,onClick:()=>G(t.type),children:p(t.type)},t.type))}),r.jsx($.Divider,{orientation:"vertical"}),v(j,n("rte.bold"),()=>le("bold"),r.jsx(g.Icon,{name:"TextBold"})),v(_,n("rte.italic"),()=>le("italic"),r.jsx(g.Icon,{name:"TextItalic"})),v(f,n("rte.underline"),()=>le("underline"),r.jsx(g.Icon,{name:"TextUnderline"})),r.jsx($.Divider,{orientation:"vertical"}),v(L==="bullet",n("rte.bulletList"),()=>G("bullet"),r.jsx(g.Icon,{name:"ListBullet"})),v(L==="number",n("rte.numberedList"),()=>G("number"),r.jsx(g.Icon,{name:"ListNumber"})),v(L==="quote",n("rte.quote"),Ie,r.jsx(g.Icon,{name:"QuoteUp"})),r.jsx($.Divider,{orientation:"vertical"}),Ht.map(t=>v(P===t.value,n(t.labelKey),()=>ke(t.value),r.jsx(g.Icon,{name:t.icon}),t.value)),r.jsx($.Divider,{orientation:"vertical"}),r.jsx(q.IconButton,{ref:U,variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.textColor"),"aria-expanded":H,onMouseDown:t=>t.preventDefault(),onClick:()=>V(t=>!t),children:r.jsx(Gt,{color:A})}),r.jsx(Xe.FloatingPanel,{open:H,triggerRef:U,onClose:t=>{var c;V(!1),t&&((c=U.current)==null||c.focus())},role:"dialog",ariaLabel:n("rte.textColor"),width:232,children:r.jsx(Se.ColorPickerPanel,{value:A||Se.DEFAULT_SWATCHES[0],onChange:Me,clearable:!1})}),v(y,n("rte.link"),Ae,r.jsx(g.Icon,{name:"Link2"})),r.jsxs(ae.Dropdown,{size:o,disabled:e,minWidth:!1,trigger:r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.insertImage"),children:r.jsx(g.Icon,{name:"GalleryAdd"})}),children:[r.jsx(J.ListItem,{clickable:!0,icon:"GalleryImport",onClick:()=>{var t;return(t=m.current)==null?void 0:t.click()},children:n("rte.uploadImage")}),r.jsx(J.ListItem,{clickable:!0,icon:"Link",onClick:De,children:n("rte.imageByUrl")})]}),r.jsx(q.IconButton,{variant:"text",color:"primary",size:o,disabled:e,"aria-label":n("rte.insertVideo"),onClick:qe,children:r.jsx(g.Icon,{name:"VideoSquare"})}),r.jsx("input",{ref:m,type:"file",accept:"image/*",hidden:!0,onChange:$e,"aria-hidden":"true",tabIndex:-1}),r.jsx(Ye.Modal,{open:h!==null,onClose:fe,size:"sm",icon:h==null?void 0:h.icon,title:h==null?void 0:h.title,footer:r.jsxs(r.Fragment,{children:[r.jsx(K.Button,{variant:"text",size:"sm",onClick:fe,children:n("common.cancel")}),r.jsx(K.Button,{type:"submit",size:"sm",form:"rte-url-form",children:(h==null?void 0:h.confirmLabel)??n("common.insert")})]}),children:r.jsx("form",{id:"rte-url-form",onSubmit:t=>{t.preventDefault(),Oe()},children:r.jsx(Ze.TextField,{label:h==null?void 0:h.label,placeholder:h==null?void 0:h.placeholder,value:he,onChange:t=>_e(t.target.value)})})})]})}function Kt(o){return new Promise((e,i)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=()=>i(n.error),n.readAsDataURL(o)})}const Jt={paragraph:s.paragraph,heading:{h1:s.h1,h2:s.h2,h3:s.h3,h4:s.h4,h5:s.h5,h6:s.h6},quote:s.quote,list:{ul:s.ul,ol:s.ol,listitem:s.li,listitemChecked:s.liChecked,listitemUnchecked:s.liUnchecked,nested:{listitem:s.nestedLi}},link:s.link,text:{bold:s.bold,italic:s.italic,underline:s.underline,strikethrough:s.strike,code:s.codeInline}},Qt=[w.HeadingNode,w.QuoteNode,I.ListNode,I.ListItemNode,F.LinkNode,X,Y],Xt=[...ce.ELEMENT_TRANSFORMERS,...ce.TEXT_FORMAT_TRANSFORMERS,...ce.TEXT_MATCH_TRANSFORMERS],Yt=["color","font-size"],Zt={span:o=>{var i,n;const e=(n=(i=a.TextNode.importDOM())==null?void 0:i.span)==null?void 0:n.call(i,o);return{priority:1,conversion:p=>{const l=(e==null?void 0:e.conversion(p))??{node:null},m=Yt.flatMap(d=>{const _=p.style.getPropertyValue(d);return _?[[d,_]]:[]});if(m.length===0)return l;const j=l.forChild;return{...l,forChild:(d,_)=>{const T=j?j(d,_):d;if(a.$isTextNode(T)){const f={...a.getStyleObjectFromCSS(T.getStyle())};for(const[x,y]of m)f[x]=y;T.setStyle(Object.entries(f).map(([x,y])=>`${x}: ${y};`).join(" "))}return T}}}}}},er=new Set(["A","B","CODE","EM","I","MARK","S","SPAN","STRONG","SUB","SUP","U"]);function tr(o){const e=o.split(";").map(i=>i.trim()).filter(i=>i&&!/^white-space\s*:\s*pre-wrap$/i.test(i));return e.length?`${e.join("; ")};`:null}function rr(o){const e=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT);let i=!0,n=!1,p=null;const l=()=>{p&&p.data.endsWith(" ")&&(p.data=`${p.data.slice(0,-1)} `),p=null,i=!0,n=!1};for(let m=e.nextNode();m;m=e.nextNode()){if(m.nodeType===Node.ELEMENT_NODE){er.has(m.tagName)||l();continue}const j=m;if(!j.data)continue;let d="";for(const _ of j.data)_===" "&&(i||n)?(d+=" ",n=!1):(d+=_,n=_===" "),i=!1;j.data=d,p=j}l()}function nr(o){if(typeof document>"u")return o;const e=document.createElement("template");e.innerHTML=o;const i=e.content;return i.querySelectorAll("[class]").forEach(n=>n.removeAttribute("class")),i.querySelectorAll("[style]").forEach(n=>{var l;if((l=n.textContent)!=null&&l.includes(" "))return;const p=tr(n.getAttribute("style")??"");p?n.setAttribute("style",p):n.removeAttribute("style")}),i.querySelectorAll("span").forEach(n=>{n.attributes.length===0&&n.replaceWith(...n.childNodes)}),i.normalize(),rr(i),e.innerHTML}function or(){const o=a.$getRoot(),e=o.getFirstChild();return o.getChildrenSize()<=1&&(e===null||a.$isParagraphNode(e)&&e.getChildrenSize()===0)}function Ce(o,e){const i=a.$getRoot();if(i.clear(),e){const n=new DOMParser().parseFromString(e,"text/html"),p=ve.$generateNodesFromDOM(o,n);i.select(),a.$insertNodes(p)}i.getChildrenSize()===0&&i.append(a.$createParagraphNode()),a.$setSelection(null)}const ue="tz-external-value";function Ee(o){return or()?"":nr(ve.$generateHtmlFromNodes(o,null))}function ir({value:o,defaultValue:e,onChange:i,onReady:n,disabled:p}){const[l]=Le.useLexicalComposerContext(),m=u.useRef(void 0),j=u.useRef(i);j.current=i;const d=u.useRef(n);d.current=n;const _=u.useRef(!1),T=f=>{var x;_.current||(_.current=!0,(x=d.current)==null||x.call(d,f))};return u.useEffect(()=>l.setEditable(!p),[l,p]),u.useEffect(()=>l.registerNodeTransform(F.LinkNode,f=>{const x=f.getURL(),y=me(x);y!==x&&f.setURL(y)}),[l]),u.useEffect(()=>{if(o===void 0){if(!e){m.current="",T("");return}m.current=e,l.update(()=>Ce(l,e),{tag:["history-merge",ue]})}},[]),u.useEffect(()=>{o===void 0||o===m.current||(m.current=o,l.update(()=>Ce(l,o),{tag:["history-merge",ue]}))},[l,o]),u.useEffect(()=>l.registerUpdateListener(({dirtyElements:f,dirtyLeaves:x,tags:y})=>{if(y.has(ue)){l.read(()=>{const C=Ee(l);m.current=C,T(C)});return}f.size===0&&x.size===0||l.read(()=>{const C=Ee(l);C!==m.current&&(m.current=C,j.current(C))})}),[l]),null}const lr=u.forwardRef(function({label:e,size:i="md",error:n,helperText:p,required:l=!1,disabled:m=!1,placeholder:j,name:d,value:_,defaultValue:T,onChange:f,onReady:x,onImageUpload:y,minHeight:C=220,"aria-label":Z,className:ee,style:L},O){const P=de.useT(),te=Z??P("rte.label"),E=Je.useFormContext(),S=E&&d?E.field(d):void 0,A=n??(S==null?void 0:S.error)??!1,B=p??(S==null?void 0:S.helperText),H=E&&d?E.values[d]:void 0,V=_!==void 0?_:E&&d?String(H??""):void 0,U=u.useCallback(N=>{E&&d&&E.setValue(d,N),f==null||f(N)},[E,d,f]),re=N=>S==null?void 0:S.onBlur(N),z=u.useRef(null);u.useEffect(()=>{const N=z.current;N&&(d?N.setAttribute("name",d):N.removeAttribute("name"))},[d]);const ne={namespace:"tz-rich-text-editor",theme:Jt,nodes:Qt,html:{import:Zt},editable:!m,onError:N=>{throw N}};return r.jsxs("div",{ref:O,className:Be.clsx(s.editor,s[i],A&&s.error,m&&s.disabled,ee),style:{"--tz-rte-min-height":`${C}px`,...L},children:[e!=null&&r.jsxs("div",{className:s.label,children:[r.jsx(ye.Typography,{as:"span",variant:"bodySmall",color:"muted",children:e}),l&&r.jsx("span",{className:s.required,"aria-hidden":"true",children:"*"})]}),r.jsx("div",{className:s.control,children:r.jsxs(Ue.LexicalComposer,{initialConfig:ne,children:[r.jsx(Wt,{size:i,disabled:m,onImageUpload:y}),r.jsx("div",{className:s.shell,children:r.jsx(Fe.RichTextPlugin,{contentEditable:r.jsx(Pe.ContentEditable,{ref:z,className:s.content,"aria-label":te,"aria-invalid":A||void 0,onBlur:re}),placeholder:r.jsx("div",{className:s.placeholder,children:j??P("rte.placeholder")}),ErrorBoundary:He.LexicalErrorBoundary})}),r.jsx(Ve.HistoryPlugin,{}),r.jsx(ze.ListPlugin,{}),r.jsx(Ge.CheckListPlugin,{}),r.jsx(We.LinkPlugin,{}),r.jsx(Ke.MarkdownShortcutPlugin,{transformers:Xt}),r.jsx(ir,{value:V,defaultValue:T,onChange:U,onReady:x,disabled:m})]})}),B!=null&&r.jsx(ye.Typography,{as:"span",variant:"bodySmall",color:A?"error":"muted",className:s.helper,children:B})]})});exports.RichTextEditor=lr;
|
|
2
|
+
//# sourceMappingURL=RichTextEditor-Ba1G_qXu.cjs.map
|