@techzyapp/ui-library 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AdminRoot-BYkmCGNx.js → AdminRoot-B9A4Hoz0.js} +5 -5
- package/dist/{AdminRoot-BYkmCGNx.js.map → AdminRoot-B9A4Hoz0.js.map} +1 -1
- package/dist/{AdminRoot-BbkfFQEn.cjs → AdminRoot-BVUEWczU.cjs} +2 -2
- package/dist/{AdminRoot-BbkfFQEn.cjs.map → AdminRoot-BVUEWczU.cjs.map} +1 -1
- package/dist/{Alert-BLqAcEoT.js → Alert-B7w9xD2p.js} +3 -3
- package/dist/{Alert-BLqAcEoT.js.map → Alert-B7w9xD2p.js.map} +1 -1
- package/dist/{Alert-BM5WOI_u.cjs → Alert-B9l1VhIr.cjs} +2 -2
- package/dist/{Alert-BM5WOI_u.cjs.map → Alert-B9l1VhIr.cjs.map} +1 -1
- package/dist/{Breadcrumbs-Di4-Acfb.cjs → Breadcrumbs-B1JMwCjO.cjs} +2 -2
- package/dist/{Breadcrumbs-Di4-Acfb.cjs.map → Breadcrumbs-B1JMwCjO.cjs.map} +1 -1
- package/dist/{Breadcrumbs-CzHGbN2c.js → Breadcrumbs-Cl1CgKkk.js} +3 -3
- package/dist/{Breadcrumbs-CzHGbN2c.js.map → Breadcrumbs-Cl1CgKkk.js.map} +1 -1
- package/dist/{Button-9Qcdkw-y.js → Button-BJ5Xd10u.js} +2 -2
- package/dist/{Button-9Qcdkw-y.js.map → Button-BJ5Xd10u.js.map} +1 -1
- package/dist/{Button-BQhiJq8e.cjs → Button-BZq1mIUH.cjs} +2 -2
- package/dist/{Button-BQhiJq8e.cjs.map → Button-BZq1mIUH.cjs.map} +1 -1
- package/dist/{Calendar-dXhLgOUH.cjs → Calendar-r-dDXWEp.cjs} +2 -2
- package/dist/{Calendar-dXhLgOUH.cjs.map → Calendar-r-dDXWEp.cjs.map} +1 -1
- package/dist/{Calendar-BB-C0qXO.js → Calendar-rRPnaU9M.js} +3 -3
- package/dist/{Calendar-BB-C0qXO.js.map → Calendar-rRPnaU9M.js.map} +1 -1
- package/dist/{Card-BERQfyhJ.js → Card-Cr3D2bzJ.js} +2 -2
- package/dist/{Card-BERQfyhJ.js.map → Card-Cr3D2bzJ.js.map} +1 -1
- package/dist/{Card-DULpoOfj.cjs → Card-KsczbH5c.cjs} +2 -2
- package/dist/{Card-DULpoOfj.cjs.map → Card-KsczbH5c.cjs.map} +1 -1
- package/dist/{Chip-BuydTI6V.cjs → Chip-BZ3I4Lbe.cjs} +2 -2
- package/dist/{Chip-BuydTI6V.cjs.map → Chip-BZ3I4Lbe.cjs.map} +1 -1
- package/dist/{Chip-DZ5Fz7jx.js → Chip-DEp1zWh1.js} +2 -2
- package/dist/{Chip-DZ5Fz7jx.js.map → Chip-DEp1zWh1.js.map} +1 -1
- package/dist/{CodeBlock-BySsTAtY.js → CodeBlock-CMHqvoBJ.js} +3 -3
- package/dist/{CodeBlock-BySsTAtY.js.map → CodeBlock-CMHqvoBJ.js.map} +1 -1
- package/dist/{CodeBlock-BPraYPoS.cjs → CodeBlock-DIkyeG4S.cjs} +2 -2
- package/dist/{CodeBlock-BPraYPoS.cjs.map → CodeBlock-DIkyeG4S.cjs.map} +1 -1
- package/dist/{ColorPicker-DJow7m2v.js → ColorPicker-5SMyU5oh.js} +3 -3
- package/dist/{ColorPicker-DJow7m2v.js.map → ColorPicker-5SMyU5oh.js.map} +1 -1
- package/dist/{ColorPicker-BTBTQD39.cjs → ColorPicker-B1riGs1z.cjs} +2 -2
- package/dist/{ColorPicker-BTBTQD39.cjs.map → ColorPicker-B1riGs1z.cjs.map} +1 -1
- package/dist/{ColorPickerPanel-D6agWM6y.js → ColorPickerPanel-4Y6oXL7v.js} +2 -2
- package/dist/{ColorPickerPanel-D6agWM6y.js.map → ColorPickerPanel-4Y6oXL7v.js.map} +1 -1
- package/dist/{ColorPickerPanel-DXIYwUoE.cjs → ColorPickerPanel-CzBlh0zw.cjs} +2 -2
- package/dist/{ColorPickerPanel-DXIYwUoE.cjs.map → ColorPickerPanel-CzBlh0zw.cjs.map} +1 -1
- package/dist/{ColorRamp-B45Rtwgw.cjs → ColorRamp-D_h-hp7n.cjs} +2 -2
- package/dist/{ColorRamp-B45Rtwgw.cjs.map → ColorRamp-D_h-hp7n.cjs.map} +1 -1
- package/dist/{ColorRamp-Bhj28c_6.js → ColorRamp-Qc8ZtPDh.js} +2 -2
- package/dist/{ColorRamp-Bhj28c_6.js.map → ColorRamp-Qc8ZtPDh.js.map} +1 -1
- package/dist/ConfigProvider-CzAQf_d_.cjs +2 -0
- package/dist/ConfigProvider-CzAQf_d_.cjs.map +1 -0
- package/dist/ConfigProvider-D2svpXFu.js +347 -0
- package/dist/ConfigProvider-D2svpXFu.js.map +1 -0
- package/dist/{CopyButton-CBk85MQ7.js → CopyButton-BNcW9-KU.js} +3 -3
- package/dist/{CopyButton-CBk85MQ7.js.map → CopyButton-BNcW9-KU.js.map} +1 -1
- package/dist/{CopyButton-Bfte6TJF.cjs → CopyButton-DUtx2-Gi.cjs} +2 -2
- package/dist/{CopyButton-Bfte6TJF.cjs.map → CopyButton-DUtx2-Gi.cjs.map} +1 -1
- package/dist/{DatePicker-eAzDnO2Y.js → DatePicker-D2PyGdec.js} +4 -4
- package/dist/{DatePicker-eAzDnO2Y.js.map → DatePicker-D2PyGdec.js.map} +1 -1
- package/dist/{DatePicker-DBiU4Mb6.cjs → DatePicker-D_PqDvKt.cjs} +2 -2
- package/dist/{DatePicker-DBiU4Mb6.cjs.map → DatePicker-D_PqDvKt.cjs.map} +1 -1
- package/dist/{DateTimePicker-CvaD8IkF.cjs → DateTimePicker-C3Kq5hKE.cjs} +2 -2
- package/dist/{DateTimePicker-CvaD8IkF.cjs.map → DateTimePicker-C3Kq5hKE.cjs.map} +1 -1
- package/dist/{DateTimePicker-M2UBjFVc.js → DateTimePicker-DdXFzqO_.js} +7 -7
- package/dist/{DateTimePicker-M2UBjFVc.js.map → DateTimePicker-DdXFzqO_.js.map} +1 -1
- package/dist/{DescriptionList-DQHNOTWl.cjs → DescriptionList-C7AOcw_2.cjs} +2 -2
- package/dist/{DescriptionList-DQHNOTWl.cjs.map → DescriptionList-C7AOcw_2.cjs.map} +1 -1
- package/dist/{DescriptionList-BhsmdtS1.js → DescriptionList-DxRgKNEJ.js} +4 -4
- package/dist/{DescriptionList-BhsmdtS1.js.map → DescriptionList-DxRgKNEJ.js.map} +1 -1
- package/dist/{Dropdown-BbaU1WDC.cjs → Dropdown-CMqWq6J_.cjs} +2 -2
- package/dist/{Dropdown-BbaU1WDC.cjs.map → Dropdown-CMqWq6J_.cjs.map} +1 -1
- package/dist/{Dropdown-BlmbYp1X.js → Dropdown-zlv96RLy.js} +2 -2
- package/dist/{Dropdown-BlmbYp1X.js.map → Dropdown-zlv96RLy.js.map} +1 -1
- package/dist/{EmptyState-2pA3XlOX.js → EmptyState-CvpKSYY4.js} +2 -2
- package/dist/{EmptyState-2pA3XlOX.js.map → EmptyState-CvpKSYY4.js.map} +1 -1
- package/dist/{EmptyState-ByBpy2vN.cjs → EmptyState-ECc6e_En.cjs} +2 -2
- package/dist/{EmptyState-ByBpy2vN.cjs.map → EmptyState-ECc6e_En.cjs.map} +1 -1
- package/dist/{ErrorBoundary-B-37hGZW.js → ErrorBoundary-CJx5E9wJ.js} +5 -5
- package/dist/{ErrorBoundary-B-37hGZW.js.map → ErrorBoundary-CJx5E9wJ.js.map} +1 -1
- package/dist/{ErrorBoundary-gRGxeuM1.cjs → ErrorBoundary-DbKRtdgS.cjs} +2 -2
- package/dist/{ErrorBoundary-gRGxeuM1.cjs.map → ErrorBoundary-DbKRtdgS.cjs.map} +1 -1
- package/dist/{FileCard-BYNJVmp0.cjs → FileCard-Bjqsgi7S.cjs} +2 -2
- package/dist/{FileCard-BYNJVmp0.cjs.map → FileCard-Bjqsgi7S.cjs.map} +1 -1
- package/dist/{FileCard-BNfUAgsF.js → FileCard-D4t0-ms2.js} +3 -3
- package/dist/{FileCard-BNfUAgsF.js.map → FileCard-D4t0-ms2.js.map} +1 -1
- package/dist/{FileUploader-DdICa5UC.cjs → FileUploader-DWM8WrY6.cjs} +2 -2
- package/dist/{FileUploader-DdICa5UC.cjs.map → FileUploader-DWM8WrY6.cjs.map} +1 -1
- package/dist/{FileUploader-TOWwDOSS.js → FileUploader-DdcvZoUb.js} +5 -5
- package/dist/{FileUploader-TOWwDOSS.js.map → FileUploader-DdcvZoUb.js.map} +1 -1
- package/dist/{Flag-DDR6OANA.js → Flag-BLEBMdb-.js} +2 -2
- package/dist/{Flag-DDR6OANA.js.map → Flag-BLEBMdb-.js.map} +1 -1
- package/dist/{Flag-DXPQ2t8z.cjs → Flag-D5rqScYG.cjs} +2 -2
- package/dist/{Flag-DXPQ2t8z.cjs.map → Flag-D5rqScYG.cjs.map} +1 -1
- package/dist/{FullscreenToggle-BKo1lDSE.cjs → FullscreenToggle-CZoc5pYg.cjs} +2 -2
- package/dist/{FullscreenToggle-BKo1lDSE.cjs.map → FullscreenToggle-CZoc5pYg.cjs.map} +1 -1
- package/dist/{FullscreenToggle-DmH1541W.js → FullscreenToggle-DZnKK1Lj.js} +3 -3
- package/dist/{FullscreenToggle-DmH1541W.js.map → FullscreenToggle-DZnKK1Lj.js.map} +1 -1
- package/dist/{IconButton-CL_6iMQh.js → IconButton-CqFgam3J.js} +2 -2
- package/dist/{IconButton-CL_6iMQh.js.map → IconButton-CqFgam3J.js.map} +1 -1
- package/dist/{IconButton-CvIXSFsr.cjs → IconButton-V8tjArlt.cjs} +2 -2
- package/dist/{IconButton-CvIXSFsr.cjs.map → IconButton-V8tjArlt.cjs.map} +1 -1
- package/dist/List-CXHlAI5w.js +38 -0
- package/dist/List-CXHlAI5w.js.map +1 -0
- package/dist/List-DOsh6w-d.cjs +2 -0
- package/dist/List-DOsh6w-d.cjs.map +1 -0
- package/dist/ListItem-CUeIBhOF.cjs +2 -0
- package/dist/ListItem-CUeIBhOF.cjs.map +1 -0
- package/dist/ListItem-ehFB7TUW.js +77 -0
- package/dist/ListItem-ehFB7TUW.js.map +1 -0
- package/dist/{Loader-Czzb450N.js → Loader-Bsz0BkGr.js} +2 -2
- package/dist/{Loader-Czzb450N.js.map → Loader-Bsz0BkGr.js.map} +1 -1
- package/dist/{Loader-CI1j71X8.cjs → Loader-CqRaCdzF.cjs} +2 -2
- package/dist/{Loader-CI1j71X8.cjs.map → Loader-CqRaCdzF.cjs.map} +1 -1
- package/dist/LocationPicker-BRGNcTd_.cjs +2 -0
- package/dist/LocationPicker-BRGNcTd_.cjs.map +1 -0
- package/dist/LocationPicker-DtMDpPFZ.js +781 -0
- package/dist/LocationPicker-DtMDpPFZ.js.map +1 -0
- package/dist/{Modal-DPObz0b-.cjs → Modal-CcrqM4kn.cjs} +2 -2
- package/dist/{Modal-DPObz0b-.cjs.map → Modal-CcrqM4kn.cjs.map} +1 -1
- package/dist/{Modal-DMJMw6kT.js → Modal-DCee1a9m.js} +3 -3
- package/dist/{Modal-DMJMw6kT.js.map → Modal-DCee1a9m.js.map} +1 -1
- package/dist/{MultiSelect-IDAJ5a5K.cjs → MultiSelect-BJ-qMpA5.cjs} +2 -2
- package/dist/{MultiSelect-IDAJ5a5K.cjs.map → MultiSelect-BJ-qMpA5.cjs.map} +1 -1
- package/dist/{MultiSelect-BTR6w5Ot.js → MultiSelect-JQ6iKHyI.js} +4 -4
- package/dist/{MultiSelect-BTR6w5Ot.js.map → MultiSelect-JQ6iKHyI.js.map} +1 -1
- package/dist/{NumberField-DlaW-g3Z.js → NumberField-Bf-vDNLy.js} +3 -3
- package/dist/{NumberField-DlaW-g3Z.js.map → NumberField-Bf-vDNLy.js.map} +1 -1
- package/dist/{NumberField-Cg0XEDgW.cjs → NumberField-mZjwZB8E.cjs} +2 -2
- package/dist/{NumberField-Cg0XEDgW.cjs.map → NumberField-mZjwZB8E.cjs.map} +1 -1
- package/dist/{OtpField-vxQuo-uR.js → OtpField-DaAIBp6C.js} +2 -2
- package/dist/{OtpField-vxQuo-uR.js.map → OtpField-DaAIBp6C.js.map} +1 -1
- package/dist/{OtpField-DsedK1nQ.cjs → OtpField-TdjMkgQi.cjs} +2 -2
- package/dist/{OtpField-DsedK1nQ.cjs.map → OtpField-TdjMkgQi.cjs.map} +1 -1
- package/dist/{PageLayout-BPbjTYS3.cjs → PageLayout-BoHvt2cT.cjs} +2 -2
- package/dist/{PageLayout-BPbjTYS3.cjs.map → PageLayout-BoHvt2cT.cjs.map} +1 -1
- package/dist/{PageLayout-Rk6KSxmn.js → PageLayout-Bwv8Oohb.js} +2 -2
- package/dist/{PageLayout-Rk6KSxmn.js.map → PageLayout-Bwv8Oohb.js.map} +1 -1
- package/dist/{PageNotFound-CBNhKZ9Y.js → PageNotFound-CMt8vnky.js} +5 -5
- package/dist/{PageNotFound-CBNhKZ9Y.js.map → PageNotFound-CMt8vnky.js.map} +1 -1
- package/dist/{PageNotFound-PUQ1o9R4.cjs → PageNotFound-DDm6nwQh.cjs} +2 -2
- package/dist/{PageNotFound-PUQ1o9R4.cjs.map → PageNotFound-DDm6nwQh.cjs.map} +1 -1
- package/dist/{Pagination-CNdkfXp2.js → Pagination-C0xr3D-g.js} +2 -2
- package/dist/{Pagination-CNdkfXp2.js.map → Pagination-C0xr3D-g.js.map} +1 -1
- package/dist/{Pagination-DNGKNQy0.cjs → Pagination-DzkTjEZL.cjs} +2 -2
- package/dist/{Pagination-DNGKNQy0.cjs.map → Pagination-DzkTjEZL.cjs.map} +1 -1
- package/dist/{PaletteField-BSIF5jI6.cjs → PaletteField-CQV2dll0.cjs} +2 -2
- package/dist/{PaletteField-BSIF5jI6.cjs.map → PaletteField-CQV2dll0.cjs.map} +1 -1
- package/dist/{PaletteField-Bp5Fgygh.js → PaletteField-CQv6MBKe.js} +3 -3
- package/dist/{PaletteField-Bp5Fgygh.js.map → PaletteField-CQv6MBKe.js.map} +1 -1
- package/dist/{PhoneField-BdmvslXQ.js → PhoneField-Bqj5-33G.js} +4 -4
- package/dist/{PhoneField-BdmvslXQ.js.map → PhoneField-Bqj5-33G.js.map} +1 -1
- package/dist/{PhoneField-BMhZeZkW.cjs → PhoneField-Dzdm5hfY.cjs} +2 -2
- package/dist/{PhoneField-BMhZeZkW.cjs.map → PhoneField-Dzdm5hfY.cjs.map} +1 -1
- package/dist/{Popconfirm-Cyaeybtj.js → Popconfirm-CYkwGTh-.js} +3 -3
- package/dist/{Popconfirm-Cyaeybtj.js.map → Popconfirm-CYkwGTh-.js.map} +1 -1
- package/dist/{Popconfirm-IhlIINtZ.cjs → Popconfirm-DS6tCxV0.cjs} +2 -2
- package/dist/{Popconfirm-IhlIINtZ.cjs.map → Popconfirm-DS6tCxV0.cjs.map} +1 -1
- package/dist/{Progress-T7PLrJ0Y.js → Progress-DZUtn3Sh.js} +2 -2
- package/dist/{Progress-T7PLrJ0Y.js.map → Progress-DZUtn3Sh.js.map} +1 -1
- package/dist/{Progress-CAY1p06_.cjs → Progress-lf9vIKIk.cjs} +2 -2
- package/dist/{Progress-CAY1p06_.cjs.map → Progress-lf9vIKIk.cjs.map} +1 -1
- package/dist/{QueryError-Dtspj9l4.js → QueryError-Dl8yzdxw.js} +2 -2
- package/dist/{QueryError-Dtspj9l4.js.map → QueryError-Dl8yzdxw.js.map} +1 -1
- package/dist/{QueryError-DP22IUnp.cjs → QueryError-RF7Mh5zg.cjs} +2 -2
- package/dist/{QueryError-DP22IUnp.cjs.map → QueryError-RF7Mh5zg.cjs.map} +1 -1
- package/dist/{RemoveDialog-D12B4x80.cjs → RemoveDialog-Csfhv9ve.cjs} +2 -2
- package/dist/{RemoveDialog-D12B4x80.cjs.map → RemoveDialog-Csfhv9ve.cjs.map} +1 -1
- package/dist/{RemoveDialog-DdGsqaWV.js → RemoveDialog-DaWh4xmW.js} +5 -5
- package/dist/{RemoveDialog-DdGsqaWV.js.map → RemoveDialog-DaWh4xmW.js.map} +1 -1
- package/dist/{RichTextEditor-DL4y5xVv.js → RichTextEditor-BLEDQq2H.js} +9 -9
- package/dist/{RichTextEditor-DL4y5xVv.js.map → RichTextEditor-BLEDQq2H.js.map} +1 -1
- package/dist/RichTextEditor-Eo8uLXlI.cjs +2 -0
- package/dist/{RichTextEditor-BVXY25sz.cjs.map → RichTextEditor-Eo8uLXlI.cjs.map} +1 -1
- package/dist/RootLayout-BvyeNM9_.cjs +2 -0
- package/dist/{RootLayout-DDuzPlJe.cjs.map → RootLayout-BvyeNM9_.cjs.map} +1 -1
- package/dist/{RootLayout-BK3t6Mm0.js → RootLayout-D-ZlsTXF.js} +23 -23
- package/dist/{RootLayout-BK3t6Mm0.js.map → RootLayout-D-ZlsTXF.js.map} +1 -1
- package/dist/{Select-tVI_qer3.js → Select-C0UBQXhg.js} +3 -3
- package/dist/{Select-tVI_qer3.js.map → Select-C0UBQXhg.js.map} +1 -1
- package/dist/{Select-DlFDOZtn.cjs → Select-CH3mF6y1.cjs} +2 -2
- package/dist/{Select-DlFDOZtn.cjs.map → Select-CH3mF6y1.cjs.map} +1 -1
- package/dist/{Sidebar-CjrD3nNp.js → Sidebar--rOPtrqa.js} +33 -32
- package/dist/{Sidebar-CjrD3nNp.js.map → Sidebar--rOPtrqa.js.map} +1 -1
- package/dist/Sidebar-6wu2fuPT.cjs +2 -0
- package/dist/{Sidebar-gB-X4VLX.cjs.map → Sidebar-6wu2fuPT.cjs.map} +1 -1
- package/dist/{SpeedDial-xQr4JH0x.js → SpeedDial-BIodC6td.js} +2 -2
- package/dist/{SpeedDial-xQr4JH0x.js.map → SpeedDial-BIodC6td.js.map} +1 -1
- package/dist/{SpeedDial-BIOkkLKO.cjs → SpeedDial-BtxXH6Ij.cjs} +2 -2
- package/dist/{SpeedDial-BIOkkLKO.cjs.map → SpeedDial-BtxXH6Ij.cjs.map} +1 -1
- package/dist/{Stepper-CBdhvPoz.cjs → Stepper-B38I8PBS.cjs} +2 -2
- package/dist/{Stepper-CBdhvPoz.cjs.map → Stepper-B38I8PBS.cjs.map} +1 -1
- package/dist/{Stepper-CkYcIc15.js → Stepper-CPBPTxbP.js} +13 -13
- package/dist/{Stepper-CkYcIc15.js.map → Stepper-CPBPTxbP.js.map} +1 -1
- package/dist/Table-1RVWzyS6.cjs +2 -0
- package/dist/{Table-Cwxqo7Br.cjs.map → Table-1RVWzyS6.cjs.map} +1 -1
- package/dist/{Table-CwQKfXGn.js → Table-BV-dr36o.js} +45 -45
- package/dist/{Table-CwQKfXGn.js.map → Table-BV-dr36o.js.map} +1 -1
- package/dist/{Tabs-651xbRe4.cjs → Tabs-DIs8iFA-.cjs} +2 -2
- package/dist/{Tabs-651xbRe4.cjs.map → Tabs-DIs8iFA-.cjs.map} +1 -1
- package/dist/{Tabs-Bztnezt9.js → Tabs-RjyUkLTB.js} +10 -10
- package/dist/{Tabs-Bztnezt9.js.map → Tabs-RjyUkLTB.js.map} +1 -1
- package/dist/{TagsField-CdymON69.js → TagsField-B3MtFiFs.js} +4 -4
- package/dist/{TagsField-CdymON69.js.map → TagsField-B3MtFiFs.js.map} +1 -1
- package/dist/{TagsField-B7ZARHzD.cjs → TagsField-CJ10-kFr.cjs} +2 -2
- package/dist/{TagsField-B7ZARHzD.cjs.map → TagsField-CJ10-kFr.cjs.map} +1 -1
- package/dist/{TextField-DkaYK1DI.js → TextField-CInaL0FR.js} +3 -3
- package/dist/{TextField-DkaYK1DI.js.map → TextField-CInaL0FR.js.map} +1 -1
- package/dist/{TextField-B22NRQ91.cjs → TextField-D_hzd5Gf.cjs} +2 -2
- package/dist/{TextField-B22NRQ91.cjs.map → TextField-D_hzd5Gf.cjs.map} +1 -1
- package/dist/ThemeToggle-CWfuK0tZ.js +28 -0
- package/dist/{ThemeToggle-DqzUvcK5.js.map → ThemeToggle-CWfuK0tZ.js.map} +1 -1
- package/dist/{ThemeToggle-D5dWHQFb.cjs → ThemeToggle-DkhhlH_r.cjs} +2 -2
- package/dist/{ThemeToggle-D5dWHQFb.cjs.map → ThemeToggle-DkhhlH_r.cjs.map} +1 -1
- package/dist/{TimeColumns-BEoHh961.js → TimeColumns-fD6dosYP.js} +2 -2
- package/dist/{TimeColumns-BEoHh961.js.map → TimeColumns-fD6dosYP.js.map} +1 -1
- package/dist/{TimeColumns-o2xhvSGE.cjs → TimeColumns-t3Pn01v5.cjs} +2 -2
- package/dist/{TimeColumns-o2xhvSGE.cjs.map → TimeColumns-t3Pn01v5.cjs.map} +1 -1
- package/dist/{TimePicker-CACmHwNn.cjs → TimePicker-DOwQF7sX.cjs} +2 -2
- package/dist/{TimePicker-CACmHwNn.cjs.map → TimePicker-DOwQF7sX.cjs.map} +1 -1
- package/dist/{TimePicker-DCryZCmh.js → TimePicker-DypTHDW0.js} +5 -5
- package/dist/{TimePicker-DCryZCmh.js.map → TimePicker-DypTHDW0.js.map} +1 -1
- package/dist/{Toaster-DwVLab3k.js → Toaster-BwNAKDMc.js} +2 -2
- package/dist/{Toaster-DwVLab3k.js.map → Toaster-BwNAKDMc.js.map} +1 -1
- package/dist/{Toaster-BwREV06e.cjs → Toaster-DdUOwi7L.cjs} +2 -2
- package/dist/{Toaster-BwREV06e.cjs.map → Toaster-DdUOwi7L.cjs.map} +1 -1
- package/dist/{TranslatedFields-B0LMXgiu.js → TranslatedFields-C_-qPixE.js} +13 -13
- package/dist/{TranslatedFields-B0LMXgiu.js.map → TranslatedFields-C_-qPixE.js.map} +1 -1
- package/dist/{TranslatedFields-sio1Qfy7.cjs → TranslatedFields-D9FQlxiQ.cjs} +2 -2
- package/dist/{TranslatedFields-sio1Qfy7.cjs.map → TranslatedFields-D9FQlxiQ.cjs.map} +1 -1
- package/dist/{UserCard-Dzc4zmPj.cjs → UserCard-C-q2s2Cw.cjs} +2 -2
- package/dist/{UserCard-Dzc4zmPj.cjs.map → UserCard-C-q2s2Cw.cjs.map} +1 -1
- package/dist/{UserCard-B5FVcJaK.js → UserCard-CwWv0HXD.js} +3 -3
- package/dist/{UserCard-B5FVcJaK.js.map → UserCard-CwWv0HXD.js.map} +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Card/index.cjs +1 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Chip/index.cjs +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/ColorPicker/index.cjs +1 -1
- package/dist/components/ColorPicker/index.js +1 -1
- package/dist/components/ColorRamp/index.cjs +1 -1
- package/dist/components/ColorRamp/index.js +1 -1
- package/dist/components/CopyButton/index.cjs +1 -1
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DateTimePicker/index.cjs +1 -1
- package/dist/components/DateTimePicker/index.js +1 -1
- package/dist/components/DescriptionList/index.cjs +1 -1
- package/dist/components/DescriptionList/index.js +1 -1
- package/dist/components/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/index.cjs +1 -1
- package/dist/components/FileCard/index.js +1 -1
- package/dist/components/FileUploader/index.cjs +1 -1
- package/dist/components/FileUploader/index.js +1 -1
- package/dist/components/Flag/index.cjs +1 -1
- package/dist/components/Flag/index.js +1 -1
- package/dist/components/FullscreenToggle/index.cjs +1 -1
- package/dist/components/FullscreenToggle/index.js +1 -1
- package/dist/components/IconButton/index.cjs +1 -1
- package/dist/components/IconButton/index.js +1 -1
- package/dist/components/List/index.cjs +1 -1
- package/dist/components/List/index.js +5 -4
- package/dist/components/List/index.js.map +1 -1
- package/dist/components/Loader/index.cjs +1 -1
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/LocationPicker/LocationPicker.d.cts +87 -0
- package/dist/components/LocationPicker/LocationPicker.d.ts +87 -0
- package/dist/components/LocationPicker/PlaceSearch.d.cts +20 -0
- package/dist/components/LocationPicker/PlaceSearch.d.ts +20 -0
- package/dist/components/LocationPicker/googleMaps.d.cts +89 -0
- package/dist/components/LocationPicker/googleMaps.d.ts +89 -0
- package/dist/components/LocationPicker/index.cjs +2 -0
- package/dist/components/LocationPicker/index.cjs.map +1 -0
- package/dist/components/LocationPicker/index.d.cts +2 -0
- package/dist/components/LocationPicker/index.d.ts +2 -0
- package/dist/components/LocationPicker/index.js +7 -0
- package/dist/components/LocationPicker/index.js.map +1 -0
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/MultiSelect/index.cjs +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OtpField/index.cjs +1 -1
- package/dist/components/OtpField/index.js +1 -1
- package/dist/components/PageLayout/index.cjs +1 -1
- package/dist/components/PageLayout/index.js +1 -1
- package/dist/components/PageNotFound/index.cjs +1 -1
- package/dist/components/PageNotFound/index.js +1 -1
- package/dist/components/Pagination/index.cjs +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PaletteField/index.cjs +1 -1
- package/dist/components/PaletteField/index.js +1 -1
- package/dist/components/PhoneField/index.cjs +1 -1
- package/dist/components/PhoneField/index.js +1 -1
- package/dist/components/Popconfirm/index.cjs +1 -1
- package/dist/components/Popconfirm/index.js +1 -1
- package/dist/components/Progress/index.cjs +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/RemoveDialog/index.cjs +1 -1
- package/dist/components/RemoveDialog/index.js +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Sidebar/index.cjs +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/SpeedDial/index.cjs +1 -1
- package/dist/components/SpeedDial/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.cjs +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/TagsField/index.cjs +1 -1
- package/dist/components/TagsField/index.js +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/ThemeToggle/index.cjs +1 -1
- package/dist/components/ThemeToggle/index.js +1 -1
- package/dist/components/TimePicker/index.cjs +1 -1
- package/dist/components/TimePicker/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TranslatedFields/index.cjs +1 -1
- package/dist/components/TranslatedFields/index.js +1 -1
- package/dist/components/UserCard/index.cjs +1 -1
- package/dist/components/UserCard/index.js +1 -1
- package/dist/components/index.d.cts +1 -0
- package/dist/components/index.d.ts +1 -0
- 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 +136 -132
- package/dist/entries/components.js.map +1 -1
- 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 +15 -13
- package/dist/i18n/messages.d.cts +42 -0
- package/dist/i18n/messages.d.ts +42 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +238 -232
- package/dist/index.js.map +1 -1
- package/dist/{messages-DswDgGe2.js → messages-BOJsnD0O.js} +180 -33
- package/dist/messages-BOJsnD0O.js.map +1 -0
- package/dist/{messages-DS38X5W2.cjs → messages-ejfYfHwL.cjs} +9 -9
- package/dist/messages-ejfYfHwL.cjs.map +1 -0
- package/dist/theme/ConfigProvider.d.cts +22 -0
- package/dist/theme/ConfigProvider.d.ts +22 -0
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/useOptionMenu-8hjCTNL4.cjs +2 -0
- package/dist/{useOptionMenu-BYeSUee6.cjs.map → useOptionMenu-8hjCTNL4.cjs.map} +1 -1
- package/dist/{useOptionMenu-DtTvY9EC.js → useOptionMenu-C1wOZ9NT.js} +9 -8
- package/dist/{useOptionMenu-DtTvY9EC.js.map → useOptionMenu-C1wOZ9NT.js.map} +1 -1
- package/package.json +1 -1
- package/dist/ConfigProvider-Ct0Pe3Ku.js +0 -335
- package/dist/ConfigProvider-Ct0Pe3Ku.js.map +0 -1
- package/dist/ConfigProvider-CtpfSy1i.cjs +0 -2
- package/dist/ConfigProvider-CtpfSy1i.cjs.map +0 -1
- package/dist/List-BLPB3-B8.js +0 -107
- package/dist/List-BLPB3-B8.js.map +0 -1
- package/dist/List-ah2PNWeY.cjs +0 -2
- package/dist/List-ah2PNWeY.cjs.map +0 -1
- package/dist/RichTextEditor-BVXY25sz.cjs +0 -2
- package/dist/RootLayout-DDuzPlJe.cjs +0 -2
- package/dist/Sidebar-gB-X4VLX.cjs +0 -2
- package/dist/Table-Cwxqo7Br.cjs +0 -2
- package/dist/ThemeToggle-DqzUvcK5.js +0 -28
- package/dist/messages-DS38X5W2.cjs.map +0 -1
- package/dist/messages-DswDgGe2.js.map +0 -1
- package/dist/useOptionMenu-BYeSUee6.cjs +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimePicker-CvaD8IkF.cjs","sources":["../src/components/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tabs } from '../Tabs'\nimport { Typography } from '../Typography'\nimport { Calendar } from '../DatePicker/Calendar'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseISO,\n parseInput,\n parseValue,\n today,\n toISO,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport dt from './DateTimePicker.module.css'\nimport { TimeColumns } from './TimeColumns'\n\nexport type DateTimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface DateTimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and calendar density. */\n size?: DateTimePickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a datetime string in `valueFormat` (default ISO datetime; `''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next datetime in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'DD/MM/YYYY HH:mm:ss'` (or `hh:mm:ss A`\n * when `hour12`; the `:ss` is dropped when `showSeconds` is `false`).\n */\n format?: string\n /**\n * Wire format of `value`/`defaultValue`/`onChange` (dayjs tokens), decoupled from the displayed\n * `format`. Defaults to the ISO datetime `'YYYY-MM-DDTHH:mm:ss[Z]'` when `utc` (the `Z` marks the\n * value as UTC, e.g. `'2026-06-10T09:35:00Z'`), or `'YYYY-MM-DDTHH:mm:ss'` (no `Z`) when `utc={false}`.\n * Incoming values are parsed **leniently** (this format, then any ISO-8601 string — so a backend\n * datetime like `'2026-06-10T09:35:49.6134342'` with or without `Z` is accepted).\n */\n valueFormat?: string\n /**\n * Treat the value as **UTC** and display/edit in the viewer's **local** timezone (default `true`).\n * Set `false` to disable timezone conversion entirely — the field shows and emits the value's exact\n * wall-clock (what you pick is what's sent, no UTC shift).\n */\n utc?: boolean\n /** 12-hour clock (1–12 + AM/PM) instead of 24-hour (0–23). Defaults to `false`. */\n hour12?: boolean\n /** Minute increment for the minutes column. Defaults to `1`. */\n minuteStep?: number\n /** Show the seconds column + `:ss` in the default format. Defaults to `true`; pass `false` to hide seconds. */\n showSeconds?: boolean\n /** Placeholder shown when empty. Defaults to the lowercased `format`. */\n placeholder?: string\n /** Earliest selectable date (ISO date or datetime; day-level bound on the calendar). */\n min?: string\n /** Latest selectable date (ISO date or datetime; day-level bound on the calendar). */\n max?: string\n /** Disables specific dates — receives each day as an ISO `'YYYY-MM-DD'` string. */\n disabledDate?: (date: string) => boolean\n /** First day of the week: 0 = Sunday … 6 = Saturday. Defaults to `1` (Monday). */\n weekStartsOn?: number\n /** Shows a clear (×) button when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the datetime string). */\n name?: string\n /** Id for the input (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\nfunction defaultFormatFor(hour12: boolean, showSeconds: boolean): string {\n const time = hour12\n ? showSeconds\n ? 'hh:mm:ss A'\n : 'hh:mm A'\n : showSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n return `DD/MM/YYYY ${time}`\n}\n\n/**\n * A datetime field with a typed, masked input **and** a popover combining the keyboard-navigable\n * `Calendar` (date) with scrollable time columns (hour / minute / optional second + AM/PM in 12-hour\n * mode). All math runs in **UTC** so the instant never drifts with the viewer's timezone; the value is a\n * string in `valueFormat` (UTC ISO datetime with a `Z` by default, or no `Z` when `utc={false}`) — incoming values are parsed\n * leniently (a richer backend datetime is accepted) and the chosen instant is emitted in that format.\n * Picking a date keeps the time and vice-versa, and the popover stays open until you click away,\n * press Escape, or hit Done. Supports `hour12`, `minuteStep`, `showSeconds`, `min`/`max`,\n * `disabledDate`, `weekStartsOn`, and `clearable`. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires the `dayjs` peer dependency.\n */\nexport const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(\n function DateTimePicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n format: formatProp,\n valueFormat: valueFormatProp,\n utc = true,\n hour12 = false,\n minuteStep = 1,\n showSeconds = true,\n placeholder,\n min,\n max,\n disabledDate,\n weekStartsOn = 1,\n clearable = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n ) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n const labelId = `${id}-label`\n const format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // when the value is UTC, the wire string carries a `Z` (\"…09:35:00Z\"); `utc={false}` emits the\n // bare wall-clock (no zone designator). Override either via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'YYYY-MM-DDTHH:mm:ss[Z]' : 'YYYY-MM-DDTHH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` datetime string ────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n // when `utc`, parse the UTC value and show it in the viewer's LOCAL time (value stays UTC, emit\n // converts back); when `utc={false}`, show/emit the value's exact wall-clock (no tz conversion)\n const toDisplay = (instant: Dayjs | null) => (utc ? utcToLocalWall(instant) : instant)\n const selected = toDisplay(parseValue(currentValue, valueFormat))\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const minDate = toDisplay(parseValue(min, valueFormat))\n const maxDate = toDisplay(parseValue(max, valueFormat))\n const mask = maskFromFormat(format)\n // precision the user can actually type — driven by the display `format`, not just `showSeconds`\n const timeUnit = /s/.test(format) ? 'second' : 'minute'\n\n const commit = (next: string) => {\n if (next === currentValue) return // skip redundant onChange / setValue with an unchanged value\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // emit a datetime in the wire `valueFormat` (time preserved), or '' to clear. Re-picking the same\n // instant is a no-op (string equality alone would leak a spurious emit for sub-second source values)\n const commitDateTime = (d: Dayjs | null) => {\n if (d && selected && d.isSame(selected, 'second')) return\n // local-wall → UTC for the wire value (or emit the wall-clock as-is when `utc={false}`)\n commit(d ? (utc ? localWallToUtc(d) : d).format(valueFormat) : '')\n }\n\n // true when `d` differs from the current value at the input's precision — gates typed-input commits\n // so a no-op round-trip (focus/blur) never rewrites an unchanged value's finer time\n const changed = (d: Dayjs) => !selected || !d.isSame(selected, timeUnit)\n\n // input display text (kept in sync with the committed value; free while typing an incomplete value)\n const [inputText, setInputText] = useState<string>(() =>\n selected ? selected.format(format) : '',\n )\n useEffect(() => {\n setInputText(selected ? selected.format(format) : '')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentValue, format, valueFormat])\n\n // ── popover ──────────────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n const [open, setOpen] = useState(false)\n const [viewMonth, setViewMonth] = useState<Dayjs>(() => selected ?? today())\n // which popover tab is active — controlled so picking a day can auto-advance to Time\n const [tab, setTab] = useState<'date' | 'time'>('date')\n const advanceRef = useRef(false) // set when a day-pick advances to Time → move focus there\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n\n const fieldBlurRef = useRef<(() => void) | undefined>(undefined)\n fieldBlurRef.current = bound\n ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>)\n : undefined\n\n // the floating panel forwards its node here, for the blur check + the auto-advance focus move\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n fieldBlurRef.current?.()\n if (refocus) inputRef.current?.focus()\n }, [])\n\n useEffect(() => {\n if (open) {\n setViewMonth(selected ?? today())\n setTab('date') // always open on the Date tab\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // after a day-pick auto-advances to the Time tab, move focus onto it so the focus trap holds\n // (the just-picked calendar cell has unmounted); a manual tab switch never triggers this\n useEffect(() => {\n if (tab === 'time' && advanceRef.current) {\n advanceRef.current = false\n popoverRef.current\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus()\n }\n }, [tab, popoverRef])\n\n const isOutOfRange = (d: Dayjs): boolean => {\n if (minDate && d.isBefore(minDate, 'day')) return true\n if (maxDate && d.isAfter(maxDate, 'day')) return true\n return Boolean(disabledDate && disabledDate(toISO(d)))\n }\n\n const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('') // emptying the field clears the value\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && !isOutOfRange(parsed) && changed(parsed)) commitDateTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('') // an emptied field stays cleared\n } else if (parsed && !isOutOfRange(parsed)) {\n if (changed(parsed)) commitDateTime(parsed)\n setInputText(parsed.format(format))\n } else {\n setInputText(selected ? selected.format(format) : '')\n }\n const nextEl = event.relatedTarget as Node | null\n if (nextEl && (popoverRef.current?.contains(nextEl) || triggerRef.current?.contains(nextEl)))\n return\n bound?.onBlur(event)\n }\n\n // picking a day keeps the current time; picking a time keeps the current day — the popover stays open\n const handleSelectDate = (iso: string) => {\n const date = parseISO(iso)\n if (!date) return\n const base = selected ?? today()\n commitDateTime(date.hour(base.hour()).minute(base.minute()).second(base.second()))\n advanceRef.current = true\n setTab('time') // picking a day advances to the Time tab\n }\n const handleTimeChange = (next: Dayjs) => commitDateTime(next)\n\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={triggerRef} className={clsx(styles.control, open && styles.open)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n className={styles.input}\n value={inputText}\n placeholder={placeholder ?? format.toLowerCase()}\n disabled={disabled}\n autoComplete=\"off\"\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={handleInputBlur}\n />\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('dateTimePicker.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n commit('')\n setInputText('')\n inputRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <IconButton\n type=\"button\"\n variant=\"text\"\n color=\"primary\"\n size={size}\n disabled={disabled}\n aria-label={t('dateTimePicker.open')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={styles.calendarButton}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"Calendar3\" size={iconSize} />\n </IconButton>\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel=\"Choose date and time\"\n trapFocus\n className={clsx(styles.popover, dt.popover)}\n >\n <Tabs\n className={dt.tabs}\n aria-label={t('dateTimePicker.label')}\n fullWidth\n autoFocus\n // the Date/Time tabs are internal popover UI — never sync them to the page URL\n queryKey={null}\n value={tab}\n onChange={(v) => setTab(v as 'date' | 'time')}\n items={[\n {\n value: 'date',\n label: t('dateTimePicker.dateTab'),\n icon: 'Calendar3',\n content: (\n <Calendar\n value={selected}\n month={viewMonth}\n onMonthChange={setViewMonth}\n onSelect={handleSelectDate}\n min={minDate}\n max={maxDate}\n disabledDate={disabledDate}\n weekStartsOn={weekStartsOn}\n labelId={labelId}\n />\n ),\n },\n {\n value: 'time',\n label: t('dateTimePicker.timeTab'),\n icon: 'Clock',\n content: (\n <div className={dt.timePane}>\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n />\n </div>\n ),\n },\n ]}\n />\n <div className={dt.footer}>\n <Button size=\"sm\" variant=\"filled\" color=\"primary\" onClick={() => closePopover(true)}>\n {t('common.done')}\n </Button>\n </div>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n },\n)\n"],"names":["defaultFormatFor","hour12","showSeconds","DateTimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","min","max","disabledDate","weekStartsOn","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","labelId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","toDisplay","instant","utcToLocalWall","selected","parseValue","resolvedError","resolvedHelperText","minDate","maxDate","mask","maskFromFormat","timeUnit","commit","next","commitDateTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","viewMonth","setViewMonth","today","tab","setTab","advanceRef","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","isOutOfRange","toISO","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleSelectDate","iso","date","parseISO","base","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","dt","Tabs","v","Calendar","TimeColumns","Button"],"mappings":"2gBAyGA,SAASA,GAAiBC,EAAiBC,EAA8B,CAQvE,MAAO,cAPMD,EACTC,EACE,aACA,UACFA,EACE,WACA,OACmB,EAC3B,CAaO,MAAMC,GAAiBC,EAAAA,WAC5B,SACE,CACE,MAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,GACA,WAAAC,GACA,SAAAC,GAAW,GACX,UAAAC,GAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,EACA,aAAAC,GACA,SAAAC,EACA,OAAQC,GACR,YAAaC,GACb,IAAAC,EAAM,GACN,OAAAhB,EAAS,GACT,WAAAiB,GAAa,EACb,YAAAhB,EAAc,GACd,YAAAiB,GACA,IAAAC,GACA,IAAAC,GACA,aAAAC,EACA,aAAAC,GAAe,EACf,UAAAC,GAAY,GACZ,KAAAC,EACA,GAAIC,GACJ,UAAAC,GACA,MAAAC,EAAA,EAEFC,EACA,CACA,MAAMC,EAAIC,GAAAA,KAAA,EACJC,GAAUC,EAAAA,MAAA,EACVC,EAAKR,IAAUM,GACfG,EAAW,GAAGD,CAAE,UAChBE,GAAU,GAAGF,CAAE,SACfG,EAAStB,IAAcf,GAAi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ACA,WAAAiB,GACA,YAAAhB,CAAA,CAAA,CACF,CACF,CAAA,CAEJ,CACF,CAAA,EAEF6G,EAAAA,IAAC,OAAI,UAAWM,KAAG,OACjB,SAAAN,MAACW,GAAAA,OAAA,CAAO,KAAK,KAAK,QAAQ,SAAS,MAAM,UAAU,QAAS,IAAMpC,EAAa,EAAI,EAChF,SAAAxD,EAAE,aAAa,CAAA,CAClB,CAAA,CACF,CAAA,CAAA,CAAA,EAGDyB,GAAsB,MACrBwD,EAAAA,IAACC,GAAAA,WAAA,CACC,GAAG,OACH,GAAI7E,EACJ,QAAQ,YACR,MAAOmB,EAAgB,QAAU,QACjC,UAAWwD,EAAAA,OAAO,OAEjB,SAAAvD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CACF"}
|
|
1
|
+
{"version":3,"file":"DateTimePicker-C3Kq5hKE.cjs","sources":["../src/components/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tabs } from '../Tabs'\nimport { Typography } from '../Typography'\nimport { Calendar } from '../DatePicker/Calendar'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseISO,\n parseInput,\n parseValue,\n today,\n toISO,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport dt from './DateTimePicker.module.css'\nimport { TimeColumns } from './TimeColumns'\n\nexport type DateTimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface DateTimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and calendar density. */\n size?: DateTimePickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a datetime string in `valueFormat` (default ISO datetime; `''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next datetime in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'DD/MM/YYYY HH:mm:ss'` (or `hh:mm:ss A`\n * when `hour12`; the `:ss` is dropped when `showSeconds` is `false`).\n */\n format?: string\n /**\n * Wire format of `value`/`defaultValue`/`onChange` (dayjs tokens), decoupled from the displayed\n * `format`. Defaults to the ISO datetime `'YYYY-MM-DDTHH:mm:ss[Z]'` when `utc` (the `Z` marks the\n * value as UTC, e.g. `'2026-06-10T09:35:00Z'`), or `'YYYY-MM-DDTHH:mm:ss'` (no `Z`) when `utc={false}`.\n * Incoming values are parsed **leniently** (this format, then any ISO-8601 string — so a backend\n * datetime like `'2026-06-10T09:35:49.6134342'` with or without `Z` is accepted).\n */\n valueFormat?: string\n /**\n * Treat the value as **UTC** and display/edit in the viewer's **local** timezone (default `true`).\n * Set `false` to disable timezone conversion entirely — the field shows and emits the value's exact\n * wall-clock (what you pick is what's sent, no UTC shift).\n */\n utc?: boolean\n /** 12-hour clock (1–12 + AM/PM) instead of 24-hour (0–23). Defaults to `false`. */\n hour12?: boolean\n /** Minute increment for the minutes column. Defaults to `1`. */\n minuteStep?: number\n /** Show the seconds column + `:ss` in the default format. Defaults to `true`; pass `false` to hide seconds. */\n showSeconds?: boolean\n /** Placeholder shown when empty. Defaults to the lowercased `format`. */\n placeholder?: string\n /** Earliest selectable date (ISO date or datetime; day-level bound on the calendar). */\n min?: string\n /** Latest selectable date (ISO date or datetime; day-level bound on the calendar). */\n max?: string\n /** Disables specific dates — receives each day as an ISO `'YYYY-MM-DD'` string. */\n disabledDate?: (date: string) => boolean\n /** First day of the week: 0 = Sunday … 6 = Saturday. Defaults to `1` (Monday). */\n weekStartsOn?: number\n /** Shows a clear (×) button when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the datetime string). */\n name?: string\n /** Id for the input (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\nfunction defaultFormatFor(hour12: boolean, showSeconds: boolean): string {\n const time = hour12\n ? showSeconds\n ? 'hh:mm:ss A'\n : 'hh:mm A'\n : showSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n return `DD/MM/YYYY ${time}`\n}\n\n/**\n * A datetime field with a typed, masked input **and** a popover combining the keyboard-navigable\n * `Calendar` (date) with scrollable time columns (hour / minute / optional second + AM/PM in 12-hour\n * mode). All math runs in **UTC** so the instant never drifts with the viewer's timezone; the value is a\n * string in `valueFormat` (UTC ISO datetime with a `Z` by default, or no `Z` when `utc={false}`) — incoming values are parsed\n * leniently (a richer backend datetime is accepted) and the chosen instant is emitted in that format.\n * Picking a date keeps the time and vice-versa, and the popover stays open until you click away,\n * press Escape, or hit Done. Supports `hour12`, `minuteStep`, `showSeconds`, `min`/`max`,\n * `disabledDate`, `weekStartsOn`, and `clearable`. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires the `dayjs` peer dependency.\n */\nexport const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(\n function DateTimePicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n format: formatProp,\n valueFormat: valueFormatProp,\n utc = true,\n hour12 = false,\n minuteStep = 1,\n showSeconds = true,\n placeholder,\n min,\n max,\n disabledDate,\n weekStartsOn = 1,\n clearable = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n ) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n const labelId = `${id}-label`\n const format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // when the value is UTC, the wire string carries a `Z` (\"…09:35:00Z\"); `utc={false}` emits the\n // bare wall-clock (no zone designator). Override either via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'YYYY-MM-DDTHH:mm:ss[Z]' : 'YYYY-MM-DDTHH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` datetime string ────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n // when `utc`, parse the UTC value and show it in the viewer's LOCAL time (value stays UTC, emit\n // converts back); when `utc={false}`, show/emit the value's exact wall-clock (no tz conversion)\n const toDisplay = (instant: Dayjs | null) => (utc ? utcToLocalWall(instant) : instant)\n const selected = toDisplay(parseValue(currentValue, valueFormat))\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const minDate = toDisplay(parseValue(min, valueFormat))\n const maxDate = toDisplay(parseValue(max, valueFormat))\n const mask = maskFromFormat(format)\n // precision the user can actually type — driven by the display `format`, not just `showSeconds`\n const timeUnit = /s/.test(format) ? 'second' : 'minute'\n\n const commit = (next: string) => {\n if (next === currentValue) return // skip redundant onChange / setValue with an unchanged value\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // emit a datetime in the wire `valueFormat` (time preserved), or '' to clear. Re-picking the same\n // instant is a no-op (string equality alone would leak a spurious emit for sub-second source values)\n const commitDateTime = (d: Dayjs | null) => {\n if (d && selected && d.isSame(selected, 'second')) return\n // local-wall → UTC for the wire value (or emit the wall-clock as-is when `utc={false}`)\n commit(d ? (utc ? localWallToUtc(d) : d).format(valueFormat) : '')\n }\n\n // true when `d` differs from the current value at the input's precision — gates typed-input commits\n // so a no-op round-trip (focus/blur) never rewrites an unchanged value's finer time\n const changed = (d: Dayjs) => !selected || !d.isSame(selected, timeUnit)\n\n // input display text (kept in sync with the committed value; free while typing an incomplete value)\n const [inputText, setInputText] = useState<string>(() =>\n selected ? selected.format(format) : '',\n )\n useEffect(() => {\n setInputText(selected ? selected.format(format) : '')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentValue, format, valueFormat])\n\n // ── popover ──────────────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n const [open, setOpen] = useState(false)\n const [viewMonth, setViewMonth] = useState<Dayjs>(() => selected ?? today())\n // which popover tab is active — controlled so picking a day can auto-advance to Time\n const [tab, setTab] = useState<'date' | 'time'>('date')\n const advanceRef = useRef(false) // set when a day-pick advances to Time → move focus there\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n\n const fieldBlurRef = useRef<(() => void) | undefined>(undefined)\n fieldBlurRef.current = bound\n ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>)\n : undefined\n\n // the floating panel forwards its node here, for the blur check + the auto-advance focus move\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n fieldBlurRef.current?.()\n if (refocus) inputRef.current?.focus()\n }, [])\n\n useEffect(() => {\n if (open) {\n setViewMonth(selected ?? today())\n setTab('date') // always open on the Date tab\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // after a day-pick auto-advances to the Time tab, move focus onto it so the focus trap holds\n // (the just-picked calendar cell has unmounted); a manual tab switch never triggers this\n useEffect(() => {\n if (tab === 'time' && advanceRef.current) {\n advanceRef.current = false\n popoverRef.current\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus()\n }\n }, [tab, popoverRef])\n\n const isOutOfRange = (d: Dayjs): boolean => {\n if (minDate && d.isBefore(minDate, 'day')) return true\n if (maxDate && d.isAfter(maxDate, 'day')) return true\n return Boolean(disabledDate && disabledDate(toISO(d)))\n }\n\n const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('') // emptying the field clears the value\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && !isOutOfRange(parsed) && changed(parsed)) commitDateTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('') // an emptied field stays cleared\n } else if (parsed && !isOutOfRange(parsed)) {\n if (changed(parsed)) commitDateTime(parsed)\n setInputText(parsed.format(format))\n } else {\n setInputText(selected ? selected.format(format) : '')\n }\n const nextEl = event.relatedTarget as Node | null\n if (nextEl && (popoverRef.current?.contains(nextEl) || triggerRef.current?.contains(nextEl)))\n return\n bound?.onBlur(event)\n }\n\n // picking a day keeps the current time; picking a time keeps the current day — the popover stays open\n const handleSelectDate = (iso: string) => {\n const date = parseISO(iso)\n if (!date) return\n const base = selected ?? today()\n commitDateTime(date.hour(base.hour()).minute(base.minute()).second(base.second()))\n advanceRef.current = true\n setTab('time') // picking a day advances to the Time tab\n }\n const handleTimeChange = (next: Dayjs) => commitDateTime(next)\n\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={triggerRef} className={clsx(styles.control, open && styles.open)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n className={styles.input}\n value={inputText}\n placeholder={placeholder ?? format.toLowerCase()}\n disabled={disabled}\n autoComplete=\"off\"\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={handleInputBlur}\n />\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('dateTimePicker.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n commit('')\n setInputText('')\n inputRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <IconButton\n type=\"button\"\n variant=\"text\"\n color=\"primary\"\n size={size}\n disabled={disabled}\n aria-label={t('dateTimePicker.open')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={styles.calendarButton}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"Calendar3\" size={iconSize} />\n </IconButton>\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel=\"Choose date and time\"\n trapFocus\n className={clsx(styles.popover, dt.popover)}\n >\n <Tabs\n className={dt.tabs}\n aria-label={t('dateTimePicker.label')}\n fullWidth\n autoFocus\n // the Date/Time tabs are internal popover UI — never sync them to the page URL\n queryKey={null}\n value={tab}\n onChange={(v) => setTab(v as 'date' | 'time')}\n items={[\n {\n value: 'date',\n label: t('dateTimePicker.dateTab'),\n icon: 'Calendar3',\n content: (\n <Calendar\n value={selected}\n month={viewMonth}\n onMonthChange={setViewMonth}\n onSelect={handleSelectDate}\n min={minDate}\n max={maxDate}\n disabledDate={disabledDate}\n weekStartsOn={weekStartsOn}\n labelId={labelId}\n />\n ),\n },\n {\n value: 'time',\n label: t('dateTimePicker.timeTab'),\n icon: 'Clock',\n content: (\n <div className={dt.timePane}>\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n />\n </div>\n ),\n },\n ]}\n />\n <div className={dt.footer}>\n <Button size=\"sm\" variant=\"filled\" color=\"primary\" onClick={() => closePopover(true)}>\n {t('common.done')}\n </Button>\n </div>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n },\n)\n"],"names":["defaultFormatFor","hour12","showSeconds","DateTimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","min","max","disabledDate","weekStartsOn","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","labelId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","toDisplay","instant","utcToLocalWall","selected","parseValue","resolvedError","resolvedHelperText","minDate","maxDate","mask","maskFromFormat","timeUnit","commit","next","commitDateTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","viewMonth","setViewMonth","today","tab","setTab","advanceRef","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","isOutOfRange","toISO","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleSelectDate","iso","date","parseISO","base","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","dt","Tabs","v","Calendar","TimeColumns","Button"],"mappings":"2gBAyGA,SAASA,GAAiBC,EAAiBC,EAA8B,CAQvE,MAA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KC,EAAAA,OAAO,QAASO,EAAAA,GAAG,OAAO,EAE1C,SAAA,CAAAN,EAAAA,IAACO,GAAAA,KAAA,CACC,UAAWD,EAAAA,GAAG,KACd,aAAYvF,EAAE,sBAAsB,EACpC,UAAS,GACT,UAAS,GAET,SAAU,KACV,MAAOgD,EACP,SAAWyC,GAAMxC,EAAOwC,CAAoB,EAC5C,MAAO,CACL,CACE,MAAO,OACP,MAAOzF,EAAE,wBAAwB,EACjC,KAAM,YACN,QACEiF,EAAAA,IAACS,GAAAA,SAAA,CACC,MAAOpE,EACP,MAAOuB,GACP,cAAeC,EACf,SAAUyB,GACV,IAAK7C,EACL,IAAKC,EACL,aAAAnC,EACA,aAAAC,GACA,QAAAa,EAAA,CAAA,CACF,EAGJ,CACE,MAAO,OACP,MAAON,EAAE,wBAAwB,EACjC,KAAM,QACN,QACEiF,EAAAA,IAAC,MAAA,CAAI,UAAWM,KAAG,SACjB,SAAAN,EAAAA,IAACU,EAAAA,YAAA,CACC,MAAOrE,EACP,SAAUsD,GACV,OAAAzG,EACA,WAAAiB,GACA,YAAAhB,CAAA,CAAA,CACF,CACF,CAAA,CAEJ,CACF,CAAA,EAEF6G,EAAAA,IAAC,OAAI,UAAWM,KAAG,OACjB,SAAAN,MAACW,GAAAA,OAAA,CAAO,KAAK,KAAK,QAAQ,SAAS,MAAM,UAAU,QAAS,IAAMpC,EAAa,EAAI,EAChF,SAAAxD,EAAE,aAAa,CAAA,CAClB,CAAA,CACF,CAAA,CAAA,CAAA,EAGDyB,GAAsB,MACrBwD,EAAAA,IAACC,GAAAA,WAAA,CACC,GAAG,OACH,GAAI7E,EACJ,QAAQ,YACR,MAAOmB,EAAgB,QAAU,QACjC,UAAWwD,EAAAA,OAAO,OAEjB,SAAAvD,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CACF"}
|
|
@@ -3,15 +3,15 @@ import { forwardRef as Ae, useId as Ee, useState as h, useEffect as j, useRef as
|
|
|
3
3
|
import { clsx as z } from "clsx";
|
|
4
4
|
import { u as Le } from "./formContext-B7ln1Miy.js";
|
|
5
5
|
import { F as $e } from "./FloatingPanel-C5c_eMQ0.js";
|
|
6
|
-
import { B as je } from "./Button-
|
|
6
|
+
import { B as je } from "./Button-BJ5Xd10u.js";
|
|
7
7
|
import { I as le } from "./Icon-CGQ5yGSZ.js";
|
|
8
|
-
import { I as ze } from "./IconButton-
|
|
9
|
-
import { T as Ue } from "./Tabs-
|
|
8
|
+
import { I as ze } from "./IconButton-CqFgam3J.js";
|
|
9
|
+
import { T as Ue } from "./Tabs-RjyUkLTB.js";
|
|
10
10
|
import { T as ie } from "./Typography-CJv5AnRP.js";
|
|
11
|
-
import { C as Ke } from "./Calendar-
|
|
11
|
+
import { C as Ke } from "./Calendar-rRPnaU9M.js";
|
|
12
12
|
import { p as U, m as Ze, t as K, s, u as Ge, b as ce, c as Je, a as Qe, l as Xe, d as _e } from "./DatePicker.module-CMMQyEhG.js";
|
|
13
|
-
import { d as N, T as et } from "./TimeColumns-
|
|
14
|
-
import { a as tt } from "./ConfigProvider-
|
|
13
|
+
import { d as N, T as et } from "./TimeColumns-fD6dosYP.js";
|
|
14
|
+
import { a as tt } from "./ConfigProvider-D2svpXFu.js";
|
|
15
15
|
function at(Z, c) {
|
|
16
16
|
return `DD/MM/YYYY ${Z ? c ? "hh:mm:ss A" : "hh:mm A" : c ? "HH:mm:ss" : "HH:mm"}`;
|
|
17
17
|
}
|
|
@@ -242,4 +242,4 @@ const Tt = Ae(
|
|
|
242
242
|
export {
|
|
243
243
|
Tt as D
|
|
244
244
|
};
|
|
245
|
-
//# sourceMappingURL=DateTimePicker-
|
|
245
|
+
//# sourceMappingURL=DateTimePicker-DdXFzqO_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimePicker-M2UBjFVc.js","sources":["../src/components/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tabs } from '../Tabs'\nimport { Typography } from '../Typography'\nimport { Calendar } from '../DatePicker/Calendar'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseISO,\n parseInput,\n parseValue,\n today,\n toISO,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport dt from './DateTimePicker.module.css'\nimport { TimeColumns } from './TimeColumns'\n\nexport type DateTimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface DateTimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and calendar density. */\n size?: DateTimePickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a datetime string in `valueFormat` (default ISO datetime; `''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next datetime in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'DD/MM/YYYY HH:mm:ss'` (or `hh:mm:ss A`\n * when `hour12`; the `:ss` is dropped when `showSeconds` is `false`).\n */\n format?: string\n /**\n * Wire format of `value`/`defaultValue`/`onChange` (dayjs tokens), decoupled from the displayed\n * `format`. Defaults to the ISO datetime `'YYYY-MM-DDTHH:mm:ss[Z]'` when `utc` (the `Z` marks the\n * value as UTC, e.g. `'2026-06-10T09:35:00Z'`), or `'YYYY-MM-DDTHH:mm:ss'` (no `Z`) when `utc={false}`.\n * Incoming values are parsed **leniently** (this format, then any ISO-8601 string — so a backend\n * datetime like `'2026-06-10T09:35:49.6134342'` with or without `Z` is accepted).\n */\n valueFormat?: string\n /**\n * Treat the value as **UTC** and display/edit in the viewer's **local** timezone (default `true`).\n * Set `false` to disable timezone conversion entirely — the field shows and emits the value's exact\n * wall-clock (what you pick is what's sent, no UTC shift).\n */\n utc?: boolean\n /** 12-hour clock (1–12 + AM/PM) instead of 24-hour (0–23). Defaults to `false`. */\n hour12?: boolean\n /** Minute increment for the minutes column. Defaults to `1`. */\n minuteStep?: number\n /** Show the seconds column + `:ss` in the default format. Defaults to `true`; pass `false` to hide seconds. */\n showSeconds?: boolean\n /** Placeholder shown when empty. Defaults to the lowercased `format`. */\n placeholder?: string\n /** Earliest selectable date (ISO date or datetime; day-level bound on the calendar). */\n min?: string\n /** Latest selectable date (ISO date or datetime; day-level bound on the calendar). */\n max?: string\n /** Disables specific dates — receives each day as an ISO `'YYYY-MM-DD'` string. */\n disabledDate?: (date: string) => boolean\n /** First day of the week: 0 = Sunday … 6 = Saturday. Defaults to `1` (Monday). */\n weekStartsOn?: number\n /** Shows a clear (×) button when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the datetime string). */\n name?: string\n /** Id for the input (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\nfunction defaultFormatFor(hour12: boolean, showSeconds: boolean): string {\n const time = hour12\n ? showSeconds\n ? 'hh:mm:ss A'\n : 'hh:mm A'\n : showSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n return `DD/MM/YYYY ${time}`\n}\n\n/**\n * A datetime field with a typed, masked input **and** a popover combining the keyboard-navigable\n * `Calendar` (date) with scrollable time columns (hour / minute / optional second + AM/PM in 12-hour\n * mode). All math runs in **UTC** so the instant never drifts with the viewer's timezone; the value is a\n * string in `valueFormat` (UTC ISO datetime with a `Z` by default, or no `Z` when `utc={false}`) — incoming values are parsed\n * leniently (a richer backend datetime is accepted) and the chosen instant is emitted in that format.\n * Picking a date keeps the time and vice-versa, and the popover stays open until you click away,\n * press Escape, or hit Done. Supports `hour12`, `minuteStep`, `showSeconds`, `min`/`max`,\n * `disabledDate`, `weekStartsOn`, and `clearable`. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires the `dayjs` peer dependency.\n */\nexport const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(\n function DateTimePicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n format: formatProp,\n valueFormat: valueFormatProp,\n utc = true,\n hour12 = false,\n minuteStep = 1,\n showSeconds = true,\n placeholder,\n min,\n max,\n disabledDate,\n weekStartsOn = 1,\n clearable = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n ) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n const labelId = `${id}-label`\n const format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // when the value is UTC, the wire string carries a `Z` (\"…09:35:00Z\"); `utc={false}` emits the\n // bare wall-clock (no zone designator). Override either via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'YYYY-MM-DDTHH:mm:ss[Z]' : 'YYYY-MM-DDTHH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` datetime string ────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n // when `utc`, parse the UTC value and show it in the viewer's LOCAL time (value stays UTC, emit\n // converts back); when `utc={false}`, show/emit the value's exact wall-clock (no tz conversion)\n const toDisplay = (instant: Dayjs | null) => (utc ? utcToLocalWall(instant) : instant)\n const selected = toDisplay(parseValue(currentValue, valueFormat))\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const minDate = toDisplay(parseValue(min, valueFormat))\n const maxDate = toDisplay(parseValue(max, valueFormat))\n const mask = maskFromFormat(format)\n // precision the user can actually type — driven by the display `format`, not just `showSeconds`\n const timeUnit = /s/.test(format) ? 'second' : 'minute'\n\n const commit = (next: string) => {\n if (next === currentValue) return // skip redundant onChange / setValue with an unchanged value\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // emit a datetime in the wire `valueFormat` (time preserved), or '' to clear. Re-picking the same\n // instant is a no-op (string equality alone would leak a spurious emit for sub-second source values)\n const commitDateTime = (d: Dayjs | null) => {\n if (d && selected && d.isSame(selected, 'second')) return\n // local-wall → UTC for the wire value (or emit the wall-clock as-is when `utc={false}`)\n commit(d ? (utc ? localWallToUtc(d) : d).format(valueFormat) : '')\n }\n\n // true when `d` differs from the current value at the input's precision — gates typed-input commits\n // so a no-op round-trip (focus/blur) never rewrites an unchanged value's finer time\n const changed = (d: Dayjs) => !selected || !d.isSame(selected, timeUnit)\n\n // input display text (kept in sync with the committed value; free while typing an incomplete value)\n const [inputText, setInputText] = useState<string>(() =>\n selected ? selected.format(format) : '',\n )\n useEffect(() => {\n setInputText(selected ? selected.format(format) : '')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentValue, format, valueFormat])\n\n // ── popover ──────────────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n const [open, setOpen] = useState(false)\n const [viewMonth, setViewMonth] = useState<Dayjs>(() => selected ?? today())\n // which popover tab is active — controlled so picking a day can auto-advance to Time\n const [tab, setTab] = useState<'date' | 'time'>('date')\n const advanceRef = useRef(false) // set when a day-pick advances to Time → move focus there\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n\n const fieldBlurRef = useRef<(() => void) | undefined>(undefined)\n fieldBlurRef.current = bound\n ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>)\n : undefined\n\n // the floating panel forwards its node here, for the blur check + the auto-advance focus move\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n fieldBlurRef.current?.()\n if (refocus) inputRef.current?.focus()\n }, [])\n\n useEffect(() => {\n if (open) {\n setViewMonth(selected ?? today())\n setTab('date') // always open on the Date tab\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // after a day-pick auto-advances to the Time tab, move focus onto it so the focus trap holds\n // (the just-picked calendar cell has unmounted); a manual tab switch never triggers this\n useEffect(() => {\n if (tab === 'time' && advanceRef.current) {\n advanceRef.current = false\n popoverRef.current\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus()\n }\n }, [tab, popoverRef])\n\n const isOutOfRange = (d: Dayjs): boolean => {\n if (minDate && d.isBefore(minDate, 'day')) return true\n if (maxDate && d.isAfter(maxDate, 'day')) return true\n return Boolean(disabledDate && disabledDate(toISO(d)))\n }\n\n const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('') // emptying the field clears the value\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && !isOutOfRange(parsed) && changed(parsed)) commitDateTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('') // an emptied field stays cleared\n } else if (parsed && !isOutOfRange(parsed)) {\n if (changed(parsed)) commitDateTime(parsed)\n setInputText(parsed.format(format))\n } else {\n setInputText(selected ? selected.format(format) : '')\n }\n const nextEl = event.relatedTarget as Node | null\n if (nextEl && (popoverRef.current?.contains(nextEl) || triggerRef.current?.contains(nextEl)))\n return\n bound?.onBlur(event)\n }\n\n // picking a day keeps the current time; picking a time keeps the current day — the popover stays open\n const handleSelectDate = (iso: string) => {\n const date = parseISO(iso)\n if (!date) return\n const base = selected ?? today()\n commitDateTime(date.hour(base.hour()).minute(base.minute()).second(base.second()))\n advanceRef.current = true\n setTab('time') // picking a day advances to the Time tab\n }\n const handleTimeChange = (next: Dayjs) => commitDateTime(next)\n\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={triggerRef} className={clsx(styles.control, open && styles.open)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n className={styles.input}\n value={inputText}\n placeholder={placeholder ?? format.toLowerCase()}\n disabled={disabled}\n autoComplete=\"off\"\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={handleInputBlur}\n />\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('dateTimePicker.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n commit('')\n setInputText('')\n inputRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <IconButton\n type=\"button\"\n variant=\"text\"\n color=\"primary\"\n size={size}\n disabled={disabled}\n aria-label={t('dateTimePicker.open')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={styles.calendarButton}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"Calendar3\" size={iconSize} />\n </IconButton>\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel=\"Choose date and time\"\n trapFocus\n className={clsx(styles.popover, dt.popover)}\n >\n <Tabs\n className={dt.tabs}\n aria-label={t('dateTimePicker.label')}\n fullWidth\n autoFocus\n // the Date/Time tabs are internal popover UI — never sync them to the page URL\n queryKey={null}\n value={tab}\n onChange={(v) => setTab(v as 'date' | 'time')}\n items={[\n {\n value: 'date',\n label: t('dateTimePicker.dateTab'),\n icon: 'Calendar3',\n content: (\n <Calendar\n value={selected}\n month={viewMonth}\n onMonthChange={setViewMonth}\n onSelect={handleSelectDate}\n min={minDate}\n max={maxDate}\n disabledDate={disabledDate}\n weekStartsOn={weekStartsOn}\n labelId={labelId}\n />\n ),\n },\n {\n value: 'time',\n label: t('dateTimePicker.timeTab'),\n icon: 'Clock',\n content: (\n <div className={dt.timePane}>\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n />\n </div>\n ),\n },\n ]}\n />\n <div className={dt.footer}>\n <Button size=\"sm\" variant=\"filled\" color=\"primary\" onClick={() => closePopover(true)}>\n {t('common.done')}\n </Button>\n </div>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n },\n)\n"],"names":["defaultFormatFor","hour12","showSeconds","DateTimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","min","max","disabledDate","weekStartsOn","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","labelId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","toDisplay","instant","utcToLocalWall","selected","parseValue","resolvedError","resolvedHelperText","minDate","maxDate","mask","maskFromFormat","timeUnit","commit","next","commitDateTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","viewMonth","setViewMonth","today","tab","setTab","advanceRef","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","isOutOfRange","toISO","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleSelectDate","iso","date","parseISO","base","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","dt","Tabs","v","Calendar","TimeColumns","Button"],"mappings":";;;;;;;;;;;;;;AAyGA,SAASA,GAAiBC,GAAiBC,GAA8B;AAQvE,SAAO,cAPMD,IACTC,IACE,eACA,YACFA,IACE,aACA,OACmB;AAC3B;AAaO,MAAMC,KAAiBC;AAAA,EAC5B,SACE;AAAA,IACE,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC,KAAW;AAAA,IACX,WAAAC,KAAY;AAAA,IACZ,UAAAC,IAAW;AAAA,IACX,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,IACA,QAAQC;AAAA,IACR,aAAaC;AAAA,IACb,KAAAC,IAAM;AAAA,IACN,QAAAhB,IAAS;AAAA,IACT,YAAAiB,KAAa;AAAA,IACb,aAAAhB,IAAc;AAAA,IACd,aAAAiB;AAAA,IACA,KAAAC;AAAA,IACA,KAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC,KAAe;AAAA,IACf,WAAAC,KAAY;AAAA,IACZ,MAAAC;AAAA,IACA,IAAIC;AAAA,IACJ,WAAAC;AAAA,IACA,O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AA,YAAA;AAAA,UAAA;AAAA,UAGDyB,KAAsB,QACrB,gBAAAwD;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,IAAG;AAAA,cACH,IAAI7E;AAAA,cACJ,SAAQ;AAAA,cACR,OAAOmB,IAAgB,UAAU;AAAA,cACjC,WAAWwD,EAAO;AAAA,cAEjB,UAAAvD;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;"}
|
|
1
|
+
{"version":3,"file":"DateTimePicker-DdXFzqO_.js","sources":["../src/components/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type FocusEvent,\n type ReactNode,\n} from 'react'\nimport { clsx } from 'clsx'\nimport { useT } from '../../theme'\nimport { useFormContext } from '../../form/formContext'\nimport { FloatingPanel } from '../FloatingPanel/FloatingPanel'\nimport { Button } from '../Button'\nimport { Icon } from '../Icon'\nimport { IconButton } from '../IconButton'\nimport { Tabs } from '../Tabs'\nimport { Typography } from '../Typography'\nimport { Calendar } from '../DatePicker/Calendar'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseISO,\n parseInput,\n parseValue,\n today,\n toISO,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport dt from './DateTimePicker.module.css'\nimport { TimeColumns } from './TimeColumns'\n\nexport type DateTimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface DateTimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and calendar density. */\n size?: DateTimePickerSize\n /** Marks the field invalid: red border/ring + the `helperText` in the error color. */\n error?: boolean\n /** Helper / validation text under the field. Adopts the error color while `error`. */\n helperText?: ReactNode\n /** Adds a red asterisk after the label. */\n required?: boolean\n /** Stretches the field to fill its container width. Defaults to `true`. */\n fullWidth?: boolean\n /** Disables the field. */\n disabled?: boolean\n /** Controlled value — a datetime string in `valueFormat` (default ISO datetime; `''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next datetime in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'DD/MM/YYYY HH:mm:ss'` (or `hh:mm:ss A`\n * when `hour12`; the `:ss` is dropped when `showSeconds` is `false`).\n */\n format?: string\n /**\n * Wire format of `value`/`defaultValue`/`onChange` (dayjs tokens), decoupled from the displayed\n * `format`. Defaults to the ISO datetime `'YYYY-MM-DDTHH:mm:ss[Z]'` when `utc` (the `Z` marks the\n * value as UTC, e.g. `'2026-06-10T09:35:00Z'`), or `'YYYY-MM-DDTHH:mm:ss'` (no `Z`) when `utc={false}`.\n * Incoming values are parsed **leniently** (this format, then any ISO-8601 string — so a backend\n * datetime like `'2026-06-10T09:35:49.6134342'` with or without `Z` is accepted).\n */\n valueFormat?: string\n /**\n * Treat the value as **UTC** and display/edit in the viewer's **local** timezone (default `true`).\n * Set `false` to disable timezone conversion entirely — the field shows and emits the value's exact\n * wall-clock (what you pick is what's sent, no UTC shift).\n */\n utc?: boolean\n /** 12-hour clock (1–12 + AM/PM) instead of 24-hour (0–23). Defaults to `false`. */\n hour12?: boolean\n /** Minute increment for the minutes column. Defaults to `1`. */\n minuteStep?: number\n /** Show the seconds column + `:ss` in the default format. Defaults to `true`; pass `false` to hide seconds. */\n showSeconds?: boolean\n /** Placeholder shown when empty. Defaults to the lowercased `format`. */\n placeholder?: string\n /** Earliest selectable date (ISO date or datetime; day-level bound on the calendar). */\n min?: string\n /** Latest selectable date (ISO date or datetime; day-level bound on the calendar). */\n max?: string\n /** Disables specific dates — receives each day as an ISO `'YYYY-MM-DD'` string. */\n disabledDate?: (date: string) => boolean\n /** First day of the week: 0 = Sunday … 6 = Saturday. Defaults to `1` (Monday). */\n weekStartsOn?: number\n /** Shows a clear (×) button when a value is set. Defaults to `true`. */\n clearable?: boolean\n /** Form field name — auto-binds to a surrounding `<Form>` (value is the datetime string). */\n name?: string\n /** Id for the input (label association). */\n id?: string\n className?: string\n style?: CSSProperties\n}\n\nfunction defaultFormatFor(hour12: boolean, showSeconds: boolean): string {\n const time = hour12\n ? showSeconds\n ? 'hh:mm:ss A'\n : 'hh:mm A'\n : showSeconds\n ? 'HH:mm:ss'\n : 'HH:mm'\n return `DD/MM/YYYY ${time}`\n}\n\n/**\n * A datetime field with a typed, masked input **and** a popover combining the keyboard-navigable\n * `Calendar` (date) with scrollable time columns (hour / minute / optional second + AM/PM in 12-hour\n * mode). All math runs in **UTC** so the instant never drifts with the viewer's timezone; the value is a\n * string in `valueFormat` (UTC ISO datetime with a `Z` by default, or no `Z` when `utc={false}`) — incoming values are parsed\n * leniently (a richer backend datetime is accepted) and the chosen instant is emitted in that format.\n * Picking a date keeps the time and vice-versa, and the popover stays open until you click away,\n * press Escape, or hit Done. Supports `hour12`, `minuteStep`, `showSeconds`, `min`/`max`,\n * `disabledDate`, `weekStartsOn`, and `clearable`. Controlled (`value` + `onChange`) or uncontrolled\n * (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires the `dayjs` peer dependency.\n */\nexport const DateTimePicker = forwardRef<HTMLInputElement, DateTimePickerProps>(\n function DateTimePicker(\n {\n label,\n size = 'md',\n error,\n helperText,\n required = false,\n fullWidth = true,\n disabled = false,\n value,\n defaultValue,\n onChange,\n format: formatProp,\n valueFormat: valueFormatProp,\n utc = true,\n hour12 = false,\n minuteStep = 1,\n showSeconds = true,\n placeholder,\n min,\n max,\n disabledDate,\n weekStartsOn = 1,\n clearable = true,\n name,\n id: idProp,\n className,\n style,\n },\n ref,\n ) {\n const t = useT()\n const reactId = useId()\n const id = idProp ?? reactId\n const helperId = `${id}-helper`\n const labelId = `${id}-label`\n const format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // when the value is UTC, the wire string carries a `Z` (\"…09:35:00Z\"); `utc={false}` emits the\n // bare wall-clock (no zone designator). Override either via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'YYYY-MM-DDTHH:mm:ss[Z]' : 'YYYY-MM-DDTHH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` datetime string ────────────\n const form = useFormContext()\n const isFormBound = Boolean(form && name)\n const bound = isFormBound ? form!.field(name!) : undefined\n const externalValue =\n value !== undefined\n ? value\n : isFormBound\n ? ((form!.values[name!] as string | undefined) ?? '')\n : undefined\n const isControlled = value !== undefined || isFormBound\n const [internal, setInternal] = useState<string>(defaultValue ?? '')\n const currentValue = isControlled ? externalValue! : internal\n // when `utc`, parse the UTC value and show it in the viewer's LOCAL time (value stays UTC, emit\n // converts back); when `utc={false}`, show/emit the value's exact wall-clock (no tz conversion)\n const toDisplay = (instant: Dayjs | null) => (utc ? utcToLocalWall(instant) : instant)\n const selected = toDisplay(parseValue(currentValue, valueFormat))\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const minDate = toDisplay(parseValue(min, valueFormat))\n const maxDate = toDisplay(parseValue(max, valueFormat))\n const mask = maskFromFormat(format)\n // precision the user can actually type — driven by the display `format`, not just `showSeconds`\n const timeUnit = /s/.test(format) ? 'second' : 'minute'\n\n const commit = (next: string) => {\n if (next === currentValue) return // skip redundant onChange / setValue with an unchanged value\n if (!isControlled) setInternal(next)\n if (isFormBound) form!.setValue(name!, next)\n onChange?.(next)\n }\n\n // emit a datetime in the wire `valueFormat` (time preserved), or '' to clear. Re-picking the same\n // instant is a no-op (string equality alone would leak a spurious emit for sub-second source values)\n const commitDateTime = (d: Dayjs | null) => {\n if (d && selected && d.isSame(selected, 'second')) return\n // local-wall → UTC for the wire value (or emit the wall-clock as-is when `utc={false}`)\n commit(d ? (utc ? localWallToUtc(d) : d).format(valueFormat) : '')\n }\n\n // true when `d` differs from the current value at the input's precision — gates typed-input commits\n // so a no-op round-trip (focus/blur) never rewrites an unchanged value's finer time\n const changed = (d: Dayjs) => !selected || !d.isSame(selected, timeUnit)\n\n // input display text (kept in sync with the committed value; free while typing an incomplete value)\n const [inputText, setInputText] = useState<string>(() =>\n selected ? selected.format(format) : '',\n )\n useEffect(() => {\n setInputText(selected ? selected.format(format) : '')\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [currentValue, format, valueFormat])\n\n // ── popover ──────────────────────────────────────────────────────────────────────────────────\n const triggerRef = useRef<HTMLDivElement | null>(null)\n const inputRef = useRef<HTMLInputElement | null>(null)\n const [open, setOpen] = useState(false)\n const [viewMonth, setViewMonth] = useState<Dayjs>(() => selected ?? today())\n // which popover tab is active — controlled so picking a day can auto-advance to Time\n const [tab, setTab] = useState<'date' | 'time'>('date')\n const advanceRef = useRef(false) // set when a day-pick advances to Time → move focus there\n\n const setInputRef = useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node\n if (typeof ref === 'function') ref(node)\n else if (ref) (ref as { current: HTMLInputElement | null }).current = node\n },\n [ref],\n )\n\n const fieldBlurRef = useRef<(() => void) | undefined>(undefined)\n fieldBlurRef.current = bound\n ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>)\n : undefined\n\n // the floating panel forwards its node here, for the blur check + the auto-advance focus move\n const popoverRef = useRef<HTMLDivElement | null>(null)\n\n const closePopover = useCallback((refocus: boolean) => {\n setOpen(false)\n fieldBlurRef.current?.()\n if (refocus) inputRef.current?.focus()\n }, [])\n\n useEffect(() => {\n if (open) {\n setViewMonth(selected ?? today())\n setTab('date') // always open on the Date tab\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open])\n\n // after a day-pick auto-advances to the Time tab, move focus onto it so the focus trap holds\n // (the just-picked calendar cell has unmounted); a manual tab switch never triggers this\n useEffect(() => {\n if (tab === 'time' && advanceRef.current) {\n advanceRef.current = false\n popoverRef.current\n ?.querySelector<HTMLElement>('[role=\"tab\"][aria-selected=\"true\"]')\n ?.focus()\n }\n }, [tab, popoverRef])\n\n const isOutOfRange = (d: Dayjs): boolean => {\n if (minDate && d.isBefore(minDate, 'day')) return true\n if (maxDate && d.isAfter(maxDate, 'day')) return true\n return Boolean(disabledDate && disabledDate(toISO(d)))\n }\n\n const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('') // emptying the field clears the value\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && !isOutOfRange(parsed) && changed(parsed)) commitDateTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('') // an emptied field stays cleared\n } else if (parsed && !isOutOfRange(parsed)) {\n if (changed(parsed)) commitDateTime(parsed)\n setInputText(parsed.format(format))\n } else {\n setInputText(selected ? selected.format(format) : '')\n }\n const nextEl = event.relatedTarget as Node | null\n if (nextEl && (popoverRef.current?.contains(nextEl) || triggerRef.current?.contains(nextEl)))\n return\n bound?.onBlur(event)\n }\n\n // picking a day keeps the current time; picking a time keeps the current day — the popover stays open\n const handleSelectDate = (iso: string) => {\n const date = parseISO(iso)\n if (!date) return\n const base = selected ?? today()\n commitDateTime(date.hour(base.hour()).minute(base.minute()).second(base.second()))\n advanceRef.current = true\n setTab('time') // picking a day advances to the Time tab\n }\n const handleTimeChange = (next: Dayjs) => commitDateTime(next)\n\n const iconSize: 'sm' | 'md' = size === 'sm' ? 'sm' : 'md'\n\n return (\n <div\n className={clsx(\n styles.field,\n styles[size],\n fullWidth && styles.fullWidth,\n resolvedError && styles.error,\n disabled && styles.disabled,\n className,\n )}\n style={style}\n >\n {label != null && (\n <label htmlFor={id} className={styles.label}>\n <Typography as=\"span\" variant=\"bodySmall\" color=\"muted\">\n {label}\n </Typography>\n {required && (\n <span className={styles.required} aria-hidden=\"true\">\n *\n </span>\n )}\n </label>\n )}\n\n <div ref={triggerRef} className={clsx(styles.control, open && styles.open)}>\n <input\n ref={setInputRef}\n id={id}\n name={name}\n className={styles.input}\n value={inputText}\n placeholder={placeholder ?? format.toLowerCase()}\n disabled={disabled}\n autoComplete=\"off\"\n aria-invalid={resolvedError || undefined}\n aria-describedby={resolvedHelperText != null ? helperId : undefined}\n onChange={(e) => handleInputChange(e.target.value)}\n onBlur={handleInputBlur}\n />\n\n {clearable && currentValue !== '' && !disabled && (\n <button\n type=\"button\"\n className={styles.clear}\n aria-label={t('dateTimePicker.clear')}\n tabIndex={-1}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => {\n commit('')\n setInputText('')\n inputRef.current?.focus()\n }}\n >\n <Icon name=\"CloseCircle\" size=\"sm\" />\n </button>\n )}\n\n <IconButton\n type=\"button\"\n variant=\"text\"\n color=\"primary\"\n size={size}\n disabled={disabled}\n aria-label={t('dateTimePicker.open')}\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n className={styles.calendarButton}\n onMouseDown={(e) => e.preventDefault()}\n onClick={() => setOpen((o) => !o)}\n >\n <Icon name=\"Calendar3\" size={iconSize} />\n </IconButton>\n </div>\n\n <FloatingPanel\n ref={popoverRef}\n open={open}\n triggerRef={triggerRef}\n onClose={closePopover}\n role=\"dialog\"\n ariaLabel=\"Choose date and time\"\n trapFocus\n className={clsx(styles.popover, dt.popover)}\n >\n <Tabs\n className={dt.tabs}\n aria-label={t('dateTimePicker.label')}\n fullWidth\n autoFocus\n // the Date/Time tabs are internal popover UI — never sync them to the page URL\n queryKey={null}\n value={tab}\n onChange={(v) => setTab(v as 'date' | 'time')}\n items={[\n {\n value: 'date',\n label: t('dateTimePicker.dateTab'),\n icon: 'Calendar3',\n content: (\n <Calendar\n value={selected}\n month={viewMonth}\n onMonthChange={setViewMonth}\n onSelect={handleSelectDate}\n min={minDate}\n max={maxDate}\n disabledDate={disabledDate}\n weekStartsOn={weekStartsOn}\n labelId={labelId}\n />\n ),\n },\n {\n value: 'time',\n label: t('dateTimePicker.timeTab'),\n icon: 'Clock',\n content: (\n <div className={dt.timePane}>\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n />\n </div>\n ),\n },\n ]}\n />\n <div className={dt.footer}>\n <Button size=\"sm\" variant=\"filled\" color=\"primary\" onClick={() => closePopover(true)}>\n {t('common.done')}\n </Button>\n </div>\n </FloatingPanel>\n\n {resolvedHelperText != null && (\n <Typography\n as=\"span\"\n id={helperId}\n variant=\"bodySmall\"\n color={resolvedError ? 'error' : 'muted'}\n className={styles.helper}\n >\n {resolvedHelperText}\n </Typography>\n )}\n </div>\n )\n },\n)\n"],"names":["defaultFormatFor","hour12","showSeconds","DateTimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","min","max","disabledDate","weekStartsOn","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","labelId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","toDisplay","instant","utcToLocalWall","selected","parseValue","resolvedError","resolvedHelperText","minDate","maxDate","mask","maskFromFormat","timeUnit","commit","next","commitDateTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","viewMonth","setViewMonth","today","tab","setTab","advanceRef","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","isOutOfRange","toISO","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleSelectDate","iso","date","parseISO","base","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","dt","Tabs","v","Calendar","TimeColumns","Button"],"mappings":";;;;;;;;;;;;;;AAyGA,SAASA,GAAiBC,GAAiBC,GAA8B;AAQvE,SAAO,cAPMD,IACTC,IACE,eACA,YACFA,IACE,aACA,OACmB;AAC3B;AAaO,MAAMC,KAAiBC;AAAA,EAC5B,SACE;AAAA,IACE,OAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,OAAAC;AAAA,IACA,YAAAC;A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UACjB,UAAA,gBAAAN;AAAA,0BAACU;AAAA,0BAAA;AAAA,4BACC,OAAOrE;AAAA,4BACP,UAAUsD;AAAA,4BACV,QAAAzG;AAAA,4BACA,YAAAiB;AAAA,4BACA,aAAAhB;AAAA,0BAAA;AAAA,wBAAA,EACF,CACF;AAAA,sBAAA;AAAA,oBAEJ;AAAA,kBACF;AAAA,gBAAA;AAAA,gBAEF,gBAAA6G,EAAC,SAAI,WAAWM,EAAG,QACjB,UAAA,gBAAAN,EAACW,IAAA,EAAO,MAAK,MAAK,SAAQ,UAAS,OAAM,WAAU,SAAS,MAAMpC,GAAa,EAAI,GAChF,UAAAxD,EAAE,aAAa,EAAA,CAClB,EAAA,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UAGDyB,KAAsB,QACrB,gBAAAwD;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,IAAG;AAAA,cACH,IAAI7E;AAAA,cACJ,SAAQ;AAAA,cACR,OAAOmB,IAAgB,UAAU;AAAA,cACjC,WAAWwD,EAAO;AAAA,cAEjB,UAAAvD;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),M=require("react"),R=require("clsx"),G=require("./breakpoints-Dpnh6BbG.cjs"),J=require("./useMediaQuery-CHMrI6Dy.cjs"),K=require("./names-YOCJ4B5J.cjs"),V=require("./Icon-BUP5_kRs.cjs"),X=require("./CopyButton-
|
|
2
|
-
//# sourceMappingURL=DescriptionList-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),M=require("react"),R=require("clsx"),G=require("./breakpoints-Dpnh6BbG.cjs"),J=require("./useMediaQuery-CHMrI6Dy.cjs"),K=require("./names-YOCJ4B5J.cjs"),V=require("./Icon-BUP5_kRs.cjs"),X=require("./CopyButton-DUtx2-Gi.cjs"),Y=require("./IconButton-V8tjArlt.cjs"),S=require("./Skeleton-DK0lAjS9.cjs"),q=require("./Typography-B6ASPrzT.cjs"),Z=require("./ConfigProvider-CzAQf_d_.cjs"),W="_root_10k89_4",ee="_sm_10k89_14",se="_md_10k89_22",te="_lg_10k89_30",ae="_header_10k89_40",le="_headerMain_10k89_49",ne="_headerIcon_10k89_56",oe="_headerText_10k89_59",re="_title_10k89_65",ce="_actions_10k89_68",de="_grid_10k89_80",ie="_item_10k89_87",_e="_dividers_10k89_95",ue="_lastRow_10k89_99",he="_label_10k89_103",pe="_labelIcon_10k89_111",me="_value_10k89_116",ve="_valueMedium_10k89_125",xe="_valueBold_10k89_128",ke="_valueText_10k89_131",ye="_placeholder_10k89_135",be="_copy_10k89_148",je="_copyButton_10k89_156",Ne="_horizontal_10k89_172",fe="_stacked_10k89_170",ge="_bordered_10k89_184",Ie="_lastRowStart_10k89_218",e={root:W,sm:ee,md:se,lg:te,header:ae,headerMain:le,headerIcon:ne,headerText:oe,title:re,actions:ce,grid:de,item:ie,dividers:_e,lastRow:ue,label:he,labelIcon:pe,value:me,valueMedium:ve,valueBold:xe,valueText:ke,placeholder:ye,copy:be,copyButton:je,horizontal:Ne,stacked:fe,bordered:ge,lastRowStart:Ie},we=new Set(K.ICON_NAMES),Te={xs:1,sm:2,lg:3},Me=t=>t==null||t===""||t===!1,Re=t=>{if(typeof t.copyable=="string")return t.copyable;if(typeof t.value=="string"||typeof t.value=="number")return String(t.value)},Se=(t,n)=>{let r=0,l=0;return t.map(i=>{const o=Math.min(i.span??1,n);l+o>n&&(r+=1,l=0);const h={item:i,span:o,row:r,col:l};return l+=o,l>=n&&(r+=1,l=0),h})},B=(t,n="sm")=>typeof t=="string"&&we.has(t)?s.jsx(V.Icon,{name:t,size:n}):t,qe=M.forwardRef(function({items:n,columns:r=Te,layout:l="vertical",size:i="md",valueWeight:o="regular",bordered:h=!1,dividers:C=!0,labelWidth:p=160,stackBelow:k="xxs",loading:c=!1,emptyText:L="—",title:d,icon:m,color:z="accent",subtitle:_,actions:v,className:E,style:A,...D},O){const y=Z.useT(),b=`${M.useId()}-title`,j=J.useBreakpointMatches(),N=G.resolveResponsive(r,j)??1,$=l==="horizontal"&&k!==!1&&j[k],f=n.filter(a=>!a.hidden),u=Se(f,N),g=u.length?u[u.length-1].row:0,U=typeof c=="number"?c:f.length||6,F=d!=null||_!=null||v!=null||m!=null,H={"--dl-cols":N,"--dl-label-w":typeof p=="number"?`${p}px`:p};return s.jsxs("div",{ref:O,className:R.clsx(e.root,e[i],e[l],o!=="regular"&&e[`value${o==="bold"?"Bold":"Medium"}`],h&&e.bordered,C&&e.dividers,$&&e.stacked,E),style:{...H,...A},...D,children:[F&&s.jsxs("div",{className:e.header,children:[s.jsxs("div",{className:e.headerMain,children:[m!=null&&s.jsx(Y.IconButton,{variant:"filled",size:"sm",color:z,nonClickable:!0,"aria-hidden":!0,className:e.headerIcon,children:B(m,"md")}),(d!=null||_!=null)&&s.jsxs("div",{className:e.headerText,children:[d!=null&&s.jsx(q.Typography,{as:"h3",id:b,variant:"subtitle",className:e.title,children:d}),_!=null&&s.jsx(q.Typography,{as:"p",variant:"bodySmall",color:"muted",children:_})]})]}),v!=null&&s.jsx("div",{className:e.actions,children:v})]}),s.jsx("dl",{className:e.grid,"aria-labelledby":d!=null?b:void 0,"aria-busy":c?!0:void 0,"aria-label":c?y("descriptionList.loading"):void 0,children:c?Array.from({length:U},(a,x)=>s.jsxs("div",{className:e.item,"aria-hidden":"true",children:[s.jsx("dt",{className:e.label,children:s.jsx(S.Skeleton,{width:"40%",height:"0.9em"})}),s.jsx("dd",{className:e.value,children:s.jsx(S.Skeleton,{width:"70%",height:"1.1em"})})]},x)):u.map(({item:a,span:x,row:I,col:P},Q)=>{const w=Me(a.value),T=!w&&a.copyable?Re(a):void 0;return s.jsxs("div",{className:R.clsx(e.item,I===g&&e.lastRow,I===g&&P===0&&e.lastRowStart),style:{"--dl-span":x},children:[s.jsxs("dt",{className:e.label,children:[a.icon!=null&&s.jsx("span",{className:e.labelIcon,"aria-hidden":"true",children:B(a.icon)}),a.label]}),s.jsxs("dd",{className:e.value,children:[s.jsx("span",{className:e.valueText,children:w?s.jsx("span",{className:e.placeholder,"aria-label":y("descriptionList.empty"),children:L}):a.value}),T!=null&&s.jsx("span",{className:e.copy,children:s.jsx(X.CopyButton,{value:T,size:"sm",variant:"text",className:e.copyButton})})]})]},a.key??Q)})})]})});exports.DescriptionList=qe;
|
|
2
|
+
//# sourceMappingURL=DescriptionList-C7AOcw_2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionList-DQHNOTWl.cjs","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 `items.length` rows, 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":"y1CAaMA,GAAgB,IAAI,IAAYC,YAAU,EAkE1CC,GAAsD,CAAE,GAAI,EAAG,GAAI,EAAG,GAAI,CAAA,EAE1EC,GAAWC,GAAqBA,GAAS,MAAQA,IAAU,IAAMA,IAAU,GAG3EC,GAAcC,GAA8C,CAChE,GAAI,OAAOA,EAAK,UAAa,gBAAiBA,EAAK,SACnD,GAAI,OAAOA,EAAK,OAAU,UAAY,OAAOA,EAAK,OAAU,SAAU,OAAO,OAAOA,EAAK,KAAK,CAEhG,EAGMC,GAAa,CAACC,EAA0BC,IAAiB,CAC7D,IAAIC,EAAM,EACNC,EAAM,EACV,OAAOH,EAAM,IAAKF,GAAS,CACzB,MAAMM,EAAO,KAAK,IAAIN,EAAK,MAAQ,EAAGG,CAAI,EACtCE,EAAMC,EAAOH,IACfC,GAAO,EACPC,EAAM,GAER,MAAME,EAAS,CAAE,KAAAP,EAAM,KAAAM,EAAM,IAAAF,EAAK,IAAAC,CAAA,EAClC,OAAAA,GAAOC,EACHD,GAAOF,IACTC,GAAO,EACPC,EAAM,GAEDE,CACT,CAAC,CACH,EAEMC,EAAa,CAACC,EAA4BC,EAAoB,OAClE,OAAOD,GAAS,UAAYf,GAAc,IAAIe,CAAI,EAChDE,EAAAA,IAACC,QAAK,KAAMH,EAAkB,KAAAC,EAAY,EAE1CD,EAgBSI,GAAkBC,EAAAA,WAC7B,SACE,CACE,MAAAZ,EACA,QAAAa,EAAUnB,GACV,OAAAoB,EAAS,WACT,KAAAN,EAAO,KACP,YAAAO,EAAc,UACd,SAAAC,EAAW,GACX,SAAAC,EAAW,GACX,WAAAC,EAAa,IACb,WAAAC,EAAa,MACb,QAAAC,EAAU,GACV,UAAAC,EAAY,IACZ,MAAAC,EACA,KAAAf,EACA,MAAAgB,EAAQ,SACR,SAAAC,E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,CAAI,EAAI,OAC1D,OACE6C,EAAAA,KAAC,MAAA,CAEC,UAAWC,EAAAA,KACTC,EAAO,KACP3C,IAAQqC,GAAWM,EAAO,QAC1B3C,IAAQqC,GAAWpC,IAAQ,GAAK0C,EAAO,YAAA,EAEzC,MAAO,CAAE,YAAazC,CAAA,EAEtB,SAAA,CAAAuC,EAAAA,KAAC,KAAA,CAAG,UAAWE,EAAO,MACnB,SAAA,CAAA/C,EAAK,MAAQ,MACZW,EAAAA,IAAC,OAAA,CAAK,UAAWoC,EAAO,UAAW,cAAY,OAC5C,SAAAvC,EAAWR,EAAK,IAAI,EACvB,EAEDA,EAAK,KAAA,EACR,EACA6C,EAAAA,KAAC,KAAA,CAAG,UAAWE,EAAO,MACpB,SAAA,CAAApC,EAAAA,IAAC,OAAA,CAAK,UAAWoC,EAAO,UACrB,SAAAM,EACC1C,EAAAA,IAAC,OAAA,CACC,UAAWoC,EAAO,YAClB,aAAYf,EAAE,uBAAuB,EAEpC,SAAAT,CAAA,CAAA,EAGHvB,EAAK,MAET,EACCsD,GAAQ,MACP3C,EAAAA,IAAC,OAAA,CAAK,UAAWoC,EAAO,KACtB,SAAApC,EAAAA,IAAC4C,EAAAA,WAAA,CACC,MAAOD,EACP,KAAK,KACL,QAAQ,OACR,UAAWP,EAAO,UAAA,CAAA,CACpB,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,EAvCK/C,EAAK,KAAOmD,CAAA,CA0CvB,CAAC,CAAA,CAAA,CACP,CAAA,CAAA,CAGN,CACF"}
|
|
1
|
+
{"version":3,"file":"DescriptionList-C7AOcw_2.cjs","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 `items.length` rows, 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":"y1CAaMA,GAAgB,IAAI,IAAYC,YAAU,EAkE1CC,GAAsD,CAAE,GAAI,EAAG,GAAI,EAAG,GAAI,CAAA,EAE1EC,GAAWC,GAAqBA,GAAS,MAAQA,IAAU,IAAMA,IAAU,GAG3EC,GAAcC,GAA8C,CAChE,GAAI,OAAOA,EAAK,UAAa,gBAAiBA,EAAK,SACnD,GAAI,OAAOA,EAAK,OAAU,UAAY,OAAOA,EAAK,OAAU,SAAU,OAAO,OAAOA,EAAK,KAAK,CAEhG,EAGMC,GAAa,CAACC,EAA0BC,IAAiB,CAC7D,IAAIC,EAAM,EACNC,EAAM,EACV,OAAOH,EAAM,IAAKF,GAAS,CACzB,MAAMM,EAAO,KAAK,IAAIN,EAAK,MAAQ,EAAGG,CAAI,EACtCE,EAAMC,EAAOH,IACfC,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,CAAA,EAGHvB,EAAK,MAET,EACCsD,GAAQ,MACP3C,EAAAA,IAAC,OAAA,CAAK,UAAWoC,EAAO,KACtB,SAAApC,EAAAA,IAAC4C,EAAAA,WAAA,CACC,MAAOD,EACP,KAAK,KACL,QAAQ,OACR,UAAWP,EAAO,UAAA,CAAA,CACpB,CACF,CAAA,CAAA,CAEJ,CAAA,CAAA,EAvCK/C,EAAK,KAAOmD,CAAA,CA0CvB,CAAC,CAAA,CAAA,CACP,CAAA,CAAA,CAGN,CACF"}
|
|
@@ -5,11 +5,11 @@ import { r as Q } from "./breakpoints-BbDakdqF.js";
|
|
|
5
5
|
import { u as V } from "./useMediaQuery-DrDUrkmJ.js";
|
|
6
6
|
import { a as X } from "./names-BR1uJs0-.js";
|
|
7
7
|
import { I as Y } from "./Icon-CGQ5yGSZ.js";
|
|
8
|
-
import { C as Z } from "./CopyButton-
|
|
9
|
-
import { I as W } from "./IconButton-
|
|
8
|
+
import { C as Z } from "./CopyButton-BNcW9-KU.js";
|
|
9
|
+
import { I as W } from "./IconButton-CqFgam3J.js";
|
|
10
10
|
import { S as B } from "./Skeleton-_-uGax2j.js";
|
|
11
11
|
import { T as z } from "./Typography-CJv5AnRP.js";
|
|
12
|
-
import { a as ee } from "./ConfigProvider-
|
|
12
|
+
import { a as ee } from "./ConfigProvider-D2svpXFu.js";
|
|
13
13
|
const ae = "_root_10k89_4", se = "_sm_10k89_14", le = "_md_10k89_22", te = "_lg_10k89_30", oe = "_header_10k89_40", ne = "_headerMain_10k89_49", re = "_headerIcon_10k89_56", ce = "_headerText_10k89_59", de = "_title_10k89_65", ie = "_actions_10k89_68", _e = "_grid_10k89_80", me = "_item_10k89_87", ue = "_dividers_10k89_95", pe = "_lastRow_10k89_99", he = "_label_10k89_103", ve = "_labelIcon_10k89_111", ke = "_value_10k89_116", fe = "_valueMedium_10k89_125", ye = "_valueBold_10k89_128", be = "_valueText_10k89_131", Ne = "_placeholder_10k89_135", xe = "_copy_10k89_148", Ie = "_copyButton_10k89_156", ge = "_horizontal_10k89_172", we = "_stacked_10k89_170", Te = "_bordered_10k89_184", Me = "_lastRowStart_10k89_218", e = {
|
|
14
14
|
root: ae,
|
|
15
15
|
sm: se,
|
|
@@ -173,4 +173,4 @@ const ae = "_root_10k89_4", se = "_sm_10k89_14", le = "_md_10k89_22", te = "_lg_
|
|
|
173
173
|
export {
|
|
174
174
|
Ke as D
|
|
175
175
|
};
|
|
176
|
-
//# sourceMappingURL=DescriptionList-
|
|
176
|
+
//# sourceMappingURL=DescriptionList-DxRgKNEJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionList-BhsmdtS1.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 `items.length` rows, 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,IAAa,CAACC,GAA4BC,IAAoB,SAClE,OAAOD,KAAS,YAAYf,GAAc,IAAIe,CAAI,IAChD,gBAAAE,EAACC,KAAK,MAAMH,GAAkB,MAAAC,GAAY,IAE1CD,GAgBSI,KAAkBC;AAAA,EAC7B,SACE;AAAA,IACE,OAAAZ;AAAA,IACA,SAAAa,IAAUnB;AAAA,IACV,QAAAoB,IAAS;AAAA,IACT,MAAAN,IAAO;AAAA,IACP,aAAAO,IAAc;AAAA,IACd,UAAAC,IAAW;AAAA,IAC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pC,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
|
+
{"version":3,"file":"DescriptionList-DxRgKNEJ.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 `items.length` rows, 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,IAAa,CAACC,GAA4BC,IAAoB,SAClE,OAAOD,KAAS,YAAYf,GAAc,IAAIe,CAAI,IAChD,gBAAAE,EAACC,KAAK,MAAMH,GAAkB,MAAAC,GAAY,IAE1CD,GAgBSI,KAAkBC;AAAA,EAC7B,SACE;AAAA,IACE,OAAAZ;AAAA,IACA,S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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-DOsh6w-d.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-CMqWq6J_.cjs.map
|