@techzyapp/ui-library 1.0.41 → 1.0.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -8
- package/dist/AdminRoot-BLHvXCvL.js +101 -0
- package/dist/AdminRoot-BLHvXCvL.js.map +1 -0
- package/dist/AdminRoot-D_g_TW30.cjs +2 -0
- package/dist/AdminRoot-D_g_TW30.cjs.map +1 -0
- package/dist/Alert-B4XZDk16.cjs +2 -0
- package/dist/Alert-B4XZDk16.cjs.map +1 -0
- package/dist/Alert-D5E1PLkV.js +70 -0
- package/dist/Alert-D5E1PLkV.js.map +1 -0
- package/dist/AuthLayout-exuNQicH.cjs.map +1 -1
- package/dist/AuthLayout-q8pbCGdt.js.map +1 -1
- package/dist/{Breadcrumbs-B6Pii2Y_.cjs → Breadcrumbs-DSUxcp6u.cjs} +2 -2
- package/dist/Breadcrumbs-DSUxcp6u.cjs.map +1 -0
- package/dist/{Breadcrumbs-DKYJOdHZ.js → Breadcrumbs-M31xyok8.js} +3 -3
- package/dist/Breadcrumbs-M31xyok8.js.map +1 -0
- package/dist/{Button-CjsnB8gX.js → Button-CtADzomU.js} +2 -2
- package/dist/{Button-CjsnB8gX.js.map → Button-CtADzomU.js.map} +1 -1
- package/dist/{Button-ClVfHGBc.cjs → Button-Q_5uA-zc.cjs} +2 -2
- package/dist/{Button-ClVfHGBc.cjs.map → Button-Q_5uA-zc.cjs.map} +1 -1
- package/dist/{Calendar-BzGVX4F4.cjs → Calendar-BbbtMsZs.cjs} +2 -2
- package/dist/{Calendar-BzGVX4F4.cjs.map → Calendar-BbbtMsZs.cjs.map} +1 -1
- package/dist/{Calendar-CQaPEukM.js → Calendar-CHLCv2s9.js} +3 -3
- package/dist/{Calendar-CQaPEukM.js.map → Calendar-CHLCv2s9.js.map} +1 -1
- package/dist/Card-Br9IB0yM.js +129 -0
- package/dist/Card-Br9IB0yM.js.map +1 -0
- package/dist/Card-CntRsQfm.cjs +2 -0
- package/dist/Card-CntRsQfm.cjs.map +1 -0
- package/dist/{Chip-Dp8skUZ2.cjs → Chip-CrBizrvG.cjs} +2 -2
- package/dist/Chip-CrBizrvG.cjs.map +1 -0
- package/dist/{Chip-BjSNgaAf.js → Chip-DYZ5w7VM.js} +2 -2
- package/dist/Chip-DYZ5w7VM.js.map +1 -0
- package/dist/ChoiceCardGroup-C7Eengyd.cjs +2 -0
- package/dist/ChoiceCardGroup-C7Eengyd.cjs.map +1 -0
- package/dist/ChoiceCardGroup-q0yN-TeQ.js +180 -0
- package/dist/{ChoiceCardGroup-143hR0v_.cjs.map → ChoiceCardGroup-q0yN-TeQ.js.map} +1 -1
- package/dist/{CodeBlock-CcJjS0_q.js → CodeBlock-B6Eqc4HR.js} +3 -3
- package/dist/CodeBlock-B6Eqc4HR.js.map +1 -0
- package/dist/{CodeBlock-o_VSkAek.cjs → CodeBlock-DW4uaZXM.cjs} +2 -2
- package/dist/CodeBlock-DW4uaZXM.cjs.map +1 -0
- package/dist/{ColorPicker-C1hZcAbH.js → ColorPicker-GsKIqJu8.js} +51 -51
- package/dist/{ColorPicker-C1hZcAbH.js.map → ColorPicker-GsKIqJu8.js.map} +1 -1
- package/dist/ColorPicker-nhWd_nOW.cjs +2 -0
- package/dist/{ColorPicker-DY6Vk1uS.cjs.map → ColorPicker-nhWd_nOW.cjs.map} +1 -1
- package/dist/{ColorPickerPanel-BuzwmkPN.js → ColorPickerPanel-BEcZePcT.js} +2 -2
- package/dist/{ColorPickerPanel-BuzwmkPN.js.map → ColorPickerPanel-BEcZePcT.js.map} +1 -1
- package/dist/{ColorPickerPanel-CDrHbCfG.cjs → ColorPickerPanel-BeAu83S6.cjs} +2 -2
- package/dist/{ColorPickerPanel-CDrHbCfG.cjs.map → ColorPickerPanel-BeAu83S6.cjs.map} +1 -1
- package/dist/{ColorRamp-CVnOYlu3.cjs → ColorRamp-C-zRPhHj.cjs} +2 -2
- package/dist/{ColorRamp-CVnOYlu3.cjs.map → ColorRamp-C-zRPhHj.cjs.map} +1 -1
- package/dist/{ColorRamp-CePqEkMR.js → ColorRamp-CeNgd8wF.js} +2 -2
- package/dist/{ColorRamp-CePqEkMR.js.map → ColorRamp-CeNgd8wF.js.map} +1 -1
- package/dist/ConfigProvider-Ci9Q2HLF.cjs +2 -0
- package/dist/ConfigProvider-Ci9Q2HLF.cjs.map +1 -0
- package/dist/{ConfigProvider-Bgu85MsI.js → ConfigProvider-Dqfu7UBU.js} +133 -126
- package/dist/ConfigProvider-Dqfu7UBU.js.map +1 -0
- package/dist/{CopyButton-CgDeyJ3A.js → CopyButton-Bidt2Vgp.js} +3 -3
- package/dist/{CopyButton-CgDeyJ3A.js.map → CopyButton-Bidt2Vgp.js.map} +1 -1
- package/dist/{CopyButton-CjPyKpky.cjs → CopyButton-Chr7SP5i.cjs} +2 -2
- package/dist/{CopyButton-CjPyKpky.cjs.map → CopyButton-Chr7SP5i.cjs.map} +1 -1
- package/dist/DatePicker-4rb34nPR.cjs +2 -0
- package/dist/{DatePicker-CwZ_-ElE.cjs.map → DatePicker-4rb34nPR.cjs.map} +1 -1
- package/dist/{DatePicker-tid4OuJ2.js → DatePicker-D7ZMOhWn.js} +42 -42
- package/dist/{DatePicker-tid4OuJ2.js.map → DatePicker-D7ZMOhWn.js.map} +1 -1
- package/dist/DateTimePicker-CVFzKzyA.cjs +2 -0
- package/dist/DateTimePicker-CVFzKzyA.cjs.map +1 -0
- package/dist/{DateTimePicker-C2871cuc.js → DateTimePicker-gDxM2CGy.js} +50 -50
- package/dist/DateTimePicker-gDxM2CGy.js.map +1 -0
- package/dist/{DescriptionList-BWw0Fe6U.cjs → DescriptionList-BBvfABps.cjs} +2 -2
- package/dist/DescriptionList-BBvfABps.cjs.map +1 -0
- package/dist/{DescriptionList-BP4CDME5.js → DescriptionList-Die3lRBW.js} +4 -4
- package/dist/DescriptionList-Die3lRBW.js.map +1 -0
- package/dist/{Dropdown-DYYhzKSo.cjs → Dropdown-CMjURWYd.cjs} +2 -2
- package/dist/{Dropdown-DYYhzKSo.cjs.map → Dropdown-CMjURWYd.cjs.map} +1 -1
- package/dist/{Dropdown-CcC-Hwx4.js → Dropdown-CnDBlB02.js} +2 -2
- package/dist/{Dropdown-CcC-Hwx4.js.map → Dropdown-CnDBlB02.js.map} +1 -1
- package/dist/{EmptyState-DGHOD_jy.cjs → EmptyState-D5EKQjX1.cjs} +2 -2
- package/dist/{EmptyState-DGHOD_jy.cjs.map → EmptyState-D5EKQjX1.cjs.map} +1 -1
- package/dist/{EmptyState-BlmQtbSs.js → EmptyState-DRgER10x.js} +2 -2
- package/dist/{EmptyState-BlmQtbSs.js.map → EmptyState-DRgER10x.js.map} +1 -1
- package/dist/{ErrorBoundary-ukRaS6uS.js → ErrorBoundary-CLfE2NjU.js} +3 -3
- package/dist/{ErrorBoundary-ukRaS6uS.js.map → ErrorBoundary-CLfE2NjU.js.map} +1 -1
- package/dist/{ErrorBoundary-DL194IyB.cjs → ErrorBoundary-DVcGWZd8.cjs} +2 -2
- package/dist/{ErrorBoundary-DL194IyB.cjs.map → ErrorBoundary-DVcGWZd8.cjs.map} +1 -1
- package/dist/{ErrorState-BjEA0VfF.cjs → ErrorState-DJDQbHZY.cjs} +2 -2
- package/dist/{ErrorState-BjEA0VfF.cjs.map → ErrorState-DJDQbHZY.cjs.map} +1 -1
- package/dist/{ErrorState-Hfd_0MeE.js → ErrorState-Dqw0AvmB.js} +7 -7
- package/dist/{ErrorState-Hfd_0MeE.js.map → ErrorState-Dqw0AvmB.js.map} +1 -1
- package/dist/{FileCard-COc4rHe-.cjs → FileCard-BqMproT9.cjs} +2 -2
- package/dist/FileCard-BqMproT9.cjs.map +1 -0
- package/dist/{FileCard-CWwB8CWF.js → FileCard-kVnjcSlk.js} +3 -3
- package/dist/FileCard-kVnjcSlk.js.map +1 -0
- package/dist/{FileUploader-Bqy_fV7l.cjs → FileUploader-BimFH5d8.cjs} +2 -2
- package/dist/FileUploader-BimFH5d8.cjs.map +1 -0
- package/dist/{FileUploader--WOmlhSh.js → FileUploader-LJIMh5_b.js} +5 -5
- package/dist/FileUploader-LJIMh5_b.js.map +1 -0
- package/dist/{Flag-C48Zfhvb.cjs → Flag-B1ZvZVXi.cjs} +2 -2
- package/dist/{Flag-C48Zfhvb.cjs.map → Flag-B1ZvZVXi.cjs.map} +1 -1
- package/dist/{Flag-fgMTTcy8.js → Flag-BEIqYQZg.js} +2 -2
- package/dist/{Flag-fgMTTcy8.js.map → Flag-BEIqYQZg.js.map} +1 -1
- package/dist/FloatingPanel-C5c_eMQ0.js.map +1 -1
- package/dist/FloatingPanel-tGCG2nhA.cjs.map +1 -1
- package/dist/{FullscreenToggle-GjsMn1GO.js → FullscreenToggle-BuQonKW8.js} +3 -3
- package/dist/{FullscreenToggle-GjsMn1GO.js.map → FullscreenToggle-BuQonKW8.js.map} +1 -1
- package/dist/{FullscreenToggle-DuLaUzi_.cjs → FullscreenToggle-CWlOXLss.cjs} +2 -2
- package/dist/{FullscreenToggle-DuLaUzi_.cjs.map → FullscreenToggle-CWlOXLss.cjs.map} +1 -1
- package/dist/{IconButton-t1OhAMNc.js → IconButton-BoURJOUD.js} +2 -2
- package/dist/{IconButton-t1OhAMNc.js.map → IconButton-BoURJOUD.js.map} +1 -1
- package/dist/{IconButton-D3ZpI0XL.cjs → IconButton-CiDPeKM4.cjs} +2 -2
- package/dist/{IconButton-D3ZpI0XL.cjs.map → IconButton-CiDPeKM4.cjs.map} +1 -1
- package/dist/{List-CwuAJDTi.js → List-2Y3ktTcF.js} +2 -2
- package/dist/{List-CwuAJDTi.js.map → List-2Y3ktTcF.js.map} +1 -1
- package/dist/{List-B5Ppe9R1.cjs → List-CKoNx21F.cjs} +2 -2
- package/dist/{List-B5Ppe9R1.cjs.map → List-CKoNx21F.cjs.map} +1 -1
- package/dist/{ListItem-BWNIbyTh.js → ListItem-2Lr5_NRY.js} +15 -15
- package/dist/{ListItem-BWNIbyTh.js.map → ListItem-2Lr5_NRY.js.map} +1 -1
- package/dist/ListItem-DkCYXucd.cjs +2 -0
- package/dist/{ListItem-Qo1Tt6Fi.cjs.map → ListItem-DkCYXucd.cjs.map} +1 -1
- package/dist/{Loader-Cywaf7ju.cjs → Loader-CAmRn8Oj.cjs} +2 -2
- package/dist/{Loader-Cywaf7ju.cjs.map → Loader-CAmRn8Oj.cjs.map} +1 -1
- package/dist/{Loader-De8_GqR1.js → Loader-CnTuddK7.js} +2 -2
- package/dist/{Loader-De8_GqR1.js.map → Loader-CnTuddK7.js.map} +1 -1
- package/dist/{LocationPicker-DBsxCYi9.cjs → LocationPicker-BwQ6ULMF.cjs} +2 -2
- package/dist/{LocationPicker-DBsxCYi9.cjs.map → LocationPicker-BwQ6ULMF.cjs.map} +1 -1
- package/dist/{LocationPicker-UfyDBvhp.js → LocationPicker-Cns3fkYI.js} +7 -7
- package/dist/{LocationPicker-UfyDBvhp.js.map → LocationPicker-Cns3fkYI.js.map} +1 -1
- package/dist/{Modal-Dfwc9eIq.js → Modal-CYcVOzID.js} +3 -3
- package/dist/Modal-CYcVOzID.js.map +1 -0
- package/dist/{Modal--5EbLfMz.cjs → Modal-DwY3jGHE.cjs} +2 -2
- package/dist/Modal-DwY3jGHE.cjs.map +1 -0
- package/dist/{MultiSelect-lBAEcAlR.cjs → MultiSelect-DJ6tRseY.cjs} +2 -2
- package/dist/{MultiSelect-lBAEcAlR.cjs.map → MultiSelect-DJ6tRseY.cjs.map} +1 -1
- package/dist/{MultiSelect-q__o8HyU.js → MultiSelect-svEVZNbp.js} +4 -4
- package/dist/{MultiSelect-q__o8HyU.js.map → MultiSelect-svEVZNbp.js.map} +1 -1
- package/dist/{NumberField-CXH0B1Bt.js → NumberField-9ekoB1wS.js} +3 -3
- package/dist/{NumberField-CXH0B1Bt.js.map → NumberField-9ekoB1wS.js.map} +1 -1
- package/dist/{NumberField-DSicjq5R.cjs → NumberField-sokUuuBR.cjs} +2 -2
- package/dist/{NumberField-DSicjq5R.cjs.map → NumberField-sokUuuBR.cjs.map} +1 -1
- package/dist/OtpField-DA7zJwy9.js +174 -0
- package/dist/OtpField-DA7zJwy9.js.map +1 -0
- package/dist/OtpField-DlkGju72.cjs +2 -0
- package/dist/OtpField-DlkGju72.cjs.map +1 -0
- package/dist/{PageError-MHbSl1oT.cjs → PageError-DUN5PzDF.cjs} +2 -2
- package/dist/{PageError-MHbSl1oT.cjs.map → PageError-DUN5PzDF.cjs.map} +1 -1
- package/dist/{PageError-VYc07Q7W.js → PageError-vD8Dpfns.js} +5 -5
- package/dist/{PageError-VYc07Q7W.js.map → PageError-vD8Dpfns.js.map} +1 -1
- package/dist/{PageLayout-Bt6U_80d.cjs → PageLayout-BesuKuX6.cjs} +2 -2
- package/dist/PageLayout-BesuKuX6.cjs.map +1 -0
- package/dist/{PageLayout-Df1SOlr7.js → PageLayout-CdObvxt7.js} +4 -4
- package/dist/PageLayout-CdObvxt7.js.map +1 -0
- package/dist/{PageNotFound-BWfaomjC.js → PageNotFound-Cc5eZ6w3.js} +5 -5
- package/dist/{PageNotFound-BWfaomjC.js.map → PageNotFound-Cc5eZ6w3.js.map} +1 -1
- package/dist/{PageNotFound-e4ITkqDC.cjs → PageNotFound-CfOAhmJ-.cjs} +2 -2
- package/dist/{PageNotFound-e4ITkqDC.cjs.map → PageNotFound-CfOAhmJ-.cjs.map} +1 -1
- package/dist/Pagination-CAD9_Nr_.cjs +2 -0
- package/dist/Pagination-CAD9_Nr_.cjs.map +1 -0
- package/dist/Pagination-CX0S1RrF.js +139 -0
- package/dist/Pagination-CX0S1RrF.js.map +1 -0
- package/dist/{PaletteField-D4c-Q1PG.js → PaletteField-CVIwl2nV.js} +3 -3
- package/dist/{PaletteField-D4c-Q1PG.js.map → PaletteField-CVIwl2nV.js.map} +1 -1
- package/dist/{PaletteField-DnUpn2zP.cjs → PaletteField-CpiEkXcB.cjs} +2 -2
- package/dist/{PaletteField-DnUpn2zP.cjs.map → PaletteField-CpiEkXcB.cjs.map} +1 -1
- package/dist/{PhoneField-BTB2_Lo1.cjs → PhoneField-Dlnnv4DU.cjs} +2 -2
- package/dist/{PhoneField-BTB2_Lo1.cjs.map → PhoneField-Dlnnv4DU.cjs.map} +1 -1
- package/dist/{PhoneField-BY5hapKk.js → PhoneField-xHLTU-o5.js} +4 -4
- package/dist/{PhoneField-BY5hapKk.js.map → PhoneField-xHLTU-o5.js.map} +1 -1
- package/dist/{Popconfirm-PkVgBrL-.cjs → Popconfirm-Chlm_M5T.cjs} +2 -2
- package/dist/{Popconfirm-PkVgBrL-.cjs.map → Popconfirm-Chlm_M5T.cjs.map} +1 -1
- package/dist/{Popconfirm-BXa5qLHY.js → Popconfirm-DIlygJY8.js} +3 -3
- package/dist/{Popconfirm-BXa5qLHY.js.map → Popconfirm-DIlygJY8.js.map} +1 -1
- package/dist/Popover-DsYUT23r.cjs.map +1 -1
- package/dist/Popover-WaVH3jsN.js.map +1 -1
- package/dist/{Progress-bId4RkgJ.js → Progress-BAEhawtj.js} +2 -2
- package/dist/{Progress-bId4RkgJ.js.map → Progress-BAEhawtj.js.map} +1 -1
- package/dist/{Progress-R_Vt4gJA.cjs → Progress-DqvKmyQW.cjs} +2 -2
- package/dist/{Progress-R_Vt4gJA.cjs.map → Progress-DqvKmyQW.cjs.map} +1 -1
- package/dist/QrCode-D7BTYcW2.js +81 -0
- package/dist/QrCode-D7BTYcW2.js.map +1 -0
- package/dist/QrCode-Dqsk49vX.cjs +2 -0
- package/dist/QrCode-Dqsk49vX.cjs.map +1 -0
- package/dist/{RemoveDialog-Dh_q5jZF.js → RemoveDialog-CQIm9GTH.js} +5 -5
- package/dist/{RemoveDialog-Dh_q5jZF.js.map → RemoveDialog-CQIm9GTH.js.map} +1 -1
- package/dist/{RemoveDialog-Cvj-DaiY.cjs → RemoveDialog-DZ-EqIfS.cjs} +2 -2
- package/dist/{RemoveDialog-Cvj-DaiY.cjs.map → RemoveDialog-DZ-EqIfS.cjs.map} +1 -1
- package/dist/RichTextEditor-Ba1G_qXu.cjs +2 -0
- package/dist/RichTextEditor-Ba1G_qXu.cjs.map +1 -0
- package/dist/{RichTextEditor-Dv-LDsN-.js → RichTextEditor-CJcbxQ6H.js} +148 -148
- package/dist/RichTextEditor-CJcbxQ6H.js.map +1 -0
- package/dist/RootLayout-Cl98ghy1.js +647 -0
- package/dist/RootLayout-Cl98ghy1.js.map +1 -0
- package/dist/RootLayout-s_Q_kSoS.cjs +2 -0
- package/dist/RootLayout-s_Q_kSoS.cjs.map +1 -0
- package/dist/{Select-DdkJXkw-.cjs → Select-BrjXCXtl.cjs} +2 -2
- package/dist/{Select-DdkJXkw-.cjs.map → Select-BrjXCXtl.cjs.map} +1 -1
- package/dist/{Select-Bw8Q86ts.js → Select-CG8UJL9R.js} +3 -3
- package/dist/{Select-Bw8Q86ts.js.map → Select-CG8UJL9R.js.map} +1 -1
- package/dist/{Sidebar-CGL5hvpl.js → Sidebar-CbPr34jd.js} +133 -131
- package/dist/{Sidebar-CGL5hvpl.js.map → Sidebar-CbPr34jd.js.map} +1 -1
- package/dist/Sidebar-DLlqHvQJ.cjs +2 -0
- package/dist/{Sidebar-CfEx7W7i.cjs.map → Sidebar-DLlqHvQJ.cjs.map} +1 -1
- package/dist/Slider-B5iG-HSw.js +185 -0
- package/dist/Slider-B5iG-HSw.js.map +1 -0
- package/dist/Slider-DTnui01g.cjs +2 -0
- package/dist/Slider-DTnui01g.cjs.map +1 -0
- package/dist/{SpeedDial-C-yLmnk7.js → SpeedDial-Be3SHkzw.js} +2 -2
- package/dist/{SpeedDial-C-yLmnk7.js.map → SpeedDial-Be3SHkzw.js.map} +1 -1
- package/dist/{SpeedDial-jOxWEd09.cjs → SpeedDial-i5kxikmt.cjs} +2 -2
- package/dist/{SpeedDial-jOxWEd09.cjs.map → SpeedDial-i5kxikmt.cjs.map} +1 -1
- package/dist/{Stepper-DYpiLhzD.js → Stepper-BDQt-oVG.js} +2 -2
- package/dist/Stepper-BDQt-oVG.js.map +1 -0
- package/dist/{Stepper-D7An-ugU.cjs → Stepper-e8qBsKYW.cjs} +2 -2
- package/dist/Stepper-e8qBsKYW.cjs.map +1 -0
- package/dist/{Table-BhaH8EKZ.cjs → Table-C14fRX1U.cjs} +2 -2
- package/dist/Table-C14fRX1U.cjs.map +1 -0
- package/dist/{Table-DK4GBKS3.js → Table-ChdM_vyi.js} +18 -18
- package/dist/Table-ChdM_vyi.js.map +1 -0
- package/dist/{Tabs-CWiDeqqW.js → Tabs-BxZrgozI.js} +2 -2
- package/dist/{Tabs-CWiDeqqW.js.map → Tabs-BxZrgozI.js.map} +1 -1
- package/dist/{Tabs-6x4vC8je.cjs → Tabs-C4kB1yfG.cjs} +2 -2
- package/dist/{Tabs-6x4vC8je.cjs.map → Tabs-C4kB1yfG.cjs.map} +1 -1
- package/dist/TagsField-Bg5BcQU-.cjs +2 -0
- package/dist/TagsField-Bg5BcQU-.cjs.map +1 -0
- package/dist/{TagsField-Cg9YVl7G.js → TagsField-DWlIt7XO.js} +64 -64
- package/dist/TagsField-DWlIt7XO.js.map +1 -0
- package/dist/{TextField-BRaoadxk.cjs → TextField-B-xqoDZR.cjs} +2 -2
- package/dist/{TextField-BRaoadxk.cjs.map → TextField-B-xqoDZR.cjs.map} +1 -1
- package/dist/{TextField-5nQkU8HP.js → TextField-Dwx5GPxz.js} +3 -3
- package/dist/{TextField-5nQkU8HP.js.map → TextField-Dwx5GPxz.js.map} +1 -1
- package/dist/{ThemeToggle-DXpbooYn.js → ThemeToggle-CK2USfgx.js} +3 -3
- package/dist/{ThemeToggle-DXpbooYn.js.map → ThemeToggle-CK2USfgx.js.map} +1 -1
- package/dist/{ThemeToggle-DhaVEyPL.cjs → ThemeToggle-DFgv1bsh.cjs} +2 -2
- package/dist/{ThemeToggle-DhaVEyPL.cjs.map → ThemeToggle-DFgv1bsh.cjs.map} +1 -1
- package/dist/{TimeColumns-girAEgEN.cjs → TimeColumns-B8KTj-tc.cjs} +2 -2
- package/dist/{TimeColumns-girAEgEN.cjs.map → TimeColumns-B8KTj-tc.cjs.map} +1 -1
- package/dist/{TimeColumns-C_gdJn__.js → TimeColumns-BWcuu3l7.js} +2 -2
- package/dist/{TimeColumns-C_gdJn__.js.map → TimeColumns-BWcuu3l7.js.map} +1 -1
- package/dist/TimePicker-DjL15hz1.cjs +2 -0
- package/dist/{TimePicker-_Ak5yB_5.cjs.map → TimePicker-DjL15hz1.cjs.map} +1 -1
- package/dist/{TimePicker-DHdsY8kQ.js → TimePicker-YMVHevpZ.js} +54 -54
- package/dist/{TimePicker-DHdsY8kQ.js.map → TimePicker-YMVHevpZ.js.map} +1 -1
- package/dist/Toaster-9hZ5MuW7.cjs +2 -0
- package/dist/Toaster-9hZ5MuW7.cjs.map +1 -0
- package/dist/Toaster-pHN2pxrU.js +64 -0
- package/dist/Toaster-pHN2pxrU.js.map +1 -0
- package/dist/TranslatedFields-BpWU5ZcG.js +86 -0
- package/dist/TranslatedFields-BpWU5ZcG.js.map +1 -0
- package/dist/TranslatedFields-SvS37hab.cjs +2 -0
- package/dist/TranslatedFields-SvS37hab.cjs.map +1 -0
- package/dist/{UserCard-B9bzkZph.cjs → UserCard-VPaexedS.cjs} +2 -2
- package/dist/UserCard-VPaexedS.cjs.map +1 -0
- package/dist/{UserCard-DYK6S-nr.js → UserCard-cmZrMvwL.js} +3 -3
- package/dist/UserCard-cmZrMvwL.js.map +1 -0
- package/dist/app/AdminRoot.d.cts +16 -5
- package/dist/app/AdminRoot.d.ts +16 -5
- package/dist/components/Alert/Alert.d.cts +1 -1
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/Alert/index.cjs +1 -1
- package/dist/components/Alert/index.js +1 -1
- package/dist/components/AuthLayout/AuthLayout.d.cts +2 -2
- package/dist/components/AuthLayout/AuthLayout.d.ts +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.d.cts +2 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -1
- package/dist/components/Breadcrumbs/index.cjs +1 -1
- package/dist/components/Breadcrumbs/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Card/Card.d.cts +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Card/index.cjs +1 -1
- package/dist/components/Card/index.js +1 -1
- package/dist/components/Chip/Chip.d.cts +1 -1
- package/dist/components/Chip/Chip.d.ts +1 -1
- package/dist/components/Chip/index.cjs +1 -1
- package/dist/components/Chip/index.js +1 -1
- package/dist/components/ChoiceCard/ChoiceCard.d.cts +1 -1
- package/dist/components/ChoiceCard/ChoiceCard.d.ts +1 -1
- package/dist/components/ChoiceCard/index.cjs +1 -1
- package/dist/components/ChoiceCard/index.js +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.cts +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
- package/dist/components/CodeBlock/index.cjs +1 -1
- package/dist/components/CodeBlock/index.js +1 -1
- package/dist/components/ColorPicker/index.cjs +1 -1
- package/dist/components/ColorPicker/index.js +1 -1
- package/dist/components/ColorRamp/index.cjs +1 -1
- package/dist/components/ColorRamp/index.js +1 -1
- package/dist/components/CopyButton/index.cjs +1 -1
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.cts +2 -2
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +2 -2
- package/dist/components/DateTimePicker/index.cjs +1 -1
- package/dist/components/DateTimePicker/index.js +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.cts +1 -1
- package/dist/components/DescriptionList/DescriptionList.d.ts +1 -1
- package/dist/components/DescriptionList/index.cjs +1 -1
- package/dist/components/DescriptionList/index.js +1 -1
- package/dist/components/Dropdown/index.cjs +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/EmptyState/index.cjs +1 -1
- package/dist/components/EmptyState/index.js +1 -1
- package/dist/components/ErrorState/ErrorBoundary.d.cts +1 -1
- package/dist/components/ErrorState/ErrorBoundary.d.ts +1 -1
- package/dist/components/ErrorState/index.cjs +1 -1
- package/dist/components/ErrorState/index.js +2 -2
- package/dist/components/FileCard/FileCard.d.cts +5 -2
- package/dist/components/FileCard/FileCard.d.ts +5 -2
- package/dist/components/FileCard/index.cjs +1 -1
- package/dist/components/FileCard/index.js +1 -1
- package/dist/components/FileUploader/FileUploader.d.cts +5 -5
- package/dist/components/FileUploader/FileUploader.d.ts +5 -5
- package/dist/components/FileUploader/index.cjs +1 -1
- package/dist/components/FileUploader/index.js +1 -1
- package/dist/components/Flag/index.cjs +1 -1
- package/dist/components/Flag/index.js +1 -1
- package/dist/components/FloatingPanel/FloatingPanel.d.cts +6 -5
- package/dist/components/FloatingPanel/FloatingPanel.d.ts +6 -5
- package/dist/components/FullscreenToggle/index.cjs +1 -1
- package/dist/components/FullscreenToggle/index.js +1 -1
- package/dist/components/IconButton/index.cjs +1 -1
- package/dist/components/IconButton/index.js +1 -1
- package/dist/components/List/index.cjs +1 -1
- package/dist/components/List/index.js +2 -2
- package/dist/components/Loader/Loader.d.cts +1 -1
- package/dist/components/Loader/Loader.d.ts +1 -1
- package/dist/components/Loader/index.cjs +1 -1
- package/dist/components/Loader/index.js +1 -1
- package/dist/components/LocationPicker/index.cjs +1 -1
- package/dist/components/LocationPicker/index.js +1 -1
- package/dist/components/Modal/Modal.d.cts +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +1 -1
- package/dist/components/MultiSelect/index.cjs +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.js +1 -1
- package/dist/components/OtpField/OtpField.d.cts +1 -1
- package/dist/components/OtpField/OtpField.d.ts +1 -1
- package/dist/components/OtpField/index.cjs +1 -1
- package/dist/components/OtpField/index.js +1 -1
- package/dist/components/PageError/index.cjs +1 -1
- package/dist/components/PageError/index.js +1 -1
- package/dist/components/PageLayout/PageLayout.d.cts +2 -2
- package/dist/components/PageLayout/PageLayout.d.ts +2 -2
- package/dist/components/PageLayout/index.cjs +1 -1
- package/dist/components/PageLayout/index.js +1 -1
- package/dist/components/PageNotFound/index.cjs +1 -1
- package/dist/components/PageNotFound/index.js +1 -1
- package/dist/components/Pagination/index.cjs +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/PaletteField/index.cjs +1 -1
- package/dist/components/PaletteField/index.js +1 -1
- package/dist/components/PhoneField/index.cjs +1 -1
- package/dist/components/PhoneField/index.js +1 -1
- package/dist/components/Popconfirm/index.cjs +1 -1
- package/dist/components/Popconfirm/index.js +1 -1
- package/dist/components/Popover/Popover.d.cts +1 -1
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Progress/index.cjs +1 -1
- package/dist/components/Progress/index.js +1 -1
- package/dist/components/QrCode/QrCode.d.cts +5 -2
- package/dist/components/QrCode/QrCode.d.ts +5 -2
- package/dist/components/QrCode/index.cjs +1 -1
- package/dist/components/QrCode/index.js +1 -1
- package/dist/components/RemoveDialog/index.cjs +1 -1
- package/dist/components/RemoveDialog/index.js +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.cts +1 -1
- package/dist/components/RichTextEditor/RichTextEditor.d.ts +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RootLayout/RootLayout.d.cts +15 -7
- package/dist/components/RootLayout/RootLayout.d.ts +15 -7
- package/dist/components/RootLayout/index.cjs +1 -1
- package/dist/components/RootLayout/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Sidebar/index.cjs +1 -1
- package/dist/components/Sidebar/index.js +1 -1
- package/dist/components/Slider/Slider.d.cts +2 -2
- package/dist/components/Slider/Slider.d.ts +2 -2
- package/dist/components/Slider/index.cjs +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/SpeedDial/index.cjs +1 -1
- package/dist/components/SpeedDial/index.js +1 -1
- package/dist/components/Stepper/Stepper.d.cts +2 -2
- package/dist/components/Stepper/Stepper.d.ts +2 -2
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Table/Table.d.cts +1 -1
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Tabs/index.cjs +1 -1
- package/dist/components/Tabs/index.js +1 -1
- package/dist/components/TagsField/TagsField.d.cts +1 -1
- package/dist/components/TagsField/TagsField.d.ts +1 -1
- package/dist/components/TagsField/index.cjs +1 -1
- package/dist/components/TagsField/index.js +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/ThemeToggle/index.cjs +1 -1
- package/dist/components/ThemeToggle/index.js +1 -1
- package/dist/components/TimePicker/index.cjs +1 -1
- package/dist/components/TimePicker/index.js +1 -1
- package/dist/components/Toast/Toaster.d.cts +10 -4
- package/dist/components/Toast/Toaster.d.ts +10 -4
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TranslatedFields/TranslatedFields.d.cts +1 -1
- package/dist/components/TranslatedFields/TranslatedFields.d.ts +1 -1
- package/dist/components/TranslatedFields/index.cjs +1 -1
- package/dist/components/TranslatedFields/index.js +1 -1
- package/dist/components/UserCard/UserCard.d.cts +6 -5
- package/dist/components/UserCard/UserCard.d.ts +6 -5
- package/dist/components/UserCard/index.cjs +1 -1
- package/dist/components/UserCard/index.js +1 -1
- package/dist/entries/app.cjs +1 -1
- package/dist/entries/app.js +1 -1
- package/dist/entries/components.cjs +1 -1
- package/dist/entries/components.js +56 -56
- package/dist/entries/i18n.cjs +1 -1
- package/dist/entries/i18n.js +2 -2
- package/dist/entries/theme.cjs +1 -1
- package/dist/entries/theme.d.cts +2 -2
- package/dist/entries/theme.d.ts +2 -2
- package/dist/entries/theme.js +14 -13
- package/dist/form/useForm.d.cts +1 -1
- package/dist/form/useForm.d.ts +1 -1
- package/dist/hooks/useMediaQuery.d.cts +3 -3
- package/dist/hooks/useMediaQuery.d.ts +3 -3
- package/dist/i18n/messages.d.cts +20 -0
- package/dist/i18n/messages.d.ts +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.css +3 -3
- package/dist/index.js +236 -235
- package/dist/{messages-BasxRpyx.js → messages-BiRLMy1E.js} +177 -37
- package/dist/messages-BiRLMy1E.js.map +1 -0
- package/dist/{messages-CElolVGm.cjs → messages-C_fRRCg6.cjs} +9 -9
- package/dist/messages-C_fRRCg6.cjs.map +1 -0
- package/dist/theme/ConfigProvider.d.cts +39 -10
- package/dist/theme/ConfigProvider.d.ts +39 -10
- package/dist/theme/index.d.cts +2 -2
- package/dist/theme/index.d.ts +2 -2
- package/dist/useForm-CGbJ44Gp.js.map +1 -1
- package/dist/useForm-CSw6r1n1.cjs.map +1 -1
- package/dist/{useHomeTo-Btkk0RSB.js → useHomeTo-DdmOGy09.js} +2 -2
- package/dist/{useHomeTo-Btkk0RSB.js.map → useHomeTo-DdmOGy09.js.map} +1 -1
- package/dist/{useHomeTo-BnjXms11.cjs → useHomeTo-HCkVzGTu.cjs} +2 -2
- package/dist/{useHomeTo-BnjXms11.cjs.map → useHomeTo-HCkVzGTu.cjs.map} +1 -1
- package/dist/useMediaQuery-CHMrI6Dy.cjs.map +1 -1
- package/dist/useMediaQuery-DrDUrkmJ.js.map +1 -1
- package/dist/{useOptionMenu-IebDGoqk.cjs → useOptionMenu-BqCj10_a.cjs} +2 -2
- package/dist/{useOptionMenu-IebDGoqk.cjs.map → useOptionMenu-BqCj10_a.cjs.map} +1 -1
- package/dist/{useOptionMenu-DeW68na-.js → useOptionMenu-EiyIkC3E.js} +5 -5
- package/dist/{useOptionMenu-DeW68na-.js.map → useOptionMenu-EiyIkC3E.js.map} +1 -1
- package/package.json +1 -1
- package/dist/AdminRoot-aOYQtzF0.js +0 -109
- package/dist/AdminRoot-aOYQtzF0.js.map +0 -1
- package/dist/AdminRoot-ajWIf94J.cjs +0 -2
- package/dist/AdminRoot-ajWIf94J.cjs.map +0 -1
- package/dist/Alert-5tpyGb2M.cjs +0 -2
- package/dist/Alert-5tpyGb2M.cjs.map +0 -1
- package/dist/Alert-Dz0sNGpz.js +0 -70
- package/dist/Alert-Dz0sNGpz.js.map +0 -1
- package/dist/Breadcrumbs-B6Pii2Y_.cjs.map +0 -1
- package/dist/Breadcrumbs-DKYJOdHZ.js.map +0 -1
- package/dist/Card-CIRGqg3P.cjs +0 -2
- package/dist/Card-CIRGqg3P.cjs.map +0 -1
- package/dist/Card-Co3A4Qgo.js +0 -128
- package/dist/Card-Co3A4Qgo.js.map +0 -1
- package/dist/Chip-BjSNgaAf.js.map +0 -1
- package/dist/Chip-Dp8skUZ2.cjs.map +0 -1
- package/dist/ChoiceCardGroup-143hR0v_.cjs +0 -2
- package/dist/ChoiceCardGroup-Cx8CtmPl.js +0 -180
- package/dist/ChoiceCardGroup-Cx8CtmPl.js.map +0 -1
- package/dist/CodeBlock-CcJjS0_q.js.map +0 -1
- package/dist/CodeBlock-o_VSkAek.cjs.map +0 -1
- package/dist/ColorPicker-DY6Vk1uS.cjs +0 -2
- package/dist/ConfigProvider-Bgu85MsI.js.map +0 -1
- package/dist/ConfigProvider-DELhJlqo.cjs +0 -2
- package/dist/ConfigProvider-DELhJlqo.cjs.map +0 -1
- package/dist/DatePicker-CwZ_-ElE.cjs +0 -2
- package/dist/DateTimePicker-C2871cuc.js.map +0 -1
- package/dist/DateTimePicker-DdEPtw9U.cjs +0 -2
- package/dist/DateTimePicker-DdEPtw9U.cjs.map +0 -1
- package/dist/DescriptionList-BP4CDME5.js.map +0 -1
- package/dist/DescriptionList-BWw0Fe6U.cjs.map +0 -1
- package/dist/FileCard-COc4rHe-.cjs.map +0 -1
- package/dist/FileCard-CWwB8CWF.js.map +0 -1
- package/dist/FileUploader--WOmlhSh.js.map +0 -1
- package/dist/FileUploader-Bqy_fV7l.cjs.map +0 -1
- package/dist/ListItem-Qo1Tt6Fi.cjs +0 -2
- package/dist/Modal--5EbLfMz.cjs.map +0 -1
- package/dist/Modal-Dfwc9eIq.js.map +0 -1
- package/dist/OtpField-Dy-LKTi9.js +0 -174
- package/dist/OtpField-Dy-LKTi9.js.map +0 -1
- package/dist/OtpField-KHwdaajC.cjs +0 -2
- package/dist/OtpField-KHwdaajC.cjs.map +0 -1
- package/dist/PageLayout-Bt6U_80d.cjs.map +0 -1
- package/dist/PageLayout-Df1SOlr7.js.map +0 -1
- package/dist/Pagination-DDMq_7OZ.js +0 -139
- package/dist/Pagination-DDMq_7OZ.js.map +0 -1
- package/dist/Pagination-UMeckhmY.cjs +0 -2
- package/dist/Pagination-UMeckhmY.cjs.map +0 -1
- package/dist/QrCode-B9YbQNVc.js +0 -80
- package/dist/QrCode-B9YbQNVc.js.map +0 -1
- package/dist/QrCode-CNVYpz9j.cjs +0 -2
- package/dist/QrCode-CNVYpz9j.cjs.map +0 -1
- package/dist/RichTextEditor-Dv-LDsN-.js.map +0 -1
- package/dist/RichTextEditor-lmPGowSR.cjs +0 -2
- package/dist/RichTextEditor-lmPGowSR.cjs.map +0 -1
- package/dist/RootLayout-B_ZtI-L_.cjs +0 -2
- package/dist/RootLayout-B_ZtI-L_.cjs.map +0 -1
- package/dist/RootLayout-DIOquzrU.js +0 -642
- package/dist/RootLayout-DIOquzrU.js.map +0 -1
- package/dist/Sidebar-CfEx7W7i.cjs +0 -2
- package/dist/Slider-0joKXhPo.cjs +0 -2
- package/dist/Slider-0joKXhPo.cjs.map +0 -1
- package/dist/Slider-CwZYxDO0.js +0 -184
- package/dist/Slider-CwZYxDO0.js.map +0 -1
- package/dist/Stepper-D7An-ugU.cjs.map +0 -1
- package/dist/Stepper-DYpiLhzD.js.map +0 -1
- package/dist/Table-BhaH8EKZ.cjs.map +0 -1
- package/dist/Table-DK4GBKS3.js.map +0 -1
- package/dist/TagsField-Cg9YVl7G.js.map +0 -1
- package/dist/TagsField-DwZLCIeb.cjs +0 -2
- package/dist/TagsField-DwZLCIeb.cjs.map +0 -1
- package/dist/TimePicker-_Ak5yB_5.cjs +0 -2
- package/dist/Toaster-Dput5iLU.js +0 -63
- package/dist/Toaster-Dput5iLU.js.map +0 -1
- package/dist/Toaster-fjyF8W3F.cjs +0 -2
- package/dist/Toaster-fjyF8W3F.cjs.map +0 -1
- package/dist/TranslatedFields-B-BU17IV.cjs +0 -2
- package/dist/TranslatedFields-B-BU17IV.cjs.map +0 -1
- package/dist/TranslatedFields-JnqLgUiF.js +0 -86
- package/dist/TranslatedFields-JnqLgUiF.js.map +0 -1
- package/dist/UserCard-B9bzkZph.cjs.map +0 -1
- package/dist/UserCard-DYK6S-nr.js.map +0 -1
- package/dist/messages-BasxRpyx.js.map +0 -1
- package/dist/messages-CElolVGm.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker-_Ak5yB_5.cjs","sources":["../src/components/TimePicker/TimePicker.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 { Typography } from '../Typography'\nimport { TimeColumns } from '../DateTimePicker/TimeColumns'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseInput,\n parseTime,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport tp from './TimePicker.module.css'\n\nexport type TimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface TimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and popover density. */\n size?: TimePickerSize\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 time string in `valueFormat` (`''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next time in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'HH:mm:ss'` (or `hh:mm:ss A` when\n * `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 `'HH:mm:ss[Z]'` when `utc` (the `Z` marks UTC), or `'HH:mm:ss'` when\n * `utc={false}`. Incoming values are parsed **leniently** (this format, then a numeric time — so a\n * backend time like `'09:35:49.6134342'` is accepted, ms-capped — then any ISO-8601 datetime, whose\n * time is used). Only the time-of-day is used; the date is ignored.\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 — the field shows and emits the value's exact wall-clock.\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 /** 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 time 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 if (hour12) return showSeconds ? 'hh:mm:ss A' : 'hh:mm A'\n return showSeconds ? 'HH:mm:ss' : 'HH:mm'\n}\n\n/** Compares two datetimes by **time of day** only (ignoring the date) at the given precision. */\nfunction sameTime(a: Dayjs, b: Dayjs, unit: 'minute' | 'second'): boolean {\n if (a.hour() !== b.hour() || a.minute() !== b.minute()) return false\n return unit === 'minute' ? true : a.second() === b.second()\n}\n\n/**\n * A time-of-day field with a typed, masked input **and** a popover of scrollable time columns\n * (hour / minute / optional second + AM/PM in 12-hour mode) — the time sibling of `DateTimePicker`,\n * with no calendar. The value is a string in `valueFormat` (UTC, with a `Z`, unless `utc={false}`) —\n * incoming values are parsed leniently (a richer backend time is accepted) and the chosen time emitted\n * in that format. Picking keeps the popover open until you click away, press Escape, or hit Done.\n * Supports `hour12`, `minuteStep`, `showSeconds`, and `clearable`. Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires `dayjs`.\n */\nexport const TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\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 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 format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // UTC time-of-day carries a `Z` (\"09:35:00Z\"); `utc={false}` emits the bare wall-clock. Override via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'HH:mm:ss[Z]' : 'HH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` time 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 time 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 selected = utc\n ? utcToLocalWall(parseTime(currentValue, valueFormat))\n : parseTime(currentValue, valueFormat)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const mask = maskFromFormat(format)\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 time in the wire `valueFormat`, or '' to clear. Re-picking the same time-of-day is a no-op\n const commitTime = (d: Dayjs | null) => {\n if (d && selected && sameTime(d, 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 const changed = (d: Dayjs) => !selected || !sameTime(d, selected, timeUnit)\n\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\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 ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\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 const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('')\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && changed(parsed)) commitTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('')\n } else if (parsed) {\n if (changed(parsed)) commitTime(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 const handleTimeChange = (next: Dayjs) => commitTime(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('timePicker.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('timePicker.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=\"Clock\" 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 time\"\n trapFocus\n className={styles.popover}\n >\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n autoFocus\n />\n <div className={tp.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"],"names":["defaultFormatFor","hour12","showSeconds","sameTime","a","b","unit","TimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","selected","utcToLocalWall","parseTime","resolvedError","resolvedHelperText","mask","maskFromFormat","timeUnit","commit","next","commitTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","TimeColumns","tp","Button"],"mappings":"seA2FA,SAASA,GAAiBC,EAAiBC,EAA8B,CACvE,OAAID,EAAeC,EAAc,aAAe,UACzCA,EAAc,WAAa,OACpC,CAGA,SAASC,EAASC,EAAUC,EAAUC,EAAoC,CACxE,OAAIF,EAAE,SAAWC,EAAE,KAAA,GAAUD,EAAE,WAAaC,EAAE,OAAA,EAAiB,GACxDC,IAAS,SAAW,GAAOF,EAAE,OAAA,IAAaC,EAAE,OAAA,CACrD,CAWO,MAAME,GAAaC,EAAAA,WAA8C,SACtE,CACE,MAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,EACA,aAAAC,EACA,SAAAC,EACA,OAAQC,EACR,YAAaC,GACb,IAAAC,EAAM,GACN,OAAApB,EAAS,GACT,WAAAqB,GAAa,EACb,YAAApB,EAAc,GACd,YAAAqB,GACA,UAAAC,GAAY,GACZ,KAAAC,EACA,GAAIC,GACJ,UAAAC,GACA,MAAAC,EACF,EACAC,EACA,CACA,MAAMC,EAAIC,GAAAA,KAAA,EACJC,GAAUC,EAAAA,MAAA,EACVC,EAAKR,IAAUM,GACfG,EAAW,GAAGD,CAAE,UAChBE,EAASjB,GAAcnB,GAAiBC,EAAQC,CAAW,EAE3DmC,EAAcjB,KAAoBC,EAAM,cAAgB,YAGxDiB,EAAOC,GAAAA,eAAA,EACPC,EAAc,GAAQF,GAAQb,GAC9BgB,EAAQD,EAAcF,EAAM,MAAMb,CAAK,EAAI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,IAAA,CAAK,CAAA,CAAA,EAIvCF,EAAAA,IAACG,GAAAA,WAAA,CACC,KAAK,SACL,QAAQ,OACR,MAAM,UACN,KAAAtF,EACA,SAAAK,EACA,aAAYe,EAAE,iBAAiB,EAC/B,gBAAc,SACd,gBAAesC,EACf,UAAWwB,EAAAA,OAAO,eAClB,YAAc,GAAM,EAAE,eAAA,EACtB,QAAS,IAAMvB,EAAS4B,GAAM,CAACA,CAAC,EAEhC,SAAAJ,EAAAA,IAACE,OAAA,CAAK,KAAK,QAAQ,KAAMN,EAAA,CAAU,CAAA,CAAA,CACrC,EACF,EAEAC,EAAAA,KAACQ,GAAAA,cAAA,CACC,IAAKxB,EACL,KAAAN,EACA,WAAAH,EACA,QAASU,EACT,KAAK,SACL,UAAU,cACV,UAAS,GACT,UAAWiB,EAAAA,OAAO,QAElB,SAAA,CAAAC,EAAAA,IAACM,GAAAA,YAAA,CACC,MAAOnD,EACP,SAAUwC,GACV,OAAAvF,EACA,WAAAqB,GACA,YAAApB,EACA,UAAS,EAAA,CAAA,EAEX2F,EAAAA,IAAC,OAAI,UAAWO,GAAG,OACjB,SAAAP,MAACQ,GAAAA,OAAA,CAAO,KAAK,KAAK,QAAQ,SAAS,MAAM,UAAU,QAAS,IAAM1B,EAAa,EAAI,EAChF,SAAA7C,EAAE,aAAa,CAAA,CAClB,CAAA,CACF,CAAA,CAAA,CAAA,EAGDsB,GAAsB,MACrByC,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAI3D,EACJ,QAAQ,YACR,MAAOgB,EAAgB,QAAU,QACjC,UAAWyC,EAAAA,OAAO,OAEjB,SAAAxC,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
|
|
1
|
+
{"version":3,"file":"TimePicker-DjL15hz1.cjs","sources":["../src/components/TimePicker/TimePicker.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 { Typography } from '../Typography'\nimport { TimeColumns } from '../DateTimePicker/TimeColumns'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseInput,\n parseTime,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport tp from './TimePicker.module.css'\n\nexport type TimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface TimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and popover density. */\n size?: TimePickerSize\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 time string in `valueFormat` (`''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next time in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'HH:mm:ss'` (or `hh:mm:ss A` when\n * `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 `'HH:mm:ss[Z]'` when `utc` (the `Z` marks UTC), or `'HH:mm:ss'` when\n * `utc={false}`. Incoming values are parsed **leniently** (this format, then a numeric time — so a\n * backend time like `'09:35:49.6134342'` is accepted, ms-capped — then any ISO-8601 datetime, whose\n * time is used). Only the time-of-day is used; the date is ignored.\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 — the field shows and emits the value's exact wall-clock.\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 /** 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 time 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 if (hour12) return showSeconds ? 'hh:mm:ss A' : 'hh:mm A'\n return showSeconds ? 'HH:mm:ss' : 'HH:mm'\n}\n\n/** Compares two datetimes by **time of day** only (ignoring the date) at the given precision. */\nfunction sameTime(a: Dayjs, b: Dayjs, unit: 'minute' | 'second'): boolean {\n if (a.hour() !== b.hour() || a.minute() !== b.minute()) return false\n return unit === 'minute' ? true : a.second() === b.second()\n}\n\n/**\n * A time-of-day field with a typed, masked input **and** a popover of scrollable time columns\n * (hour / minute / optional second + AM/PM in 12-hour mode) — the time sibling of `DateTimePicker`,\n * with no calendar. The value is a string in `valueFormat` (UTC, with a `Z`, unless `utc={false}`) —\n * incoming values are parsed leniently (a richer backend time is accepted) and the chosen time emitted\n * in that format. Picking keeps the popover open until you click away, press Escape, or hit Done.\n * Supports `hour12`, `minuteStep`, `showSeconds`, and `clearable`. Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires `dayjs`.\n */\nexport const TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\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 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 format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // UTC time-of-day carries a `Z` (\"09:35:00Z\"); `utc={false}` emits the bare wall-clock. Override via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'HH:mm:ss[Z]' : 'HH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` time 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 time 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 selected = utc\n ? utcToLocalWall(parseTime(currentValue, valueFormat))\n : parseTime(currentValue, valueFormat)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const mask = maskFromFormat(format)\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 time in the wire `valueFormat`, or '' to clear. Re-picking the same time-of-day is a no-op\n const commitTime = (d: Dayjs | null) => {\n if (d && selected && sameTime(d, 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 const changed = (d: Dayjs) => !selected || !sameTime(d, selected, timeUnit)\n\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\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 ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\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 const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('')\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && changed(parsed)) commitTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('')\n } else if (parsed) {\n if (changed(parsed)) commitTime(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 const handleTimeChange = (next: Dayjs) => commitTime(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('timePicker.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('timePicker.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=\"Clock\" 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={t('timePicker.dialog')}\n trapFocus\n className={styles.popover}\n >\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n autoFocus\n />\n <div className={tp.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"],"names":["defaultFormatFor","hour12","showSeconds","sameTime","a","b","unit","TimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","selected","utcToLocalWall","parseTime","resolvedError","resolvedHelperText","mask","maskFromFormat","timeUnit","commit","next","commitTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","TimeColumns","tp","Button"],"mappings":"seA2FA,SAASA,GAAiBC,EAAiBC,EAA8B,CACvE,OAAID,EAAeC,EAAc,aAAe,UACzCA,EAAc,WAAa,OACpC,CAGA,SAASC,EAASC,EAAUC,EAAUC,EAAoC,CACxE,OAAIF,EAAE,SAAWC,EAAE,KAAA,GAAUD,EAAE,WAAaC,EAAE,OAAA,EAAiB,GACxDC,IAAS,SAAW,GAAOF,EAAE,OAAA,IAAaC,EAAE,OAAA,CACrD,CAWO,MAAME,GAAaC,EAAAA,WAA8C,SACtE,CACE,MAAAC,EACA,KAAAC,EAAO,KACP,MAAAC,EACA,WAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,EAAY,GACZ,SAAAC,EAAW,GACX,MAAAC,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,MAACQ,GAAAA,OAAA,CAAO,KAAK,KAAK,QAAQ,SAAS,MAAM,UAAU,QAAS,IAAM1B,EAAa,EAAI,EAChF,SAAA7C,EAAE,aAAa,CAAA,CAClB,CAAA,CACF,CAAA,CAAA,CAAA,EAGDsB,GAAsB,MACrByC,EAAAA,IAACC,EAAAA,WAAA,CACC,GAAG,OACH,GAAI3D,EACJ,QAAQ,YACR,MAAOgB,EAAgB,QAAU,QACjC,UAAWyC,EAAAA,OAAO,OAEjB,SAAAxC,CAAA,CAAA,CACH,CAAA,CAAA,CAIR,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as xe, useId as
|
|
1
|
+
import { jsxs as y, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as xe, useId as ge, useState as V, useEffect as Ne, useRef as x, useCallback as Z } from "react";
|
|
3
3
|
import { clsx as $ } from "clsx";
|
|
4
4
|
import { u as Be } from "./formContext-B7ln1Miy.js";
|
|
5
5
|
import { F as He } from "./FloatingPanel-C5c_eMQ0.js";
|
|
6
|
-
import { B as
|
|
6
|
+
import { B as Pe } from "./Button-CtADzomU.js";
|
|
7
7
|
import { b as G } from "./Icon-D5TxgfCc.js";
|
|
8
|
-
import { I as
|
|
8
|
+
import { I as be } from "./IconButton-BoURJOUD.js";
|
|
9
9
|
import { T as J } from "./Typography-ChSuxgkc.js";
|
|
10
|
-
import { T as Re } from "./TimeColumns-
|
|
11
|
-
import { u as De, h as K, m as Ee, s as
|
|
12
|
-
import { a as Ve } from "./ConfigProvider-
|
|
10
|
+
import { T as Re } from "./TimeColumns-BWcuu3l7.js";
|
|
11
|
+
import { u as De, h as K, m as Ee, s as t, b as Q, c as Le, l as Me } from "./DatePicker.module-CMMQyEhG.js";
|
|
12
|
+
import { a as Ve } from "./ConfigProvider-Dqfu7UBU.js";
|
|
13
13
|
const We = "_footer_p1ea2_7", _e = {
|
|
14
14
|
footer: We
|
|
15
15
|
};
|
|
@@ -24,15 +24,15 @@ const Qe = xe(function({
|
|
|
24
24
|
size: m = "md",
|
|
25
25
|
error: Y,
|
|
26
26
|
helperText: ee,
|
|
27
|
-
required:
|
|
28
|
-
fullWidth:
|
|
27
|
+
required: te = !1,
|
|
28
|
+
fullWidth: oe = !0,
|
|
29
29
|
disabled: h = !1,
|
|
30
|
-
value:
|
|
30
|
+
value: g,
|
|
31
31
|
defaultValue: re,
|
|
32
32
|
onChange: N,
|
|
33
33
|
format: se,
|
|
34
34
|
valueFormat: ae,
|
|
35
|
-
utc:
|
|
35
|
+
utc: B = !0,
|
|
36
36
|
hour12: W = !1,
|
|
37
37
|
minuteStep: ne = 1,
|
|
38
38
|
showSeconds: _ = !0,
|
|
@@ -43,30 +43,30 @@ const Qe = xe(function({
|
|
|
43
43
|
className: me,
|
|
44
44
|
style: ue
|
|
45
45
|
}, f) {
|
|
46
|
-
const
|
|
47
|
-
e !== p && (w || he(e), C &&
|
|
46
|
+
const v = Ve(), fe = ge(), H = ce ?? fe, j = `${H}-helper`, n = se ?? je(W, _), T = ae ?? (B ? "HH:mm:ss[Z]" : "HH:mm:ss"), k = Be(), C = !!(k && u), o = C ? k.field(u) : void 0, pe = g !== void 0 ? g : C ? k.values[u] ?? "" : void 0, w = g !== void 0 || C, [de, he] = V(re ?? ""), p = w ? pe : de, r = B ? De(K(p, T)) : K(p, T), P = Y ?? (o == null ? void 0 : o.error) ?? !1, b = ee ?? (o == null ? void 0 : o.helperText), ve = Ee(n), Te = /s/.test(n) ? "second" : "minute", F = (e) => {
|
|
47
|
+
e !== p && (w || he(e), C && k.setValue(u, e), N == null || N(e));
|
|
48
48
|
}, R = (e) => {
|
|
49
|
-
e && r && X(e, r, "second") ||
|
|
49
|
+
e && r && X(e, r, "second") || F(e ? (B ? Me(e) : e).format(T) : "");
|
|
50
50
|
}, z = (e) => !r || !X(e, r, Te), [D, d] = V(
|
|
51
51
|
() => r ? r.format(n) : ""
|
|
52
52
|
);
|
|
53
|
-
|
|
53
|
+
Ne(() => {
|
|
54
54
|
d(r ? r.format(n) : "");
|
|
55
|
-
}, [p, n,
|
|
56
|
-
const E =
|
|
55
|
+
}, [p, n, T]);
|
|
56
|
+
const E = x(null), L = x(null), [M, A] = V(!1), ke = Z(
|
|
57
57
|
(e) => {
|
|
58
58
|
L.current = e, typeof f == "function" ? f(e) : f && (f.current = e);
|
|
59
59
|
},
|
|
60
60
|
[f]
|
|
61
|
-
),
|
|
62
|
-
|
|
63
|
-
const S =
|
|
61
|
+
), I = x(void 0);
|
|
62
|
+
I.current = o ? () => o.onBlur({}) : void 0;
|
|
63
|
+
const S = x(null), U = Z((e) => {
|
|
64
64
|
var s, l;
|
|
65
|
-
A(!1), (s =
|
|
66
|
-
}, []),
|
|
65
|
+
A(!1), (s = I.current) == null || s.call(I), e && ((l = L.current) == null || l.focus());
|
|
66
|
+
}, []), Ce = (e) => {
|
|
67
67
|
const s = Le(e, ve);
|
|
68
68
|
if (d(s), s === "") {
|
|
69
|
-
|
|
69
|
+
F("");
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
const l = Q(s, n);
|
|
@@ -74,42 +74,42 @@ const Qe = xe(function({
|
|
|
74
74
|
}, Fe = (e) => {
|
|
75
75
|
var q, O;
|
|
76
76
|
const s = Q(D, n);
|
|
77
|
-
D === "" ?
|
|
77
|
+
D === "" ? F("") : s ? (z(s) && R(s), d(s.format(n))) : d(r ? r.format(n) : "");
|
|
78
78
|
const l = e.relatedTarget;
|
|
79
|
-
l && ((q = S.current) != null && q.contains(l) || (O = E.current) != null && O.contains(l)) ||
|
|
79
|
+
l && ((q = S.current) != null && q.contains(l) || (O = E.current) != null && O.contains(l)) || o == null || o.onBlur(e);
|
|
80
80
|
}, Ie = (e) => R(e), ye = m === "sm" ? "sm" : "md";
|
|
81
|
-
return /* @__PURE__ */
|
|
81
|
+
return /* @__PURE__ */ y(
|
|
82
82
|
"div",
|
|
83
83
|
{
|
|
84
84
|
className: $(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
h &&
|
|
85
|
+
t.field,
|
|
86
|
+
t[m],
|
|
87
|
+
oe && t.fullWidth,
|
|
88
|
+
P && t.error,
|
|
89
|
+
h && t.disabled,
|
|
90
90
|
me
|
|
91
91
|
),
|
|
92
92
|
style: ue,
|
|
93
93
|
children: [
|
|
94
|
-
i != null && /* @__PURE__ */
|
|
94
|
+
i != null && /* @__PURE__ */ y("label", { htmlFor: H, className: t.label, children: [
|
|
95
95
|
/* @__PURE__ */ a(J, { as: "span", variant: "bodySmall", color: "muted", children: i }),
|
|
96
|
-
|
|
96
|
+
te && /* @__PURE__ */ a("span", { className: t.required, "aria-hidden": "true", children: "*" })
|
|
97
97
|
] }),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ y("div", { ref: E, className: $(t.control, M && t.open), children: [
|
|
99
99
|
/* @__PURE__ */ a(
|
|
100
100
|
"input",
|
|
101
101
|
{
|
|
102
|
-
ref:
|
|
102
|
+
ref: ke,
|
|
103
103
|
id: H,
|
|
104
104
|
name: u,
|
|
105
|
-
className:
|
|
105
|
+
className: t.input,
|
|
106
106
|
value: D,
|
|
107
107
|
placeholder: le ?? n.toLowerCase(),
|
|
108
108
|
disabled: h,
|
|
109
109
|
autoComplete: "off",
|
|
110
|
-
"aria-invalid":
|
|
111
|
-
"aria-describedby":
|
|
112
|
-
onChange: (e) =>
|
|
110
|
+
"aria-invalid": P || void 0,
|
|
111
|
+
"aria-describedby": b != null ? j : void 0,
|
|
112
|
+
onChange: (e) => Ce(e.target.value),
|
|
113
113
|
onBlur: Fe
|
|
114
114
|
}
|
|
115
115
|
),
|
|
@@ -117,36 +117,36 @@ const Qe = xe(function({
|
|
|
117
117
|
"button",
|
|
118
118
|
{
|
|
119
119
|
type: "button",
|
|
120
|
-
className:
|
|
121
|
-
"aria-label":
|
|
120
|
+
className: t.clear,
|
|
121
|
+
"aria-label": v("timePicker.clear"),
|
|
122
122
|
tabIndex: -1,
|
|
123
123
|
onMouseDown: (e) => e.preventDefault(),
|
|
124
124
|
onClick: () => {
|
|
125
125
|
var e;
|
|
126
|
-
|
|
126
|
+
F(""), d(""), (e = L.current) == null || e.focus();
|
|
127
127
|
},
|
|
128
128
|
children: /* @__PURE__ */ a(G, { name: "CloseCircle", size: "sm" })
|
|
129
129
|
}
|
|
130
130
|
),
|
|
131
131
|
/* @__PURE__ */ a(
|
|
132
|
-
|
|
132
|
+
be,
|
|
133
133
|
{
|
|
134
134
|
type: "button",
|
|
135
135
|
variant: "text",
|
|
136
136
|
color: "primary",
|
|
137
137
|
size: m,
|
|
138
138
|
disabled: h,
|
|
139
|
-
"aria-label":
|
|
139
|
+
"aria-label": v("timePicker.open"),
|
|
140
140
|
"aria-haspopup": "dialog",
|
|
141
141
|
"aria-expanded": M,
|
|
142
|
-
className:
|
|
142
|
+
className: t.calendarButton,
|
|
143
143
|
onMouseDown: (e) => e.preventDefault(),
|
|
144
144
|
onClick: () => A((e) => !e),
|
|
145
145
|
children: /* @__PURE__ */ a(G, { name: "Clock", size: ye })
|
|
146
146
|
}
|
|
147
147
|
)
|
|
148
148
|
] }),
|
|
149
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ y(
|
|
150
150
|
He,
|
|
151
151
|
{
|
|
152
152
|
ref: S,
|
|
@@ -154,9 +154,9 @@ const Qe = xe(function({
|
|
|
154
154
|
triggerRef: E,
|
|
155
155
|
onClose: U,
|
|
156
156
|
role: "dialog",
|
|
157
|
-
ariaLabel: "
|
|
157
|
+
ariaLabel: v("timePicker.dialog"),
|
|
158
158
|
trapFocus: !0,
|
|
159
|
-
className:
|
|
159
|
+
className: t.popover,
|
|
160
160
|
children: [
|
|
161
161
|
/* @__PURE__ */ a(
|
|
162
162
|
Re,
|
|
@@ -169,19 +169,19 @@ const Qe = xe(function({
|
|
|
169
169
|
autoFocus: !0
|
|
170
170
|
}
|
|
171
171
|
),
|
|
172
|
-
/* @__PURE__ */ a("div", { className: _e.footer, children: /* @__PURE__ */ a(
|
|
172
|
+
/* @__PURE__ */ a("div", { className: _e.footer, children: /* @__PURE__ */ a(Pe, { size: "sm", variant: "filled", color: "primary", onClick: () => U(!0), children: v("common.done") }) })
|
|
173
173
|
]
|
|
174
174
|
}
|
|
175
175
|
),
|
|
176
|
-
|
|
176
|
+
b != null && /* @__PURE__ */ a(
|
|
177
177
|
J,
|
|
178
178
|
{
|
|
179
179
|
as: "span",
|
|
180
180
|
id: j,
|
|
181
181
|
variant: "bodySmall",
|
|
182
|
-
color:
|
|
183
|
-
className:
|
|
184
|
-
children:
|
|
182
|
+
color: P ? "error" : "muted",
|
|
183
|
+
className: t.helper,
|
|
184
|
+
children: b
|
|
185
185
|
}
|
|
186
186
|
)
|
|
187
187
|
]
|
|
@@ -191,4 +191,4 @@ const Qe = xe(function({
|
|
|
191
191
|
export {
|
|
192
192
|
Qe as T
|
|
193
193
|
};
|
|
194
|
-
//# sourceMappingURL=TimePicker-
|
|
194
|
+
//# sourceMappingURL=TimePicker-YMVHevpZ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimePicker-DHdsY8kQ.js","sources":["../src/components/TimePicker/TimePicker.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 { Typography } from '../Typography'\nimport { TimeColumns } from '../DateTimePicker/TimeColumns'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseInput,\n parseTime,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport tp from './TimePicker.module.css'\n\nexport type TimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface TimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and popover density. */\n size?: TimePickerSize\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 time string in `valueFormat` (`''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next time in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'HH:mm:ss'` (or `hh:mm:ss A` when\n * `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 `'HH:mm:ss[Z]'` when `utc` (the `Z` marks UTC), or `'HH:mm:ss'` when\n * `utc={false}`. Incoming values are parsed **leniently** (this format, then a numeric time — so a\n * backend time like `'09:35:49.6134342'` is accepted, ms-capped — then any ISO-8601 datetime, whose\n * time is used). Only the time-of-day is used; the date is ignored.\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 — the field shows and emits the value's exact wall-clock.\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 /** 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 time 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 if (hour12) return showSeconds ? 'hh:mm:ss A' : 'hh:mm A'\n return showSeconds ? 'HH:mm:ss' : 'HH:mm'\n}\n\n/** Compares two datetimes by **time of day** only (ignoring the date) at the given precision. */\nfunction sameTime(a: Dayjs, b: Dayjs, unit: 'minute' | 'second'): boolean {\n if (a.hour() !== b.hour() || a.minute() !== b.minute()) return false\n return unit === 'minute' ? true : a.second() === b.second()\n}\n\n/**\n * A time-of-day field with a typed, masked input **and** a popover of scrollable time columns\n * (hour / minute / optional second + AM/PM in 12-hour mode) — the time sibling of `DateTimePicker`,\n * with no calendar. The value is a string in `valueFormat` (UTC, with a `Z`, unless `utc={false}`) —\n * incoming values are parsed leniently (a richer backend time is accepted) and the chosen time emitted\n * in that format. Picking keeps the popover open until you click away, press Escape, or hit Done.\n * Supports `hour12`, `minuteStep`, `showSeconds`, and `clearable`. Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires `dayjs`.\n */\nexport const TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\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 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 format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // UTC time-of-day carries a `Z` (\"09:35:00Z\"); `utc={false}` emits the bare wall-clock. Override via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'HH:mm:ss[Z]' : 'HH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` time 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 time 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 selected = utc\n ? utcToLocalWall(parseTime(currentValue, valueFormat))\n : parseTime(currentValue, valueFormat)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const mask = maskFromFormat(format)\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 time in the wire `valueFormat`, or '' to clear. Re-picking the same time-of-day is a no-op\n const commitTime = (d: Dayjs | null) => {\n if (d && selected && sameTime(d, 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 const changed = (d: Dayjs) => !selected || !sameTime(d, selected, timeUnit)\n\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\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 ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\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 const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('')\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && changed(parsed)) commitTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('')\n } else if (parsed) {\n if (changed(parsed)) commitTime(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 const handleTimeChange = (next: Dayjs) => commitTime(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('timePicker.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('timePicker.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=\"Clock\" 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 time\"\n trapFocus\n className={styles.popover}\n >\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n autoFocus\n />\n <div className={tp.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"],"names":["defaultFormatFor","hour12","showSeconds","sameTime","a","b","unit","TimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","selected","utcToLocalWall","parseTime","resolvedError","resolvedHelperText","mask","maskFromFormat","timeUnit","commit","next","commitTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","TimeColumns","tp","Button"],"mappings":";;;;;;;;;;;;;;;AA2FA,SAASA,GAAiBC,GAAiBC,GAA8B;AACvE,SAAID,IAAeC,IAAc,eAAe,YACzCA,IAAc,aAAa;AACpC;AAGA,SAASC,EAASC,GAAUC,GAAUC,GAAoC;AACxE,SAAIF,EAAE,WAAWC,EAAE,KAAA,KAAUD,EAAE,aAAaC,EAAE,OAAA,IAAiB,KACxDC,MAAS,WAAW,KAAOF,EAAE,OAAA,MAAaC,EAAE,OAAA;AACrD;AAWO,MAAME,KAAaC,GAA8C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,KAAW;AAAA,EACX,WAAAC,KAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAQC;AAAA,EACR,aAAaC;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,QAAApB,IAAS;AAAA,EACT,YAAAqB,KAAa;AAAA,EACb,aAAApB,IAAc;AAAA,EACd,aAAAqB;AAAA,EACA,WAAAC,KAAY;AAAA,EACZ,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GACA;AACA,QAAMC,IAAIC,GA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AA;AAAA,cAAA,gBAAAC;AAAA,gBAACM;AAAA,gBAAA;AAAA,kBACC,OAAOnD;AAAA,kBACP,UAAUwC;AAAA,kBACV,QAAAvF;AAAA,kBACA,YAAAqB;AAAA,kBACA,aAAApB;AAAA,kBACA,WAAS;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEX,gBAAA2F,EAAC,SAAI,WAAWO,GAAG,QACjB,UAAA,gBAAAP,EAACQ,IAAA,EAAO,MAAK,MAAK,SAAQ,UAAS,OAAM,WAAU,SAAS,MAAM1B,EAAa,EAAI,GAChF,UAAA7C,EAAE,aAAa,EAAA,CAClB,EAAA,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDsB,KAAsB,QACrB,gBAAAyC;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAI3D;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWyC,EAAO;AAAA,YAEjB,UAAAxC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"TimePicker-YMVHevpZ.js","sources":["../src/components/TimePicker/TimePicker.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 { Typography } from '../Typography'\nimport { TimeColumns } from '../DateTimePicker/TimeColumns'\nimport {\n applyMask,\n localWallToUtc,\n maskFromFormat,\n parseInput,\n parseTime,\n utcToLocalWall,\n type Dayjs,\n} from '../DatePicker/dateUtils'\nimport styles from '../DatePicker/DatePicker.module.css'\nimport tp from './TimePicker.module.css'\n\nexport type TimePickerSize = 'sm' | 'md' | 'lg'\n\nexport interface TimePickerProps {\n /** Label rendered above the field. */\n label?: ReactNode\n /** Preset size — control height, font and popover density. */\n size?: TimePickerSize\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 time string in `valueFormat` (`''` = empty). */\n value?: string\n /** Initial value for uncontrolled use (in `valueFormat`). */\n defaultValue?: string\n /** Fires with the next time in `valueFormat` (`''` when cleared). */\n onChange?: (value: string) => void\n /**\n * Display + typed-input format (dayjs tokens). Defaults to `'HH:mm:ss'` (or `hh:mm:ss A` when\n * `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 `'HH:mm:ss[Z]'` when `utc` (the `Z` marks UTC), or `'HH:mm:ss'` when\n * `utc={false}`. Incoming values are parsed **leniently** (this format, then a numeric time — so a\n * backend time like `'09:35:49.6134342'` is accepted, ms-capped — then any ISO-8601 datetime, whose\n * time is used). Only the time-of-day is used; the date is ignored.\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 — the field shows and emits the value's exact wall-clock.\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 /** 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 time 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 if (hour12) return showSeconds ? 'hh:mm:ss A' : 'hh:mm A'\n return showSeconds ? 'HH:mm:ss' : 'HH:mm'\n}\n\n/** Compares two datetimes by **time of day** only (ignoring the date) at the given precision. */\nfunction sameTime(a: Dayjs, b: Dayjs, unit: 'minute' | 'second'): boolean {\n if (a.hour() !== b.hour() || a.minute() !== b.minute()) return false\n return unit === 'minute' ? true : a.second() === b.second()\n}\n\n/**\n * A time-of-day field with a typed, masked input **and** a popover of scrollable time columns\n * (hour / minute / optional second + AM/PM in 12-hour mode) — the time sibling of `DateTimePicker`,\n * with no calendar. The value is a string in `valueFormat` (UTC, with a `Z`, unless `utc={false}`) —\n * incoming values are parsed leniently (a richer backend time is accepted) and the chosen time emitted\n * in that format. Picking keeps the popover open until you click away, press Escape, or hit Done.\n * Supports `hour12`, `minuteStep`, `showSeconds`, and `clearable`. Controlled (`value` + `onChange`) or\n * uncontrolled (`defaultValue`), and binds to a surrounding `<Form>` by `name`. Requires `dayjs`.\n */\nexport const TimePicker = forwardRef<HTMLInputElement, TimePickerProps>(function TimePicker(\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 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 format = formatProp ?? defaultFormatFor(hour12, showSeconds)\n // UTC time-of-day carries a `Z` (\"09:35:00Z\"); `utc={false}` emits the bare wall-clock. Override via `valueFormat`.\n const valueFormat = valueFormatProp ?? (utc ? 'HH:mm:ss[Z]' : 'HH:mm:ss')\n\n // ── value (controlled / form-bound / uncontrolled) — a `valueFormat` time 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 time 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 selected = utc\n ? utcToLocalWall(parseTime(currentValue, valueFormat))\n : parseTime(currentValue, valueFormat)\n\n const resolvedError = error ?? bound?.error ?? false\n const resolvedHelperText = helperText ?? bound?.helperText\n\n const mask = maskFromFormat(format)\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 time in the wire `valueFormat`, or '' to clear. Re-picking the same time-of-day is a no-op\n const commitTime = (d: Dayjs | null) => {\n if (d && selected && sameTime(d, 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 const changed = (d: Dayjs) => !selected || !sameTime(d, selected, timeUnit)\n\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\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 ? () => bound.onBlur({} as FocusEvent<HTMLInputElement>) : undefined\n\n // the floating panel forwards its node here, for the focus-leaves-the-widget check on blur\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 const handleInputChange = (raw: string) => {\n const masked = applyMask(raw, mask)\n setInputText(masked)\n if (masked === '') {\n commit('')\n return\n }\n const parsed = parseInput(masked, format)\n if (parsed && changed(parsed)) commitTime(parsed)\n }\n\n const handleInputBlur = (event: FocusEvent<HTMLInputElement>) => {\n const parsed = parseInput(inputText, format)\n if (inputText === '') {\n commit('')\n } else if (parsed) {\n if (changed(parsed)) commitTime(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 const handleTimeChange = (next: Dayjs) => commitTime(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('timePicker.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('timePicker.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=\"Clock\" 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={t('timePicker.dialog')}\n trapFocus\n className={styles.popover}\n >\n <TimeColumns\n value={selected}\n onChange={handleTimeChange}\n hour12={hour12}\n minuteStep={minuteStep}\n showSeconds={showSeconds}\n autoFocus\n />\n <div className={tp.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"],"names":["defaultFormatFor","hour12","showSeconds","sameTime","a","b","unit","TimePicker","forwardRef","label","size","error","helperText","required","fullWidth","disabled","value","defaultValue","onChange","formatProp","valueFormatProp","utc","minuteStep","placeholder","clearable","name","idProp","className","style","ref","t","useT","reactId","useId","id","helperId","format","valueFormat","form","useFormContext","isFormBound","bound","externalValue","isControlled","internal","setInternal","useState","currentValue","selected","utcToLocalWall","parseTime","resolvedError","resolvedHelperText","mask","maskFromFormat","timeUnit","commit","next","commitTime","d","localWallToUtc","changed","inputText","setInputText","useEffect","triggerRef","useRef","inputRef","open","setOpen","setInputRef","useCallback","node","fieldBlurRef","popoverRef","closePopover","refocus","_a","_b","handleInputChange","raw","masked","applyMask","parsed","parseInput","handleInputBlur","event","nextEl","handleTimeChange","iconSize","jsxs","clsx","styles","jsx","Typography","Icon","IconButton","o","FloatingPanel","TimeColumns","tp","Button"],"mappings":";;;;;;;;;;;;;;;AA2FA,SAASA,GAAiBC,GAAiBC,GAA8B;AACvE,SAAID,IAAeC,IAAc,eAAe,YACzCA,IAAc,aAAa;AACpC;AAGA,SAASC,EAASC,GAAUC,GAAUC,GAAoC;AACxE,SAAIF,EAAE,WAAWC,EAAE,KAAA,KAAUD,EAAE,aAAaC,EAAE,OAAA,IAAiB,KACxDC,MAAS,WAAW,KAAOF,EAAE,OAAA,MAAaC,EAAE,OAAA;AACrD;AAWO,MAAME,KAAaC,GAA8C,SACtE;AAAA,EACE,OAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC,KAAW;AAAA,EACX,WAAAC,KAAY;AAAA,EACZ,UAAAC,IAAW;AAAA,EACX,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAQC;AAAA,EACR,aAAaC;AAAA,EACb,KAAAC,IAAM;AAAA,EACN,QAAApB,IAAS;AAAA,EACT,YAAAqB,KAAa;AAAA,EACb,aAAApB,IAAc;AAAA,EACd,aAAAqB;AAAA,EACA,WAAAC,KAAY;AAAA,EACZ,MAAAC;AAAA,EACA,IAAIC;AAAA,EACJ,WAAAC;AAAA,EACA,OAAAC;AACF,GACAC,GAC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S;AAAA,YACT,WAAW8D,EAAO;AAAA,YAElB,UAAA;AAAA,cAAA,gBAAAC;AAAA,gBAACM;AAAA,gBAAA;AAAA,kBACC,OAAOnD;AAAA,kBACP,UAAUwC;AAAA,kBACV,QAAAvF;AAAA,kBACA,YAAAqB;AAAA,kBACA,aAAApB;AAAA,kBACA,WAAS;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEX,gBAAA2F,EAAC,SAAI,WAAWO,GAAG,QACjB,UAAA,gBAAAP,EAACQ,IAAA,EAAO,MAAK,MAAK,SAAQ,UAAS,OAAM,WAAU,SAAS,MAAM1B,EAAa,EAAI,GAChF,UAAA7C,EAAE,aAAa,EAAA,CAClB,EAAA,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGDsB,KAAsB,QACrB,gBAAAyC;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAG;AAAA,YACH,IAAI3D;AAAA,YACJ,SAAQ;AAAA,YACR,OAAOgB,IAAgB,UAAU;AAAA,YACjC,WAAWyC,EAAO;AAAA,YAEjB,UAAAxC;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const a=require("react/jsx-runtime"),n=require("react"),w=require("react-dom"),r=require("./toastStore-B4Tk2Xk7.cjs"),q=require("./Alert-B4XZDk16.cjs"),_=require("./ConfigProvider-Ci9Q2HLF.cjs"),g="_viewport_1fqde_3",x="_item_1fqde_40",E="_alert_1fqde_63",m={viewport:g,item:x,alert:E},b=300;function j({toast:e,duration:l,position:i}){const[s,c]=n.useState(!1),o=e.duration??l,t=n.useRef(void 0),u=n.useRef(o),p=n.useRef(0);n.useEffect(()=>{const f=requestAnimationFrame(()=>c(!0));return()=>cancelAnimationFrame(f)},[]),n.useEffect(()=>{if(e.open)return;c(!1);const f=window.setTimeout(()=>r.removeToast(e.id),b);return()=>window.clearTimeout(f)},[e.open,e.id]);const d=()=>{t.current!=null&&(window.clearTimeout(t.current),t.current=void 0)},T=()=>{!e.open||u.current===1/0||(d(),p.current=Date.now(),t.current=window.setTimeout(()=>r.closeToast(e.id),u.current))},v=()=>{t.current!=null&&(d(),u.current-=Date.now()-p.current)};return n.useEffect(()=>(u.current=o,T(),d),[e.open,o]),a.jsx("div",{className:m.item,"data-open":s?"true":"false","data-position":i,onMouseEnter:v,onMouseLeave:T,children:a.jsx(q.Alert,{color:e.color,variant:e.variant??"contained",icon:e.icon,action:e.action,onClose:()=>r.closeToast(e.id),role:"status",className:m.alert,children:e.message})})}function y({position:e,duration:l}){const i=_.useToastConfig(),s=e??i.position??"top-center",c=l??i.duration??4e3,o=n.useSyncExternalStore(r.subscribeToasts,r.getToasts,r.getToasts);return typeof document>"u"?null:w.createPortal(a.jsx("div",{className:m.viewport,"data-position":s,"aria-live":"polite",children:o.map(t=>a.jsx(j,{toast:t,duration:c,position:s},t.id))}),document.body)}exports.Toaster=y;
|
|
2
|
+
//# sourceMappingURL=Toaster-9hZ5MuW7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toaster-9hZ5MuW7.cjs","sources":["../src/components/Toast/ToastItem.tsx","../src/components/Toast/Toaster.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { Alert } from '../Alert'\nimport { closeToast, removeToast, type ToastPosition, type ToastRecord } from './toastStore'\nimport styles from './Toaster.module.css'\n\n/** Exit-animation duration (matches `--tz-duration`) — how long to keep a closing toast mounted. */\nconst EXIT_MS = 300\n\nexport interface ToastItemProps {\n toast: ToastRecord\n /** Fallback auto-dismiss delay when the toast doesn't set its own. */\n duration: number\n position: ToastPosition\n}\n\n/**\n * One rendered toast — an `Alert` wrapped with the enter/exit animation, the auto-dismiss timer\n * (paused while hovered), and the close wiring. Internal to `Toaster`.\n */\nexport function ToastItem({ toast, duration, position }: ToastItemProps) {\n const [visible, setVisible] = useState(false)\n const ttl = toast.duration ?? duration\n const timer = useRef<number | undefined>(undefined)\n const remaining = useRef(ttl)\n const startedAt = useRef(0)\n\n // enter — flip `visible` on the next frame so the transition runs\n useEffect(() => {\n const raf = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(raf)\n }, [])\n\n // exit — when the store marks this toast closing, animate out then remove it\n useEffect(() => {\n if (toast.open) return\n setVisible(false)\n const t = window.setTimeout(() => removeToast(toast.id), EXIT_MS)\n return () => window.clearTimeout(t)\n }, [toast.open, toast.id])\n\n // auto-dismiss timer, paused on hover (tracks the remaining time across pauses)\n const clearTimer = () => {\n if (timer.current != null) {\n window.clearTimeout(timer.current)\n timer.current = undefined\n }\n }\n const resume = () => {\n if (!toast.open || remaining.current === Infinity) return\n clearTimer()\n startedAt.current = Date.now()\n timer.current = window.setTimeout(() => closeToast(toast.id), remaining.current)\n }\n const pause = () => {\n if (timer.current == null) return\n clearTimer()\n remaining.current -= Date.now() - startedAt.current\n }\n useEffect(() => {\n // (re)start from the full duration on open, and whenever an update-by-id changes `duration`\n // (otherwise the original countdown keeps running against the stale ttl)\n remaining.current = ttl\n resume()\n return clearTimer\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [toast.open, ttl])\n\n return (\n <div\n className={styles.item}\n data-open={visible ? 'true' : 'false'}\n data-position={position}\n onMouseEnter={pause}\n onMouseLeave={resume}\n >\n <Alert\n color={toast.color}\n variant={toast.variant ?? 'contained'}\n icon={toast.icon}\n action={toast.action}\n onClose={() => closeToast(toast.id)}\n role=\"status\"\n className={styles.alert}\n >\n {toast.message}\n </Alert>\n </div>\n )\n}\n","import { useSyncExternalStore } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useToastConfig } from '../../theme'\nimport { getToasts, subscribeToasts, type ToastPosition } from './toastStore'\nimport { ToastItem } from './ToastItem'\nimport styles from './Toaster.module.css'\n\nexport interface ToasterProps {\n /** Corner the toasts stack in. Defaults to the app-wide `config.toast.position`, else `top-center`. */\n position?: ToastPosition\n /**\n * Default auto-dismiss delay in ms; a per-toast `duration` overrides it. Defaults to the app-wide\n * `config.toast.duration`, else `4000`.\n */\n duration?: number\n}\n\n/**\n * The toast viewport — mount it **once** near the app root. It portals to `<body>` at `--tz-z-toast`,\n * subscribes to the imperative `toast` store, and renders each toast as an animated, auto-dismissing\n * `Alert`. Drive it from anywhere with `toast.success('Saved')` / `toast.error(...)` / `toast.dismiss(id)`.\n * `position` / `duration` resolve **prop → `config.toast` → built-in default** (`top-center` / `4000`), so the\n * prop-less viewports `AdminRoot` / `RootLayout` mount follow the app config; outside a `ConfigProvider` the\n * built-in defaults apply.\n *\n * @example\n * <Toaster position=\"top-center\" />\n * // …elsewhere:\n * toast.success('Saved')\n */\nexport function Toaster({ position: positionProp, duration: durationProp }: ToasterProps) {\n const config = useToastConfig()\n const position = positionProp ?? config.position ?? 'top-center'\n const duration = durationProp ?? config.duration ?? 4000\n const toasts = useSyncExternalStore(subscribeToasts, getToasts, getToasts)\n\n if (typeof document === 'undefined') return null\n\n return createPortal(\n <div className={styles.viewport} data-position={position} aria-live=\"polite\">\n {toasts.map((t) => (\n <ToastItem key={t.id} toast={t} duration={duration} position={position} />\n ))}\n </div>,\n document.body,\n )\n}\n"],"names":["EXIT_MS","ToastItem","toast","duration","position","visible","setVisible","useState","ttl","timer","useRef","remaining","startedAt","useEffect","raf","t","removeToast","clearTimer","resume","closeToast","pause","jsx","styles","Alert","Toaster","positionProp","durationProp","config","useToastConfig","toasts","useSyncExternalStore","subscribeToasts","getToasts","createPortal"],"mappings":"2SAMMA,EAAU,IAaT,SAASC,EAAU,CAAE,MAAAC,EAAO,SAAAC,EAAU,SAAAC,GAA4B,CACvE,KAAM,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAS,EAAK,EACtCC,EAAMN,EAAM,UAAYC,EACxBM,EAAQC,EAAAA,OAA2B,MAAS,EAC5CC,EAAYD,EAAAA,OAAOF,CAAG,EACtBI,EAAYF,EAAAA,OAAO,CAAC,EAG1BG,EAAAA,UAAU,IAAM,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,EAAc,SAAUC,GAA8B,CACxF,MAAMC,EAASC,EAAAA,eAAA,EACTxB,EAAWqB,GAAgBE,EAAO,UAAY,aAC9CxB,EAAWuB,GAAgBC,EAAO,UAAY,IAC9CE,EAASC,EAAAA,qBAAqBC,kBAAiBC,EAAAA,UAAWA,EAAAA,SAAS,EAEzE,OAAI,OAAO,SAAa,IAAoB,KAErCC,EAAAA,aACLZ,EAAAA,IAAC,OAAI,UAAWC,EAAO,SAAU,gBAAelB,EAAU,YAAU,SACjE,SAAAyB,EAAO,IAAK,GACXR,EAAAA,IAACpB,GAAqB,MAAO,EAAG,SAAAE,EAAoB,SAAAC,GAApC,EAAE,EAAsD,CACzE,CAAA,CACH,EACA,SAAS,IAAA,CAEb"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useRef as m, useEffect as d, useSyncExternalStore as b } from "react";
|
|
3
|
+
import { createPortal as q } from "react-dom";
|
|
4
|
+
import { r as y, c as w, s as A, g as T } from "./toastStore-Cx_JOKwS.js";
|
|
5
|
+
import { A as E } from "./Alert-D5E1PLkV.js";
|
|
6
|
+
import { q as S } from "./ConfigProvider-Dqfu7UBU.js";
|
|
7
|
+
const h = "_viewport_1fqde_3", x = "_item_1fqde_40", I = "_alert_1fqde_63", f = {
|
|
8
|
+
viewport: h,
|
|
9
|
+
item: x,
|
|
10
|
+
alert: I
|
|
11
|
+
}, M = 300;
|
|
12
|
+
function N({ toast: e, duration: a, position: r }) {
|
|
13
|
+
const [o, i] = g(!1), n = e.duration ?? a, t = m(void 0), s = m(n), p = m(0);
|
|
14
|
+
d(() => {
|
|
15
|
+
const l = requestAnimationFrame(() => i(!0));
|
|
16
|
+
return () => cancelAnimationFrame(l);
|
|
17
|
+
}, []), d(() => {
|
|
18
|
+
if (e.open) return;
|
|
19
|
+
i(!1);
|
|
20
|
+
const l = window.setTimeout(() => y(e.id), M);
|
|
21
|
+
return () => window.clearTimeout(l);
|
|
22
|
+
}, [e.open, e.id]);
|
|
23
|
+
const u = () => {
|
|
24
|
+
t.current != null && (window.clearTimeout(t.current), t.current = void 0);
|
|
25
|
+
}, v = () => {
|
|
26
|
+
!e.open || s.current === 1 / 0 || (u(), p.current = Date.now(), t.current = window.setTimeout(() => w(e.id), s.current));
|
|
27
|
+
}, _ = () => {
|
|
28
|
+
t.current != null && (u(), s.current -= Date.now() - p.current);
|
|
29
|
+
};
|
|
30
|
+
return d(() => (s.current = n, v(), u), [e.open, n]), /* @__PURE__ */ c(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: f.item,
|
|
34
|
+
"data-open": o ? "true" : "false",
|
|
35
|
+
"data-position": r,
|
|
36
|
+
onMouseEnter: _,
|
|
37
|
+
onMouseLeave: v,
|
|
38
|
+
children: /* @__PURE__ */ c(
|
|
39
|
+
E,
|
|
40
|
+
{
|
|
41
|
+
color: e.color,
|
|
42
|
+
variant: e.variant ?? "contained",
|
|
43
|
+
icon: e.icon,
|
|
44
|
+
action: e.action,
|
|
45
|
+
onClose: () => w(e.id),
|
|
46
|
+
role: "status",
|
|
47
|
+
className: f.alert,
|
|
48
|
+
children: e.message
|
|
49
|
+
}
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function R({ position: e, duration: a }) {
|
|
55
|
+
const r = S(), o = e ?? r.position ?? "top-center", i = a ?? r.duration ?? 4e3, n = b(A, T, T);
|
|
56
|
+
return typeof document > "u" ? null : q(
|
|
57
|
+
/* @__PURE__ */ c("div", { className: f.viewport, "data-position": o, "aria-live": "polite", children: n.map((t) => /* @__PURE__ */ c(N, { toast: t, duration: i, position: o }, t.id)) }),
|
|
58
|
+
document.body
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
R as T
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=Toaster-pHN2pxrU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toaster-pHN2pxrU.js","sources":["../src/components/Toast/ToastItem.tsx","../src/components/Toast/Toaster.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { Alert } from '../Alert'\nimport { closeToast, removeToast, type ToastPosition, type ToastRecord } from './toastStore'\nimport styles from './Toaster.module.css'\n\n/** Exit-animation duration (matches `--tz-duration`) — how long to keep a closing toast mounted. */\nconst EXIT_MS = 300\n\nexport interface ToastItemProps {\n toast: ToastRecord\n /** Fallback auto-dismiss delay when the toast doesn't set its own. */\n duration: number\n position: ToastPosition\n}\n\n/**\n * One rendered toast — an `Alert` wrapped with the enter/exit animation, the auto-dismiss timer\n * (paused while hovered), and the close wiring. Internal to `Toaster`.\n */\nexport function ToastItem({ toast, duration, position }: ToastItemProps) {\n const [visible, setVisible] = useState(false)\n const ttl = toast.duration ?? duration\n const timer = useRef<number | undefined>(undefined)\n const remaining = useRef(ttl)\n const startedAt = useRef(0)\n\n // enter — flip `visible` on the next frame so the transition runs\n useEffect(() => {\n const raf = requestAnimationFrame(() => setVisible(true))\n return () => cancelAnimationFrame(raf)\n }, [])\n\n // exit — when the store marks this toast closing, animate out then remove it\n useEffect(() => {\n if (toast.open) return\n setVisible(false)\n const t = window.setTimeout(() => removeToast(toast.id), EXIT_MS)\n return () => window.clearTimeout(t)\n }, [toast.open, toast.id])\n\n // auto-dismiss timer, paused on hover (tracks the remaining time across pauses)\n const clearTimer = () => {\n if (timer.current != null) {\n window.clearTimeout(timer.current)\n timer.current = undefined\n }\n }\n const resume = () => {\n if (!toast.open || remaining.current === Infinity) return\n clearTimer()\n startedAt.current = Date.now()\n timer.current = window.setTimeout(() => closeToast(toast.id), remaining.current)\n }\n const pause = () => {\n if (timer.current == null) return\n clearTimer()\n remaining.current -= Date.now() - startedAt.current\n }\n useEffect(() => {\n // (re)start from the full duration on open, and whenever an update-by-id changes `duration`\n // (otherwise the original countdown keeps running against the stale ttl)\n remaining.current = ttl\n resume()\n return clearTimer\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [toast.open, ttl])\n\n return (\n <div\n className={styles.item}\n data-open={visible ? 'true' : 'false'}\n data-position={position}\n onMouseEnter={pause}\n onMouseLeave={resume}\n >\n <Alert\n color={toast.color}\n variant={toast.variant ?? 'contained'}\n icon={toast.icon}\n action={toast.action}\n onClose={() => closeToast(toast.id)}\n role=\"status\"\n className={styles.alert}\n >\n {toast.message}\n </Alert>\n </div>\n )\n}\n","import { useSyncExternalStore } from 'react'\nimport { createPortal } from 'react-dom'\nimport { useToastConfig } from '../../theme'\nimport { getToasts, subscribeToasts, type ToastPosition } from './toastStore'\nimport { ToastItem } from './ToastItem'\nimport styles from './Toaster.module.css'\n\nexport interface ToasterProps {\n /** Corner the toasts stack in. Defaults to the app-wide `config.toast.position`, else `top-center`. */\n position?: ToastPosition\n /**\n * Default auto-dismiss delay in ms; a per-toast `duration` overrides it. Defaults to the app-wide\n * `config.toast.duration`, else `4000`.\n */\n duration?: number\n}\n\n/**\n * The toast viewport — mount it **once** near the app root. It portals to `<body>` at `--tz-z-toast`,\n * subscribes to the imperative `toast` store, and renders each toast as an animated, auto-dismissing\n * `Alert`. Drive it from anywhere with `toast.success('Saved')` / `toast.error(...)` / `toast.dismiss(id)`.\n * `position` / `duration` resolve **prop → `config.toast` → built-in default** (`top-center` / `4000`), so the\n * prop-less viewports `AdminRoot` / `RootLayout` mount follow the app config; outside a `ConfigProvider` the\n * built-in defaults apply.\n *\n * @example\n * <Toaster position=\"top-center\" />\n * // …elsewhere:\n * toast.success('Saved')\n */\nexport function Toaster({ position: positionProp, duration: durationProp }: ToasterProps) {\n const config = useToastConfig()\n const position = positionProp ?? config.position ?? 'top-center'\n const duration = durationProp ?? config.duration ?? 4000\n const toasts = useSyncExternalStore(subscribeToasts, getToasts, getToasts)\n\n if (typeof document === 'undefined') return null\n\n return createPortal(\n <div className={styles.viewport} data-position={position} aria-live=\"polite\">\n {toasts.map((t) => (\n <ToastItem key={t.id} toast={t} duration={duration} position={position} />\n ))}\n </div>,\n document.body,\n )\n}\n"],"names":["EXIT_MS","ToastItem","toast","duration","position","visible","setVisible","useState","ttl","timer","useRef","remaining","startedAt","useEffect","raf","t","removeToast","clearTimer","resume","closeToast","pause","jsx","styles","Alert","Toaster","positionProp","durationProp","config","useToastConfig","toasts","useSyncExternalStore","subscribeToasts","getToasts","createPortal"],"mappings":";;;;;;;;;;GAMMA,IAAU;AAaT,SAASC,EAAU,EAAE,OAAAC,GAAO,UAAAC,GAAU,UAAAC,KAA4B;AACvE,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtCC,IAAMN,EAAM,YAAYC,GACxBM,IAAQC,EAA2B,MAAS,GAC5CC,IAAYD,EAAOF,CAAG,GACtBI,IAAYF,EAAO,CAAC;AAG1B,EAAAG,EAAU,MAAM;AACd,UAAMC,IAAM,sBAAsB,MAAMR,EAAW,EAAI,CAAC;AACxD,WAAO,MAAM,qBAAqBQ,CAAG;AAAA,EACvC,GAAG,CAAA,CAAE,GAGLD,EAAU,MAAM;AACd,QAAIX,EAAM,KAAM;AAChB,IAAAI,EAAW,EAAK;AAChB,UAAMS,IAAI,OAAO,WAAW,MAAMC,EAAYd,EAAM,EAAE,GAAGF,CAAO;AAChE,WAAO,MAAM,OAAO,aAAae,CAAC;AAAA,EACpC,GAAG,CAACb,EAAM,MAAMA,EAAM,EAAE,CAAC;AAGzB,QAAMe,IAAa,MAAM;AACvB,IAAIR,EAAM,WAAW,SACnB,OAAO,aAAaA,EAAM,OAAO,GACjCA,EAAM,UAAU;AAAA,EAEpB,GACMS,IAAS,MAAM;AACnB,IAAI,CAAChB,EAAM,QAAQS,EAAU,YAAY,UACzCM,EAAA,GACAL,EAAU,UAAU,KAAK,IAAA,GACzBH,EAAM,UAAU,OAAO,WAAW,MAAMU,EAAWjB,EAAM,EAAE,GAAGS,EAAU,OAAO;AAAA,EACjF,GACMS,IAAQ,MAAM;AAClB,IAAIX,EAAM,WAAW,SACrBQ,EA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