@techzyapp/ui-library 1.0.45 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/AdminRoot-BRN_MlHp.cjs +2 -0
- package/dist/AdminRoot-BRN_MlHp.cjs.map +1 -0
- package/dist/AdminRoot-CtqPtYxo.js +107 -0
- package/dist/AdminRoot-CtqPtYxo.js.map +1 -0
- package/dist/{Alert-BU7GlQna.js → Alert-Bo_XgY-A.js} +3 -3
- package/dist/{Alert-BU7GlQna.js.map → Alert-Bo_XgY-A.js.map} +1 -1
- package/dist/{Alert-CVQOjuEq.cjs → Alert-QvfNBhlU.cjs} +2 -2
- package/dist/{Alert-CVQOjuEq.cjs.map → Alert-QvfNBhlU.cjs.map} +1 -1
- package/dist/AuthGuard-CAaQZ2y7.cjs +2 -0
- package/dist/AuthGuard-CAaQZ2y7.cjs.map +1 -0
- package/dist/AuthGuard-vqKf2PF9.js +102 -0
- package/dist/AuthGuard-vqKf2PF9.js.map +1 -0
- package/dist/{Breadcrumbs-BMz_YVPa.js → Breadcrumbs-BEv57tuJ.js} +3 -3
- package/dist/{Breadcrumbs-BMz_YVPa.js.map → Breadcrumbs-BEv57tuJ.js.map} +1 -1
- package/dist/{Breadcrumbs-BbC0o4JE.cjs → Breadcrumbs-CqGS32x5.cjs} +2 -2
- package/dist/{Breadcrumbs-BbC0o4JE.cjs.map → Breadcrumbs-CqGS32x5.cjs.map} +1 -1
- package/dist/{Button-mBZOvgyZ.cjs → Button-BtiFpRie.cjs} +2 -2
- package/dist/{Button-mBZOvgyZ.cjs.map → Button-BtiFpRie.cjs.map} +1 -1
- package/dist/{Button-C415LPw_.js → Button-DZWYeAno.js} +2 -2
- package/dist/{Button-C415LPw_.js.map → Button-DZWYeAno.js.map} +1 -1
- package/dist/{Calendar-B0f6h9-A.js → Calendar-7W9xNVBZ.js} +3 -3
- package/dist/{Calendar-B0f6h9-A.js.map → Calendar-7W9xNVBZ.js.map} +1 -1
- package/dist/{Calendar-hO051hfk.cjs → Calendar-Bgh_3Vk2.cjs} +2 -2
- package/dist/{Calendar-hO051hfk.cjs.map → Calendar-Bgh_3Vk2.cjs.map} +1 -1
- package/dist/{Card-BdNr5row.cjs → Card-KfmWG9Uz.cjs} +2 -2
- package/dist/{Card-BdNr5row.cjs.map → Card-KfmWG9Uz.cjs.map} +1 -1
- package/dist/{Card-ssUNaOF_.js → Card-ckOd617g.js} +3 -3
- package/dist/{Card-ssUNaOF_.js.map → Card-ckOd617g.js.map} +1 -1
- package/dist/{Chip-BpJN4rzY.cjs → Chip-BDUsue_R.cjs} +2 -2
- package/dist/{Chip-BpJN4rzY.cjs.map → Chip-BDUsue_R.cjs.map} +1 -1
- package/dist/{Chip-C0x-6g2h.js → Chip-Crzm7Eux.js} +2 -2
- package/dist/{Chip-C0x-6g2h.js.map → Chip-Crzm7Eux.js.map} +1 -1
- package/dist/{CodeBlock-DKnWINdV.js → CodeBlock-CX8_dMPD.js} +3 -3
- package/dist/{CodeBlock-DKnWINdV.js.map → CodeBlock-CX8_dMPD.js.map} +1 -1
- package/dist/{CodeBlock-DTrzN95i.cjs → CodeBlock-rnGAu2DQ.cjs} +2 -2
- package/dist/{CodeBlock-DTrzN95i.cjs.map → CodeBlock-rnGAu2DQ.cjs.map} +1 -1
- package/dist/{ColorPicker-Doaegll4.cjs → ColorPicker-BaAdcqR9.cjs} +2 -2
- package/dist/{ColorPicker-Doaegll4.cjs.map → ColorPicker-BaAdcqR9.cjs.map} +1 -1
- package/dist/{ColorPicker-Bidev2DJ.js → ColorPicker-CwLivdAt.js} +3 -3
- package/dist/{ColorPicker-Bidev2DJ.js.map → ColorPicker-CwLivdAt.js.map} +1 -1
- package/dist/{ColorPickerPanel-DThSuUoz.js → ColorPickerPanel-CkrSIf35.js} +2 -2
- package/dist/{ColorPickerPanel-DThSuUoz.js.map → ColorPickerPanel-CkrSIf35.js.map} +1 -1
- package/dist/{ColorPickerPanel-048Fj7wv.cjs → ColorPickerPanel-IOhJJF1R.cjs} +2 -2
- package/dist/{ColorPickerPanel-048Fj7wv.cjs.map → ColorPickerPanel-IOhJJF1R.cjs.map} +1 -1
- package/dist/{ColorRamp-CGw4D9bf.cjs → ColorRamp-BCy8a7ks.cjs} +2 -2
- package/dist/{ColorRamp-CGw4D9bf.cjs.map → ColorRamp-BCy8a7ks.cjs.map} +1 -1
- package/dist/{ColorRamp-Reb0q69d.js → ColorRamp-DbFOsspz.js} +2 -2
- package/dist/{ColorRamp-Reb0q69d.js.map → ColorRamp-DbFOsspz.js.map} +1 -1
- package/dist/ConfigProvider-CYSpuSMJ.cjs +2 -0
- package/dist/ConfigProvider-CYSpuSMJ.cjs.map +1 -0
- package/dist/ConfigProvider-DtyUlWk6.js +394 -0
- package/dist/ConfigProvider-DtyUlWk6.js.map +1 -0
- package/dist/{CopyButton-Cnab62vt.cjs → CopyButton-DUG5s3TM.cjs} +2 -2
- package/dist/{CopyButton-Cnab62vt.cjs.map → CopyButton-DUG5s3TM.cjs.map} +1 -1
- package/dist/{CopyButton-Dm8-V4ku.js → CopyButton-LURMuaYw.js} +3 -3
- package/dist/{CopyButton-Dm8-V4ku.js.map → CopyButton-LURMuaYw.js.map} +1 -1
- package/dist/{DatePicker-CaGeW_-j.cjs → DatePicker-Bw9gLB8o.cjs} +2 -2
- package/dist/{DatePicker-CaGeW_-j.cjs.map → DatePicker-Bw9gLB8o.cjs.map} +1 -1
- package/dist/{DatePicker-C4MTCmDn.js → DatePicker-CSIBYSZt.js} +4 -4
- package/dist/{DatePicker-C4MTCmDn.js.map → DatePicker-CSIBYSZt.js.map} +1 -1
- package/dist/{DateTimePicker-B0CjHKPV.js → DateTimePicker-C9F2yJMf.js} +7 -7
- package/dist/{DateTimePicker-B0CjHKPV.js.map → DateTimePicker-C9F2yJMf.js.map} +1 -1
- package/dist/{DateTimePicker-DXKaAYey.cjs → DateTimePicker-kikKdt0F.cjs} +2 -2
- package/dist/{DateTimePicker-DXKaAYey.cjs.map → DateTimePicker-kikKdt0F.cjs.map} +1 -1
- package/dist/{DescriptionList-BSDwobDc.cjs → DescriptionList-DnGkHdzT.cjs} +2 -2
- package/dist/{DescriptionList-BSDwobDc.cjs.map → DescriptionList-DnGkHdzT.cjs.map} +1 -1
- package/dist/{DescriptionList-BkUS5egS.js → DescriptionList-kfNXbf_D.js} +4 -4
- package/dist/{DescriptionList-BkUS5egS.js.map → DescriptionList-kfNXbf_D.js.map} +1 -1
- package/dist/{EmptyState-CkkFHKrh.cjs → EmptyState-BM5LrRLq.cjs} +2 -2
- package/dist/{EmptyState-CkkFHKrh.cjs.map → EmptyState-BM5LrRLq.cjs.map} +1 -1
- package/dist/{EmptyState-DXoaPC7o.js → EmptyState-DrSj2XV_.js} +2 -2
- package/dist/{EmptyState-DXoaPC7o.js.map → EmptyState-DrSj2XV_.js.map} +1 -1
- package/dist/{ErrorBoundary-CSP_Ctg6.js → ErrorBoundary-DsP4hO_V.js} +3 -3
- package/dist/{ErrorBoundary-CSP_Ctg6.js.map → ErrorBoundary-DsP4hO_V.js.map} +1 -1
- package/dist/{ErrorBoundary-tZjKtO28.cjs → ErrorBoundary-yz669VEu.cjs} +2 -2
- package/dist/{ErrorBoundary-tZjKtO28.cjs.map → ErrorBoundary-yz669VEu.cjs.map} +1 -1
- package/dist/{ErrorState-JH4JdrTI.cjs → ErrorState-BThPIYaM.cjs} +2 -2
- package/dist/{ErrorState-JH4JdrTI.cjs.map → ErrorState-BThPIYaM.cjs.map} +1 -1
- package/dist/{ErrorState-WYsly5-i.js → ErrorState-DEngucdq.js} +7 -7
- package/dist/{ErrorState-WYsly5-i.js.map → ErrorState-DEngucdq.js.map} +1 -1
- package/dist/{FileCard-D4TB3qGG.js → FileCard-CmCESTQd.js} +3 -3
- package/dist/{FileCard-D4TB3qGG.js.map → FileCard-CmCESTQd.js.map} +1 -1
- package/dist/{FileCard-BIfPqeek.cjs → FileCard-wxDT2rj9.cjs} +2 -2
- package/dist/{FileCard-BIfPqeek.cjs.map → FileCard-wxDT2rj9.cjs.map} +1 -1
- package/dist/{FileUploader-YE_DfTNC.cjs → FileUploader-DBNRp5eT.cjs} +2 -2
- package/dist/{FileUploader-YE_DfTNC.cjs.map → FileUploader-DBNRp5eT.cjs.map} +1 -1
- package/dist/{FileUploader-DPVF76Ha.js → FileUploader-Dp1r4Sxc.js} +29 -29
- package/dist/{FileUploader-DPVF76Ha.js.map → FileUploader-Dp1r4Sxc.js.map} +1 -1
- package/dist/{FullscreenToggle-ipX55Nj4.cjs → FullscreenToggle-DVdQriWB.cjs} +2 -2
- package/dist/{FullscreenToggle-ipX55Nj4.cjs.map → FullscreenToggle-DVdQriWB.cjs.map} +1 -1
- package/dist/{FullscreenToggle-CxwGPLdd.js → FullscreenToggle-WGsbE3Op.js} +3 -3
- package/dist/{FullscreenToggle-CxwGPLdd.js.map → FullscreenToggle-WGsbE3Op.js.map} +1 -1
- package/dist/{IconButton-U_sr2Ahy.cjs → IconButton-DSPdv-oI.cjs} +2 -2
- package/dist/{IconButton-U_sr2Ahy.cjs.map → IconButton-DSPdv-oI.cjs.map} +1 -1
- package/dist/{IconButton-re6xITGO.js → IconButton-iWbUJAz7.js} +2 -2
- package/dist/{IconButton-re6xITGO.js.map → IconButton-iWbUJAz7.js.map} +1 -1
- package/dist/{ImageEditor-BwrG1fk7.js → ImageEditor-BDNys8pq.js} +5 -5
- package/dist/{ImageEditor-BwrG1fk7.js.map → ImageEditor-BDNys8pq.js.map} +1 -1
- package/dist/{ImageEditor-1n50vo_v.cjs → ImageEditor-C40dp2-V.cjs} +2 -2
- package/dist/{ImageEditor-1n50vo_v.cjs.map → ImageEditor-C40dp2-V.cjs.map} +1 -1
- package/dist/{Loader-7v1QBvHY.js → Loader-DD1vfqmN.js} +2 -2
- package/dist/{Loader-7v1QBvHY.js.map → Loader-DD1vfqmN.js.map} +1 -1
- package/dist/{Loader-BE3SQr7W.cjs → Loader-RyFTP2X5.cjs} +2 -2
- package/dist/{Loader-BE3SQr7W.cjs.map → Loader-RyFTP2X5.cjs.map} +1 -1
- package/dist/{LocationPicker-CVJ4jVn2.cjs → LocationPicker-B594f0bz.cjs} +2 -2
- package/dist/{LocationPicker-CVJ4jVn2.cjs.map → LocationPicker-B594f0bz.cjs.map} +1 -1
- package/dist/{LocationPicker-BvKtZFq0.js → LocationPicker-DpmYaYyd.js} +6 -6
- package/dist/{LocationPicker-BvKtZFq0.js.map → LocationPicker-DpmYaYyd.js.map} +1 -1
- package/dist/{Modal-CxODxl81.cjs → Modal-7cCok6fV.cjs} +2 -2
- package/dist/{Modal-CxODxl81.cjs.map → Modal-7cCok6fV.cjs.map} +1 -1
- package/dist/{Modal-DpoiMMM3.js → Modal-DVGTD2Ck.js} +3 -3
- package/dist/{Modal-DpoiMMM3.js.map → Modal-DVGTD2Ck.js.map} +1 -1
- package/dist/{MultiSelect-B7KwEhL5.js → MultiSelect-D-X833xt.js} +4 -4
- package/dist/{MultiSelect-B7KwEhL5.js.map → MultiSelect-D-X833xt.js.map} +1 -1
- package/dist/{MultiSelect-2GouMRTl.cjs → MultiSelect-DTKNjUDH.cjs} +2 -2
- package/dist/{MultiSelect-2GouMRTl.cjs.map → MultiSelect-DTKNjUDH.cjs.map} +1 -1
- package/dist/{NumberField-ThojS4K3.js → NumberField-OPOl0Yph.js} +3 -3
- package/dist/{NumberField-ThojS4K3.js.map → NumberField-OPOl0Yph.js.map} +1 -1
- package/dist/{NumberField-o2z2QNK1.cjs → NumberField-Xz4yQMlm.cjs} +2 -2
- package/dist/{NumberField-o2z2QNK1.cjs.map → NumberField-Xz4yQMlm.cjs.map} +1 -1
- package/dist/{OtpField-C3MlMZ2F.js → OtpField-CLrDMNtS.js} +2 -2
- package/dist/{OtpField-C3MlMZ2F.js.map → OtpField-CLrDMNtS.js.map} +1 -1
- package/dist/{OtpField-BhZq44vV.cjs → OtpField-kd0YghZq.cjs} +2 -2
- package/dist/{OtpField-BhZq44vV.cjs.map → OtpField-kd0YghZq.cjs.map} +1 -1
- package/dist/{PageError-63Gk6fVC.js → PageError-BIiZDzey.js} +5 -5
- package/dist/{PageError-63Gk6fVC.js.map → PageError-BIiZDzey.js.map} +1 -1
- package/dist/{PageError-CCKWbrc5.cjs → PageError-v6MAH_OL.cjs} +2 -2
- package/dist/{PageError-CCKWbrc5.cjs.map → PageError-v6MAH_OL.cjs.map} +1 -1
- package/dist/{PageLayout-BekkDBtT.js → PageLayout-BjaPfXvb.js} +4 -4
- package/dist/{PageLayout-BekkDBtT.js.map → PageLayout-BjaPfXvb.js.map} +1 -1
- package/dist/{PageLayout-CDPUYu6A.cjs → PageLayout-DH3jochw.cjs} +2 -2
- package/dist/{PageLayout-CDPUYu6A.cjs.map → PageLayout-DH3jochw.cjs.map} +1 -1
- package/dist/{PageNotFound-BD3zX3cd.js → PageNotFound-C1oSsMG-.js} +5 -5
- package/dist/{PageNotFound-BD3zX3cd.js.map → PageNotFound-C1oSsMG-.js.map} +1 -1
- package/dist/{PageNotFound-CTR6htwa.cjs → PageNotFound-Cse4bROv.cjs} +2 -2
- package/dist/{PageNotFound-CTR6htwa.cjs.map → PageNotFound-Cse4bROv.cjs.map} +1 -1
- package/dist/{Pagination-qKjISBJ9.js → Pagination-BNJdqcu4.js} +2 -2
- package/dist/{Pagination-qKjISBJ9.js.map → Pagination-BNJdqcu4.js.map} +1 -1
- package/dist/{Pagination-BJvLUjQ0.cjs → Pagination-DkmfEmgK.cjs} +2 -2
- package/dist/{Pagination-BJvLUjQ0.cjs.map → Pagination-DkmfEmgK.cjs.map} +1 -1
- package/dist/{PaletteField-y8KpR4Ap.js → PaletteField-Cdky6Zka.js} +3 -3
- package/dist/{PaletteField-y8KpR4Ap.js.map → PaletteField-Cdky6Zka.js.map} +1 -1
- package/dist/{PaletteField-CDS9CJW9.cjs → PaletteField-DqZl1mK0.cjs} +2 -2
- package/dist/{PaletteField-CDS9CJW9.cjs.map → PaletteField-DqZl1mK0.cjs.map} +1 -1
- package/dist/{PhoneField-OjsuevPx.js → PhoneField-DmFaJJEa.js} +4 -4
- package/dist/{PhoneField-OjsuevPx.js.map → PhoneField-DmFaJJEa.js.map} +1 -1
- package/dist/{PhoneField-Df3J6Hhg.cjs → PhoneField-jq-3_i_b.cjs} +2 -2
- package/dist/{PhoneField-Df3J6Hhg.cjs.map → PhoneField-jq-3_i_b.cjs.map} +1 -1
- package/dist/{Popconfirm-aCyniPnH.js → Popconfirm-D-8ZG2WR.js} +3 -3
- package/dist/{Popconfirm-aCyniPnH.js.map → Popconfirm-D-8ZG2WR.js.map} +1 -1
- package/dist/{Popconfirm-BKzJ_EZy.cjs → Popconfirm-KOE9gGi6.cjs} +2 -2
- package/dist/{Popconfirm-BKzJ_EZy.cjs.map → Popconfirm-KOE9gGi6.cjs.map} +1 -1
- package/dist/{Progress-DWOoLd8u.cjs → Progress-7EyhPtnu.cjs} +2 -2
- package/dist/{Progress-DWOoLd8u.cjs.map → Progress-7EyhPtnu.cjs.map} +1 -1
- package/dist/{Progress-DzxbkcaD.js → Progress-CdX666FP.js} +2 -2
- package/dist/{Progress-DzxbkcaD.js.map → Progress-CdX666FP.js.map} +1 -1
- package/dist/{QrCode-C8uAPiHq.cjs → QrCode-ClIJjjvF.cjs} +2 -2
- package/dist/{QrCode-C8uAPiHq.cjs.map → QrCode-ClIJjjvF.cjs.map} +1 -1
- package/dist/{QrCode-DaJYqBc1.js → QrCode-D7ocSDi7.js} +2 -2
- package/dist/{QrCode-DaJYqBc1.js.map → QrCode-D7ocSDi7.js.map} +1 -1
- package/dist/{RemoveDialog-MhEU5Zl3.js → RemoveDialog-DTzRPLaT.js} +5 -5
- package/dist/{RemoveDialog-MhEU5Zl3.js.map → RemoveDialog-DTzRPLaT.js.map} +1 -1
- package/dist/{RemoveDialog-BnOtR6-q.cjs → RemoveDialog-UsSX5z8Y.cjs} +2 -2
- package/dist/{RemoveDialog-BnOtR6-q.cjs.map → RemoveDialog-UsSX5z8Y.cjs.map} +1 -1
- package/dist/{RichTextEditor-zkoxujnO.js → RichTextEditor-BMctlkVC.js} +7 -7
- package/dist/{RichTextEditor-zkoxujnO.js.map → RichTextEditor-BMctlkVC.js.map} +1 -1
- package/dist/{RichTextEditor-Cnrnvv1f.cjs → RichTextEditor-Bh0Q3dIW.cjs} +2 -2
- package/dist/{RichTextEditor-Cnrnvv1f.cjs.map → RichTextEditor-Bh0Q3dIW.cjs.map} +1 -1
- package/dist/{RootLayout-Z9PuRfsa.cjs → RootLayout-BztZetpk.cjs} +2 -2
- package/dist/{RootLayout-Z9PuRfsa.cjs.map → RootLayout-BztZetpk.cjs.map} +1 -1
- package/dist/{RootLayout-C4r9i5Go.js → RootLayout-CTkv4iQJ.js} +14 -14
- package/dist/{RootLayout-C4r9i5Go.js.map → RootLayout-CTkv4iQJ.js.map} +1 -1
- package/dist/{Select-CylqFHce.cjs → Select-BzVyK6Ne.cjs} +2 -2
- package/dist/{Select-CylqFHce.cjs.map → Select-BzVyK6Ne.cjs.map} +1 -1
- package/dist/{Select-jT94L1vq.js → Select-CmonDIIU.js} +3 -3
- package/dist/{Select-jT94L1vq.js.map → Select-CmonDIIU.js.map} +1 -1
- package/dist/{Sidebar-B1O2RsbR.js → Sidebar-CLr-DyQ_.js} +3 -3
- package/dist/{Sidebar-B1O2RsbR.js.map → Sidebar-CLr-DyQ_.js.map} +1 -1
- package/dist/{Sidebar-Bcm0fgVm.cjs → Sidebar-CM-jZfj5.cjs} +2 -2
- package/dist/{Sidebar-Bcm0fgVm.cjs.map → Sidebar-CM-jZfj5.cjs.map} +1 -1
- package/dist/{Slider-DC-ugZwT.js → Slider-C7Wb3q_F.js} +2 -2
- package/dist/{Slider-DC-ugZwT.js.map → Slider-C7Wb3q_F.js.map} +1 -1
- package/dist/{Slider-CV7ug0WF.cjs → Slider-Oe9VSAdy.cjs} +2 -2
- package/dist/{Slider-CV7ug0WF.cjs.map → Slider-Oe9VSAdy.cjs.map} +1 -1
- package/dist/{SpeedDial-C6yiMUe8.js → SpeedDial-CCGQlwn2.js} +2 -2
- package/dist/{SpeedDial-C6yiMUe8.js.map → SpeedDial-CCGQlwn2.js.map} +1 -1
- package/dist/{SpeedDial-DOgm2DDX.cjs → SpeedDial-DpIXoYHB.cjs} +2 -2
- package/dist/{SpeedDial-DOgm2DDX.cjs.map → SpeedDial-DpIXoYHB.cjs.map} +1 -1
- package/dist/{Stepper-BZdYGpBN.js → Stepper-D_WKS1RG.js} +2 -2
- package/dist/{Stepper-BZdYGpBN.js.map → Stepper-D_WKS1RG.js.map} +1 -1
- package/dist/{Stepper-DqM86TGV.cjs → Stepper-PBDU60G_.cjs} +2 -2
- package/dist/{Stepper-DqM86TGV.cjs.map → Stepper-PBDU60G_.cjs.map} +1 -1
- package/dist/{Table-BgaCwRDQ.cjs → Table-CZ4n4-TN.cjs} +2 -2
- package/dist/{Table-BgaCwRDQ.cjs.map → Table-CZ4n4-TN.cjs.map} +1 -1
- package/dist/{Table-FZlVWoYi.js → Table-DZQVa_PE.js} +16 -16
- package/dist/{Table-FZlVWoYi.js.map → Table-DZQVa_PE.js.map} +1 -1
- package/dist/{Tabs-BqQPkorY.js → Tabs-B063mP-v.js} +12 -12
- package/dist/{Tabs-BqQPkorY.js.map → Tabs-B063mP-v.js.map} +1 -1
- package/dist/{Tabs-kGeyFhJ6.cjs → Tabs-Byhqm-TE.cjs} +2 -2
- package/dist/{Tabs-kGeyFhJ6.cjs.map → Tabs-Byhqm-TE.cjs.map} +1 -1
- package/dist/{TagsField-B_sjp48X.cjs → TagsField-g_LtwYgz.cjs} +2 -2
- package/dist/{TagsField-B_sjp48X.cjs.map → TagsField-g_LtwYgz.cjs.map} +1 -1
- package/dist/{TagsField-ByTx9JXK.js → TagsField-hQFYyNcM.js} +4 -4
- package/dist/{TagsField-ByTx9JXK.js.map → TagsField-hQFYyNcM.js.map} +1 -1
- package/dist/{TextField-CBYJIfau.cjs → TextField-D4s2hGSd.cjs} +2 -2
- package/dist/{TextField-CBYJIfau.cjs.map → TextField-D4s2hGSd.cjs.map} +1 -1
- package/dist/{TextField-CyKIx-d-.js → TextField-Dfpk0jOg.js} +3 -3
- package/dist/{TextField-CyKIx-d-.js.map → TextField-Dfpk0jOg.js.map} +1 -1
- package/dist/{ThemeToggle-Dg6IishB.js → ThemeToggle-BQQ3eswr.js} +7 -7
- package/dist/{ThemeToggle-Dg6IishB.js.map → ThemeToggle-BQQ3eswr.js.map} +1 -1
- package/dist/{ThemeToggle-D2dIqiBa.cjs → ThemeToggle-BTTI7Jz0.cjs} +2 -2
- package/dist/{ThemeToggle-D2dIqiBa.cjs.map → ThemeToggle-BTTI7Jz0.cjs.map} +1 -1
- package/dist/{TimeColumns-Cx8J5qzW.js → TimeColumns-BpjhrNCq.js} +2 -2
- package/dist/{TimeColumns-Cx8J5qzW.js.map → TimeColumns-BpjhrNCq.js.map} +1 -1
- package/dist/{TimeColumns-DVmK_T_P.cjs → TimeColumns-DZYGWWG_.cjs} +2 -2
- package/dist/{TimeColumns-DVmK_T_P.cjs.map → TimeColumns-DZYGWWG_.cjs.map} +1 -1
- package/dist/{TimePicker-0nZOPRKp.cjs → TimePicker-DChtZgBs.cjs} +2 -2
- package/dist/{TimePicker-0nZOPRKp.cjs.map → TimePicker-DChtZgBs.cjs.map} +1 -1
- package/dist/{TimePicker-sAhtvqQ4.js → TimePicker-mzoMIlpq.js} +5 -5
- package/dist/{TimePicker-sAhtvqQ4.js.map → TimePicker-mzoMIlpq.js.map} +1 -1
- package/dist/{Toaster-BOW9rzLq.js → Toaster-79DvOW80.js} +8 -8
- package/dist/{Toaster-BOW9rzLq.js.map → Toaster-79DvOW80.js.map} +1 -1
- package/dist/{Toaster-DYGo92ke.cjs → Toaster-lonArt-H.cjs} +2 -2
- package/dist/{Toaster-DYGo92ke.cjs.map → Toaster-lonArt-H.cjs.map} +1 -1
- package/dist/{TranslatedFields-C_DuLotV.cjs → TranslatedFields-BYpMrYaw.cjs} +2 -2
- package/dist/{TranslatedFields-C_DuLotV.cjs.map → TranslatedFields-BYpMrYaw.cjs.map} +1 -1
- package/dist/{TranslatedFields-CcE0td9p.js → TranslatedFields-CHHtXO_n.js} +9 -9
- package/dist/{TranslatedFields-CcE0td9p.js.map → TranslatedFields-CHHtXO_n.js.map} +1 -1
- package/dist/{UserCard-DeONbaKj.js → UserCard-BJFNP_nl.js} +3 -3
- package/dist/{UserCard-DeONbaKj.js.map → UserCard-BJFNP_nl.js.map} +1 -1
- package/dist/{UserCard-DLVptkLr.cjs → UserCard-SlkCgZS9.cjs} +2 -2
- package/dist/{UserCard-DLVptkLr.cjs.map → UserCard-SlkCgZS9.cjs.map} +1 -1
- package/dist/app/AdminRoot.d.cts +9 -4
- package/dist/app/AdminRoot.d.ts +9 -4
- package/dist/auth/AuthGuard.d.cts +9 -3
- package/dist/auth/AuthGuard.d.ts +9 -3
- package/dist/auth/authLayoutRoute.d.cts +11 -3
- package/dist/auth/authLayoutRoute.d.ts +11 -3
- package/dist/auth/authRedirect.d.cts +64 -0
- package/dist/auth/authRedirect.d.ts +64 -0
- package/dist/authLayoutRoute-DCG9gCZ8.cjs +2 -0
- package/dist/authLayoutRoute-DCG9gCZ8.cjs.map +1 -0
- package/dist/authLayoutRoute-TuEqVizw.js +15 -0
- package/dist/authLayoutRoute-TuEqVizw.js.map +1 -0
- 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/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/ImageEditor/index.cjs +1 -1
- package/dist/components/ImageEditor/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/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/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/auth.cjs +1 -1
- package/dist/entries/auth.d.cts +1 -0
- package/dist/entries/auth.d.ts +1 -0
- package/dist/entries/auth.js +7 -4
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +52 -52
- 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 +1 -1
- package/dist/entries/theme.d.ts +1 -1
- package/dist/entries/theme.js +20 -18
- package/dist/index.cjs +1 -1
- package/dist/index.js +259 -254
- package/dist/theme/ConfigProvider.d.cts +17 -0
- package/dist/theme/ConfigProvider.d.ts +17 -0
- package/dist/theme/index.d.cts +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/{useHomeTo-BL3e8Sc6.js → useHomeTo-BLSvhJd5.js} +2 -2
- package/dist/{useHomeTo-BL3e8Sc6.js.map → useHomeTo-BLSvhJd5.js.map} +1 -1
- package/dist/{useHomeTo-W1PDW5CU.cjs → useHomeTo-cXCg1tf0.cjs} +2 -2
- package/dist/{useHomeTo-W1PDW5CU.cjs.map → useHomeTo-cXCg1tf0.cjs.map} +1 -1
- package/dist/{useOptionMenu-CVl7VHXl.cjs → useOptionMenu-6ZffgbYG.cjs} +2 -2
- package/dist/{useOptionMenu-CVl7VHXl.cjs.map → useOptionMenu-6ZffgbYG.cjs.map} +1 -1
- package/dist/{useOptionMenu-BkKiZ6Ax.js → useOptionMenu-CxM6FHXL.js} +3 -3
- package/dist/{useOptionMenu-BkKiZ6Ax.js.map → useOptionMenu-CxM6FHXL.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminRoot-BZ1v5vN9.js +0 -101
- package/dist/AdminRoot-BZ1v5vN9.js.map +0 -1
- package/dist/AdminRoot-DJ4-UMAB.cjs +0 -2
- package/dist/AdminRoot-DJ4-UMAB.cjs.map +0 -1
- package/dist/AuthGuard-CVklwDbj.js +0 -7
- package/dist/AuthGuard-CVklwDbj.js.map +0 -1
- package/dist/AuthGuard-kfOZviar.cjs +0 -2
- package/dist/AuthGuard-kfOZviar.cjs.map +0 -1
- package/dist/ConfigProvider-DBU6rOIA.cjs +0 -2
- package/dist/ConfigProvider-DBU6rOIA.cjs.map +0 -1
- package/dist/ConfigProvider-DVDGtCUc.js +0 -386
- package/dist/ConfigProvider-DVDGtCUc.js.map +0 -1
- package/dist/authLayoutRoute-B10sXioW.js +0 -11
- package/dist/authLayoutRoute-B10sXioW.js.map +0 -1
- package/dist/authLayoutRoute-BVQ4LhuU.cjs +0 -2
- package/dist/authLayoutRoute-BVQ4LhuU.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneField-Df3J6Hhg.cjs","sources":["../src/components/PhoneField/phone.ts","../src/components/PhoneField/PhoneField.tsx"],"sourcesContent":["import type * as PhoneLibModule from 'libphonenumber-js'\nimport type { CountryCode } from 'libphonenumber-js'\nimport { optionalPeer } from '../../hooks/useOptionalPeer'\n\n/**\n * `libphonenumber-js` is an optional peer, loaded **lazily** (see `optionalPeer`) — never imported\n * statically, so apps that don't install it still build + run when they import the barrel. PhoneField\n * waits for it on mount; the helpers below run only once it's loaded (`lib()`).\n */\nexport const phonePeer = optionalPeer<typeof PhoneLibModule>(\n 'libphonenumber-js',\n 'PhoneField',\n () => import('libphonenumber-js'),\n)\nconst lib = () => phonePeer.get()!\n\n/** An ISO-3166 alpha-2 country code, as `libphonenumber-js` knows it (`'GE'`, `'US'`, …). */\nexport type PhoneCountry = CountryCode\n/** How the number is shown in the input while typing (the value is always E.164). */\nexport type PhoneFormat = 'national' | 'international'\n\nlet allCountries: readonly PhoneCountry[] | undefined\n/** Every country `libphonenumber-js` has metadata for (once loaded). */\nexport function getPhoneCountries(): readonly PhoneCountry[] {\n return (allCountries ??= lib().getCountries())\n}\n\n/** The country's calling code without the `+` — `'GE'` → `'995'`. */\nexport const callingCodeOf = (country: PhoneCountry): string => lib().getCountryCallingCode(country)\n\n/**\n * `true` for a complete, valid number (E.164 or any parseable international form). Use it in a schema:\n * `phone: z.string().refine(isValidPhone, 'Enter a valid phone number')`. Needs `libphonenumber-js`\n * loaded — it is once any PhoneField has mounted; before that it starts the load and returns `false`.\n */\nexport function isValidPhone(value: unknown): boolean {\n const loaded = phonePeer.get()\n // not loaded yet (no PhoneField mounted so far) → start loading and report \"not valid\" for now\n if (!loaded) {\n void phonePeer.load()\n return false\n }\n return typeof value === 'string' && value.trim() !== '' && loaded.isValidPhoneNumber(value)\n}\n\n/** A flag emoji from the two regional-indicator letters — no image assets (Windows shows the letters). */\nexport function flagEmoji(country: string): string {\n return String.fromCodePoint(\n ...[...country.toUpperCase()].map((c) => 0x1f1e6 + c.charCodeAt(0) - 65),\n )\n}\n\nconst displayNamesCache = new Map<string, Intl.DisplayNames | null>()\n/** The country's name in `locale` via `Intl.DisplayNames` (no catalog to ship); falls back to the code. */\nexport function countryName(country: string, locale: string): string {\n if (!displayNamesCache.has(locale)) {\n try {\n displayNamesCache.set(locale, new Intl.DisplayNames([locale], { type: 'region' }))\n } catch {\n displayNamesCache.set(locale, null)\n }\n }\n try {\n return displayNamesCache.get(locale)?.of(country) ?? country\n } catch {\n return country\n }\n}\n\n// the main country for a calling code shared by several (a partial \"+44…\" parses as Guernsey otherwise)\nconst MAIN_FOR_CODE: Record<string, PhoneCountry> = {\n '1': 'US',\n '7': 'RU',\n '39': 'IT',\n '44': 'GB',\n '47': 'NO',\n '61': 'AU',\n '212': 'MA',\n '262': 'RE',\n '290': 'SH',\n '358': 'FI',\n '590': 'GP',\n '599': 'CW',\n}\n// base UI language → its usual country, for the default when the locale carries no region\nconst LANGUAGE_COUNTRY: Record<string, PhoneCountry> = {\n ka: 'GE',\n en: 'US',\n es: 'ES',\n de: 'DE',\n it: 'IT',\n fr: 'FR',\n ru: 'RU',\n}\n\n/** The default country: the locale's region → its language's usual country → the browser's region → US. */\nexport function detectCountry(locale: string, allowed: readonly PhoneCountry[]): PhoneCountry {\n const [base, region] = locale.split('-')\n const browser =\n typeof navigator !== 'undefined' ? navigator.language?.split('-')[1]?.toUpperCase() : undefined\n const candidates = [region?.toUpperCase(), LANGUAGE_COUNTRY[base?.toLowerCase()], browser, 'US']\n return (candidates.find((c) => c && allowed.includes(c as PhoneCountry)) ??\n allowed[0]) as PhoneCountry\n}\n\n/** The result of reading what's in the input. */\nexport interface PhoneReading {\n /** The canonical value — `'+995555123456'`, or `''` when empty. */\n e164: string\n /** The country the number belongs to (may switch when a `+code` is typed). */\n country: PhoneCountry\n /** The national significant number — digits only, no trunk `0`. */\n national: string\n /** A complete, valid number. */\n valid: boolean\n /** What the input should show (formatted as you type). */\n display: string\n}\n\nconst digitsOf = (s: string) => s.replace(/\\D/g, '')\n\n/** Which allowed country a `+code…` number belongs to — keep the current one when it shares the code. */\nfunction countryForCode(\n code: string,\n current: PhoneCountry,\n detected: PhoneCountry | undefined,\n allowed: readonly PhoneCountry[],\n): PhoneCountry {\n if (callingCodeOf(current) === code) return current\n const pick = [detected, MAIN_FOR_CODE[code], ...allowed.filter((c) => callingCodeOf(c) === code)]\n return (pick.find((c) => c && allowed.includes(c)) as PhoneCountry | undefined) ?? current\n}\n\n/** Read raw input text → the canonical value + the formatted display, as the user types. */\nexport function readPhoneInput(\n raw: string,\n country: PhoneCountry,\n format: PhoneFormat,\n allowed: readonly PhoneCountry[],\n): PhoneReading {\n const text = raw.trimStart()\n const digits = digitsOf(text)\n if (!digits) {\n return {\n e164: '',\n country,\n national: '',\n valid: false,\n display: text.startsWith('+') ? '+' : '',\n }\n }\n\n // an explicit \"+code…\" (typed or pasted) — the calling code decides the country\n if (text.startsWith('+')) {\n const typer = new (lib().AsYouType)()\n const display = typer.input(`+${digits}`)\n const code = typer.getCallingCode()\n const parsed = lib().parsePhoneNumberFromString(`+${digits}`)\n const next = code\n ? countryForCode(code, country, parsed?.country ?? typer.getCountry(), allowed)\n : country\n const e164 = `+${digits}`\n return {\n e164,\n country: next,\n national: code ? digits.slice(code.length) : '',\n valid: lib().isValidPhoneNumber(e164),\n display,\n }\n }\n\n // national digits under the selected country (a leading trunk \"0\" is dropped from the value)\n const code = callingCodeOf(country)\n const parsed = lib().parsePhoneNumberFromString(digits, country)\n const national = parsed?.nationalNumber ?? digits.replace(/^0+/, '')\n const e164 = national ? `+${code}${national}` : ''\n const display =\n format === 'international'\n ? new (lib().AsYouType)(country).input(`+${code}${national}`)\n : new (lib().AsYouType)(country).input(digits)\n return {\n e164,\n country,\n national,\n valid: e164 !== '' && lib().isValidPhoneNumber(e164),\n display,\n }\n}\n\n/** Derive the country + display from an E.164 value (initial / external value changes). */\nexport function phoneFromValue(\n value: string,\n fallback: PhoneCountry,\n format: PhoneFormat,\n allowed: readonly PhoneCountry[],\n): { country: PhoneCountry; display: string } {\n if (!value) return { country: fallback, display: '' }\n const parsed = lib().parsePhoneNumberFromString(value)\n if (parsed) {\n const country = countryForCode(parsed.countryCallingCode, fallback, parsed.country, allowed)\n return {\n country,\n display: format === 'national' ? parsed.formatNational() : parsed.formatInternational(),\n }\n }\n const reading = readPhoneInput(value, fallback, 'international', allowed)\n const display =\n format === 'national' && reading.national\n ? new (lib().AsYouType)(reading.country).input(reading.national)\n : reading.display\n return { country: reading.country, display }\n}\n\n/** Caret index in `display` right after its `n`-th digit — keeps the caret put while reformatting. */\nexport function caretAfterDigits(display: string, n: number): number {\n if (n <= 0) return display.startsWith('+') ? 1 : 0\n let seen = 0\n for (let i = 0; i < display.length; i++) {\n if (/\\d/.test(display[i])) seen++\n if (seen === n) return i + 1\n }\n return display.length\n}\n","import {\n forwardRef,\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useLanguage, useT } from '../../theme'\nimport { useOptionalPeer } from '../../hooks/useOptionalPeer'\nimport { useFormContext } from '../../form/formContext'\nimport { Icon } from '../Icon'\nimport { TextField } from '../TextField'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu, type SelectOption } from '../OptionMenu/useOptionMenu'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport {\n callingCodeOf,\n getPhoneCountries,\n caretAfterDigits,\n countryName,\n detectCountry,\n flagEmoji,\n phoneFromValue,\n phonePeer,\n readPhoneInput,\n type PhoneCountry,\n type PhoneFormat,\n} from './phone'\nimport styles from './PhoneField.module.css'\n\nexport type PhoneFieldSize = 'sm' | 'md' | 'lg'\n\n/** Extra details handed to `onChange` alongside the E.164 value. */\nexport interface PhoneFieldChangeMeta {\n /** The number's country (ISO alpha-2). */\n country: PhoneCountry\n /** The national significant number — digits only, no trunk `0`. */\n national: string\n /** A complete, valid number for that country. */\n valid: boolean\n}\n\nexport interface PhoneFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'value' | 'defaultValue' | 'onChange' | 'type' | 'size' | 'color'\n> {\n /** The number in **E.164** (`'+995555123456'`) — the only form the field emits. `''` when empty. */\n value?: string\n /** Initial E.164 value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the E.164 value (`''` when cleared) and `{ country, national, valid }`. */\n onChange?: (value: string, meta: PhoneFieldChangeMeta) => void\n /** The country to start with. Defaults to one derived from the UI language / browser locale. */\n defaultCountry?: PhoneCountry\n /** Restrict the selectable countries (e.g. only where you operate). Defaults to all. */\n countries?: readonly PhoneCountry[]\n /** Countries pinned to the top of the list, in this order. */\n preferredCountries?: readonly PhoneCountry[]\n /**\n * How the number reads while typing — `national` (default: `555 12 34 56`, the calling code lives in\n * the country button) or `international` (`+995 555 12 34 56`). The value is E.164 either way.\n */\n format?: PhoneFormat\n /** Field label. */\n label?: ReactNode\n /** Helper / validation text under the field. */\n helperText?: ReactNode\n /** Error state (red border + helper). */\n error?: boolean\n /** Shows a required asterisk. */\n required?: boolean\n /** `sm` / `md` / `lg` — control height + type. Defaults to `md`. */\n size?: PhoneFieldSize\n /** Stretch to the container. Defaults to `true`. */\n fullWidth?: boolean\n}\n\n/** The field itself — rendered once `libphonenumber-js` has loaded. */\nconst PhoneFieldInner = forwardRef<HTMLInputElement, PhoneFieldProps>(function PhoneFieldInner(\n {\n value,\n defaultValue,\n onChange,\n defaultCountry,\n countries: countriesProp,\n preferredCountries = [],\n format = 'national',\n label,\n helperText,\n error,\n required,\n size = 'md',\n fullWidth = true,\n name,\n disabled = false,\n id: idProp,\n className,\n style,\n onBlur,\n placeholder,\n ...props\n },\n ref,\n) {\n const t = useT()\n const { language } = useLanguage()\n const countries = countriesProp ?? getPhoneCountries()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // ── value: controlled / form-bound / uncontrolled — always E.164 ──\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const [internal, setInternal] = useState(defaultValue ?? '')\n const currentValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : internal\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const fallbackCountry = useMemo<PhoneCountry>(\n () =>\n defaultCountry && countries.includes(defaultCountry)\n ? defaultCountry\n : detectCountry(language, countries),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [defaultCountry, language, countries.join()],\n )\n\n const [country, setCountry] = useState<PhoneCountry>(\n () => phoneFromValue(currentValue, fallbackCountry, format, countries).country,\n )\n const [display, setDisplay] = useState(\n () => phoneFromValue(currentValue, fallbackCountry, format, countries).display,\n )\n\n // re-derive the display when the value changes from OUTSIDE (a reset / a controlled update) — the\n // values we emit ourselves are skipped, so formatting never fights the user mid-typing\n const lastEmitted = useRef(currentValue)\n if (lastEmitted.current !== currentValue) {\n lastEmitted.current = currentValue\n const next = phoneFromValue(currentValue, country, format, countries)\n setCountry(next.country)\n setDisplay(next.display)\n }\n\n // caret restore after reformatting\n const innerRef = useRef<HTMLInputElement | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n const pendingCaret = useRef<number | null>(null)\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const emit = (reading: ReturnType<typeof readPhoneInput>) => {\n lastEmitted.current = reading.e164\n setDisplay(reading.display)\n if (reading.country !== country) setCountry(reading.country)\n if (value === undefined && !isFormBound) setInternal(reading.e164)\n if (isFormBound) form!.setValue(name!, reading.e164)\n onChange?.(reading.e164, {\n country: reading.country,\n national: reading.national,\n valid: reading.valid,\n })\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n let raw = el.value\n const caret = el.selectionStart ?? raw.length\n let digitsBefore = raw.slice(0, caret).replace(/\\D/g, '').length\n // backspace over a formatting char (space / paren / dash) would be re-added by the formatter —\n // treat it as deleting the digit before it instead\n const prevDigits = display.replace(/\\D/g, '')\n if (raw.length < display.length && raw.replace(/\\D/g, '') === prevDigits && digitsBefore > 0) {\n let seen = 0\n let cut = -1\n for (let i = 0; i < raw.length; i++) {\n if (/\\d/.test(raw[i]) && ++seen === digitsBefore) {\n cut = i\n break\n }\n }\n if (cut >= 0) raw = raw.slice(0, cut) + raw.slice(cut + 1)\n digitsBefore -= 1\n }\n const reading = readPhoneInput(raw, country, format, countries)\n pendingCaret.current =\n caret >= el.value.length\n ? reading.display.length\n : caretAfterDigits(reading.display, digitsBefore)\n emit(reading)\n }\n\n // ── country picker — the shared option menu (search matches name, ISO code, calling code) ──\n const controlRef = useRef<HTMLDivElement | null>(null)\n const countryOptions = useMemo<SelectOption[]>(() => {\n const toOption = (c: PhoneCountry): SelectOption => {\n const dial = callingCodeOf(c)\n return {\n value: c,\n label: countryName(c, language),\n icon: (\n <span className={styles.flag} aria-hidden=\"true\">\n {flagEmoji(c)}\n </span>\n ),\n keywords: [c, dial, `+${dial}`],\n trailing: <span className={styles.dial}>+{dial}</span>,\n }\n }\n // preferred countries first (in the given order), then the rest A→Z by their localized name —\n // as two groups (\"Suggested\" / \"All Countries\") when there are preferred ones\n const pinned = preferredCountries.filter((c) => countries.includes(c)).map(toOption)\n const rest = countries\n .filter((c) => !preferredCountries.includes(c))\n .map(toOption)\n .sort((a, b) => a.label.localeCompare(b.label, language))\n if (pinned.length === 0) return rest\n return [\n ...pinned.map((o) => ({ ...o, group: t('phoneField.suggested') })),\n ...rest.map((o) => ({ ...o, group: t('phoneField.allCountries') })),\n ]\n }, [countries, preferredCountries, language, t])\n\n const pickCountry = (next: PhoneCountry) => {\n // keep the typed national digits, re-read under the new calling code\n const national = readPhoneInput(display, country, format, countries).national\n setCountry(next)\n emit({ ...readPhoneInput(national, next, format, countries), country: next })\n }\n\n const menu = useOptionMenu({\n idBase: `${id}-country`,\n options: countryOptions,\n isSelected: (o) => o.value === country,\n onPick: (o) => pickCountry(o.value as PhoneCountry),\n searchable: true,\n disabled,\n // after a pick / Esc, typing continues in the number\n focusRef: innerRef,\n })\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const describedBy = resolvedHelperText != null ? helperId : undefined\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n const code = callingCodeOf(country)\n const name_ = countryName(country, language)\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n styles.phoneField,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={controlRef} className={clsx(fieldStyles.control, styles.control)}>\n <button\n type=\"button\"\n className={styles.country}\n aria-haspopup=\"listbox\"\n aria-expanded={menu.open}\n aria-controls={menu.open ? menu.listboxId : undefined}\n aria-label={`${t('phoneField.country')}: ${name_} (+${code})`}\n disabled={disabled}\n onClick={menu.toggleMenu}\n onKeyDown={(e) => {\n // ↓ / ↑ open the list (Enter / Space already click the button)\n if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !menu.open) {\n e.preventDefault()\n menu.openMenu()\n }\n }}\n >\n <span className={styles.flag} aria-hidden=\"true\">\n {flagEmoji(country)}\n </span>\n {format === 'national' && <span className={styles.code}>+{code}</span>}\n {/* the same chevron as Select / MultiSelect (ArrowDown4, sized per field size: sm 16 · md 14 · lg 12) */}\n <Icon\n name=\"ArrowDown4\"\n className={clsx(styles.chevron, menu.open && styles.chevronOpen)}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </button>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel\"\n className={fieldStyles.input}\n value={display}\n placeholder={placeholder}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={describedBy}\n {...props}\n />\n </div>\n\n <OptionMenu\n menu={menu}\n anchorRef={controlRef}\n size={size}\n searchPlaceholder={t('phoneField.search')}\n ariaLabel={t('phoneField.country')}\n />\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n\n/**\n * A phone-number field: a **country button** (flag + `+code`, opening a searchable, localized country\n * list) inside the input frame, and the number **formatted as you type** for that country. The value is\n * always **E.164** (`'+995555123456'`) — one canonical form for the backend. Typing or pasting `+44…`\n * switches the country by its calling code. `onChange(value, { country, national, valid })`; binds to a\n * `<Form>` by `name` (the form value is the E.164 string — validate with `isValidPhone`). Country names\n * come from `Intl.DisplayNames` in the active UI language; flags are emoji. Needs the optional peer\n * **`libphonenumber-js`** (formatting, parsing, validation metadata), loaded lazily on first mount — until\n * it's ready (or if it isn't installed) a disabled look-alike field renders. Reuses the `TextField` look.\n */\nexport const PhoneField = forwardRef<HTMLInputElement, PhoneFieldProps>(\n function PhoneField(props, ref) {\n const { module } = useOptionalPeer(phonePeer)\n if (module) return <PhoneFieldInner ref={ref} {...props} />\n // loading (a tick, first mount only) or the peer is missing: the same frame, disabled — never bound\n // to a <Form> (no `name`) so it can't write a value\n const {\n label,\n helperText,\n error,\n required,\n size,\n fullWidth = true,\n className,\n style,\n placeholder,\n } = props\n return (\n <TextField\n ref={ref}\n type=\"tel\"\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n size={size}\n fullWidth={fullWidth}\n className={className}\n style={style}\n placeholder={placeholder}\n value={props.value ?? props.defaultValue ?? ''}\n readOnly\n disabled\n />\n )\n },\n)\n"],"names":["phonePeer","optionalPeer","lib","allCountries","getPhoneCountries","callingCodeOf","country","isValidPhone","value","loaded","flagEmoji","c","displayNamesCache","countryName","locale","_a","MAIN_FOR_CODE","LANGUAGE_COUNTRY","detectCountry","allowed","base","region","browser","_b","digitsOf","s","countryForCode","code","current","detected","readPhoneInput","raw","format","text","digits","typer","display","parsed","next","e164","national","phoneFromValue","fallback","reading","caretAfterDigits","n","seen","i","PhoneFieldInner","forwardRef","defaultValue","onChange","defaultCountry","countriesProp","preferredCountries","label","helperText","error","required","size","fullWidth","name","disabled","idProp","className","style","onBlur","placeholder","props","ref","t","useT","language","useLanguage","countries","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","fallbackCountry","useMemo","setCountry","setDisplay","lastEmitted","useRef","innerRef","setInputRef","useCallback","node","pendingCaret","useLayoutEffect","pos","emit","handleChange","event","el","caret","digitsBefore","prevDigits","cut","controlRef","countryOptions","toOption","dial","jsx","styles","jsxs","pinned","rest","a","b","o","pickCountry","menu","useOptionMenu","handleBlur","describedBy","chevronPx","name_","clsx","fieldStyles","Typography","e","Icon","OptionMenu","PhoneField","module","useOptionalPeer","TextField"],"mappings":"63BASaA,EAAYC,GAAAA,aACvB,oBACA,aACA,IAAM,OAAO,mBAAmB,CAClC,EACMC,EAAM,IAAMF,EAAU,IAAA,EAO5B,IAAIG,GAEG,SAASC,IAA6C,CAC3D,OAAQD,QAAiBD,EAAA,EAAM,aAAA,EACjC,CAGO,MAAMG,EAAiBC,GAAkCJ,EAAA,EAAM,sBAAsBI,CAAO,EAO5F,SAASC,GAAaC,EAAyB,CACpD,MAAMC,EAAST,EAAU,IAAA,EAEzB,OAAKS,EAIE,OAAOD,GAAU,UAAYA,EAAM,SAAW,IAAMC,EAAO,mBAAmBD,CAAK,GAHnFR,EAAU,KAAA,EACR,GAGX,CAGO,SAASU,GAAUJ,EAAyB,CACjD,OAAO,OAAO,cACZ,GAAG,CAAC,GAAGA,EAAQ,aAAa,EAAE,IAAKK,GAAM,OAAUA,EAAE,WAAW,CAAC,EAAI,EAAE,CAAA,CAE3E,CAEA,MAAMC,MAAwB,IAEvB,SAASC,GAAYP,EAAiBQ,EAAwB,OACnE,GAAI,CAACF,EAAkB,IAAIE,CAAM,EAC/B,GAAI,CACFF,EAAkB,IAAIE,EAAQ,IAAI,KAAK,aAAa,CAACA,CAAM,EAAG,CAAE,KAAM,QAAA,CAAU,CAAC,CACnF,MAAQ,CACNF,EAAkB,IAAIE,EAAQ,IAAI,CACpC,CAEF,GAAI,CACF,QAAOC,EAAAH,EAAkB,IAAIE,CAAM,IAA5B,YAAAC,EAA+B,GAAGT,KAAYA,CACvD,MAAQ,CACN,OAAOA,CACT,CACF,CAGA,MAAMU,GAA8C,CAClD,EAAK,KACL,EAAK,KACL,GAAM,KACN,GAAM,KACN,GAAM,KACN,GAAM,KACN,IAAO,KACP,IAAO,KACP,IAAO,KACP,IAAO,KACP,IAAO,KACP,I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,UAAAI,EACA,MAAAC,EACA,YAAAE,CAAA,EACEC,EACJ,OACE8C,EAAAA,IAACwB,GAAAA,UAAA,CACC,IAAArE,EACA,KAAK,MACL,MAAAd,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EACA,KAAAC,EACA,UAAAC,EACA,UAAAI,EACA,MAAAC,EACA,YAAAE,EACA,MAAOC,EAAM,OAASA,EAAM,cAAgB,GAC5C,SAAQ,GACR,SAAQ,EAAA,CAAA,CAGd,CACF"}
|
|
1
|
+
{"version":3,"file":"PhoneField-jq-3_i_b.cjs","sources":["../src/components/PhoneField/phone.ts","../src/components/PhoneField/PhoneField.tsx"],"sourcesContent":["import type * as PhoneLibModule from 'libphonenumber-js'\nimport type { CountryCode } from 'libphonenumber-js'\nimport { optionalPeer } from '../../hooks/useOptionalPeer'\n\n/**\n * `libphonenumber-js` is an optional peer, loaded **lazily** (see `optionalPeer`) — never imported\n * statically, so apps that don't install it still build + run when they import the barrel. PhoneField\n * waits for it on mount; the helpers below run only once it's loaded (`lib()`).\n */\nexport const phonePeer = optionalPeer<typeof PhoneLibModule>(\n 'libphonenumber-js',\n 'PhoneField',\n () => import('libphonenumber-js'),\n)\nconst lib = () => phonePeer.get()!\n\n/** An ISO-3166 alpha-2 country code, as `libphonenumber-js` knows it (`'GE'`, `'US'`, …). */\nexport type PhoneCountry = CountryCode\n/** How the number is shown in the input while typing (the value is always E.164). */\nexport type PhoneFormat = 'national' | 'international'\n\nlet allCountries: readonly PhoneCountry[] | undefined\n/** Every country `libphonenumber-js` has metadata for (once loaded). */\nexport function getPhoneCountries(): readonly PhoneCountry[] {\n return (allCountries ??= lib().getCountries())\n}\n\n/** The country's calling code without the `+` — `'GE'` → `'995'`. */\nexport const callingCodeOf = (country: PhoneCountry): string => lib().getCountryCallingCode(country)\n\n/**\n * `true` for a complete, valid number (E.164 or any parseable international form). Use it in a schema:\n * `phone: z.string().refine(isValidPhone, 'Enter a valid phone number')`. Needs `libphonenumber-js`\n * loaded — it is once any PhoneField has mounted; before that it starts the load and returns `false`.\n */\nexport function isValidPhone(value: unknown): boolean {\n const loaded = phonePeer.get()\n // not loaded yet (no PhoneField mounted so far) → start loading and report \"not valid\" for now\n if (!loaded) {\n void phonePeer.load()\n return false\n }\n return typeof value === 'string' && value.trim() !== '' && loaded.isValidPhoneNumber(value)\n}\n\n/** A flag emoji from the two regional-indicator letters — no image assets (Windows shows the letters). */\nexport function flagEmoji(country: string): string {\n return String.fromCodePoint(\n ...[...country.toUpperCase()].map((c) => 0x1f1e6 + c.charCodeAt(0) - 65),\n )\n}\n\nconst displayNamesCache = new Map<string, Intl.DisplayNames | null>()\n/** The country's name in `locale` via `Intl.DisplayNames` (no catalog to ship); falls back to the code. */\nexport function countryName(country: string, locale: string): string {\n if (!displayNamesCache.has(locale)) {\n try {\n displayNamesCache.set(locale, new Intl.DisplayNames([locale], { type: 'region' }))\n } catch {\n displayNamesCache.set(locale, null)\n }\n }\n try {\n return displayNamesCache.get(locale)?.of(country) ?? country\n } catch {\n return country\n }\n}\n\n// the main country for a calling code shared by several (a partial \"+44…\" parses as Guernsey otherwise)\nconst MAIN_FOR_CODE: Record<string, PhoneCountry> = {\n '1': 'US',\n '7': 'RU',\n '39': 'IT',\n '44': 'GB',\n '47': 'NO',\n '61': 'AU',\n '212': 'MA',\n '262': 'RE',\n '290': 'SH',\n '358': 'FI',\n '590': 'GP',\n '599': 'CW',\n}\n// base UI language → its usual country, for the default when the locale carries no region\nconst LANGUAGE_COUNTRY: Record<string, PhoneCountry> = {\n ka: 'GE',\n en: 'US',\n es: 'ES',\n de: 'DE',\n it: 'IT',\n fr: 'FR',\n ru: 'RU',\n}\n\n/** The default country: the locale's region → its language's usual country → the browser's region → US. */\nexport function detectCountry(locale: string, allowed: readonly PhoneCountry[]): PhoneCountry {\n const [base, region] = locale.split('-')\n const browser =\n typeof navigator !== 'undefined' ? navigator.language?.split('-')[1]?.toUpperCase() : undefined\n const candidates = [region?.toUpperCase(), LANGUAGE_COUNTRY[base?.toLowerCase()], browser, 'US']\n return (candidates.find((c) => c && allowed.includes(c as PhoneCountry)) ??\n allowed[0]) as PhoneCountry\n}\n\n/** The result of reading what's in the input. */\nexport interface PhoneReading {\n /** The canonical value — `'+995555123456'`, or `''` when empty. */\n e164: string\n /** The country the number belongs to (may switch when a `+code` is typed). */\n country: PhoneCountry\n /** The national significant number — digits only, no trunk `0`. */\n national: string\n /** A complete, valid number. */\n valid: boolean\n /** What the input should show (formatted as you type). */\n display: string\n}\n\nconst digitsOf = (s: string) => s.replace(/\\D/g, '')\n\n/** Which allowed country a `+code…` number belongs to — keep the current one when it shares the code. */\nfunction countryForCode(\n code: string,\n current: PhoneCountry,\n detected: PhoneCountry | undefined,\n allowed: readonly PhoneCountry[],\n): PhoneCountry {\n if (callingCodeOf(current) === code) return current\n const pick = [detected, MAIN_FOR_CODE[code], ...allowed.filter((c) => callingCodeOf(c) === code)]\n return (pick.find((c) => c && allowed.includes(c)) as PhoneCountry | undefined) ?? current\n}\n\n/** Read raw input text → the canonical value + the formatted display, as the user types. */\nexport function readPhoneInput(\n raw: string,\n country: PhoneCountry,\n format: PhoneFormat,\n allowed: readonly PhoneCountry[],\n): PhoneReading {\n const text = raw.trimStart()\n const digits = digitsOf(text)\n if (!digits) {\n return {\n e164: '',\n country,\n national: '',\n valid: false,\n display: text.startsWith('+') ? '+' : '',\n }\n }\n\n // an explicit \"+code…\" (typed or pasted) — the calling code decides the country\n if (text.startsWith('+')) {\n const typer = new (lib().AsYouType)()\n const display = typer.input(`+${digits}`)\n const code = typer.getCallingCode()\n const parsed = lib().parsePhoneNumberFromString(`+${digits}`)\n const next = code\n ? countryForCode(code, country, parsed?.country ?? typer.getCountry(), allowed)\n : country\n const e164 = `+${digits}`\n return {\n e164,\n country: next,\n national: code ? digits.slice(code.length) : '',\n valid: lib().isValidPhoneNumber(e164),\n display,\n }\n }\n\n // national digits under the selected country (a leading trunk \"0\" is dropped from the value)\n const code = callingCodeOf(country)\n const parsed = lib().parsePhoneNumberFromString(digits, country)\n const national = parsed?.nationalNumber ?? digits.replace(/^0+/, '')\n const e164 = national ? `+${code}${national}` : ''\n const display =\n format === 'international'\n ? new (lib().AsYouType)(country).input(`+${code}${national}`)\n : new (lib().AsYouType)(country).input(digits)\n return {\n e164,\n country,\n national,\n valid: e164 !== '' && lib().isValidPhoneNumber(e164),\n display,\n }\n}\n\n/** Derive the country + display from an E.164 value (initial / external value changes). */\nexport function phoneFromValue(\n value: string,\n fallback: PhoneCountry,\n format: PhoneFormat,\n allowed: readonly PhoneCountry[],\n): { country: PhoneCountry; display: string } {\n if (!value) return { country: fallback, display: '' }\n const parsed = lib().parsePhoneNumberFromString(value)\n if (parsed) {\n const country = countryForCode(parsed.countryCallingCode, fallback, parsed.country, allowed)\n return {\n country,\n display: format === 'national' ? parsed.formatNational() : parsed.formatInternational(),\n }\n }\n const reading = readPhoneInput(value, fallback, 'international', allowed)\n const display =\n format === 'national' && reading.national\n ? new (lib().AsYouType)(reading.country).input(reading.national)\n : reading.display\n return { country: reading.country, display }\n}\n\n/** Caret index in `display` right after its `n`-th digit — keeps the caret put while reformatting. */\nexport function caretAfterDigits(display: string, n: number): number {\n if (n <= 0) return display.startsWith('+') ? 1 : 0\n let seen = 0\n for (let i = 0; i < display.length; i++) {\n if (/\\d/.test(display[i])) seen++\n if (seen === n) return i + 1\n }\n return display.length\n}\n","import {\n forwardRef,\n useCallback,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type CSSProperties,\n type FocusEvent,\n type InputHTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useLanguage, useT } from '../../theme'\nimport { useOptionalPeer } from '../../hooks/useOptionalPeer'\nimport { useFormContext } from '../../form/formContext'\nimport { Icon } from '../Icon'\nimport { TextField } from '../TextField'\nimport { OptionMenu } from '../OptionMenu/OptionMenu'\nimport { useOptionMenu, type SelectOption } from '../OptionMenu/useOptionMenu'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport {\n callingCodeOf,\n getPhoneCountries,\n caretAfterDigits,\n countryName,\n detectCountry,\n flagEmoji,\n phoneFromValue,\n phonePeer,\n readPhoneInput,\n type PhoneCountry,\n type PhoneFormat,\n} from './phone'\nimport styles from './PhoneField.module.css'\n\nexport type PhoneFieldSize = 'sm' | 'md' | 'lg'\n\n/** Extra details handed to `onChange` alongside the E.164 value. */\nexport interface PhoneFieldChangeMeta {\n /** The number's country (ISO alpha-2). */\n country: PhoneCountry\n /** The national significant number — digits only, no trunk `0`. */\n national: string\n /** A complete, valid number for that country. */\n valid: boolean\n}\n\nexport interface PhoneFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n 'value' | 'defaultValue' | 'onChange' | 'type' | 'size' | 'color'\n> {\n /** The number in **E.164** (`'+995555123456'`) — the only form the field emits. `''` when empty. */\n value?: string\n /** Initial E.164 value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the E.164 value (`''` when cleared) and `{ country, national, valid }`. */\n onChange?: (value: string, meta: PhoneFieldChangeMeta) => void\n /** The country to start with. Defaults to one derived from the UI language / browser locale. */\n defaultCountry?: PhoneCountry\n /** Restrict the selectable countries (e.g. only where you operate). Defaults to all. */\n countries?: readonly PhoneCountry[]\n /** Countries pinned to the top of the list, in this order. */\n preferredCountries?: readonly PhoneCountry[]\n /**\n * How the number reads while typing — `national` (default: `555 12 34 56`, the calling code lives in\n * the country button) or `international` (`+995 555 12 34 56`). The value is E.164 either way.\n */\n format?: PhoneFormat\n /** Field label. */\n label?: ReactNode\n /** Helper / validation text under the field. */\n helperText?: ReactNode\n /** Error state (red border + helper). */\n error?: boolean\n /** Shows a required asterisk. */\n required?: boolean\n /** `sm` / `md` / `lg` — control height + type. Defaults to `md`. */\n size?: PhoneFieldSize\n /** Stretch to the container. Defaults to `true`. */\n fullWidth?: boolean\n}\n\n/** The field itself — rendered once `libphonenumber-js` has loaded. */\nconst PhoneFieldInner = forwardRef<HTMLInputElement, PhoneFieldProps>(function PhoneFieldInner(\n {\n value,\n defaultValue,\n onChange,\n defaultCountry,\n countries: countriesProp,\n preferredCountries = [],\n format = 'national',\n label,\n helperText,\n error,\n required,\n size = 'md',\n fullWidth = true,\n name,\n disabled = false,\n id: idProp,\n className,\n style,\n onBlur,\n placeholder,\n ...props\n },\n ref,\n) {\n const t = useT()\n const { language } = useLanguage()\n const countries = countriesProp ?? getPhoneCountries()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n\n // ── value: controlled / form-bound / uncontrolled — always E.164 ──\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const [internal, setInternal] = useState(defaultValue ?? '')\n const currentValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : internal\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const fallbackCountry = useMemo<PhoneCountry>(\n () =>\n defaultCountry && countries.includes(defaultCountry)\n ? defaultCountry\n : detectCountry(language, countries),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [defaultCountry, language, countries.join()],\n )\n\n const [country, setCountry] = useState<PhoneCountry>(\n () => phoneFromValue(currentValue, fallbackCountry, format, countries).country,\n )\n const [display, setDisplay] = useState(\n () => phoneFromValue(currentValue, fallbackCountry, format, countries).display,\n )\n\n // re-derive the display when the value changes from OUTSIDE (a reset / a controlled update) — the\n // values we emit ourselves are skipped, so formatting never fights the user mid-typing\n const lastEmitted = useRef(currentValue)\n if (lastEmitted.current !== currentValue) {\n lastEmitted.current = currentValue\n const next = phoneFromValue(currentValue, country, format, countries)\n setCountry(next.country)\n setDisplay(next.display)\n }\n\n // caret restore after reformatting\n const innerRef = useRef<HTMLInputElement | null>(null)\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n innerRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n const pendingCaret = useRef<number | null>(null)\n useLayoutEffect(() => {\n const pos = pendingCaret.current\n if (pos == null) return\n pendingCaret.current = null\n innerRef.current?.setSelectionRange(pos, pos)\n })\n\n const emit = (reading: ReturnType<typeof readPhoneInput>) => {\n lastEmitted.current = reading.e164\n setDisplay(reading.display)\n if (reading.country !== country) setCountry(reading.country)\n if (value === undefined && !isFormBound) setInternal(reading.e164)\n if (isFormBound) form!.setValue(name!, reading.e164)\n onChange?.(reading.e164, {\n country: reading.country,\n national: reading.national,\n valid: reading.valid,\n })\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const el = event.target\n let raw = el.value\n const caret = el.selectionStart ?? raw.length\n let digitsBefore = raw.slice(0, caret).replace(/\\D/g, '').length\n // backspace over a formatting char (space / paren / dash) would be re-added by the formatter —\n // treat it as deleting the digit before it instead\n const prevDigits = display.replace(/\\D/g, '')\n if (raw.length < display.length && raw.replace(/\\D/g, '') === prevDigits && digitsBefore > 0) {\n let seen = 0\n let cut = -1\n for (let i = 0; i < raw.length; i++) {\n if (/\\d/.test(raw[i]) && ++seen === digitsBefore) {\n cut = i\n break\n }\n }\n if (cut >= 0) raw = raw.slice(0, cut) + raw.slice(cut + 1)\n digitsBefore -= 1\n }\n const reading = readPhoneInput(raw, country, format, countries)\n pendingCaret.current =\n caret >= el.value.length\n ? reading.display.length\n : caretAfterDigits(reading.display, digitsBefore)\n emit(reading)\n }\n\n // ── country picker — the shared option menu (search matches name, ISO code, calling code) ──\n const controlRef = useRef<HTMLDivElement | null>(null)\n const countryOptions = useMemo<SelectOption[]>(() => {\n const toOption = (c: PhoneCountry): SelectOption => {\n const dial = callingCodeOf(c)\n return {\n value: c,\n label: countryName(c, language),\n icon: (\n <span className={styles.flag} aria-hidden=\"true\">\n {flagEmoji(c)}\n </span>\n ),\n keywords: [c, dial, `+${dial}`],\n trailing: <span className={styles.dial}>+{dial}</span>,\n }\n }\n // preferred countries first (in the given order), then the rest A→Z by their localized name —\n // as two groups (\"Suggested\" / \"All Countries\") when there are preferred ones\n const pinned = preferredCountries.filter((c) => countries.includes(c)).map(toOption)\n const rest = countries\n .filter((c) => !preferredCountries.includes(c))\n .map(toOption)\n .sort((a, b) => a.label.localeCompare(b.label, language))\n if (pinned.length === 0) return rest\n return [\n ...pinned.map((o) => ({ ...o, group: t('phoneField.suggested') })),\n ...rest.map((o) => ({ ...o, group: t('phoneField.allCountries') })),\n ]\n }, [countries, preferredCountries, language, t])\n\n const pickCountry = (next: PhoneCountry) => {\n // keep the typed national digits, re-read under the new calling code\n const national = readPhoneInput(display, country, format, countries).national\n setCountry(next)\n emit({ ...readPhoneInput(national, next, format, countries), country: next })\n }\n\n const menu = useOptionMenu({\n idBase: `${id}-country`,\n options: countryOptions,\n isSelected: (o) => o.value === country,\n onPick: (o) => pickCountry(o.value as PhoneCountry),\n searchable: true,\n disabled,\n // after a pick / Esc, typing continues in the number\n focusRef: innerRef,\n })\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n bound?.onBlur(event)\n onBlur?.(event)\n }\n\n const describedBy = resolvedHelperText != null ? helperId : undefined\n const chevronPx = size === 'sm' ? 16 : size === 'md' ? 14 : 12\n const code = callingCodeOf(country)\n const name_ = countryName(country, language)\n\n return (\n <div\n className={clsx(\n fieldStyles.field,\n fieldStyles[size],\n fullWidth && fieldStyles.fullWidth,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n styles.phoneField,\n className,\n )}\n style={style as CSSProperties}\n >\n {label != null && (\n <label htmlFor={id} className={fieldStyles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={fieldStyles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={controlRef} className={clsx(fieldStyles.control, styles.control)}>\n <button\n type=\"button\"\n className={styles.country}\n aria-haspopup=\"listbox\"\n aria-expanded={menu.open}\n aria-controls={menu.open ? menu.listboxId : undefined}\n aria-label={`${t('phoneField.country')}: ${name_} (+${code})`}\n disabled={disabled}\n onClick={menu.toggleMenu}\n onKeyDown={(e) => {\n // ↓ / ↑ open the list (Enter / Space already click the button)\n if ((e.key === 'ArrowDown' || e.key === 'ArrowUp') && !menu.open) {\n e.preventDefault()\n menu.openMenu()\n }\n }}\n >\n <span className={styles.flag} aria-hidden=\"true\">\n {flagEmoji(country)}\n </span>\n {format === 'national' && <span className={styles.code}>+{code}</span>}\n {/* the same chevron as Select / MultiSelect (ArrowDown4, sized per field size: sm 16 · md 14 · lg 12) */}\n <Icon\n name=\"ArrowDown4\"\n className={clsx(styles.chevron, menu.open && styles.chevronOpen)}\n style={{ width: chevronPx, height: chevronPx }}\n aria-hidden=\"true\"\n />\n </button>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n type=\"tel\"\n inputMode=\"tel\"\n autoComplete=\"tel\"\n className={fieldStyles.input}\n value={display}\n placeholder={placeholder}\n onChange={handleChange}\n onBlur={handleBlur}\n disabled={disabled}\n aria-invalid={resolvedError || undefined}\n aria-describedby={describedBy}\n {...props}\n />\n </div>\n\n <OptionMenu\n menu={menu}\n anchorRef={controlRef}\n size={size}\n searchPlaceholder={t('phoneField.search')}\n ariaLabel={t('phoneField.country')}\n />\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={fieldStyles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n})\n\n/**\n * A phone-number field: a **country button** (flag + `+code`, opening a searchable, localized country\n * list) inside the input frame, and the number **formatted as you type** for that country. The value is\n * always **E.164** (`'+995555123456'`) — one canonical form for the backend. Typing or pasting `+44…`\n * switches the country by its calling code. `onChange(value, { country, national, valid })`; binds to a\n * `<Form>` by `name` (the form value is the E.164 string — validate with `isValidPhone`). Country names\n * come from `Intl.DisplayNames` in the active UI language; flags are emoji. Needs the optional peer\n * **`libphonenumber-js`** (formatting, parsing, validation metadata), loaded lazily on first mount — until\n * it's ready (or if it isn't installed) a disabled look-alike field renders. Reuses the `TextField` look.\n */\nexport const PhoneField = forwardRef<HTMLInputElement, PhoneFieldProps>(\n function PhoneField(props, ref) {\n const { module } = useOptionalPeer(phonePeer)\n if (module) return <PhoneFieldInner ref={ref} {...props} />\n // loading (a tick, first mount only) or the peer is missing: the same frame, disabled — never bound\n // to a <Form> (no `name`) so it can't write a value\n const {\n label,\n helperText,\n error,\n required,\n size,\n fullWidth = true,\n className,\n style,\n placeholder,\n } = props\n return (\n <TextField\n ref={ref}\n type=\"tel\"\n label={label}\n helperText={helperText}\n error={error}\n required={required}\n size={size}\n fullWidth={fullWidth}\n className={className}\n style={style}\n placeholder={placeholder}\n value={props.value ?? props.defaultValue ?? ''}\n readOnly\n disabled\n />\n )\n },\n)\n"],"names":["phonePeer","optionalPeer","lib","allCountries","getPhoneCountries","callingCodeOf","country","isValidPhone","value","loaded","flagEmoji","c","displayNamesCache","countryName","locale","_a","MAIN_FOR_CODE","LANGUAGE_COUNTRY","detectCountry","allowed","base","region","browser","_b","digitsOf","s","countryForCode","code","current","detected","readPhoneInput","raw","format","text","digits","typer","display","parsed","next","e164","national","phoneFromValue","fallback","reading","caretAfterDigits","n","seen","i","PhoneFieldInner","forwardRef","defaultValue","onChange","defaultCountry","countriesProp","preferredCountries","label","helperText","error","required","size","fullWidth","name","disabled","idProp","className","style","onBlur","placeholder","props","ref","t","useT","language","useLanguage","countries","reactId","useId","id","helperId","form","useFormContext","isFormBound","bound","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","fallbackCountry","useMemo","setCountry","setDisplay","lastEmitted","useRef","innerRef","setInputRef","useCallback","node","pendingCaret","useLayoutEffect","pos","emit","handleChange","event","el","caret","digitsBefore","prevDigits","cut","controlRef","countryOptions","toOption","dial","jsx","styles","jsxs","pinned","rest","a","b","o","pickCountry","menu","useOptionMenu","handleBlur","describedBy","chevronPx","name_","clsx","fieldStyles","Typography","e","Icon","OptionM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K,MACL,MAAAd,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EACA,KAAAC,EACA,UAAAC,EACA,UAAAI,EACA,MAAAC,EACA,YAAAE,EACA,MAAOC,EAAM,OAASA,EAAM,cAAgB,GAC5C,SAAQ,GACR,SAAQ,EAAA,CAAA,CAGd,CACF"}
|
|
@@ -2,9 +2,9 @@ import { jsx as o, jsxs as i, Fragment as J } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId as K, useRef as A, useState as R, useEffect as Q, cloneElement as U } from "react";
|
|
3
3
|
import { clsx as V } from "clsx";
|
|
4
4
|
import { b as W, a as X } from "./Icon-B7DJn8Tw.js";
|
|
5
|
-
import { B as S } from "./Button-
|
|
5
|
+
import { B as S } from "./Button-DZWYeAno.js";
|
|
6
6
|
import { F as Y } from "./FloatingPanel-C5c_eMQ0.js";
|
|
7
|
-
import { a as Z } from "./ConfigProvider-
|
|
7
|
+
import { a as Z } from "./ConfigProvider-DtyUlWk6.js";
|
|
8
8
|
const tt = "_popconfirm_ztpne_5", et = "_body_ztpne_12", nt = "_icon_ztpne_21", rt = "_text_ztpne_33", ot = "_title_ztpne_43", st = "_description_ztpne_50", it = "_footer_ztpne_58", n = {
|
|
9
9
|
popconfirm: tt,
|
|
10
10
|
body: et,
|
|
@@ -109,4 +109,4 @@ function _t({
|
|
|
109
109
|
export {
|
|
110
110
|
_t as P
|
|
111
111
|
};
|
|
112
|
-
//# sourceMappingURL=Popconfirm-
|
|
112
|
+
//# sourceMappingURL=Popconfirm-D-8ZG2WR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popconfirm-aCyniPnH.js","sources":["../src/components/Popconfirm/Popconfirm.tsx"],"sourcesContent":["import {\n cloneElement,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Button } from '../Button'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Icon } from '../Icon'\nimport type { PopoverAlign } from '../Popover'\nimport styles from './Popconfirm.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface PopconfirmProps {\n /** The question — \"Delete this item?\". Labels the dialog. */\n title: ReactNode\n /** Optional muted line under the title (the consequence). Describes the dialog. */\n description?: ReactNode\n /**\n * Runs on confirm. Return a Promise to keep the popover open with the confirm button **loading** until\n * it settles — it closes on success and **stays open on rejection** (show your own toast).\n */\n // `unknown` (not `void | Promise`) so `() => toast.success(…)` — which returns an id — still fits\n onConfirm: () => unknown\n /** Runs on Cancel, `Escape` or an outside click. */\n onCancel?: () => void\n /** Confirm button label. Defaults to the localized \"Confirm\". */\n confirmLabel?: ReactNode\n /** Cancel button label. Defaults to the localized \"Cancel\". */\n cancelLabel?: ReactNode\n /** Tints the confirm button and the icon. Defaults to `error` (a destructive action). */\n color?: ThemeColor\n /** Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in the `color`. */\n icon?: IconName | ReactNode | false\n /** Horizontal alignment to the trigger (`start` default, `end` for a trigger near the right edge). */\n align?: PopoverAlign\n /** Controlled open state. */\n open?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Clicking the trigger does nothing (no popover). */\n disabled?: boolean\n /** Panel width (px number or CSS width). Defaults to `300px`. */\n width?: number | string\n /** Class on the floating panel. */\n className?: string\n /** Style on the floating panel. */\n style?: CSSProperties\n /** The trigger — usually a `Button` / `IconButton`. Cloned to wire the click + ARIA. */\n children: ReactElement\n}\n\n/**\n * An **inline confirm** for quick, low-risk actions (a row's delete / archive) — a small anchored popover\n * with a question, an optional description and **Cancel** / **Confirm**, where a `RemoveDialog` modal\n * would be too heavy and a bare `onClick` too dangerous. Wraps its trigger (`children`), which it clones\n * to toggle the panel. Built on the shared `FloatingPanel` (portaled, flips, clamps to the viewport,\n * dismisses on outside click / `Escape` = cancel). A11y: `role=\"alertdialog\"` labelled by the title and\n * described by the description, focus trapped and **placed on Cancel** (never the destructive button —\n * the `RemoveDialog` rule), focus returns to the trigger. An async `onConfirm` shows a loading confirm\n * button (Cancel + dismiss locked meanwhile), closes on success, stays open on failure. The icon sits in a\n * tinted box, the buttons (`sm`; confirm `contained` in `color`, default `error`) in a Card-style footer. Use `RemoveDialog` for high-risk, context-heavy deletes.\n */\nexport function Popconfirm({\n title,\n description,\n onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n color = 'error',\n icon = 'Danger',\n align = 'start',\n open,\n onOpenChange,\n disabled = false,\n width = 300,\n className,\n style,\n children,\n}: PopconfirmProps) {\n const t = useT()\n const id = useId()\n const panelId = `${id}-panel`\n const titleId = `${id}-title`\n const descId = `${id}-desc`\n const triggerRef = useRef<HTMLElement | null>(null)\n const cancelRef = useRef<HTMLButtonElement | null>(null)\n const [busy, setBusy] = useState(false)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(false)\n const isOpen = isControlled ? open : internalOpen\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n }\n\n // focus Cancel once the panel is positioned + visible (a hidden element can't take focus)\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => cancelRef.current?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const close = (refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }\n\n const cancel = (refocus = true) => {\n if (busy) return\n onCancel?.()\n close(refocus)\n }\n\n const confirm = async () => {\n const result = onConfirm()\n // any thenable counts as async (not just native Promises)\n if (!result || typeof (result as PromiseLike<unknown>).then !== 'function') {\n close(true)\n return\n }\n setBusy(true)\n try {\n await result\n setBusy(false)\n close(true)\n } catch {\n // stays open so the user can retry or cancel; surfacing the error (a toast) is the consumer's job\n setBusy(false)\n }\n }\n\n const triggerProps = children.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (disabled || busy) return\n if (isOpen) cancel(false)\n else setOpen(true)\n },\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? panelId : undefined,\n })\n\n const renderedIcon =\n icon === false ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <>\n {trigger}\n <FloatingPanel\n open={isOpen}\n triggerRef={triggerRef}\n align={align}\n onClose={(refocus) => cancel(refocus)}\n id={panelId}\n role=\"alertdialog\"\n ariaLabelledBy={titleId}\n ariaDescribedBy={description != null ? descId : undefined}\n trapFocus\n width={width}\n className={clsx(styles.popconfirm, className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n >\n <div className={styles.body}>\n {renderedIcon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {renderedIcon}\n </span>\n )}\n <div className={styles.text}>\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n {description != null && (\n <div id={descId} className={styles.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n <Button ref={cancelRef} variant=\"text\" size=\"sm\" onClick={() => cancel()} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button variant=\"contained\" color={color} size=\"sm\" loading={busy} onClick={confirm}>\n {confirmLabel ?? t('common.confirm')}\n </Button>\n </div>\n </FloatingPanel>\n </>\n )\n}\n"],"names":["ICON_NAME_SET","ICON_NAMES","Popconfirm","title","description","onConfirm","onCancel","confirmLabel","cancelLabel","color","icon","align","open","onOpenChange","disabled","width","className","style","children","t","useT","id","useId","panelId","titleId","descId","triggerRef","useRef","cancelRef","busy","setBusy","useState","isControlled","internalOpen","setInternalOpen","isOpen","setOpen","next","useEffect","raf","_a","close","refocus","cancel","confirm","result","triggerProps","originalRef","trigger","cloneElement","node","event","renderedIcon","jsx","Icon","jsxs","Fragment","FloatingPanel","clsx","styles","Button"],"mappings":";;;;;;;;;;;;;;;GAqBMA,KAAgB,IAAI,IAAYC,CAAU;AAoDzC,SAASC,GAAW;AAAA,EACzB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AAAA,EACR,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AACF,GAAoB;AAClB,QAAMC,IAAIC,EAAA,GACJC,IAAKC,EAAA,GACLC,IAAU,GAAGF,CAAE,UACfG,IAAU,GAAGH,CAAE,UACfI,IAAS,GAAGJ,CAAE,SACdK,IAAaC,EAA2B,IAAI,GAC5CC,IAAYD,EAAiC,IAAI,GACjD,CAACE,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAEhCC,IAAepB,MAAS,QACxB,CAACqB,GAAcC,CAAe,IAAIH,EAAS,EAAK,GAChDI,IAASH,IAAepB,IAAOqB,GAC/BG,IAAU,CAACC,MAAkB;AACjC,IAAKL,KAAcE,EAAgBG,CAAI,GACvCxB,KAAA,QAAAA,EAAewB;AAAA,EACjB;AAGA,EAAAC,EAAU,MAAM;AACd,QAAI,CAACH,EAAQ;AACb,UAAMI,IAAM,sBAAsB,MAAA;;AAAM,cAAAC,IAAAZ,EAAU,YAAV,gBAAAY,EAAmB;AAAA,KAAO;AAClE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A,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Popconfirm-D-8ZG2WR.js","sources":["../src/components/Popconfirm/Popconfirm.tsx"],"sourcesContent":["import {\n cloneElement,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Button } from '../Button'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Icon } from '../Icon'\nimport type { PopoverAlign } from '../Popover'\nimport styles from './Popconfirm.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface PopconfirmProps {\n /** The question — \"Delete this item?\". Labels the dialog. */\n title: ReactNode\n /** Optional muted line under the title (the consequence). Describes the dialog. */\n description?: ReactNode\n /**\n * Runs on confirm. Return a Promise to keep the popover open with the confirm button **loading** until\n * it settles — it closes on success and **stays open on rejection** (show your own toast).\n */\n // `unknown` (not `void | Promise`) so `() => toast.success(…)` — which returns an id — still fits\n onConfirm: () => unknown\n /** Runs on Cancel, `Escape` or an outside click. */\n onCancel?: () => void\n /** Confirm button label. Defaults to the localized \"Confirm\". */\n confirmLabel?: ReactNode\n /** Cancel button label. Defaults to the localized \"Cancel\". */\n cancelLabel?: ReactNode\n /** Tints the confirm button and the icon. Defaults to `error` (a destructive action). */\n color?: ThemeColor\n /** Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in the `color`. */\n icon?: IconName | ReactNode | false\n /** Horizontal alignment to the trigger (`start` default, `end` for a trigger near the right edge). */\n align?: PopoverAlign\n /** Controlled open state. */\n open?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Clicking the trigger does nothing (no popover). */\n disabled?: boolean\n /** Panel width (px number or CSS width). Defaults to `300px`. */\n width?: number | string\n /** Class on the floating panel. */\n className?: string\n /** Style on the floating panel. */\n style?: CSSProperties\n /** The trigger — usually a `Button` / `IconButton`. Cloned to wire the click + ARIA. */\n children: ReactElement\n}\n\n/**\n * An **inline confirm** for quick, low-risk actions (a row's delete / archive) — a small anchored popover\n * with a question, an optional description and **Cancel** / **Confirm**, where a `RemoveDialog` modal\n * would be too heavy and a bare `onClick` too dangerous. Wraps its trigger (`children`), which it clones\n * to toggle the panel. Built on the shared `FloatingPanel` (portaled, flips, clamps to the viewport,\n * dismisses on outside click / `Escape` = cancel). A11y: `role=\"alertdialog\"` labelled by the title and\n * described by the description, focus trapped and **placed on Cancel** (never the destructive button —\n * the `RemoveDialog` rule), focus returns to the trigger. An async `onConfirm` shows a loading confirm\n * button (Cancel + dismiss locked meanwhile), closes on success, stays open on failure. The icon sits in a\n * tinted box, the buttons (`sm`; confirm `contained` in `color`, default `error`) in a Card-style footer. Use `RemoveDialog` for high-risk, context-heavy deletes.\n */\nexport function Popconfirm({\n title,\n description,\n onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n color = 'error',\n icon = 'Danger',\n align = 'start',\n open,\n onOpenChange,\n disabled = false,\n width = 300,\n className,\n style,\n children,\n}: PopconfirmProps) {\n const t = useT()\n const id = useId()\n const panelId = `${id}-panel`\n const titleId = `${id}-title`\n const descId = `${id}-desc`\n const triggerRef = useRef<HTMLElement | null>(null)\n const cancelRef = useRef<HTMLButtonElement | null>(null)\n const [busy, setBusy] = useState(false)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(false)\n const isOpen = isControlled ? open : internalOpen\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n }\n\n // focus Cancel once the panel is positioned + visible (a hidden element can't take focus)\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => cancelRef.current?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const close = (refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }\n\n const cancel = (refocus = true) => {\n if (busy) return\n onCancel?.()\n close(refocus)\n }\n\n const confirm = async () => {\n const result = onConfirm()\n // any thenable counts as async (not just native Promises)\n if (!result || typeof (result as PromiseLike<unknown>).then !== 'function') {\n close(true)\n return\n }\n setBusy(true)\n try {\n await result\n setBusy(false)\n close(true)\n } catch {\n // stays open so the user can retry or cancel; surfacing the error (a toast) is the consumer's job\n setBusy(false)\n }\n }\n\n const triggerProps = children.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (disabled || busy) return\n if (isOpen) cancel(false)\n else setOpen(true)\n },\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? panelId : undefined,\n })\n\n const renderedIcon =\n icon === false ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <>\n {trigger}\n <FloatingPanel\n open={isOpen}\n triggerRef={triggerRef}\n align={align}\n onClose={(refocus) => cancel(refocus)}\n id={panelId}\n role=\"alertdialog\"\n ariaLabelledBy={titleId}\n ariaDescribedBy={description != null ? descId : undefined}\n trapFocus\n width={width}\n className={clsx(styles.popconfirm, className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n >\n <div className={styles.body}>\n {renderedIcon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {renderedIcon}\n </span>\n )}\n <div className={styles.text}>\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n {description != null && (\n <div id={descId} className={styles.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n <Button ref={cancelRef} variant=\"text\" size=\"sm\" onClick={() => cancel()} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button variant=\"contained\" color={color} size=\"sm\" loading={busy} onClick={confirm}>\n {confirmLabel ?? t('common.confirm')}\n </Button>\n </div>\n </FloatingPanel>\n </>\n )\n}\n"],"names":["ICON_NAME_SET","ICON_NAMES","Popconfirm","title","description","onConfirm","onCancel","confirmLabel","cancelLabel","color","icon","align","open","onOpenChange","disabled","width","className","style","children","t","useT","id","useId","panelId","titleId","descId","triggerRef","useRef","cancelRef","busy","setBusy","useState","isControlled","internalOpen","setInternalOpen","isOpen","setOpen","next","useEffect","raf","_a","close","refocus","cancel","confirm","result","triggerProps","originalRef","trigger","cloneElement","node","event","renderedIcon","jsx","Icon","jsxs","Fragment","FloatingPanel","clsx","styles","Button"],"mappings":";;;;;;;;;;;;;;;GAqBMA,KAAgB,IAAI,IAAYC,CAAU;AAoDzC,SAASC,GAAW;AAAA,EACzB,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,OAAAC,IAAQ;AAAA,EACR,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AACF,GAAoB;AAClB,QAAMC,IAAIC,EAAA,GACJC,IAAKC,EAAA,GACLC,IAAU,GAAGF,CAAE,UACfG,IAAU,GAAGH,CAAE,UACfI,IAAS,GAAGJ,CAAE,SACdK,IAAaC,EAA2B,IAAI,GAC5CC,IAAYD,EAAiC,IAAI,GACjD,CAACE,GAAMC,CAAO,IAAIC,EAAS,EAAK,GAEhCC,IAAep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OAAA,EAAI,WAAWI,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAN,EAACO,KAAO,KAAKhC,GAAW,SAAQ,QAAO,MAAK,MAAK,SAAS,MAAMe,EAAA,GAAU,UAAUd,GACjF,UAAArB,KAAeW,EAAE,eAAe,GACnC;AAAA,YACA,gBAAAkC,EAACO,GAAA,EAAO,SAAQ,aAAY,OAAAnD,GAAc,MAAK,MAAK,SAASoB,GAAM,SAASe,GACzE,UAAArC,KAAgBY,EAAE,gBAAgB,EAAA,CACrC;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),n=require("react"),H=require("clsx"),E=require("./Icon-CBg21lKA.cjs"),R=require("./Button-
|
|
2
|
-
//# sourceMappingURL=Popconfirm-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),n=require("react"),H=require("clsx"),E=require("./Icon-CBg21lKA.cjs"),R=require("./Button-BtiFpRie.cjs"),J=require("./FloatingPanel-tGCG2nhA.cjs"),K=require("./ConfigProvider-CYSpuSMJ.cjs"),Q="_popconfirm_ztpne_5",U="_body_ztpne_12",V="_icon_ztpne_21",W="_text_ztpne_33",X="_title_ztpne_43",Y="_description_ztpne_50",Z="_footer_ztpne_58",r={popconfirm:Q,body:U,icon:V,text:W,title:X,description:Y,footer:Z},ee=new Set(E.ICON_NAMES);function te({title:S,description:u,onConfirm:k,onCancel:f,confirmLabel:A,cancelLabel:P,color:j="error",icon:c="Danger",align:$="start",open:v,onOpenChange:d,disabled:w=!1,width:D=300,className:M,style:O,children:b}){const z=K.useT(),p=n.useId(),N=`${p}-panel`,g=`${p}-title`,h=`${p}-desc`,m=n.useRef(null),I=n.useRef(null),[i,_]=n.useState(!1),q=v!==void 0,[T,C]=n.useState(!1),o=q?v:T,B=e=>{q||C(e),d==null||d(e)};n.useEffect(()=>{if(!o)return;const e=requestAnimationFrame(()=>{var s;return(s=I.current)==null?void 0:s.focus()});return()=>cancelAnimationFrame(e)},[o]);const x=e=>{var s;B(!1),e&&((s=m.current)==null||s.focus())},y=(e=!0)=>{i||(f==null||f(),x(e))},L=async()=>{const e=k();if(!e||typeof e.then!="function"){x(!0);return}_(!0);try{await e,_(!1),x(!0)}catch{_(!1)}},l=b.props,a=l.ref,G=n.cloneElement(b,{ref:e=>{m.current=e,typeof a=="function"?a(e):a&&(a.current=e)},onClick:e=>{var s;(s=l.onClick)==null||s.call(l,e),!(w||i)&&(o?y(!1):B(!0))},"aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?N:void 0}),F=c===!1?null:typeof c=="string"&&ee.has(c)?t.jsx(E.Icon,{name:c}):c;return t.jsxs(t.Fragment,{children:[G,t.jsxs(J.FloatingPanel,{open:o,triggerRef:m,align:$,onClose:e=>y(e),id:N,role:"alertdialog",ariaLabelledBy:g,ariaDescribedBy:u!=null?h:void 0,trapFocus:!0,width:D,className:H.clsx(r.popconfirm,M),style:{"--tz-btn-rgb":`var(--tz-color-${j}-rgb)`,...O},children:[t.jsxs("div",{className:r.body,children:[F!=null&&t.jsx("span",{className:r.icon,"aria-hidden":"true",children:F}),t.jsxs("div",{className:r.text,children:[t.jsx("div",{id:g,className:r.title,children:S}),u!=null&&t.jsx("div",{id:h,className:r.description,children:u})]})]}),t.jsxs("div",{className:r.footer,children:[t.jsx(R.Button,{ref:I,variant:"text",size:"sm",onClick:()=>y(),disabled:i,children:P??z("common.cancel")}),t.jsx(R.Button,{variant:"contained",color:j,size:"sm",loading:i,onClick:L,children:A??z("common.confirm")})]})]})]})}exports.Popconfirm=te;
|
|
2
|
+
//# sourceMappingURL=Popconfirm-KOE9gGi6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popconfirm-BKzJ_EZy.cjs","sources":["../src/components/Popconfirm/Popconfirm.tsx"],"sourcesContent":["import {\n cloneElement,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Button } from '../Button'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Icon } from '../Icon'\nimport type { PopoverAlign } from '../Popover'\nimport styles from './Popconfirm.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface PopconfirmProps {\n /** The question — \"Delete this item?\". Labels the dialog. */\n title: ReactNode\n /** Optional muted line under the title (the consequence). Describes the dialog. */\n description?: ReactNode\n /**\n * Runs on confirm. Return a Promise to keep the popover open with the confirm button **loading** until\n * it settles — it closes on success and **stays open on rejection** (show your own toast).\n */\n // `unknown` (not `void | Promise`) so `() => toast.success(…)` — which returns an id — still fits\n onConfirm: () => unknown\n /** Runs on Cancel, `Escape` or an outside click. */\n onCancel?: () => void\n /** Confirm button label. Defaults to the localized \"Confirm\". */\n confirmLabel?: ReactNode\n /** Cancel button label. Defaults to the localized \"Cancel\". */\n cancelLabel?: ReactNode\n /** Tints the confirm button and the icon. Defaults to `error` (a destructive action). */\n color?: ThemeColor\n /** Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in the `color`. */\n icon?: IconName | ReactNode | false\n /** Horizontal alignment to the trigger (`start` default, `end` for a trigger near the right edge). */\n align?: PopoverAlign\n /** Controlled open state. */\n open?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Clicking the trigger does nothing (no popover). */\n disabled?: boolean\n /** Panel width (px number or CSS width). Defaults to `300px`. */\n width?: number | string\n /** Class on the floating panel. */\n className?: string\n /** Style on the floating panel. */\n style?: CSSProperties\n /** The trigger — usually a `Button` / `IconButton`. Cloned to wire the click + ARIA. */\n children: ReactElement\n}\n\n/**\n * An **inline confirm** for quick, low-risk actions (a row's delete / archive) — a small anchored popover\n * with a question, an optional description and **Cancel** / **Confirm**, where a `RemoveDialog` modal\n * would be too heavy and a bare `onClick` too dangerous. Wraps its trigger (`children`), which it clones\n * to toggle the panel. Built on the shared `FloatingPanel` (portaled, flips, clamps to the viewport,\n * dismisses on outside click / `Escape` = cancel). A11y: `role=\"alertdialog\"` labelled by the title and\n * described by the description, focus trapped and **placed on Cancel** (never the destructive button —\n * the `RemoveDialog` rule), focus returns to the trigger. An async `onConfirm` shows a loading confirm\n * button (Cancel + dismiss locked meanwhile), closes on success, stays open on failure. The icon sits in a\n * tinted box, the buttons (`sm`; confirm `contained` in `color`, default `error`) in a Card-style footer. Use `RemoveDialog` for high-risk, context-heavy deletes.\n */\nexport function Popconfirm({\n title,\n description,\n onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n color = 'error',\n icon = 'Danger',\n align = 'start',\n open,\n onOpenChange,\n disabled = false,\n width = 300,\n className,\n style,\n children,\n}: PopconfirmProps) {\n const t = useT()\n const id = useId()\n const panelId = `${id}-panel`\n const titleId = `${id}-title`\n const descId = `${id}-desc`\n const triggerRef = useRef<HTMLElement | null>(null)\n const cancelRef = useRef<HTMLButtonElement | null>(null)\n const [busy, setBusy] = useState(false)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(false)\n const isOpen = isControlled ? open : internalOpen\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n }\n\n // focus Cancel once the panel is positioned + visible (a hidden element can't take focus)\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => cancelRef.current?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const close = (refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }\n\n const cancel = (refocus = true) => {\n if (busy) return\n onCancel?.()\n close(refocus)\n }\n\n const confirm = async () => {\n const result = onConfirm()\n // any thenable counts as async (not just native Promises)\n if (!result || typeof (result as PromiseLike<unknown>).then !== 'function') {\n close(true)\n return\n }\n setBusy(true)\n try {\n await result\n setBusy(false)\n close(true)\n } catch {\n // stays open so the user can retry or cancel; surfacing the error (a toast) is the consumer's job\n setBusy(false)\n }\n }\n\n const triggerProps = children.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (disabled || busy) return\n if (isOpen) cancel(false)\n else setOpen(true)\n },\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? panelId : undefined,\n })\n\n const renderedIcon =\n icon === false ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <>\n {trigger}\n <FloatingPanel\n open={isOpen}\n triggerRef={triggerRef}\n align={align}\n onClose={(refocus) => cancel(refocus)}\n id={panelId}\n role=\"alertdialog\"\n ariaLabelledBy={titleId}\n ariaDescribedBy={description != null ? descId : undefined}\n trapFocus\n width={width}\n className={clsx(styles.popconfirm, className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n >\n <div className={styles.body}>\n {renderedIcon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {renderedIcon}\n </span>\n )}\n <div className={styles.text}>\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n {description != null && (\n <div id={descId} className={styles.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n <Button ref={cancelRef} variant=\"text\" size=\"sm\" onClick={() => cancel()} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button variant=\"contained\" color={color} size=\"sm\" loading={busy} onClick={confirm}>\n {confirmLabel ?? t('common.confirm')}\n </Button>\n </div>\n </FloatingPanel>\n </>\n )\n}\n"],"names":["ICON_NAME_SET","ICON_NAMES","Popconfirm","title","description","onConfirm","onCancel","confirmLabel","cancelLabel","color","icon","align","open","onOpenChange","disabled","width","className","style","children","t","useT","id","useId","panelId","titleId","descId","triggerRef","useRef","cancelRef","busy","setBusy","useState","isControlled","internalOpen","setInternalOpen","isOpen","setOpen","next","useEffect","raf","_a","close","refocus","cancel","confirm","result","triggerProps","originalRef","trigger","cloneElement","node","event","renderedIcon","jsx","Icon","jsxs","Fragment","FloatingPanel","clsx","styles","Button"],"mappings":"ycAqBMA,GAAgB,IAAI,IAAYC,YAAU,EAoDzC,SAASC,GAAW,CACzB,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,YAAAC,EACA,MAAAC,EAAQ,QACR,KAAAC,EAAO,SACP,MAAAC,EAAQ,QACR,KAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EAAQ,IACR,UAAAC,EACA,MAAAC,EACA,SAAAC,CACF,EAAoB,CAClB,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAKC,EAAAA,MAAA,EACLC,EAAU,GAAGF,CAAE,SACfG,EAAU,GAAGH,CAAE,SACfI,EAAS,GAAGJ,CAAE,QACdK,EAAaC,EAAAA,OAA2B,IAAI,EAC5CC,EAAYD,EAAAA,OAAiC,IAAI,EACjD,CAACE,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EAEhCC,EAAepB,IAAS,OACxB,CAACqB,EAAcC,CAAe,EAAIH,EAAAA,SAAS,EAAK,EAChDI,EAASH,EAAepB,EAAOqB,EAC/BG,EAAWC,GAAkB,CAC5BL,GAAcE,EAAgBG,CAAI,EACvCxB,GAAA,MAAAA,EAAewB,EACjB,EAGAC,EAAAA,UAAU,IAAM,CACd,GAAI,CAACH,EAAQ,OACb,MAAMI,EAAM,sBAAsB,IAAA,OAAM,OAAA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YC,EAAOD,CAAO,EACpC,GAAInB,EACJ,KAAK,cACL,eAAgBC,EAChB,gBAAiBpB,GAAe,KAAOqB,EAAS,OAChD,UAAS,GACT,MAAAV,EACA,UAAW2C,EAAAA,KAAKC,EAAO,WAAY3C,CAAS,EAC5C,MAAO,CAAE,eAAgB,kBAAkBP,CAAK,QAAS,GAAGQ,CAAA,EAE5D,SAAA,CAAAsC,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,KACpB,SAAA,CAAAP,GAAgB,YACd,OAAA,CAAK,UAAWO,EAAO,KAAM,cAAY,OACvC,SAAAP,CAAA,CACH,EAEFG,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,KACrB,SAAA,CAAAN,MAAC,OAAI,GAAI7B,EAAS,UAAWmC,EAAO,MACjC,SAAAxD,EACH,EACCC,GAAe,MACdiD,MAAC,MAAA,CAAI,GAAI5B,EAAQ,UAAWkC,EAAO,YAChC,SAAAvD,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,EACF,EACAmD,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,OACrB,SAAA,CAAAN,MAACO,EAAAA,QAAO,IAAKhC,EAAW,QAAQ,OAAO,KAAK,KAAK,QAAS,IAAMe,EAAA,EAAU,SAAUd,EACjF,SAAArB,GAAeW,EAAE,eAAe,EACnC,EACAkC,EAAAA,IAACO,EAAAA,OAAA,CAAO,QAAQ,YAAY,MAAAnD,EAAc,KAAK,KAAK,QAASoB,EAAM,QAASe,EACzE,SAAArC,GAAgBY,EAAE,gBAAgB,CAAA,CACrC,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,EACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"Popconfirm-KOE9gGi6.cjs","sources":["../src/components/Popconfirm/Popconfirm.tsx"],"sourcesContent":["import {\n cloneElement,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Button } from '../Button'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Icon } from '../Icon'\nimport type { PopoverAlign } from '../Popover'\nimport styles from './Popconfirm.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface PopconfirmProps {\n /** The question — \"Delete this item?\". Labels the dialog. */\n title: ReactNode\n /** Optional muted line under the title (the consequence). Describes the dialog. */\n description?: ReactNode\n /**\n * Runs on confirm. Return a Promise to keep the popover open with the confirm button **loading** until\n * it settles — it closes on success and **stays open on rejection** (show your own toast).\n */\n // `unknown` (not `void | Promise`) so `() => toast.success(…)` — which returns an id — still fits\n onConfirm: () => unknown\n /** Runs on Cancel, `Escape` or an outside click. */\n onCancel?: () => void\n /** Confirm button label. Defaults to the localized \"Confirm\". */\n confirmLabel?: ReactNode\n /** Cancel button label. Defaults to the localized \"Cancel\". */\n cancelLabel?: ReactNode\n /** Tints the confirm button and the icon. Defaults to `error` (a destructive action). */\n color?: ThemeColor\n /** Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in the `color`. */\n icon?: IconName | ReactNode | false\n /** Horizontal alignment to the trigger (`start` default, `end` for a trigger near the right edge). */\n align?: PopoverAlign\n /** Controlled open state. */\n open?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Clicking the trigger does nothing (no popover). */\n disabled?: boolean\n /** Panel width (px number or CSS width). Defaults to `300px`. */\n width?: number | string\n /** Class on the floating panel. */\n className?: string\n /** Style on the floating panel. */\n style?: CSSProperties\n /** The trigger — usually a `Button` / `IconButton`. Cloned to wire the click + ARIA. */\n children: ReactElement\n}\n\n/**\n * An **inline confirm** for quick, low-risk actions (a row's delete / archive) — a small anchored popover\n * with a question, an optional description and **Cancel** / **Confirm**, where a `RemoveDialog` modal\n * would be too heavy and a bare `onClick` too dangerous. Wraps its trigger (`children`), which it clones\n * to toggle the panel. Built on the shared `FloatingPanel` (portaled, flips, clamps to the viewport,\n * dismisses on outside click / `Escape` = cancel). A11y: `role=\"alertdialog\"` labelled by the title and\n * described by the description, focus trapped and **placed on Cancel** (never the destructive button —\n * the `RemoveDialog` rule), focus returns to the trigger. An async `onConfirm` shows a loading confirm\n * button (Cancel + dismiss locked meanwhile), closes on success, stays open on failure. The icon sits in a\n * tinted box, the buttons (`sm`; confirm `contained` in `color`, default `error`) in a Card-style footer. Use `RemoveDialog` for high-risk, context-heavy deletes.\n */\nexport function Popconfirm({\n title,\n description,\n onConfirm,\n onCancel,\n confirmLabel,\n cancelLabel,\n color = 'error',\n icon = 'Danger',\n align = 'start',\n open,\n onOpenChange,\n disabled = false,\n width = 300,\n className,\n style,\n children,\n}: PopconfirmProps) {\n const t = useT()\n const id = useId()\n const panelId = `${id}-panel`\n const titleId = `${id}-title`\n const descId = `${id}-desc`\n const triggerRef = useRef<HTMLElement | null>(null)\n const cancelRef = useRef<HTMLButtonElement | null>(null)\n const [busy, setBusy] = useState(false)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(false)\n const isOpen = isControlled ? open : internalOpen\n const setOpen = (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n }\n\n // focus Cancel once the panel is positioned + visible (a hidden element can't take focus)\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => cancelRef.current?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const close = (refocus: boolean) => {\n setOpen(false)\n if (refocus) triggerRef.current?.focus()\n }\n\n const cancel = (refocus = true) => {\n if (busy) return\n onCancel?.()\n close(refocus)\n }\n\n const confirm = async () => {\n const result = onConfirm()\n // any thenable counts as async (not just native Promises)\n if (!result || typeof (result as PromiseLike<unknown>).then !== 'function') {\n close(true)\n return\n }\n setBusy(true)\n try {\n await result\n setBusy(false)\n close(true)\n } catch {\n // stays open so the user can retry or cancel; surfacing the error (a toast) is the consumer's job\n setBusy(false)\n }\n }\n\n const triggerProps = children.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n const trigger = cloneElement(children as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (disabled || busy) return\n if (isOpen) cancel(false)\n else setOpen(true)\n },\n 'aria-haspopup': 'dialog',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? panelId : undefined,\n })\n\n const renderedIcon =\n icon === false ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <>\n {trigger}\n <FloatingPanel\n open={isOpen}\n triggerRef={triggerRef}\n align={align}\n onClose={(refocus) => cancel(refocus)}\n id={panelId}\n role=\"alertdialog\"\n ariaLabelledBy={titleId}\n ariaDescribedBy={description != null ? descId : undefined}\n trapFocus\n width={width}\n className={clsx(styles.popconfirm, className)}\n style={{ '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style } as CSSProperties}\n >\n <div className={styles.body}>\n {renderedIcon != null && (\n <span className={styles.icon} aria-hidden=\"true\">\n {renderedIcon}\n </span>\n )}\n <div className={styles.text}>\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n {description != null && (\n <div id={descId} className={styles.description}>\n {description}\n </div>\n )}\n </div>\n </div>\n <div className={styles.footer}>\n <Button ref={cancelRef} variant=\"text\" size=\"sm\" onClick={() => cancel()} disabled={busy}>\n {cancelLabel ?? t('common.cancel')}\n </Button>\n <Button variant=\"contained\" color={color} size=\"sm\" loading={busy} onClick={confirm}>\n {confirmLabel ?? t('common.confirm')}\n </Button>\n </div>\n </FloatingPanel>\n </>\n )\n}\n"],"names":["ICON_NAME_SET","ICON_NAMES","Popconfirm","title","description","onConfirm","onCancel","confirmLabel","cancelLabel","color","icon","align","open","onOpenChange","disabled","width","className","style","children","t","useT","id","useId","panelId","titleId","descId","triggerRef","useRef","cancelRef","busy","setBusy","useState","isControlled","internalOpen","setInternalOpen","isOpen","setOpen","next","useEffect","raf","_a","close","refocus","cancel","confirm","result","triggerProps","originalRef","trigger","cloneElement","node","event","renderedIcon","jsx","Icon","jsxs","Fragment","FloatingPanel","clsx","styles","Button"],"mappings":"ycAqBMA,GAAgB,IAAI,IAAYC,YAAU,EAoDzC,SAASC,GAAW,CACzB,MAAAC,EACA,YAAAC,EACA,UAAAC,EACA,SAAAC,EACA,aAAAC,EACA,YAAAC,EACA,MAAAC,EAAQ,QACR,KAAAC,EAAO,SACP,MAAAC,EAAQ,QACR,KAAAC,EACA,aAAAC,EACA,SAAAC,EAAW,GACX,MAAAC,EAAQ,IACR,UAAAC,EACA,MAAAC,EACA,SAAAC,CACF,EAAoB,CAClB,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAKC,EAAAA,MAAA,EACLC,EAAU,GAAGF,CAAE,SACfG,EAAU,GAAGH,CAAE,SACfI,EAAS,GAAGJ,CAAE,QACdK,EAAaC,EAAAA,OAA2B,IAAI,EAC5CC,EAAYD,EAAAA,OAAiC,IAAI,EACjD,CAACE,EAAMC,CAAO,EAAIC,EAAAA,SAAS,EAAK,EAEhCC,EAAepB,IAAS,OACxB,CAACqB,EAAcC,CAAe,EAAIH,EAAAA,SAAS,EAAK,EAChDI,EAASH,EAAepB,EAAOqB,EAC/BG,EAAWC,GAAkB,CAC5BL,GAAcE,EAAgBG,CAAI,EACvCxB,GAAA,MAAAA,EAAewB,EACjB,EAGAC,EAAAA,UAAU,IAAM,CACd,GAAI,CAACH,EAAQ,OACb,MAAMI,EAAM,sBAAsB,IAAA,OAAM,OAAAC,EAAAZ,EAAU,UAAV,YAAAY,EAAmB,QAAO,EAClE,MAAO,IAAM,qBAAqBD,CAAG,CACvC,EAA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EAAS,OAChD,UAAS,GACT,MAAAV,EACA,UAAW2C,EAAAA,KAAKC,EAAO,WAAY3C,CAAS,EAC5C,MAAO,CAAE,eAAgB,kBAAkBP,CAAK,QAAS,GAAGQ,CAAA,EAE5D,SAAA,CAAAsC,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,KACpB,SAAA,CAAAP,GAAgB,YACd,OAAA,CAAK,UAAWO,EAAO,KAAM,cAAY,OACvC,SAAAP,CAAA,CACH,EAEFG,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,KACrB,SAAA,CAAAN,MAAC,OAAI,GAAI7B,EAAS,UAAWmC,EAAO,MACjC,SAAAxD,EACH,EACCC,GAAe,MACdiD,MAAC,MAAA,CAAI,GAAI5B,EAAQ,UAAWkC,EAAO,YAChC,SAAAvD,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,EACF,EACAmD,EAAAA,KAAC,MAAA,CAAI,UAAWI,EAAO,OACrB,SAAA,CAAAN,MAACO,EAAAA,QAAO,IAAKhC,EAAW,QAAQ,OAAO,KAAK,KAAK,QAAS,IAAMe,EAAA,EAAU,SAAUd,EACjF,SAAArB,GAAeW,EAAE,eAAe,EACnC,EACAkC,EAAAA,IAACO,EAAAA,OAAA,CAAO,QAAQ,YAAY,MAAAnD,EAAc,KAAK,KAAK,QAASoB,EAAM,QAASe,EACzE,SAAArC,GAAgBY,EAAE,gBAAgB,CAAA,CACrC,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CACF,EACF,CAEJ"}
|
|
@@ -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-CYSpuSMJ.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-7EyhPtnu.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress-DWOoLd8u.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,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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-7EyhPtnu.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,EAAUe,EAASD,CAAO,EAC1Bd,EACE,GAAG,KAAK,MAAMgB,CAAG,CAAC,IAClB,OACFI,EAAgBP,EAClBJ,EAAE,gBAAgB,EAClB,OAAOU,GAAc,SACnBA,EACA,GAAG,KAAK,MAAMH,CAAG,CAAC,IAEl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B,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,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as s, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as I, useId as L } from "react";
|
|
3
3
|
import { clsx as l } from "clsx";
|
|
4
|
-
import { a as B } from "./ConfigProvider-
|
|
4
|
+
import { a as B } from "./ConfigProvider-DtyUlWk6.js";
|
|
5
5
|
const C = "_root_1uzzo_4", D = "_caption_1uzzo_11", R = "_value_1uzzo_16", S = "_linear_1uzzo_23", q = "_sm_1uzzo_28", A = "_md_1uzzo_31", E = "_lg_1uzzo_34", G = "_header_1uzzo_38", H = "_track_1uzzo_45", J = "_buffer_1uzzo_52", K = "_fill_1uzzo_53", O = "_striped_1uzzo_69", Q = "_animated_1uzzo_82", U = "_indeterminate_1uzzo_95", W = "_circular_1uzzo_109", X = "_ring_1uzzo_128", Y = "_svg_1uzzo_136", Z = "_ringTrack_1uzzo_144", nn = "_ringFill_1uzzo_145", rn = "_ringValue_1uzzo_159", an = "_spinning_1uzzo_165", n = {
|
|
6
6
|
root: C,
|
|
7
7
|
caption: D,
|
|
@@ -116,4 +116,4 @@ const C = "_root_1uzzo_4", D = "_caption_1uzzo_11", R = "_value_1uzzo_16", S = "
|
|
|
116
116
|
export {
|
|
117
117
|
sn as P
|
|
118
118
|
};
|
|
119
|
-
//# sourceMappingURL=Progress-
|
|
119
|
+
//# sourceMappingURL=Progress-CdX666FP.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Progress-DzxbkcaD.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,IAAM,IAAIA,IAAM,KAC1BoB,IAAUF,IAAgB,IAAIzB,EAAMM,GAAO,GAAGoB,CAAO,GACrDE,IAAOD,IAAUD,IAAW,KAC5BG,IAAYhB,KAAU,OAAO,SAAab,E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ACrB,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-CdX666FP.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,IAAM,IAAIA,IAAM,KAC1BoB,IAAUF,IAAgB,IAAIzB,EAAMM,GAAO,GAAGoB,CAAO,GACrDE,IAAOD,IAAUD,IAAW,KAC5BG,IAAYhB,KAAU,OAAO,SAAab,EAAMa,GAAQ,GAAGa,CAAO,IAAIA,IAAW,KAGjFI,IACJ,CAACL,MAAiBT,KAAA,gBAAAA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;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";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-CYSpuSMJ.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-ClIJjjvF.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrCode-
|
|
1
|
+
{"version":3,"file":"QrCode-ClIJjjvF.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,MAAAC,EACA,KAAAC,EAAO,IACP,MAAAC,EACA,MAAAC,EAAQ,OACR,OAAAC,EAAS,EACT,MAAAC,EACA,QAAAC,EACA,OAAAC,EAAS,GACT,UAAAC,EACA,MAAAC,EACA,aAAcC,EACd,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAYL,GAAiBG,EAAE,cAAc,EAI7C,CAAE,OAAQG,EAAO,OAAAC,CAAA,EAAWC,EAAAA,gBAAgBtB,CAAM,EAClDuB,EAAYH,GAAA,YAAAA,EAAO,UAInBI,EAA6BlB,IAAUG,EAAQ,IAAM,KAErDgB,EACJhB,GAAS,MACJ,IAAM,CACL,MAAMiB,EAAM,OAAOjB,GAAU,SAAW,CAAE,IAAKA,GAAUA,EACnDkB,EAAM,KAAK,MAAMtB,EAAO,GAAI,EAClC,MAAO,CACL,IAAKqB,EAAI,IACT,MAAOA,EAAI,OAASC,EACpB,OAAQD,EAAI,QAAUC,EACtB,SAAUD,EAAI,UAAY,EAAA,CAE9B,KACA,OAKAE,EAAQrB,IAAU,OAAS,OAAY,CAAE,aAAc,kBAAkBA,CAAK,GAAA,EAEpF,OACEsB,EAAAA,KAAC,MAAA,CACC,IAAAb,EACA,KAAK,MACL,aAAYG,EACZ,UAAWW,EAAAA,KAAKC,EAAO,KAAMpB,GAAUoB,EAAO,OAAQnB,CAAS,EAC/D,MAAO,CAAE,GAAGgB,EAAO,GAAGf,CAAA,EACrB,GAAGE,EAEH,SAAA,CAAAQ,EACCS,EAAAA,IAACT,EAAA,CACC,UAAWQ,EAAO,KAClB,MAAA3B,EACA,KAAAC,EACA,MAAOmB,EACP,WAAYhB,EAEZ,QAAQ,kBACR,QAAQ,kBACR,cAAAiB,EACA,cAAW,EAAA,CAAA,EAGbO,EAAAA,IAACC,EAAAA,SAAA,CACC,QAAQ,OACR,MAAO5B,EACP,OAAQA,EACR,UAAWgB,EAAS,GAAQ,UAC5B,UAAWU,EAAO,IAAA,CAAA,EAGrBrB,GAAW,MACVsB,EAAAA,IAACE,EAAAA,WAAA,CAAW,QAAQ,UAAU,MAAM,QAAQ,UAAWH,EAAO,QAC3D,SAAArB,CAAA,CACH,CAAA,CAAA,CAAA,CAIR,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-DtyUlWk6.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-D7ocSDi7.js.map
|