@namroodinc/liquid-editorial 0.6.9 → 0.8.0
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 +55 -7
- package/UPGRADING.md +436 -0
- package/dist/chunks/{Avatar-DdFEOumt.js → Avatar-6t78C9Np.js} +2 -2
- package/dist/chunks/{Avatar-DdFEOumt.js.map → Avatar-6t78C9Np.js.map} +1 -1
- package/dist/chunks/{Avatar-B_2lI7fS.cjs → Avatar-Cvj_DqG0.cjs} +2 -2
- package/dist/chunks/{Avatar-B_2lI7fS.cjs.map → Avatar-Cvj_DqG0.cjs.map} +1 -1
- package/dist/chunks/CollectionView-B18Ihv7X.cjs +2 -0
- package/dist/chunks/CollectionView-B18Ihv7X.cjs.map +1 -0
- package/dist/chunks/{CollectionView-Cr12UFWa.js → CollectionView-C-SwkPWC.js} +28 -29
- package/dist/chunks/CollectionView-C-SwkPWC.js.map +1 -0
- package/dist/chunks/ColourField-Dohdx7eW.cjs +2 -0
- package/dist/chunks/ColourField-Dohdx7eW.cjs.map +1 -0
- package/dist/chunks/{ColourField-DC6cLb9h.js → ColourField-DzZ--mQZ.js} +122 -122
- package/dist/chunks/ColourField-DzZ--mQZ.js.map +1 -0
- package/dist/chunks/DatePicker-Bjc4D8Kg.cjs +2 -0
- package/dist/chunks/DatePicker-Bjc4D8Kg.cjs.map +1 -0
- package/dist/chunks/DatePicker-DZVOtzoU.js +298 -0
- package/dist/chunks/DatePicker-DZVOtzoU.js.map +1 -0
- package/dist/chunks/Drawer-CcVF_p4b.cjs +2 -0
- package/dist/chunks/Drawer-CcVF_p4b.cjs.map +1 -0
- package/dist/chunks/Drawer-uhJvy3s9.js +172 -0
- package/dist/chunks/Drawer-uhJvy3s9.js.map +1 -0
- package/dist/chunks/EntryPicker-CBquan7o.js +685 -0
- package/dist/chunks/EntryPicker-CBquan7o.js.map +1 -0
- package/dist/chunks/EntryPicker-Dq72wjTt.cjs +2 -0
- package/dist/chunks/EntryPicker-Dq72wjTt.cjs.map +1 -0
- package/dist/chunks/FormEditor-CTcnpR51.cjs +2 -0
- package/dist/chunks/FormEditor-CTcnpR51.cjs.map +1 -0
- package/dist/chunks/{FormEditor-BkBhcYI5.js → FormEditor-D0J3JN-H.js} +221 -188
- package/dist/chunks/FormEditor-D0J3JN-H.js.map +1 -0
- package/dist/chunks/{LoadState-B7GTDlWv.js → LoadState-B056EPu7.js} +20 -19
- package/dist/chunks/LoadState-B056EPu7.js.map +1 -0
- package/dist/chunks/LoadState-BXLG-SkQ.cjs +2 -0
- package/dist/chunks/LoadState-BXLG-SkQ.cjs.map +1 -0
- package/dist/chunks/NumberField-CVsK4l9P.js +178 -0
- package/dist/chunks/NumberField-CVsK4l9P.js.map +1 -0
- package/dist/chunks/NumberField-Ccjpa_1d.cjs +2 -0
- package/dist/chunks/NumberField-Ccjpa_1d.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-CNkwWist.js → RichTextEditor-B6H6_3wk.js} +28 -28
- package/dist/chunks/{RichTextEditor-CNkwWist.js.map → RichTextEditor-B6H6_3wk.js.map} +1 -1
- package/dist/chunks/RichTextEditor-BIopdEDA.cjs +2 -0
- package/dist/chunks/RichTextEditor-BIopdEDA.cjs.map +1 -0
- package/dist/chunks/Slider-BfvNPjRJ.cjs +2 -0
- package/dist/chunks/Slider-BfvNPjRJ.cjs.map +1 -0
- package/dist/chunks/Slider-Cab6NqhK.js +168 -0
- package/dist/chunks/Slider-Cab6NqhK.js.map +1 -0
- package/dist/chunks/decimal-Ca7qJExZ.cjs +2 -0
- package/dist/chunks/decimal-Ca7qJExZ.cjs.map +1 -0
- package/dist/chunks/decimal-hq_W9D3s.js +15 -0
- package/dist/chunks/decimal-hq_W9D3s.js.map +1 -0
- package/dist/chunks/dialogLabel-3EeaH1Zl.cjs +2 -0
- package/dist/chunks/dialogLabel-3EeaH1Zl.cjs.map +1 -0
- package/dist/chunks/dialogLabel-BjtTix5C.js +176 -0
- package/dist/chunks/dialogLabel-BjtTix5C.js.map +1 -0
- package/dist/chunks/frame-BtIh7K-M.cjs +2 -0
- package/dist/chunks/frame-BtIh7K-M.cjs.map +1 -0
- package/dist/chunks/frame-CycTDnzE.js +164 -0
- package/dist/chunks/frame-CycTDnzE.js.map +1 -0
- package/dist/chunks/{group-C6EOgTgM.js → group-67F_I1yw.js} +3 -3
- package/dist/chunks/{group-C6EOgTgM.js.map → group-67F_I1yw.js.map} +1 -1
- package/dist/chunks/{group-QSnlx4jX.cjs → group-BSJHLagi.cjs} +2 -2
- package/dist/chunks/{group-QSnlx4jX.cjs.map → group-BSJHLagi.cjs.map} +1 -1
- package/dist/chunks/limit-BBnpe9o9.cjs +2 -0
- package/dist/chunks/limit-BBnpe9o9.cjs.map +1 -0
- package/dist/chunks/limit-BHHST_0G.js +15 -0
- package/dist/chunks/limit-BHHST_0G.js.map +1 -0
- package/dist/chunks/overlayLayer-BgnMskpk.js +158 -0
- package/dist/chunks/overlayLayer-BgnMskpk.js.map +1 -0
- package/dist/chunks/overlayLayer-YVudmo27.cjs +2 -0
- package/dist/chunks/overlayLayer-YVudmo27.cjs.map +1 -0
- package/dist/chunks/{useLimit-BOmHKdJE.js → useLimit-C471qZ4H.js} +2 -2
- package/dist/chunks/useLimit-C471qZ4H.js.map +1 -0
- package/dist/chunks/{useLimit-DXe_VmYl.cjs → useLimit-WWWDacob.cjs} +2 -2
- package/dist/chunks/useLimit-WWWDacob.cjs.map +1 -0
- package/dist/chunks/useTooltip-DajWQyNL.js +75 -0
- package/dist/chunks/useTooltip-DajWQyNL.js.map +1 -0
- package/dist/chunks/useTooltip-DtrE7QYu.cjs +2 -0
- package/dist/chunks/useTooltip-DtrE7QYu.cjs.map +1 -0
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.cjs.map +1 -1
- package/dist/components/AppShell/index.js +4 -4
- package/dist/components/AppShell/index.js.map +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Badge/index.cjs +1 -1
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.cts +3 -0
- package/dist/components/Badge/index.d.cts.map +1 -1
- package/dist/components/Badge/index.d.ts +3 -0
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js +11 -10
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Badge/style.css +25 -2
- package/dist/components/Button/index.cjs.map +1 -1
- package/dist/components/Button/index.d.cts +4 -2
- package/dist/components/Button/index.d.cts.map +1 -1
- package/dist/components/Button/index.d.ts +4 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.js +1 -1
- package/dist/components/CollectionView/filters.d.cts.map +1 -1
- package/dist/components/CollectionView/filters.d.ts.map +1 -1
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.d.cts.map +1 -1
- package/dist/components/ColourField/index.d.ts.map +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/content.d.cts +27 -0
- package/dist/components/Drawer/content.d.cts.map +1 -0
- package/dist/components/Drawer/content.d.ts +27 -0
- package/dist/components/Drawer/content.d.ts.map +1 -0
- package/dist/components/Drawer/head.d.cts +10 -0
- package/dist/components/Drawer/head.d.cts.map +1 -0
- package/dist/components/Drawer/head.d.ts +10 -0
- package/dist/components/Drawer/head.d.ts.map +1 -0
- package/dist/components/Drawer/index.cjs +1 -2
- package/dist/components/Drawer/index.d.cts +21 -0
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts +21 -0
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +1 -102
- package/dist/components/Drawer/style.css +67 -0
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.js +10 -10
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EntryPicker/chosen.d.cts +16 -0
- package/dist/components/EntryPicker/chosen.d.cts.map +1 -0
- package/dist/components/EntryPicker/chosen.d.ts +16 -0
- package/dist/components/EntryPicker/chosen.d.ts.map +1 -0
- package/dist/components/EntryPicker/dialog.d.cts +22 -0
- package/dist/components/EntryPicker/dialog.d.cts.map +1 -0
- package/dist/components/EntryPicker/dialog.d.ts +22 -0
- package/dist/components/EntryPicker/dialog.d.ts.map +1 -0
- package/dist/components/EntryPicker/feedback.d.cts +20 -0
- package/dist/components/EntryPicker/feedback.d.cts.map +1 -0
- package/dist/components/EntryPicker/feedback.d.ts +20 -0
- package/dist/components/EntryPicker/feedback.d.ts.map +1 -0
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.d.cts +4 -38
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts +4 -38
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/item.d.cts +10 -0
- package/dist/components/EntryPicker/item.d.cts.map +1 -0
- package/dist/components/EntryPicker/item.d.ts +10 -0
- package/dist/components/EntryPicker/item.d.ts.map +1 -0
- package/dist/components/EntryPicker/results.d.cts +11 -0
- package/dist/components/EntryPicker/results.d.cts.map +1 -0
- package/dist/components/EntryPicker/results.d.ts +11 -0
- package/dist/components/EntryPicker/results.d.ts.map +1 -0
- package/dist/components/EntryPicker/selected-items.d.cts +11 -0
- package/dist/components/EntryPicker/selected-items.d.cts.map +1 -0
- package/dist/components/EntryPicker/selected-items.d.ts +11 -0
- package/dist/components/EntryPicker/selected-items.d.ts.map +1 -0
- package/dist/components/EntryPicker/style.css +129 -14
- package/dist/components/EntryPicker/types.d.cts +61 -0
- package/dist/components/EntryPicker/types.d.cts.map +1 -0
- package/dist/components/EntryPicker/types.d.ts +61 -0
- package/dist/components/EntryPicker/types.d.ts.map +1 -0
- package/dist/components/EntryPicker/use-picker-data.d.cts +40 -0
- package/dist/components/EntryPicker/use-picker-data.d.cts.map +1 -0
- package/dist/components/EntryPicker/use-picker-data.d.ts +40 -0
- package/dist/components/EntryPicker/use-picker-data.d.ts.map +1 -0
- package/dist/components/EntryPicker/use-selected-items.d.cts +21 -0
- package/dist/components/EntryPicker/use-selected-items.d.cts.map +1 -0
- package/dist/components/EntryPicker/use-selected-items.d.ts +21 -0
- package/dist/components/EntryPicker/use-selected-items.d.ts.map +1 -0
- package/dist/components/Field/frame.d.cts.map +1 -1
- package/dist/components/Field/frame.d.ts.map +1 -1
- package/dist/components/Field/index.cjs +1 -1
- package/dist/components/Field/index.js +1 -1
- package/dist/components/Field/{limit-reading.d.cts → limit-announcer.d.cts} +1 -4
- package/dist/components/Field/limit-announcer.d.cts.map +1 -0
- package/dist/components/Field/{limit-reading.d.ts → limit-announcer.d.ts} +1 -4
- package/dist/components/Field/limit-announcer.d.ts.map +1 -0
- package/dist/components/Field/limit.d.cts +1 -5
- package/dist/components/Field/limit.d.cts.map +1 -1
- package/dist/components/Field/limit.d.ts +1 -5
- package/dist/components/Field/limit.d.ts.map +1 -1
- package/dist/components/Field/style.css +0 -39
- package/dist/components/Field/types.d.cts +7 -3
- package/dist/components/Field/types.d.cts.map +1 -1
- package/dist/components/Field/types.d.ts +7 -3
- package/dist/components/Field/types.d.ts.map +1 -1
- package/dist/components/Field/useLimit.d.cts +1 -1
- package/dist/components/Field/useLimit.d.cts.map +1 -1
- package/dist/components/Field/useLimit.d.ts +1 -1
- package/dist/components/Field/useLimit.d.ts.map +1 -1
- package/dist/components/FormEditor/README.md +133 -14
- package/dist/components/FormEditor/control.d.cts +3 -2
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +3 -2
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +3 -2
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +3 -2
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +19 -6
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +19 -6
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/LimitReading/index.cjs +2 -0
- package/dist/components/LimitReading/index.cjs.map +1 -0
- package/dist/components/LimitReading/index.d.cts +5 -0
- package/dist/components/LimitReading/index.d.cts.map +1 -0
- package/dist/components/LimitReading/index.d.ts +5 -0
- package/dist/components/LimitReading/index.d.ts.map +1 -0
- package/dist/components/LimitReading/index.js +66 -0
- package/dist/components/LimitReading/index.js.map +1 -0
- package/dist/components/LimitReading/limit.d.cts +9 -0
- package/dist/components/LimitReading/limit.d.cts.map +1 -0
- package/dist/components/LimitReading/limit.d.ts +9 -0
- package/dist/components/LimitReading/limit.d.ts.map +1 -0
- package/dist/components/LimitReading/style.css +69 -0
- package/dist/components/LimitReading/types.d.cts +14 -0
- package/dist/components/LimitReading/types.d.cts.map +1 -0
- package/dist/components/LimitReading/types.d.ts +14 -0
- package/dist/components/LimitReading/types.d.ts.map +1 -0
- package/dist/components/LoadState/error.d.cts +3 -1
- package/dist/components/LoadState/error.d.cts.map +1 -1
- package/dist/components/LoadState/error.d.ts +3 -1
- package/dist/components/LoadState/error.d.ts.map +1 -1
- package/dist/components/LoadState/index.cjs +1 -1
- package/dist/components/LoadState/index.d.cts +3 -1
- package/dist/components/LoadState/index.d.cts.map +1 -1
- package/dist/components/LoadState/index.d.ts +3 -1
- package/dist/components/LoadState/index.d.ts.map +1 -1
- package/dist/components/LoadState/index.js +1 -1
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +50 -49
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts +9 -0
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts +9 -0
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +71 -64
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/style.css +16 -0
- package/dist/components/NumberField/index.cjs +1 -2
- package/dist/components/NumberField/index.d.cts +10 -3
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts +10 -3
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +1 -128
- package/dist/components/NumberField/step.d.cts +29 -0
- package/dist/components/NumberField/step.d.cts.map +1 -0
- package/dist/components/NumberField/step.d.ts +29 -0
- package/dist/components/NumberField/step.d.ts.map +1 -0
- package/dist/components/NumberField/style.css +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +57 -55
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Popover/style.css +6 -0
- package/dist/components/Popover/useTooltip.d.cts +2 -1
- package/dist/components/Popover/useTooltip.d.cts.map +1 -1
- package/dist/components/Popover/useTooltip.d.ts +2 -1
- package/dist/components/Popover/useTooltip.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts +6 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts +6 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +32 -26
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +73 -72
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.js +1 -1
- package/dist/components/Slider/index.cjs +1 -1
- package/dist/components/Slider/index.d.cts.map +1 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/Slider/scale.d.cts +0 -2
- package/dist/components/Slider/scale.d.cts.map +1 -1
- package/dist/components/Slider/scale.d.ts +0 -2
- package/dist/components/Slider/scale.d.ts.map +1 -1
- package/dist/components/Table/style.css +6 -1
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.js +1 -1
- package/dist/components/TextField/index.cjs +1 -1
- package/dist/components/TextField/index.js +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +50 -48
- package/dist/internal/decimal.d.cts +7 -0
- package/dist/internal/decimal.d.cts.map +1 -0
- package/dist/internal/decimal.d.ts +7 -0
- package/dist/internal/decimal.d.ts.map +1 -0
- package/dist/internal/dialogFocus.d.cts +2 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +2 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/dist/internal/dialogLabel.d.cts +10 -0
- package/dist/internal/dialogLabel.d.cts.map +1 -0
- package/dist/internal/dialogLabel.d.ts +10 -0
- package/dist/internal/dialogLabel.d.ts.map +1 -0
- package/dist/internal/dialogStack.d.cts +11 -3
- package/dist/internal/dialogStack.d.cts.map +1 -1
- package/dist/internal/dialogStack.d.ts +11 -3
- package/dist/internal/dialogStack.d.ts.map +1 -1
- package/dist/internal/movableHost.d.cts +9 -5
- package/dist/internal/movableHost.d.cts.map +1 -1
- package/dist/internal/movableHost.d.ts +9 -5
- package/dist/internal/movableHost.d.ts.map +1 -1
- package/dist/internal/overlayLayer.d.cts +33 -0
- package/dist/internal/overlayLayer.d.cts.map +1 -0
- package/dist/internal/overlayLayer.d.ts +33 -0
- package/dist/internal/overlayLayer.d.ts.map +1 -0
- package/dist/internal/portalScope.d.cts.map +1 -1
- package/dist/internal/portalScope.d.ts.map +1 -1
- package/dist/internal/useDialogPortal.d.cts +9 -0
- package/dist/internal/useDialogPortal.d.cts.map +1 -0
- package/dist/internal/useDialogPortal.d.ts +9 -0
- package/dist/internal/useDialogPortal.d.ts.map +1 -0
- package/dist/internal/useLatest.d.cts +7 -0
- package/dist/internal/useLatest.d.cts.map +1 -0
- package/dist/internal/useLatest.d.ts +7 -0
- package/dist/internal/useLatest.d.ts.map +1 -0
- package/dist/internal/useModalDialog.d.cts +5 -1
- package/dist/internal/useModalDialog.d.cts.map +1 -1
- package/dist/internal/useModalDialog.d.ts +5 -1
- package/dist/internal/useModalDialog.d.ts.map +1 -1
- package/dist/styles.css +1 -0
- package/dist/tokens.css +1 -2
- package/package.json +1 -1
- package/dist/chunks/CollectionView-BIuOL917.cjs +0 -2
- package/dist/chunks/CollectionView-BIuOL917.cjs.map +0 -1
- package/dist/chunks/CollectionView-Cr12UFWa.js.map +0 -1
- package/dist/chunks/ColourField-DC6cLb9h.js.map +0 -1
- package/dist/chunks/ColourField-NnFxLEsh.cjs +0 -2
- package/dist/chunks/ColourField-NnFxLEsh.cjs.map +0 -1
- package/dist/chunks/DatePicker-01sor8iD.cjs +0 -2
- package/dist/chunks/DatePicker-01sor8iD.cjs.map +0 -1
- package/dist/chunks/DatePicker-DJAqXUDJ.js +0 -297
- package/dist/chunks/DatePicker-DJAqXUDJ.js.map +0 -1
- package/dist/chunks/EntryPicker-B88N69zH.js +0 -180
- package/dist/chunks/EntryPicker-B88N69zH.js.map +0 -1
- package/dist/chunks/EntryPicker-daSkD4aR.cjs +0 -2
- package/dist/chunks/EntryPicker-daSkD4aR.cjs.map +0 -1
- package/dist/chunks/FormEditor-B4mtAxaU.cjs +0 -2
- package/dist/chunks/FormEditor-B4mtAxaU.cjs.map +0 -1
- package/dist/chunks/FormEditor-BkBhcYI5.js.map +0 -1
- package/dist/chunks/LoadState-B7GTDlWv.js.map +0 -1
- package/dist/chunks/LoadState-C7tQ6fIP.cjs +0 -2
- package/dist/chunks/LoadState-C7tQ6fIP.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-DAnjElUO.cjs +0 -2
- package/dist/chunks/RichTextEditor-DAnjElUO.cjs.map +0 -1
- package/dist/chunks/Slider-k8weRl34.cjs +0 -2
- package/dist/chunks/Slider-k8weRl34.cjs.map +0 -1
- package/dist/chunks/Slider-vdMFLX-H.js +0 -174
- package/dist/chunks/Slider-vdMFLX-H.js.map +0 -1
- package/dist/chunks/frame-C8TwdWBC.cjs +0 -2
- package/dist/chunks/frame-C8TwdWBC.cjs.map +0 -1
- package/dist/chunks/frame-DaC03_n-.js +0 -203
- package/dist/chunks/frame-DaC03_n-.js.map +0 -1
- package/dist/chunks/limit-BX6-o1a2.cjs +0 -2
- package/dist/chunks/limit-BX6-o1a2.cjs.map +0 -1
- package/dist/chunks/limit-ChteDN4T.js +0 -18
- package/dist/chunks/limit-ChteDN4T.js.map +0 -1
- package/dist/chunks/movableHost-CajG9_5Z.cjs +0 -2
- package/dist/chunks/movableHost-CajG9_5Z.cjs.map +0 -1
- package/dist/chunks/movableHost-NJj_FsAu.js +0 -23
- package/dist/chunks/movableHost-NJj_FsAu.js.map +0 -1
- package/dist/chunks/portalScope-AzzPM54i.js +0 -105
- package/dist/chunks/portalScope-AzzPM54i.js.map +0 -1
- package/dist/chunks/portalScope-BVA1-Ypu.cjs +0 -2
- package/dist/chunks/portalScope-BVA1-Ypu.cjs.map +0 -1
- package/dist/chunks/useLimit-BOmHKdJE.js.map +0 -1
- package/dist/chunks/useLimit-DXe_VmYl.cjs.map +0 -1
- package/dist/chunks/useModalDialog-Cgus9408.cjs +0 -2
- package/dist/chunks/useModalDialog-Cgus9408.cjs.map +0 -1
- package/dist/chunks/useModalDialog-Dh-_6A0j.js +0 -85
- package/dist/chunks/useModalDialog-Dh-_6A0j.js.map +0 -1
- package/dist/chunks/useTooltip-C5gvEoYk.js +0 -74
- package/dist/chunks/useTooltip-C5gvEoYk.js.map +0 -1
- package/dist/chunks/useTooltip-bTE_a2Xn.cjs +0 -2
- package/dist/chunks/useTooltip-bTE_a2Xn.cjs.map +0 -1
- package/dist/components/Drawer/index.cjs.map +0 -1
- package/dist/components/Drawer/index.js.map +0 -1
- package/dist/components/Field/limit-reading.d.cts.map +0 -1
- package/dist/components/Field/limit-reading.d.ts.map +0 -1
- package/dist/components/NumberField/index.cjs.map +0 -1
- package/dist/components/NumberField/index.js.map +0 -1
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { createContext as e, useContext as t, useEffect as n, useLayoutEffect as r, useRef as i } from "react";
|
|
2
|
-
//#region src/internal/dialogFocus.ts
|
|
3
|
-
var a = ":is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])";
|
|
4
|
-
function o(e) {
|
|
5
|
-
let t = e.closest("[contenteditable]");
|
|
6
|
-
return !(e.matches("a[href]") && t && t !== e && t.getAttribute("contenteditable") !== "false" && !e.hasAttribute("tabindex")) && (e.checkVisibility?.() ?? !e.closest("[hidden]")) && !e.closest("[inert]");
|
|
7
|
-
}
|
|
8
|
-
function s(e) {
|
|
9
|
-
return !e || e === e.ownerDocument.body || !e.isConnected || e.closest("[aria-hidden='true'], [inert]") !== null;
|
|
10
|
-
}
|
|
11
|
-
function c(e, t) {
|
|
12
|
-
let n = e;
|
|
13
|
-
for (; n;) {
|
|
14
|
-
if (n instanceof HTMLElement && !s(n) && (n.focus(t), n.getRootNode().activeElement === n)) return !0;
|
|
15
|
-
n = n.parentElement?.closest("[tabindex]") ?? null;
|
|
16
|
-
}
|
|
17
|
-
return !1;
|
|
18
|
-
}
|
|
19
|
-
function l(e) {
|
|
20
|
-
return e instanceof HTMLInputElement && e.type === "radio";
|
|
21
|
-
}
|
|
22
|
-
function u(e, t) {
|
|
23
|
-
return e === t || l(e) && l(t) && e.name !== "" && e.name === t.name && e.form === t.form;
|
|
24
|
-
}
|
|
25
|
-
function d(e) {
|
|
26
|
-
let t = Array.from(e.querySelectorAll(a)).filter(o);
|
|
27
|
-
return t.filter((e) => !l(e) || e.checked || !t.some((t) => l(t) && t.checked && u(t, e)));
|
|
28
|
-
}
|
|
29
|
-
var f = /* @__PURE__ */ new WeakMap();
|
|
30
|
-
function p(e, t) {
|
|
31
|
-
return f.set(e, t), () => {
|
|
32
|
-
f.delete(e);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function m(e) {
|
|
36
|
-
let t = e instanceof Element ? e : e.parentElement;
|
|
37
|
-
for (; t && !f.has(t);) t = t.parentElement;
|
|
38
|
-
return t;
|
|
39
|
-
}
|
|
40
|
-
function h(e, t) {
|
|
41
|
-
let n = /* @__PURE__ */ new Set(), r = m(t);
|
|
42
|
-
for (; r && !n.has(r);) {
|
|
43
|
-
n.add(r);
|
|
44
|
-
let t = f.get(r);
|
|
45
|
-
if (e.contains(t)) return !0;
|
|
46
|
-
r = m(t);
|
|
47
|
-
}
|
|
48
|
-
return !1;
|
|
49
|
-
}
|
|
50
|
-
function g(e, t) {
|
|
51
|
-
return !!(t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
52
|
-
}
|
|
53
|
-
function _(e, t) {
|
|
54
|
-
if (e.key !== "Tab" || e.defaultPrevented || !t) return;
|
|
55
|
-
let n = d(t), r = n[0], i = n.at(-1);
|
|
56
|
-
if (!r || !i) return;
|
|
57
|
-
let a = t.getRootNode().activeElement ?? document.activeElement, o = a !== null && t.contains(a);
|
|
58
|
-
!o && a && h(t, a) || (!o || (e.shiftKey ? u(a, r) || g(a, r) : u(a, i) || g(i, a))) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
|
|
59
|
-
}
|
|
60
|
-
//#endregion
|
|
61
|
-
//#region src/internal/portalScope.ts
|
|
62
|
-
var v = typeof document > "u" ? n : r, y = e(null), b = [
|
|
63
|
-
"data-theme",
|
|
64
|
-
"lang",
|
|
65
|
-
"dir"
|
|
66
|
-
];
|
|
67
|
-
function x(e) {
|
|
68
|
-
let t = e.closest("[dir]") ? getComputedStyle(e).direction || e.closest("[dir]").getAttribute("dir") : null;
|
|
69
|
-
return {
|
|
70
|
-
"data-theme": e.closest("[data-theme]")?.getAttribute("data-theme") ?? null,
|
|
71
|
-
lang: e.closest("[lang]")?.getAttribute("lang") ?? null,
|
|
72
|
-
dir: t
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function S(e, t, n, { keepDir: r = !1 } = {}) {
|
|
76
|
-
let a = i(n);
|
|
77
|
-
v(() => {
|
|
78
|
-
a.current = n;
|
|
79
|
-
}), v(() => {
|
|
80
|
-
let n = e.current, i = a.current?.();
|
|
81
|
-
if (!t || !n || !i) return;
|
|
82
|
-
let o = () => {
|
|
83
|
-
for (let [e, t] of Object.entries(x(i))) e === "dir" && r || (t === null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t));
|
|
84
|
-
};
|
|
85
|
-
o();
|
|
86
|
-
let s = new MutationObserver(o);
|
|
87
|
-
for (let e = i; e; e = e.parentElement) s.observe(e, {
|
|
88
|
-
attributes: !0,
|
|
89
|
-
attributeFilter: b
|
|
90
|
-
});
|
|
91
|
-
return () => s.disconnect();
|
|
92
|
-
}, [
|
|
93
|
-
e,
|
|
94
|
-
t,
|
|
95
|
-
r
|
|
96
|
-
]);
|
|
97
|
-
}
|
|
98
|
-
function C(e, n, r) {
|
|
99
|
-
let i = t(y);
|
|
100
|
-
S(e, n, i && (() => i.current), r);
|
|
101
|
-
}
|
|
102
|
-
//#endregion
|
|
103
|
-
export { c as a, _ as c, s as i, C as n, p as o, S as r, d as s, y as t };
|
|
104
|
-
|
|
105
|
-
//# sourceMappingURL=portalScope-AzzPM54i.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portalScope-AzzPM54i.js","names":["focusableSelector","canTakeFocus","editingHost","element","cannotHoldFocus","focusNearest","candidate","options","isRadio","sameStop","a","b","tabbableControls","controls","container","control","other","popupAnchors","registerPopup","popup","anchor","popupAround","node","inOwnedPopup","visited","panel","precedes","trapTabFocus","event","first","last","active","inside","useIsomorphicLayoutEffect","useEffect","useLayoutEffect","PortalScopeContext","createContext","scopeAttributes","scopeOf","direction","usePortalScope","latest","useRef","getAnchor","root","rootRef","isOpen","sync","name","value","keepDir","observer","useInheritedPortalScope","useContext"],"sources":["../../src/internal/dialogFocus.ts","../../src/internal/portalScope.ts"],"sourcesContent":["const focusableSelector =\n \":is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])\";\n\n// Unrendered controls (display: none, [hidden], closed <details>) and inert\n// subtrees cannot take focus. Environments without checkVisibility fall back\n// to the hidden attribute.\nfunction canTakeFocus(element: HTMLElement) {\n const editingHost = element.closest(\"[contenteditable]\");\n // A link being edited is document content, not a native Tab stop. Explicit\n // tabindex and links inside noneditable widgets still participate normally.\n const writingLink =\n element.matches(\"a[href]\") &&\n editingHost &&\n editingHost !== element &&\n editingHost.getAttribute(\"contenteditable\") !== \"false\" &&\n !element.hasAttribute(\"tabindex\");\n return (\n !writingLink &&\n (element.checkVisibility?.() ?? !element.closest(\"[hidden]\")) &&\n !element.closest(\"[inert]\")\n );\n}\n\n/** Removed, hidden and inert elements can't keep focus, and neither can the page. */\nexport function cannotHoldFocus(element: Element | null) {\n return (\n !element ||\n element === element.ownerDocument.body ||\n !element.isConnected ||\n element.closest(\"[aria-hidden='true'], [inert]\") !== null\n );\n}\n\n/**\n * Focuses `element`, or, when it can no longer take focus (disabled, or no\n * longer editable), its nearest ancestor with a tabindex, such as an enclosing\n * dialog panel. Returns whether anything took focus.\n */\nexport function focusNearest(element: Element | null, options?: FocusOptions) {\n let candidate = element;\n while (candidate) {\n if (candidate instanceof HTMLElement && !cannotHoldFocus(candidate)) {\n candidate.focus(options);\n if ((candidate.getRootNode() as Document | ShadowRoot).activeElement === candidate) {\n return true;\n }\n }\n candidate = candidate.parentElement?.closest(\"[tabindex]\") ?? null;\n }\n return false;\n}\n\nfunction isRadio(element: Element | null): element is HTMLInputElement {\n return element instanceof HTMLInputElement && element.type === \"radio\";\n}\n\n/** Radios sharing a name and form are one Tab stop. */\nfunction sameStop(a: Element, b: Element) {\n return (\n a === b || (isRadio(a) && isRadio(b) && a.name !== \"\" && a.name === b.name && a.form === b.form)\n );\n}\n\n/**\n * The controls Tab visits inside `container`, in document order. A radio group\n * contributes only its checked radio, or every radio while none is checked.\n */\nexport function tabbableControls(container: HTMLElement) {\n const controls = Array.from(container.querySelectorAll<HTMLElement>(focusableSelector)).filter(\n canTakeFocus,\n );\n return controls.filter(\n (control) =>\n !isRadio(control) ||\n control.checked ||\n !controls.some((other) => isRadio(other) && other.checked && sameStop(other, control)),\n );\n}\n\nconst popupAnchors = new WeakMap<Element, Element>();\n\n/**\n * Popups portal outside the dialog that opened them. Registering one with its\n * anchor lets that dialog's Tab trap treat the popup as its own.\n */\nexport function registerPopup(popup: Element, anchor: Element) {\n popupAnchors.set(popup, anchor);\n return () => {\n popupAnchors.delete(popup);\n };\n}\n\nfunction popupAround(node: Node) {\n let element = node instanceof Element ? node : node.parentElement;\n while (element && !popupAnchors.has(element)) {\n element = element.parentElement;\n }\n return element;\n}\n\n/** Inside a popup anchored in the panel, directly or through other popups. */\nfunction inOwnedPopup(panel: HTMLElement, node: Node) {\n const visited = new Set<Element>();\n let popup = popupAround(node);\n while (popup && !visited.has(popup)) {\n visited.add(popup);\n const anchor = popupAnchors.get(popup)!;\n if (panel.contains(anchor)) {\n return true;\n }\n popup = popupAround(anchor);\n }\n return false;\n}\n\n/** `a` comes before `b` in document order, including as its ancestor. */\nfunction precedes(a: Node, b: Node) {\n return Boolean(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\n/**\n * Keeps Tab inside an aria-modal panel. Call only for the topmost dialog.\n * Focus that left the panel returns to its first control (last with Shift);\n * Tab inside a popup the panel owns is left to the popup and the browser.\n */\nexport function trapTabFocus(event: KeyboardEvent, panel: HTMLElement | null) {\n if (event.key !== \"Tab\" || event.defaultPrevented || !panel) {\n return;\n }\n const controls = tabbableControls(panel);\n const first = controls[0];\n const last = controls.at(-1);\n if (!first || !last) {\n return;\n }\n // document.activeElement stops at the host of a shadow root holding the panel.\n const active =\n (panel.getRootNode() as Document | ShadowRoot).activeElement ?? document.activeElement;\n const inside = active !== null && panel.contains(active);\n if (!inside && active && inOwnedPopup(panel, active)) {\n return;\n }\n // Focus on the panel itself, or on another untabbable element beyond the\n // first or last control, would otherwise leave the panel.\n const wraps =\n !inside ||\n (event.shiftKey\n ? sameStop(active, first) || precedes(active, first)\n : sameStop(active, last) || precedes(last, active));\n if (wraps) {\n event.preventDefault();\n (event.shiftKey ? last : first).focus();\n }\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n type RefObject,\n} from \"react\";\n\nconst useIsomorphicLayoutEffect = typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * The inline element whose theme, direction and language body-mounted overlays\n * opened from inside it carry: RichTextEditor's frame, or a Popover's anchor.\n * Nested overlays inherit the same inline anchor rather than their parent's\n * panel, so they never depend on the order in which overlays mount.\n */\nexport const PortalScopeContext = createContext<RefObject<Element | null> | null>(null);\n\nconst scopeAttributes = [\"data-theme\", \"lang\", \"dir\"];\n\nfunction scopeOf(anchor: Element) {\n const direction = anchor.closest(\"[dir]\")\n ? getComputedStyle(anchor).direction || anchor.closest(\"[dir]\")!.getAttribute(\"dir\")\n : null;\n return {\n \"data-theme\": anchor.closest(\"[data-theme]\")?.getAttribute(\"data-theme\") ?? null,\n lang: anchor.closest(\"[lang]\")?.getAttribute(\"lang\") ?? null,\n dir: direction,\n };\n}\n\n/**\n * Copies the anchor's `data-theme`, `lang` and `dir` onto an overlay root while\n * it is open, and follows later changes to those attributes on the anchor's\n * ancestors. Attributes rather than resolved values, so the theme's whole\n * stylesheet keeps applying, including `color-scheme` and media queries.\n * Without an anchor the overlay inherits from the document root, as before.\n */\nexport function usePortalScope(\n rootRef: RefObject<HTMLElement | null>,\n isOpen: boolean,\n getAnchor: (() => Element | null | undefined) | null,\n { keepDir = false }: { keepDir?: boolean } = {},\n) {\n const latest = useRef(getAnchor);\n useIsomorphicLayoutEffect(() => {\n latest.current = getAnchor;\n });\n\n useIsomorphicLayoutEffect(() => {\n const root = rootRef.current;\n const anchor = latest.current?.();\n if (!isOpen || !root || !anchor) {\n return;\n }\n const sync = () => {\n for (const [name, value] of Object.entries(scopeOf(anchor))) {\n if (name === \"dir\" && keepDir) {\n continue;\n }\n if (value === null) {\n root.removeAttribute(name);\n } else if (root.getAttribute(name) !== value) {\n root.setAttribute(name, value);\n }\n }\n };\n sync();\n // Only scoping attributes: class and style churn on ancestors never re-applies.\n const observer = new MutationObserver(sync);\n for (let node: Element | null = anchor; node; node = node.parentElement) {\n observer.observe(node, { attributes: true, attributeFilter: scopeAttributes });\n }\n return () => observer.disconnect();\n }, [rootRef, isOpen, keepDir]);\n}\n\n/** Applies the scope of the inline anchor an enclosing editor or popover provides, if any. */\nexport function useInheritedPortalScope(\n rootRef: RefObject<HTMLElement | null>,\n isOpen: boolean,\n options?: { keepDir?: boolean },\n) {\n const anchor = useContext(PortalScopeContext);\n usePortalScope(rootRef, isOpen, anchor && (() => anchor.current), options);\n}\n"],"mappings":";;AAAA,IAAMA,IACJ;AAKF,SAASC,EAAa,GAAsB;CAC1C,IAAMC,IAAcC,EAAQ,QAAQ,mBAAmB;CASvD,OACE,EANAA,EAAQ,QAAQ,SAAS,KACzBD,KACAA,MAAgBC,KAChBD,EAAY,aAAa,iBAAiB,MAAM,WAChD,CAACC,EAAQ,aAAa,UAAU,OAG/BA,EAAQ,kBAAkB,KAAK,CAACA,EAAQ,QAAQ,UAAU,MAC3D,CAACA,EAAQ,QAAQ,SAAS;AAE9B;AAGA,SAAgBC,EAAgB,GAAyB;CACvD,OACE,CAACD,KACDA,MAAYA,EAAQ,cAAc,QAClC,CAACA,EAAQ,eACTA,EAAQ,QAAQ,+BAA+B,MAAM;AAEzD;AAOA,SAAgBE,EAAa,GAAyB,GAAwB;CAC5E,IAAIC,IAAYH;CAChB,OAAOG,IAAW;EAChB,IAAIA,aAAqB,eAAe,CAACF,EAAgBE,CAAS,MAChEA,EAAU,MAAMC,CAAO,GAClBD,EAAU,YAAY,CAAC,CAA2B,kBAAkBA,IACvE,OAAO;EAGX,IAAYA,EAAU,eAAe,QAAQ,YAAY,KAAK;CAChE;CACA,OAAO;AACT;AAEA,SAASE,EAAQ,GAAsD;CACrE,OAAOL,aAAmB,oBAAoBA,EAAQ,SAAS;AACjE;AAGA,SAASM,EAAS,GAAY,GAAY;CACxC,OACEC,MAAMC,KAAMH,EAAQE,CAAC,KAAKF,EAAQG,CAAC,KAAKD,EAAE,SAAS,MAAMA,EAAE,SAASC,EAAE,QAAQD,EAAE,SAASC,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J,EAAK,aAAaI,CAAI,MAAMC,KACrCL,EAAK,aAAaI,GAAMC,CAAK;EAGnC;EACA,EAAK;EAEL,IAAME,IAAW,IAAI,iBAAiBJ,CAAI;EAC1C,KAAK,IAAI1B,IAAuBF,GAAQE,GAAM,IAAOA,EAAK,eACxD,EAAS,QAAQA,GAAM;GAAE,YAAY;GAAM,iBAAiBgB;EAAgB,CAAC;EAE/E,aAAac,EAAS,WAAW;CACnC,GAAG;EAACN;EAASC;EAAQI;CAAO,CAAC;AAC/B;AAGA,SAAgBE,EACd,GACA,GACA,GACA;CACA,IAAMjC,IAASkC,EAAWlB,CAAkB;CAC5C,EAAeU,GAASC,GAAQ3B,YAAiBA,EAAO,UAAUb,CAAO;AAC3E"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
let e=require("react");var t=`:is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])`;function n(e){let t=e.closest(`[contenteditable]`);return!(e.matches(`a[href]`)&&t&&t!==e&&t.getAttribute(`contenteditable`)!==`false`&&!e.hasAttribute(`tabindex`))&&(e.checkVisibility?.()??!e.closest(`[hidden]`))&&!e.closest(`[inert]`)}function r(e){return!e||e===e.ownerDocument.body||!e.isConnected||e.closest(`[aria-hidden='true'], [inert]`)!==null}function i(e,t){let n=e;for(;n;){if(n instanceof HTMLElement&&!r(n)&&(n.focus(t),n.getRootNode().activeElement===n))return!0;n=n.parentElement?.closest(`[tabindex]`)??null}return!1}function a(e){return e instanceof HTMLInputElement&&e.type===`radio`}function o(e,t){return e===t||a(e)&&a(t)&&e.name!==``&&e.name===t.name&&e.form===t.form}function s(e){let r=Array.from(e.querySelectorAll(t)).filter(n);return r.filter(e=>!a(e)||e.checked||!r.some(t=>a(t)&&t.checked&&o(t,e)))}var c=new WeakMap;function l(e,t){return c.set(e,t),()=>{c.delete(e)}}function u(e){let t=e instanceof Element?e:e.parentElement;for(;t&&!c.has(t);)t=t.parentElement;return t}function d(e,t){let n=new Set,r=u(t);for(;r&&!n.has(r);){n.add(r);let t=c.get(r);if(e.contains(t))return!0;r=u(t)}return!1}function f(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function p(e,t){if(e.key!==`Tab`||e.defaultPrevented||!t)return;let n=s(t),r=n[0],i=n.at(-1);if(!r||!i)return;let a=t.getRootNode().activeElement??document.activeElement,c=a!==null&&t.contains(a);!c&&a&&d(t,a)||(!c||(e.shiftKey?o(a,r)||f(a,r):o(a,i)||f(i,a)))&&(e.preventDefault(),(e.shiftKey?i:r).focus())}var m=typeof document>`u`?e.useEffect:e.useLayoutEffect,h=(0,e.createContext)(null),g=[`data-theme`,`lang`,`dir`];function _(e){let t=e.closest(`[dir]`)?getComputedStyle(e).direction||e.closest(`[dir]`).getAttribute(`dir`):null;return{"data-theme":e.closest(`[data-theme]`)?.getAttribute(`data-theme`)??null,lang:e.closest(`[lang]`)?.getAttribute(`lang`)??null,dir:t}}function v(t,n,r,{keepDir:i=!1}={}){let a=(0,e.useRef)(r);m(()=>{a.current=r}),m(()=>{let e=t.current,r=a.current?.();if(!n||!e||!r)return;let o=()=>{for(let[t,n]of Object.entries(_(r)))t===`dir`&&i||(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n))};o();let s=new MutationObserver(o);for(let e=r;e;e=e.parentElement)s.observe(e,{attributes:!0,attributeFilter:g});return()=>s.disconnect()},[t,n,i])}function y(t,n,r){let i=(0,e.useContext)(h);v(t,n,i&&(()=>i.current),r)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return h}});
|
|
2
|
-
//# sourceMappingURL=portalScope-BVA1-Ypu.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"portalScope-BVA1-Ypu.cjs","names":["useEffect","useLayoutEffect","createContext","useRef","useContext","react","focusableSelector","canTakeFocus","editingHost","element","cannotHoldFocus","focusNearest","candidate","options","isRadio","sameStop","a","b","tabbableControls","controls","container","control","other","popupAnchors","registerPopup","popup","anchor","popupAround","node","inOwnedPopup","visited","panel","precedes","trapTabFocus","event","first","last","active","inside","useIsomorphicLayoutEffect","PortalScopeContext","scopeAttributes","scopeOf","direction","usePortalScope","latest","getAnchor","root","rootRef","isOpen","sync","name","value","keepDir","observer","useInheritedPortalScope"],"sources":["../../src/internal/dialogFocus.ts","../../src/internal/portalScope.ts"],"sourcesContent":["const focusableSelector =\n \":is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])\";\n\n// Unrendered controls (display: none, [hidden], closed <details>) and inert\n// subtrees cannot take focus. Environments without checkVisibility fall back\n// to the hidden attribute.\nfunction canTakeFocus(element: HTMLElement) {\n const editingHost = element.closest(\"[contenteditable]\");\n // A link being edited is document content, not a native Tab stop. Explicit\n // tabindex and links inside noneditable widgets still participate normally.\n const writingLink =\n element.matches(\"a[href]\") &&\n editingHost &&\n editingHost !== element &&\n editingHost.getAttribute(\"contenteditable\") !== \"false\" &&\n !element.hasAttribute(\"tabindex\");\n return (\n !writingLink &&\n (element.checkVisibility?.() ?? !element.closest(\"[hidden]\")) &&\n !element.closest(\"[inert]\")\n );\n}\n\n/** Removed, hidden and inert elements can't keep focus, and neither can the page. */\nexport function cannotHoldFocus(element: Element | null) {\n return (\n !element ||\n element === element.ownerDocument.body ||\n !element.isConnected ||\n element.closest(\"[aria-hidden='true'], [inert]\") !== null\n );\n}\n\n/**\n * Focuses `element`, or, when it can no longer take focus (disabled, or no\n * longer editable), its nearest ancestor with a tabindex, such as an enclosing\n * dialog panel. Returns whether anything took focus.\n */\nexport function focusNearest(element: Element | null, options?: FocusOptions) {\n let candidate = element;\n while (candidate) {\n if (candidate instanceof HTMLElement && !cannotHoldFocus(candidate)) {\n candidate.focus(options);\n if ((candidate.getRootNode() as Document | ShadowRoot).activeElement === candidate) {\n return true;\n }\n }\n candidate = candidate.parentElement?.closest(\"[tabindex]\") ?? null;\n }\n return false;\n}\n\nfunction isRadio(element: Element | null): element is HTMLInputElement {\n return element instanceof HTMLInputElement && element.type === \"radio\";\n}\n\n/** Radios sharing a name and form are one Tab stop. */\nfunction sameStop(a: Element, b: Element) {\n return (\n a === b || (isRadio(a) && isRadio(b) && a.name !== \"\" && a.name === b.name && a.form === b.form)\n );\n}\n\n/**\n * The controls Tab visits inside `container`, in document order. A radio group\n * contributes only its checked radio, or every radio while none is checked.\n */\nexport function tabbableControls(container: HTMLElement) {\n const controls = Array.from(container.querySelectorAll<HTMLElement>(focusableSelector)).filter(\n canTakeFocus,\n );\n return controls.filter(\n (control) =>\n !isRadio(control) ||\n control.checked ||\n !controls.some((other) => isRadio(other) && other.checked && sameStop(other, control)),\n );\n}\n\nconst popupAnchors = new WeakMap<Element, Element>();\n\n/**\n * Popups portal outside the dialog that opened them. Registering one with its\n * anchor lets that dialog's Tab trap treat the popup as its own.\n */\nexport function registerPopup(popup: Element, anchor: Element) {\n popupAnchors.set(popup, anchor);\n return () => {\n popupAnchors.delete(popup);\n };\n}\n\nfunction popupAround(node: Node) {\n let element = node instanceof Element ? node : node.parentElement;\n while (element && !popupAnchors.has(element)) {\n element = element.parentElement;\n }\n return element;\n}\n\n/** Inside a popup anchored in the panel, directly or through other popups. */\nfunction inOwnedPopup(panel: HTMLElement, node: Node) {\n const visited = new Set<Element>();\n let popup = popupAround(node);\n while (popup && !visited.has(popup)) {\n visited.add(popup);\n const anchor = popupAnchors.get(popup)!;\n if (panel.contains(anchor)) {\n return true;\n }\n popup = popupAround(anchor);\n }\n return false;\n}\n\n/** `a` comes before `b` in document order, including as its ancestor. */\nfunction precedes(a: Node, b: Node) {\n return Boolean(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\n/**\n * Keeps Tab inside an aria-modal panel. Call only for the topmost dialog.\n * Focus that left the panel returns to its first control (last with Shift);\n * Tab inside a popup the panel owns is left to the popup and the browser.\n */\nexport function trapTabFocus(event: KeyboardEvent, panel: HTMLElement | null) {\n if (event.key !== \"Tab\" || event.defaultPrevented || !panel) {\n return;\n }\n const controls = tabbableControls(panel);\n const first = controls[0];\n const last = controls.at(-1);\n if (!first || !last) {\n return;\n }\n // document.activeElement stops at the host of a shadow root holding the panel.\n const active =\n (panel.getRootNode() as Document | ShadowRoot).activeElement ?? document.activeElement;\n const inside = active !== null && panel.contains(active);\n if (!inside && active && inOwnedPopup(panel, active)) {\n return;\n }\n // Focus on the panel itself, or on another untabbable element beyond the\n // first or last control, would otherwise leave the panel.\n const wraps =\n !inside ||\n (event.shiftKey\n ? sameStop(active, first) || precedes(active, first)\n : sameStop(active, last) || precedes(last, active));\n if (wraps) {\n event.preventDefault();\n (event.shiftKey ? last : first).focus();\n }\n}\n","import {\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n type RefObject,\n} from \"react\";\n\nconst useIsomorphicLayoutEffect = typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * The inline element whose theme, direction and language body-mounted overlays\n * opened from inside it carry: RichTextEditor's frame, or a Popover's anchor.\n * Nested overlays inherit the same inline anchor rather than their parent's\n * panel, so they never depend on the order in which overlays mount.\n */\nexport const PortalScopeContext = createContext<RefObject<Element | null> | null>(null);\n\nconst scopeAttributes = [\"data-theme\", \"lang\", \"dir\"];\n\nfunction scopeOf(anchor: Element) {\n const direction = anchor.closest(\"[dir]\")\n ? getComputedStyle(anchor).direction || anchor.closest(\"[dir]\")!.getAttribute(\"dir\")\n : null;\n return {\n \"data-theme\": anchor.closest(\"[data-theme]\")?.getAttribute(\"data-theme\") ?? null,\n lang: anchor.closest(\"[lang]\")?.getAttribute(\"lang\") ?? null,\n dir: direction,\n };\n}\n\n/**\n * Copies the anchor's `data-theme`, `lang` and `dir` onto an overlay root while\n * it is open, and follows later changes to those attributes on the anchor's\n * ancestors. Attributes rather than resolved values, so the theme's whole\n * stylesheet keeps applying, including `color-scheme` and media queries.\n * Without an anchor the overlay inherits from the document root, as before.\n */\nexport function usePortalScope(\n rootRef: RefObject<HTMLElement | null>,\n isOpen: boolean,\n getAnchor: (() => Element | null | undefined) | null,\n { keepDir = false }: { keepDir?: boolean } = {},\n) {\n const latest = useRef(getAnchor);\n useIsomorphicLayoutEffect(() => {\n latest.current = getAnchor;\n });\n\n useIsomorphicLayoutEffect(() => {\n const root = rootRef.current;\n const anchor = latest.current?.();\n if (!isOpen || !root || !anchor) {\n return;\n }\n const sync = () => {\n for (const [name, value] of Object.entries(scopeOf(anchor))) {\n if (name === \"dir\" && keepDir) {\n continue;\n }\n if (value === null) {\n root.removeAttribute(name);\n } else if (root.getAttribute(name) !== value) {\n root.setAttribute(name, value);\n }\n }\n };\n sync();\n // Only scoping attributes: class and style churn on ancestors never re-applies.\n const observer = new MutationObserver(sync);\n for (let node: Element | null = anchor; node; node = node.parentElement) {\n observer.observe(node, { attributes: true, attributeFilter: scopeAttributes });\n }\n return () => observer.disconnect();\n }, [rootRef, isOpen, keepDir]);\n}\n\n/** Applies the scope of the inline anchor an enclosing editor or popover provides, if any. */\nexport function useInheritedPortalScope(\n rootRef: RefObject<HTMLElement | null>,\n isOpen: boolean,\n options?: { keepDir?: boolean },\n) {\n const anchor = useContext(PortalScopeContext);\n usePortalScope(rootRef, isOpen, anchor && (() => anchor.current), options);\n}\n"],"mappings":"A,uBAAA,IAAMM,EACJ,gMAKF,SAASC,EAAa,EAAsB,CAC1C,IAAMC,EAAcC,EAAQ,QAAQ,mBAAmB,EAS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A,EACA,EACA,CACA,IAAM7B,GAAA,EAAStB,EAAAA,WAAAA,CAAWoC,CAAkB,EAC5CI,EAAeI,EAASC,EAAQvB,QAAiBA,EAAO,SAAUb,CAAO,CAC3E,C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLimit-BOmHKdJE.js","names":["FieldFrameContext","usableLimit","useLimitReport","frame","useContext","key","useId","reportLimit","binding","report","useMemo","limit","useEffect","useReportedLimit","count","max","useTextLimit","controlledLength","value","input","inputRef","maxLength","observeText","defaultValue","timer","onReset","event","read","owner","restoreValue","interceptValueWrites","own","accessor","get","set","isActive","wrapper","next","onWrite"],"sources":["../../src/components/Field/useLimit.ts"],"sourcesContent":["import { useContext, useEffect, useId, useMemo, type RefObject } from \"react\";\nimport { FieldFrameContext } from \"./context\";\nimport { usableLimit } from \"./limit\";\nimport type { FieldBinding, FieldLimit } from \"./types\";\n\ntype ReportLimit = (limit: FieldLimit | undefined) => void;\ntype TextControl = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * A control reports only to the Field it is explicitly bound to, and only while\n * that Field has no explicit limit. Each control owns one keyed report, removed\n * on unmount or rebinding without disturbing another control's report.\n */\nfunction useLimitReport(binding: FieldBinding): ReportLimit | undefined {\n const frame = useContext(FieldFrameContext);\n const key = useId();\n const reportLimit =\n frame && binding[\"aria-labelledby\"] === frame.labelId ? frame.reportLimit : undefined;\n const report = useMemo<ReportLimit | undefined>(\n () => reportLimit && ((limit) => reportLimit(key, usableLimit(limit) ? limit : undefined)),\n [reportLimit, key],\n );\n useEffect(() => () => report?.(undefined), [report]);\n return report;\n}\n\n/** Report a limit derived during render, such as committed tags or selected entries. */\nexport function useReportedLimit(binding: FieldBinding, limit: FieldLimit | undefined) {\n const report = useLimitReport(binding);\n const count = limit?.count;\n const max = limit?.max;\n useEffect(() => {\n report?.(count === undefined || max === undefined ? undefined : { count, max });\n }, [report, count, max]);\n}\n\ninterface TextLimitProps extends FieldBinding {\n maxLength?: number;\n value?: string | number | readonly string[] | null;\n defaultValue?: string | number | readonly string[] | null;\n}\n\n/**\n * Count a native text control for its bound Field. A controlled value is counted\n * from props; null is uncontrolled, as in React. An uncontrolled control is\n * observed only while a Field can show its count.\n */\nexport function useTextLimit(\n inputRef: RefObject<TextControl | null>,\n { value, defaultValue, maxLength, ...binding }: TextLimitProps,\n) {\n const report = useLimitReport(binding);\n const controlledLength = value == null ? undefined : String(value).length;\n // A new default changes an unedited control's value without any event.\n const defaultText = defaultValue == null ? \"\" : String(defaultValue);\n useEffect(() => {\n const input = inputRef.current;\n if (!report || !input) {\n return;\n }\n if (maxLength === undefined) {\n report(undefined);\n } else if (controlledLength !== undefined) {\n report({ count: controlledLength, max: maxLength });\n } else {\n return observeText(input, () => report({ count: input.value.length, max: maxLength }));\n }\n }, [inputRef, report, maxLength, controlledLength, defaultText]);\n}\n\n/**\n * Follow typing, autofill, programmatic writes and native resets without\n * replacing React's handlers or its value tracker.\n */\nfunction observeText(input: TextControl, read: () => void) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The reset event precedes the browser restoring the form's controls, and a\n // later listener may still cancel it, so read once the reset task completes.\n // The form owner is checked at event time so `form` attribute changes apply.\n const onReset = (event: Event) => {\n if (event.target === input.form) {\n clearTimeout(timer);\n timer = setTimeout(read);\n }\n };\n const owner = input.ownerDocument;\n const restoreValue = interceptValueWrites(input, read);\n input.addEventListener(\"input\", read);\n input.addEventListener(\"change\", read);\n owner.addEventListener(\"reset\", onReset, true);\n read();\n return () => {\n clearTimeout(timer);\n restoreValue();\n input.removeEventListener(\"input\", read);\n input.removeEventListener(\"change\", read);\n owner.removeEventListener(\"reset\", onReset, true);\n };\n}\n\n/**\n * Programmatic `value` writes (form libraries' setValue/reset) fire no events.\n * Wrap the instance accessor, chaining to whatever defines it now (React's\n * tracker), and restore that accessor when observation ends.\n */\nfunction interceptValueWrites(input: TextControl, onWrite: () => void) {\n const own = Object.getOwnPropertyDescriptor(input, \"value\");\n const accessor = own ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), \"value\");\n const get = accessor?.get;\n const set = accessor?.set;\n if (!get || !set || own?.configurable === false) {\n return () => {};\n }\n let isActive = true;\n const wrapper: PropertyDescriptor = {\n configurable: true,\n enumerable: accessor.enumerable,\n get(this: TextControl) {\n return get.call(this);\n },\n set(this: TextControl, next: string) {\n set.call(this, next);\n if (isActive) {\n onWrite();\n }\n },\n };\n Object.defineProperty(input, \"value\", wrapper);\n return () => {\n isActive = false;\n // Leave a later wrapper in place; it still chains through this inert one.\n if (Object.getOwnPropertyDescriptor(input, \"value\")?.set !== wrapper.set) {\n return;\n }\n if (own) {\n Object.defineProperty(input, \"value\", own);\n } else {\n Reflect.deleteProperty(input, \"value\");\n }\n };\n}\n"],"mappings":";;;;AAaA,SAASE,EAAe,GAAgD;CACtE,IAAMC,IAAQC,EAAWJ,CAAiB,GACpCK,IAAMC,EAAM,GACZC,IACJJ,KAASK,EAAQ,uBAAuBL,EAAM,UAAUA,EAAM,cAAc,KAAA,GACxEM,IAASC,QACPH,OAAiB,MAAUA,EAAYF,GAAKJ,EAAYU,CAAK,IAAIA,IAAQ,KAAA,CAAS,IACxF,CAACJ,GAAaF,CAAG,CACnB;CAEA,OADAO,cAAsBH,IAAS,KAAA,CAAS,GAAG,CAACA,CAAM,CAAC,GAC5CA;AACT;AAGA,SAAgBI,EAAiB,GAAuB,GAA+B;CACrF,IAAMJ,IAASP,EAAeM,CAAO,GAC/BM,IAAQH,GAAO,OACfI,IAAMJ,GAAO;CACnB,QAAgB;EACd,IAASG,MAAU,KAAA,KAAaC,MAAQ,KAAA,IAAY,KAAA,IAAY;GAAE;GAAO;EAAI,CAAC;CAChF,GAAG;EAACN;EAAQK;EAAOC;CAAG,CAAC;AACzB;AAaA,SAAgBC,EACd,GACA,EAAE,UAAO,iBAAc,cAAW,GAAGR,KACrC;CACA,IAAMC,IAASP,EAAeM,CAAO,GAC/BS,IAAmBC,KAAS,OAAO,KAAA,IAAY,OAAOA,CA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ACrB,MAAuB;GACrB,OAAOC,EAAI,KAAK,IAAI;EACtB;EACA,IAAuB,GAAc;GAEnC,AADAC,EAAI,KAAK,MAAMG,CAAI,GACfF,KACFG,EAAQ;EAEZ;CACF;CAEA,OADA,OAAO,eAAenB,GAAO,SAASiB,CAAO,SAChC;EAGX,AAFA,IAAW,IAEP,OAAO,yBAAyBjB,GAAO,OAAO,CAAC,EAAE,QAAQiB,EAAQ,QAGjEL,IACF,OAAO,eAAeZ,GAAO,SAASY,CAAG,IAEzC,QAAQ,eAAeZ,GAAO,OAAO;CAEzC;AACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useLimit-DXe_VmYl.cjs","names":["useContext","FieldFrameContext","useId","useMemo","usableLimit","require_context","require_limit","react","useLimitReport","frame","key","reportLimit","binding","report","limit","useReportedLimit","count","max","useTextLimit","controlledLength","value","input","inputRef","maxLength","observeText","defaultValue","timer","onReset","event","read","owner","restoreValue","interceptValueWrites","own","accessor","get","set","isActive","wrapper","next","onWrite"],"sources":["../../src/components/Field/useLimit.ts"],"sourcesContent":["import { useContext, useEffect, useId, useMemo, type RefObject } from \"react\";\nimport { FieldFrameContext } from \"./context\";\nimport { usableLimit } from \"./limit\";\nimport type { FieldBinding, FieldLimit } from \"./types\";\n\ntype ReportLimit = (limit: FieldLimit | undefined) => void;\ntype TextControl = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * A control reports only to the Field it is explicitly bound to, and only while\n * that Field has no explicit limit. Each control owns one keyed report, removed\n * on unmount or rebinding without disturbing another control's report.\n */\nfunction useLimitReport(binding: FieldBinding): ReportLimit | undefined {\n const frame = useContext(FieldFrameContext);\n const key = useId();\n const reportLimit =\n frame && binding[\"aria-labelledby\"] === frame.labelId ? frame.reportLimit : undefined;\n const report = useMemo<ReportLimit | undefined>(\n () => reportLimit && ((limit) => reportLimit(key, usableLimit(limit) ? limit : undefined)),\n [reportLimit, key],\n );\n useEffect(() => () => report?.(undefined), [report]);\n return report;\n}\n\n/** Report a limit derived during render, such as committed tags or selected entries. */\nexport function useReportedLimit(binding: FieldBinding, limit: FieldLimit | undefined) {\n const report = useLimitReport(binding);\n const count = limit?.count;\n const max = limit?.max;\n useEffect(() => {\n report?.(count === undefined || max === undefined ? undefined : { count, max });\n }, [report, count, max]);\n}\n\ninterface TextLimitProps extends FieldBinding {\n maxLength?: number;\n value?: string | number | readonly string[] | null;\n defaultValue?: string | number | readonly string[] | null;\n}\n\n/**\n * Count a native text control for its bound Field. A controlled value is counted\n * from props; null is uncontrolled, as in React. An uncontrolled control is\n * observed only while a Field can show its count.\n */\nexport function useTextLimit(\n inputRef: RefObject<TextControl | null>,\n { value, defaultValue, maxLength, ...binding }: TextLimitProps,\n) {\n const report = useLimitReport(binding);\n const controlledLength = value == null ? undefined : String(value).length;\n // A new default changes an unedited control's value without any event.\n const defaultText = defaultValue == null ? \"\" : String(defaultValue);\n useEffect(() => {\n const input = inputRef.current;\n if (!report || !input) {\n return;\n }\n if (maxLength === undefined) {\n report(undefined);\n } else if (controlledLength !== undefined) {\n report({ count: controlledLength, max: maxLength });\n } else {\n return observeText(input, () => report({ count: input.value.length, max: maxLength }));\n }\n }, [inputRef, report, maxLength, controlledLength, defaultText]);\n}\n\n/**\n * Follow typing, autofill, programmatic writes and native resets without\n * replacing React's handlers or its value tracker.\n */\nfunction observeText(input: TextControl, read: () => void) {\n let timer: ReturnType<typeof setTimeout> | undefined;\n // The reset event precedes the browser restoring the form's controls, and a\n // later listener may still cancel it, so read once the reset task completes.\n // The form owner is checked at event time so `form` attribute changes apply.\n const onReset = (event: Event) => {\n if (event.target === input.form) {\n clearTimeout(timer);\n timer = setTimeout(read);\n }\n };\n const owner = input.ownerDocument;\n const restoreValue = interceptValueWrites(input, read);\n input.addEventListener(\"input\", read);\n input.addEventListener(\"change\", read);\n owner.addEventListener(\"reset\", onReset, true);\n read();\n return () => {\n clearTimeout(timer);\n restoreValue();\n input.removeEventListener(\"input\", read);\n input.removeEventListener(\"change\", read);\n owner.removeEventListener(\"reset\", onReset, true);\n };\n}\n\n/**\n * Programmatic `value` writes (form libraries' setValue/reset) fire no events.\n * Wrap the instance accessor, chaining to whatever defines it now (React's\n * tracker), and restore that accessor when observation ends.\n */\nfunction interceptValueWrites(input: TextControl, onWrite: () => void) {\n const own = Object.getOwnPropertyDescriptor(input, \"value\");\n const accessor = own ?? Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), \"value\");\n const get = accessor?.get;\n const set = accessor?.set;\n if (!get || !set || own?.configurable === false) {\n return () => {};\n }\n let isActive = true;\n const wrapper: PropertyDescriptor = {\n configurable: true,\n enumerable: accessor.enumerable,\n get(this: TextControl) {\n return get.call(this);\n },\n set(this: TextControl, next: string) {\n set.call(this, next);\n if (isActive) {\n onWrite();\n }\n },\n };\n Object.defineProperty(input, \"value\", wrapper);\n return () => {\n isActive = false;\n // Leave a later wrapper in place; it still chains through this inert one.\n if (Object.getOwnPropertyDescriptor(input, \"value\")?.set !== wrapper.set) {\n return;\n }\n if (own) {\n Object.defineProperty(input, \"value\", own);\n } else {\n Reflect.deleteProperty(input, \"value\");\n }\n };\n}\n"],"mappings":"A,mGAaA,SAASQ,EAAe,EAAgD,CACtE,IAAMC,GAAA,EAAQT,EAAAA,WAAAA,CAAWC,EAAAA,CAAiB,EACpCS,GAAA,EAAMR,EAAAA,MAAAA,CAAM,EACZS,EACJF,GAASG,EAAQ,qBAAuBH,EAAM,QAAUA,EAAM,YAAc,IAAA,GACxEI,GAAA,EAASV,EAAAA,QAAAA,KACPQ,IAAiB,GAAUA,EAAYD,EAAKN,EAAAA,EAAYU,CAAK,EAAIA,EAAQ,IAAA,EAAS,GACxF,CAACH,EAAaD,CAAG,CACnB,EAEA,OADA,EAAAH,EAAA,UAAA,SAAsBM,IAAS,IAAA,EAAS,EAAG,CAACA,CAAM,CAAC,EAC5CA,CACT,CAGA,SAAgBE,EAAiB,EAAuB,EAA+B,CACrF,IAAMF,EAASL,EAAeI,CAAO,EAC/BI,EAA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QAASH,EAAS,EAAI,CAClD,CACF,CAOA,SAASK,EAAqB,EAAoB,EAAqB,CACrE,IAAMC,EAAM,OAAO,yBAAyBZ,EAAO,OAAO,EACpDa,EAAWD,GAAO,OAAO,yBAAyB,OAAO,eAAeZ,CAAK,EAAG,OAAO,EACvFc,EAAMD,GAAU,IAChBE,EAAMF,GAAU,IACtB,GAAI,CAACC,GAAO,CAACC,GAAOH,GAAK,eAAiB,GACxC,UAAa,CAAC,EAEhB,IAAII,EAAW,GACTC,EAA8B,CAClC,aAAc,GACd,WAAYJ,EAAS,WACrB,KAAuB,CACrB,OAAOC,EAAI,KAAK,IAAI,CACtB,EACA,IAAuB,EAAc,CACnCC,EAAI,KAAK,KAAMG,CAAI,EACfF,GACFG,EAAQ,CAEZ,CACF,EAEA,OADA,OAAO,eAAenB,EAAO,QAASiB,CAAO,MAChC,CACX,EAAW,GAEP,OAAO,yBAAyBjB,EAAO,OAAO,CAAC,EAAE,MAAQiB,EAAQ,MAGjEL,EACF,OAAO,eAAeZ,EAAO,QAASY,CAAG,EAEzC,QAAQ,eAAeZ,EAAO,OAAO,EAEzC,CACF,C"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./portalScope-BVA1-Ypu.cjs"),t=require("./isComposing-BrBcAANm.cjs");let n=require("react");var r=[];function i(){let e={};return r.push(e),{isTopmost:()=>r.at(-1)===e,close:()=>{let t=r.indexOf(e);t!==-1&&r.splice(t,1)}}}var a=0,o={overflow:``,paddingRight:``};function s(){let{body:e,documentElement:t}=document;if(a===0){o={overflow:e.style.overflow,paddingRight:e.style.paddingRight};let n=t.clientWidth;e.style.overflow=`hidden`;let r=t.clientWidth-n;if(r>0){let t=parseFloat(getComputedStyle(e).paddingRight)||0;e.style.paddingRight=`${t+r}px`}}a+=1;let n=!1;return()=>{n||(n=!0,--a,!(a>0)&&(e.style.overflow=o.overflow,e.style.paddingRight=o.paddingRight))}}function c({isOpen:r,panelRef:a,onClose:o,initialFocus:c,preventScroll:l=!1,container:u}){let d=(0,n.useRef)({onClose:o,initialFocus:c}),[f,p]=(0,n.useState)(null),[m,h]=(0,n.useState)(!1);return m!==r&&(h(r),p(r&&typeof document<`u`?document.activeElement:null)),(0,n.useEffect)(()=>{d.current={onClose:o,initialFocus:c}}),(0,n.useEffect)(()=>{if(!r)return;let n={preventScroll:l},o=a.current;o&&!o.contains(document.activeElement)&&(d.current.initialFocus?.()??e.s(o)[0]??o).focus(n);let c=i(),u=n=>{if(c.isTopmost()){if(n.key===`Escape`){if(n.defaultPrevented||t.t(n))return;n.preventDefault(),d.current.onClose()}else e.c(n,a.current)}};window.addEventListener(`keydown`,u);let p=s();return()=>{window.removeEventListener(`keydown`,u),c.close(),p(),e.i(document.activeElement)&&e.a(f,n)}},[r,f,a,l,u]),{onScrimMouseDown:e=>{r&&e.target===e.currentTarget&&(e.preventDefault(),d.current.onClose())}}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
2
|
-
//# sourceMappingURL=useModalDialog-Cgus9408.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useModalDialog-Cgus9408.cjs","names":["useRef","useState","tabbableControls","isComposing","cannotHoldFocus","require_portalScope","require_isComposing","react","stack","openDialog","entry","index","locks","previous","lockBodyScroll","body","width","documentElement","scrollbar","padding","released","useModalDialog","latest","opener","setOpener","wasOpen","setWasOpen","isOpen","focusOptions","panel","panelRef","dialog","onKeyDown","event","unlockScroll","preventScroll","container"],"sources":["../../src/internal/dialogStack.ts","../../src/internal/lockBodyScroll.ts","../../src/internal/useModalDialog.ts"],"sourcesContent":["const stack: object[] = [];\n\n/**\n * Register an open modal dialog. When dialogs nest (a picker over a drawer, a\n * drawer over a modal), only the most recently opened one handles keys.\n */\nexport function openDialog() {\n const entry = {};\n stack.push(entry);\n return {\n isTopmost: () => stack.at(-1) === entry,\n close: () => {\n const index = stack.indexOf(entry);\n if (index !== -1) {\n stack.splice(index, 1);\n }\n },\n };\n}\n","let locks = 0;\nlet previous = { overflow: \"\", paddingRight: \"\" };\n\n/**\n * Nested dialogs may unmount in either order; restore scrolling after the last.\n * Hiding a classic scrollbar widens the page, so the body is padded by the\n * width it gave back and layouts that measure themselves keep their mode.\n */\nexport function lockBodyScroll() {\n const { body, documentElement } = document;\n if (locks === 0) {\n previous = { overflow: body.style.overflow, paddingRight: body.style.paddingRight };\n const width = documentElement.clientWidth;\n body.style.overflow = \"hidden\";\n const scrollbar = documentElement.clientWidth - width;\n if (scrollbar > 0) {\n const padding = parseFloat(getComputedStyle(body).paddingRight) || 0;\n body.style.paddingRight = `${padding + scrollbar}px`;\n }\n }\n locks += 1;\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n locks -= 1;\n if (locks > 0) {\n return;\n }\n body.style.overflow = previous.overflow;\n body.style.paddingRight = previous.paddingRight;\n };\n}\n","import { useEffect, useRef, useState, type MouseEvent, type RefObject } from \"react\";\nimport { openDialog } from \"./dialogStack\";\nimport { lockBodyScroll } from \"./lockBodyScroll\";\nimport { cannotHoldFocus, focusNearest, tabbableControls, trapTabFocus } from \"./dialogFocus\";\nimport { isComposing } from \"./isComposing\";\n\nexport interface ModalDialogOptions {\n isOpen: boolean;\n panelRef: RefObject<HTMLElement | null>;\n /** Escape and a direct scrim press call this. Read when called, so it may change every render. */\n onClose: () => void;\n /** First focus when focus isn't already inside the panel. Defaults to the first tabbable control, then the panel. */\n initialFocus?: () => HTMLElement | null | undefined;\n /** Panels that slide in from off-screen must not scroll the page when focused. */\n preventScroll?: boolean;\n /** Registration restarts when this changes while open, such as a new portal container. */\n container?: unknown;\n}\n\n/**\n * Behaviour every modal overlay shares: one dialog-stack entry, a body scroll\n * lock, Escape and a Tab trap while topmost, initial focus, and focus returned\n * to the opener (or its nearest focusable container) when closing dropped it.\n */\nexport function useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus,\n preventScroll = false,\n container,\n}: ModalDialogOptions) {\n const latest = useRef({ onClose, initialFocus });\n // Captured as the dialog opens, before autoFocus or the caller moves focus inside it.\n const [opener, setOpener] = useState<Element | null>(null);\n const [wasOpen, setWasOpen] = useState(false);\n if (wasOpen !== isOpen) {\n setWasOpen(isOpen);\n setOpener(isOpen && typeof document !== \"undefined\" ? document.activeElement : null);\n }\n\n useEffect(() => {\n latest.current = { onClose, initialFocus };\n });\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const focusOptions = { preventScroll };\n const panel = panelRef.current;\n // Leave focus that autoFocus or the caller already placed inside the panel.\n if (panel && !panel.contains(document.activeElement)) {\n (latest.current.initialFocus?.() ?? tabbableControls(panel)[0] ?? panel).focus(focusOptions);\n }\n\n const dialog = openDialog();\n const onKeyDown = (event: KeyboardEvent) => {\n // A nested picker, drawer or modal handles keys until it closes.\n if (!dialog.isTopmost()) {\n return;\n }\n if (event.key === \"Escape\") {\n // A popup inside the panel (Menu, Select, DateField) claims its Escape first.\n if (event.defaultPrevented || isComposing(event)) {\n return;\n }\n event.preventDefault();\n latest.current.onClose();\n return;\n }\n trapTabFocus(event, panelRef.current);\n };\n // On window, so popup handlers on the document and inside the panel run first.\n window.addEventListener(\"keydown\", onKeyDown);\n const unlockScroll = lockBodyScroll();\n\n return () => {\n window.removeEventListener(\"keydown\", onKeyDown);\n dialog.close();\n unlockScroll();\n // Restore focus only when closing dropped it; the caller may already have placed it.\n if (cannotHoldFocus(document.activeElement)) {\n focusNearest(opener, focusOptions);\n }\n };\n }, [isOpen, opener, panelRef, preventScroll, container]);\n\n /** Presses on the scrim itself close the dialog without moving focus first. */\n const onScrimMouseDown = (event: MouseEvent) => {\n if (isOpen && event.target === event.currentTarget) {\n event.preventDefault();\n latest.current.onClose();\n }\n };\n return { onScrimMouseDown };\n}\n"],"mappings":"A,6GAAA,IAAMQ,EAAkB,CAAC,EAMzB,SAAgBC,GAAa,CAC3B,IAAMC,EAAQ,CAAC,EAEf,OADAF,EAAM,KAAKE,CAAK,EACT,CACL,cAAiBF,EAAM,GAAG,EAAE,IAAME,EA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,eAAc,EAC/BC,EAAQC,EAAS,QAEnBD,GAAS,CAACA,EAAM,SAAS,SAAS,aAAa,IAChDP,EAAO,QAAQ,eAAe,GAAKpB,EAAAA,EAAiB2B,CAAK,CAAC,CAAC,IAAMA,EAAA,CAAO,MAAMD,CAAY,EAG7F,IAAMG,EAAStB,EAAW,EACpBuB,EAAa,GAAyB,CAE1C,GAAKD,EAAO,UAAU,EAGtB,IAAIE,EAAM,MAAQ,SAAU,CAE1B,GAAIA,EAAM,kBAAoB9B,EAAAA,EAAY8B,CAAK,EAC7C,OAEFA,EAAM,eAAe,EACrBX,EAAO,QAAQ,QAAQ,CAEzB,MACAjB,EAAA,EAAa4B,EAAOH,EAAS,OAAO,CADpC,CAEF,EAEA,OAAO,iBAAiB,UAAWE,CAAS,EAC5C,IAAME,EAAepB,EAAe,EAEpC,UAAa,CACX,OAAO,oBAAoB,UAAWkB,CAAS,EAC/CD,EAAO,MAAM,EACbG,EAAa,EAET9B,EAAAA,EAAgB,SAAS,aAAa,GACxCC,EAAA,EAAakB,EAAQK,CAAY,CAErC,CACF,EAAG,CAACD,EAAQJ,EAAQO,EAAUK,EAAeC,CAAS,CAAC,EAShD,CAAE,iBANiB,GAAsB,CAC1CT,GAAUM,EAAM,SAAWA,EAAM,gBACnCA,EAAM,eAAe,EACrBX,EAAO,QAAQ,QAAQ,EAE3B,CAC0B,CAC5B,C"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { a as e, c as t, i as n, s as r } from "./portalScope-AzzPM54i.js";
|
|
2
|
-
import { t as i } from "./isComposing-8bRWyiLF.js";
|
|
3
|
-
import { useEffect as a, useRef as o, useState as s } from "react";
|
|
4
|
-
//#region src/internal/dialogStack.ts
|
|
5
|
-
var c = [];
|
|
6
|
-
function l() {
|
|
7
|
-
let e = {};
|
|
8
|
-
return c.push(e), {
|
|
9
|
-
isTopmost: () => c.at(-1) === e,
|
|
10
|
-
close: () => {
|
|
11
|
-
let t = c.indexOf(e);
|
|
12
|
-
t !== -1 && c.splice(t, 1);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/internal/lockBodyScroll.ts
|
|
18
|
-
var u = 0, d = {
|
|
19
|
-
overflow: "",
|
|
20
|
-
paddingRight: ""
|
|
21
|
-
};
|
|
22
|
-
function f() {
|
|
23
|
-
let { body: e, documentElement: t } = document;
|
|
24
|
-
if (u === 0) {
|
|
25
|
-
d = {
|
|
26
|
-
overflow: e.style.overflow,
|
|
27
|
-
paddingRight: e.style.paddingRight
|
|
28
|
-
};
|
|
29
|
-
let n = t.clientWidth;
|
|
30
|
-
e.style.overflow = "hidden";
|
|
31
|
-
let r = t.clientWidth - n;
|
|
32
|
-
if (r > 0) {
|
|
33
|
-
let t = parseFloat(getComputedStyle(e).paddingRight) || 0;
|
|
34
|
-
e.style.paddingRight = `${t + r}px`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
u += 1;
|
|
38
|
-
let n = !1;
|
|
39
|
-
return () => {
|
|
40
|
-
n || (n = !0, --u, !(u > 0) && (e.style.overflow = d.overflow, e.style.paddingRight = d.paddingRight));
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
//#endregion
|
|
44
|
-
//#region src/internal/useModalDialog.ts
|
|
45
|
-
function p({ isOpen: c, panelRef: u, onClose: d, initialFocus: p, preventScroll: m = !1, container: h }) {
|
|
46
|
-
let g = o({
|
|
47
|
-
onClose: d,
|
|
48
|
-
initialFocus: p
|
|
49
|
-
}), [_, v] = s(null), [y, b] = s(!1);
|
|
50
|
-
return y !== c && (b(c), v(c && typeof document < "u" ? document.activeElement : null)), a(() => {
|
|
51
|
-
g.current = {
|
|
52
|
-
onClose: d,
|
|
53
|
-
initialFocus: p
|
|
54
|
-
};
|
|
55
|
-
}), a(() => {
|
|
56
|
-
if (!c) return;
|
|
57
|
-
let a = { preventScroll: m }, o = u.current;
|
|
58
|
-
o && !o.contains(document.activeElement) && (g.current.initialFocus?.() ?? r(o)[0] ?? o).focus(a);
|
|
59
|
-
let s = l(), d = (e) => {
|
|
60
|
-
if (s.isTopmost()) {
|
|
61
|
-
if (e.key === "Escape") {
|
|
62
|
-
if (e.defaultPrevented || i(e)) return;
|
|
63
|
-
e.preventDefault(), g.current.onClose();
|
|
64
|
-
} else t(e, u.current);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
window.addEventListener("keydown", d);
|
|
68
|
-
let p = f();
|
|
69
|
-
return () => {
|
|
70
|
-
window.removeEventListener("keydown", d), s.close(), p(), n(document.activeElement) && e(_, a);
|
|
71
|
-
};
|
|
72
|
-
}, [
|
|
73
|
-
c,
|
|
74
|
-
_,
|
|
75
|
-
u,
|
|
76
|
-
m,
|
|
77
|
-
h
|
|
78
|
-
]), { onScrimMouseDown: (e) => {
|
|
79
|
-
c && e.target === e.currentTarget && (e.preventDefault(), g.current.onClose());
|
|
80
|
-
} };
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
export { p as t };
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=useModalDialog-Dh-_6A0j.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useModalDialog-Dh-_6A0j.js","names":["focusNearest","trapTabFocus","cannotHoldFocus","tabbableControls","isComposing","stack","openDialog","entry","index","locks","previous","lockBodyScroll","body","width","documentElement","scrollbar","padding","released","useModalDialog","latest","useRef","opener","setOpener","useState","wasOpen","setWasOpen","isOpen","useEffect","focusOptions","panel","panelRef","dialog","onKeyDown","event","unlockScroll","preventScroll","container"],"sources":["../../src/internal/dialogStack.ts","../../src/internal/lockBodyScroll.ts","../../src/internal/useModalDialog.ts"],"sourcesContent":["const stack: object[] = [];\n\n/**\n * Register an open modal dialog. When dialogs nest (a picker over a drawer, a\n * drawer over a modal), only the most recently opened one handles keys.\n */\nexport function openDialog() {\n const entry = {};\n stack.push(entry);\n return {\n isTopmost: () => stack.at(-1) === entry,\n close: () => {\n const index = stack.indexOf(entry);\n if (index !== -1) {\n stack.splice(index, 1);\n }\n },\n };\n}\n","let locks = 0;\nlet previous = { overflow: \"\", paddingRight: \"\" };\n\n/**\n * Nested dialogs may unmount in either order; restore scrolling after the last.\n * Hiding a classic scrollbar widens the page, so the body is padded by the\n * width it gave back and layouts that measure themselves keep their mode.\n */\nexport function lockBodyScroll() {\n const { body, documentElement } = document;\n if (locks === 0) {\n previous = { overflow: body.style.overflow, paddingRight: body.style.paddingRight };\n const width = documentElement.clientWidth;\n body.style.overflow = \"hidden\";\n const scrollbar = documentElement.clientWidth - width;\n if (scrollbar > 0) {\n const padding = parseFloat(getComputedStyle(body).paddingRight) || 0;\n body.style.paddingRight = `${padding + scrollbar}px`;\n }\n }\n locks += 1;\n let released = false;\n return () => {\n if (released) {\n return;\n }\n released = true;\n locks -= 1;\n if (locks > 0) {\n return;\n }\n body.style.overflow = previous.overflow;\n body.style.paddingRight = previous.paddingRight;\n };\n}\n","import { useEffect, useRef, useState, type MouseEvent, type RefObject } from \"react\";\nimport { openDialog } from \"./dialogStack\";\nimport { lockBodyScroll } from \"./lockBodyScroll\";\nimport { cannotHoldFocus, focusNearest, tabbableControls, trapTabFocus } from \"./dialogFocus\";\nimport { isComposing } from \"./isComposing\";\n\nexport interface ModalDialogOptions {\n isOpen: boolean;\n panelRef: RefObject<HTMLElement | null>;\n /** Escape and a direct scrim press call this. Read when called, so it may change every render. */\n onClose: () => void;\n /** First focus when focus isn't already inside the panel. Defaults to the first tabbable control, then the panel. */\n initialFocus?: () => HTMLElement | null | undefined;\n /** Panels that slide in from off-screen must not scroll the page when focused. */\n preventScroll?: boolean;\n /** Registration restarts when this changes while open, such as a new portal container. */\n container?: unknown;\n}\n\n/**\n * Behaviour every modal overlay shares: one dialog-stack entry, a body scroll\n * lock, Escape and a Tab trap while topmost, initial focus, and focus returned\n * to the opener (or its nearest focusable container) when closing dropped it.\n */\nexport function useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus,\n preventScroll = false,\n container,\n}: ModalDialogOptions) {\n const latest = useRef({ onClose, initialFocus });\n // Captured as the dialog opens, before autoFocus or the caller moves focus inside it.\n const [opener, setOpener] = useState<Element | null>(null);\n const [wasOpen, setWasOpen] = useState(false);\n if (wasOpen !== isOpen) {\n setWasOpen(isOpen);\n setOpener(isOpen && typeof document !== \"undefined\" ? document.activeElement : null);\n }\n\n useEffect(() => {\n latest.current = { onClose, initialFocus };\n });\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const focusOptions = { preventScroll };\n const panel = panelRef.current;\n // Leave focus that autoFocus or the caller already placed inside the panel.\n if (panel && !panel.contains(document.activeElement)) {\n (latest.current.initialFocus?.() ?? tabbableControls(panel)[0] ?? panel).focus(focusOptions);\n }\n\n const dialog = openDialog();\n const onKeyDown = (event: KeyboardEvent) => {\n // A nested picker, drawer or modal handles keys until it closes.\n if (!dialog.isTopmost()) {\n return;\n }\n if (event.key === \"Escape\") {\n // A popup inside the panel (Menu, Select, DateField) claims its Escape first.\n if (event.defaultPrevented || isComposing(event)) {\n return;\n }\n event.preventDefault();\n latest.current.onClose();\n return;\n }\n trapTabFocus(event, panelRef.current);\n };\n // On window, so popup handlers on the document and inside the panel run first.\n window.addEventListener(\"keydown\", onKeyDown);\n const unlockScroll = lockBodyScroll();\n\n return () => {\n window.removeEventListener(\"keydown\", onKeyDown);\n dialog.close();\n unlockScroll();\n // Restore focus only when closing dropped it; the caller may already have placed it.\n if (cannotHoldFocus(document.activeElement)) {\n focusNearest(opener, focusOptions);\n }\n };\n }, [isOpen, opener, panelRef, preventScroll, container]);\n\n /** Presses on the scrim itself close the dialog without moving focus first. */\n const onScrimMouseDown = (event: MouseEvent) => {\n if (isOpen && event.target === event.currentTarget) {\n event.preventDefault();\n latest.current.onClose();\n }\n };\n return { onScrimMouseDown };\n}\n"],"mappings":";;;;AAAA,IAAMK,IAAkB,CAAC;AAMzB,SAAgBC,IAAa;CAC3B,IAAMC,IAAQ,CAAC;CAEf,OADAF,EA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QC,EAAS;EAEvB,AAAID,KAAS,CAACA,EAAM,SAAS,SAAS,aAAa,MAChDV,EAAO,QAAQ,eAAe,KAAKhB,EAAiB0B,CAAK,CAAC,CAAC,MAAMA,EAAA,CAAO,MAAMD,CAAY;EAG7F,IAAMG,IAASzB,EAAW,GACpB0B,KAAa,MAAyB;GAE1C,IAAKD,EAAO,UAAU,GAGtB;QAAIE,EAAM,QAAQ,UAAU;KAE1B,IAAIA,EAAM,oBAAoB7B,EAAY6B,CAAK,GAC7C;KAGF,AADAA,EAAM,eAAe,GACrBd,EAAO,QAAQ,QAAQ;IAEzB,OACA,EAAac,GAAOH,EAAS,OAAO;GADpC;EAEF;EAEA,OAAO,iBAAiB,WAAWE,CAAS;EAC5C,IAAME,IAAevB,EAAe;EAEpC,aAAa;GAKX,AAJA,OAAO,oBAAoB,WAAWqB,CAAS,GAC/CD,EAAO,MAAM,GACbG,EAAa,GAEThC,EAAgB,SAAS,aAAa,KACxCF,EAAaqB,GAAQO,CAAY;EAErC;CACF,GAAG;EAACF;EAAQL;EAAQS;EAAUK;EAAeC;CAAS,CAAC,GAShD,EAAE,mBANiB,MAAsB;EAC9C,AAAIV,KAAUO,EAAM,WAAWA,EAAM,kBACnCA,EAAM,eAAe,GACrBd,EAAO,QAAQ,QAAQ;CAE3B,EAC0B;AAC5B"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./isComposing-8bRWyiLF.js";
|
|
2
|
-
import { Popover as t } from "../components/Popover/index.js";
|
|
3
|
-
import { useEffect as n, useId as r, useRef as i, useState as a } from "react";
|
|
4
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
-
//#region src/components/Popover/useTooltip.tsx
|
|
6
|
-
var s = 100;
|
|
7
|
-
function c(e, t) {
|
|
8
|
-
return (n) => {
|
|
9
|
-
e?.(n), n.defaultPrevented || t(n);
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
function l(e) {
|
|
13
|
-
let t = typeof document > "u" ? null : document.activeElement;
|
|
14
|
-
if (!e || !t || !e.contains(t)) return !1;
|
|
15
|
-
try {
|
|
16
|
-
return t.matches(":focus-visible");
|
|
17
|
-
} catch {
|
|
18
|
-
return !0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
function u(u, { placement: d, className: f } = {}) {
|
|
22
|
-
let p = u !== !1 && u != null && u !== "", m = i(null), h = r(), [g, _] = a(!1), [v, y] = a(!1), b = i(!1), x = i(void 0);
|
|
23
|
-
!p && g && _(!1), n(() => () => clearTimeout(x.current), []), n(() => {
|
|
24
|
-
if (!g) return;
|
|
25
|
-
let t = (t) => {
|
|
26
|
-
t.key !== "Escape" || t.defaultPrevented || e(t) || (t.preventDefault(), _(!1));
|
|
27
|
-
};
|
|
28
|
-
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
29
|
-
}, [g]);
|
|
30
|
-
let S = () => {
|
|
31
|
-
clearTimeout(x.current), p && (_(!0), y(!0));
|
|
32
|
-
}, C = () => {
|
|
33
|
-
clearTimeout(x.current), x.current = setTimeout(() => {
|
|
34
|
-
!b.current && !l(m.current) && _(!1);
|
|
35
|
-
}, s);
|
|
36
|
-
}, w = () => {
|
|
37
|
-
b.current = !0, S();
|
|
38
|
-
}, T = () => {
|
|
39
|
-
b.current = !1, C();
|
|
40
|
-
};
|
|
41
|
-
return {
|
|
42
|
-
anchorRef: m,
|
|
43
|
-
description: p && g ? h : void 0,
|
|
44
|
-
triggerProps: (e = {}) => ({
|
|
45
|
-
onMouseEnter: c(e.onMouseEnter, w),
|
|
46
|
-
onMouseLeave: c(e.onMouseLeave, T),
|
|
47
|
-
onFocus: c(e.onFocus, S),
|
|
48
|
-
onBlur: c(e.onBlur, C)
|
|
49
|
-
}),
|
|
50
|
-
panel: p && v ? /* @__PURE__ */ o(t, {
|
|
51
|
-
anchorRef: m,
|
|
52
|
-
isOpen: g,
|
|
53
|
-
id: h,
|
|
54
|
-
role: "tooltip",
|
|
55
|
-
placement: d,
|
|
56
|
-
className: [
|
|
57
|
-
"ds-surface-raised",
|
|
58
|
-
"ds-field-surface",
|
|
59
|
-
"ds-tooltip",
|
|
60
|
-
f
|
|
61
|
-
].filter(Boolean).join(" "),
|
|
62
|
-
children: /* @__PURE__ */ o("span", {
|
|
63
|
-
className: "ds-tooltip__content",
|
|
64
|
-
onMouseEnter: w,
|
|
65
|
-
onMouseLeave: T,
|
|
66
|
-
children: u
|
|
67
|
-
})
|
|
68
|
-
}) : null
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
export { u as t };
|
|
73
|
-
|
|
74
|
-
//# sourceMappingURL=useTooltip-C5gvEoYk.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-C5gvEoYk.js","names":["isComposing","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","show","hide","enter","leave","handlers","Popover","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":";;;;;AAcA,IAAMC,IAAc;AAgBpB,SAASC,EACP,GACA,GACA;CACA,QAAQ,MAAa;EAEnB,AADAC,IAASC,CAAK,GACTA,EAAM,oBACTC,EAAKD,CAAK;CAEd;AACF;AAOA,SAASE,EAAmB,GAAwB;CAClD,IAAMC,IAAS,OAAO,WAAa,MAAc,OAAO,SAAS;CACjE,IAAI,CAACC,KAAU,CAACD,KAAU,CAACC,EAAO,SAASD,CAAM,GAC/C,OAAO;CAET,IAAI;EACF,OAAOA,EAAO,QAAQ,gBAAgB;CACxC,QAAQ;EAEN,OAAO;CACT;AACF;AAOA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAYC,EAAiB,IAAI,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GACa;GACH;GACJ;GACJ,MAAK;GACM;GACX,WAAW;IAAC;IAAqB;IAAoB;IAAcC;GAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;GAEX,UAAA,kBAAC,QAAD;IACE,WAAU;IACV,cAAcJ;IACd,cAAcC;IAEb,UAAAjB;GACG,CAAA;EACC,CAAA,IACP;CACR;AACF"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e=require("./isComposing-BrBcAANm.cjs"),t=require("../components/Popover/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=100;function a(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function o(e){let t=typeof document>`u`?null:document.activeElement;if(!e||!t||!e.contains(t))return!1;try{return t.matches(`:focus-visible`)}catch{return!0}}function s(s,{placement:c,className:l}={}){let u=s!==!1&&s!=null&&s!==``,d=(0,n.useRef)(null),f=(0,n.useId)(),[p,m]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),_=(0,n.useRef)(!1),v=(0,n.useRef)(void 0);!u&&p&&m(!1),(0,n.useEffect)(()=>()=>clearTimeout(v.current),[]),(0,n.useEffect)(()=>{if(!p)return;let t=t=>{t.key!==`Escape`||t.defaultPrevented||e.t(t)||(t.preventDefault(),m(!1))};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[p]);let y=()=>{clearTimeout(v.current),u&&(m(!0),g(!0))},b=()=>{clearTimeout(v.current),v.current=setTimeout(()=>{!_.current&&!o(d.current)&&m(!1)},i)},x=()=>{_.current=!0,y()},S=()=>{_.current=!1,b()};return{anchorRef:d,description:u&&p?f:void 0,triggerProps:(e={})=>({onMouseEnter:a(e.onMouseEnter,x),onMouseLeave:a(e.onMouseLeave,S),onFocus:a(e.onFocus,y),onBlur:a(e.onBlur,b)}),panel:u&&h?(0,r.jsx)(t.Popover,{anchorRef:d,isOpen:p,id:f,role:`tooltip`,placement:c,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,l].filter(Boolean).join(` `),children:(0,r.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:x,onMouseLeave:S,children:s})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
2
|
-
//# sourceMappingURL=useTooltip-bTE_a2Xn.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip-bTE_a2Xn.cjs","names":["useRef","useId","useState","isComposing","Popover","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isEnabled","content","anchorRef","id","isOpen","setIsOpen","hasOpened","setHasOpened","hovered","timer","dismiss","show","hide","enter","leave","handlers","className"],"sources":["../../src/components/Popover/useTooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useId,\n useRef,\n useState,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type SyntheticEvent,\n} from \"react\";\nimport { isComposing } from \"../../internal/isComposing\";\nimport { Popover, type PopoverPlacement } from \".\";\n\n/** Grace period for moving the pointer from the anchor onto the tooltip text. */\nconst CLOSE_DELAY = 100;\n\ninterface TooltipTriggerHandlers<T extends Element> {\n onMouseEnter?: MouseEventHandler<T>;\n onMouseLeave?: MouseEventHandler<T>;\n onFocus?: FocusEventHandler<T>;\n onBlur?: FocusEventHandler<T>;\n}\n\ninterface TooltipOptions {\n placement?: PopoverPlacement;\n /** Added beside the shared tooltip surface classes. */\n className?: string;\n}\n\n/** The caller's handler runs first; preventing its default skips the tooltip's response. */\nfunction compose<E extends SyntheticEvent>(\n theirs: ((event: E) => void) | undefined,\n ours: (event: E) => void,\n) {\n return (event: E) => {\n theirs?.(event);\n if (!event.defaultPrevented) {\n ours(event);\n }\n };\n}\n\n/**\n * Keyboard focus inside the anchor holds a tooltip open after the pointer leaves;\n * the focus a pointer press leaves behind does not. Checked when closing, after\n * the focus event has settled.\n */\nfunction holdsKeyboardFocus(anchor: Element | null) {\n const active = typeof document === \"undefined\" ? null : document.activeElement;\n if (!anchor || !active || !anchor.contains(active)) {\n return false;\n }\n try {\n return active.matches(\":focus-visible\");\n } catch {\n // Engines without :focus-visible keep the earlier behaviour: any focus holds it.\n return true;\n }\n}\n\n/**\n * Hover and focus tooltip shared by Avatar and Time. It survives a short pointer\n * move onto its text, stays while keyboard focus remains, and closes on Escape\n * anywhere. `false`, `null` or empty content disables it.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const anchorRef = useRef<T | null>(null);\n const id = useId();\n const [isOpen, setIsOpen] = useState(false);\n // Idle anchors, such as avatars in a long table, mount no Popover until first shown.\n const [hasOpened, setHasOpened] = useState(false);\n const hovered = useRef(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n if (!isEnabled && isOpen) {\n // Disabling closes it, so re-enabling later cannot reopen it unprompted.\n setIsOpen(false);\n }\n\n useEffect(() => () => clearTimeout(timer.current), []);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const dismiss = (event: KeyboardEvent) => {\n if (event.key !== \"Escape\" || event.defaultPrevented || isComposing(event)) {\n return;\n }\n // Claim it as other popups do: a surrounding dialog skips a prevented Escape,\n // while window listeners still receive the event.\n event.preventDefault();\n setIsOpen(false);\n };\n document.addEventListener(\"keydown\", dismiss);\n return () => document.removeEventListener(\"keydown\", dismiss);\n }, [isOpen]);\n\n const show = () => {\n clearTimeout(timer.current);\n if (isEnabled) {\n setIsOpen(true);\n setHasOpened(true);\n }\n };\n const hide = () => {\n clearTimeout(timer.current);\n timer.current = setTimeout(() => {\n if (!hovered.current && !holdsKeyboardFocus(anchorRef.current)) {\n setIsOpen(false);\n }\n }, CLOSE_DELAY);\n };\n const enter = () => {\n hovered.current = true;\n show();\n };\n const leave = () => {\n hovered.current = false;\n hide();\n };\n\n return {\n anchorRef,\n /** Add to the trigger's `aria-describedby` alongside any caller description. */\n description: isEnabled && isOpen ? id : undefined,\n /** The trigger's hover and focus handlers, composed with the caller's. */\n triggerProps: (handlers: TooltipTriggerHandlers<T> = {}) => ({\n onMouseEnter: compose(handlers.onMouseEnter, enter),\n onMouseLeave: compose(handlers.onMouseLeave, leave),\n onFocus: compose(handlers.onFocus, show),\n onBlur: compose(handlers.onBlur, hide),\n }),\n panel:\n isEnabled && hasOpened ? (\n <Popover\n anchorRef={anchorRef}\n isOpen={isOpen}\n id={id}\n role=\"tooltip\"\n placement={placement}\n className={[\"ds-surface-raised\", \"ds-field-surface\", \"ds-tooltip\", className]\n .filter(Boolean)\n .join(\" \")}\n >\n <span\n className=\"ds-tooltip__content\"\n onMouseEnter={enter}\n onMouseLeave={leave}\n >\n {content}\n </span>\n </Popover>\n ) : null,\n };\n}\n"],"mappings":"A,iJAcA,IAAMS,EAAc,IAgBpB,SAASC,EACP,EACA,EACA,CACA,MAAQ,IAAa,CACnBC,IAASC,CAAK,EACTA,EAAM,kBACTC,EAAKD,CAAK,CAEd,CACF,CAOA,SAASE,EAAmB,EAAwB,CAClD,IAAMC,EAAS,OAAO,SAAa,IAAc,KAAO,SAAS,cACjE,GAAI,CAACC,GAAU,CAACD,GAAU,CAACC,EAAO,SAASD,CAAM,EAC/C,MAAO,GAET,GAAI,CACF,OAAOA,EAAO,QAAQ,gBAAgB,CACxC,MAAQ,CAEN,MAAO,EACT,CACF,CAOA,SAAgBE,EACd,EACA,CAAE,YAAW,aAA8B,CAAC,EAC5C,CACA,IAAMC,EACJC,IAAY,IAASA,GAAY,MAAiCA,IAAY,GAC1EC,GAAA,EAAYpB,EAAAA,OAAAA,CAAiB,IAAI,EACjCqB,GAAA,EAAKpB,EAAAA,MAAAA,CAAM,EACX,CAACqB,EAAQC,IAAA,EAAarB,EAAAA,SAAAA,CAAS,EAAK,EAEpC,CAACsB,EAAWC,IAAA,EAAgBvB,EAAAA,SAAAA,CAAS,EAAK,EAC1CwB,GAAA,EAAU1B,EAAAA,OA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B,aAAc8B,CAAS,CAAC,CAC1E,OAAO,OAAO,CAAC,CACf,KAAK,GAAG,EAEX,UAAA,EAAA1B,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,sBACV,aAAcuB,EACd,aAAcC,EAEb,SAAAb,CACG,CAAA,CACC,CAAA,EACP,IACR,CACF,C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useState","transitionDurationMs","forwardRef","useRef","useId","useModalDialog","createPortal","mergeRefs","Button","require_components_Button_index","require_transitionDuration","require_mergeRefs","require_useModalDialog","require_portalScope","react","react_dom","react_jsx_runtime","useDrawerExit","previousOpen","setPreviousOpen","isOpen","exiting","setExiting","duration","scrimRef","timeout","Drawer","rest","panelRef","closeRef","titleId","descriptionId","variant","portalContainer","node","side","event","onScrimMouseDown","ref","description","size","className","title","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.body,\n );\n});\n"],"mappings":"A,2YA4CA,SAASiB,EAAc,EAAiB,EAA4C,CAClF,GAAM,CAACC,EAAcC,IAAA,EAAmBnB,EAAAA,SAAAA,CAASoB,CAAM,EACjD,CAACC,EAASC,IAAA,EAActB,EAAAA,SAAAA,CAAS,EAAK,EAiB5C,OAfIkB,IAAiBE,IACnBD,EAAgBC,CAAM,EACtBE,EAA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Ae,CAAA,CAC9D,C,EACF,CAAA,EACLZ,GAAmB,SAAS,IAC9B,CACF,CAAC,E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["mergeRefs","useModalDialog","useInheritedPortalScope","useDrawerExit","previousOpen","setPreviousOpen","useState","isOpen","exiting","setExiting","useEffect","duration","transitionDurationMs","scrimRef","timeout","Drawer","forwardRef","rest","panelRef","useRef","closeRef","titleId","useId","descriptionId","variant","portalContainer","createPortal","node","side","event","onScrimMouseDown","ref","description","size","className","title","Button","closeLabel","onClose","footer"],"sources":["../../../src/components/Drawer/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { transitionDurationMs } from \"../../internal/transitionDuration\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type DrawerSide = \"end\" | \"start\" | \"bottom\";\nexport type DrawerSize = \"md\" | \"wide\";\n\nexport interface DrawerProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n title: ReactNode;\n description?: string;\n /** Which edge the panel is anchored to. */\n side?: DrawerSide;\n size?: DrawerSize;\n /** Navigation uses a compact panel, header and footer. Both variants slide in and out. */\n variant?: \"default\" | \"navigation\";\n /** Accessible name of the dismiss button. */\n closeLabel?: string;\n /**\n * Defaults to document.body, covering the viewport. A navigation drawer\n * portaled into a positioned element, such as an app shell, stays inside it.\n */\n portalContainer?: HTMLElement | null;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\nfunction useDrawerExit(isOpen: boolean, scrimRef: RefObject<HTMLDivElement | null>) {\n const [previousOpen, setPreviousOpen] = useState(isOpen);\n const [exiting, setExiting] = useState(false);\n\n if (previousOpen !== isOpen) {\n setPreviousOpen(isOpen);\n setExiting(!isOpen);\n }\n\n useEffect(() => {\n if (!exiting || isOpen) {\n return;\n }\n // Read the actual transition, including token overrides and reduced motion.\n const duration = transitionDurationMs(scrimRef.current!);\n const timeout = window.setTimeout(() => setExiting(false), duration);\n return () => window.clearTimeout(timeout);\n }, [exiting, isOpen, scrimRef]);\n\n return [exiting, setExiting] as const;\n}\n\n/**\n * A side panel for work that belongs beside the page rather than on top of it\n * — editing one record, a filter set, a revision history. Same frame, rules\n * and footer band as `Modal`, with square corners and a full slide through\n * its anchored edge. Focus is trapped while open.\n */\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n {\n isOpen,\n onClose,\n title,\n description,\n side = \"end\",\n size = \"md\",\n variant = \"default\",\n closeLabel = \"Close\",\n portalContainer,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const closeRef = useRef<HTMLButtonElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const [exiting, setExiting] = useDrawerExit(isOpen, scrimRef);\n const { onScrimMouseDown } = useModalDialog({\n isOpen,\n panelRef,\n onClose,\n initialFocus: variant === \"navigation\" ? () => closeRef.current : undefined,\n // Panels start off-screen; focusing them must not scroll the page with them.\n preventScroll: true,\n container: portalContainer,\n });\n useInheritedPortalScope(scrimRef, isOpen, { keepDir: rest.dir !== undefined });\n\n if ((!isOpen && !exiting) || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={(node) => {\n scrimRef.current = node;\n if (node) {\n node.inert = !isOpen;\n }\n }}\n className=\"ds-drawer-scrim\"\n dir={rest.dir}\n data-side={side}\n data-variant={variant}\n data-contained={portalContainer ? \"\" : undefined}\n data-state={isOpen ? \"open\" : \"closed\"}\n aria-hidden={!isOpen || undefined}\n onTransitionEnd={(event) => {\n if (event.target === event.currentTarget && event.propertyName === \"opacity\" && !isOpen) {\n setExiting(false);\n }\n }}\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : undefined}\n tabIndex={-1}\n data-side={side}\n data-size={size}\n data-variant={variant}\n className={[\"ds-drawer\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <header className=\"ds-drawer__head\">\n <div className=\"ds-drawer__titles\">\n <h2\n id={titleId}\n className=\"ds-drawer__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-drawer__description\"\n >\n {description}\n </p>\n )}\n </div>\n <Button\n ref={closeRef}\n variant=\"simple\"\n size={variant === \"navigation\" ? \"lg\" : \"sm\"}\n isIconOnly\n iconStart=\"x\"\n className={variant === \"navigation\" ? \"ds-drawer__close\" : undefined}\n aria-label={closeLabel}\n onClick={onClose}\n />\n </header>\n <div className=\"ds-drawer__body\">{children}</div>\n {footer && <footer className=\"ds-drawer__footer\">{footer}</footer>}\n </div>\n </div>,\n portalContainer ?? document.body,\n );\n});\n"],"mappings":";;;;;;;;;AA4CA,SAASG,EAAc,GAAiB,GAA4C;CAClF,IAAM,CAACC,GAAcC,KAAmBC,EAASC,CAAM,GACjD,CAACC,GAASC,KAAcH,EAAS,EAAK;CAiB5C,OAfIF,MAAiBG,MACnBF,EAAgBE,CAAM,GACtBE,EAAW,CAACF,CAAM,IAGpBG,QAAgB;EACd,IAAI,CAACF,KAAWD,GACd;EAGF,IAAMI,IAAWC,EAAqBC,EAAS,OAAQ,GACjDC,IAAU,OAAO,iBAAiBL,EAAW,EAAK,GAAGE,CAAQ;EACnE,aAAa,OAAO,aAAaG,CAAO;CAC1C,GAAG;EAACN;EAASD;EAAQM;C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WK;GACX,gBAAcT;GACd,WAAW;IAAC;IAAa;IAAoBU;GAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GAXlF,UAAA;IAaE,kBAAC,UAAD;KAAQ,WAAU;KAAlB,UAAA,CACE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,MAAD;OACE,IAAIb;OACJ,WAAU;OAET,UAAAc;MACC,CAAA,GACHH,KACC,kBAAC,KAAD;OACE,IAAIT;OACJ,WAAU;OAET,UAAAS;MACA,CAAA,CAEF;KACL,CAAA,GAAA,kBAACI,GAAD;MACE,KAAKhB;MACL,SAAQ;MACR,MAAMI,MAAY,eAAe,OAAO;MACxC,YAAA;MACA,WAAU;MACV,WAAWA,MAAY,eAAe,qBAAqB,KAAA;MAC3D,cAAYa;MACZ,SAASC;KACV,CAAA,CACK;;IACR,kBAAC,OAAD;KAAK,WAAU;KAAmB;IAAc,CAAA;IAC/CC,KAAU,kBAAC,UAAD;KAAQ,WAAU;KAAqB,UAAAA;IAAe,CAAA;GAC9D;;CACF,CAAA,GACLd,KAAmB,SAAS,IAC9B;AACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"limit-reading.d.cts","sourceRoot":"","sources":["../../../src/components/Field/limit-reading.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7D,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,GAAG,EACH,EAAE,EACF,YAAqB,EACrB,aAAoB,GACrB,EAAE,UAAU,GAAG,iBAAiB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+BAiDjD;AAID;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,UAAU,GAAG,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,+BAmBtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"limit-reading.d.ts","sourceRoot":"","sources":["../../../src/components/Field/limit-reading.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7D,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,GAAG,EACH,EAAE,EACF,YAAqB,EACrB,aAAoB,GACrB,EAAE,UAAU,GAAG,iBAAiB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,+BAiDjD;AAID;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAC7B,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,UAAU,GAAG,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,+BAmBtD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useCallback","Button","FieldAffix","useGroupBinding","require_components_Button_index","require_binding","require_components_FieldAffix_index","react","react_jsx_runtime","cx","parts","NumberField","ariaInvalid","rest","internal","setInternal","defaultValue","current","value","inputRef","commit","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","decreaseLabel","isDisabled","disabled","prefix","suffix","node","ref","isInvalid","raw","event","increaseLabel","NumberRangeField","binding","crossed","attributes","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport { useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"\n> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n /** Stepper names. Include the field's label when a form has several number fields. */\n decreaseLabel?: string;\n increaseLabel?: string;\n}\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n decreaseLabel = \"Decrease\",\n increaseLabel = \"Increase\",\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) {\n next = Math.max(min, next);\n }\n if (max !== undefined) {\n next = Math.min(max, next);\n }\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div\n className={cx(\"ds-number\", className)}\n data-size={size}\n >\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"minus\"\n className=\"ds-number__step\"\n aria-label={decreaseLabel}\n isDisabled={\n isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)\n }\n onClick={() => nudge(-1)}\n />\n )}\n <FieldAffix\n className=\"ds-number__body\"\n lead={prefix}\n trail={suffix}\n >\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"plus\"\n className=\"ds-number__step\"\n aria-label={increaseLabel}\n isDisabled={\n isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)\n }\n onClick={() => nudge(1)}\n />\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps extends FieldBinding {\n className?: string;\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n className,\n ...binding\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-number-range\", className)}\n >\n <NumberField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={minLabel}\n decreaseLabel={`Decrease ${minLabel}`}\n increaseLabel={`Increase ${minLabel}`}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span\n className=\"ds-number-range__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <NumberField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={maxLabel}\n decreaseLabel={`Decrease ${maxLabel}`}\n increaseLabel={`Increase ${maxLabel}`}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":"A,qSAeA,SAASY,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CA8BA,IAAaC,GAAA,EAAcd,EAAAA,WAAAA,CAA+C,SACxE,CACE,OAAO,KACP,QACA,eAAe,GACf,gBACA,MACA,MACA,OAAO,EACP,SACA,SAEA,aAAa,GACb,YAAY,GACZ,cAAc,GACd,gBAAgB,WAChB,gBAAgB,WAChB,YACA,WACA,eAAgBe,EAChB,GAAGC,GAEL,EACA,CACA,GAAM,CAACC,EAAUC,IAAA,EAAejB,EAAAA,SAAAA,CAAsBkB,C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gB,GAASzB,EAAO,CAAE,GAAGH,EAAS,IAAKI,CAAK,CAAC,CAC1D,CAAA,GACD,EAAAb,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,wBACV,cAAY,OACb,SAAA,GAEK,CAAA,GACN,EAAAA,EAAA,IAAA,CAACG,EAAD,CACE,eAAciC,EAAQ,gBACtB,aAAYI,EACZ,cAAe,YAAYA,IAC3B,cAAe,YAAYA,IACrB,OACN,MAAO/B,EAAQ,IACV,MACA,MACC,OACE,SACA,SACI,aACZ,UAAW4B,EACX,cAAgB,GAASzB,EAAO,CAAE,GAAGH,EAAS,IAAKI,CAAK,CAAC,CAC1D,CAAA,CACE,C,EAET,C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useGroupBinding","cx","parts","NumberField","forwardRef","ariaInvalid","rest","internal","setInternal","useState","defaultValue","current","value","inputRef","useRef","commit","useCallback","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","Button","decreaseLabel","isDisabled","disabled","FieldAffix","prefix","suffix","node","ref","isInvalid","raw","event","increaseLabel","NumberRangeField","binding","crossed","attributes","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport { useGroupBinding } from \"../Field/binding\";\nimport type { FieldBinding, FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"\n> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n /** Stepper names. Include the field's label when a form has several number fields. */\n decreaseLabel?: string;\n increaseLabel?: string;\n}\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n decreaseLabel = \"Decrease\",\n increaseLabel = \"Increase\",\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) {\n next = Math.max(min, next);\n }\n if (max !== undefined) {\n next = Math.min(max, next);\n }\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div\n className={cx(\"ds-number\", className)}\n data-size={size}\n >\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"minus\"\n className=\"ds-number__step\"\n aria-label={decreaseLabel}\n isDisabled={\n isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)\n }\n onClick={() => nudge(-1)}\n />\n )}\n <FieldAffix\n className=\"ds-number__body\"\n lead={prefix}\n trail={suffix}\n >\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"plus\"\n className=\"ds-number__step\"\n aria-label={increaseLabel}\n isDisabled={\n isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)\n }\n onClick={() => nudge(1)}\n />\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps extends FieldBinding {\n className?: string;\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n className,\n ...binding\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) {\n setInternal(next);\n }\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n const { attributes } = useGroupBinding(binding);\n\n return (\n <div\n {...attributes}\n className={cx(\"ds-number-range\", className)}\n >\n <NumberField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={minLabel}\n decreaseLabel={`Decrease ${minLabel}`}\n increaseLabel={`Increase ${minLabel}`}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span\n className=\"ds-number-range__dash\"\n aria-hidden=\"true\"\n >\n –\n </span>\n <NumberField\n aria-invalid={binding[\"aria-invalid\"]}\n aria-label={maxLabel}\n decreaseLabel={`Decrease ${maxLabel}`}\n increaseLabel={`Increase ${maxLabel}`}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAeA,SAASC,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AA8BA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,UACA,kBAAe,IACf,kBACA,QACA,QACA,UAAO,GACP,WACA,WAEA,gBAAa,IACb,eAAY,IACZ,iBAAc,IACd,mBAAgB,YAChB,mBAAgB,YAChB,cACA,aACA,gBAAgBC,GAChB,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAAsBC,CAAY,GAC5DC,IAAUC,KAASL,GACnBM,IAAWC,EAAgC,IAAI,GAE/CC,IAASC,GACZ,MAAsB;EAIrB,AAHIJ,MAAU,KAAA,KACZJ,EAAYS,CAAI,GAElBC,IAAg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