@techzyapp/ui-library 1.0.40 → 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-hi6dJhfN.cjs → Breadcrumbs-B-olYVdw.cjs} +2 -2
- package/dist/Breadcrumbs-B-olYVdw.cjs.map +1 -0
- package/dist/{Breadcrumbs-Dqhk-dY2.js → Breadcrumbs-cXET6OM5.js} +3 -3
- package/dist/Breadcrumbs-cXET6OM5.js.map +1 -0
- package/dist/{Button-Bst_NtPJ.js → Button-0ZgdNjX-.js} +2 -2
- package/dist/{Button-Bst_NtPJ.js.map → Button-0ZgdNjX-.js.map} +1 -1
- package/dist/{Button-CYZoF18-.cjs → Button-CwrDiZek.cjs} +2 -2
- package/dist/{Button-CYZoF18-.cjs.map → Button-CwrDiZek.cjs.map} +1 -1
- package/dist/{Calendar-OYXsfuWz.js → Calendar-CxzdnzdK.js} +3 -3
- package/dist/{Calendar-OYXsfuWz.js.map → Calendar-CxzdnzdK.js.map} +1 -1
- package/dist/{Calendar-CMNBHtvY.cjs → Calendar-d3CX5UJp.cjs} +2 -2
- package/dist/{Calendar-CMNBHtvY.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-B7cAHjlx.cjs → Chip-BkU3yx6G.cjs} +2 -2
- package/dist/Chip-BkU3yx6G.cjs.map +1 -0
- package/dist/{Chip-D5ZZs3QH.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-DrWRSRmO.js → CodeBlock-BHcvQrs9.js} +3 -3
- package/dist/CodeBlock-BHcvQrs9.js.map +1 -0
- package/dist/{CodeBlock-C3mG_seZ.cjs → CodeBlock-DRBQ_S5t.cjs} +2 -2
- package/dist/CodeBlock-DRBQ_S5t.cjs.map +1 -0
- package/dist/{ColorPicker-w7NdprlW.js → ColorPicker-BQKFdTNr.js} +51 -51
- package/dist/{ColorPicker-w7NdprlW.js.map → ColorPicker-BQKFdTNr.js.map} +1 -1
- package/dist/ColorPicker-BzCEMN7B.cjs +2 -0
- package/dist/{ColorPicker-C1pDI4su.cjs.map → ColorPicker-BzCEMN7B.cjs.map} +1 -1
- package/dist/{ColorPickerPanel-CKMd-dqd.js → ColorPickerPanel-DKTKC9KH.js} +2 -2
- package/dist/{ColorPickerPanel-CKMd-dqd.js.map → ColorPickerPanel-DKTKC9KH.js.map} +1 -1
- package/dist/{ColorPickerPanel-BbgujQ3X.cjs → ColorPickerPanel-kl2jUix-.cjs} +2 -2
- package/dist/{ColorPickerPanel-BbgujQ3X.cjs.map → ColorPickerPanel-kl2jUix-.cjs.map} +1 -1
- package/dist/{ColorRamp-D9_5JULy.cjs → ColorRamp-n7muILK3.cjs} +2 -2
- package/dist/{ColorRamp-D9_5JULy.cjs.map → ColorRamp-n7muILK3.cjs.map} +1 -1
- package/dist/{ColorRamp-Mp_ddhmb.js → ColorRamp-yfMyJCyx.js} +2 -2
- package/dist/{ColorRamp-Mp_ddhmb.js.map → ColorRamp-yfMyJCyx.js.map} +1 -1
- package/dist/ConfigProvider-BaiTKZKC.cjs +2 -0
- package/dist/ConfigProvider-BaiTKZKC.cjs.map +1 -0
- package/dist/ConfigProvider-D61cpCz-.js +379 -0
- package/dist/ConfigProvider-D61cpCz-.js.map +1 -0
- package/dist/{CopyButton-DZeYcG68.cjs → CopyButton-DlSi82gv.cjs} +2 -2
- package/dist/{CopyButton-DZeYcG68.cjs.map → CopyButton-DlSi82gv.cjs.map} +1 -1
- package/dist/{CopyButton-Yg5ZVTiX.js → CopyButton-ecxn-ghi.js} +3 -3
- package/dist/{CopyButton-Yg5ZVTiX.js.map → CopyButton-ecxn-ghi.js.map} +1 -1
- package/dist/DatePicker-BjZ_P21i.cjs +2 -0
- package/dist/{DatePicker-CXRsT-lt.cjs.map → DatePicker-BjZ_P21i.cjs.map} +1 -1
- package/dist/{DatePicker-BMJlfCKB.js → DatePicker-CAGpJbDi.js} +42 -42
- package/dist/{DatePicker-BMJlfCKB.js.map → DatePicker-CAGpJbDi.js.map} +1 -1
- package/dist/{DateTimePicker-B-Jjejzm.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-S9C6Tp90.cjs → DescriptionList-CvPDn-kh.cjs} +2 -2
- package/dist/DescriptionList-CvPDn-kh.cjs.map +1 -0
- package/dist/{DescriptionList-CG08_qwT.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-DnGds1ch.cjs → EmptyState-CX1g47y_.cjs} +2 -2
- package/dist/{EmptyState-DnGds1ch.cjs.map → EmptyState-CX1g47y_.cjs.map} +1 -1
- package/dist/{EmptyState-BCoPw8jf.js → EmptyState-Dqtpmtje.js} +2 -2
- package/dist/{EmptyState-BCoPw8jf.js.map → EmptyState-Dqtpmtje.js.map} +1 -1
- package/dist/{ErrorBoundary-JCNa0_Ys.cjs → ErrorBoundary-B8KwWXXp.cjs} +2 -2
- package/dist/{ErrorBoundary-JCNa0_Ys.cjs.map → ErrorBoundary-B8KwWXXp.cjs.map} +1 -1
- package/dist/{ErrorBoundary-BILk_3fM.js → ErrorBoundary-Dos7VLb-.js} +3 -3
- package/dist/{ErrorBoundary-BILk_3fM.js.map → ErrorBoundary-Dos7VLb-.js.map} +1 -1
- package/dist/{ErrorState-MQBeyF2n.cjs → ErrorState-CwCqd2PU.cjs} +2 -2
- package/dist/{ErrorState-MQBeyF2n.cjs.map → ErrorState-CwCqd2PU.cjs.map} +1 -1
- package/dist/{ErrorState-DI28ZCJN.js → ErrorState-KhzrGIJ-.js} +7 -7
- package/dist/{ErrorState-DI28ZCJN.js.map → ErrorState-KhzrGIJ-.js.map} +1 -1
- package/dist/{FileCard-Cl88Gu6L.cjs → FileCard-DEc10T2G.cjs} +2 -2
- package/dist/FileCard-DEc10T2G.cjs.map +1 -0
- package/dist/{FileCard-5QvVkO1-.js → FileCard-SSuFS13E.js} +3 -3
- package/dist/FileCard-SSuFS13E.js.map +1 -0
- package/dist/{FileUploader-FMVbj7rz.cjs → FileUploader-D58_6kDA.cjs} +2 -2
- package/dist/FileUploader-D58_6kDA.cjs.map +1 -0
- package/dist/{FileUploader-DwAl3UXI.js → FileUploader-DfYOBFa4.js} +5 -5
- package/dist/FileUploader-DfYOBFa4.js.map +1 -0
- package/dist/{Flag-Do7x-AhS.cjs → Flag-B1ZvZVXi.cjs} +2 -2
- package/dist/{Flag-Do7x-AhS.cjs.map → Flag-B1ZvZVXi.cjs.map} +1 -1
- package/dist/{Flag-DfA2t0yd.js → Flag-BEIqYQZg.js} +2 -2
- package/dist/{Flag-DfA2t0yd.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-DM6wWZ1a.js → FullscreenToggle-I_In47BB.js} +3 -3
- package/dist/{FullscreenToggle-DM6wWZ1a.js.map → FullscreenToggle-I_In47BB.js.map} +1 -1
- package/dist/{FullscreenToggle-Bbb_z2xj.cjs → FullscreenToggle-Po769CoC.cjs} +2 -2
- package/dist/{FullscreenToggle-Bbb_z2xj.cjs.map → FullscreenToggle-Po769CoC.cjs.map} +1 -1
- package/dist/{IconButton-CQ25TtBc.cjs → IconButton-CxSXEYce.cjs} +2 -2
- package/dist/{IconButton-CQ25TtBc.cjs.map → IconButton-CxSXEYce.cjs.map} +1 -1
- package/dist/{IconButton-06pmftMo.js → IconButton-D9MCwRK_.js} +2 -2
- package/dist/{IconButton-06pmftMo.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-B5Pm8AaT.cjs → Loader-5zp2MPm5.cjs} +2 -2
- package/dist/{Loader-B5Pm8AaT.cjs.map → Loader-5zp2MPm5.cjs.map} +1 -1
- package/dist/{Loader-Bj5uwVR9.js → Loader-Bluu6z0-.js} +2 -2
- package/dist/{Loader-Bj5uwVR9.js.map → Loader-Bluu6z0-.js.map} +1 -1
- package/dist/{LocationPicker-D-sT4rSe.cjs → LocationPicker-CGHXTIml.cjs} +2 -2
- package/dist/{LocationPicker-D-sT4rSe.cjs.map → LocationPicker-CGHXTIml.cjs.map} +1 -1
- package/dist/{LocationPicker-Ce8aLubZ.js → LocationPicker-hULpHBVG.js} +7 -7
- package/dist/{LocationPicker-Ce8aLubZ.js.map → LocationPicker-hULpHBVG.js.map} +1 -1
- package/dist/{Modal-DTnB_mGg.js → Modal-C6Zgwz_6.js} +3 -3
- package/dist/Modal-C6Zgwz_6.js.map +1 -0
- package/dist/{Modal-DjSOhZqd.cjs → Modal-D9_OG53G.cjs} +2 -2
- package/dist/Modal-D9_OG53G.cjs.map +1 -0
- package/dist/{MultiSelect-C4RvohFY.cjs → MultiSelect-BdPvjiTj.cjs} +2 -2
- package/dist/{MultiSelect-C4RvohFY.cjs.map → MultiSelect-BdPvjiTj.cjs.map} +1 -1
- package/dist/{MultiSelect-Dn8l5z52.js → MultiSelect-CHLMpim4.js} +4 -4
- package/dist/{MultiSelect-Dn8l5z52.js.map → MultiSelect-CHLMpim4.js.map} +1 -1
- package/dist/{NumberField-DvQ5UP1R.js → NumberField-BlpFmetF.js} +3 -3
- package/dist/{NumberField-DvQ5UP1R.js.map → NumberField-BlpFmetF.js.map} +1 -1
- package/dist/{NumberField-C3TLdAgT.cjs → NumberField-C-FZ-uRI.cjs} +2 -2
- package/dist/{NumberField-C3TLdAgT.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-aUV0vUfB.cjs → PageError-DXUOkE14.cjs} +2 -2
- package/dist/{PageError-aUV0vUfB.cjs.map → PageError-DXUOkE14.cjs.map} +1 -1
- package/dist/{PageError-BORFaxGW.js → PageError-DyDj1wQZ.js} +5 -5
- package/dist/{PageError-BORFaxGW.js.map → PageError-DyDj1wQZ.js.map} +1 -1
- package/dist/{PageLayout-rtEl8uqS.cjs → PageLayout-CoG0AaUs.cjs} +2 -2
- package/dist/PageLayout-CoG0AaUs.cjs.map +1 -0
- package/dist/{PageLayout-ojiBEcxI.js → PageLayout-nsJa8CbT.js} +4 -4
- package/dist/PageLayout-nsJa8CbT.js.map +1 -0
- package/dist/{PageNotFound-D536Tshv.js → PageNotFound-BNNwMkwE.js} +5 -5
- package/dist/{PageNotFound-D536Tshv.js.map → PageNotFound-BNNwMkwE.js.map} +1 -1
- package/dist/{PageNotFound-f-dxrnol.cjs → PageNotFound-CGSxT_n9.cjs} +2 -2
- package/dist/{PageNotFound-f-dxrnol.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-CTPl3D43.js +56 -0
- package/dist/PaletteField-CTPl3D43.js.map +1 -0
- package/dist/PaletteField-PDcu2vUp.cjs +2 -0
- package/dist/PaletteField-PDcu2vUp.cjs.map +1 -0
- package/dist/{PhoneField-DzLTXJcw.cjs → PhoneField-BPYg5ZHW.cjs} +2 -2
- package/dist/{PhoneField-DzLTXJcw.cjs.map → PhoneField-BPYg5ZHW.cjs.map} +1 -1
- package/dist/{PhoneField-CjYw-Unw.js → PhoneField-pdWDCszb.js} +4 -4
- package/dist/{PhoneField-CjYw-Unw.js.map → PhoneField-pdWDCszb.js.map} +1 -1
- package/dist/{Popconfirm-B3GhhrRM.js → Popconfirm-CMVzLaC_.js} +3 -3
- package/dist/{Popconfirm-B3GhhrRM.js.map → Popconfirm-CMVzLaC_.js.map} +1 -1
- package/dist/{Popconfirm-CYc8ywDI.cjs → Popconfirm-cNpJmkuR.cjs} +2 -2
- package/dist/{Popconfirm-CYc8ywDI.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-ZNQrxw_Q.js → Progress-BNEFGn-O.js} +2 -2
- package/dist/{Progress-ZNQrxw_Q.js.map → Progress-BNEFGn-O.js.map} +1 -1
- package/dist/{Progress-BABBBG2y.cjs → Progress-x12Rkh06.cjs} +2 -2
- package/dist/{Progress-BABBBG2y.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-ayAfGXpB.js → RemoveDialog-ARFp1UJM.js} +5 -5
- package/dist/{RemoveDialog-ayAfGXpB.js.map → RemoveDialog-ARFp1UJM.js.map} +1 -1
- package/dist/{RemoveDialog-B_Y18MeJ.cjs → RemoveDialog-IWOAQFNK.cjs} +2 -2
- package/dist/{RemoveDialog-B_Y18MeJ.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-itYD1PfE.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-1FWkryTK.cjs → Select-C2DIfuoB.cjs} +2 -2
- package/dist/{Select-1FWkryTK.cjs.map → Select-C2DIfuoB.cjs.map} +1 -1
- package/dist/{Select-K0a_7ROf.js → Select-KGsA8PbI.js} +3 -3
- package/dist/{Select-K0a_7ROf.js.map → Select-KGsA8PbI.js.map} +1 -1
- package/dist/{Sidebar-Dg15hPpM.js → Sidebar-_pcwxdd8.js} +133 -131
- package/dist/{Sidebar-Dg15hPpM.js.map → Sidebar-_pcwxdd8.js.map} +1 -1
- package/dist/Sidebar-wK1_xaY_.cjs +2 -0
- package/dist/{Sidebar-C3-u3Agj.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-D6me6w_m.cjs → SpeedDial-BT_boD06.cjs} +2 -2
- package/dist/{SpeedDial-D6me6w_m.cjs.map → SpeedDial-BT_boD06.cjs.map} +1 -1
- package/dist/{SpeedDial-CEBAWIYo.js → SpeedDial-SMMfes9f.js} +2 -2
- package/dist/{SpeedDial-CEBAWIYo.js.map → SpeedDial-SMMfes9f.js.map} +1 -1
- package/dist/{Stepper-wPPs57uZ.cjs → Stepper-BmA_DjTS.cjs} +2 -2
- package/dist/Stepper-BmA_DjTS.cjs.map +1 -0
- package/dist/{Stepper-BN0GsRZW.js → Stepper-CR0Mlkq7.js} +2 -2
- package/dist/Stepper-CR0Mlkq7.js.map +1 -0
- package/dist/{Table-CFl3OYlo.cjs → Table-BkjY1Lwt.cjs} +2 -2
- package/dist/Table-BkjY1Lwt.cjs.map +1 -0
- package/dist/{Table-DChIfjqj.js → Table-D-F68lcm.js} +18 -18
- package/dist/Table-D-F68lcm.js.map +1 -0
- package/dist/{Tabs-BAKPWO4g.cjs → Tabs-Cgp6D1WP.cjs} +2 -2
- package/dist/{Tabs-BAKPWO4g.cjs.map → Tabs-Cgp6D1WP.cjs.map} +1 -1
- package/dist/{Tabs-DfVFgOfs.js → Tabs-DP0aZ5TB.js} +2 -2
- package/dist/{Tabs-DfVFgOfs.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-CoBRqcjW.js → TagsField-CcY9MTMw.js} +64 -64
- package/dist/TagsField-CcY9MTMw.js.map +1 -0
- package/dist/{TextField-0gFvIFs8.js → TextField-0WvJsHhA.js} +3 -3
- package/dist/{TextField-0gFvIFs8.js.map → TextField-0WvJsHhA.js.map} +1 -1
- package/dist/{TextField-BL6OAJcP.cjs → TextField-C5MgCQIV.cjs} +2 -2
- package/dist/{TextField-BL6OAJcP.cjs.map → TextField-C5MgCQIV.cjs.map} +1 -1
- package/dist/{ThemeToggle-BgKfcb02.cjs → ThemeToggle-BvcCxRpF.cjs} +2 -2
- package/dist/{ThemeToggle-BgKfcb02.cjs.map → ThemeToggle-BvcCxRpF.cjs.map} +1 -1
- package/dist/ThemeToggle-DmCePuTy.js +28 -0
- package/dist/{ThemeToggle-_SUmLxmU.js.map → ThemeToggle-DmCePuTy.js.map} +1 -1
- package/dist/{TimeColumns-DkJsIu1w.cjs → TimeColumns-Q-vsHFZU.cjs} +2 -2
- package/dist/{TimeColumns-DkJsIu1w.cjs.map → TimeColumns-Q-vsHFZU.cjs.map} +1 -1
- package/dist/{TimeColumns-BE1sLoRV.js → TimeColumns-WJRHQuFv.js} +2 -2
- package/dist/{TimeColumns-BE1sLoRV.js.map → TimeColumns-WJRHQuFv.js.map} +1 -1
- package/dist/TimePicker-CvbQFzBf.cjs +2 -0
- package/dist/{TimePicker-6nHQx0P5.cjs.map → TimePicker-CvbQFzBf.cjs.map} +1 -1
- package/dist/{TimePicker-Bv2qIFf9.js → TimePicker-DJDuSxAg.js} +54 -54
- package/dist/{TimePicker-Bv2qIFf9.js.map → TimePicker-DJDuSxAg.js.map} +1 -1
- package/dist/{Toaster-Fq6-ImDJ.js → Toaster-Bb5YEN5j.js} +2 -2
- package/dist/{Toaster-Fq6-ImDJ.js.map → Toaster-Bb5YEN5j.js.map} +1 -1
- package/dist/{Toaster-Brcspf7v.cjs → Toaster-Dy1AonLa.cjs} +2 -2
- package/dist/{Toaster-Brcspf7v.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-1ubnvBV6.cjs → UserCard-DbudGMvG.cjs} +2 -2
- package/dist/UserCard-DbudGMvG.cjs.map +1 -0
- package/dist/{UserCard-DcTLEHFu.js → UserCard-UG_Cwe-Y.js} +3 -3
- package/dist/UserCard-UG_Cwe-Y.js.map +1 -0
- package/dist/app/AdminRoot.d.cts +13 -3
- package/dist/app/AdminRoot.d.ts +13 -3
- 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/PaletteField.d.cts +8 -2
- package/dist/components/PaletteField/PaletteField.d.ts +8 -2
- 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 +26 -6
- package/dist/components/RootLayout/RootLayout.d.ts +26 -6
- package/dist/components/RootLayout/SettingsDrawer.d.cts +8 -2
- package/dist/components/RootLayout/SettingsDrawer.d.ts +8 -2
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.d.cts +1 -1
- package/dist/components/RootLayout/index.d.ts +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.d.cts +2 -2
- package/dist/entries/theme.d.ts +2 -2
- package/dist/entries/theme.js +12 -11
- 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 +26 -0
- package/dist/i18n/messages.d.ts +26 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +3 -3
- package/dist/index.js +232 -231
- package/dist/{messages-CMgYU5p6.js → messages-BiRLMy1E.js} +228 -46
- package/dist/messages-BiRLMy1E.js.map +1 -0
- package/dist/messages-C_fRRCg6.cjs +36 -0
- package/dist/messages-C_fRRCg6.cjs.map +1 -0
- package/dist/theme/ConfigProvider.d.cts +47 -7
- package/dist/theme/ConfigProvider.d.ts +47 -7
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/useForm-CGbJ44Gp.js.map +1 -1
- package/dist/useForm-CSw6r1n1.cjs.map +1 -1
- package/dist/{useHomeTo-MfvJxziQ.cjs → useHomeTo-BaM7kBDh.cjs} +2 -2
- package/dist/{useHomeTo-MfvJxziQ.cjs.map → useHomeTo-BaM7kBDh.cjs.map} +1 -1
- package/dist/{useHomeTo-Ckq7scIY.js → useHomeTo-DQj9tVZI.js} +2 -2
- package/dist/{useHomeTo-Ckq7scIY.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-3YlvxPAM.cjs → useOptionMenu-BKC1y6oj.cjs} +2 -2
- package/dist/{useOptionMenu-3YlvxPAM.cjs.map → useOptionMenu-BKC1y6oj.cjs.map} +1 -1
- package/dist/{useOptionMenu-BBsyUow1.js → useOptionMenu-Dom1-bqm.js} +5 -5
- package/dist/{useOptionMenu-BBsyUow1.js.map → useOptionMenu-Dom1-bqm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminRoot-CRTBGUxq.cjs +0 -2
- package/dist/AdminRoot-CRTBGUxq.cjs.map +0 -1
- package/dist/AdminRoot-JOgiNkJA.js +0 -107
- package/dist/AdminRoot-JOgiNkJA.js.map +0 -1
- package/dist/Alert-CY8iU1zd.cjs +0 -2
- package/dist/Alert-CY8iU1zd.cjs.map +0 -1
- package/dist/Alert-CtUr-0s8.js +0 -70
- package/dist/Alert-CtUr-0s8.js.map +0 -1
- package/dist/Breadcrumbs-Dqhk-dY2.js.map +0 -1
- package/dist/Breadcrumbs-hi6dJhfN.cjs.map +0 -1
- package/dist/Card-B91LGIzF.js +0 -128
- package/dist/Card-B91LGIzF.js.map +0 -1
- package/dist/Card-CkZtVNyV.cjs +0 -2
- package/dist/Card-CkZtVNyV.cjs.map +0 -1
- package/dist/Chip-B7cAHjlx.cjs.map +0 -1
- package/dist/Chip-D5ZZs3QH.js.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-C3mG_seZ.cjs.map +0 -1
- package/dist/CodeBlock-DrWRSRmO.js.map +0 -1
- package/dist/ColorPicker-C1pDI4su.cjs +0 -2
- package/dist/ConfigProvider-B_Bb6pk1.cjs +0 -2
- package/dist/ConfigProvider-B_Bb6pk1.cjs.map +0 -1
- package/dist/ConfigProvider-DeMASTVo.js +0 -347
- package/dist/ConfigProvider-DeMASTVo.js.map +0 -1
- package/dist/DatePicker-CXRsT-lt.cjs +0 -2
- package/dist/DateTimePicker-B-Jjejzm.js.map +0 -1
- package/dist/DateTimePicker-BuTIRTUX.cjs +0 -2
- package/dist/DateTimePicker-BuTIRTUX.cjs.map +0 -1
- package/dist/DescriptionList-CG08_qwT.js.map +0 -1
- package/dist/DescriptionList-S9C6Tp90.cjs.map +0 -1
- package/dist/FileCard-5QvVkO1-.js.map +0 -1
- package/dist/FileCard-Cl88Gu6L.cjs.map +0 -1
- package/dist/FileUploader-DwAl3UXI.js.map +0 -1
- package/dist/FileUploader-FMVbj7rz.cjs.map +0 -1
- package/dist/ListItem-Qo1Tt6Fi.cjs +0 -2
- package/dist/Modal-DTnB_mGg.js.map +0 -1
- package/dist/Modal-DjSOhZqd.cjs.map +0 -1
- package/dist/OtpField-Dy4O1MeD.js +0 -174
- package/dist/OtpField-Dy4O1MeD.js.map +0 -1
- package/dist/OtpField-OdkuKKcV.cjs +0 -2
- package/dist/OtpField-OdkuKKcV.cjs.map +0 -1
- package/dist/PageLayout-ojiBEcxI.js.map +0 -1
- package/dist/PageLayout-rtEl8uqS.cjs.map +0 -1
- package/dist/Pagination-DoDGKGpQ.js +0 -139
- package/dist/Pagination-DoDGKGpQ.js.map +0 -1
- package/dist/Pagination-Ffv6IFIU.cjs +0 -2
- package/dist/Pagination-Ffv6IFIU.cjs.map +0 -1
- package/dist/PaletteField-ChG2VQtS.js +0 -54
- package/dist/PaletteField-ChG2VQtS.js.map +0 -1
- package/dist/PaletteField-DQ1OvXqe.cjs +0 -2
- package/dist/PaletteField-DQ1OvXqe.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-DSvSaszc.cjs +0 -2
- package/dist/RichTextEditor-DSvSaszc.cjs.map +0 -1
- package/dist/RichTextEditor-itYD1PfE.js.map +0 -1
- package/dist/RootLayout-BlYjYAYk.js +0 -582
- package/dist/RootLayout-BlYjYAYk.js.map +0 -1
- package/dist/RootLayout-D5nlzYlH.cjs +0 -2
- package/dist/RootLayout-D5nlzYlH.cjs.map +0 -1
- package/dist/Sidebar-C3-u3Agj.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-BN0GsRZW.js.map +0 -1
- package/dist/Stepper-wPPs57uZ.cjs.map +0 -1
- package/dist/Table-CFl3OYlo.cjs.map +0 -1
- package/dist/Table-DChIfjqj.js.map +0 -1
- package/dist/TagsField-5mbyaFQZ.cjs +0 -2
- package/dist/TagsField-5mbyaFQZ.cjs.map +0 -1
- package/dist/TagsField-CoBRqcjW.js.map +0 -1
- package/dist/ThemeToggle-_SUmLxmU.js +0 -28
- package/dist/TimePicker-6nHQx0P5.cjs +0 -2
- package/dist/TranslatedFields-CVc0NvXa.cjs +0 -2
- package/dist/TranslatedFields-CVc0NvXa.cjs.map +0 -1
- package/dist/TranslatedFields-CmRhRGC_.js +0 -86
- package/dist/TranslatedFields-CmRhRGC_.js.map +0 -1
- package/dist/UserCard-1ubnvBV6.cjs.map +0 -1
- package/dist/UserCard-DcTLEHFu.js.map +0 -1
- package/dist/messages-CMgYU5p6.js.map +0 -1
- package/dist/messages-h22vS9zn.cjs +0 -36
- package/dist/messages-h22vS9zn.cjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DescriptionList-Knq5eCiY.js","sources":["../src/components/DescriptionList/DescriptionList.tsx"],"sourcesContent":["import { forwardRef, useId, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { resolveResponsive, type Breakpoint, type Responsive } from '../../theme/breakpoints'\nimport { useBreakpointMatches } from '../../hooks/useMediaQuery'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport { Icon } from '../Icon'\nimport { CopyButton } from '../CopyButton'\nimport { IconButton } from '../IconButton'\nimport { Skeleton } from '../Skeleton'\nimport { Typography } from '../Typography'\nimport styles from './DescriptionList.module.css'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport type DescriptionListSize = 'sm' | 'md' | 'lg'\nexport type DescriptionListLayout = 'vertical' | 'horizontal'\nexport type DescriptionListColumns = 1 | 2 | 3 | 4\nexport type DescriptionListValueWeight = 'regular' | 'medium' | 'bold'\n\nexport interface DescriptionItem {\n /** Stable key (defaults to the index). */\n key?: string\n /** The term — \"Entry fee\". */\n label: ReactNode\n /** The value. `null` / `undefined` / `''` / `false` render the `emptyText` placeholder (\"—\"). */\n value?: ReactNode\n /** Columns this pair spans (clamped to the resolved column count) — for long text, addresses, lists. */\n span?: DescriptionListColumns\n /** Show a copy button: `true` copies a string/number `value`; pass a string to copy something else (an id behind a label). */\n copyable?: boolean | string\n /** Drop the pair entirely (e.g. by role). */\n hidden?: boolean\n /** Small leading icon in the label — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n}\n\nexport interface DescriptionListProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'title' | 'color'\n> {\n /** The label / value pairs, in order. Declarative so `loading` skeletons and `hidden` stay trivial. */\n items: DescriptionItem[]\n /** Column count — a number or a desktop-first breakpoint map. Defaults to `{ xs: 1, sm: 2, lg: 3 }`. */\n columns?: Responsive<DescriptionListColumns>\n /** `vertical` (label above value, default) or `horizontal` (label beside value; stacks again on phones). */\n layout?: DescriptionListLayout\n /** Text + spacing scale. Defaults to `md`. */\n size?: DescriptionListSize\n /** Font weight of the values. Defaults to `regular` (the library's body default); `medium` / `bold` add emphasis. */\n valueWeight?: DescriptionListValueWeight\n /** Frame the list as a surface card (border + radius); `horizontal` also tints the label column. */\n bordered?: boolean\n /** Hairlines between rows. Defaults to `true` (turn off inside an already-ruled container). */\n dividers?: boolean\n /** Label column width for `horizontal` (px number or CSS length). Defaults to `160px`. */\n labelWidth?: number | string\n /**\n * `horizontal` only — the breakpoint at (and below) which the label stacks back above the value.\n * A breakpoint token (`'xxs'` ≤ 576px default, `'xs'` ≤ 768px, …) or `false` to keep the two columns\n * side by side at every width. Uses the shared JS breakpoint layer, so `config.theme.breakpoints` applies.\n */\n stackBelow?: Breakpoint | false\n /** Render shimmering placeholders instead of values — `true` uses one row per visible item (`6` when none), a number sets the count. */\n loading?: boolean | number\n /** Placeholder for an empty value. Defaults to `\"—\"`. */\n emptyText?: ReactNode\n /** Optional header title. */\n title?: ReactNode\n /** Leading header icon (a tinted box before the title, like `Card`) — a known `IconName` or any node. */\n icon?: IconName | ReactNode\n /** Theme color that tints the header icon box. Defaults to `accent`. */\n color?: ThemeColor\n /** Muted line under the title. */\n subtitle?: ReactNode\n /** Header slot on the right (buttons, a status chip …). */\n actions?: ReactNode\n}\n\nconst DEFAULT_COLUMNS: Responsive<DescriptionListColumns> = { xs: 1, sm: 2, lg: 3 }\n\nconst isEmpty = (value: ReactNode) => value == null || value === '' || value === false\n\n/** What `copyable` copies: an explicit string, else a string / number value; nothing for rich nodes. */\nconst copyTextOf = (item: DescriptionItem): string | undefined => {\n if (typeof item.copyable === 'string') return item.copyable\n if (typeof item.value === 'string' || typeof item.value === 'number') return String(item.value)\n return undefined\n}\n\n/** Lay the items on a `cols`-wide grid the way CSS auto-placement will (spans clamped, wrapping rows). */\nconst placeItems = (items: DescriptionItem[], cols: number) => {\n let row = 0\n let col = 0\n return items.map((item) => {\n const span = Math.min(item.span ?? 1, cols)\n if (col + span > cols) {\n row += 1\n col = 0\n }\n const placed = { item, span, row, col }\n col += span\n if (col >= cols) {\n row += 1\n col = 0\n }\n return placed\n })\n}\n\nconst renderIcon = (icon: IconName | ReactNode, size: 'sm' | 'md' = 'sm') =>\n typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} size={size} />\n ) : (\n icon\n )\n\n/**\n * Label / value pairs for a **detail page** (the read-only twin of a form: \"User #42\" → Name, Email,\n * Role …). Renders a semantic `<dl>` of `<dt>` / `<dd>` groups laid out on a responsive CSS grid\n * (`columns`, desktop-first breakpoint map — default 1 → 2 → 3), each pair optionally spanning several\n * columns. An optional Card-style header carries an `icon` box (tinted by `color`), `title`,\n * `subtitle` and `actions`. Values are regular weight by default (`valueWeight` adds emphasis) and any node: `null` / `''` show a muted \"—\" placeholder (`emptyText`), string / number\n * values can grow a `CopyButton` (revealed on hover / focus; always visible without hover), and\n * `hidden` drops a pair (e.g. by role). `layout=\"horizontal\"` puts the label beside the value in a\n * `labelWidth` column and stacks back on phones (`stackBelow` — a breakpoint, or `false` to never stack); `bordered` frames the list as a surface card (tinting the\n * label column when horizontal). `loading` swaps the values for `Skeleton` lines of the same shape.\n * Rows are separated by hairline `dividers`. Token-only; the grid is never `overflow: hidden` so the\n * copy tooltip is never clipped. `forwardRef` to the root `<div>`.\n */\nexport const DescriptionList = forwardRef<HTMLDivElement, DescriptionListProps>(\n function DescriptionList(\n {\n items,\n columns = DEFAULT_COLUMNS,\n layout = 'vertical',\n size = 'md',\n valueWeight = 'regular',\n bordered = false,\n dividers = true,\n labelWidth = 160,\n stackBelow = 'xxs',\n loading = false,\n emptyText = '\\u2014',\n title,\n icon,\n color = 'accent',\n subtitle,\n actions,\n className,\n style,\n ...props\n },\n ref,\n ) {\n const t = useT()\n const id = useId()\n const titleId = `${id}-title`\n const matches = useBreakpointMatches()\n const cols = resolveResponsive(columns, matches) ?? 1\n const stacked = layout === 'horizontal' && stackBelow !== false && matches[stackBelow]\n\n const visible = items.filter((item) => !item.hidden)\n // Grid placement (span-aware) — the last row drops its hairline (nothing follows it, and in `bordered`\n // it would double the frame's border), and its first cell rounds the frame's bottom-left corner\n // (`bordered` + `horizontal` tints the label column, and that tint must not bleed past the radius).\n const placed = placeItems(visible, cols)\n const lastRow = placed.length ? placed[placed.length - 1].row : 0\n const skeletonRows = typeof loading === 'number' ? loading : visible.length || 6\n const hasHeader = title != null || subtitle != null || actions != null || icon != null\n\n const vars = {\n '--dl-cols': cols,\n '--dl-label-w': typeof labelWidth === 'number' ? `${labelWidth}px` : labelWidth,\n } as CSSProperties\n\n return (\n <div\n ref={ref}\n className={clsx(\n styles.root,\n styles[size],\n styles[layout],\n valueWeight !== 'regular' && styles[`value${valueWeight === 'bold' ? 'Bold' : 'Medium'}`],\n bordered && styles.bordered,\n dividers && styles.dividers,\n stacked && styles.stacked,\n className,\n )}\n style={{ ...vars, ...style }}\n {...props}\n >\n {hasHeader && (\n <div className={styles.header}>\n <div className={styles.headerMain}>\n {icon != null && (\n <IconButton\n variant=\"filled\"\n size=\"sm\"\n color={color}\n nonClickable\n aria-hidden\n className={styles.headerIcon}\n >\n {renderIcon(icon, 'md')}\n </IconButton>\n )}\n {(title != null || subtitle != null) && (\n <div className={styles.headerText}>\n {title != null && (\n <Typography as=\"h3\" id={titleId} variant=\"subtitle\" className={styles.title}>\n {title}\n </Typography>\n )}\n {subtitle != null && (\n <Typography as=\"p\" variant=\"bodySmall\" color=\"muted\">\n {subtitle}\n </Typography>\n )}\n </div>\n )}\n </div>\n {actions != null && <div className={styles.actions}>{actions}</div>}\n </div>\n )}\n\n <dl\n className={styles.grid}\n aria-labelledby={title != null ? titleId : undefined}\n aria-busy={loading ? true : undefined}\n aria-label={loading ? t('descriptionList.loading') : undefined}\n >\n {loading\n ? Array.from({ length: skeletonRows }, (_, i) => (\n <div key={i} className={styles.item} aria-hidden=\"true\">\n <dt className={styles.label}>\n <Skeleton width=\"40%\" height=\"0.9em\" />\n </dt>\n <dd className={styles.value}>\n <Skeleton width=\"70%\" height=\"1.1em\" />\n </dd>\n </div>\n ))\n : placed.map(({ item, span, row, col }, i) => {\n const empty = isEmpty(item.value)\n const copy = !empty && item.copyable ? copyTextOf(item) : undefined\n return (\n <div\n key={item.key ?? i}\n className={clsx(\n styles.item,\n row === lastRow && styles.lastRow,\n row === lastRow && col === 0 && styles.lastRowStart,\n )}\n style={{ '--dl-span': span } as CSSProperties}\n >\n <dt className={styles.label}>\n {item.icon != null && (\n <span className={styles.labelIcon} aria-hidden=\"true\">\n {renderIcon(item.icon)}\n </span>\n )}\n {item.label}\n </dt>\n <dd className={styles.value}>\n <span className={styles.valueText}>\n {empty ? (\n <span\n className={styles.placeholder}\n aria-label={t('descriptionList.empty')}\n >\n {emptyText}\n </span>\n ) : (\n item.value\n )}\n </span>\n {copy != null && (\n <span className={styles.copy}>\n <CopyButton\n value={copy}\n size=\"sm\"\n variant=\"text\"\n className={styles.copyButton}\n />\n </span>\n )}\n </dd>\n </div>\n )\n })}\n </dl>\n </div>\n )\n },\n)\n"],"names":["ICON_NAME_SET","ICON_NAMES","DEFAULT_COLUMNS","isEmpty","value","copyTextOf","item","placeItems","items","cols","row","col","span","placed","renderIcon","icon","size","jsx","Icon","DescriptionList","forwardRef","columns","layout","valueWeight","bordered","dividers","labelWidth","stackBelow","loading","emptyText","title","color","subtitle","actions","className","style","props","ref","t","useT","titleId","useId","matches","useBreakpointMatches","resolveResponsive","stacked","visible","lastRow","skeletonRows","hasHeader","vars","jsxs","clsx","styles","IconButton","Typography","_","i","Skeleton","empty","copy","CopyButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAaMA,KAAgB,IAAI,IAAYC,CAAU,GAkE1CC,KAAsD,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,EAAA,GAE1EC,KAAU,CAACC,MAAqBA,KAAS,QAAQA,MAAU,MAAMA,MAAU,IAG3EC,KAAa,CAACC,MAA8C;AAChE,MAAI,OAAOA,EAAK,YAAa,iBAAiBA,EAAK;AACnD,MAAI,OAAOA,EAAK,SAAU,YAAY,OAAOA,EAAK,SAAU,SAAU,QAAO,OAAOA,EAAK,KAAK;AAEhG,GAGMC,KAAa,CAACC,GAA0BC,MAAiB;AAC7D,MAAIC,IAAM,GACNC,IAAM;AACV,SAAOH,EAAM,IAAI,CAACF,MAAS;AACzB,UAAMM,IAAO,KAAK,IAAIN,EAAK,QAAQ,GAAGG,CAAI;AAC1C,IAAIE,IAAMC,IAAOH,MACfC,KAAO,GACPC,IAAM;AAER,UAAME,IAAS,EAAE,MAAAP,GAAM,MAAAM,GAAM,KAAAF,GAAK,KAAAC,EAAA;AAClC,WAAAA,KAAOC,GACHD,KAAOF,MACTC,KAAO,GACPC,IAAM,IAEDE;AAAA,EACT,CAAC;AACH,GAEMC,IAA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,UAAAvC,EAAWR,EAAK,IAAI,GACvB;AAAA,wBAEDA,EAAK;AAAA,sBAAA,GACR;AAAA,sBACA,gBAAA6C,EAAC,MAAA,EAAG,WAAWE,EAAO,OACpB,UAAA;AAAA,wBAAA,gBAAApC,EAAC,QAAA,EAAK,WAAWoC,EAAO,WACrB,UAAAM,IACC,gBAAA1C;AAAA,0BAAC;AAAA,0BAAA;AAAA,4BACC,WAAWoC,EAAO;AAAA,4BAClB,cAAYf,EAAE,uBAAuB;AAAA,4BAEpC,UAAAT;AAAA,0BAAA;AAAA,wBAAA,IAGHvB,EAAK,OAET;AAAA,wBACCsD,KAAQ,QACP,gBAAA3C,EAAC,QAAA,EAAK,WAAWoC,EAAO,MACtB,UAAA,gBAAApC;AAAA,0BAAC4C;AAAA,0BAAA;AAAA,4BACC,OAAOD;AAAA,4BACP,MAAK;AAAA,4BACL,SAAQ;AAAA,4BACR,WAAWP,EAAO;AAAA,0BAAA;AAAA,wBAAA,EACpB,CACF;AAAA,sBAAA,EAAA,CAEJ;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAvCK/C,EAAK,OAAOmD;AAAA,gBAAA;AAAA,cA0CvB,CAAC;AAAA,YAAA;AAAA,UAAA;AAAA,QACP;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const A=require("react/jsx-runtime"),o=require("react"),Z=require("react-dom"),$=require("clsx"),ee=require("./List-
|
|
2
|
-
//# sourceMappingURL=Dropdown-
|
|
1
|
+
"use strict";const A=require("react/jsx-runtime"),o=require("react"),Z=require("react-dom"),$=require("clsx"),ee=require("./List-CKoNx21F.cjs"),te=require("./useLockBodyScroll-CIXHZo-Q.cjs"),ne="_panel_ntp6g_4",re="_sm_ntp6g_21",oe="_md_ntp6g_24",se="_lg_ntp6g_27",B={panel:ne,sm:re,md:oe,lg:se},ie=8,j='[role="menuitem"],[role="button"],a[href],button:not([disabled]),[tabindex]:not([tabindex="-1"])';function C(b){return b?Array.from(b.querySelectorAll(j)).filter(h=>h.getAttribute("aria-disabled")!=="true"&&h.offsetParent!==null):[]}function ce({trigger:b,children:h,placement:L="bottom-start",size:M="md",minWidth:O=!0,open:W,defaultOpen:z=!1,onOpenChange:v,closeOnSelect:N=!0,matchTriggerWidth:H=!1,disabled:T=!1,offset:p=6,className:U,style:V}){const S=o.useId(),u=o.useRef(null),d=o.useRef(null),_=W!==void 0,[G,K]=o.useState(z),s=_?W:G,[J,F]=o.useState(!1),[r,Q]=o.useState(null),D=o.useCallback(n=>{_||K(n),v==null||v(n)},[_,v]),w=o.useCallback(()=>D(!1),[D]);te.useLockBodyScroll(s);const g=o.useCallback(()=>{const n=u.current,t=d.current;if(!n||!t)return;const e=n.getBoundingClientRect(),l=t.offsetWidth,a=t.offsetHeight,i=window.innerWidth,E=window.innerHeight,c=ie,m=E-e.bottom-p-c,k=e.top-p-c;let f=L.startsWith("bottom")?"bottom":"top";f==="bottom"&&a>m&&k>m?f="top":f==="top"&&a>k&&m>k&&(f="bottom");const I=Math.max(0,f==="bottom"?m:k),P=Math.min(a,I);let R=f==="bottom"?e.bottom+p:e.top-p-P;R=Math.min(Math.max(R,c),Math.max(c,E-c-P));let q=L.endsWith("end")?e.right-l:e.left;q=Math.min(Math.max(q,c),Math.max(c,i-c-l)),Q({top:R,left:q,side:f,maxHeight:I,minWidth:H?e.width:void 0})},[L,p,H]);o.useLayoutEffect(()=>{if(!s){F(!1);return}g()},[s,g]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>F(!0)),t=()=>g();window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);let e;return typeof ResizeObserver<"u"&&(e=new ResizeObserver(t),d.current&&e.observe(d.current),u.current&&e.observe(u.current)),()=>{cancelAnimationFrame(n),window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),e==null||e.disconnect()}},[s,g]),o.useEffect(()=>{if(!s)return;const n=e=>{var a,i;const l=e.target;(a=u.current)!=null&&a.contains(l)||(i=d.current)!=null&&i.contains(l)||w()},t=e=>{var l,a;if(e.key==="Escape")e.preventDefault(),w(),(l=u.current)==null||l.focus();else if(e.key==="Tab")w();else if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();const i=C(d.current);if(!i.length)return;const E=i.indexOf(document.activeElement),c=e.key==="ArrowDown"?1:-1,m=(E+c+i.length)%i.length;(a=i[m])==null||a.focus()}};return document.addEventListener("pointerdown",n,!0),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",n,!0),document.removeEventListener("keydown",t)}},[s,w]),o.useEffect(()=>{if(!s)return;const n=requestAnimationFrame(()=>{var t;return(t=C(d.current)[0])==null?void 0:t.focus()});return()=>cancelAnimationFrame(n)},[s]);const x=b.props,y=x.ref,X=o.cloneElement(b,{ref:n=>{u.current=n,typeof y=="function"?y(n):y&&(y.current=n)},onClick:n=>{var t;(t=x.onClick)==null||t.call(x,n),T||D(!s)},"aria-haspopup":"menu","aria-expanded":s,"aria-controls":s?S:void 0}),Y=n=>{var e;if(!N)return;const t=n.target.closest(j);t&&t.getAttribute("aria-disabled")!=="true"&&(w(),(e=u.current)==null||e.focus())};return A.jsxs(A.Fragment,{children:[X,s&&Z.createPortal(A.jsx("div",{ref:d,id:S,className:$.clsx(B.panel,O&&B[M],U),"data-open":J?"true":"false","data-side":(r==null?void 0:r.side)??"bottom",style:{position:"fixed",top:(r==null?void 0:r.top)??0,left:(r==null?void 0:r.left)??0,maxHeight:r==null?void 0:r.maxHeight,minWidth:r==null?void 0:r.minWidth,visibility:r?"visible":"hidden",...V},onClick:Y,children:A.jsx(ee.List,{role:"menu",size:M,padding:"xs",children:h})}),document.body)]})}exports.Dropdown=ce;
|
|
2
|
+
//# sourceMappingURL=Dropdown-CMjURWYd.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown-DYYhzKSo.cjs","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":"wSAiEMA,GAAmB,EAEnBC,EACJ,mGAEF,SAASC,EAAeC,EAA0C,CAChE,OAAKA,EACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE,OAC/DG,GAAOA,EAAG,aAAa,eAAe,IAAM,QAAUA,EAAG,eAAiB,IAAA,EAF1D,CAAA,CAIrB,CASO,SAASC,GAAS,CACvB,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,eACZ,KAAAC,EAAO,KACP,SAAAC,EAAW,GACX,KAAAC,EACA,YAAAC,EAAc,GACd,aAAAC,EACA,cAAAC,EAAgB,GAChB,kBAAAC,EAAoB,GACpB,SAAAC,EAAW,GACX,OAAAC,EAAS,EACT,UAAAC,EACA,MAAAC,CACF,EAAkB,CAChB,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AAgB,WAAYA,EAAYG,CAAI,EAC9CH,IAAcA,EAAgD,QAAUG,EACnF,EACA,QAAUZ,GAA2B,QACnCE,EAAAM,EAAa,UAAb,MAAAN,EAAA,KAAAM,EAAuBR,GAClB5C,GAAUkB,EAAQ,CAACL,CAAM,CAChC,EACA,gBAAiB,OACjB,gBAAiBA,EACjB,gBAAiBA,EAAST,EAAS,MAAA,CACpC,EAEKqD,EAAoBb,GAA2B,OACnD,GAAI,CAAC9C,EAAe,OACpB,MAAM4D,EAAQd,EAAM,OAAuB,QAAQ3D,CAAS,EACxDyE,GAAQA,EAAK,aAAa,eAAe,IAAM,SACjDrC,EAAA,GACAyB,EAAAxC,EAAW,UAAX,MAAAwC,EAAoB,QAExB,EAEA,OACEa,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAN,EACAzC,GACCgD,EAAAA,aACEC,EAAAA,IAAC,MAAA,CACC,IAAKtD,EACL,GAAIJ,EACJ,UAAW2D,EAAAA,KAAKC,EAAO,MAAOtE,GAAYsE,EAAOvE,CAAI,EAAGS,CAAS,EACjE,YAAWY,EAAU,OAAS,QAC9B,aAAWE,GAAA,YAAAA,EAAK,OAAQ,SACxB,MAAO,CACL,SAAU,QACV,KAAKA,GAAA,YAAAA,EAAK,MAAO,EACjB,MAAMA,GAAA,YAAAA,EAAK,OAAQ,EACnB,UAAWA,GAAA,YAAAA,EAAK,UAChB,SAAUA,GAAA,YAAAA,EAAK,SACf,WAAYA,EAAM,UAAY,SAC9B,GAAGb,CAAA,EAEL,QAASsD,EAET,eAACQ,GAAAA,KAAA,CAAK,KAAK,OAAO,KAAAxE,EAAY,QAAQ,KACnC,SAAAF,CAAA,CACH,CAAA,CAAA,EAEF,SAAS,IAAA,CACX,EACJ,CAEJ"}
|
|
1
|
+
{"version":3,"file":"Dropdown-CMjURWYd.cjs","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":"wSAiEMA,GAAmB,EAEnBC,EACJ,mGAEF,SAASC,EAAeC,EAA0C,CAChE,OAAKA,EACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE,OAC/DG,GAAOA,EAAG,aAAa,eAAe,IAAM,QAAUA,EAAG,eAAiB,IAAA,EAF1D,CAAA,CAIrB,CASO,SAASC,GAAS,CACvB,QAAAC,EACA,SAAAC,EACA,UAAAC,EAAY,eACZ,KAAAC,EAAO,KACP,SAAAC,EAAW,GACX,KAAAC,EACA,YAAAC,EAAc,GACd,aAAAC,EACA,cAAAC,EAAgB,GAChB,kBAAAC,EAAoB,GACpB,SAAAC,EAAW,GACX,OAAAC,EAAS,EACT,UAAAC,EACA,MAAAC,CACF,EAAkB,CAChB,MAAMC,EAASC,EAAAA,MAAA,EACTC,EAAaC,EAAAA,O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,QAAUG,EACnF,EACA,QAAUZ,GAA2B,QACnCE,EAAAM,EAAa,UAAb,MAAAN,EAAA,KAAAM,EAAuBR,GAClB5C,GAAUkB,EAAQ,CAACL,CAAM,CAChC,EACA,gBAAiB,OACjB,gBAAiBA,EACjB,gBAAiBA,EAAST,EAAS,MAAA,CACpC,EAEKqD,EAAoBb,GAA2B,OACnD,GAAI,CAAC9C,EAAe,OACpB,MAAM4D,EAAQd,EAAM,OAAuB,QAAQ3D,CAAS,EACxDyE,GAAQA,EAAK,aAAa,eAAe,IAAM,SACjDrC,EAAA,GACAyB,EAAAxC,EAAW,UAAX,MAAAwC,EAAoB,QAExB,EAEA,OACEa,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAN,EACAzC,GACCgD,EAAAA,aACEC,EAAAA,IAAC,MAAA,CACC,IAAKtD,EACL,GAAIJ,EACJ,UAAW2D,EAAAA,KAAKC,EAAO,MAAOtE,GAAYsE,EAAOvE,CAAI,EAAGS,CAAS,EACjE,YAAWY,EAAU,OAAS,QAC9B,aAAWE,GAAA,YAAAA,EAAK,OAAQ,SACxB,MAAO,CACL,SAAU,QACV,KAAKA,GAAA,YAAAA,EAAK,MAAO,EACjB,MAAMA,GAAA,YAAAA,EAAK,OAAQ,EACnB,UAAWA,GAAA,YAAAA,EAAK,UAChB,SAAUA,GAAA,YAAAA,EAAK,SACf,WAAYA,EAAM,UAAY,SAC9B,GAAGb,CAAA,EAEL,QAASsD,EAET,eAACQ,GAAAA,KAAA,CAAK,KAAK,OAAO,KAAAxE,EAAY,QAAQ,KACnC,SAAAF,CAAA,CACH,CAAA,CAAA,EAEF,SAAS,IAAA,CACX,EACJ,CAEJ"}
|
|
@@ -2,7 +2,7 @@ import { jsxs as et, Fragment as nt, jsx as q } from "react/jsx-runtime";
|
|
|
2
2
|
import { useId as ot, useRef as z, useState as R, useCallback as M, useLayoutEffect as rt, useEffect as W, cloneElement as it } from "react";
|
|
3
3
|
import { createPortal as st } from "react-dom";
|
|
4
4
|
import { clsx as ct } from "clsx";
|
|
5
|
-
import { L as at } from "./List-
|
|
5
|
+
import { L as at } from "./List-2Y3ktTcF.js";
|
|
6
6
|
import { u as lt } from "./useLockBodyScroll-DwBILLPK.js";
|
|
7
7
|
const ut = "_panel_ntp6g_4", dt = "_sm_ntp6g_21", mt = "_md_ntp6g_24", ft = "_lg_ntp6g_27", C = {
|
|
8
8
|
panel: ut,
|
|
@@ -143,4 +143,4 @@ function Et({
|
|
|
143
143
|
export {
|
|
144
144
|
Et as D
|
|
145
145
|
};
|
|
146
|
-
//# sourceMappingURL=Dropdown-
|
|
146
|
+
//# sourceMappingURL=Dropdown-CnDBlB02.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown-CcC-Hwx4.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":";;;;;;;;;;;GAiEMA,KAAmB,GAEnBC,IACJ;AAEF,SAASC,EAAeC,GAA0C;AAChE,SAAKA,IACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE;AAAA,IAChE,CAACG,MAAOA,EAAG,aAAa,eAAe,MAAM,UAAUA,EAAG,iBAAiB;AAAA,EAAA,IAF1D,CAAA;AAIrB;AASO,SAASC,GAAS;AAAA,EACvB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,MAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,UAAAC,IAAW;AAAA,EACX,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,OAAAC;AACF,GAAkB;AAChB,QAAMC,IAASC,GAAA,GACTC,IAAaC,EAA2B,IAAI,GAC5CC,IAAWD,EAA8B,IAAI,GAE7CE,IAAed,MAAS,QACxB,CAACe,GAAcC,CAAe,IAAIC,EAAShB,CAAW,GACtDiB,IAASJ,IAAed,IAAOe,GAC/B,CAACI,GAASC,CAAU,IAAIH,EAAS,EAAK,GACtC,CAACI,GAAKC,CAAM,IAAIL,EAA0B,IAAI,GAE9CM,IAAUC;AAAA,IACd,CAACC,MAAkB;AACjB,MAAKX,KAAcE,EAAgBS,CAAI,GACvCvB,KAAA,QAAAA,EAAeuB;AAAA,IACjB;AAAA,IACA,CAACX,GAAcZ,CAAY;AAAA,EAAA,GAEvBwB,IAAQF,EAAY,MAAMD,EAAQ,EAAK,GAAG,CAACA,CAAO,CAAC;AAGzD,EAAAI,GAAkBT,CAAM;AAGxB,QAAMU,IAASJ,EAAY,MAAM;AAC/B,UAAMK,IAAYlB,EAAW,SACvBnB,I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ACAyB,IAAAxC,EAAW,YAAX,QAAAwC,EAAoB;AAAA,EAExB;AAEA,SACE,gBAAAa,GAAAC,IAAA,EACG,UAAA;AAAA,IAAAN;AAAA,IACAzC,KACCgD;AAAA,MACE,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,KAAKtD;AAAA,UACL,IAAIJ;AAAA,UACJ,WAAW2D,GAAKC,EAAO,OAAOtE,KAAYsE,EAAOvE,CAAI,GAAGS,CAAS;AAAA,UACjE,aAAWY,IAAU,SAAS;AAAA,UAC9B,cAAWE,KAAA,gBAAAA,EAAK,SAAQ;AAAA,UACxB,OAAO;AAAA,YACL,UAAU;AAAA,YACV,MAAKA,KAAA,gBAAAA,EAAK,QAAO;AAAA,YACjB,OAAMA,KAAA,gBAAAA,EAAK,SAAQ;AAAA,YACnB,WAAWA,KAAA,gBAAAA,EAAK;AAAA,YAChB,UAAUA,KAAA,gBAAAA,EAAK;AAAA,YACf,YAAYA,IAAM,YAAY;AAAA,YAC9B,GAAGb;AAAA,UAAA;AAAA,UAEL,SAASsD;AAAA,UAET,4BAACQ,IAAA,EAAK,MAAK,QAAO,MAAAxE,GAAY,SAAQ,MACnC,UAAAF,EAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,SAAS;AAAA,IAAA;AAAA,EACX,GACJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Dropdown-CnDBlB02.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["import {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useRef,\n useState,\n type CSSProperties,\n type MouseEvent as ReactMouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from 'react'\nimport { createPortal } from 'react-dom'\nimport { clsx } from 'clsx'\nimport { List, type ListItemSize } from '../List'\nimport { useLockBodyScroll } from '../../hooks/useLockBodyScroll'\nimport styles from './Dropdown.module.css'\n\nexport type DropdownPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end'\n\ninterface Position {\n top: number\n left: number\n side: 'top' | 'bottom'\n maxHeight: number\n minWidth?: number\n}\n\nexport interface DropdownProps {\n /** The element that opens the menu (e.g. a `Button` / `IconButton`). Cloned to wire click + a11y. */\n trigger: ReactElement\n /** Menu content — typically `ListItem`s (composed inside a `role=\"menu\"` `List`). */\n children: ReactNode\n /** Preferred placement. Flips to the opposite side automatically when it would overflow. Default `bottom-start`. */\n placement?: DropdownPlacement\n /** Menu size — sets the panel min-width (`sm` 150 · `md` 190 · `lg` 220) and the items' density. Default `md`. */\n size?: ListItemSize\n /**\n * Apply the size-based min-width (`sm` 150 · `md` 190 · `lg` 220px). Defaults to `true`; set `false`\n * to let the menu size to its content instead (the items' density still tracks `size`).\n */\n minWidth?: boolean\n /** Controlled open state. */\n open?: boolean\n /** Initial open state for uncontrolled use. Defaults to `false`. */\n defaultOpen?: boolean\n /** Fires with the next open state. */\n onOpenChange?: (open: boolean) => void\n /** Close the menu when an item inside is clicked. Defaults to `true`. */\n closeOnSelect?: boolean\n /** Make the menu at least as wide as the trigger (select-like). Defaults to `false`. */\n matchTriggerWidth?: boolean\n /** Prevents opening. */\n disabled?: boolean\n /** Gap between the trigger and the menu, in px. Defaults to `6`. */\n offset?: number\n /** Class applied to the floating panel. */\n className?: string\n /** Style applied to the floating panel. */\n style?: CSSProperties\n}\n\n/** Distance the menu is kept from the viewport edges (px). */\nconst VIEWPORT_PADDING = 8\n/** Focusable menu items, used for arrow-key roving. */\nconst FOCUSABLE =\n '[role=\"menuitem\"],[role=\"button\"],a[href],button:not([disabled]),[tabindex]:not([tabindex=\"-1\"])'\n\nfunction focusableItems(panel: HTMLElement | null): HTMLElement[] {\n if (!panel) return []\n return Array.from(panel.querySelectorAll<HTMLElement>(FOCUSABLE)).filter(\n (el) => el.getAttribute('aria-disabled') !== 'true' && el.offsetParent !== null,\n )\n}\n\n/**\n * A floating menu anchored to a `trigger`. Opens on trigger click; closes on outside click, `Escape`,\n * or selecting an item. The panel is portaled to `document.body` and positioned with collision\n * handling — it **flips** to the opposite side when it would overflow, clamps within the viewport, and\n * re-positions on scroll/resize (a too-tall menu caps its height and scrolls). Arrow keys move between\n * items; `Escape` returns focus to the trigger. Compose `ListItem`s as `children`.\n */\nexport function Dropdown({\n trigger,\n children,\n placement = 'bottom-start',\n size = 'md',\n minWidth = true,\n open,\n defaultOpen = false,\n onOpenChange,\n closeOnSelect = true,\n matchTriggerWidth = false,\n disabled = false,\n offset = 6,\n className,\n style,\n}: DropdownProps) {\n const menuId = useId()\n const triggerRef = useRef<HTMLElement | null>(null)\n const panelRef = useRef<HTMLDivElement | null>(null)\n\n const isControlled = open !== undefined\n const [internalOpen, setInternalOpen] = useState(defaultOpen)\n const isOpen = isControlled ? open : internalOpen\n const [visible, setVisible] = useState(false)\n const [pos, setPos] = useState<Position | null>(null)\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalOpen(next)\n onOpenChange?.(next)\n },\n [isControlled, onOpenChange],\n )\n const close = useCallback(() => setOpen(false), [setOpen])\n\n // lock page scroll while the menu is open (no scrollbar shift)\n useLockBodyScroll(isOpen)\n\n // ── positioning: flip when it would overflow, clamp inside the viewport ──\n const update = useCallback(() => {\n const triggerEl = triggerRef.current\n const panel = panelRef.current\n if (!triggerEl || !panel) return\n\n const rect = triggerEl.getBoundingClientRect()\n const panelW = panel.offsetWidth\n const panelH = panel.offsetHeight\n const vw = window.innerWidth\n const vh = window.innerHeight\n const pad = VIEWPORT_PADDING\n\n const spaceBelow = vh - rect.bottom - offset - pad\n const spaceAbove = rect.top - offset - pad\n let side: 'top' | 'bottom' = placement.startsWith('bottom') ? 'bottom' : 'top'\n // flip only when the preferred side can't fit AND the opposite side has more room\n if (side === 'bottom' && panelH > spaceBelow && spaceAbove > spaceBelow) side = 'top'\n else if (side === 'top' && panelH > spaceAbove && spaceBelow > spaceAbove) side = 'bottom'\n\n const available = side === 'bottom' ? spaceBelow : spaceAbove\n const maxHeight = Math.max(0, available)\n const usedH = Math.min(panelH, maxHeight)\n\n let top = side === 'bottom' ? rect.bottom + offset : rect.top - offset - usedH\n top = Math.min(Math.max(top, pad), Math.max(pad, vh - pad - usedH))\n\n let left = placement.endsWith('end') ? rect.right - panelW : rect.left\n left = Math.min(Math.max(left, pad), Math.max(pad, vw - pad - panelW))\n\n setPos({ top, left, side, maxHeight, minWidth: matchTriggerWidth ? rect.width : undefined })\n }, [placement, offset, matchTriggerWidth])\n\n // position synchronously before paint whenever the menu is open\n useLayoutEffect(() => {\n if (!isOpen) {\n setVisible(false)\n return\n }\n update()\n }, [isOpen, update])\n\n // enter transition + reposition listeners while open\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => setVisible(true))\n\n const onReposition = () => update()\n window.addEventListener('resize', onReposition)\n window.addEventListener('scroll', onReposition, true)\n let ro: ResizeObserver | undefined\n if (typeof ResizeObserver !== 'undefined') {\n ro = new ResizeObserver(onReposition)\n if (panelRef.current) ro.observe(panelRef.current)\n if (triggerRef.current) ro.observe(triggerRef.current)\n }\n\n return () => {\n cancelAnimationFrame(raf)\n window.removeEventListener('resize', onReposition)\n window.removeEventListener('scroll', onReposition, true)\n ro?.disconnect()\n }\n }, [isOpen, update])\n\n // outside click + keyboard (Escape, arrow roving)\n useEffect(() => {\n if (!isOpen) return\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target as Node\n if (triggerRef.current?.contains(target) || panelRef.current?.contains(target)) return\n close()\n }\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault()\n close()\n triggerRef.current?.focus()\n } else if (event.key === 'Tab') {\n // Tab would move focus by portal DOM order (end of <body>), orphaning the open menu — close it\n // and let focus continue naturally from the trigger (Select/MultiSelect do the same)\n close()\n } else if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault()\n const items = focusableItems(panelRef.current)\n if (!items.length) return\n const current = items.indexOf(document.activeElement as HTMLElement)\n const delta = event.key === 'ArrowDown' ? 1 : -1\n const next = (current + delta + items.length) % items.length\n items[next]?.focus()\n }\n }\n document.addEventListener('pointerdown', onPointerDown, true)\n document.addEventListener('keydown', onKeyDown)\n return () => {\n document.removeEventListener('pointerdown', onPointerDown, true)\n document.removeEventListener('keydown', onKeyDown)\n }\n }, [isOpen, close])\n\n // focus the first item once the menu is open and positioned\n useEffect(() => {\n if (!isOpen) return\n const raf = requestAnimationFrame(() => focusableItems(panelRef.current)[0]?.focus())\n return () => cancelAnimationFrame(raf)\n }, [isOpen])\n\n const triggerProps = trigger.props as {\n onClick?: (event: ReactMouseEvent) => void\n ref?: Ref<HTMLElement>\n }\n const originalRef = triggerProps.ref\n\n const clonedTrigger = cloneElement(trigger as ReactElement<Record<string, unknown>>, {\n ref: (node: HTMLElement | null) => {\n triggerRef.current = node\n if (typeof originalRef === 'function') originalRef(node)\n else if (originalRef) (originalRef as { current: HTMLElement | null }).current = node\n },\n onClick: (event: ReactMouseEvent) => {\n triggerProps.onClick?.(event)\n if (!disabled) setOpen(!isOpen)\n },\n 'aria-haspopup': 'menu',\n 'aria-expanded': isOpen,\n 'aria-controls': isOpen ? menuId : undefined,\n })\n\n const handlePanelClick = (event: ReactMouseEvent) => {\n if (!closeOnSelect) return\n const item = (event.target as HTMLElement).closest(FOCUSABLE)\n if (item && item.getAttribute('aria-disabled') !== 'true') {\n close()\n triggerRef.current?.focus()\n }\n }\n\n return (\n <>\n {clonedTrigger}\n {isOpen &&\n createPortal(\n <div\n ref={panelRef}\n id={menuId}\n className={clsx(styles.panel, minWidth && styles[size], className)}\n data-open={visible ? 'true' : 'false'}\n data-side={pos?.side ?? 'bottom'}\n style={{\n position: 'fixed',\n top: pos?.top ?? 0,\n left: pos?.left ?? 0,\n maxHeight: pos?.maxHeight,\n minWidth: pos?.minWidth,\n visibility: pos ? 'visible' : 'hidden',\n ...style,\n }}\n onClick={handlePanelClick}\n >\n <List role=\"menu\" size={size} padding=\"xs\">\n {children}\n </List>\n </div>,\n document.body,\n )}\n </>\n )\n}\n"],"names":["VIEWPORT_PADDING","FOCUSABLE","focusableItems","panel","el","Dropdown","trigger","children","placement","size","minWidth","open","defaultOpen","onOpenChange","closeOnSelect","matchTriggerWidth","disabled","offset","className","style","menuId","useId","triggerRef","useRef","panelRef","isControlled","internalOpen","setInternalOpen","useState","isOpen","visible","setVisible","pos","setPos","setOpen","useCallback","next","close","useLockBodyScroll","update","triggerEl","rect","panelW","panelH","vw","vh","pad","spaceBelow","spaceAbove","side","maxHeight","usedH","top","left","useLayoutEffect","useEffect","raf","onReposition","ro","onPointerDown","event","target","_a","_b","onKeyDown","items","current","delta","triggerProps","originalRef","clonedTrigger","cloneElement","node","handlePanelClick","item","jsxs","Fragment","createPortal","jsx","clsx","styles","List"],"mappings":";;;;;;;;;;;GAiEMA,KAAmB,GAEnBC,IACJ;AAEF,SAASC,EAAeC,GAA0C;AAChE,SAAKA,IACE,MAAM,KAAKA,EAAM,iBAA8BF,CAAS,CAAC,EAAE;AAAA,IAChE,CAACG,MAAOA,EAAG,aAAa,eAAe,MAAM,UAAUA,EAAG,iBAAiB;AAAA,EAAA,IAF1D,CAAA;AAIrB;AASO,SAASC,GAAS;AAAA,EACvB,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAW;AAAA,EACX,MAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,cAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,mBAAAC,IAAoB;AAAA,EACpB,UAAAC,IAAW;AAAA,EACX,QAAAC,IAAS;AAAA,EACT,WAAAC;AAAA,EACA,OAAAC;AACF,GAAkB;AAChB,QAAMC,IAASC,GAAA,GACTC,IAAaC,EAA2B,IAAI,GAC5CC,IAAWD,EAA8B,IAAI,GAE7CE,IAAed,MAAS,QACxB,CAACe,GAAcC,CAAe,IAAIC,EAAShB,CAAW,GACtDiB,IAASJ,IAAed,IAAOe,GAC/B,CAACI,GAASC,CAAU,I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,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),S=require("react"),N=require("clsx"),c=require("./Icon-B6lz-V0A.cjs"),j=require("./ConfigProvider-
|
|
2
|
-
//# sourceMappingURL=EmptyState-
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),S=require("react"),N=require("clsx"),c=require("./Icon-B6lz-V0A.cjs"),j=require("./ConfigProvider-BaiTKZKC.cjs"),g="_emptyState_1vpxy_3",h="_sm_1vpxy_17",f="_md_1vpxy_23",E="_lg_1vpxy_29",I="_icon_1vpxy_37",q="_title_1vpxy_55",b="_description_1vpxy_61",C="_action_1vpxy_70",O="_pattern_1vpxy_77",T="_tinted_1vpxy_100",t={emptyState:g,sm:h,md:f,lg:E,icon:I,title:q,description:b,action:C,pattern:O,tinted:T},w=new Set(c.ICON_NAMES),z=S.forwardRef(function({icon:n,title:_,description:i,action:r,size:d="md",pattern:p=!0,color:s,className:m,style:l,children:x,...y},u){const v=j.useT(),o=_??v("emptyState.title"),a=n===!1?null:n==null?e.jsx(c.Icon,{name:"FolderOpen"}):typeof n=="string"&&w.has(n)?e.jsx(c.Icon,{name:n}):n;return e.jsxs("div",{ref:u,className:N.clsx(t.emptyState,t[d],p&&t.pattern,s&&t.tinted,m),style:s?{"--tz-btn-rgb":`var(--tz-color-${s}-rgb)`,...l}:l,...y,children:[a!=null&&e.jsx("div",{className:t.icon,"aria-hidden":!0,children:a}),o!=null&&e.jsx("div",{className:t.title,children:o}),i!=null&&e.jsx("div",{className:t.description,children:i}),r!=null&&e.jsx("div",{className:t.action,children:r}),x]})});exports.EmptyState=z;
|
|
2
|
+
//# sourceMappingURL=EmptyState-CX1g47y_.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState-
|
|
1
|
+
{"version":3,"file":"EmptyState-CX1g47y_.cjs","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Tint the icon puck with a theme color (e.g. `error` for a failure). Omitted → the neutral muted puck. */\n color?: ThemeColor\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n size = 'md',\n pattern = true,\n color,\n className,\n style,\n children,\n ...props\n },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(\n styles.emptyState,\n styles[size],\n pattern && styles.pattern,\n color && styles.tinted,\n className,\n )}\n style={\n (color\n ? { '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style }\n : style) as CSSProperties\n }\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","color","className","style","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":"ycASMA,EAAgB,IAAI,IAAYC,YAAU,EA8BnCC,EAAaC,EAAAA,WAA4C,SACpE,CACE,KAAAC,EACA,MAAAC,EACA,YAAAC,EACA,OAAAC,EACA,KAAAC,EAAO,KACP,QAAAC,EAAU,GACV,MAAAC,EACA,UAAAC,EACA,MAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMC,EAAIC,EAAAA,KAAA,EACJC,EAAgBb,GAASW,EAAE,kBAAkB,EAC7CG,EACJf,IAAS,GAAQ,KAAOA,GAAQ,KAC9BgB,MAACC,EAAAA,KAAA,CAAK,KAAK,YAAA,CAAa,EACtB,OAAOjB,GAAS,UAAYJ,EAAc,IAAII,CAAI,EACpDgB,MAACC,EAAAA,KAAA,CAAK,KAAMjB,CAAA,CAAkB,EAE9BA,EAGJ,OACEkB,EAAAA,KAAC,MAAA,CACC,IAAAP,EACA,UAAWQ,EAAAA,KACTC,EAAO,WACPA,EAAOhB,CAAI,EACXC,GAAWe,EAAO,QAClBd,GAASc,EAAO,OAChBb,CAAA,EAEF,MACGD,EACG,CAAE,eAAgB,kBAAkBA,CAAK,QAAS,GAAGE,CAAA,EACrDA,EAEL,GAAGE,EAEH,SAAA,CAAAK,GAAgB,YACd,MAAA,CAAI,UAAWK,EAAO,KAAM,cAAW,GACrC,SAAAL,CAAA,CACH,EAEDD,GAAiB,MAAQE,EAAAA,IAAC,OAAI,UAAWI,EAAO,MAAQ,SAAAN,EAAc,EACtEZ,GAAe,MAAQc,EAAAA,IAAC,OAAI,UAAWI,EAAO,YAAc,SAAAlB,EAAY,EACxEC,GAAU,MAAQa,EAAAA,IAAC,OAAI,UAAWI,EAAO,OAAS,SAAAjB,EAAO,EACzDM,CAAA,CAAA,CAAA,CAGP,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef as S } from "react";
|
|
3
3
|
import { clsx as N } from "clsx";
|
|
4
4
|
import { b as c, a as h } from "./Icon-D5TxgfCc.js";
|
|
5
|
-
import { a as g } from "./ConfigProvider-
|
|
5
|
+
import { a as g } from "./ConfigProvider-D61cpCz-.js";
|
|
6
6
|
const E = "_emptyState_1vpxy_3", b = "_sm_1vpxy_17", I = "_md_1vpxy_23", O = "_lg_1vpxy_29", T = "_icon_1vpxy_37", j = "_title_1vpxy_55", w = "_description_1vpxy_61", z = "_action_1vpxy_70", A = "_pattern_1vpxy_77", C = "_tinted_1vpxy_100", t = {
|
|
7
7
|
emptyState: E,
|
|
8
8
|
sm: b,
|
|
@@ -54,4 +54,4 @@ const E = "_emptyState_1vpxy_3", b = "_sm_1vpxy_17", I = "_md_1vpxy_23", O = "_l
|
|
|
54
54
|
export {
|
|
55
55
|
D as E
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=EmptyState-
|
|
57
|
+
//# sourceMappingURL=EmptyState-Dqtpmtje.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmptyState-
|
|
1
|
+
{"version":3,"file":"EmptyState-Dqtpmtje.js","sources":["../src/components/EmptyState/EmptyState.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type HTMLAttributes, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT, type ThemeColor } from '../../theme'\nimport { Icon } from '../Icon'\nimport { ICON_NAMES, type IconName } from '../../icons/names'\nimport styles from './EmptyState.module.css'\n\nexport type EmptyStateSize = 'sm' | 'md' | 'lg'\n\nconst ICON_NAME_SET = new Set<string>(ICON_NAMES)\n\nexport interface EmptyStateProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'color'> {\n /** Leading glyph shown in a soft circle — an `IconName`, any node, or `false` to hide it. Defaults to `FolderOpen`. */\n icon?: IconName | ReactNode | false\n /** Heading line. Defaults to `\"No Results Found\"`. */\n title?: ReactNode\n /** Muted description under the title (e.g. a hint on what to do next). */\n description?: ReactNode\n /** Action slot under the text — e.g. an \"Add Item\" or \"Clear Filters\" button. */\n action?: ReactNode\n /** Size — scales the icon, text, and vertical padding. Defaults to `md`. */\n size?: EmptyStateSize\n /**\n * Polished \"hero\" look: a faded grid backdrop (fades out toward the edges) + an elevated icon\n * (gradient + drop shadow). Defaults to `true`; pass `pattern={false}` for the flat, compact placeholder.\n */\n pattern?: boolean\n /** Tint the icon puck with a theme color (e.g. `error` for a failure). Omitted → the neutral muted puck. */\n color?: ThemeColor\n /** Extra content rendered below the action. */\n children?: ReactNode\n}\n\n/**\n * The empty-state placeholder — drop it in wherever a page, table, list, or gallery has nothing to\n * show (no records yet, no search matches). A centered, muted glyph in a soft circle + a `title` +\n * an optional `description` and `action` (e.g. a \"Add Item\" / \"Clear Filters\" button). Neutral by\n * design; pass a custom `icon` node for a tinted glyph. Token-only styling.\n */\nexport const EmptyState = forwardRef<HTMLDivElement, EmptyStateProps>(function EmptyState(\n {\n icon,\n title,\n description,\n action,\n size = 'md',\n pattern = true,\n color,\n className,\n style,\n children,\n ...props\n },\n ref,\n) {\n const t = useT()\n const resolvedTitle = title ?? t('emptyState.title')\n const renderedIcon =\n icon === false ? null : icon == null ? (\n <Icon name=\"FolderOpen\" />\n ) : typeof icon === 'string' && ICON_NAME_SET.has(icon) ? (\n <Icon name={icon as IconName} />\n ) : (\n icon\n )\n\n return (\n <div\n ref={ref}\n className={clsx(\n styles.emptyState,\n styles[size],\n pattern && styles.pattern,\n color && styles.tinted,\n className,\n )}\n style={\n (color\n ? { '--tz-btn-rgb': `var(--tz-color-${color}-rgb)`, ...style }\n : style) as CSSProperties\n }\n {...props}\n >\n {renderedIcon != null && (\n <div className={styles.icon} aria-hidden>\n {renderedIcon}\n </div>\n )}\n {resolvedTitle != null && <div className={styles.title}>{resolvedTitle}</div>}\n {description != null && <div className={styles.description}>{description}</div>}\n {action != null && <div className={styles.action}>{action}</div>}\n {children}\n </div>\n )\n})\n"],"names":["ICON_NAME_SET","ICON_NAMES","EmptyState","forwardRef","icon","title","description","action","size","pattern","color","className","style","children","props","ref","t","useT","resolvedTitle","renderedIcon","jsx","Icon","jsxs","clsx","styles"],"mappings":";;;;;;;;;;;;;;;;GASMA,IAAgB,IAAI,IAAYC,CAAU,GA8BnCC,IAAaC,EAA4C,SACpE;AAAA,EACE,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAAAC,IAAU;AAAA,EACV,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,GAAGC;AACL,GACAC,GACA;AACA,QAAMC,IAAIC,EAAA,GACJC,IAAgBb,KAASW,EAAE,kBAAkB,GAC7CG,IACJf,MAAS,KAAQ,OAAOA,KAAQ,OAC9B,gBAAAgB,EAACC,GAAA,EAAK,MAAK,aAAA,CAAa,IACtB,OAAOjB,KAAS,YAAYJ,EAAc,IAAII,CAAI,IACpD,gBAAAgB,EAACC,GAAA,EAAK,MAAMjB,EAAA,CAAkB,IAE9BA;AAGJ,SACE,gBAAAkB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAP;AAAA,MACA,WAAWQ;AAAA,QACTC,EAAO;AAAA,QACPA,EAAOhB,CAAI;AAAA,QACXC,KAAWe,EAAO;AAAA,QAClBd,KAASc,EAAO;AAAA,QAChBb;AAAA,MAAA;AAAA,MAEF,OACGD,IACG,EAAE,gBAAgB,kBAAkBA,CAAK,SAAS,GAAGE,EAAA,IACrDA;AAAA,MAEL,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAK,KAAgB,0BACd,OAAA,EAAI,WAAWK,EAAO,MAAM,eAAW,IACrC,UAAAL,EAAA,CACH;AAAA,QAEDD,KAAiB,QAAQ,gBAAAE,EAAC,SAAI,WAAWI,EAAO,OAAQ,UAAAN,GAAc;AAAA,QACtEZ,KAAe,QAAQ,gBAAAc,EAAC,SAAI,WAAWI,EAAO,aAAc,UAAAlB,GAAY;AAAA,QACxEC,KAAU,QAAQ,gBAAAa,EAAC,SAAI,WAAWI,EAAO,QAAS,UAAAjB,GAAO;AAAA,QACzDM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const n=require("react/jsx-runtime"),c=require("react"),u=require("./ErrorState-
|
|
2
|
-
//# sourceMappingURL=ErrorBoundary-
|
|
1
|
+
"use strict";const n=require("react/jsx-runtime"),c=require("react"),u=require("./ErrorState-CwCqd2PU.cjs"),h=require("./ConfigProvider-BaiTKZKC.cjs"),l=c.forwardRef(function({error:r,fallback:t,description:s,compact:o=!0,...a},p){return r==null||r===!1?null:n.jsx(u.ErrorState,{ref:p,error:r,description:s??t,compact:o,...a})}),d=(e=[],r=[])=>e.length!==r.length||e.some((t,s)=>!Object.is(t,r[s])),i=e=>e instanceof Error?e:new Error(String(e));function f({error:e,reset:r}){const t=h.useT();return n.jsx(u.ErrorState,{variant:"block",error:e,description:t("errorState.description"),onRetry:r})}class E extends c.Component{constructor(){super(...arguments),this.state={error:null},this.reset=()=>{var r,t;this.setState({error:null}),(t=(r=this.props).onReset)==null||t.call(r)}}static getDerivedStateFromError(r){return{error:i(r)}}componentDidCatch(r,t){var s,o;(o=(s=this.props).onError)==null||o.call(s,i(r),t)}componentDidUpdate(r,t){this.state.error&&t.error&&d(r.resetKeys,this.props.resetKeys)&&this.reset()}render(){const{error:r}=this.state;if(!r)return this.props.children;const{fallback:t}=this.props;return typeof t=="function"?t(r,this.reset):t!==void 0?t:n.jsx(f,{error:r,reset:this.reset})}}exports.ErrorBoundary=E;exports.QueryError=l;
|
|
2
|
+
//# sourceMappingURL=ErrorBoundary-B8KwWXXp.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary-
|
|
1
|
+
{"version":3,"file":"ErrorBoundary-B8KwWXXp.cjs","sources":["../src/components/ErrorState/QueryError.tsx","../src/components/ErrorState/ErrorBoundary.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react'\nimport { ErrorState, type ErrorStateProps } from './ErrorState'\n\nexport interface QueryErrorProps extends ErrorStateProps {\n /** The query's error (`query.error`). `null` / `undefined` → renders nothing. */\n error: unknown\n /**\n * The user-facing sentence (\"Could not load players.\"). Shown instead of the raw message, which then\n * only appears in the Details dialog's dev dump. Same as `description`, which wins when both are set.\n */\n fallback?: ReactNode\n}\n\n/**\n * The react-query-style one-liner: `<QueryError error={users.error} onRetry={users.refetch}\n * fallback=\"Could not load players.\" />`. Renders nothing while `error` is empty, otherwise an\n * `ErrorState` — an alert banner by default; with `variant=\"block\"` it's **compact by default** (pass\n * `compact={false}` for the hero). Everything else passes through to `ErrorState`.\n */\nexport const QueryError = forwardRef<HTMLDivElement, QueryErrorProps>(function QueryError(\n { error, fallback, description, compact = true, ...props },\n ref,\n) {\n if (error == null || error === false) return null\n return (\n <ErrorState\n ref={ref}\n error={error}\n description={description ?? fallback}\n compact={compact}\n {...props}\n />\n )\n})\n","import { Component, type ErrorInfo, type ReactNode } from 'react'\nimport { useT } from '../../theme'\nimport { ErrorState } from './ErrorState'\n\nexport interface ErrorBoundaryProps {\n /**\n * What to render after a crash — a node, or `(error, reset) => node`. Defaults to an `ErrorState` with\n * a friendly description, a **Try Again** button (`reset`) and the stack in dev.\n */\n fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode)\n /** Report the crash (e.g. `Sentry.captureException`). */\n onError?: (error: Error, info: ErrorInfo) => void\n /** Called after the boundary resets (Try Again, or a `resetKeys` change). */\n onReset?: () => void\n /** Reset automatically when any of these change (shallow) — e.g. `[location.pathname]` clears on navigation. */\n resetKeys?: unknown[]\n children?: ReactNode\n}\n\ninterface ErrorBoundaryState {\n error: Error | null\n}\n\nconst keysChanged = (a: unknown[] = [], b: unknown[] = []) =>\n a.length !== b.length || a.some((v, i) => !Object.is(v, b[i]))\n\nconst toError = (value: unknown) => (value instanceof Error ? value : new Error(String(value)))\n\n/** The default crash screen — a function component so it can read the localized strings. */\nfunction DefaultFallback({ error, reset }: { error: Error; reset: () => void }) {\n const t = useT()\n // a render crash message (\"Cannot read properties of undefined\") is for developers, not users —\n // the description stays friendly and the raw error lives in the dev-only details panel\n return (\n <ErrorState\n variant=\"block\"\n error={error}\n description={t('errorState.description')}\n onRetry={reset}\n />\n )\n}\n\n/**\n * Catches render errors in its subtree and shows a fallback instead of unmounting the whole app (a\n * white screen). The one class component in the library — React only offers error boundaries as\n * classes. `fallback` is a node or `(error, reset) => node` (default: an `ErrorState` with Try Again);\n * `onError` reports the crash (Sentry); `resetKeys` resets it when they change (e.g. the route path, so\n * navigating away recovers); `onReset` runs after any reset. `AdminRoot` mounts one around the page\n * content automatically, so a crashing page keeps the sidebar + header.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = { error: null }\n\n static getDerivedStateFromError(error: unknown): ErrorBoundaryState {\n return { error: toError(error) }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo) {\n this.props.onError?.(toError(error), info)\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n // reset only an error that was ALREADY showing before the keys changed — if the key change itself is\n // what crashed the subtree (same render), resetting would just re-render it into a second throw\n if (this.state.error && prevState.error && keysChanged(prev.resetKeys, this.props.resetKeys)) {\n this.reset()\n }\n }\n\n reset = () => {\n this.setState({ error: null })\n this.props.onReset?.()\n }\n\n render() {\n const { error } = this.state\n if (!error) return this.props.children\n const { fallback } = this.props\n if (typeof fallback === 'function') return fallback(error, this.reset)\n if (fallback !== undefined) return fallback\n return <DefaultFallback error={error} reset={this.reset} />\n }\n}\n"],"names":["QueryError","forwardRef","error","fallback","description","compact","props","ref","jsx","ErrorState","keysChanged","a","b","v","i","toError","value","DefaultFallback","reset","useT","ErrorBoundary","Component","_b","_a","info","prev","prevState"],"mappings":"uJAmBaA,EAAaC,EAAAA,WAA4C,SACpE,CAAE,MAAAC,EAAO,SAAAC,EAAU,YAAAC,EAAa,QAAAC,EAAU,GAAM,GAAGC,CAAA,EACnDC,EACA,CACA,OAAIL,GAAS,MAAQA,IAAU,GAAc,KAE3CM,EAAAA,IAACC,EAAAA,WAAA,CACC,IAAAF,EACA,MAAAL,EACA,YAAaE,GAAeD,EAC5B,QAAAE,EACC,GAAGC,CAAA,CAAA,CAGV,CAAC,ECVKI,EAAc,CAACC,EAAe,CAAA,EAAIC,EAAe,CAAA,IACrDD,EAAE,SAAWC,EAAE,QAAUD,EAAE,KAAK,CAACE,EAAGC,IAAM,CAAC,OAAO,GAAGD,EAAGD,EAAEE,CAAC,CAAC,CAAC,EAEzDC,EAAWC,GAAoBA,aAAiB,MAAQA,EAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC,EAG7F,SAASC,EAAgB,CAAE,MAAAf,EAAO,MAAAgB,GAA8C,CAC9E,MAAM,EAAIC,EAAAA,KAAA,EAGV,OACEX,EAAAA,IAACC,EAAAA,WAAA,CACC,QAAQ,QACR,MAAAP,EACA,YAAa,EAAE,wBAAwB,EACvC,QAASgB,CAAA,CAAA,CAGf,CAUO,MAAME,UAAsBC,EAAAA,SAAkD,CAA9E,aAAA,CAAA,MAAA,GAAA,SAAA,EACL,KAAA,MAA4B,CAAE,MAAO,IAAA,EAkBrC,KAAA,MAAQ,IAAM,SACZ,KAAK,SAAS,CAAE,MAAO,IAAA,CAAM,GAC7BC,GAAAC,EAAA,KAAK,OAAM,UAAX,MAAAD,EAAA,KAAAC,EACF,CAAA,CAnBA,OAAO,yBAAyBrB,EAAoC,CAClE,MAAO,CAAE,MAAOa,EAAQb,CAAK,CAAA,CAC/B,CAEA,kBAAkBA,EAAgBsB,EAAiB,UACjDF,GAAAC,EAAA,KAAK,OAAM,UAAX,MAAAD,EAAA,KAAAC,EAAqBR,EAAQb,CAAK,EAAGsB,EACvC,CAEA,mBAAmBC,EAA0BC,EAA+B,CAGtE,KAAK,MAAM,OAASA,EAAU,OAAShB,EAAYe,EAAK,UAAW,KAAK,MAAM,SAAS,GACzF,KAAK,MAAA,CAET,CAOA,QAAS,CACP,KAAM,CAAE,MAAAvB,GAAU,KAAK,MACvB,GAAI,CAACA,EAAO,OAAO,KAAK,MAAM,SAC9B,KAAM,CAAE,SAAAC,GAAa,KAAK,MAC1B,OAAI,OAAOA,GAAa,WAAmBA,EAASD,EAAO,KAAK,KAAK,EACjEC,IAAa,OAAkBA,EAC5BK,EAAAA,IAACS,EAAA,CAAgB,MAAAf,EAAc,MAAO,KAAK,MAAO,CAC3D,CACF"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as u, Component as f } from "react";
|
|
3
|
-
import { E as a } from "./ErrorState-
|
|
4
|
-
import { a as h } from "./ConfigProvider-
|
|
3
|
+
import { E as a } from "./ErrorState-KhzrGIJ-.js";
|
|
4
|
+
import { a as h } from "./ConfigProvider-D61cpCz-.js";
|
|
5
5
|
const S = u(function({ error: r, fallback: t, description: o, compact: s = !0, ...c }, p) {
|
|
6
6
|
return r == null || r === !1 ? null : /* @__PURE__ */ n(
|
|
7
7
|
a,
|
|
@@ -54,4 +54,4 @@ export {
|
|
|
54
54
|
k as E,
|
|
55
55
|
S as Q
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=ErrorBoundary-
|
|
57
|
+
//# sourceMappingURL=ErrorBoundary-Dos7VLb-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorBoundary-
|
|
1
|
+
{"version":3,"file":"ErrorBoundary-Dos7VLb-.js","sources":["../src/components/ErrorState/QueryError.tsx","../src/components/ErrorState/ErrorBoundary.tsx"],"sourcesContent":["import { forwardRef, type ReactNode } from 'react'\nimport { ErrorState, type ErrorStateProps } from './ErrorState'\n\nexport interface QueryErrorProps extends ErrorStateProps {\n /** The query's error (`query.error`). `null` / `undefined` → renders nothing. */\n error: unknown\n /**\n * The user-facing sentence (\"Could not load players.\"). Shown instead of the raw message, which then\n * only appears in the Details dialog's dev dump. Same as `description`, which wins when both are set.\n */\n fallback?: ReactNode\n}\n\n/**\n * The react-query-style one-liner: `<QueryError error={users.error} onRetry={users.refetch}\n * fallback=\"Could not load players.\" />`. Renders nothing while `error` is empty, otherwise an\n * `ErrorState` — an alert banner by default; with `variant=\"block\"` it's **compact by default** (pass\n * `compact={false}` for the hero). Everything else passes through to `ErrorState`.\n */\nexport const QueryError = forwardRef<HTMLDivElement, QueryErrorProps>(function QueryError(\n { error, fallback, description, compact = true, ...props },\n ref,\n) {\n if (error == null || error === false) return null\n return (\n <ErrorState\n ref={ref}\n error={error}\n description={description ?? fallback}\n compact={compact}\n {...props}\n />\n )\n})\n","import { Component, type ErrorInfo, type ReactNode } from 'react'\nimport { useT } from '../../theme'\nimport { ErrorState } from './ErrorState'\n\nexport interface ErrorBoundaryProps {\n /**\n * What to render after a crash — a node, or `(error, reset) => node`. Defaults to an `ErrorState` with\n * a friendly description, a **Try Again** button (`reset`) and the stack in dev.\n */\n fallback?: ReactNode | ((error: Error, reset: () => void) => ReactNode)\n /** Report the crash (e.g. `Sentry.captureException`). */\n onError?: (error: Error, info: ErrorInfo) => void\n /** Called after the boundary resets (Try Again, or a `resetKeys` change). */\n onReset?: () => void\n /** Reset automatically when any of these change (shallow) — e.g. `[location.pathname]` clears on navigation. */\n resetKeys?: unknown[]\n children?: ReactNode\n}\n\ninterface ErrorBoundaryState {\n error: Error | null\n}\n\nconst keysChanged = (a: unknown[] = [], b: unknown[] = []) =>\n a.length !== b.length || a.some((v, i) => !Object.is(v, b[i]))\n\nconst toError = (value: unknown) => (value instanceof Error ? value : new Error(String(value)))\n\n/** The default crash screen — a function component so it can read the localized strings. */\nfunction DefaultFallback({ error, reset }: { error: Error; reset: () => void }) {\n const t = useT()\n // a render crash message (\"Cannot read properties of undefined\") is for developers, not users —\n // the description stays friendly and the raw error lives in the dev-only details panel\n return (\n <ErrorState\n variant=\"block\"\n error={error}\n description={t('errorState.description')}\n onRetry={reset}\n />\n )\n}\n\n/**\n * Catches render errors in its subtree and shows a fallback instead of unmounting the whole app (a\n * white screen). The one class component in the library — React only offers error boundaries as\n * classes. `fallback` is a node or `(error, reset) => node` (default: an `ErrorState` with Try Again);\n * `onError` reports the crash (Sentry); `resetKeys` resets it when they change (e.g. the route path, so\n * navigating away recovers); `onReset` runs after any reset. `AdminRoot` mounts one around the page\n * content automatically, so a crashing page keeps the sidebar + header.\n */\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state: ErrorBoundaryState = { error: null }\n\n static getDerivedStateFromError(error: unknown): ErrorBoundaryState {\n return { error: toError(error) }\n }\n\n componentDidCatch(error: unknown, info: ErrorInfo) {\n this.props.onError?.(toError(error), info)\n }\n\n componentDidUpdate(prev: ErrorBoundaryProps, prevState: ErrorBoundaryState) {\n // reset only an error that was ALREADY showing before the keys changed — if the key change itself is\n // what crashed the subtree (same render), resetting would just re-render it into a second throw\n if (this.state.error && prevState.error && keysChanged(prev.resetKeys, this.props.resetKeys)) {\n this.reset()\n }\n }\n\n reset = () => {\n this.setState({ error: null })\n this.props.onReset?.()\n }\n\n render() {\n const { error } = this.state\n if (!error) return this.props.children\n const { fallback } = this.props\n if (typeof fallback === 'function') return fallback(error, this.reset)\n if (fallback !== undefined) return fallback\n return <DefaultFallback error={error} reset={this.reset} />\n }\n}\n"],"names":["QueryError","forwardRef","error","fallback","description","compact","props","ref","jsx","ErrorState","keysChanged","a","b","v","i","toError","value","DefaultFallback","reset","useT","ErrorBoundary","Component","_b","_a","info","prev","prevState"],"mappings":";;;;AAmBO,MAAMA,IAAaC,EAA4C,SACpE,EAAE,OAAAC,GAAO,UAAAC,GAAU,aAAAC,GAAa,SAAAC,IAAU,IAAM,GAAGC,EAAA,GACnDC,GACA;AACA,SAAIL,KAAS,QAAQA,MAAU,KAAc,OAE3C,gBAAAM;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,OAAAL;AAAA,MACA,aAAaE,KAAeD;AAAA,MAC5B,SAAAE;AAAA,MACC,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC,GCVKI,IAAc,CAACC,IAAe,CAAA,GAAIC,IAAe,CAAA,MACrDD,EAAE,WAAWC,EAAE,UAAUD,EAAE,KAAK,CAACE,GAAGC,MAAM,CAAC,OAAO,GAAGD,GAAGD,EAAEE,CAAC,CAAC,CAAC,GAEzDC,IAAU,CAACC,MAAoBA,aAAiB,QAAQA,IAAQ,IAAI,MAAM,OAAOA,CAAK,CAAC;AAG7F,SAASC,EAAgB,EAAE,OAAAf,GAAO,OAAAgB,KAA8C;AAC9E,QAAM,IAAIC,EAAA;AAGV,SACE,gBAAAX;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAQ;AAAA,MACR,OAAAP;AAAA,MACA,aAAa,EAAE,wBAAwB;AAAA,MACvC,SAASgB;AAAA,IAAA;AAAA,EAAA;AAGf;AAUO,MAAME,UAAsBC,EAAkD;AAAA,EAA9E,cAAA;AAAA,UAAA,GAAA,SAAA,GACL,KAAA,QAA4B,EAAE,OAAO,KAAA,GAkBrC,KAAA,QAAQ,MAAM;;AACZ,WAAK,SAAS,EAAE,OAAO,KAAA,CAAM,IAC7BC,KAAAC,IAAA,KAAK,OAAM,YAAX,QAAAD,EAAA,KAAAC;AAAA,IACF;AAAA,EAAA;AAAA,EAnBA,OAAO,yBAAyBrB,GAAoC;AAClE,WAAO,EAAE,OAAOa,EAAQb,CAAK,EAAA;AAAA,EAC/B;AAAA,EAEA,kBAAkBA,GAAgBsB,GAAiB;;AACjD,KAAAF,KAAAC,IAAA,KAAK,OAAM,YAAX,QAAAD,EAAA,KAAAC,GAAqBR,EAAQb,CAAK,GAAGsB;AAAA,EACvC;AAAA,EAEA,mBAAmBC,GAA0BC,GAA+B;AAG1E,IAAI,KAAK,MAAM,SAASA,EAAU,SAAShB,EAAYe,EAAK,WAAW,KAAK,MAAM,SAAS,KACzF,KAAK,MAAA;AAAA,EAET;AAAA,EAOA,SAAS;AACP,UAAM,EAAE,OAAAvB,MAAU,KAAK;AACvB,QAAI,CAACA,EAAO,QAAO,KAAK,MAAM;AAC9B,UAAM,EAAE,UAAAC,MAAa,KAAK;AAC1B,WAAI,OAAOA,KAAa,aAAmBA,EAASD,GAAO,KAAK,KAAK,IACjEC,MAAa,SAAkBA,IAC5B,gBAAAK,EAACS,GAAA,EAAgB,OAAAf,GAAc,OAAO,KAAK,OAAO;AAAA,EAC3D;AACF;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const r=require("react/jsx-runtime"),V=require("react"),b=require("clsx"),Q=require("./Alert-
|
|
1
|
+
"use strict";const r=require("react/jsx-runtime"),V=require("react"),b=require("clsx"),Q=require("./Alert-C8BBxL_7.cjs"),d=require("./Button-CwrDiZek.cjs"),U=require("./EmptyState-CX1g47y_.cjs"),_=require("./Icon-B6lz-V0A.cjs"),W=require("./IconButton-CxSXEYce.cjs"),X=require("./Tooltip-DmMq5R1x.cjs"),n=require("./errorMessage-C7N4KvUS.cjs"),Y=require("./useClipboard-BjTIX-4g.cjs"),Z=require("./Modal-D9_OG53G.cjs"),w=require("./ConfigProvider-BaiTKZKC.cjs"),P="_errorState_o523f_4",L="_actions_o523f_9",rr="_fieldErrors_o523f_18",er="_field_o523f_18",tr="_compact_o523f_32",or="_pre_o523f_37",sr="_alertVariant_o523f_53",nr="_alertTitle_o523f_56",lr="_alertBody_o523f_60",ar="_alertActions_o523f_65",t={errorState:P,actions:L,fieldErrors:rr,field:er,compact:tr,pre:or,alertVariant:sr,alertTitle:nr,alertBody:lr,alertActions:ar};function cr({open:I,onClose:o,report:u}){const s=w.useT(),{copy:h,copied:a}=Y.useClipboard();return r.jsx(Z.Modal,{open:I,onClose:o,title:s("errorState.detailsTitle"),icon:"Danger",color:"error",size:"lg",scrollBehavior:"inside",footer:r.jsxs(r.Fragment,{children:[r.jsx(d.Button,{variant:"text",color:"primary",onClick:o,children:s("common.close")}),r.jsx(d.Button,{startIcon:r.jsx(_.Icon,{name:a?"CopySuccess":"Copy"}),onClick:()=>void h(u),children:s(a?"clipboard.copied":"clipboard.copy")})]}),children:r.jsx("pre",{className:t.pre,children:u})})}const ir=V.forwardRef(function({error:o,variant:u="alert",title:s,description:h,icon:a,onRetry:c,retrying:m=!1,retryLabel:x,showDetails:C="dev",compact:S=!1,traceId:y,fieldErrors:T,fieldLabels:v,size:R,pattern:G,action:p,className:N,children:k,...A},z){const e=w.useT(),[H,E]=V.useState(!1),f=n.getErrorMessage(o,l=>e("errorState.requestFailed",{status:l})),g=y===!1?void 0:y??n.getErrorTraceId(o),B=T===!1?void 0:T??n.getErrorFieldErrors(o),J=B&&Object.keys(B).length>0?r.jsx("ul",{className:t.fieldErrors,children:Object.entries(B).map(([l,K])=>r.jsxs("li",{children:[r.jsx("span",{className:t.field,children:(v==null?void 0:v[l])??n.humanizeField(l)})," —"," ",K]},l))}):void 0,q=h??J??f??e("errorState.description"),$=a===void 0?n.isNetworkError(o)?"CloudCross":"Danger":a,j=(C==="dev"?n.isDev():C)?n.getErrorDetails(o):void 0,D=n.getErrorStatus(o),i=g!=null||j!=null?[g!=null&&`${e("errorState.traceId")}: ${g}`,D!=null&&`${e("errorState.status")}: ${D}`,f!=null&&(q===f||j!=null)&&`${e("errorState.message")}: ${f}`,j!=null&&`
|
|
2
2
|
${j}`].filter(Boolean).join(`
|
|
3
3
|
`):void 0,F=i!=null?r.jsx(cr,{open:H,onClose:()=>E(!1),report:i}):null;if(u==="alert"){const l=i!=null||c!=null||p!=null?r.jsxs("span",{className:t.alertActions,children:[c!=null&&r.jsx(X.Tooltip,{content:x??e("errorState.retry"),children:r.jsx(W.IconButton,{size:"sm",variant:"text",color:"error","aria-label":typeof x=="string"?x:e("errorState.retry"),loading:m,disabled:m,onClick:c,children:r.jsx(_.Icon,{name:"RefreshArrow2"})})}),i!=null&&r.jsx(d.Button,{size:"sm",variant:"filled",color:"error",onClick:()=>E(!0),children:e("errorState.details")}),p]}):void 0;return r.jsxs(r.Fragment,{children:[r.jsxs(Q.Alert,{ref:z,color:"error",icon:$,action:l,className:b.clsx(t.alertVariant,N),...A,children:[s!=null&&r.jsx("span",{className:t.alertTitle,children:s}),r.jsx("span",{className:t.alertBody,children:q}),k]}),F]})}const M=c!=null?r.jsx(d.Button,{size:"sm",variant:"outlined",color:"primary",startIcon:r.jsx(_.Icon,{name:"RefreshRight"}),loading:m,disabled:m,onClick:c,children:x??e("errorState.retry")}):null,O=i!=null?r.jsx(d.Button,{size:"sm",variant:"text",color:"primary",startIcon:r.jsx(_.Icon,{name:"DocumentText"}),onClick:()=>E(!0),children:e("errorState.details")}):null;return r.jsxs(r.Fragment,{children:[r.jsx(U.EmptyState,{ref:z,role:"alert",color:"error",icon:$,title:s??e("errorState.title"),description:q,size:R??(S?"sm":"md"),pattern:G??!S,action:M||O||p?r.jsxs("span",{className:t.actions,children:[M,O,p]}):void 0,className:b.clsx(t.errorState,S&&t.compact,N),...A,children:k}),F]})});exports.ErrorState=ir;
|
|
4
|
-
//# sourceMappingURL=ErrorState-
|
|
4
|
+
//# sourceMappingURL=ErrorState-CwCqd2PU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorState-MQBeyF2n.cjs","sources":["../src/components/ErrorState/ErrorDetailsModal.tsx","../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import { useT } from '../../theme'\nimport { useClipboard } from '../../hooks/useClipboard'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { Modal } from '../Modal'\nimport styles from './ErrorState.module.css'\n\nexport interface ErrorDetailsModalProps {\n open: boolean\n onClose: () => void\n /** The whole report — shown as-is and copied by the Copy button. */\n report: string\n}\n\n/**\n * Internal to `ErrorState`: the \"Details\" dialog — the error report (trace id, status, message, then the stack /\n * raw dump when allowed) in one monospace block, with **Copy** (the whole report, flips to \"Copied!\") and\n * **Close** in the footer, so a user can paste it into a support ticket in one go.\n */\nexport function ErrorDetailsModal({ open, onClose, report }: ErrorDetailsModalProps) {\n const t = useT()\n const { copy, copied } = useClipboard()\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={t('errorState.detailsTitle')}\n icon=\"Danger\"\n color=\"error\"\n size=\"lg\"\n scrollBehavior=\"inside\"\n footer={\n <>\n <Button variant=\"text\" color=\"primary\" onClick={onClose}>\n {t('common.close')}\n </Button>\n <Button\n startIcon={<Icon name={copied ? 'CopySuccess' : 'Copy'} />}\n onClick={() => void copy(report)}\n >\n {copied ? t('clipboard.copied') : t('clipboard.copy')}\n </Button>\n </>\n }\n >\n <pre className={styles.pre}>{report}</pre>\n </Modal>\n )\n}\n","import { forwardRef, useState, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Alert } from '../Alert'\nimport { Button } from '../Button'\nimport { EmptyState, type EmptyStateProps } from '../EmptyState'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport type { IconName } from '../../icons/names'\nimport {\n getErrorDetails,\n getErrorFieldErrors,\n getErrorMessage,\n getErrorStatus,\n getErrorTraceId,\n humanizeField,\n isNetworkError,\n isDev,\n} from './errorMessage'\nimport { ErrorDetailsModal } from './ErrorDetailsModal'\nimport styles from './ErrorState.module.css'\n\nexport type ErrorStateVariant = 'block' | 'alert'\n\nexport interface ErrorStateProps extends Omit<EmptyStateProps, 'icon' | 'title' | 'color'> {\n /**\n * The shape. `'alert'` (default) — a red `Alert` banner: the message (no default title), then Try Again /\n * Details / `action` in the alert's action slot; it fits anywhere — above a form, in a modal, in a card.\n * `'block'` — the `EmptyState`-style block (puck, title, centred message, the buttons below), for an area\n * whose data failed to load, or a whole page (`PageError`). `compact` and `pattern` apply to `'block'` only.\n */\n variant?: ErrorStateVariant\n /**\n * What failed — an `Error`, a string, an axios-style error, a `{ message }` or a raw `{ status }`\n * response. Its message becomes the description (unless `description` is given) and its stack feeds\n * the details panel.\n */\n error?: unknown\n /**\n * Heading. Alert: none unless given — the message is the point. Block: defaults to the localized \"Something\n * Went Wrong\".\n */\n title?: ReactNode\n /**\n * Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in both variants (the alert\n * replaces the Alert's own × icon), or `CloudCross` when the request never got a response (an explicit\n * `status: 0` / network error code), tinted `error`.\n */\n icon?: IconName | ReactNode | false\n /** Adds a \"Try Again\" button that calls this (e.g. a query's `refetch`). */\n onRetry?: () => void\n /**\n * The retry is running (e.g. `query.isFetching`) — the \"Try Again\" button shows its loader and is disabled,\n * so a slow refetch doesn't look like a dead click. Defaults to `false`.\n */\n retrying?: boolean\n /** Retry button label. Defaults to the localized \"Try Again\". */\n retryLabel?: ReactNode\n /**\n * Include the technical dump (the stack, or the raw error as JSON) in the **Details** dialog. `'dev'`\n * (default) only in development builds; `true` always; `false` never. The Details button itself shows\n * whenever there's a trace id or this dump — never inline on the page.\n */\n showDetails?: boolean | 'dev'\n /** The inline variant — small, no hero pattern — for inside a table, card or panel. Defaults to `false`. */\n compact?: boolean\n /**\n * The server's trace id — it matches a report to the server log. It isn't shown on the page: it leads the\n * **Details** dialog (with a copy button), and its presence alone shows the Details button, production\n * included. Defaults to the one on `error` (`error.traceId` / `error.response.data.traceId`); `false` hides it.\n */\n traceId?: string | false\n /**\n * Per-field validation messages (`{ field: message }`), listed as the description when there's no explicit\n * `description`. Defaults to the ones on `error` (`getErrorFieldErrors`: `error.fieldErrors` — an object, a\n * method or a `{ field, message }[]` —, `error.details`, `error.response.data.errors`); `false` hides them. In a form, put them on the inputs instead.\n */\n fieldErrors?: Record<string, string> | false\n /**\n * Labels for the field-error keys (`{ newPassword: 'New Password' }`). A key without one is shown humanized\n * and Title Cased (`newPassword` / `new_password` → \"New Password\"; a dotted path keeps its last segment).\n */\n fieldLabels?: Record<string, ReactNode>\n}\n\n/**\n * The \"it broke\" counterpart of `EmptyState`. By default (`variant=\"alert\"`) a red `Alert` banner with a `Danger`\n * icon: the failure's own message (extracted from an `Error`, a string, an axios-style `response.data.message`, a\n * `{ message }`, or a raw `{ status }` → \"Request failed (404)\"), or a 400's per-field `fieldErrors` list; then\n * **Try Again** (`onRetry`, spinning while `retrying`) and **Details** in its action slot. `variant=\"block\"` is the\n * `EmptyState`-style block (an `error`-tinted puck, a \"Something Went Wrong\" title, the same buttons below);\n * `compact` is its inline size. **Details** opens a dialog with the full report — the server's `traceId`, the\n * status, the message, and the stack in development (`showDetails`) — in one block with a copy button. Announced\n * once (`role=\"alert\"`). `forwardRef` to the root; any other `EmptyState` prop passes through to the block.\n */\nexport const ErrorState = forwardRef<HTMLDivElement, ErrorStateProps>(function ErrorState(\n {\n error,\n variant = 'alert',\n title,\n description,\n icon,\n onRetry,\n retrying = false,\n retryLabel,\n showDetails = 'dev',\n compact = false,\n traceId: traceIdProp,\n fieldErrors: fieldErrorsProp,\n fieldLabels,\n size,\n pattern,\n action,\n className,\n children,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [detailsOpen, setDetailsOpen] = useState(false)\n const message = getErrorMessage(error, (status) => t('errorState.requestFailed', { status }))\n const traceId = traceIdProp === false ? undefined : (traceIdProp ?? getErrorTraceId(error))\n const fieldErrors =\n fieldErrorsProp === false ? undefined : (fieldErrorsProp ?? getErrorFieldErrors(error))\n const fieldErrorList =\n fieldErrors && Object.keys(fieldErrors).length > 0 ? (\n <ul className={styles.fieldErrors}>\n {Object.entries(fieldErrors).map(([field, msg]) => (\n <li key={field}>\n <span className={styles.field}>{fieldLabels?.[field] ?? humanizeField(field)}</span> —{' '}\n {msg}\n </li>\n ))}\n </ul>\n ) : undefined\n const body = description ?? fieldErrorList ?? message ?? t('errorState.description')\n const resolvedIcon = icon === undefined ? (isNetworkError(error) ? 'CloudCross' : 'Danger') : icon\n\n // the \"Details\" report — trace id, status, message, then the stack / raw dump (dev only by default). The\n // button shows when there's something worth opening: a trace id (always — it's what support asks for) or\n // the technical dump.\n const technical = (showDetails === 'dev' ? isDev() : showDetails)\n ? getErrorDetails(error)\n : undefined\n const status = getErrorStatus(error)\n const report =\n traceId != null || technical != null\n ? [\n traceId != null && `${t('errorState.traceId')}: ${traceId}`,\n status != null && `${t('errorState.status')}: ${status}`,\n // the raw message only where it's already visible, or with the dev dump — a `description` /\n // `fallback` (or PageError) hides it on purpose\n message != null &&\n (body === message || technical != null) &&\n `${t('errorState.message')}: ${message}`,\n technical != null && `\\n${technical}`,\n ]\n .filter(Boolean)\n .join('\\n')\n : undefined\n const detailsModal =\n report != null ? (\n <ErrorDetailsModal open={detailsOpen} onClose={() => setDetailsOpen(false)} report={report} />\n ) : null\n\n // ── alert (default): a banner — the message, then Try Again / Details / action in the action slot ──\n if (variant === 'alert') {\n const alertActions =\n report != null || onRetry != null || action != null ? (\n <span className={styles.alertActions}>\n {/* an icon-only retry (tooltip + aria-label) keeps the slot narrow, so the message keeps its room on\n small screens */}\n {onRetry != null && (\n <Tooltip content={retryLabel ?? t('errorState.retry')}>\n <IconButton\n size=\"sm\"\n variant=\"text\"\n color=\"error\"\n aria-label={typeof retryLabel === 'string' ? retryLabel : t('errorState.retry')}\n loading={retrying}\n disabled={retrying}\n onClick={onRetry}\n >\n <Icon name=\"RefreshArrow2\" />\n </IconButton>\n </Tooltip>\n )}\n {report != null && (\n <Button size=\"sm\" variant=\"filled\" color=\"error\" onClick={() => setDetailsOpen(true)}>\n {t('errorState.details')}\n </Button>\n )}\n {action}\n </span>\n ) : undefined\n return (\n <>\n <Alert\n ref={ref}\n color=\"error\"\n icon={resolvedIcon}\n action={alertActions}\n className={clsx(styles.alertVariant, className)}\n {...props}\n >\n {title != null && <span className={styles.alertTitle}>{title}</span>}\n <span className={styles.alertBody}>{body}</span>\n {children}\n </Alert>\n {detailsModal}\n </>\n )\n }\n\n // ── block: the EmptyState-style hero / compact block ──\n const retry =\n onRetry != null ? (\n <Button\n size=\"sm\"\n variant=\"outlined\"\n color=\"primary\"\n startIcon={<Icon name=\"RefreshRight\" />}\n loading={retrying}\n disabled={retrying}\n onClick={onRetry}\n >\n {retryLabel ?? t('errorState.retry')}\n </Button>\n ) : null\n const detailsButton =\n report != null ? (\n <Button\n size=\"sm\"\n variant=\"text\"\n color=\"primary\"\n startIcon={<Icon name=\"DocumentText\" />}\n onClick={() => setDetailsOpen(true)}\n >\n {t('errorState.details')}\n </Button>\n ) : null\n\n return (\n <>\n <EmptyState\n ref={ref}\n // one announcement, assertive: an error is what the user needs to know now (role=\"alert\" already\n // implies aria-live=\"assertive\" — pairing it with \"polite\" was contradictory)\n role=\"alert\"\n color=\"error\"\n icon={resolvedIcon}\n title={title ?? t('errorState.title')}\n // a 400's message is the generic \"validation errors occurred\" — the per-field list is the useful part\n description={body}\n size={size ?? (compact ? 'sm' : 'md')}\n pattern={pattern ?? !compact}\n action={\n retry || detailsButton || action ? (\n <span className={styles.actions}>\n {retry}\n {detailsButton}\n {action}\n </span>\n ) : undefined\n }\n className={clsx(styles.errorState, compact && styles.compact, className)}\n {...props}\n >\n {children}\n </EmptyState>\n {detailsModal}\n </>\n )\n})\n"],"names":["ErrorDetailsModal","open","onClose","report","t","useT","copy","copied","useClipboard","jsx","Modal","jsxs","Fragment","Button","Icon","styles","ErrorState","forwardRef","error","variant","title","description","icon","onRetry","retrying","retryLabel","showDetails","compact","traceIdProp","fieldErrorsProp","fieldLabels","size","pattern","action","className","children","props","ref","detailsOpen","setDetailsOpen","useState","message","getErrorMessage","status","traceId","getErrorTraceId","fieldErrors","getErrorFieldErrors","fieldErrorList","field","msg","humanizeField","body","resolvedIcon","isNetworkError","technical","isDev","getErrorDetails","getErrorStatus","detailsModal","alertActions","Tooltip","IconButton","Alert","clsx","retry","detailsButton","EmptyState"],"mappings":"g0BAmBO,SAASA,GAAkB,CAAE,KAAAC,EAAM,QAAAC,EAAS,OAAAC,GAAkC,CACnF,MAAMC,EAAIC,EAAAA,KAAA,EACJ,CAAE,KAAAC,EAAM,OAAAC,CAAA,EAAWC,eAAA,EACzB,OACEC,EAAAA,IAACC,EAAAA,MAAA,CACC,KAAAT,EACA,QAAAC,EACA,MAAOE,EAAE,yBAAyB,EAClC,KAAK,SACL,MAAM,QACN,KAAK,KACL,eAAe,SACf,OACEO,EAAAA,KAAAC,WAAA,CACE,SAAA,CAAAH,EAAAA,IAACI,EAAAA,OAAA,CAAO,QAAQ,OAAO,MAAM,UAAU,QAASX,EAC7C,SAAAE,EAAE,cAAc,CAAA,CACnB,EACAK,EAAAA,IAACI,EAAAA,OAAA,CACC,UAAWJ,EAAAA,IAACK,OAAA,CAAK,KAAMP,EAAS,cAAgB,OAAQ,EACxD,QAAS,IAAM,KAAKD,EAAKH,CAAM,EAE9B,SAASC,EAATG,EAAW,mBAAwB,gBAAN,CAAsB,CAAA,CACtD,EACF,EAGF,SAAAE,EAAAA,IAAC,MAAA,CAAI,UAAWM,EAAO,IAAM,SAAAZ,CAAA,CAAO,CAAA,CAAA,CAG1C,CCgDO,MAAMa,GAAaC,EAAAA,WAA4C,SACpE,CACE,MAAAC,EACA,QAAAC,EAAU,QACV,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,QAAAC,EACA,SAAAC,EAAW,GACX,WAAAC,EACA,YAAAC,EAAc,MACd,QAAAC,EAAU,GACV,QAASC,EACT,YAAa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,EAAAA,IAAC,OAAA,CAAK,UAAWM,EAAO,UAAY,SAAAqC,EAAK,EACxCjB,CAAA,CAAA,CAAA,EAEFwB,CAAA,EACH,CAEJ,CAGA,MAAMM,EACJ1C,GAAW,KACTd,EAAAA,IAACI,EAAAA,OAAA,CACC,KAAK,KACL,QAAQ,WACR,MAAM,UACN,UAAWJ,EAAAA,IAACK,EAAAA,KAAA,CAAK,KAAK,cAAA,CAAe,EACrC,QAASU,EACT,SAAUA,EACV,QAASD,EAER,SAAAE,GAAcrB,EAAE,kBAAkB,CAAA,CAAA,EAEnC,KACA8D,EACJ/D,GAAU,KACRM,EAAAA,IAACI,EAAAA,OAAA,CACC,KAAK,KACL,QAAQ,OACR,MAAM,UACN,UAAWJ,EAAAA,IAACK,EAAAA,KAAA,CAAK,KAAK,cAAA,CAAe,EACrC,QAAS,IAAMyB,EAAe,EAAI,EAEjC,WAAE,oBAAoB,CAAA,CAAA,EAEvB,KAEN,OACE5B,EAAAA,KAAAC,WAAA,CACE,SAAA,CAAAH,EAAAA,IAAC0D,EAAAA,WAAA,CACC,IAAA9B,EAGA,KAAK,QACL,MAAM,QACN,KAAMgB,EACN,MAAOjC,GAAShB,EAAE,kBAAkB,EAEpC,YAAagD,EACb,KAAMrB,IAASJ,EAAU,KAAO,MAChC,QAASK,GAAW,CAACL,EACrB,OACEsC,GAASC,GAAiBjC,SACvB,OAAA,CAAK,UAAWlB,EAAO,QACrB,SAAA,CAAAkD,EACAC,EACAjC,CAAA,CAAA,CACH,EACE,OAEN,UAAW+B,EAAAA,KAAKjD,EAAO,WAAYY,GAAWZ,EAAO,QAASmB,CAAS,EACtE,GAAGE,EAEH,SAAAD,CAAA,CAAA,EAEFwB,CAAA,EACH,CAEJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"ErrorState-CwCqd2PU.cjs","sources":["../src/components/ErrorState/ErrorDetailsModal.tsx","../src/components/ErrorState/ErrorState.tsx"],"sourcesContent":["import { useT } from '../../theme'\nimport { useClipboard } from '../../hooks/useClipboard'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { Modal } from '../Modal'\nimport styles from './ErrorState.module.css'\n\nexport interface ErrorDetailsModalProps {\n open: boolean\n onClose: () => void\n /** The whole report — shown as-is and copied by the Copy button. */\n report: string\n}\n\n/**\n * Internal to `ErrorState`: the \"Details\" dialog — the error report (trace id, status, message, then the stack /\n * raw dump when allowed) in one monospace block, with **Copy** (the whole report, flips to \"Copied!\") and\n * **Close** in the footer, so a user can paste it into a support ticket in one go.\n */\nexport function ErrorDetailsModal({ open, onClose, report }: ErrorDetailsModalProps) {\n const t = useT()\n const { copy, copied } = useClipboard()\n return (\n <Modal\n open={open}\n onClose={onClose}\n title={t('errorState.detailsTitle')}\n icon=\"Danger\"\n color=\"error\"\n size=\"lg\"\n scrollBehavior=\"inside\"\n footer={\n <>\n <Button variant=\"text\" color=\"primary\" onClick={onClose}>\n {t('common.close')}\n </Button>\n <Button\n startIcon={<Icon name={copied ? 'CopySuccess' : 'Copy'} />}\n onClick={() => void copy(report)}\n >\n {copied ? t('clipboard.copied') : t('clipboard.copy')}\n </Button>\n </>\n }\n >\n <pre className={styles.pre}>{report}</pre>\n </Modal>\n )\n}\n","import { forwardRef, useState, type ReactNode } from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { Alert } from '../Alert'\nimport { Button } from '../Button'\nimport { EmptyState, type EmptyStateProps } from '../EmptyState'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tooltip } from '../Tooltip'\nimport type { IconName } from '../../icons/names'\nimport {\n getErrorDetails,\n getErrorFieldErrors,\n getErrorMessage,\n getErrorStatus,\n getErrorTraceId,\n humanizeField,\n isNetworkError,\n isDev,\n} from './errorMessage'\nimport { ErrorDetailsModal } from './ErrorDetailsModal'\nimport styles from './ErrorState.module.css'\n\nexport type ErrorStateVariant = 'block' | 'alert'\n\nexport interface ErrorStateProps extends Omit<EmptyStateProps, 'icon' | 'title' | 'color'> {\n /**\n * The shape. `'alert'` (default) — a red `Alert` banner: the message (no default title), then Try Again /\n * Details / `action` in the alert's action slot; it fits anywhere — above a form, in a modal, in a card.\n * `'block'` — the `EmptyState`-style block (puck, title, centred message, the buttons below), for an area\n * whose data failed to load, or a whole page (`PageError`). `compact` and `pattern` apply to `'block'` only.\n */\n variant?: ErrorStateVariant\n /**\n * What failed — an `Error`, a string, an axios-style error, a `{ message }` or a raw `{ status }`\n * response. Its message becomes the description (unless `description` is given) and its stack feeds\n * the details panel.\n */\n error?: unknown\n /**\n * Heading. Alert: none unless given — the message is the point. Block: defaults to the localized \"Something\n * Went Wrong\".\n */\n title?: ReactNode\n /**\n * Leading icon — a known `IconName`, any node, or `false`. Defaults to `Danger` in both variants (the alert\n * replaces the Alert's own × icon), or `CloudCross` when the request never got a response (an explicit\n * `status: 0` / network error code), tinted `error`.\n */\n icon?: IconName | ReactNode | false\n /** Adds a \"Try Again\" button that calls this (e.g. a query's `refetch`). */\n onRetry?: () => void\n /**\n * The retry is running (e.g. `query.isFetching`) — the \"Try Again\" button shows its loader and is disabled,\n * so a slow refetch doesn't look like a dead click. Defaults to `false`.\n */\n retrying?: boolean\n /** Retry button label. Defaults to the localized \"Try Again\". */\n retryLabel?: ReactNode\n /**\n * Include the technical dump (the stack, or the raw error as JSON) in the **Details** dialog. `'dev'`\n * (default) only in development builds; `true` always; `false` never. The Details button itself shows\n * whenever there's a trace id or this dump — never inline on the page.\n */\n showDetails?: boolean | 'dev'\n /** The inline variant — small, no hero pattern — for inside a table, card or panel. Defaults to `false`. */\n compact?: boolean\n /**\n * The server's trace id — it matches a report to the server log. It isn't shown on the page: it leads the\n * **Details** dialog (with a copy button), and its presence alone shows the Details button, production\n * included. Defaults to the one on `error` (`error.traceId` / `error.response.data.traceId`); `false` hides it.\n */\n traceId?: string | false\n /**\n * Per-field validation messages (`{ field: message }`), listed as the description when there's no explicit\n * `description`. Defaults to the ones on `error` (`getErrorFieldErrors`: `error.fieldErrors` — an object, a\n * method or a `{ field, message }[]` —, `error.details`, `error.response.data.errors`); `false` hides them. In a form, put them on the inputs instead.\n */\n fieldErrors?: Record<string, string> | false\n /**\n * Labels for the field-error keys (`{ newPassword: 'New Password' }`). A key without one is shown humanized\n * and Title Cased (`newPassword` / `new_password` → \"New Password\"; a dotted path keeps its last segment).\n */\n fieldLabels?: Record<string, ReactNode>\n}\n\n/**\n * The \"it broke\" counterpart of `EmptyState`. By default (`variant=\"alert\"`) a red `Alert` banner with a `Danger`\n * icon: the failure's own message (extracted from an `Error`, a string, an axios-style `response.data.message`, a\n * `{ message }`, or a raw `{ status }` → \"Request failed (404)\"), or a 400's per-field `fieldErrors` list; then\n * **Try Again** (`onRetry`, spinning while `retrying`) and **Details** in its action slot. `variant=\"block\"` is the\n * `EmptyState`-style block (an `error`-tinted puck, a \"Something Went Wrong\" title, the same buttons below);\n * `compact` is its inline size. **Details** opens a dialog with the full report — the server's `traceId`, the\n * status, the message, and the stack in development (`showDetails`) — in one block with a copy button. Announced\n * once (`role=\"alert\"`). `forwardRef` to the root; any other `EmptyState` prop passes through to the block.\n */\nexport const ErrorState = forwardRef<HTMLDivElement, ErrorStateProps>(function ErrorState(\n {\n error,\n variant = 'alert',\n title,\n description,\n icon,\n onRetry,\n retrying = false,\n retryLabel,\n showDetails = 'dev',\n compact = false,\n traceId: traceIdProp,\n fieldErrors: fieldErrorsProp,\n fieldLabels,\n size,\n pattern,\n action,\n className,\n children,\n ...props\n },\n ref,\n) {\n const t = useT()\n const [detailsOpen, setDetailsOpen] = useState(false)\n const message = getErrorMessage(error, (status) => t('errorState.requestFailed', { status }))\n const traceId = traceIdProp === false ? undefined : (traceIdProp ?? getErrorTraceId(error))\n const fieldErrors =\n fieldErrorsProp === false ? undefined : (fieldErrorsProp ?? getErrorFieldErrors(error))\n const fieldErrorList =\n fieldErrors && Object.keys(fieldErrors).length > 0 ? (\n <ul className={styles.fieldErrors}>\n {Object.entries(fieldErrors).map(([field, msg]) => (\n <li key={field}>\n <span className={styles.field}>{fieldLabels?.[field] ?? humanizeField(field)}</span> —{' '}\n {msg}\n </li>\n ))}\n </ul>\n ) : undefined\n const body = description ?? fieldErrorList ?? message ?? t('errorState.description')\n const resolvedIcon = icon === undefined ? (isNetworkError(error) ? 'CloudCross' : 'Danger') : icon\n\n // the \"Details\" report — trace id, status, message, then the stack / raw dump (dev only by default). The\n // button shows when there's something worth opening: a trace id (always — it's what support asks for) or\n // the technical dump.\n const technical = (showDetails === 'dev' ? isDev() : showDetails)\n ? getErrorDetails(error)\n : undefined\n const status = getErrorStatus(error)\n const report =\n traceId != null || technical != null\n ? [\n traceId != null && `${t('errorState.traceId')}: ${traceId}`,\n status != null && `${t('errorState.status')}: ${status}`,\n // the raw message only where it's already visible, or with the dev dump — a `description` /\n // `fallback` (or PageError) hides it on purpose\n message != null &&\n (body === message || technical != null) &&\n `${t('errorState.message')}: ${message}`,\n technical != null && `\\n${technical}`,\n ]\n .filter(Boolean)\n .join('\\n')\n : undefined\n const detailsModal =\n report != null ? (\n <ErrorDetailsModal open={detailsOpen} onClose={() => setDetailsOpen(false)} report={report} />\n ) : null\n\n // ── alert (default): a banner — the message, then Try Again / Details / action in the action slot ──\n if (variant === 'alert') {\n const alertActions =\n report != null || onRetry != null || action != null ? (\n <span className={styles.alertActions}>\n {/* an icon-only retry (tooltip + aria-label) keeps the slot narrow, so the message keeps its room on\n small screens */}\n {onRetry != null && (\n <Tooltip content={retryLabel ?? t('errorState.retry')}>\n <IconButton\n size=\"sm\"\n variant=\"text\"\n color=\"error\"\n aria-label={typeof retryLabel === 'string' ? retryLabel : t('errorState.retry')}\n loading={retrying}\n disabled={retrying}\n onClick={onRetry}\n >\n <Icon name=\"RefreshArrow2\" />\n </IconButton>\n </Tooltip>\n )}\n {report != null && (\n <Button size=\"sm\" variant=\"filled\" color=\"error\" onClick={() => setDetailsOpen(true)}>\n {t('errorState.details')}\n </Button>\n )}\n {action}\n </span>\n ) : undefined\n return (\n <>\n <Alert\n ref={ref}\n color=\"error\"\n icon={resolvedIcon}\n action={alertActions}\n className={clsx(styles.alertVariant, className)}\n {...props}\n >\n {title != null && <span className={styles.alertTitle}>{title}</span>}\n <span className={styles.alertBody}>{body}</span>\n {children}\n </Alert>\n {detailsModal}\n </>\n )\n }\n\n // ── block: the EmptyState-style hero / compact block ──\n const retry =\n onRetry != null ? (\n <Button\n size=\"sm\"\n variant=\"outlined\"\n color=\"primary\"\n startIcon={<Icon name=\"RefreshRight\" />}\n loading={retrying}\n disabled={retrying}\n onClick={onRetry}\n >\n {retryLabel ?? t('errorState.retry')}\n </Button>\n ) : null\n const detailsButton =\n report != null ? (\n <Button\n size=\"sm\"\n variant=\"text\"\n color=\"primary\"\n startIcon={<Icon name=\"DocumentText\" />}\n onClick={() => setDetailsOpen(true)}\n >\n {t('errorState.details')}\n </Button>\n ) : null\n\n return (\n <>\n <EmptyState\n ref={ref}\n // one announcement, assertive: an error is what the user needs to know now (role=\"alert\" already\n // implies aria-live=\"assertive\" — pairing it with \"polite\" was contradictory)\n role=\"alert\"\n color=\"error\"\n icon={resolvedIcon}\n title={title ?? t('errorState.title')}\n // a 400's message is the generic \"validation errors occurred\" — the per-field list is the useful part\n description={body}\n size={size ?? (compact ? 'sm' : 'md')}\n pattern={pattern ?? !compact}\n action={\n retry || detailsButton || action ? (\n <span className={styles.actions}>\n {retry}\n {detailsButton}\n {action}\n </span>\n ) : undefined\n }\n className={clsx(styles.errorState, compact && styles.compact, className)}\n {...props}\n >\n {children}\n </EmptyState>\n {detailsModal}\n </>\n )\n})\n"],"names":["ErrorDetailsModal","open","onClose","report","t","useT","copy","copied","useClipboard","jsx","Modal","jsxs","Fragment","Button","Icon","styles","ErrorState","forwardRef","error","variant","title","description","icon","onRetry","retrying","retryLabel","showDetails","compact","traceIdProp","fieldErrorsProp","fieldLabels","size","pattern","action","className","children","props","ref","detailsOpen","setDetailsOpen","useState","message","getErrorMessage","status","traceId","getErrorTraceId","fieldErrors","getErrorFieldErrors","fieldErrorList","field","msg","humanizeField","body","resolvedIcon","isNetworkError","technical","isDev","getErrorDetails","getErrorStatus","detailsModal","alertActions","Tooltip","IconButton","Alert","clsx","retry","detailsButton","EmptyState"],"mappings":"g0BAmBO,SAASA,GAAkB,CAAE,KAAAC,EAAM,QAAAC,EAAS,OAAAC,GAAkC,CACnF,MAAMC,EAAIC,EAAAA,KAAA,EACJ,CAAE,KAAAC,EAAM,OAAAC,CAAA,EAAWC,eAAA,EACzB,OACEC,EAAAA,IAACC,EAAAA,MAAA,CACC,KAAAT,EACA,QAAAC,EACA,MAAOE,EAAE,yBAAyB,EAClC,KAAK,SACL,MAAM,QACN,KAAK,KACL,eAAe,SACf,OACEO,EAAAA,KAAAC,WAAA,CACE,SAAA,CAAAH,EAAAA,IAACI,EAAAA,OAAA,CAAO,QAAQ,OAAO,MAAM,UAAU,QAASX,EAC7C,SAAAE,EAAE,cAAc,CAAA,CACnB,EACAK,EAAAA,IAACI,EAAAA,OAAA,CACC,UAAWJ,EAAAA,IAACK,OAAA,CAAK,KAAMP,EAAS,cAAgB,OAAQ,EACxD,QAAS,IAAM,KAAKD,EAAKH,CAAM,EAE9B,SAASC,EAATG,EAAW,mBAAwB,gBAAN,CAAsB,CAAA,CACtD,EACF,EAGF,SAAAE,EAAAA,IAAC,MAAA,CAAI,UAAWM,EAAO,IAAM,SAAAZ,CAAA,CAAO,CAAA,CAAA,CAG1C,CCgDO,MAAMa,GAAaC,EAAAA,WAA4C,SACpE,CACE,MAAAC,EACA,QAAAC,EAAU,QACV,MAAAC,EACA,YAAAC,EACA,KAAAC,EACA,QAAAC,EACA,SAAAC,EAAW,GACX,WAAAC,EACA,YAAAC,EAAc,MACd,QAAAC,EAAU,GACV,QAASC,EACT,YAAaC,EACb,YAAAC,EACA,KAAAC,EACA,QAAAC,EACA,OAAAC,EACA,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EACAC,EACA,CACA,MAAMjC,EAAIC,EAAAA,KAAA,EACJ,CAACiC,EAAaC,CAAc,EAAIC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