@techzyapp/ui-library 1.0.41 → 1.0.42
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 +14 -8
- package/dist/AdminRoot-DufZpgdm.js +100 -0
- package/dist/AdminRoot-DufZpgdm.js.map +1 -0
- package/dist/AdminRoot-DwJ5jdXr.cjs +2 -0
- package/dist/AdminRoot-DwJ5jdXr.cjs.map +1 -0
- package/dist/Alert-C8BBxL_7.cjs +2 -0
- package/dist/Alert-C8BBxL_7.cjs.map +1 -0
- package/dist/Alert-D6oBxBdP.js +70 -0
- package/dist/Alert-D6oBxBdP.js.map +1 -0
- package/dist/AuthLayout-exuNQicH.cjs.map +1 -1
- package/dist/AuthLayout-q8pbCGdt.js.map +1 -1
- package/dist/{Breadcrumbs-B6Pii2Y_.cjs → Breadcrumbs-B-olYVdw.cjs} +2 -2
- package/dist/Breadcrumbs-B-olYVdw.cjs.map +1 -0
- package/dist/{Breadcrumbs-DKYJOdHZ.js → Breadcrumbs-cXET6OM5.js} +3 -3
- package/dist/Breadcrumbs-cXET6OM5.js.map +1 -0
- package/dist/{Button-CjsnB8gX.js → Button-0ZgdNjX-.js} +2 -2
- package/dist/{Button-CjsnB8gX.js.map → Button-0ZgdNjX-.js.map} +1 -1
- package/dist/{Button-ClVfHGBc.cjs → Button-CwrDiZek.cjs} +2 -2
- package/dist/{Button-ClVfHGBc.cjs.map → Button-CwrDiZek.cjs.map} +1 -1
- package/dist/{Calendar-CQaPEukM.js → Calendar-CxzdnzdK.js} +3 -3
- package/dist/{Calendar-CQaPEukM.js.map → Calendar-CxzdnzdK.js.map} +1 -1
- package/dist/{Calendar-BzGVX4F4.cjs → Calendar-d3CX5UJp.cjs} +2 -2
- package/dist/{Calendar-BzGVX4F4.cjs.map → Calendar-d3CX5UJp.cjs.map} +1 -1
- package/dist/Card-CjqStov5.js +129 -0
- package/dist/Card-CjqStov5.js.map +1 -0
- package/dist/Card-CxnUoWsi.cjs +2 -0
- package/dist/Card-CxnUoWsi.cjs.map +1 -0
- package/dist/{Chip-Dp8skUZ2.cjs → Chip-BkU3yx6G.cjs} +2 -2
- package/dist/Chip-BkU3yx6G.cjs.map +1 -0
- package/dist/{Chip-BjSNgaAf.js → Chip-CzJjbaKx.js} +2 -2
- package/dist/Chip-CzJjbaKx.js.map +1 -0
- package/dist/ChoiceCardGroup-C7Eengyd.cjs +2 -0
- package/dist/ChoiceCardGroup-C7Eengyd.cjs.map +1 -0
- package/dist/ChoiceCardGroup-q0yN-TeQ.js +180 -0
- package/dist/{ChoiceCardGroup-143hR0v_.cjs.map → ChoiceCardGroup-q0yN-TeQ.js.map} +1 -1
- package/dist/{CodeBlock-CcJjS0_q.js → CodeBlock-BHcvQrs9.js} +3 -3
- package/dist/CodeBlock-BHcvQrs9.js.map +1 -0
- package/dist/{CodeBlock-o_VSkAek.cjs → CodeBlock-DRBQ_S5t.cjs} +2 -2
- package/dist/CodeBlock-DRBQ_S5t.cjs.map +1 -0
- package/dist/{ColorPicker-C1hZcAbH.js → ColorPicker-BQKFdTNr.js} +51 -51
- package/dist/{ColorPicker-C1hZcAbH.js.map → ColorPicker-BQKFdTNr.js.map} +1 -1
- package/dist/ColorPicker-BzCEMN7B.cjs +2 -0
- package/dist/{ColorPicker-DY6Vk1uS.cjs.map → ColorPicker-BzCEMN7B.cjs.map} +1 -1
- package/dist/{ColorPickerPanel-BuzwmkPN.js → ColorPickerPanel-DKTKC9KH.js} +2 -2
- package/dist/{ColorPickerPanel-BuzwmkPN.js.map → ColorPickerPanel-DKTKC9KH.js.map} +1 -1
- package/dist/{ColorPickerPanel-CDrHbCfG.cjs → ColorPickerPanel-kl2jUix-.cjs} +2 -2
- package/dist/{ColorPickerPanel-CDrHbCfG.cjs.map → ColorPickerPanel-kl2jUix-.cjs.map} +1 -1
- package/dist/{ColorRamp-CVnOYlu3.cjs → ColorRamp-n7muILK3.cjs} +2 -2
- package/dist/{ColorRamp-CVnOYlu3.cjs.map → ColorRamp-n7muILK3.cjs.map} +1 -1
- package/dist/{ColorRamp-CePqEkMR.js → ColorRamp-yfMyJCyx.js} +2 -2
- package/dist/{ColorRamp-CePqEkMR.js.map → ColorRamp-yfMyJCyx.js.map} +1 -1
- package/dist/{ConfigProvider-DELhJlqo.cjs → ConfigProvider-BaiTKZKC.cjs} +2 -2
- package/dist/ConfigProvider-BaiTKZKC.cjs.map +1 -0
- package/dist/{ConfigProvider-Bgu85MsI.js → ConfigProvider-D61cpCz-.js} +2 -2
- package/dist/ConfigProvider-D61cpCz-.js.map +1 -0
- package/dist/{CopyButton-CjPyKpky.cjs → CopyButton-DlSi82gv.cjs} +2 -2
- package/dist/{CopyButton-CjPyKpky.cjs.map → CopyButton-DlSi82gv.cjs.map} +1 -1
- package/dist/{CopyButton-CgDeyJ3A.js → CopyButton-ecxn-ghi.js} +3 -3
- package/dist/{CopyButton-CgDeyJ3A.js.map → CopyButton-ecxn-ghi.js.map} +1 -1
- package/dist/DatePicker-BjZ_P21i.cjs +2 -0
- package/dist/{DatePicker-CwZ_-ElE.cjs.map → DatePicker-BjZ_P21i.cjs.map} +1 -1
- package/dist/{DatePicker-tid4OuJ2.js → DatePicker-CAGpJbDi.js} +42 -42
- package/dist/{DatePicker-tid4OuJ2.js.map → DatePicker-CAGpJbDi.js.map} +1 -1
- package/dist/{DateTimePicker-C2871cuc.js → DateTimePicker-BJmF0Su6.js} +50 -50
- package/dist/DateTimePicker-BJmF0Su6.js.map +1 -0
- package/dist/DateTimePicker-DZqWQeUL.cjs +2 -0
- package/dist/DateTimePicker-DZqWQeUL.cjs.map +1 -0
- package/dist/{DescriptionList-BWw0Fe6U.cjs → DescriptionList-CvPDn-kh.cjs} +2 -2
- package/dist/DescriptionList-CvPDn-kh.cjs.map +1 -0
- package/dist/{DescriptionList-BP4CDME5.js → DescriptionList-Knq5eCiY.js} +4 -4
- package/dist/DescriptionList-Knq5eCiY.js.map +1 -0
- package/dist/{Dropdown-DYYhzKSo.cjs → Dropdown-CMjURWYd.cjs} +2 -2
- package/dist/{Dropdown-DYYhzKSo.cjs.map → Dropdown-CMjURWYd.cjs.map} +1 -1
- package/dist/{Dropdown-CcC-Hwx4.js → Dropdown-CnDBlB02.js} +2 -2
- package/dist/{Dropdown-CcC-Hwx4.js.map → Dropdown-CnDBlB02.js.map} +1 -1
- package/dist/{EmptyState-DGHOD_jy.cjs → EmptyState-CX1g47y_.cjs} +2 -2
- package/dist/{EmptyState-DGHOD_jy.cjs.map → EmptyState-CX1g47y_.cjs.map} +1 -1
- package/dist/{EmptyState-BlmQtbSs.js → EmptyState-Dqtpmtje.js} +2 -2
- package/dist/{EmptyState-BlmQtbSs.js.map → EmptyState-Dqtpmtje.js.map} +1 -1
- package/dist/{ErrorBoundary-DL194IyB.cjs → ErrorBoundary-B8KwWXXp.cjs} +2 -2
- package/dist/{ErrorBoundary-DL194IyB.cjs.map → ErrorBoundary-B8KwWXXp.cjs.map} +1 -1
- package/dist/{ErrorBoundary-ukRaS6uS.js → ErrorBoundary-Dos7VLb-.js} +3 -3
- package/dist/{ErrorBoundary-ukRaS6uS.js.map → ErrorBoundary-Dos7VLb-.js.map} +1 -1
- package/dist/{ErrorState-BjEA0VfF.cjs → ErrorState-CwCqd2PU.cjs} +2 -2
- package/dist/{ErrorState-BjEA0VfF.cjs.map → ErrorState-CwCqd2PU.cjs.map} +1 -1
- package/dist/{ErrorState-Hfd_0MeE.js → ErrorState-KhzrGIJ-.js} +7 -7
- package/dist/{ErrorState-Hfd_0MeE.js.map → ErrorState-KhzrGIJ-.js.map} +1 -1
- package/dist/{FileCard-COc4rHe-.cjs → FileCard-DEc10T2G.cjs} +2 -2
- package/dist/FileCard-DEc10T2G.cjs.map +1 -0
- package/dist/{FileCard-CWwB8CWF.js → FileCard-SSuFS13E.js} +3 -3
- package/dist/FileCard-SSuFS13E.js.map +1 -0
- package/dist/{FileUploader-Bqy_fV7l.cjs → FileUploader-D58_6kDA.cjs} +2 -2
- package/dist/FileUploader-D58_6kDA.cjs.map +1 -0
- package/dist/{FileUploader--WOmlhSh.js → FileUploader-DfYOBFa4.js} +5 -5
- package/dist/FileUploader-DfYOBFa4.js.map +1 -0
- package/dist/{Flag-C48Zfhvb.cjs → Flag-B1ZvZVXi.cjs} +2 -2
- package/dist/{Flag-C48Zfhvb.cjs.map → Flag-B1ZvZVXi.cjs.map} +1 -1
- package/dist/{Flag-fgMTTcy8.js → Flag-BEIqYQZg.js} +2 -2
- package/dist/{Flag-fgMTTcy8.js.map → Flag-BEIqYQZg.js.map} +1 -1
- package/dist/FloatingPanel-C5c_eMQ0.js.map +1 -1
- package/dist/FloatingPanel-tGCG2nhA.cjs.map +1 -1
- package/dist/{FullscreenToggle-GjsMn1GO.js → FullscreenToggle-I_In47BB.js} +3 -3
- package/dist/{FullscreenToggle-GjsMn1GO.js.map → FullscreenToggle-I_In47BB.js.map} +1 -1
- package/dist/{FullscreenToggle-DuLaUzi_.cjs → FullscreenToggle-Po769CoC.cjs} +2 -2
- package/dist/{FullscreenToggle-DuLaUzi_.cjs.map → FullscreenToggle-Po769CoC.cjs.map} +1 -1
- package/dist/{IconButton-D3ZpI0XL.cjs → IconButton-CxSXEYce.cjs} +2 -2
- package/dist/{IconButton-D3ZpI0XL.cjs.map → IconButton-CxSXEYce.cjs.map} +1 -1
- package/dist/{IconButton-t1OhAMNc.js → IconButton-D9MCwRK_.js} +2 -2
- package/dist/{IconButton-t1OhAMNc.js.map → IconButton-D9MCwRK_.js.map} +1 -1
- package/dist/{List-CwuAJDTi.js → List-2Y3ktTcF.js} +2 -2
- package/dist/{List-CwuAJDTi.js.map → List-2Y3ktTcF.js.map} +1 -1
- package/dist/{List-B5Ppe9R1.cjs → List-CKoNx21F.cjs} +2 -2
- package/dist/{List-B5Ppe9R1.cjs.map → List-CKoNx21F.cjs.map} +1 -1
- package/dist/{ListItem-BWNIbyTh.js → ListItem-2Lr5_NRY.js} +15 -15
- package/dist/{ListItem-BWNIbyTh.js.map → ListItem-2Lr5_NRY.js.map} +1 -1
- package/dist/ListItem-DkCYXucd.cjs +2 -0
- package/dist/{ListItem-Qo1Tt6Fi.cjs.map → ListItem-DkCYXucd.cjs.map} +1 -1
- package/dist/{Loader-Cywaf7ju.cjs → Loader-5zp2MPm5.cjs} +2 -2
- package/dist/{Loader-Cywaf7ju.cjs.map → Loader-5zp2MPm5.cjs.map} +1 -1
- package/dist/{Loader-De8_GqR1.js → Loader-Bluu6z0-.js} +2 -2
- package/dist/{Loader-De8_GqR1.js.map → Loader-Bluu6z0-.js.map} +1 -1
- package/dist/{LocationPicker-DBsxCYi9.cjs → LocationPicker-CGHXTIml.cjs} +2 -2
- package/dist/{LocationPicker-DBsxCYi9.cjs.map → LocationPicker-CGHXTIml.cjs.map} +1 -1
- package/dist/{LocationPicker-UfyDBvhp.js → LocationPicker-hULpHBVG.js} +7 -7
- package/dist/{LocationPicker-UfyDBvhp.js.map → LocationPicker-hULpHBVG.js.map} +1 -1
- package/dist/{Modal-Dfwc9eIq.js → Modal-C6Zgwz_6.js} +3 -3
- package/dist/Modal-C6Zgwz_6.js.map +1 -0
- package/dist/{Modal--5EbLfMz.cjs → Modal-D9_OG53G.cjs} +2 -2
- package/dist/Modal-D9_OG53G.cjs.map +1 -0
- package/dist/{MultiSelect-lBAEcAlR.cjs → MultiSelect-BdPvjiTj.cjs} +2 -2
- package/dist/{MultiSelect-lBAEcAlR.cjs.map → MultiSelect-BdPvjiTj.cjs.map} +1 -1
- package/dist/{MultiSelect-q__o8HyU.js → MultiSelect-CHLMpim4.js} +4 -4
- package/dist/{MultiSelect-q__o8HyU.js.map → MultiSelect-CHLMpim4.js.map} +1 -1
- package/dist/{NumberField-CXH0B1Bt.js → NumberField-BlpFmetF.js} +3 -3
- package/dist/{NumberField-CXH0B1Bt.js.map → NumberField-BlpFmetF.js.map} +1 -1
- package/dist/{NumberField-DSicjq5R.cjs → NumberField-C-FZ-uRI.cjs} +2 -2
- package/dist/{NumberField-DSicjq5R.cjs.map → NumberField-C-FZ-uRI.cjs.map} +1 -1
- package/dist/OtpField-D4-r7I0A.js +174 -0
- package/dist/OtpField-D4-r7I0A.js.map +1 -0
- package/dist/OtpField-Drjy2wwq.cjs +2 -0
- package/dist/OtpField-Drjy2wwq.cjs.map +1 -0
- package/dist/{PageError-MHbSl1oT.cjs → PageError-DXUOkE14.cjs} +2 -2
- package/dist/{PageError-MHbSl1oT.cjs.map → PageError-DXUOkE14.cjs.map} +1 -1
- package/dist/{PageError-VYc07Q7W.js → PageError-DyDj1wQZ.js} +5 -5
- package/dist/{PageError-VYc07Q7W.js.map → PageError-DyDj1wQZ.js.map} +1 -1
- package/dist/{PageLayout-Bt6U_80d.cjs → PageLayout-CoG0AaUs.cjs} +2 -2
- package/dist/PageLayout-CoG0AaUs.cjs.map +1 -0
- package/dist/{PageLayout-Df1SOlr7.js → PageLayout-nsJa8CbT.js} +4 -4
- package/dist/PageLayout-nsJa8CbT.js.map +1 -0
- package/dist/{PageNotFound-BWfaomjC.js → PageNotFound-BNNwMkwE.js} +5 -5
- package/dist/{PageNotFound-BWfaomjC.js.map → PageNotFound-BNNwMkwE.js.map} +1 -1
- package/dist/{PageNotFound-e4ITkqDC.cjs → PageNotFound-CGSxT_n9.cjs} +2 -2
- package/dist/{PageNotFound-e4ITkqDC.cjs.map → PageNotFound-CGSxT_n9.cjs.map} +1 -1
- package/dist/Pagination-CZtewveA.cjs +2 -0
- package/dist/Pagination-CZtewveA.cjs.map +1 -0
- package/dist/Pagination-tuWRnGwR.js +139 -0
- package/dist/Pagination-tuWRnGwR.js.map +1 -0
- package/dist/{PaletteField-D4c-Q1PG.js → PaletteField-CTPl3D43.js} +3 -3
- package/dist/{PaletteField-D4c-Q1PG.js.map → PaletteField-CTPl3D43.js.map} +1 -1
- package/dist/{PaletteField-DnUpn2zP.cjs → PaletteField-PDcu2vUp.cjs} +2 -2
- package/dist/{PaletteField-DnUpn2zP.cjs.map → PaletteField-PDcu2vUp.cjs.map} +1 -1
- package/dist/{PhoneField-BTB2_Lo1.cjs → PhoneField-BPYg5ZHW.cjs} +2 -2
- package/dist/{PhoneField-BTB2_Lo1.cjs.map → PhoneField-BPYg5ZHW.cjs.map} +1 -1
- package/dist/{PhoneField-BY5hapKk.js → PhoneField-pdWDCszb.js} +4 -4
- package/dist/{PhoneField-BY5hapKk.js.map → PhoneField-pdWDCszb.js.map} +1 -1
- package/dist/{Popconfirm-BXa5qLHY.js → Popconfirm-CMVzLaC_.js} +3 -3
- package/dist/{Popconfirm-BXa5qLHY.js.map → Popconfirm-CMVzLaC_.js.map} +1 -1
- package/dist/{Popconfirm-PkVgBrL-.cjs → Popconfirm-cNpJmkuR.cjs} +2 -2
- package/dist/{Popconfirm-PkVgBrL-.cjs.map → Popconfirm-cNpJmkuR.cjs.map} +1 -1
- package/dist/Popover-DsYUT23r.cjs.map +1 -1
- package/dist/Popover-WaVH3jsN.js.map +1 -1
- package/dist/{Progress-bId4RkgJ.js → Progress-BNEFGn-O.js} +2 -2
- package/dist/{Progress-bId4RkgJ.js.map → Progress-BNEFGn-O.js.map} +1 -1
- package/dist/{Progress-R_Vt4gJA.cjs → Progress-x12Rkh06.cjs} +2 -2
- package/dist/{Progress-R_Vt4gJA.cjs.map → Progress-x12Rkh06.cjs.map} +1 -1
- package/dist/QrCode-CrNJZV_8.js +81 -0
- package/dist/QrCode-CrNJZV_8.js.map +1 -0
- package/dist/QrCode-TcQQE0h7.cjs +2 -0
- package/dist/QrCode-TcQQE0h7.cjs.map +1 -0
- package/dist/{RemoveDialog-Dh_q5jZF.js → RemoveDialog-ARFp1UJM.js} +5 -5
- package/dist/{RemoveDialog-Dh_q5jZF.js.map → RemoveDialog-ARFp1UJM.js.map} +1 -1
- package/dist/{RemoveDialog-Cvj-DaiY.cjs → RemoveDialog-IWOAQFNK.cjs} +2 -2
- package/dist/{RemoveDialog-Cvj-DaiY.cjs.map → RemoveDialog-IWOAQFNK.cjs.map} +1 -1
- package/dist/RichTextEditor-C9jT2cLl.cjs +2 -0
- package/dist/RichTextEditor-C9jT2cLl.cjs.map +1 -0
- package/dist/{RichTextEditor-Dv-LDsN-.js → RichTextEditor-DrwJUEYz.js} +148 -148
- package/dist/RichTextEditor-DrwJUEYz.js.map +1 -0
- package/dist/RootLayout-CZ2GQ8XA.js +647 -0
- package/dist/RootLayout-CZ2GQ8XA.js.map +1 -0
- package/dist/RootLayout-DStUP263.cjs +2 -0
- package/dist/RootLayout-DStUP263.cjs.map +1 -0
- package/dist/{Select-DdkJXkw-.cjs → Select-C2DIfuoB.cjs} +2 -2
- package/dist/{Select-DdkJXkw-.cjs.map → Select-C2DIfuoB.cjs.map} +1 -1
- package/dist/{Select-Bw8Q86ts.js → Select-KGsA8PbI.js} +3 -3
- package/dist/{Select-Bw8Q86ts.js.map → Select-KGsA8PbI.js.map} +1 -1
- package/dist/{Sidebar-CGL5hvpl.js → Sidebar-_pcwxdd8.js} +133 -131
- package/dist/{Sidebar-CGL5hvpl.js.map → Sidebar-_pcwxdd8.js.map} +1 -1
- package/dist/Sidebar-wK1_xaY_.cjs +2 -0
- package/dist/{Sidebar-CfEx7W7i.cjs.map → Sidebar-wK1_xaY_.cjs.map} +1 -1
- package/dist/Slider-CXAz9SUY.cjs +2 -0
- package/dist/Slider-CXAz9SUY.cjs.map +1 -0
- package/dist/Slider-Cpc5_dPl.js +185 -0
- package/dist/Slider-Cpc5_dPl.js.map +1 -0
- package/dist/{SpeedDial-jOxWEd09.cjs → SpeedDial-BT_boD06.cjs} +2 -2
- package/dist/{SpeedDial-jOxWEd09.cjs.map → SpeedDial-BT_boD06.cjs.map} +1 -1
- package/dist/{SpeedDial-C-yLmnk7.js → SpeedDial-SMMfes9f.js} +2 -2
- package/dist/{SpeedDial-C-yLmnk7.js.map → SpeedDial-SMMfes9f.js.map} +1 -1
- package/dist/{Stepper-D7An-ugU.cjs → Stepper-BmA_DjTS.cjs} +2 -2
- package/dist/Stepper-BmA_DjTS.cjs.map +1 -0
- package/dist/{Stepper-DYpiLhzD.js → Stepper-CR0Mlkq7.js} +2 -2
- package/dist/Stepper-CR0Mlkq7.js.map +1 -0
- package/dist/{Table-BhaH8EKZ.cjs → Table-BkjY1Lwt.cjs} +2 -2
- package/dist/Table-BkjY1Lwt.cjs.map +1 -0
- package/dist/{Table-DK4GBKS3.js → Table-D-F68lcm.js} +18 -18
- package/dist/Table-D-F68lcm.js.map +1 -0
- package/dist/{Tabs-6x4vC8je.cjs → Tabs-Cgp6D1WP.cjs} +2 -2
- package/dist/{Tabs-6x4vC8je.cjs.map → Tabs-Cgp6D1WP.cjs.map} +1 -1
- package/dist/{Tabs-CWiDeqqW.js → Tabs-DP0aZ5TB.js} +2 -2
- package/dist/{Tabs-CWiDeqqW.js.map → Tabs-DP0aZ5TB.js.map} +1 -1
- package/dist/TagsField-9nKu6ZW4.cjs +2 -0
- package/dist/TagsField-9nKu6ZW4.cjs.map +1 -0
- package/dist/{TagsField-Cg9YVl7G.js → TagsField-CcY9MTMw.js} +64 -64
- package/dist/TagsField-CcY9MTMw.js.map +1 -0
- package/dist/{TextField-5nQkU8HP.js → TextField-0WvJsHhA.js} +3 -3
- package/dist/{TextField-5nQkU8HP.js.map → TextField-0WvJsHhA.js.map} +1 -1
- package/dist/{TextField-BRaoadxk.cjs → TextField-C5MgCQIV.cjs} +2 -2
- package/dist/{TextField-BRaoadxk.cjs.map → TextField-C5MgCQIV.cjs.map} +1 -1
- package/dist/{ThemeToggle-DhaVEyPL.cjs → ThemeToggle-BvcCxRpF.cjs} +2 -2
- package/dist/{ThemeToggle-DhaVEyPL.cjs.map → ThemeToggle-BvcCxRpF.cjs.map} +1 -1
- package/dist/{ThemeToggle-DXpbooYn.js → ThemeToggle-DmCePuTy.js} +3 -3
- package/dist/{ThemeToggle-DXpbooYn.js.map → ThemeToggle-DmCePuTy.js.map} +1 -1
- package/dist/{TimeColumns-girAEgEN.cjs → TimeColumns-Q-vsHFZU.cjs} +2 -2
- package/dist/{TimeColumns-girAEgEN.cjs.map → TimeColumns-Q-vsHFZU.cjs.map} +1 -1
- package/dist/{TimeColumns-C_gdJn__.js → TimeColumns-WJRHQuFv.js} +2 -2
- package/dist/{TimeColumns-C_gdJn__.js.map → TimeColumns-WJRHQuFv.js.map} +1 -1
- package/dist/TimePicker-CvbQFzBf.cjs +2 -0
- package/dist/{TimePicker-_Ak5yB_5.cjs.map → TimePicker-CvbQFzBf.cjs.map} +1 -1
- package/dist/{TimePicker-DHdsY8kQ.js → TimePicker-DJDuSxAg.js} +54 -54
- package/dist/{TimePicker-DHdsY8kQ.js.map → TimePicker-DJDuSxAg.js.map} +1 -1
- package/dist/{Toaster-Dput5iLU.js → Toaster-Bb5YEN5j.js} +2 -2
- package/dist/{Toaster-Dput5iLU.js.map → Toaster-Bb5YEN5j.js.map} +1 -1
- package/dist/{Toaster-fjyF8W3F.cjs → Toaster-Dy1AonLa.cjs} +2 -2
- package/dist/{Toaster-fjyF8W3F.cjs.map → Toaster-Dy1AonLa.cjs.map} +1 -1
- package/dist/TranslatedFields-CuK5KKzE.cjs +2 -0
- package/dist/TranslatedFields-CuK5KKzE.cjs.map +1 -0
- package/dist/TranslatedFields-DKXznBtD.js +86 -0
- package/dist/TranslatedFields-DKXznBtD.js.map +1 -0
- package/dist/{UserCard-B9bzkZph.cjs → UserCard-DbudGMvG.cjs} +2 -2
- package/dist/UserCard-DbudGMvG.cjs.map +1 -0
- package/dist/{UserCard-DYK6S-nr.js → UserCard-UG_Cwe-Y.js} +3 -3
- package/dist/UserCard-UG_Cwe-Y.js.map +1 -0
- package/dist/app/AdminRoot.d.cts +5 -2
- package/dist/app/AdminRoot.d.ts +5 -2
- package/dist/components/Alert/Alert.d.cts +1 -1
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/AuthLayout/AuthLayout.d.cts +2 -2
- package/dist/components/AuthLayout/AuthLayout.d.ts +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +2 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -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/Card.d.cts +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/index.cjs +1 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Chip/Chip.d.cts +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Chip/index.cjs +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/ChoiceCard/ChoiceCard.d.cts +1 -1
- package/dist/components/ChoiceCard/ChoiceCard.d.ts +1 -1
- package/dist/components/ChoiceCard/index.cjs +1 -1
- package/dist/components/ChoiceCard/index.js +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.cts +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.ts +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/DateTimePicker.d.cts +2 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/dist/components/DateTimePicker/index.cjs +1 -1
- package/dist/components/DateTimePicker/index.js +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.cts +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +1 -1
- package/dist/components/DescriptionList/index.cjs +1 -1
- package/dist/components/DescriptionList/index.js +1 -1
- package/dist/components/Dropdown/index.cjs +1 -1
- package/dist/components/Dropdown/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/FileCard.d.cts +5 -2
- package/dist/components/FileCard/FileCard.d.ts +5 -2
- package/dist/components/FileCard/index.cjs +1 -1
- package/dist/components/FileCard/index.js +1 -1
- package/dist/components/FileUploader/FileUploader.d.cts +5 -5
- package/dist/components/FileUploader/FileUploader.d.ts +5 -5
- package/dist/components/FileUploader/index.cjs +1 -1
- package/dist/components/FileUploader/index.js +1 -1
- package/dist/components/Flag/index.cjs +1 -1
- package/dist/components/Flag/index.js +1 -1
- package/dist/components/FloatingPanel/FloatingPanel.d.cts +6 -5
- package/dist/components/FloatingPanel/FloatingPanel.d.ts +6 -5
- 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/List/index.cjs +1 -1
- package/dist/components/List/index.js +2 -2
- package/dist/components/Loader/Loader.d.cts +1 -1
- package/dist/components/Loader/Loader.d.ts +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/Modal.d.cts +1 -1
- package/dist/components/Modal/Modal.d.ts +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/OtpField.d.cts +1 -1
- package/dist/components/OtpField/OtpField.d.ts +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/PageLayout.d.cts +2 -2
- package/dist/components/PageLayout/PageLayout.d.ts +2 -2
- 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/Popover/Popover.d.cts +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Progress/index.cjs +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/QrCode/QrCode.d.cts +5 -2
- package/dist/components/QrCode/QrCode.d.ts +5 -2
- 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/RichTextEditor.d.cts +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RootLayout/RootLayout.d.cts +12 -5
- package/dist/components/RootLayout/RootLayout.d.ts +12 -5
- 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/Slider.d.cts +2 -2
- package/dist/components/Slider/Slider.d.ts +2 -2
- 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/Stepper.d.cts +2 -2
- package/dist/components/Stepper/Stepper.d.ts +2 -2
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Table/Table.d.cts +1 -1
- package/dist/components/Table/Table.d.ts +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/TagsField.d.cts +1 -1
- package/dist/components/TagsField/TagsField.d.ts +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/TranslatedFields.d.cts +1 -1
- package/dist/components/TranslatedFields/TranslatedFields.d.ts +1 -1
- package/dist/components/TranslatedFields/index.cjs +1 -1
- package/dist/components/TranslatedFields/index.js +1 -1
- package/dist/components/UserCard/UserCard.d.cts +6 -5
- package/dist/components/UserCard/UserCard.d.ts +6 -5
- package/dist/components/UserCard/index.cjs +1 -1
- package/dist/components/UserCard/index.js +1 -1
- package/dist/entries/app.cjs +1 -1
- package/dist/entries/app.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +56 -56
- package/dist/entries/i18n.cjs +1 -1
- package/dist/entries/i18n.js +2 -2
- package/dist/entries/theme.cjs +1 -1
- package/dist/entries/theme.js +1 -1
- package/dist/form/useForm.d.cts +1 -1
- package/dist/form/useForm.d.ts +1 -1
- package/dist/hooks/useMediaQuery.d.cts +3 -3
- package/dist/hooks/useMediaQuery.d.ts +3 -3
- package/dist/i18n/messages.d.cts +20 -0
- package/dist/i18n/messages.d.ts +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +3 -3
- package/dist/index.js +59 -59
- package/dist/{messages-BasxRpyx.js → messages-BiRLMy1E.js} +177 -37
- package/dist/messages-BiRLMy1E.js.map +1 -0
- package/dist/{messages-CElolVGm.cjs → messages-C_fRRCg6.cjs} +9 -9
- package/dist/messages-C_fRRCg6.cjs.map +1 -0
- package/dist/theme/ConfigProvider.d.cts +19 -10
- package/dist/theme/ConfigProvider.d.ts +19 -10
- package/dist/useForm-CGbJ44Gp.js.map +1 -1
- package/dist/useForm-CSw6r1n1.cjs.map +1 -1
- package/dist/{useHomeTo-BnjXms11.cjs → useHomeTo-BaM7kBDh.cjs} +2 -2
- package/dist/{useHomeTo-BnjXms11.cjs.map → useHomeTo-BaM7kBDh.cjs.map} +1 -1
- package/dist/{useHomeTo-Btkk0RSB.js → useHomeTo-DQj9tVZI.js} +2 -2
- package/dist/{useHomeTo-Btkk0RSB.js.map → useHomeTo-DQj9tVZI.js.map} +1 -1
- package/dist/useMediaQuery-CHMrI6Dy.cjs.map +1 -1
- package/dist/useMediaQuery-DrDUrkmJ.js.map +1 -1
- package/dist/{useOptionMenu-IebDGoqk.cjs → useOptionMenu-BKC1y6oj.cjs} +2 -2
- package/dist/{useOptionMenu-IebDGoqk.cjs.map → useOptionMenu-BKC1y6oj.cjs.map} +1 -1
- package/dist/{useOptionMenu-DeW68na-.js → useOptionMenu-Dom1-bqm.js} +5 -5
- package/dist/{useOptionMenu-DeW68na-.js.map → useOptionMenu-Dom1-bqm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminRoot-aOYQtzF0.js +0 -109
- package/dist/AdminRoot-aOYQtzF0.js.map +0 -1
- package/dist/AdminRoot-ajWIf94J.cjs +0 -2
- package/dist/AdminRoot-ajWIf94J.cjs.map +0 -1
- package/dist/Alert-5tpyGb2M.cjs +0 -2
- package/dist/Alert-5tpyGb2M.cjs.map +0 -1
- package/dist/Alert-Dz0sNGpz.js +0 -70
- package/dist/Alert-Dz0sNGpz.js.map +0 -1
- package/dist/Breadcrumbs-B6Pii2Y_.cjs.map +0 -1
- package/dist/Breadcrumbs-DKYJOdHZ.js.map +0 -1
- package/dist/Card-CIRGqg3P.cjs +0 -2
- package/dist/Card-CIRGqg3P.cjs.map +0 -1
- package/dist/Card-Co3A4Qgo.js +0 -128
- package/dist/Card-Co3A4Qgo.js.map +0 -1
- package/dist/Chip-BjSNgaAf.js.map +0 -1
- package/dist/Chip-Dp8skUZ2.cjs.map +0 -1
- package/dist/ChoiceCardGroup-143hR0v_.cjs +0 -2
- package/dist/ChoiceCardGroup-Cx8CtmPl.js +0 -180
- package/dist/ChoiceCardGroup-Cx8CtmPl.js.map +0 -1
- package/dist/CodeBlock-CcJjS0_q.js.map +0 -1
- package/dist/CodeBlock-o_VSkAek.cjs.map +0 -1
- package/dist/ColorPicker-DY6Vk1uS.cjs +0 -2
- package/dist/ConfigProvider-Bgu85MsI.js.map +0 -1
- package/dist/ConfigProvider-DELhJlqo.cjs.map +0 -1
- package/dist/DatePicker-CwZ_-ElE.cjs +0 -2
- package/dist/DateTimePicker-C2871cuc.js.map +0 -1
- package/dist/DateTimePicker-DdEPtw9U.cjs +0 -2
- package/dist/DateTimePicker-DdEPtw9U.cjs.map +0 -1
- package/dist/DescriptionList-BP4CDME5.js.map +0 -1
- package/dist/DescriptionList-BWw0Fe6U.cjs.map +0 -1
- package/dist/FileCard-COc4rHe-.cjs.map +0 -1
- package/dist/FileCard-CWwB8CWF.js.map +0 -1
- package/dist/FileUploader--WOmlhSh.js.map +0 -1
- package/dist/FileUploader-Bqy_fV7l.cjs.map +0 -1
- package/dist/ListItem-Qo1Tt6Fi.cjs +0 -2
- package/dist/Modal--5EbLfMz.cjs.map +0 -1
- package/dist/Modal-Dfwc9eIq.js.map +0 -1
- package/dist/OtpField-Dy-LKTi9.js +0 -174
- package/dist/OtpField-Dy-LKTi9.js.map +0 -1
- package/dist/OtpField-KHwdaajC.cjs +0 -2
- package/dist/OtpField-KHwdaajC.cjs.map +0 -1
- package/dist/PageLayout-Bt6U_80d.cjs.map +0 -1
- package/dist/PageLayout-Df1SOlr7.js.map +0 -1
- package/dist/Pagination-DDMq_7OZ.js +0 -139
- package/dist/Pagination-DDMq_7OZ.js.map +0 -1
- package/dist/Pagination-UMeckhmY.cjs +0 -2
- package/dist/Pagination-UMeckhmY.cjs.map +0 -1
- package/dist/QrCode-B9YbQNVc.js +0 -80
- package/dist/QrCode-B9YbQNVc.js.map +0 -1
- package/dist/QrCode-CNVYpz9j.cjs +0 -2
- package/dist/QrCode-CNVYpz9j.cjs.map +0 -1
- package/dist/RichTextEditor-Dv-LDsN-.js.map +0 -1
- package/dist/RichTextEditor-lmPGowSR.cjs +0 -2
- package/dist/RichTextEditor-lmPGowSR.cjs.map +0 -1
- package/dist/RootLayout-B_ZtI-L_.cjs +0 -2
- package/dist/RootLayout-B_ZtI-L_.cjs.map +0 -1
- package/dist/RootLayout-DIOquzrU.js +0 -642
- package/dist/RootLayout-DIOquzrU.js.map +0 -1
- package/dist/Sidebar-CfEx7W7i.cjs +0 -2
- package/dist/Slider-0joKXhPo.cjs +0 -2
- package/dist/Slider-0joKXhPo.cjs.map +0 -1
- package/dist/Slider-CwZYxDO0.js +0 -184
- package/dist/Slider-CwZYxDO0.js.map +0 -1
- package/dist/Stepper-D7An-ugU.cjs.map +0 -1
- package/dist/Stepper-DYpiLhzD.js.map +0 -1
- package/dist/Table-BhaH8EKZ.cjs.map +0 -1
- package/dist/Table-DK4GBKS3.js.map +0 -1
- package/dist/TagsField-Cg9YVl7G.js.map +0 -1
- package/dist/TagsField-DwZLCIeb.cjs +0 -2
- package/dist/TagsField-DwZLCIeb.cjs.map +0 -1
- package/dist/TimePicker-_Ak5yB_5.cjs +0 -2
- package/dist/TranslatedFields-B-BU17IV.cjs +0 -2
- package/dist/TranslatedFields-B-BU17IV.cjs.map +0 -1
- package/dist/TranslatedFields-JnqLgUiF.js +0 -86
- package/dist/TranslatedFields-JnqLgUiF.js.map +0 -1
- package/dist/UserCard-B9bzkZph.cjs.map +0 -1
- package/dist/UserCard-DYK6S-nr.js.map +0 -1
- package/dist/messages-BasxRpyx.js.map +0 -1
- package/dist/messages-CElolVGm.cjs.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Modal--5EbLfMz.cjs","sources":["../src/components/Overlay/Overlay.tsx","../src/components/Modal/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Overlay.module.css'\n\nexport interface OverlayProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the overlay is mounted + shown — gates the portal and drives the fade-in. */\n open: boolean\n /** Requested dismiss — fired on a backdrop click (`closeOnBackdrop`) or Escape (`closeOnEscape`). */\n onClose?: () => void\n /** Close when the scrim itself (outside the content) is clicked. Defaults to `true`. */\n closeOnBackdrop?: boolean\n /** Close when Escape is pressed while focus is within the overlay. Defaults to `true`. */\n closeOnEscape?: boolean\n /** Lock page scroll while open. Defaults to `true`. */\n lockScroll?: boolean\n /** Scrim darkness — the black backdrop's alpha (0–1). Defaults to `0.45`. */\n dim?: number\n /** Overlay content — typically a centered dialog / box / media. */\n children?: ReactNode\n}\n\n/**\n * The shared backdrop primitive behind every dimmed, page-blocking surface (`Modal`, the FileUploader\n * lightbox). Portals a fixed full-viewport scrim to `<body>`, locks page scroll, fades in (opacity keyed\n * off a rAF `visible` flag → `data-open`), and dismisses on **backdrop-click** (gated on the pointer-down\n * AND click both landing on the scrim, so a text-selection drag ending on it doesn't close) / **Escape**\n * (swallowed via `stopPropagation` so it can't reach a React-tree ancestor overlay). Centers its children\n * by default; consumers layer their own padding / scroll / placement via `className` + `data-*` and read\n * the shared `data-open` on the scrim for their own box's enter transform. A consumer `onKeyDown` still\n * fires (after the Escape handling) so it can add e.g. a Tab focus-trap. Internal — no `index.ts`, so it's\n * never exposed as a package subpath; import it via `../Overlay/Overlay`. The ref points at the scrim div.\n */\nexport const Overlay = forwardRef<HTMLDivElement, OverlayProps>(function Overlay(\n {\n open,\n onClose,\n closeOnBackdrop = true,\n closeOnEscape = true,\n lockScroll = true,\n dim,\n className,\n style,\n children,\n onKeyDown,\n onMouseDown,\n onClick,\n ...props\n },\n ref,\n) {\n const mouseDownTarget = useRef<EventTarget | null>(null)\n const [visible, setVisible] = useState(false)\n\n useLockBodyScroll(open && lockScroll)\n\n // enter animation: flip `visible` on the frame after mount so the opacity transition runs\n useEffect(() => {\n if (!open) {\n setVisible(false)\n return\n }\n const raf = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(raf)\n }, [open])\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n // the overlay owns the page — swallow Escape so it can't reach a React-tree ancestor overlay (e.g.\n // an outer Modal) even when this one isn't Escape-dismissible\n event.stopPropagation()\n if (closeOnEscape) onClose?.()\n }\n onKeyDown?.(event)\n }\n // remember where the pointer went down so the click handler can tell a scrim click from a drag that\n // started inside the content and ended on the scrim (a text-selection drag)\n const handleMouseDown = (event: MouseEvent<HTMLDivElement>) => {\n mouseDownTarget.current = event.target\n onMouseDown?.(event)\n }\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n if (\n closeOnBackdrop &&\n event.target === event.currentTarget &&\n mouseDownTarget.current === event.currentTarget\n ) {\n onClose?.()\n }\n onClick?.(event)\n }\n\n if (!open || typeof document === 'undefined') return null\n\n return createPortal(\n <div\n ref={ref}\n className={clsx(styles.overlay, className)}\n data-open={visible ? 'true' : 'false'}\n style={dim != null ? ({ '--tz-overlay-dim': dim, ...style } as CSSProperties) : style}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n {...props}\n >\n {children}\n </div>,\n document.body,\n )\n})\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Overlay } from '../Overlay/Overlay'\nimport styles from './Modal.module.css'\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'fullScreen'\nexport type ModalScrollBehavior = 'inside' | 'outside'\nexport type ModalPlacement = 'center' | 'left' | 'right'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\n/** Focusable descendants used by the focus trap + initial focus. */\n// every clause excludes tabindex=\"-1\" so decorative/programmatic-only nodes (e.g. the header's\n// `nonClickable aria-hidden` IconButton) don't count as trap boundaries or initial-focus targets\nconst FOCUSABLE =\n 'a[href]:not([tabindex=\"-1\"]), button:not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), input:not(:disabled):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])'\n\n/** Body FIELDS — where a form modal's initial focus lands (buttons / links in content don't count). */\nconst FIELD =\n 'input:not([type=\"hidden\"]):not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), [contenteditable]:not([contenteditable=\"false\"]):not([tabindex=\"-1\"])'\n\n/**\n * Focus the first candidate that actually takes focus (a field inside a hidden tab panel won't). A radio\n * lands on its group's checked option, as Tab would.\n */\nfunction focusFirst(candidates: ArrayLike<HTMLElement>): boolean {\n const list = Array.from(candidates)\n for (const candidate of list) {\n const el =\n candidate instanceof HTMLInputElement && candidate.type === 'radio' && !candidate.checked\n ? (list.find(\n (other) =>\n other instanceof HTMLInputElement &&\n other.type === 'radio' &&\n other.name === candidate.name &&\n other.checked,\n ) ?? candidate)\n : candidate\n el.focus({ preventScroll: true })\n if (document.activeElement === el) return true\n }\n return false\n}\n\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** Whether the modal is open — gates the portal and drives the enter animation. */\n open: boolean\n /** Called when a dismiss is requested (close button, backdrop click, or Escape). */\n onClose: () => void\n /** Preset width: `sm` 360 · `md` 620 · `lg` 900 px, or `fullScreen` (fills the viewport). Defaults to `md`. */\n size?: ModalSize\n /**\n * Where overflow scrolls when the content is taller than the viewport: `outside` (default — the\n * whole dialog grows and the overlay/page scrolls) or `inside` (the body scrolls while the header +\n * footer stay pinned). Ignored for side-drawer placements (`left`/`right`), which always scroll inside.\n */\n scrollBehavior?: ModalScrollBehavior\n /**\n * Where the dialog sits: `center` (default — the standard centered modal), or `left` / `right` to\n * make it a **full-height side drawer** (sheet) that slides in from that edge. A drawer takes its\n * width from `size`, fills the viewport height, and always scrolls its body inside (header + footer\n * stay pinned).\n */\n placement?: ModalPlacement\n /** Header title. When set, labels the dialog (`aria-labelledby`). */\n title?: ReactNode\n /** Muted description line under the title (e.g. a confirm prompt). */\n description?: ReactNode\n /** Leading header icon shown in a tinted box (like `Card`) — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Theme color that tints the leading icon box. Defaults to `accent`. */\n color?: ThemeColor\n /** Footer slot — right-aligned actions over a top divider (e.g. Cancel / Confirm buttons). */\n footer?: ReactNode\n /** Extra class on the scrollable body element — to tune its padding / layout (e.g. a compact confirm). */\n bodyClassName?: string\n /** Show the header × close button. Defaults to `true`. */\n showCloseButton?: boolean\n /** Close when the backdrop (outside the dialog) is clicked. Defaults to `true`. */\n closeOnBackdrop?: boolean\n /** Close when Escape is pressed. Defaults to `true`. */\n closeOnEscape?: boolean\n /** Accessible label — used when there's no `title`. */\n ariaLabel?: string\n /** Dialog body. */\n children?: ReactNode\n}\n\n/**\n * A centered, backdrop-dimmed overlay dialog. Portaled to `<body>`, it locks page scroll while open,\n * traps Tab focus inside, restores focus to the previously-focused element on close, and dismisses on\n * close button / backdrop click / Escape (each toggleable). Sizes are `sm`/`md`/`lg` (max-width caps)\n * or `fullScreen`; `scrollBehavior` picks inside-body vs. whole-dialog scrolling. `placement` turns it\n * into a full-height side drawer (`left`/`right`) that slides in from the edge. The header mirrors\n * `Card` — an optional tinted `icon` box + `title` + `description`. Controlled by `open` + `onClose`.\n * The forwarded ref points at the dialog element.\n *\n * @example\n * const { isOpen, open, close } = useDisclosure()\n * <Modal open={isOpen} onClose={close} title=\"Edit\" footer={<Button onClick={close}>Done</Button>}>\n * …\n * </Modal>\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n {\n open,\n onClose,\n size = 'md',\n scrollBehavior = 'outside',\n placement = 'center',\n title,\n description,\n icon,\n color = 'accent',\n footer,\n bodyClassName,\n showCloseButton = true,\n closeOnBackdrop = true,\n closeOnEscape = true,\n ariaLabel,\n className,\n style,\n children,\n ...props\n },\n forwardedRef,\n) {\n const t = useT()\n const panelRef = useRef<HTMLDivElement | null>(null)\n const bodyRef = useRef<HTMLDivElement | null>(null)\n const footerRef = useRef<HTMLDivElement | null>(null)\n const titleId = useId()\n const descId = useId()\n\n // portal + scrim + scroll-lock + fade-in + backdrop-dismiss are handled by the shared `<Overlay>`\n\n // the element focused before opening — read during the render that opens the modal, because an\n // `autoFocus` element inside moves focus on mount, before any effect could see the opener\n const openerRef = useRef<HTMLElement | null>(null)\n const wasOpenRef = useRef(false)\n if (open !== wasOpenRef.current) {\n wasOpenRef.current = open\n if (open && typeof document !== 'undefined') {\n openerRef.current = document.activeElement as HTMLElement | null\n }\n }\n\n // focus management on open — an explicit `autoFocus` inside wins; else the first body FIELD (form\n // modals land on their first input), else the first footer action (a confirm dialog lands on\n // Cancel/Confirm, a sheet on its Close), else the dialog panel itself. Never \"any control in the\n // body\": a copy / icon / link button deep in content isn't where focus should start (it would also\n // pop that button's tooltip). The Tab trap still reaches every control. Restore on close.\n useEffect(() => {\n if (!open) return\n const panel = panelRef.current\n const opener = openerRef.current\n if (!panel?.contains(document.activeElement)) {\n // preventScroll so opening an `outside`-scroll modal doesn't jump the overlay to a below-fold control\n const placed =\n focusFirst(bodyRef.current?.querySelectorAll<HTMLElement>(FIELD) ?? []) ||\n focusFirst(footerRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? [])\n if (!placed) panel?.focus({ preventScroll: true })\n }\n // only restore if the element is still mounted (it may have unmounted while the modal was open)\n return () => {\n if (opener?.isConnected) opener.focus?.()\n }\n }, [open])\n\n // merge the panel ref (positioning/focus) with the forwarded ref (consumer access)\n const setPanelRef = (node: HTMLDivElement | null) => {\n panelRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n // trap Tab within the dialog so focus can't strand on the locked page behind it (Escape + backdrop\n // dismissal live in `<Overlay>`; this fires after the overlay's own handler)\n const handleTabTrap = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Tab') return\n const panel = panelRef.current\n if (!panel) return\n const focusables = [...panel.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => el.offsetParent !== null || el === document.activeElement,\n )\n if (focusables.length === 0) {\n event.preventDefault()\n panel.focus()\n return\n }\n const first = focusables[0]\n const last = focusables[focusables.length - 1]\n const active = document.activeElement\n if (event.shiftKey && (active === first || active === panel)) {\n event.preventDefault()\n last.focus()\n } else if (!event.shiftKey && active === last) {\n event.preventDefault()\n first.focus()\n }\n }\n\n if (!open) return null\n\n // a side drawer (left/right) is always full-height with the body scrolling inside (header/footer pinned)\n const isDrawer = placement !== 'center'\n\n const renderedIcon =\n icon == null ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n const hasHeader = title != null || description != null || renderedIcon != null || showCloseButton\n // a divider sets the header apart from the body/footer, like Card\n const headerDivided = children != null || footer != null\n\n return (\n <Overlay\n open={open}\n onClose={onClose}\n closeOnBackdrop={closeOnBackdrop}\n closeOnEscape={closeOnEscape}\n onKeyDown={handleTabTrap}\n className={styles.overlay}\n data-size={size}\n data-placement={placement}\n data-scroll={isDrawer ? 'inside' : scrollBehavior}\n >\n <div\n ref={setPanelRef}\n className={clsx(styles.modal, styles[size], className)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? titleId : undefined}\n aria-label={title == null ? ariaLabel : undefined}\n aria-describedby={description != null ? descId : undefined}\n tabIndex={-1}\n style={style as CSSProperties}\n {...props}\n >\n {hasHeader && (\n <div className={clsx(styles.header, headerDivided && styles.headerDivided)}>\n <div className={styles.headerMain}>\n {renderedIcon != null && (\n <IconButton\n variant=\"filled\"\n size=\"sm\"\n color={color}\n nonClickable\n aria-hidden\n className={styles.icon}\n >\n {renderedIcon}\n </IconButton>\n )}\n {(title != null || description != null) && (\n <div className={styles.headerText}>\n {title != null && (\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n )}\n {description != null && (\n <div id={descId} className={styles.subtitle}>\n {description}\n </div>\n )}\n </div>\n )}\n </div>\n {showCloseButton && (\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n size=\"sm\"\n className={styles.close}\n aria-label={t('common.close')}\n onClick={onClose}\n >\n <Icon name=\"Close\" />\n </IconButton>\n )}\n </div>\n )}\n {children != null && (\n <div ref={bodyRef} className={clsx(styles.body, bodyClassName)}>\n {children}\n </div>\n )}\n {footer != null && (\n <div ref={footerRef} className={styles.footer}>\n {footer}\n </div>\n )}\n </div>\n </Overlay>\n )\n})\n"],"names":["Overlay","forwardRef","open","onClose","closeOnBackdrop","closeOnEscape","lockScroll","dim","className","style","children","onKeyDown","onMouseDown","onClick","props","ref","mouseDownTarget","useRef","visible","setVisible","useState","useLockBodyScroll","useEffect","raf","handleKeyDown","event","handleMouseDown","handleClick","createPortal","jsx","clsx","styles","ICON_NAME_SET","ICON_NAMES","FOCUSABLE","FIELD","focusFirst","candidates","list","candidate","el","other","Modal","size","scrollBehavior","placement","title","description","icon","color","footer","bodyClassName","showCloseButton","ariaLabel","forwardedRef","t","useT","panelRef","bodyRef","footerRef","titleId","useId","descId","openerRef","wasOpenRef","panel","opener","_a","_b","setPanelRef","node","handleTabTrap","focusables","first","last","active","isDrawer","renderedIcon","Icon","hasHeader","headerDivided","jsxs","IconButton"],"mappings":"qTA4CaA,EAAUC,EAAAA,WAAyC,SAC9D,CACE,KAAAC,EACA,QAAAC,EACA,gBAAAC,EAAkB,GAClB,cAAAC,EAAgB,GAChB,WAAAC,EAAa,GACb,IAAAC,EACA,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAC,EACA,QAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAkBC,EAAAA,OAA2B,IAAI,EACjD,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EAE5CC,EAAAA,kBAAkBnB,GAAQI,CAAU,EAGpCgB,EAAAA,UAAU,IAAM,CACd,GAAI,CAACpB,EAAM,CACTiB,EAAW,EAAK,EAChB,MACF,CACA,MAAMI,EAAM,sBAAsB,IAAMJ,EAAW,EAAI,CAAC,EACxD,MAAO,IAAM,qBAAqBI,CAAG,CACvC,EAAG,CAACrB,CAAI,CAAC,EAET,MAAMsB,EAAiBC,GAAyC,CAC1DA,EAAM,MAAQ,WAGhBA,EAAM,gBAAA,EACFpB,IAAeF,GAAA,MAAAA,MAErBQ,GAAA,MAAAA,EAAYc,EACd,EAGMC,EAAmBD,GAAsC,CAC7DT,EAAgB,QAAUS,EAAM,OAChCb,GAAA,MAAAA,EAAca,EAChB,EACME,EAAeF,GAAsC,CAEvDrB,GACAqB,EAAM,SAAWA,EAAM,eACvBT,EAAgB,UAAYS,EAAM,gBAElCtB,GAAA,MAAAA,KAEFU,GAAA,MAAAA,EAAUY,EAC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AY,GACZ,cAAW,GACX,UAAWlB,EAAO,KAEjB,SAAA8C,CAAA,CAAA,GAGH/B,GAAS,MAAQC,GAAe,cAC/B,MAAA,CAAI,UAAWhB,EAAO,WACpB,SAAA,CAAAe,GAAS,YACP,MAAA,CAAI,GAAIc,EAAS,UAAW7B,EAAO,MACjC,SAAAe,CAAA,CACH,EAEDC,GAAe,MACdlB,MAAC,MAAA,CAAI,GAAIiC,EAAQ,UAAW/B,EAAO,SAChC,SAAAgB,CAAA,CACH,CAAA,CAAA,CAEJ,CAAA,EAEJ,EACCK,GACCvB,EAAAA,IAACqD,EAAAA,WAAA,CACC,QAAQ,SACR,MAAM,UACN,KAAK,KACL,UAAWnD,EAAO,MAClB,aAAYwB,EAAE,cAAc,EAC5B,QAASpD,EAET,SAAA0B,EAAAA,IAACiD,EAAAA,KAAA,CAAK,KAAK,OAAA,CAAQ,CAAA,CAAA,CACrB,EAEJ,EAEDpE,GAAY,MACXmB,EAAAA,IAAC,MAAA,CAAI,IAAK6B,EAAS,UAAW5B,EAAAA,KAAKC,EAAO,KAAMoB,CAAa,EAC1D,SAAAzC,CAAA,CACH,EAEDwC,GAAU,MACTrB,MAAC,MAAA,CAAI,IAAK8B,EAAW,UAAW5B,EAAO,OACpC,SAAAmB,CAAA,CACH,CAAA,CAAA,CAAA,CAEJ,CAAA,CAGN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Modal-Dfwc9eIq.js","sources":["../src/components/Overlay/Overlay.tsx","../src/components/Modal/Modal.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent,\n type MouseEvent,\n type ReactNode,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Overlay.module.css'\n\nexport interface OverlayProps extends HTMLAttributes<HTMLDivElement> {\n /** Whether the overlay is mounted + shown — gates the portal and drives the fade-in. */\n open: boolean\n /** Requested dismiss — fired on a backdrop click (`closeOnBackdrop`) or Escape (`closeOnEscape`). */\n onClose?: () => void\n /** Close when the scrim itself (outside the content) is clicked. Defaults to `true`. */\n closeOnBackdrop?: boolean\n /** Close when Escape is pressed while focus is within the overlay. Defaults to `true`. */\n closeOnEscape?: boolean\n /** Lock page scroll while open. Defaults to `true`. */\n lockScroll?: boolean\n /** Scrim darkness — the black backdrop's alpha (0–1). Defaults to `0.45`. */\n dim?: number\n /** Overlay content — typically a centered dialog / box / media. */\n children?: ReactNode\n}\n\n/**\n * The shared backdrop primitive behind every dimmed, page-blocking surface (`Modal`, the FileUploader\n * lightbox). Portals a fixed full-viewport scrim to `<body>`, locks page scroll, fades in (opacity keyed\n * off a rAF `visible` flag → `data-open`), and dismisses on **backdrop-click** (gated on the pointer-down\n * AND click both landing on the scrim, so a text-selection drag ending on it doesn't close) / **Escape**\n * (swallowed via `stopPropagation` so it can't reach a React-tree ancestor overlay). Centers its children\n * by default; consumers layer their own padding / scroll / placement via `className` + `data-*` and read\n * the shared `data-open` on the scrim for their own box's enter transform. A consumer `onKeyDown` still\n * fires (after the Escape handling) so it can add e.g. a Tab focus-trap. Internal — no `index.ts`, so it's\n * never exposed as a package subpath; import it via `../Overlay/Overlay`. The ref points at the scrim div.\n */\nexport const Overlay = forwardRef<HTMLDivElement, OverlayProps>(function Overlay(\n {\n open,\n onClose,\n closeOnBackdrop = true,\n closeOnEscape = true,\n lockScroll = true,\n dim,\n className,\n style,\n children,\n onKeyDown,\n onMouseDown,\n onClick,\n ...props\n },\n ref,\n) {\n const mouseDownTarget = useRef<EventTarget | null>(null)\n const [visible, setVisible] = useState(false)\n\n useLockBodyScroll(open && lockScroll)\n\n // enter animation: flip `visible` on the frame after mount so the opacity transition runs\n useEffect(() => {\n if (!open) {\n setVisible(false)\n return\n }\n const raf = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(raf)\n }, [open])\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Escape') {\n // the overlay owns the page — swallow Escape so it can't reach a React-tree ancestor overlay (e.g.\n // an outer Modal) even when this one isn't Escape-dismissible\n event.stopPropagation()\n if (closeOnEscape) onClose?.()\n }\n onKeyDown?.(event)\n }\n // remember where the pointer went down so the click handler can tell a scrim click from a drag that\n // started inside the content and ended on the scrim (a text-selection drag)\n const handleMouseDown = (event: MouseEvent<HTMLDivElement>) => {\n mouseDownTarget.current = event.target\n onMouseDown?.(event)\n }\n const handleClick = (event: MouseEvent<HTMLDivElement>) => {\n if (\n closeOnBackdrop &&\n event.target === event.currentTarget &&\n mouseDownTarget.current === event.currentTarget\n ) {\n onClose?.()\n }\n onClick?.(event)\n }\n\n if (!open || typeof document === 'undefined') return null\n\n return createPortal(\n <div\n ref={ref}\n className={clsx(styles.overlay, className)}\n data-open={visible ? 'true' : 'false'}\n style={dim != null ? ({ '--tz-overlay-dim': dim, ...style } as CSSProperties) : style}\n onKeyDown={handleKeyDown}\n onMouseDown={handleMouseDown}\n onClick={handleClick}\n {...props}\n >\n {children}\n </div>,\n document.body,\n )\n})\n","import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Overlay } from '../Overlay/Overlay'\nimport styles from './Modal.module.css'\n\nexport type ModalSize = 'sm' | 'md' | 'lg' | 'fullScreen'\nexport type ModalScrollBehavior = 'inside' | 'outside'\nexport type ModalPlacement = 'center' | 'left' | 'right'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\n/** Focusable descendants used by the focus trap + initial focus. */\n// every clause excludes tabindex=\"-1\" so decorative/programmatic-only nodes (e.g. the header's\n// `nonClickable aria-hidden` IconButton) don't count as trap boundaries or initial-focus targets\nconst FOCUSABLE =\n 'a[href]:not([tabindex=\"-1\"]), button:not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), input:not(:disabled):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), [tabindex]:not([tabindex=\"-1\"])'\n\n/** Body FIELDS — where a form modal's initial focus lands (buttons / links in content don't count). */\nconst FIELD =\n 'input:not([type=\"hidden\"]):not(:disabled):not([tabindex=\"-1\"]), textarea:not(:disabled):not([tabindex=\"-1\"]), select:not(:disabled):not([tabindex=\"-1\"]), [contenteditable]:not([contenteditable=\"false\"]):not([tabindex=\"-1\"])'\n\n/**\n * Focus the first candidate that actually takes focus (a field inside a hidden tab panel won't). A radio\n * lands on its group's checked option, as Tab would.\n */\nfunction focusFirst(candidates: ArrayLike<HTMLElement>): boolean {\n const list = Array.from(candidates)\n for (const candidate of list) {\n const el =\n candidate instanceof HTMLInputElement && candidate.type === 'radio' && !candidate.checked\n ? (list.find(\n (other) =>\n other instanceof HTMLInputElement &&\n other.type === 'radio' &&\n other.name === candidate.name &&\n other.checked,\n ) ?? candidate)\n : candidate\n el.focus({ preventScroll: true })\n if (document.activeElement === el) return true\n }\n return false\n}\n\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** Whether the modal is open — gates the portal and drives the enter animation. */\n open: boolean\n /** Called when a dismiss is requested (close button, backdrop click, or Escape). */\n onClose: () => void\n /** Preset width: `sm` 360 · `md` 620 · `lg` 900 px, or `fullScreen` (fills the viewport). Defaults to `md`. */\n size?: ModalSize\n /**\n * Where overflow scrolls when the content is taller than the viewport: `outside` (default — the\n * whole dialog grows and the overlay/page scrolls) or `inside` (the body scrolls while the header +\n * footer stay pinned). Ignored for side-drawer placements (`left`/`right`), which always scroll inside.\n */\n scrollBehavior?: ModalScrollBehavior\n /**\n * Where the dialog sits: `center` (default — the standard centered modal), or `left` / `right` to\n * make it a **full-height side drawer** (sheet) that slides in from that edge. A drawer takes its\n * width from `size`, fills the viewport height, and always scrolls its body inside (header + footer\n * stay pinned).\n */\n placement?: ModalPlacement\n /** Header title. When set, labels the dialog (`aria-labelledby`). */\n title?: ReactNode\n /** Muted description line under the title (e.g. a confirm prompt). */\n description?: ReactNode\n /** Leading header icon shown in a tinted box (like `Card`) — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Theme color that tints the leading icon box. Defaults to `accent`. */\n color?: ThemeColor\n /** Footer slot — right-aligned actions over a top divider (e.g. Cancel / Confirm buttons). */\n footer?: ReactNode\n /** Extra class on the scrollable body element — to tune its padding / layout (e.g. a compact confirm). */\n bodyClassName?: string\n /** Show the header × close button. Defaults to `true`. */\n showCloseButton?: boolean\n /** Close when the backdrop (outside the dialog) is clicked. Defaults to `true`. */\n closeOnBackdrop?: boolean\n /** Close when Escape is pressed. Defaults to `true`. */\n closeOnEscape?: boolean\n /** Accessible label — used when there's no `title`. */\n ariaLabel?: string\n /** Dialog body. */\n children?: ReactNode\n}\n\n/**\n * A centered, backdrop-dimmed overlay dialog. Portaled to `<body>`, it locks page scroll while open,\n * traps Tab focus inside, restores focus to the previously-focused element on close, and dismisses on\n * close button / backdrop click / Escape (each toggleable). Sizes are `sm`/`md`/`lg` (max-width caps)\n * or `fullScreen`; `scrollBehavior` picks inside-body vs. whole-dialog scrolling. `placement` turns it\n * into a full-height side drawer (`left`/`right`) that slides in from the edge. The header mirrors\n * `Card` — an optional tinted `icon` box + `title` + `description`. Controlled by `open` + `onClose`.\n * The forwarded ref points at the dialog element.\n *\n * @example\n * const { isOpen, open, close } = useDisclosure()\n * <Modal open={isOpen} onClose={close} title=\"Edit\" footer={<Button onClick={close}>Done</Button>}>\n * …\n * </Modal>\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n {\n open,\n onClose,\n size = 'md',\n scrollBehavior = 'outside',\n placement = 'center',\n title,\n description,\n icon,\n color = 'accent',\n footer,\n bodyClassName,\n showCloseButton = true,\n closeOnBackdrop = true,\n closeOnEscape = true,\n ariaLabel,\n className,\n style,\n children,\n ...props\n },\n forwardedRef,\n) {\n const t = useT()\n const panelRef = useRef<HTMLDivElement | null>(null)\n const bodyRef = useRef<HTMLDivElement | null>(null)\n const footerRef = useRef<HTMLDivElement | null>(null)\n const titleId = useId()\n const descId = useId()\n\n // portal + scrim + scroll-lock + fade-in + backdrop-dismiss are handled by the shared `<Overlay>`\n\n // the element focused before opening — read during the render that opens the modal, because an\n // `autoFocus` element inside moves focus on mount, before any effect could see the opener\n const openerRef = useRef<HTMLElement | null>(null)\n const wasOpenRef = useRef(false)\n if (open !== wasOpenRef.current) {\n wasOpenRef.current = open\n if (open && typeof document !== 'undefined') {\n openerRef.current = document.activeElement as HTMLElement | null\n }\n }\n\n // focus management on open — an explicit `autoFocus` inside wins; else the first body FIELD (form\n // modals land on their first input), else the first footer action (a confirm dialog lands on\n // Cancel/Confirm, a sheet on its Close), else the dialog panel itself. Never \"any control in the\n // body\": a copy / icon / link button deep in content isn't where focus should start (it would also\n // pop that button's tooltip). The Tab trap still reaches every control. Restore on close.\n useEffect(() => {\n if (!open) return\n const panel = panelRef.current\n const opener = openerRef.current\n if (!panel?.contains(document.activeElement)) {\n // preventScroll so opening an `outside`-scroll modal doesn't jump the overlay to a below-fold control\n const placed =\n focusFirst(bodyRef.current?.querySelectorAll<HTMLElement>(FIELD) ?? []) ||\n focusFirst(footerRef.current?.querySelectorAll<HTMLElement>(FOCUSABLE) ?? [])\n if (!placed) panel?.focus({ preventScroll: true })\n }\n // only restore if the element is still mounted (it may have unmounted while the modal was open)\n return () => {\n if (opener?.isConnected) opener.focus?.()\n }\n }, [open])\n\n // merge the panel ref (positioning/focus) with the forwarded ref (consumer access)\n const setPanelRef = (node: HTMLDivElement | null) => {\n panelRef.current = node\n if (typeof forwardedRef === 'function') forwardedRef(node)\n else if (forwardedRef) forwardedRef.current = node\n }\n\n // trap Tab within the dialog so focus can't strand on the locked page behind it (Escape + backdrop\n // dismissal live in `<Overlay>`; this fires after the overlay's own handler)\n const handleTabTrap = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Tab') return\n const panel = panelRef.current\n if (!panel) return\n const focusables = [...panel.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => el.offsetParent !== null || el === document.activeElement,\n )\n if (focusables.length === 0) {\n event.preventDefault()\n panel.focus()\n return\n }\n const first = focusables[0]\n const last = focusables[focusables.length - 1]\n const active = document.activeElement\n if (event.shiftKey && (active === first || active === panel)) {\n event.preventDefault()\n last.focus()\n } else if (!event.shiftKey && active === last) {\n event.preventDefault()\n first.focus()\n }\n }\n\n if (!open) return null\n\n // a side drawer (left/right) is always full-height with the body scrolling inside (header/footer pinned)\n const isDrawer = placement !== 'center'\n\n const renderedIcon =\n icon == null ? null : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n const hasHeader = title != null || description != null || renderedIcon != null || showCloseButton\n // a divider sets the header apart from the body/footer, like Card\n const headerDivided = children != null || footer != null\n\n return (\n <Overlay\n open={open}\n onClose={onClose}\n closeOnBackdrop={closeOnBackdrop}\n closeOnEscape={closeOnEscape}\n onKeyDown={handleTabTrap}\n className={styles.overlay}\n data-size={size}\n data-placement={placement}\n data-scroll={isDrawer ? 'inside' : scrollBehavior}\n >\n <div\n ref={setPanelRef}\n className={clsx(styles.modal, styles[size], className)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title != null ? titleId : undefined}\n aria-label={title == null ? ariaLabel : undefined}\n aria-describedby={description != null ? descId : undefined}\n tabIndex={-1}\n style={style as CSSProperties}\n {...props}\n >\n {hasHeader && (\n <div className={clsx(styles.header, headerDivided && styles.headerDivided)}>\n <div className={styles.headerMain}>\n {renderedIcon != null && (\n <IconButton\n variant=\"filled\"\n size=\"sm\"\n color={color}\n nonClickable\n aria-hidden\n className={styles.icon}\n >\n {renderedIcon}\n </IconButton>\n )}\n {(title != null || description != null) && (\n <div className={styles.headerText}>\n {title != null && (\n <div id={titleId} className={styles.title}>\n {title}\n </div>\n )}\n {description != null && (\n <div id={descId} className={styles.subtitle}>\n {description}\n </div>\n )}\n </div>\n )}\n </div>\n {showCloseButton && (\n <IconButton\n variant=\"filled\"\n color=\"primary\"\n size=\"sm\"\n className={styles.close}\n aria-label={t('common.close')}\n onClick={onClose}\n >\n <Icon name=\"Close\" />\n </IconButton>\n )}\n </div>\n )}\n {children != null && (\n <div ref={bodyRef} className={clsx(styles.body, bodyClassName)}>\n {children}\n </div>\n )}\n {footer != null && (\n <div ref={footerRef} className={styles.footer}>\n {footer}\n </div>\n )}\n </div>\n </Overlay>\n )\n})\n"],"names":["Overlay","forwardRef","open","onClose","closeOnBackdrop","closeOnEscape","lockScroll","dim","className","style","children","onKeyDown","onMouseDown","onClick","props","ref","mouseDownTarget","useRef","visible","setVisible","useState","useLockBodyScroll","useEffect","raf","handleKeyDown","event","handleMouseDown","handleClick","createPortal","jsx","clsx","styles","ICON_NAME_SET","ICON_NAMES","FOCUSABLE","FIELD","focusFirst","candidates","list","candidate","el","other","Modal","size","scrollBehavior","placement","title","description","icon","color","footer","bodyClassName","showCloseButton","ariaLabel","forwardedRef","t","useT","panelRef","bodyRef","footerRef","titleId","useId","descId","openerRef","wasOpenRef","panel","opener","_a","_b","setPanelRef","node","handleTabTrap","focusables","first","last","active","isDrawer","renderedIcon","Icon","hasHeader","headerDivided","jsxs","IconButton"],"mappings":";;;;;;;;;;GA4CaA,KAAUC,EAAyC,SAC9D;AAAA,EACE,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,eAAAC,IAAgB;AAAA,EAChB,YAAAC,IAAa;AAAA,EACb,KAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA,GAAGC;AACL,G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AA,oBAEjB,UAAA8C;AAAA,kBAAA;AAAA,gBAAA;AAAA,iBAGH/B,KAAS,QAAQC,KAAe,2BAC/B,OAAA,EAAI,WAAWhB,EAAO,YACpB,UAAA;AAAA,kBAAAe,KAAS,0BACP,OAAA,EAAI,IAAIc,GAAS,WAAW7B,EAAO,OACjC,UAAAe,EAAA,CACH;AAAA,kBAEDC,KAAe,QACd,gBAAAlB,EAAC,OAAA,EAAI,IAAIiC,GAAQ,WAAW/B,EAAO,UAChC,UAAAgB,EAAA,CACH;AAAA,gBAAA,EAAA,CAEJ;AAAA,cAAA,GAEJ;AAAA,cACCK,KACC,gBAAAvB;AAAA,gBAACqD;AAAA,gBAAA;AAAA,kBACC,SAAQ;AAAA,kBACR,OAAM;AAAA,kBACN,MAAK;AAAA,kBACL,WAAWnD,EAAO;AAAA,kBAClB,cAAYwB,EAAE,cAAc;AAAA,kBAC5B,SAASpD;AAAA,kBAET,UAAA,gBAAA0B,EAACiD,GAAA,EAAK,MAAK,QAAA,CAAQ;AAAA,gBAAA;AAAA,cAAA;AAAA,YACrB,GAEJ;AAAA,YAEDpE,KAAY,QACX,gBAAAmB,EAAC,OAAA,EAAI,KAAK6B,GAAS,WAAW5B,EAAKC,EAAO,MAAMoB,CAAa,GAC1D,UAAAzC,EAAA,CACH;AAAA,YAEDwC,KAAU,QACT,gBAAArB,EAAC,OAAA,EAAI,KAAK8B,GAAW,WAAW5B,EAAO,QACpC,UAAAmB,EAAA,CACH;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { jsxs as R, jsx as _ } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as ee, useId as te, useState as re, useRef as se, useEffect as oe } from "react";
|
|
3
|
-
import { clsx as T } from "clsx";
|
|
4
|
-
import { u as ae } from "./formContext-B7ln1Miy.js";
|
|
5
|
-
import { T as z } from "./Typography-ChSuxgkc.js";
|
|
6
|
-
import { f as d } from "./TextField.module-6gYcR9TL.js";
|
|
7
|
-
import { a as le } from "./ConfigProvider-Bgu85MsI.js";
|
|
8
|
-
const ce = "_row_1bbms_2", ne = "_center_1bbms_14", ie = "_end_1bbms_15", fe = "_sm_1bbms_27", de = "_md_1bbms_31", me = "_lg_1bbms_35", ue = "_box_1bbms_41", pe = "_filled_1bbms_65", be = "_invalid_1bbms_82", m = {
|
|
9
|
-
row: ce,
|
|
10
|
-
center: ne,
|
|
11
|
-
end: ie,
|
|
12
|
-
sm: fe,
|
|
13
|
-
md: de,
|
|
14
|
-
lg: me,
|
|
15
|
-
box: ue,
|
|
16
|
-
filled: pe,
|
|
17
|
-
invalid: be
|
|
18
|
-
}, _e = {
|
|
19
|
-
numeric: /[0-9]/,
|
|
20
|
-
alphabetic: /[A-Za-z]/,
|
|
21
|
-
alphanumeric: /[A-Za-z0-9]/
|
|
22
|
-
};
|
|
23
|
-
function he(B, a) {
|
|
24
|
-
const c = [...B].slice(0, a);
|
|
25
|
-
for (; c.length < a; ) c.push("");
|
|
26
|
-
return c;
|
|
27
|
-
}
|
|
28
|
-
const Be = ee(function({
|
|
29
|
-
length: a = 4,
|
|
30
|
-
type: c = "numeric",
|
|
31
|
-
value: v,
|
|
32
|
-
defaultValue: O,
|
|
33
|
-
onChange: x,
|
|
34
|
-
onComplete: g,
|
|
35
|
-
name: n,
|
|
36
|
-
label: h,
|
|
37
|
-
helperText: S,
|
|
38
|
-
error: j,
|
|
39
|
-
required: E = !1,
|
|
40
|
-
disabled: N = !1,
|
|
41
|
-
autoFocus: M = !1,
|
|
42
|
-
placeholder: P,
|
|
43
|
-
size: V = "md",
|
|
44
|
-
align: K = "start",
|
|
45
|
-
color: Z = "primary",
|
|
46
|
-
className: $,
|
|
47
|
-
style: q
|
|
48
|
-
}, C) {
|
|
49
|
-
const H = le(), F = `${te()}-helper`, A = _e[c], u = ae(), w = !!(u && n), o = u && n ? u.field(n) : void 0, L = v !== void 0 ? v : w ? u.values[n] : void 0, I = v !== void 0 || w, [G, J] = re(O ?? ""), Q = I ? L ?? "" : G, y = j ?? (o == null ? void 0 : o.error) ?? !1, D = S ?? (o == null ? void 0 : o.helperText), i = he(Q, a), k = se([]);
|
|
50
|
-
oe(() => {
|
|
51
|
-
var t;
|
|
52
|
-
M && ((t = k.current[0]) == null || t.focus());
|
|
53
|
-
}, []);
|
|
54
|
-
const f = (t) => {
|
|
55
|
-
const e = k.current[Math.max(0, Math.min(t, a - 1))];
|
|
56
|
-
e == null || e.focus(), e == null || e.select();
|
|
57
|
-
}, p = (t) => {
|
|
58
|
-
const e = t.join("");
|
|
59
|
-
I || J(e), w && u.setValue(n, e), x == null || x(e), t.every((r) => r !== "") && (g == null || g(e));
|
|
60
|
-
}, U = (t, e) => {
|
|
61
|
-
const r = [...e].filter((s) => A.test(s));
|
|
62
|
-
if (e !== "" && r.length === 0) return;
|
|
63
|
-
const l = [...i];
|
|
64
|
-
if (r.length <= 1)
|
|
65
|
-
l[t] = r[0] ?? "", p(l), r[0] && f(t + 1);
|
|
66
|
-
else {
|
|
67
|
-
let s = t;
|
|
68
|
-
for (const b of r) {
|
|
69
|
-
if (s >= a) break;
|
|
70
|
-
l[s] = b, s++;
|
|
71
|
-
}
|
|
72
|
-
p(l), f(s);
|
|
73
|
-
}
|
|
74
|
-
}, W = (t, e) => {
|
|
75
|
-
if (e.key === "Backspace") {
|
|
76
|
-
if (i[t] === "" && t > 0) {
|
|
77
|
-
e.preventDefault();
|
|
78
|
-
const r = [...i];
|
|
79
|
-
r[t - 1] = "", p(r), f(t - 1);
|
|
80
|
-
}
|
|
81
|
-
} else if (e.key === "ArrowLeft")
|
|
82
|
-
e.preventDefault(), f(t - 1);
|
|
83
|
-
else if (e.key === "ArrowRight")
|
|
84
|
-
e.preventDefault(), f(t + 1);
|
|
85
|
-
else if (e.key === "Delete") {
|
|
86
|
-
e.preventDefault();
|
|
87
|
-
const r = [...i];
|
|
88
|
-
r[t] = "", p(r);
|
|
89
|
-
}
|
|
90
|
-
}, X = (t, e) => {
|
|
91
|
-
e.preventDefault();
|
|
92
|
-
const r = [...e.clipboardData.getData("text")].filter((b) => A.test(b));
|
|
93
|
-
if (r.length === 0) return;
|
|
94
|
-
const l = [...i];
|
|
95
|
-
let s = t;
|
|
96
|
-
for (const b of r) {
|
|
97
|
-
if (s >= a) break;
|
|
98
|
-
l[s] = b, s++;
|
|
99
|
-
}
|
|
100
|
-
p(l), f(s);
|
|
101
|
-
}, Y = (t) => {
|
|
102
|
-
t.currentTarget.contains(t.relatedTarget) || o == null || o.onBlur(t);
|
|
103
|
-
};
|
|
104
|
-
return /* @__PURE__ */ R(
|
|
105
|
-
"div",
|
|
106
|
-
{
|
|
107
|
-
ref: C,
|
|
108
|
-
className: T(
|
|
109
|
-
d.field,
|
|
110
|
-
y && d.error,
|
|
111
|
-
N && d.disabled,
|
|
112
|
-
$
|
|
113
|
-
),
|
|
114
|
-
style: {
|
|
115
|
-
"--tz-btn-rgb": `var(--tz-color-${Z}-rgb)`,
|
|
116
|
-
...q
|
|
117
|
-
},
|
|
118
|
-
children: [
|
|
119
|
-
h != null && /* @__PURE__ */ R("span", { className: d.label, children: [
|
|
120
|
-
/* @__PURE__ */ _(z, { as: "span", variant: "bodySmall", color: "muted", children: h }),
|
|
121
|
-
E && /* @__PURE__ */ _("span", { className: d.required, "aria-hidden": "true", children: "*" })
|
|
122
|
-
] }),
|
|
123
|
-
/* @__PURE__ */ _(
|
|
124
|
-
"div",
|
|
125
|
-
{
|
|
126
|
-
role: "group",
|
|
127
|
-
"aria-label": typeof h == "string" ? h : "One-time code",
|
|
128
|
-
"aria-invalid": y || void 0,
|
|
129
|
-
"aria-describedby": D != null ? F : void 0,
|
|
130
|
-
className: T(m.row, m[V], m[K], y && m.invalid),
|
|
131
|
-
onBlur: Y,
|
|
132
|
-
children: i.map((t, e) => /* @__PURE__ */ _(
|
|
133
|
-
"input",
|
|
134
|
-
{
|
|
135
|
-
ref: (r) => {
|
|
136
|
-
k.current[e] = r;
|
|
137
|
-
},
|
|
138
|
-
name: e === 0 ? n : void 0,
|
|
139
|
-
type: "text",
|
|
140
|
-
inputMode: c === "numeric" ? "numeric" : "text",
|
|
141
|
-
autoComplete: e === 0 ? "one-time-code" : "off",
|
|
142
|
-
"aria-label": H("otpField.digit", { index: e + 1, total: a }),
|
|
143
|
-
className: T(m.box, t !== "" && m.filled),
|
|
144
|
-
value: t,
|
|
145
|
-
placeholder: P,
|
|
146
|
-
disabled: N,
|
|
147
|
-
onChange: (r) => U(e, r.target.value),
|
|
148
|
-
onKeyDown: (r) => W(e, r),
|
|
149
|
-
onPaste: (r) => X(e, r),
|
|
150
|
-
onFocus: (r) => r.target.select()
|
|
151
|
-
},
|
|
152
|
-
e
|
|
153
|
-
))
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
D != null && /* @__PURE__ */ _(
|
|
157
|
-
z,
|
|
158
|
-
{
|
|
159
|
-
as: "span",
|
|
160
|
-
id: F,
|
|
161
|
-
variant: "bodySmall",
|
|
162
|
-
color: y ? "error" : "muted",
|
|
163
|
-
className: d.helper,
|
|
164
|
-
children: D
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
);
|
|
170
|
-
});
|
|
171
|
-
export {
|
|
172
|
-
Be as O
|
|
173
|
-
};
|
|
174
|
-
//# sourceMappingURL=OtpField-Dy-LKTi9.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OtpField-Dy-LKTi9.js","sources":["../src/components/OtpField/OtpField.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './OtpField.module.css'\n\nexport type OtpFieldSize = 'sm' | 'md' | 'lg'\n/** Which characters the code accepts. */\nexport type OtpFieldType = 'numeric' | 'alphabetic' | 'alphanumeric'\n\nexport type OtpFieldAlign = 'start' | 'center' | 'end'\n\n/** Allowed-character matcher per `type`. */\nconst PATTERN: Record<OtpFieldType, RegExp> = {\n numeric: /[0-9]/,\n alphabetic: /[A-Za-z]/,\n alphanumeric: /[A-Za-z0-9]/,\n}\n\n/** Split a code string into exactly `length` single-char slots, padded with empties. */\nfunction toChars(value: string, length: number): string[] {\n const out = [...value].slice(0, length)\n while (out.length < length) out.push('')\n return out\n}\n\nexport interface OtpFieldProps {\n /** Number of input boxes (the code length). Defaults to `4`. */\n length?: number\n /** Which characters are accepted (also drives the mobile keyboard). Defaults to `'numeric'`. */\n type?: OtpFieldType\n /** Controlled value — the concatenated code string. */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the full code string on every change. */\n onChange?: (value: string) => void\n /** Fires with the code once every box is filled. */\n onComplete?: (value: string) => void\n /** Field name — the `<Form>` binding key (form value is the code `string`). */\n name?: string\n /** Label rendered above the boxes. */\n label?: ReactNode\n /** Helper / error text under the boxes (shown in the error color while `error`). */\n helperText?: ReactNode\n /** Marks the field invalid — reddens the boxes + helper. */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every box. */\n disabled?: boolean\n /** Focus the first box on mount. */\n autoFocus?: boolean\n /** Placeholder character shown in empty boxes (e.g. `'•'`). */\n placeholder?: string\n /** Preset size. Defaults to `'md'`. */\n size?: OtpFieldSize\n /** Horizontal alignment of the boxes within the field. Defaults to `'start'` (left). */\n align?: OtpFieldAlign\n /** Theme palette token for the focus ring / active box. Defaults to `'primary'`. */\n color?: ThemeColor\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A one-time-passcode input — a row of single-character boxes for verification codes. **`length`**\n * (default `4`) sets the box count; **`type`** (`'numeric'` default · `'alphabetic'` · `'alphanumeric'`)\n * restricts the accepted characters and the mobile keyboard. Typing advances to the next box, Backspace\n * clears + steps back, Arrows navigate, and **paste / SMS autofill** (`autocomplete=\"one-time-code\"`)\n * distributes the whole code across the boxes. The value is the concatenated string — controlled\n * (`value` + `onChange`) or uncontrolled (`defaultValue`); **`onComplete`** fires when all boxes are\n * filled. Shares the field-family chrome (`label` · `error` + `helperText` · `required` · `disabled` ·\n * `size`) and binds to a surrounding `<Form>` by **`name`** (form value = the code string; validate with\n * e.g. `z.string().length(4)` or a `type`-matching regex). Tinted by `color` via the shared\n * `--tz-btn-rgb` pattern; `role=\"group\"` with per-box `aria-label`s. Own CSS module (+ TextField's for\n * the label/helper chrome).\n */\nexport const OtpField = forwardRef<HTMLDivElement, OtpFieldProps>(function OtpField(\n {\n length = 4,\n type = 'numeric',\n value,\n defaultValue,\n onChange,\n onComplete,\n name,\n label,\n helperText,\n error,\n required = false,\n disabled = false,\n autoFocus = false,\n placeholder,\n size = 'md',\n align = 'start',\n color = 'primary',\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const helperId = `${reactId}-helper`\n const allowed = PATTERN[type]\n\n // bind to a surrounding <Form> by `name` — form value is the code string; error/touched via field()\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue =\n value !== undefined ? value : isFormBound ? (form!.values[name!] as string) : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? (externalValue ?? '') : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n // the code split into exactly `length` single-char slots (padded with empties)\n const chars = toChars(currentValue, length)\n\n const inputsRef = useRef<(HTMLInputElement | null)[]>([])\n\n useEffect(() => {\n if (autoFocus) inputsRef.current[0]?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const focusBox = (i: number) => {\n const el = inputsRef.current[Math.max(0, Math.min(i, length - 1))]\n el?.focus()\n el?.select()\n }\n\n const commit = (nextChars: string[]) => {\n const next = nextChars.join('')\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n if (nextChars.every((c) => c !== '')) onComplete?.(next)\n }\n\n const handleChange = (index: number, raw: string) => {\n const filtered = [...raw].filter((c) => allowed.test(c))\n // a disallowed keystroke (raw non-empty but nothing survives the filter) is ignored\n if (raw !== '' && filtered.length === 0) return\n const nextChars = [...chars]\n if (filtered.length <= 1) {\n // a single typed char (boxes select-on-focus, so this replaces) — or a clear ('')\n nextChars[index] = filtered[0] ?? ''\n commit(nextChars)\n if (filtered[0]) focusBox(index + 1)\n } else {\n // multiple chars (SMS autofill dumps the whole code into one box) → distribute from here\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n }\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Backspace') {\n if (chars[index] === '' && index > 0) {\n // empty box → step back and clear the previous one\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index - 1] = ''\n commit(nextChars)\n focusBox(index - 1)\n }\n // a non-empty box lets the native delete run → onChange fires with '' (stays put)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusBox(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusBox(index + 1)\n } else if (event.key === 'Delete') {\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index] = ''\n commit(nextChars)\n }\n }\n\n const handlePaste = (index: number, event: ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n const filtered = [...event.clipboardData.getData('text')].filter((c) => allowed.test(c))\n if (filtered.length === 0) return\n const nextChars = [...chars]\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n\n // mark the field touched when focus leaves the whole widget (not when it hops between boxes)\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n ...style,\n } as CSSProperties\n }\n >\n {label != null && (\n <span 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 </span>\n )}\n\n <div\n role=\"group\"\n aria-label={typeof label === 'string' ? label : 'One-time code'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.row, styles[size], styles[align], resolvedError && styles.invalid)}\n onBlur={handleBlur}\n >\n {chars.map((char, i) => (\n <input\n key={i}\n ref={(el) => {\n inputsRef.current[i] = el\n }}\n // the name goes on the first box only, so the form's scroll-to-error can target it\n name={i === 0 ? name : undefined}\n type=\"text\"\n inputMode={type === 'numeric' ? 'numeric' : 'text'}\n autoComplete={i === 0 ? 'one-time-code' : 'off'}\n aria-label={t('otpField.digit', { index: i + 1, total: length })}\n className={clsx(styles.box, char !== '' && styles.filled)}\n value={char}\n placeholder={placeholder}\n disabled={disabled}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={(e) => handlePaste(i, e)}\n onFocus={(e) => e.target.select()}\n />\n ))}\n </div>\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"],"names":["PATTERN","toChars","value","length","out","OtpField","forwardRef","type","defaultValue","onChange","onComplete","name","label","helperText","error","required","disabled","autoFocus","placeholder","size","align","color","className","style","ref","t","useT","helperId","useId","allowed","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","chars","inputsRef","useRef","useEffect","_a","focusBox","i","el","commit","nextChars","next","c","handleChange","index","raw","filtered","k","ch","handleKeyDown","event","handlePaste","handleBlur","jsxs","clsx","fieldStyles","jsx","Typography","styles","char","e"],"mappings":";;;;;;;;;;;;;;;;;GA0BMA,KAAwC;AAAA,EAC5C,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,cAAc;AAChB;AAGA,SAASC,GAAQC,GAAeC,GAA0B;AACxD,QAAMC,IAAM,CAAC,GAAGF,CAAK,EAAE,MAAM,GAAGC,CAAM;AACtC,SAAOC,EAAI,SAASD,IAAQ,CAAAC,EAAI,KAAK,EAAE;AACvC,SAAOA;AACT;AAsDO,MAAMC,KAAWC,GAA0C,SAChE;AAAA,EACE,QAAAH,IAAS;AAAA,EACT,MAAAI,IAAO;AAAA,EACP,OAAAL;AAAA,EACA,cAAAM;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,OAAAC,IAAQ;AAAA,EACR,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;AACA,QAAMC,IAAIC,GAAA,GAEJC,IAAW,GADDC,GAAA,CACW,WACrBC,IAAU7B,GAAQO,CAAI,GAGtBuB,IAAOC,GAAA,GACPC,IAAc,GAAQF,KAAQnB,IAC9BsB,IAAQH,KAAQnB,IAAOmB,EAAK,MAAMnB,CAAI,IAAI,QAE1CuB,IACJhC,M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AMD,MAAM,IAAIrC,IAAO;AAAA,gBACvB,MAAK;AAAA,gBACL,WAAWJ,MAAS,YAAY,YAAY;AAAA,gBAC5C,cAAcyC,MAAM,IAAI,kBAAkB;AAAA,gBAC1C,cAAYvB,EAAE,kBAAkB,EAAE,OAAOuB,IAAI,GAAG,OAAO7C,GAAQ;AAAA,gBAC/D,WAAW8D,EAAKI,EAAO,KAAKC,MAAS,MAAMD,EAAO,MAAM;AAAA,gBACxD,OAAOC;AAAA,gBACP,aAAApD;AAAA,gBACA,UAAAF;AAAA,gBACA,UAAU,CAACuD,MAAMjB,EAAaN,GAAGuB,EAAE,OAAO,KAAK;AAAA,gBAC/C,WAAW,CAACA,MAAMX,EAAcZ,GAAGuB,CAAC;AAAA,gBACpC,SAAS,CAACA,MAAMT,EAAYd,GAAGuB,CAAC;AAAA,gBAChC,SAAS,CAACA,MAAMA,EAAE,OAAO,OAAA;AAAA,cAAO;AAAA,cAjB3BvB;AAAA,YAAA,CAmBR;AAAA,UAAA;AAAA,QAAA;AAAA,QAGFP,KAAsB,QACrB,gBAAA0B;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAIzC;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOa,IAAgB,UAAU;AAAA,YACjC,WAAW0B,EAAY;AAAA,YAEtB,UAAAzB;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),_=require("react"),k=require("clsx"),ee=require("./formContext-bTWrqdEV.cjs"),R=require("./Typography-d97DdbNd.cjs"),u=require("./TextField.module-DsNCo8vN.cjs"),te=require("./ConfigProvider-DELhJlqo.cjs"),se="_row_1bbms_2",re="_center_1bbms_14",oe="_end_1bbms_15",le="_sm_1bbms_27",ce="_md_1bbms_31",ne="_lg_1bbms_35",ae="_box_1bbms_41",ie="_filled_1bbms_65",de="_invalid_1bbms_82",m={row:se,center:re,end:oe,sm:le,md:ce,lg:ne,box:ae,filled:ie,invalid:de},fe={numeric:/[0-9]/,alphabetic:/[A-Za-z]/,alphanumeric:/[A-Za-z0-9]/};function ue(S,l){const a=[...S].slice(0,l);for(;a.length<l;)a.push("");return a}const me=_.forwardRef(function({length:l=4,type:a="numeric",value:v,defaultValue:A,onChange:g,onComplete:T,name:i,label:y,helperText:I,error:z,required:O=!1,disabled:q=!1,autoFocus:P=!1,placeholder:C,size:E="md",align:M="start",color:V="primary",className:K,style:Z},$){const H=te.useT(),F=`${_.useId()}-helper`,B=fe[a],p=ee.useFormContext(),w=!!(p&&i),o=p&&i?p.field(i):void 0,L=v!==void 0?v:w?p.values[i]:void 0,N=v!==void 0||w,[G,J]=_.useState(A??""),Q=N?L??"":G,x=z??(o==null?void 0:o.error)??!1,D=I??(o==null?void 0:o.helperText),d=ue(Q,l),j=_.useRef([]);_.useEffect(()=>{var t;P&&((t=j.current[0])==null||t.focus())},[]);const f=t=>{const e=j.current[Math.max(0,Math.min(t,l-1))];e==null||e.focus(),e==null||e.select()},b=t=>{const e=t.join("");N||J(e),w&&p.setValue(i,e),g==null||g(e),t.every(s=>s!=="")&&(T==null||T(e))},U=(t,e)=>{const s=[...e].filter(r=>B.test(r));if(e!==""&&s.length===0)return;const c=[...d];if(s.length<=1)c[t]=s[0]??"",b(c),s[0]&&f(t+1);else{let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)}},W=(t,e)=>{if(e.key==="Backspace"){if(d[t]===""&&t>0){e.preventDefault();const s=[...d];s[t-1]="",b(s),f(t-1)}}else if(e.key==="ArrowLeft")e.preventDefault(),f(t-1);else if(e.key==="ArrowRight")e.preventDefault(),f(t+1);else if(e.key==="Delete"){e.preventDefault();const s=[...d];s[t]="",b(s)}},X=(t,e)=>{e.preventDefault();const s=[...e.clipboardData.getData("text")].filter(h=>B.test(h));if(s.length===0)return;const c=[...d];let r=t;for(const h of s){if(r>=l)break;c[r]=h,r++}b(c),f(r)},Y=t=>{t.currentTarget.contains(t.relatedTarget)||o==null||o.onBlur(t)};return n.jsxs("div",{ref:$,className:k.clsx(u.fieldStyles.field,x&&u.fieldStyles.error,q&&u.fieldStyles.disabled,K),style:{"--tz-btn-rgb":`var(--tz-color-${V}-rgb)`,...Z},children:[y!=null&&n.jsxs("span",{className:u.fieldStyles.label,children:[n.jsx(R.Typography,{as:"span",variant:"bodySmall",color:"muted",children:y}),O&&n.jsx("span",{className:u.fieldStyles.required,"aria-hidden":"true",children:"*"})]}),n.jsx("div",{role:"group","aria-label":typeof y=="string"?y:"One-time code","aria-invalid":x||void 0,"aria-describedby":D!=null?F:void 0,className:k.clsx(m.row,m[E],m[M],x&&m.invalid),onBlur:Y,children:d.map((t,e)=>n.jsx("input",{ref:s=>{j.current[e]=s},name:e===0?i:void 0,type:"text",inputMode:a==="numeric"?"numeric":"text",autoComplete:e===0?"one-time-code":"off","aria-label":H("otpField.digit",{index:e+1,total:l}),className:k.clsx(m.box,t!==""&&m.filled),value:t,placeholder:C,disabled:q,onChange:s=>U(e,s.target.value),onKeyDown:s=>W(e,s),onPaste:s=>X(e,s),onFocus:s=>s.target.select()},e))}),D!=null&&n.jsx(R.Typography,{as:"span",id:F,variant:"bodySmall",color:x?"error":"muted",className:u.fieldStyles.helper,children:D})]})});exports.OtpField=me;
|
|
2
|
-
//# sourceMappingURL=OtpField-KHwdaajC.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OtpField-KHwdaajC.cjs","sources":["../src/components/OtpField/OtpField.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type ClipboardEvent,\n type CSSProperties,\n type FocusEvent,\n type KeyboardEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useFormContext } from '../../form/formContext'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Typography } from '../Typography'\nimport fieldStyles from '../TextField/TextField.module.css'\nimport styles from './OtpField.module.css'\n\nexport type OtpFieldSize = 'sm' | 'md' | 'lg'\n/** Which characters the code accepts. */\nexport type OtpFieldType = 'numeric' | 'alphabetic' | 'alphanumeric'\n\nexport type OtpFieldAlign = 'start' | 'center' | 'end'\n\n/** Allowed-character matcher per `type`. */\nconst PATTERN: Record<OtpFieldType, RegExp> = {\n numeric: /[0-9]/,\n alphabetic: /[A-Za-z]/,\n alphanumeric: /[A-Za-z0-9]/,\n}\n\n/** Split a code string into exactly `length` single-char slots, padded with empties. */\nfunction toChars(value: string, length: number): string[] {\n const out = [...value].slice(0, length)\n while (out.length < length) out.push('')\n return out\n}\n\nexport interface OtpFieldProps {\n /** Number of input boxes (the code length). Defaults to `4`. */\n length?: number\n /** Which characters are accepted (also drives the mobile keyboard). Defaults to `'numeric'`. */\n type?: OtpFieldType\n /** Controlled value — the concatenated code string. */\n value?: string\n /** Initial value for uncontrolled use. */\n defaultValue?: string\n /** Fires with the full code string on every change. */\n onChange?: (value: string) => void\n /** Fires with the code once every box is filled. */\n onComplete?: (value: string) => void\n /** Field name — the `<Form>` binding key (form value is the code `string`). */\n name?: string\n /** Label rendered above the boxes. */\n label?: ReactNode\n /** Helper / error text under the boxes (shown in the error color while `error`). */\n helperText?: ReactNode\n /** Marks the field invalid — reddens the boxes + helper. */\n error?: boolean\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Disables every box. */\n disabled?: boolean\n /** Focus the first box on mount. */\n autoFocus?: boolean\n /** Placeholder character shown in empty boxes (e.g. `'•'`). */\n placeholder?: string\n /** Preset size. Defaults to `'md'`. */\n size?: OtpFieldSize\n /** Horizontal alignment of the boxes within the field. Defaults to `'start'` (left). */\n align?: OtpFieldAlign\n /** Theme palette token for the focus ring / active box. Defaults to `'primary'`. */\n color?: ThemeColor\n className?: string\n style?: CSSProperties\n}\n\n/**\n * A one-time-passcode input — a row of single-character boxes for verification codes. **`length`**\n * (default `4`) sets the box count; **`type`** (`'numeric'` default · `'alphabetic'` · `'alphanumeric'`)\n * restricts the accepted characters and the mobile keyboard. Typing advances to the next box, Backspace\n * clears + steps back, Arrows navigate, and **paste / SMS autofill** (`autocomplete=\"one-time-code\"`)\n * distributes the whole code across the boxes. The value is the concatenated string — controlled\n * (`value` + `onChange`) or uncontrolled (`defaultValue`); **`onComplete`** fires when all boxes are\n * filled. Shares the field-family chrome (`label` · `error` + `helperText` · `required` · `disabled` ·\n * `size`) and binds to a surrounding `<Form>` by **`name`** (form value = the code string; validate with\n * e.g. `z.string().length(4)` or a `type`-matching regex). Tinted by `color` via the shared\n * `--tz-btn-rgb` pattern; `role=\"group\"` with per-box `aria-label`s. Own CSS module (+ TextField's for\n * the label/helper chrome).\n */\nexport const OtpField = forwardRef<HTMLDivElement, OtpFieldProps>(function OtpField(\n {\n length = 4,\n type = 'numeric',\n value,\n defaultValue,\n onChange,\n onComplete,\n name,\n label,\n helperText,\n error,\n required = false,\n disabled = false,\n autoFocus = false,\n placeholder,\n size = 'md',\n align = 'start',\n color = 'primary',\n className,\n style,\n },\n ref,\n) {\n const t = useT()\n const reactId = useId()\n const helperId = `${reactId}-helper`\n const allowed = PATTERN[type]\n\n // bind to a surrounding <Form> by `name` — form value is the code string; error/touched via field()\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = form && name ? form.field(name) : undefined\n\n const externalValue =\n value !== undefined ? value : isFormBound ? (form!.values[name!] as string) : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? (externalValue ?? '') : internal\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n // the code split into exactly `length` single-char slots (padded with empties)\n const chars = toChars(currentValue, length)\n\n const inputsRef = useRef<(HTMLInputElement | null)[]>([])\n\n useEffect(() => {\n if (autoFocus) inputsRef.current[0]?.focus()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n const focusBox = (i: number) => {\n const el = inputsRef.current[Math.max(0, Math.min(i, length - 1))]\n el?.focus()\n el?.select()\n }\n\n const commit = (nextChars: string[]) => {\n const next = nextChars.join('')\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n if (nextChars.every((c) => c !== '')) onComplete?.(next)\n }\n\n const handleChange = (index: number, raw: string) => {\n const filtered = [...raw].filter((c) => allowed.test(c))\n // a disallowed keystroke (raw non-empty but nothing survives the filter) is ignored\n if (raw !== '' && filtered.length === 0) return\n const nextChars = [...chars]\n if (filtered.length <= 1) {\n // a single typed char (boxes select-on-focus, so this replaces) — or a clear ('')\n nextChars[index] = filtered[0] ?? ''\n commit(nextChars)\n if (filtered[0]) focusBox(index + 1)\n } else {\n // multiple chars (SMS autofill dumps the whole code into one box) → distribute from here\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n }\n\n const handleKeyDown = (index: number, event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Backspace') {\n if (chars[index] === '' && index > 0) {\n // empty box → step back and clear the previous one\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index - 1] = ''\n commit(nextChars)\n focusBox(index - 1)\n }\n // a non-empty box lets the native delete run → onChange fires with '' (stays put)\n } else if (event.key === 'ArrowLeft') {\n event.preventDefault()\n focusBox(index - 1)\n } else if (event.key === 'ArrowRight') {\n event.preventDefault()\n focusBox(index + 1)\n } else if (event.key === 'Delete') {\n event.preventDefault()\n const nextChars = [...chars]\n nextChars[index] = ''\n commit(nextChars)\n }\n }\n\n const handlePaste = (index: number, event: ClipboardEvent<HTMLInputElement>) => {\n event.preventDefault()\n const filtered = [...event.clipboardData.getData('text')].filter((c) => allowed.test(c))\n if (filtered.length === 0) return\n const nextChars = [...chars]\n let k = index\n for (const ch of filtered) {\n if (k >= length) break\n nextChars[k] = ch\n k++\n }\n commit(nextChars)\n focusBox(k)\n }\n\n // mark the field touched when focus leaves the whole widget (not when it hops between boxes)\n const handleBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node | null)) {\n bound?.onBlur(event as unknown as FocusEvent<HTMLInputElement>)\n }\n }\n\n return (\n <div\n ref={ref}\n className={clsx(\n fieldStyles.field,\n resolvedError && fieldStyles.error,\n disabled && fieldStyles.disabled,\n className,\n )}\n style={\n {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n ...style,\n } as CSSProperties\n }\n >\n {label != null && (\n <span 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 </span>\n )}\n\n <div\n role=\"group\"\n aria-label={typeof label === 'string' ? label : 'One-time code'}\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n className={clsx(styles.row, styles[size], styles[align], resolvedError && styles.invalid)}\n onBlur={handleBlur}\n >\n {chars.map((char, i) => (\n <input\n key={i}\n ref={(el) => {\n inputsRef.current[i] = el\n }}\n // the name goes on the first box only, so the form's scroll-to-error can target it\n name={i === 0 ? name : undefined}\n type=\"text\"\n inputMode={type === 'numeric' ? 'numeric' : 'text'}\n autoComplete={i === 0 ? 'one-time-code' : 'off'}\n aria-label={t('otpField.digit', { index: i + 1, total: length })}\n className={clsx(styles.box, char !== '' && styles.filled)}\n value={char}\n placeholder={placeholder}\n disabled={disabled}\n onChange={(e) => handleChange(i, e.target.value)}\n onKeyDown={(e) => handleKeyDown(i, e)}\n onPaste={(e) => handlePaste(i, e)}\n onFocus={(e) => e.target.select()}\n />\n ))}\n </div>\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"],"names":["PATTERN","toChars","value","length","out","OtpField","forwardRef","type","defaultValue","onChange","onComplete","name","label","helperText","error","required","disabled","autoFocus","placeholder","size","align","color","className","style","ref","t","useT","helperId","useId","allowed","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","resolvedError","resolvedHelperText","chars","inputsRef","useRef","useEffect","_a","focusBox","i","el","commit","nextChars","next","c","handleChange","index","raw","filtered","k","ch","handleKeyDown","event","handlePaste","handleBlur","jsxs","clsx","fieldStyles","jsx","Typography","styles","char","e"],"mappings":"2fA0BMA,GAAwC,CAC5C,QAAS,QACT,WAAY,WACZ,aAAc,aAChB,EAGA,SAASC,GAAQC,EAAeC,EAA0B,CACxD,MAAMC,EAAM,CAAC,GAAGF,CAAK,EAAE,MAAM,EAAGC,CAAM,EACtC,KAAOC,EAAI,OAASD,GAAQC,EAAI,KAAK,EAAE,EACvC,OAAOA,CACT,CAsDO,MAAMC,GAAWC,EAAAA,WAA0C,SAChE,CACE,OAAAH,EAAS,EACT,KAAAI,EAAO,UACP,MAAAL,EACA,aAAAM,EACA,SAAAC,EACA,WAAAC,EACA,KAAAC,EACA,MAAAC,EACA,WAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,YAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EAAQ,QACR,MAAAC,EAAQ,UACR,UAAAC,EACA,MAAAC,CACF,EACAC,EACA,CACA,MAAMC,EAAIC,GAAAA,KAAA,EAEJC,EAAW,GADDC,EAAAA,MAAA,CACW,UACrBC,EAAU7B,GAAQO,CAAI,EAGtBuB,EAAOC,GAAAA,eAAA,EACPC,EAAc,GAAQF,GAAQnB,GAC9BsB,EAAQH,GAAQnB,EAAOmB,EAAK,MAAMnB,CAAI,EAAI,OAE1CuB,EACJhC,IAAU,OAAYA,EAAQ8B,EAAeF,EAAM,OAAOnB,CAAK,EAAe,OAC1EwB,EAAejC,IAAU,QAAa8B,EACtC,CAACI,EAAUC,CAAW,EAAIC,EAAAA,SAAi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A,EAGFP,GAAsB,MACrB0B,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAIzC,EACJ,QAAQ,YACR,MAAOa,EAAgB,QAAU,QACjC,UAAW0B,EAAAA,YAAY,OAEtB,SAAAzB,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout-Bt6U_80d.cjs","sources":["../src/components/PageLayout/PageLayout.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react'\nimport { useRouter, type LinkProps } from '@tanstack/react-router'\nimport { useT } from '../../theme'\nimport { Card, type CardProps } from '../Card'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\nimport styles from './PageLayout.module.css'\n\n/** Something React would actually render — `null` / `undefined` / booleans / `''` render nothing (e.g. the\n * `pageActions={isDirty && <Button…/>}` pattern), so they mustn't produce an empty heading row. */\nconst renders = (node: ReactNode): boolean =>\n node != null && typeof node !== 'boolean' && node !== ''\n\n/** PageLayout is a flat `Card`, so it gains all of Card's slots minus the `flat` toggle (always flat). */\nexport interface PageLayoutProps extends Omit<CardProps, 'flat'> {\n /**\n * The page heading — an `h2` in the row **above** the card (the card's own header — `icon` / `title` /\n * `subtitle` / `actions` — is separate and unchanged). Shown only when given.\n */\n pageTitle?: ReactNode\n /**\n * Anything for the right end of the heading row — usually a few `size=\"sm\"` `Button`s, built in the page with\n * its own state. Rendered as given (no automatic phone collapse); on a narrow screen the row wraps, so they\n * drop below the title.\n */\n pageActions?: ReactNode\n /**\n * A back button left of the heading. `true` → the browser history back; a **path** string → navigates there\n * (deterministic on a deep link / refresh, e.g. `back={`/users/${id}`}`). Omitted / `false` → none.\n */\n back?: boolean | string\n}\n\n/**\n * The container a page's body sits in — a **flat `Card`** (no shadow, the page `background` color), so it\n * blends with the shell while the Cards/inputs placed inside it read as elevated. Being a Card, it has the full\n * Card anatomy: an optional card header (`icon` + `title` + `subtitle` + `actions`), the body (`children`), a\n * `footer` / `footerStart` (`stickyFooter`), and `collapsible`. Above the card, an optional **page heading row**\n * — `back` (button) + `pageTitle` (`h2`) + `pageActions` (right) — shown only when one of them is given; the\n * shell itself renders no page title. Rendered by the consumer inside each route, below the shell's breadcrumbs:\n * `<PageLayout pageTitle=\"Users\" pageActions={<Button size=\"sm\">Add New</Button>}>…</PageLayout>`. The ref\n * points at the card. Styling uses `--tz-*` tokens only.\n */\nexport const PageLayout = forwardRef<HTMLDivElement, PageLayoutProps>(function PageLayout(\n { pageTitle, pageActions, back, ...props },\n ref,\n) {\n const t = useT()\n // lenient: outside a RouterProvider the back button falls back to the browser's own history / location\n const router = useRouter({ warn: false })\n const goBack =\n back === true\n ? () => (router ? router.history.back() : window.history.back())\n : typeof back === 'string' && back\n ? () =>\n router\n ? void router.navigate({ to: back as LinkProps['to'] })\n : window.location.assign(back)\n : undefined\n const showTitle = renders(pageTitle)\n const showActions = renders(pageActions)\n const hasHeading = showTitle || showActions || goBack != null\n\n return (\n <>\n {hasHeading ? (\n <div className={styles.heading}>\n {goBack ? (\n <IconButton\n aria-label={t('pageTitle.back')}\n variant=\"filled\"\n color=\"accent\"\n size=\"sm\"\n onClick={goBack}\n >\n <Icon name=\"ArrowLeft\" />\n </IconButton>\n ) : null}\n {showTitle ? (\n <Typography variant=\"h2\" className={styles.title}>\n {pageTitle}\n </Typography>\n ) : null}\n {showActions ? <div className={styles.actions}>{pageActions}</div> : null}\n </div>\n ) : null}\n <Card ref={ref} flat {...props} />\n </>\n )\n})\n"],"names":["renders","node","PageLayout","forwardRef","pageTitle","pageActions","back","props","ref","t","useT","router","useRouter","goBack","showTitle","showActions","hasHeading","jsxs","Fragment","styles","jsx","IconButton","Icon","Typography","Card"],"mappings":"mYAWMA,EAAWC,GACfA,GAAQ,MAAQ,OAAOA,GAAS,WAAaA,IAAS,GAgC3CC,EAAaC,EAAAA,WAA4C,SACpE,CAAE,UAAAC,EAAW,YAAAC,EAAa,KAAAC,EAAM,GAAGC,CAAA,EACnCC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EAEJC,EAASC,EAAAA,UAAU,CAAE,KAAM,GAAO,EAClCC,EACJP,IAAS,GACL,IAAOK,EAASA,EAAO,QAAQ,KAAA,EAAS,OAAO,QAAQ,KAAA,EACvD,OAAOL,GAAS,UAAYA,EAC1B,IACEK,EACI,KAAKA,EAAO,SAAS,CAAE,GAAIL,CAAA,CAAyB,EACpD,OAAO,SAAS,OAAOA,CAAI,EACjC,OACFQ,EAAYd,EAAQI,CAAS,EAC7BW,EAAcf,EAAQK,CAAW,EACjCW,EAAaF,GAAaC,GAAeF,GAAU,KAEzD,OACEI,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAF,EACCC,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAO,QACpB,SAAA,CAAAN,EACCO,EAAAA,IAACC,EAAAA,WAAA,CACC,aAAYZ,EAAE,gBAAgB,EAC9B,QAAQ,SACR,MAAM,SACN,KAAK,KACL,QAASI,EAET,SAAAO,EAAAA,IAACE,EAAAA,KAAA,CAAK,KAAK,WAAA,CAAY,CAAA,CAAA,EAEvB,KACHR,QACES,aAAA,CAAW,QAAQ,KAAK,UAAWJ,EAAO,MACxC,SAAAf,CAAA,CACH,EACE,KACHW,EAAcK,EAAAA,IAAC,MAAA,CAAI,UAAWD,EAAO,QAAU,WAAY,EAAS,IAAA,CAAA,CACvE,EACE,WACHK,EAAAA,KAAA,CAAK,IAAAhB,EAAU,KAAI,GAAE,GAAGD,CAAA,CAAO,CAAA,EAClC,CAEJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageLayout-Df1SOlr7.js","sources":["../src/components/PageLayout/PageLayout.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react'\nimport { useRouter, type LinkProps } from '@tanstack/react-router'\nimport { useT } from '../../theme'\nimport { Card, type CardProps } from '../Card'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Typography } from '../Typography'\nimport styles from './PageLayout.module.css'\n\n/** Something React would actually render — `null` / `undefined` / booleans / `''` render nothing (e.g. the\n * `pageActions={isDirty && <Button…/>}` pattern), so they mustn't produce an empty heading row. */\nconst renders = (node: ReactNode): boolean =>\n node != null && typeof node !== 'boolean' && node !== ''\n\n/** PageLayout is a flat `Card`, so it gains all of Card's slots minus the `flat` toggle (always flat). */\nexport interface PageLayoutProps extends Omit<CardProps, 'flat'> {\n /**\n * The page heading — an `h2` in the row **above** the card (the card's own header — `icon` / `title` /\n * `subtitle` / `actions` — is separate and unchanged). Shown only when given.\n */\n pageTitle?: ReactNode\n /**\n * Anything for the right end of the heading row — usually a few `size=\"sm\"` `Button`s, built in the page with\n * its own state. Rendered as given (no automatic phone collapse); on a narrow screen the row wraps, so they\n * drop below the title.\n */\n pageActions?: ReactNode\n /**\n * A back button left of the heading. `true` → the browser history back; a **path** string → navigates there\n * (deterministic on a deep link / refresh, e.g. `back={`/users/${id}`}`). Omitted / `false` → none.\n */\n back?: boolean | string\n}\n\n/**\n * The container a page's body sits in — a **flat `Card`** (no shadow, the page `background` color), so it\n * blends with the shell while the Cards/inputs placed inside it read as elevated. Being a Card, it has the full\n * Card anatomy: an optional card header (`icon` + `title` + `subtitle` + `actions`), the body (`children`), a\n * `footer` / `footerStart` (`stickyFooter`), and `collapsible`. Above the card, an optional **page heading row**\n * — `back` (button) + `pageTitle` (`h2`) + `pageActions` (right) — shown only when one of them is given; the\n * shell itself renders no page title. Rendered by the consumer inside each route, below the shell's breadcrumbs:\n * `<PageLayout pageTitle=\"Users\" pageActions={<Button size=\"sm\">Add New</Button>}>…</PageLayout>`. The ref\n * points at the card. Styling uses `--tz-*` tokens only.\n */\nexport const PageLayout = forwardRef<HTMLDivElement, PageLayoutProps>(function PageLayout(\n { pageTitle, pageActions, back, ...props },\n ref,\n) {\n const t = useT()\n // lenient: outside a RouterProvider the back button falls back to the browser's own history / location\n const router = useRouter({ warn: false })\n const goBack =\n back === true\n ? () => (router ? router.history.back() : window.history.back())\n : typeof back === 'string' && back\n ? () =>\n router\n ? void router.navigate({ to: back as LinkProps['to'] })\n : window.location.assign(back)\n : undefined\n const showTitle = renders(pageTitle)\n const showActions = renders(pageActions)\n const hasHeading = showTitle || showActions || goBack != null\n\n return (\n <>\n {hasHeading ? (\n <div className={styles.heading}>\n {goBack ? (\n <IconButton\n aria-label={t('pageTitle.back')}\n variant=\"filled\"\n color=\"accent\"\n size=\"sm\"\n onClick={goBack}\n >\n <Icon name=\"ArrowLeft\" />\n </IconButton>\n ) : null}\n {showTitle ? (\n <Typography variant=\"h2\" className={styles.title}>\n {pageTitle}\n </Typography>\n ) : null}\n {showActions ? <div className={styles.actions}>{pageActions}</div> : null}\n </div>\n ) : null}\n <Card ref={ref} flat {...props} />\n </>\n )\n})\n"],"names":["renders","node","PageLayout","forwardRef","pageTitle","pageActions","back","props","ref","t","useT","router","useRouter","goBack","showTitle","showActions","hasHeading","jsxs","Fragment","styles","jsx","IconButton","Icon","Typography","Card"],"mappings":";;;;;;;;;;;;GAWMA,IAAU,CAACC,MACfA,KAAQ,QAAQ,OAAOA,KAAS,aAAaA,MAAS,IAgC3CC,IAAaC,EAA4C,SACpE,EAAE,WAAAC,GAAW,aAAAC,GAAa,MAAAC,GAAM,GAAGC,EAAA,GACnCC,GACA;AACA,QAAMC,IAAIC,EAAA,GAEJC,IAASC,EAAU,EAAE,MAAM,IAAO,GAClCC,IACJP,MAAS,KACL,MAAOK,IAASA,EAAO,QAAQ,KAAA,IAAS,OAAO,QAAQ,KAAA,IACvD,OAAOL,KAAS,YAAYA,IAC1B,MACEK,IACI,KAAKA,EAAO,SAAS,EAAE,IAAIL,EAAA,CAAyB,IACpD,OAAO,SAAS,OAAOA,CAAI,IACjC,QACFQ,IAAYd,EAAQI,CAAS,GAC7BW,IAAcf,EAAQK,CAAW,GACjCW,IAAaF,KAAaC,KAAeF,KAAU;AAEzD,SACE,gBAAAI,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAF,IACC,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAO,SACpB,UAAA;AAAA,MAAAN,IACC,gBAAAO;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,cAAYZ,EAAE,gBAAgB;AAAA,UAC9B,SAAQ;AAAA,UACR,OAAM;AAAA,UACN,MAAK;AAAA,UACL,SAASI;AAAA,UAET,UAAA,gBAAAO,EAACE,GAAA,EAAK,MAAK,YAAA,CAAY;AAAA,QAAA;AAAA,MAAA,IAEvB;AAAA,MACHR,sBACES,GAAA,EAAW,SAAQ,MAAK,WAAWJ,EAAO,OACxC,UAAAf,EAAA,CACH,IACE;AAAA,MACHW,IAAc,gBAAAK,EAAC,OAAA,EAAI,WAAWD,EAAO,SAAU,aAAY,IAAS;AAAA,IAAA,EAAA,CACvE,IACE;AAAA,sBACHK,GAAA,EAAK,KAAAhB,GAAU,MAAI,IAAE,GAAGD,EAAA,CAAO;AAAA,EAAA,GAClC;AAEJ,CAAC;"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as O } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as Q, useState as U } from "react";
|
|
3
|
-
import { clsx as d } from "clsx";
|
|
4
|
-
import { b as V } from "./Icon-D5TxgfCc.js";
|
|
5
|
-
import { a as W } from "./ConfigProvider-Bgu85MsI.js";
|
|
6
|
-
const v = (s, i) => Array.from({ length: Math.max(i - s + 1, 0) }, (l, a) => s + a);
|
|
7
|
-
function X({
|
|
8
|
-
count: s,
|
|
9
|
-
page: i,
|
|
10
|
-
siblingCount: l = 1,
|
|
11
|
-
boundaryCount: a = 1
|
|
12
|
-
}) {
|
|
13
|
-
if (s <= 0) return [];
|
|
14
|
-
const o = v(1, Math.min(a, s)), g = v(Math.max(s - a + 1, a + 1), s), p = Math.max(
|
|
15
|
-
Math.min(i - l, s - a - l * 2 - 1),
|
|
16
|
-
a + 2
|
|
17
|
-
), _ = Math.min(
|
|
18
|
-
Math.max(i + l, a + l * 2 + 2),
|
|
19
|
-
g.length > 0 ? g[0] - 2 : s - 1
|
|
20
|
-
);
|
|
21
|
-
return [
|
|
22
|
-
...o,
|
|
23
|
-
// A start ellipsis, OR the single page that sits between the start boundary and the siblings.
|
|
24
|
-
...p > a + 2 ? ["start-ellipsis"] : a + 1 < s - a ? [a + 1] : [],
|
|
25
|
-
...v(p, _),
|
|
26
|
-
// An end ellipsis, OR the single page between the siblings and the end boundary.
|
|
27
|
-
..._ < s - a - 1 ? ["end-ellipsis"] : s - a > a ? [s - a] : [],
|
|
28
|
-
...g
|
|
29
|
-
];
|
|
30
|
-
}
|
|
31
|
-
const Y = "_pagination_5gbvi_3", Z = "_list_5gbvi_8", y = "_item_5gbvi_18", u = "_sm_5gbvi_28", C = "_md_5gbvi_33", aa = "_lg_5gbvi_38", sa = "_page_5gbvi_45", ea = "_selected_5gbvi_64", ia = "_outlined_5gbvi_80", ta = "_rounded_5gbvi_96", la = "_arrow_5gbvi_26", na = "_flip_5gbvi_107", ra = "_ellipsis_5gbvi_112", e = {
|
|
32
|
-
pagination: Y,
|
|
33
|
-
list: Z,
|
|
34
|
-
item: y,
|
|
35
|
-
sm: u,
|
|
36
|
-
md: C,
|
|
37
|
-
lg: aa,
|
|
38
|
-
page: sa,
|
|
39
|
-
selected: ea,
|
|
40
|
-
outlined: ia,
|
|
41
|
-
rounded: ta,
|
|
42
|
-
arrow: la,
|
|
43
|
-
flip: na,
|
|
44
|
-
ellipsis: ra
|
|
45
|
-
}, w = (s, i, l) => Math.min(Math.max(s, i), l), _a = Q(function({
|
|
46
|
-
count: i,
|
|
47
|
-
page: l,
|
|
48
|
-
defaultPage: a = 1,
|
|
49
|
-
onChange: o,
|
|
50
|
-
siblingCount: g = 1,
|
|
51
|
-
boundaryCount: p = 1,
|
|
52
|
-
showFirstButton: _ = !1,
|
|
53
|
-
showLastButton: $ = !1,
|
|
54
|
-
hidePrevButton: z = !1,
|
|
55
|
-
hideNextButton: A = !1,
|
|
56
|
-
variant: S = "outlined",
|
|
57
|
-
size: h = "md",
|
|
58
|
-
color: b = "accent",
|
|
59
|
-
rounded: j = !1,
|
|
60
|
-
disabled: x = !1,
|
|
61
|
-
className: k,
|
|
62
|
-
style: I,
|
|
63
|
-
"aria-label": L = "Pagination",
|
|
64
|
-
...R
|
|
65
|
-
}, E) {
|
|
66
|
-
const M = l !== void 0, [T, q] = U(a), N = Math.max(i, 1), n = w(M ? l : T, 1, N), P = (t) => {
|
|
67
|
-
const c = w(t, 1, N);
|
|
68
|
-
c !== n && (M || q(c), o == null || o(c));
|
|
69
|
-
}, m = W(), B = X({ count: i, page: n, siblingCount: g, boundaryCount: p }), D = {
|
|
70
|
-
"--tz-btn-rgb": `var(--tz-color-${b}-rgb)`,
|
|
71
|
-
"--tz-btn-on": `var(--tz-color-${b}-contrast, #fff)`,
|
|
72
|
-
...I
|
|
73
|
-
}, f = (t, c, F, G, H, J, K = !1) => H ? null : /* @__PURE__ */ r("li", { className: e.item, children: /* @__PURE__ */ r(
|
|
74
|
-
"button",
|
|
75
|
-
{
|
|
76
|
-
type: "button",
|
|
77
|
-
className: d(e.page, e.arrow),
|
|
78
|
-
"aria-label": F,
|
|
79
|
-
disabled: x || J,
|
|
80
|
-
onClick: () => P(G),
|
|
81
|
-
children: /* @__PURE__ */ r(V, { name: c, size: h, className: K ? e.flip : void 0 })
|
|
82
|
-
}
|
|
83
|
-
) }, t);
|
|
84
|
-
return /* @__PURE__ */ r(
|
|
85
|
-
"nav",
|
|
86
|
-
{
|
|
87
|
-
ref: E,
|
|
88
|
-
"aria-label": L,
|
|
89
|
-
className: d(
|
|
90
|
-
e.pagination,
|
|
91
|
-
e[S],
|
|
92
|
-
e[h],
|
|
93
|
-
j && e.rounded,
|
|
94
|
-
k
|
|
95
|
-
),
|
|
96
|
-
style: D,
|
|
97
|
-
...R,
|
|
98
|
-
children: /* @__PURE__ */ O("ul", { className: e.list, children: [
|
|
99
|
-
_ && f("first", "Previous", m("pagination.first"), 1, !1, n <= 1),
|
|
100
|
-
f(
|
|
101
|
-
"prev",
|
|
102
|
-
"ArrowLeft",
|
|
103
|
-
m("pagination.previous"),
|
|
104
|
-
n - 1,
|
|
105
|
-
z,
|
|
106
|
-
n <= 1
|
|
107
|
-
),
|
|
108
|
-
B.map(
|
|
109
|
-
(t, c) => typeof t == "number" ? /* @__PURE__ */ r("li", { className: e.item, children: /* @__PURE__ */ r(
|
|
110
|
-
"button",
|
|
111
|
-
{
|
|
112
|
-
type: "button",
|
|
113
|
-
className: d(e.page, t === n && e.selected),
|
|
114
|
-
"aria-label": m("pagination.page", { page: t }),
|
|
115
|
-
"aria-current": t === n ? "page" : void 0,
|
|
116
|
-
disabled: x,
|
|
117
|
-
onClick: () => P(t),
|
|
118
|
-
children: t
|
|
119
|
-
}
|
|
120
|
-
) }, t) : /* @__PURE__ */ r("li", { className: e.item, "aria-hidden": !0, children: /* @__PURE__ */ r("span", { className: e.ellipsis, children: "…" }) }, `${t}-${c}`)
|
|
121
|
-
),
|
|
122
|
-
f(
|
|
123
|
-
"next",
|
|
124
|
-
"ArrowLeft",
|
|
125
|
-
m("pagination.next"),
|
|
126
|
-
n + 1,
|
|
127
|
-
A,
|
|
128
|
-
n >= i,
|
|
129
|
-
!0
|
|
130
|
-
),
|
|
131
|
-
$ && f("last", "Next", m("pagination.last"), i, !1, n >= i)
|
|
132
|
-
] })
|
|
133
|
-
}
|
|
134
|
-
);
|
|
135
|
-
});
|
|
136
|
-
export {
|
|
137
|
-
_a as P
|
|
138
|
-
};
|
|
139
|
-
//# sourceMappingURL=Pagination-DDMq_7OZ.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pagination-DDMq_7OZ.js","sources":["../src/components/Pagination/paginationRange.ts","../src/components/Pagination/Pagination.tsx"],"sourcesContent":["/** A gap placeholder rendered as `…` — at the start (`1 … 4`) or end (`6 … 10`) of the range. */\nexport type PaginationEllipsis = 'start-ellipsis' | 'end-ellipsis'\n\n/** One item in a pagination range: a 1-based page number, or an ellipsis placeholder. */\nexport type PaginationItem = number | PaginationEllipsis\n\n/** Inputs for {@link paginationRange}. */\nexport interface PaginationRangeOptions {\n /** Total number of pages. */\n count: number\n /** Current page (1-based). */\n page: number\n /** Pages shown on each side of the current page. Defaults to `1`. */\n siblingCount?: number\n /** Pages always shown at the start and end. Defaults to `1`. */\n boundaryCount?: number\n}\n\n/** Inclusive integer range `[start, end]` (empty when `end < start`). */\nconst range = (start: number, end: number): number[] =>\n Array.from({ length: Math.max(end - start + 1, 0) }, (_, i) => start + i)\n\n/**\n * Build the page-item sequence for a pager — the boundary pages, the current page with its siblings,\n * and `start`/`end` ellipses where pages are skipped (the classic `1 … 4 5 6 … 10`). Pure and\n * framework-free so it can be unit-tested in isolation and reused. Assumes `1 <= page <= count`.\n */\nexport function paginationRange({\n count,\n page,\n siblingCount = 1,\n boundaryCount = 1,\n}: PaginationRangeOptions): PaginationItem[] {\n if (count <= 0) return []\n\n // Pages pinned at each edge.\n const startPages = range(1, Math.min(boundaryCount, count))\n const endPages = range(Math.max(count - boundaryCount + 1, boundaryCount + 1), count)\n\n // The window of pages around the current one, clamped so it never overlaps the boundaries.\n const siblingsStart = Math.max(\n Math.min(page - siblingCount, count - boundaryCount - siblingCount * 2 - 1),\n boundaryCount + 2,\n )\n const siblingsEnd = Math.min(\n Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2),\n endPages.length > 0 ? endPages[0] - 2 : count - 1,\n )\n\n return [\n ...startPages,\n // A start ellipsis, OR the single page that sits between the start boundary and the siblings.\n ...(siblingsStart > boundaryCount + 2\n ? (['start-ellipsis'] as PaginationItem[])\n : boundaryCount + 1 < count - boundaryCount\n ? [boundaryCount + 1]\n : []),\n ...range(siblingsStart, siblingsEnd),\n // An end ellipsis, OR the single page between the siblings and the end boundary.\n ...(siblingsEnd < count - boundaryCount - 1\n ? (['end-ellipsis'] as PaginationItem[])\n : count - boundaryCount > boundaryCount\n ? [count - boundaryCount]\n : []),\n ...endPages,\n ]\n}\n","import {\n forwardRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { Icon, type IconName } from '../Icon'\nimport { useT, type ThemeColor } from '../../theme'\nimport { paginationRange } from './paginationRange'\nimport styles from './Pagination.module.css'\n\nexport type PaginationVariant = 'outlined' | 'text'\nexport type PaginationSize = 'sm' | 'md' | 'lg'\n\nexport interface PaginationProps extends Omit<HTMLAttributes<HTMLElement>, 'color' | 'onChange'> {\n /** Total number of pages (required). From a row count, pass `Math.ceil(total / pageSize)`. */\n count: number\n /** Controlled current page (1-based). */\n page?: number\n /** Initial page for uncontrolled use (1-based). Defaults to `1`. */\n defaultPage?: number\n /** Fires with the next page (1-based) when a page or arrow is activated. */\n onChange?: (page: number) => void\n /** Pages shown on each side of the current page. Defaults to `1`. */\n siblingCount?: number\n /** Pages always shown at the start and end. Defaults to `1`. */\n boundaryCount?: number\n /** Show a jump-to-first-page button before the previous arrow. Defaults to `false`. */\n showFirstButton?: boolean\n /** Show a jump-to-last-page button after the next arrow. Defaults to `false`. */\n showLastButton?: boolean\n /** Hide the previous-page arrow. Defaults to `false`. */\n hidePrevButton?: boolean\n /** Hide the next-page arrow. Defaults to `false`. */\n hideNextButton?: boolean\n /** Item style: `outlined` (bordered boxes, default) or `text` (borderless). */\n variant?: PaginationVariant\n /** Control size — sets the box, font, and icon sizes. Defaults to `md`. */\n size?: PaginationSize\n /** Theme palette token that tints the selected page. Defaults to `accent`. */\n color?: ThemeColor\n /** Render circular page buttons instead of rounded rectangles. Defaults to `false`. */\n rounded?: boolean\n /** Disable the whole control. Defaults to `false`. */\n disabled?: boolean\n}\n\nconst clamp = (n: number, lo: number, hi: number) => Math.min(Math.max(n, lo), hi)\n\n/**\n * A page navigator — previous/next arrows around a numbered range with `…` gaps (`1 … 4 5 6 … 10`),\n * the classic pager. Reusable across tables, lists, and galleries: drive it with `count` (total\n * pages) + `page`/`onChange`, computing `count` as `Math.ceil(total / pageSize)`. The selected page\n * is tinted via the shared `--tz-btn-rgb` pattern; unselected items are bordered (`outlined`) or\n * borderless (`text`). Controlled (`page` + `onChange`) or uncontrolled (`defaultPage`).\n */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(function Pagination(\n {\n count,\n page,\n defaultPage = 1,\n onChange,\n siblingCount = 1,\n boundaryCount = 1,\n showFirstButton = false,\n showLastButton = false,\n hidePrevButton = false,\n hideNextButton = false,\n variant = 'outlined',\n size = 'md',\n color = 'accent',\n rounded = false,\n disabled = false,\n className,\n style,\n 'aria-label': ariaLabel = 'Pagination',\n ...props\n },\n ref,\n) {\n const isControlled = page !== undefined\n const [internal, setInternal] = useState(defaultPage)\n const lastPage = Math.max(count, 1)\n const current = clamp(isControlled ? page! : internal, 1, lastPage)\n\n const go = (next: number) => {\n const target = clamp(next, 1, lastPage)\n if (target === current) return\n if (!isControlled) setInternal(target)\n onChange?.(target)\n }\n\n const t = useT()\n const items = paginationRange({ count, page: current, siblingCount, boundaryCount })\n\n // The selected fill + its readable text color, derived once via the shared button-tint vars.\n const rootStyle = {\n '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`,\n '--tz-btn-on': `var(--tz-color-${color}-contrast, #fff)`,\n ...style,\n } as CSSProperties\n\n // An arrow / jump control. `flip` mirrors the (left-pointing) icon to face right — the icon set has\n // no matching plain right arrow, so the next/last glyphs are the left ones flipped for symmetry.\n const control = (\n key: string,\n icon: IconName,\n label: string,\n target: number,\n hidden: boolean,\n atBound: boolean,\n flip = false,\n ): ReactNode =>\n hidden ? null : (\n <li key={key} className={styles.item}>\n <button\n type=\"button\"\n className={clsx(styles.page, styles.arrow)}\n aria-label={label}\n disabled={disabled || atBound}\n onClick={() => go(target)}\n >\n <Icon name={icon} size={size} className={flip ? styles.flip : undefined} />\n </button>\n </li>\n )\n\n return (\n <nav\n ref={ref}\n aria-label={ariaLabel}\n className={clsx(\n styles.pagination,\n styles[variant],\n styles[size],\n rounded && styles.rounded,\n className,\n )}\n style={rootStyle}\n {...props}\n >\n <ul className={styles.list}>\n {showFirstButton &&\n control('first', 'Previous', t('pagination.first'), 1, false, current <= 1)}\n {control(\n 'prev',\n 'ArrowLeft',\n t('pagination.previous'),\n current - 1,\n hidePrevButton,\n current <= 1,\n )}\n {items.map((item, i) =>\n typeof item === 'number' ? (\n <li key={item} className={styles.item}>\n <button\n type=\"button\"\n className={clsx(styles.page, item === current && styles.selected)}\n aria-label={t('pagination.page', { page: item })}\n aria-current={item === current ? 'page' : undefined}\n disabled={disabled}\n onClick={() => go(item)}\n >\n {item}\n </button>\n </li>\n ) : (\n <li key={`${item}-${i}`} className={styles.item} aria-hidden>\n <span className={styles.ellipsis}>…</span>\n </li>\n ),\n )}\n {control(\n 'next',\n 'ArrowLeft',\n t('pagination.next'),\n current + 1,\n hideNextButton,\n current >= count,\n true,\n )}\n {showLastButton &&\n control('last', 'Next', t('pagination.last'), count, false, current >= count)}\n </ul>\n </nav>\n )\n})\n"],"names":["range","start","end","_","i","paginationRange","count","page","siblingCount","boundaryCount","startPages","endPages","siblingsStart","siblingsEnd","clamp","n","lo","hi","Pagination","forwardRef","defaultPage","onChange","showFirstButton","showLastButton","hidePrevButton","hideNextButton","variant","size","color","rounded","disabled","className","style","ariaLabel","props","ref","isControlled","internal","setInternal","useState","lastPage","current","go","next","target","t","useT","items","rootStyle","control","key","icon","label","hidden","atBound","flip","jsx","styles","clsx","Icon","jsxs","item"],"mappings":";;;;;AAmBA,MAAMA,IAAQ,CAACC,GAAeC,MAC5B,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAIA,IAAMD,IAAQ,GAAG,CAAC,EAAA,GAAK,CAACE,GAAGC,MAAMH,IAAQG,CAAC;AAOnE,SAASC,EAAgB;AAAA,EAC9B,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,eAAAC,IAAgB;AAClB,GAA6C;AAC3C,MAAIH,KAAS,EAAG,QAAO,CAAA;AAGvB,Q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,UACVhB;AAAA,UACAgB,KAAWnC;AAAA,UACX;AAAA,QAAA;AAAA,QAEDiB,KACC0B,EAAQ,QAAQ,QAAQJ,EAAE,iBAAiB,GAAGvC,GAAO,IAAOmC,KAAWnC,CAAK;AAAA,MAAA,EAAA,CAChF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),P=require("react"),d=require("clsx"),Q=require("./Icon-B6lz-V0A.cjs"),U=require("./ConfigProvider-DELhJlqo.cjs"),v=(e,a)=>Array.from({length:Math.max(a-e+1,0)},(l,s)=>e+s);function V({count:e,page:a,siblingCount:l=1,boundaryCount:s=1}){if(e<=0)return[];const o=v(1,Math.min(s,e)),g=v(Math.max(e-s+1,s+1),e),p=Math.max(Math.min(a-l,e-s-l*2-1),s+2),m=Math.min(Math.max(a+l,s+l*2+2),g.length>0?g[0]-2:e-1);return[...o,...p>s+2?["start-ellipsis"]:s+1<e-s?[s+1]:[],...v(p,m),...m<e-s-1?["end-ellipsis"]:e-s>s?[e-s]:[],...g]}const W="_pagination_5gbvi_3",X="_list_5gbvi_8",Y="_item_5gbvi_18",Z="_sm_5gbvi_28",u="_md_5gbvi_33",y="_lg_5gbvi_38",C="_page_5gbvi_45",ss="_selected_5gbvi_64",es="_outlined_5gbvi_80",is="_rounded_5gbvi_96",as="_arrow_5gbvi_26",ts="_flip_5gbvi_107",ls="_ellipsis_5gbvi_112",i={pagination:W,list:X,item:Y,sm:Z,md:u,lg:y,page:C,selected:ss,outlined:es,rounded:is,arrow:as,flip:ts,ellipsis:ls},w=(e,a,l)=>Math.min(Math.max(e,a),l),ns=P.forwardRef(function({count:a,page:l,defaultPage:s=1,onChange:o,siblingCount:g=1,boundaryCount:p=1,showFirstButton:m=!1,showLastButton:q=!1,hidePrevButton:$=!1,hideNextButton:z=!1,variant:A="outlined",size:x="md",color:h="accent",rounded:I=!1,disabled:b=!1,className:R,style:S,"aria-label":k="Pagination",...L},E){const j=l!==void 0,[T,B]=P.useState(s),M=Math.max(a,1),n=w(j?l:T,1,M),N=t=>{const c=w(t,1,M);c!==n&&(j||B(c),o==null||o(c))},_=U.useT(),D=V({count:a,page:n,siblingCount:g,boundaryCount:p}),F={"--tz-btn-rgb":`var(--tz-color-${h}-rgb)`,"--tz-btn-on":`var(--tz-color-${h}-contrast, #fff)`,...S},f=(t,c,G,H,J,K,O=!1)=>J?null:r.jsx("li",{className:i.item,children:r.jsx("button",{type:"button",className:d.clsx(i.page,i.arrow),"aria-label":G,disabled:b||K,onClick:()=>N(H),children:r.jsx(Q.Icon,{name:c,size:x,className:O?i.flip:void 0})})},t);return r.jsx("nav",{ref:E,"aria-label":k,className:d.clsx(i.pagination,i[A],i[x],I&&i.rounded,R),style:F,...L,children:r.jsxs("ul",{className:i.list,children:[m&&f("first","Previous",_("pagination.first"),1,!1,n<=1),f("prev","ArrowLeft",_("pagination.previous"),n-1,$,n<=1),D.map((t,c)=>typeof t=="number"?r.jsx("li",{className:i.item,children:r.jsx("button",{type:"button",className:d.clsx(i.page,t===n&&i.selected),"aria-label":_("pagination.page",{page:t}),"aria-current":t===n?"page":void 0,disabled:b,onClick:()=>N(t),children:t})},t):r.jsx("li",{className:i.item,"aria-hidden":!0,children:r.jsx("span",{className:i.ellipsis,children:"…"})},`${t}-${c}`)),f("next","ArrowLeft",_("pagination.next"),n+1,z,n>=a,!0),q&&f("last","Next",_("pagination.last"),a,!1,n>=a)]})})});exports.Pagination=ns;
|
|
2
|
-
//# sourceMappingURL=Pagination-UMeckhmY.cjs.map
|