@namroodinc/liquid-editorial 0.7.0 → 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 +53 -5
- package/UPGRADING.md +372 -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-B-tjjBfA.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-ucTbDyQt.js → FormEditor-D0J3JN-H.js} +177 -160
- 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/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 +103 -10
- 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 +14 -6
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +14 -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 -1
- package/dist/components/NumberField/index.d.cts +1 -1
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts +1 -1
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +1 -1
- 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/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/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-B-tjjBfA.js.map +0 -1
- package/dist/chunks/ColourField-ynUP1pfN.cjs +0 -2
- package/dist/chunks/ColourField-ynUP1pfN.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-C_4JbAnS.cjs +0 -2
- package/dist/chunks/FormEditor-C_4JbAnS.cjs.map +0 -1
- package/dist/chunks/FormEditor-ucTbDyQt.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/NumberField-1EYJdwDY.cjs +0 -2
- package/dist/chunks/NumberField-1EYJdwDY.cjs.map +0 -1
- package/dist/chunks/NumberField-DizR4NJv.js +0 -178
- package/dist/chunks/NumberField-DizR4NJv.js.map +0 -1
- package/dist/chunks/RichTextEditor-DAnjElUO.cjs +0 -2
- package/dist/chunks/RichTextEditor-DAnjElUO.cjs.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
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createContext as e, useContext as t, useEffect as n, useLayoutEffect as r, useRef as i, useState as a } from "react";
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
//#region src/internal/dialogFocus.ts
|
|
4
|
+
var s = ":is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])";
|
|
5
|
+
function c(e) {
|
|
6
|
+
let t = e.closest("[contenteditable]");
|
|
7
|
+
return !(e.matches("a[href]") && t && t !== e && t.getAttribute("contenteditable") !== "false" && !e.hasAttribute("tabindex")) && (e.checkVisibility?.() ?? !e.closest("[hidden]")) && !e.closest("[inert]");
|
|
8
|
+
}
|
|
9
|
+
function l(e) {
|
|
10
|
+
return !e || e === e.ownerDocument.body || !e.isConnected || e.closest("[aria-hidden='true'], [inert]") !== null;
|
|
11
|
+
}
|
|
12
|
+
function u(e, t) {
|
|
13
|
+
let n = e;
|
|
14
|
+
for (; n;) {
|
|
15
|
+
if (n instanceof HTMLElement && !l(n) && (n.focus(t), n.getRootNode().activeElement === n)) return !0;
|
|
16
|
+
n = n.parentElement?.closest("[tabindex]") ?? null;
|
|
17
|
+
}
|
|
18
|
+
return !1;
|
|
19
|
+
}
|
|
20
|
+
function d(e) {
|
|
21
|
+
return e instanceof HTMLInputElement && e.type === "radio";
|
|
22
|
+
}
|
|
23
|
+
function f(e, t) {
|
|
24
|
+
return e === t || d(e) && d(t) && e.name !== "" && e.name === t.name && e.form === t.form;
|
|
25
|
+
}
|
|
26
|
+
function p(e) {
|
|
27
|
+
let t = Array.from(e.querySelectorAll(s)).filter(c);
|
|
28
|
+
return t.filter((e) => !d(e) || e.checked || !t.some((t) => d(t) && t.checked && f(t, e)));
|
|
29
|
+
}
|
|
30
|
+
var m = /* @__PURE__ */ new WeakMap();
|
|
31
|
+
function h(e, t) {
|
|
32
|
+
return m.set(e, t), () => {
|
|
33
|
+
m.delete(e);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function g(e) {
|
|
37
|
+
let t = e instanceof Element ? e : e.parentElement;
|
|
38
|
+
for (; t && !m.has(t);) t = t.parentElement;
|
|
39
|
+
return t;
|
|
40
|
+
}
|
|
41
|
+
function _(e, t) {
|
|
42
|
+
let n = /* @__PURE__ */ new Set(), r = g(t);
|
|
43
|
+
for (; r && !n.has(r);) {
|
|
44
|
+
n.add(r);
|
|
45
|
+
let t = m.get(r);
|
|
46
|
+
if (e.contains(t)) return !0;
|
|
47
|
+
r = g(t);
|
|
48
|
+
}
|
|
49
|
+
return !1;
|
|
50
|
+
}
|
|
51
|
+
function v(e, t) {
|
|
52
|
+
return t !== null && (e.contains(t) || _(e, t));
|
|
53
|
+
}
|
|
54
|
+
function y(e, t) {
|
|
55
|
+
return !!(t.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_PRECEDING);
|
|
56
|
+
}
|
|
57
|
+
function b(e, t) {
|
|
58
|
+
if (e.key !== "Tab" || e.defaultPrevented || !t) return;
|
|
59
|
+
let n = p(t), r = n[0], i = n.at(-1);
|
|
60
|
+
if (!r || !i) return;
|
|
61
|
+
let a = t.getRootNode().activeElement ?? document.activeElement, o = a !== null && t.contains(a);
|
|
62
|
+
!o && a && _(t, a) || (!o || (e.shiftKey ? f(a, r) || y(a, r) : f(a, i) || y(i, a))) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/internal/useLatest.ts
|
|
66
|
+
var x = typeof document > "u" ? n : r;
|
|
67
|
+
function S(e) {
|
|
68
|
+
let t = i(e);
|
|
69
|
+
return x(() => {
|
|
70
|
+
t.current = e;
|
|
71
|
+
}), t;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
//#region src/internal/portalScope.ts
|
|
75
|
+
var C = typeof document > "u" ? n : r, w = e(null), T = [
|
|
76
|
+
"data-theme",
|
|
77
|
+
"lang",
|
|
78
|
+
"dir"
|
|
79
|
+
];
|
|
80
|
+
function E(e) {
|
|
81
|
+
let t = e.closest("[dir]") ? getComputedStyle(e).direction || e.closest("[dir]").getAttribute("dir") : null;
|
|
82
|
+
return {
|
|
83
|
+
"data-theme": e.closest("[data-theme]")?.getAttribute("data-theme") ?? null,
|
|
84
|
+
lang: e.closest("[lang]")?.getAttribute("lang") ?? null,
|
|
85
|
+
dir: t
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function D(e, t, n, { keepDir: r = !1 } = {}) {
|
|
89
|
+
let i = S(n);
|
|
90
|
+
C(() => {
|
|
91
|
+
let n = e.current, a = i.current?.();
|
|
92
|
+
if (!t || !n || !a) return;
|
|
93
|
+
let o = () => {
|
|
94
|
+
for (let [e, t] of Object.entries(E(a))) e === "dir" && r || (t === null ? n.removeAttribute(e) : n.getAttribute(e) !== t && n.setAttribute(e, t));
|
|
95
|
+
};
|
|
96
|
+
o();
|
|
97
|
+
let s = new MutationObserver(o);
|
|
98
|
+
for (let e = a; e; e = e.parentElement) s.observe(e, {
|
|
99
|
+
attributes: !0,
|
|
100
|
+
attributeFilter: T
|
|
101
|
+
});
|
|
102
|
+
return () => s.disconnect();
|
|
103
|
+
}, [
|
|
104
|
+
e,
|
|
105
|
+
t,
|
|
106
|
+
r,
|
|
107
|
+
i
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
110
|
+
function O(e, n, r) {
|
|
111
|
+
let i = t(w);
|
|
112
|
+
D(e, n, i && (() => i.current), r);
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/internal/overlayLayer.tsx
|
|
116
|
+
var k = e(void 0);
|
|
117
|
+
function A({ layer: e, children: t }) {
|
|
118
|
+
return /* @__PURE__ */ o(k.Provider, {
|
|
119
|
+
value: e,
|
|
120
|
+
children: t
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function j() {
|
|
124
|
+
return t(k);
|
|
125
|
+
}
|
|
126
|
+
var M = e(!1);
|
|
127
|
+
function N() {
|
|
128
|
+
return t(M);
|
|
129
|
+
}
|
|
130
|
+
function P(e) {
|
|
131
|
+
let t = N();
|
|
132
|
+
return e && !t;
|
|
133
|
+
}
|
|
134
|
+
function F({ layer: e, isSuspended: t, children: n }) {
|
|
135
|
+
return /* @__PURE__ */ o(k.Provider, {
|
|
136
|
+
value: e,
|
|
137
|
+
children: /* @__PURE__ */ o(M.Provider, {
|
|
138
|
+
value: t,
|
|
139
|
+
children: n
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function I(e, t) {
|
|
144
|
+
let [n, r] = a("closed"), i = e ? t ? n === "closed" ? "shown" : n : n === "closed" ? "closed" : "suspended" : "closed";
|
|
145
|
+
return i !== n && r(i), i === "suspended";
|
|
146
|
+
}
|
|
147
|
+
function L(e, t, n) {
|
|
148
|
+
let r = j(), i = P(!t), a = I(e, i);
|
|
149
|
+
return {
|
|
150
|
+
layer: n ?? r,
|
|
151
|
+
isVisible: i,
|
|
152
|
+
isResumed: a
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//#endregion
|
|
156
|
+
export { j as a, O as c, l as d, u as f, b as g, p as h, N as i, D as l, h as m, A as n, P as o, v as p, L as r, w as s, F as t, S as u };
|
|
157
|
+
|
|
158
|
+
//# sourceMappingURL=overlayLayer-BgnMskpk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayLayer-BgnMskpk.js","names":["useIsomorphicLayoutEffect","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","panelHoldsFocus","active","precedes","trapTabFocus","event","first","last","inside","useIsomorphicLayoutEffect$1","useEffect","useLayoutEffect","useLatest","ref","useRef","value","useIsomorphicLayoutEffect","PortalScopeContext","createContext","scopeAttributes","scopeOf","direction","usePortalScope","latest","getAnchor","root","rootRef","isOpen","sync","name","keepDir","observer","useInheritedPortalScope","useContext","LayerContext","OverlayLayer","layer","useOverlayLayer","OverlayHiddenContext","useOverlayHidden","useOverlayOpen","hidden","open","DialogContent","isSuspended","useResumed","phase","setPhase","useState","next","isVisible","useDialogPresence","inheritedLayer","isHidden","isResumed","overlayLayer"],"sources":["../../src/internal/dialogFocus.ts","../../src/internal/useLatest.ts","../../src/internal/portalScope.ts","../../src/internal/overlayLayer.tsx"],"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/** Focus in the panel or in a popup it owns, such as a menu that resumed with it. */\nexport function panelHoldsFocus(panel: HTMLElement, active: Element | null) {\n return active !== null && (panel.contains(active) || inOwnedPopup(panel, active));\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 { useEffect, useLayoutEffect, useRef } from \"react\";\n\nconst useIsomorphicLayoutEffect = typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * The latest value, read when a callback or effect runs, so inline callbacks\n * never restart effects. Updated before layout effects and passive effects that\n * are declared after it read it.\n */\nexport function useLatest<T>(value: T) {\n const ref = useRef(value);\n useIsomorphicLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n","import { createContext, useContext, useEffect, useLayoutEffect, type RefObject } from \"react\";\nimport { useLatest } from \"./useLatest\";\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 = useLatest(getAnchor);\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, latest]);\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","import { createContext, useContext, useState, type ReactNode } from \"react\";\n\nconst LayerContext = createContext<number | undefined>(undefined);\n\n/**\n * Layer used by dialogs and popovers opened from this content, including\n * portaled editors. Keep it below the toast layer (80) so toasts stay visible.\n */\nexport function OverlayLayer({ layer, children }: { layer: number; children: ReactNode }) {\n return <LayerContext.Provider value={layer}>{children}</LayerContext.Provider>;\n}\nexport function useOverlayLayer() {\n return useContext(LayerContext);\n}\n\nconst OverlayHiddenContext = createContext(false);\nexport function useOverlayHidden() {\n return useContext(OverlayHiddenContext);\n}\n/** Suspend nested overlay controllers without changing their owner's open state. */\nexport function useOverlayOpen(open: boolean) {\n const hidden = useOverlayHidden();\n return open && !hidden;\n}\n\n/**\n * What a dialog hands its content: its layer, so nested dialogs and popovers\n * paint above it, and its suspension, so their controllers pause with it.\n */\nexport function DialogContent({\n layer,\n isSuspended,\n children,\n}: {\n layer: number | undefined;\n isSuspended: boolean;\n children: ReactNode;\n}) {\n return (\n <LayerContext.Provider value={layer}>\n <OverlayHiddenContext.Provider value={isSuspended}>{children}</OverlayHiddenContext.Provider>\n </LayerContext.Provider>\n );\n}\n\n/**\n * True once an open dialog has been suspended, so it resumes in place instead\n * of replaying its entry motion. Opening again starts over.\n */\nfunction useResumed(isOpen: boolean, isVisible: boolean) {\n const [phase, setPhase] = useState<\"closed\" | \"shown\" | \"suspended\">(\"closed\");\n const next = !isOpen\n ? \"closed\"\n : isVisible\n ? phase === \"closed\"\n ? \"shown\"\n : phase\n : phase === \"closed\"\n ? \"closed\"\n : \"suspended\";\n if (next !== phase) {\n setPhase(next);\n }\n return next === \"suspended\";\n}\n\n/**\n * Where an open dialog sits: its layer (its own, else its surroundings'),\n * whether a suspended ancestor or `isHidden` hides it, and whether it is\n * resuming from such a suspension.\n */\nexport function useDialogPresence(isOpen: boolean, isHidden: boolean, overlayLayer?: number) {\n const inheritedLayer = useOverlayLayer();\n const isVisible = useOverlayOpen(!isHidden);\n const isResumed = useResumed(isOpen, isVisible);\n return { layer: overlayLayer ?? inheritedLayer, isVisible, isResumed };\n}\n"],"mappings":";;;AAAA,IAAMC,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,EAAE;AAE/F;AAMA,SAAgBC,EAAiB,GAAwB;CACvD,IAAMC,IAAW,MAAM,KAAKC,EAAU,iBAA8Bd,CAAiB,CAAC,CAAC,CAAC,OACtFC,CACF;CACA,OAAOY,EAAS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EJ,MAAU,WACR,UACAA,IACFA,MAAU,WACR,WACA,cAPJ;CAWJ,OAHIG,MAASH,KACXC,EAASE,CAAI,GAERA,MAAS;AAClB;AAOA,SAAgBE,EAAkB,GAAiB,GAAmB,GAAuB;CAC3F,IAAMC,IAAiBf,EAAgB,GACjCa,IAAYV,EAAe,CAACa,CAAQ,GACpCC,IAAYT,EAAWlB,GAAQuB,CAAS;CAC9C,OAAO;EAAE,OAAOK,KAAgBH;EAAgB;EAAW;CAAU;AACvE"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
let e=require("react"),t=require("react/jsx-runtime");var n=`:is(button, [href], input:not([type='hidden']), select, textarea, [tabindex], [contenteditable]:not([contenteditable='false'])):not(:disabled):not([tabindex='-1']):not([aria-hidden='true'])`;function r(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 i(e){return!e||e===e.ownerDocument.body||!e.isConnected||e.closest(`[aria-hidden='true'], [inert]`)!==null}function a(e,t){let n=e;for(;n;){if(n instanceof HTMLElement&&!i(n)&&(n.focus(t),n.getRootNode().activeElement===n))return!0;n=n.parentElement?.closest(`[tabindex]`)??null}return!1}function o(e){return e instanceof HTMLInputElement&&e.type===`radio`}function s(e,t){return e===t||o(e)&&o(t)&&e.name!==``&&e.name===t.name&&e.form===t.form}function c(e){let t=Array.from(e.querySelectorAll(n)).filter(r);return t.filter(e=>!o(e)||e.checked||!t.some(t=>o(t)&&t.checked&&s(t,e)))}var l=new WeakMap;function u(e,t){return l.set(e,t),()=>{l.delete(e)}}function d(e){let t=e instanceof Element?e:e.parentElement;for(;t&&!l.has(t);)t=t.parentElement;return t}function f(e,t){let n=new Set,r=d(t);for(;r&&!n.has(r);){n.add(r);let t=l.get(r);if(e.contains(t))return!0;r=d(t)}return!1}function p(e,t){return t!==null&&(e.contains(t)||f(e,t))}function m(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}function h(e,t){if(e.key!==`Tab`||e.defaultPrevented||!t)return;let n=c(t),r=n[0],i=n.at(-1);if(!r||!i)return;let a=t.getRootNode().activeElement??document.activeElement,o=a!==null&&t.contains(a);!o&&a&&f(t,a)||(!o||(e.shiftKey?s(a,r)||m(a,r):s(a,i)||m(i,a)))&&(e.preventDefault(),(e.shiftKey?i:r).focus())}var g=typeof document>`u`?e.useEffect:e.useLayoutEffect;function _(t){let n=(0,e.useRef)(t);return g(()=>{n.current=t}),n}var v=typeof document>`u`?e.useEffect:e.useLayoutEffect,y=(0,e.createContext)(null),b=[`data-theme`,`lang`,`dir`];function x(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 S(e,t,n,{keepDir:r=!1}={}){let i=_(n);v(()=>{let n=e.current,a=i.current?.();if(!t||!n||!a)return;let o=()=>{for(let[e,t]of Object.entries(x(a)))e===`dir`&&r||(t===null?n.removeAttribute(e):n.getAttribute(e)!==t&&n.setAttribute(e,t))};o();let s=new MutationObserver(o);for(let e=a;e;e=e.parentElement)s.observe(e,{attributes:!0,attributeFilter:b});return()=>s.disconnect()},[e,t,r,i])}function C(t,n,r){let i=(0,e.useContext)(y);S(t,n,i&&(()=>i.current),r)}var w=(0,e.createContext)(void 0);function T({layer:e,children:n}){return(0,t.jsx)(w.Provider,{value:e,children:n})}function E(){return(0,e.useContext)(w)}var D=(0,e.createContext)(!1);function O(){return(0,e.useContext)(D)}function k(e){let t=O();return e&&!t}function A({layer:e,isSuspended:n,children:r}){return(0,t.jsx)(w.Provider,{value:e,children:(0,t.jsx)(D.Provider,{value:n,children:r})})}function j(t,n){let[r,i]=(0,e.useState)(`closed`),a=t?n?r===`closed`?`shown`:r:r===`closed`?`closed`:`suspended`:`closed`;return a!==r&&i(a),a===`suspended`}function M(e,t,n){let r=E(),i=k(!t),a=j(e,i);return{layer:n??r,isVisible:i,isResumed:a}}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return _}});
|
|
2
|
+
//# sourceMappingURL=overlayLayer-YVudmo27.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlayLayer-YVudmo27.cjs","names":["useIsomorphicLayoutEffect","useEffect","useLayoutEffect","useRef","useEffect","useLayoutEffect","createContext","useContext","createContext","useContext","useState","react","react_jsx_runtime","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","panelHoldsFocus","active","precedes","trapTabFocus","event","first","last","inside","useIsomorphicLayoutEffect$1","useLatest","ref","value","useIsomorphicLayoutEffect","PortalScopeContext","scopeAttributes","scopeOf","direction","usePortalScope","latest","getAnchor","root","rootRef","isOpen","sync","name","keepDir","observer","useInheritedPortalScope","LayerContext","OverlayLayer","layer","useOverlayLayer","OverlayHiddenContext","useOverlayHidden","useOverlayOpen","hidden","open","DialogContent","isSuspended","useResumed","phase","setPhase","next","isVisible","useDialogPresence","inheritedLayer","isHidden","isResumed","overlayLayer"],"sources":["../../src/internal/dialogFocus.ts","../../src/internal/useLatest.ts","../../src/internal/portalScope.ts","../../src/internal/overlayLayer.tsx"],"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/** Focus in the panel or in a popup it owns, such as a menu that resumed with it. */\nexport function panelHoldsFocus(panel: HTMLElement, active: Element | null) {\n return active !== null && (panel.contains(active) || inOwnedPopup(panel, active));\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 { useEffect, useLayoutEffect, useRef } from \"react\";\n\nconst useIsomorphicLayoutEffect = typeof document === \"undefined\" ? useEffect : useLayoutEffect;\n\n/**\n * The latest value, read when a callback or effect runs, so inline callbacks\n * never restart effects. Updated before layout effects and passive effects that\n * are declared after it read it.\n */\nexport function useLatest<T>(value: T) {\n const ref = useRef(value);\n useIsomorphicLayoutEffect(() => {\n ref.current = value;\n });\n return ref;\n}\n","import { createContext, useContext, useEffect, useLayoutEffect, type RefObject } from \"react\";\nimport { useLatest } from \"./useLatest\";\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 = useLatest(getAnchor);\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, latest]);\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","import { createContext, useContext, useState, type ReactNode } from \"react\";\n\nconst LayerContext = createContext<number | undefined>(undefined);\n\n/**\n * Layer used by dialogs and popovers opened from this content, including\n * portaled editors. Keep it below the toast layer (80) so toasts stay visible.\n */\nexport function OverlayLayer({ layer, children }: { layer: number; children: ReactNode }) {\n return <LayerContext.Provider value={layer}>{children}</LayerContext.Provider>;\n}\nexport function useOverlayLayer() {\n return useContext(LayerContext);\n}\n\nconst OverlayHiddenContext = createContext(false);\nexport function useOverlayHidden() {\n return useContext(OverlayHiddenContext);\n}\n/** Suspend nested overlay controllers without changing their owner's open state. */\nexport function useOverlayOpen(open: boolean) {\n const hidden = useOverlayHidden();\n return open && !hidden;\n}\n\n/**\n * What a dialog hands its content: its layer, so nested dialogs and popovers\n * paint above it, and its suspension, so their controllers pause with it.\n */\nexport function DialogContent({\n layer,\n isSuspended,\n children,\n}: {\n layer: number | undefined;\n isSuspended: boolean;\n children: ReactNode;\n}) {\n return (\n <LayerContext.Provider value={layer}>\n <OverlayHiddenContext.Provider value={isSuspended}>{children}</OverlayHiddenContext.Provider>\n </LayerContext.Provider>\n );\n}\n\n/**\n * True once an open dialog has been suspended, so it resumes in place instead\n * of replaying its entry motion. Opening again starts over.\n */\nfunction useResumed(isOpen: boolean, isVisible: boolean) {\n const [phase, setPhase] = useState<\"closed\" | \"shown\" | \"suspended\">(\"closed\");\n const next = !isOpen\n ? \"closed\"\n : isVisible\n ? phase === \"closed\"\n ? \"shown\"\n : phase\n : phase === \"closed\"\n ? \"closed\"\n : \"suspended\";\n if (next !== phase) {\n setPhase(next);\n }\n return next === \"suspended\";\n}\n\n/**\n * Where an open dialog sits: its layer (its own, else its surroundings'),\n * whether a suspended ancestor or `isHidden` hides it, and whether it is\n * resuming from such a suspension.\n */\nexport function useDialogPresence(isOpen: boolean, isHidden: boolean, overlayLayer?: number) {\n const inheritedLayer = useOverlayLayer();\n const isVisible = useOverlayOpen(!isHidden);\n const isResumed = useResumed(isOpen, isVisible);\n return {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AAwC,CAAA,CACvE,CAAA,CAE3B,CAMA,SAASC,EAAW,EAAiB,EAAoB,CACvD,GAAM,CAACC,EAAOC,IAAA,EAAYtE,EAAAA,SAAAA,CAA2C,QAAQ,EACvEuE,EAAQpB,EAEVqB,EACEH,IAAU,SACR,QACAA,EACFA,IAAU,SACR,SACA,YAPJ,SAWJ,OAHIE,IAASF,GACXC,EAASC,CAAI,EAERA,IAAS,WAClB,CAOA,SAAgBE,EAAkB,EAAiB,EAAmB,EAAuB,CAC3F,IAAMC,EAAiBd,EAAgB,EACjCY,EAAYT,EAAe,CAACY,CAAQ,EACpCC,EAAYR,EAAWjB,EAAQqB,CAAS,EAC9C,MAAO,CAAE,MAAOK,GAAgBH,EAAgB,YAAW,WAAU,CACvE,C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "./context-CXvOl4Kt.js";
|
|
2
|
-
import { r as t } from "./limit-
|
|
2
|
+
import { r as t } from "./limit-BHHST_0G.js";
|
|
3
3
|
import { useContext as n, useEffect as r, useId as i, useMemo as a } from "react";
|
|
4
4
|
//#region src/components/Field/useLimit.ts
|
|
5
5
|
function o(o) {
|
|
@@ -70,4 +70,4 @@ function u(e, t) {
|
|
|
70
70
|
//#endregion
|
|
71
71
|
export { c as n, s as t };
|
|
72
72
|
|
|
73
|
-
//# sourceMappingURL=useLimit-
|
|
73
|
+
//# sourceMappingURL=useLimit-C471qZ4H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLimit-C471qZ4H.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 | null | 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":";;;;AA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const e=require("./context-BONPXF-V.cjs"),t=require("./limit-BBnpe9o9.cjs");let n=require("react");function r(r){let i=(0,n.useContext)(e.t),a=(0,n.useId)(),o=i&&r[`aria-labelledby`]===i.labelId?i.reportLimit:void 0,s=(0,n.useMemo)(()=>o&&(e=>o(a,t.r(e)?e:void 0)),[o,a]);return(0,n.useEffect)(()=>()=>s?.(void 0),[s]),s}function i(e,t){let i=r(e),a=t?.count,o=t?.max;(0,n.useEffect)(()=>{i?.(a===void 0||o===void 0?void 0:{count:a,max:o})},[i,a,o])}function a(e,{value:t,defaultValue:i,maxLength:a,...s}){let c=r(s),l=t==null?void 0:String(t).length;(0,n.useEffect)(()=>{let t=e.current;if(c&&t){if(a===void 0)c(void 0);else if(l!==void 0)c({count:l,max:a});else return o(t,()=>c({count:t.value.length,max:a}))}},[e,c,a,l,i==null?``:String(i)])}function o(e,t){let n,r=r=>{r.target===e.form&&(clearTimeout(n),n=setTimeout(t))},i=e.ownerDocument,a=s(e,t);return e.addEventListener(`input`,t),e.addEventListener(`change`,t),i.addEventListener(`reset`,r,!0),t(),()=>{clearTimeout(n),a(),e.removeEventListener(`input`,t),e.removeEventListener(`change`,t),i.removeEventListener(`reset`,r,!0)}}function s(e,t){let n=Object.getOwnPropertyDescriptor(e,`value`),r=n??Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),`value`),i=r?.get,a=r?.set;if(!i||!a||n?.configurable===!1)return()=>{};let o=!0,s={configurable:!0,enumerable:r.enumerable,get(){return i.call(this)},set(e){a.call(this,e),o&&t()}};return Object.defineProperty(e,"value",s),()=>{o=!1,Object.getOwnPropertyDescriptor(e,`value`)?.set===s.set&&(n?Object.defineProperty(e,"value",n):Reflect.deleteProperty(e,`value`))}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
|
|
2
|
+
//# sourceMappingURL=useLimit-WWWDacob.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLimit-WWWDacob.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 | null | 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,EAAsC,CAC5F,IAAMF,EAASL,EAAeI,CAAO,EAC/BI,EAAQF,GAAO,MACfG,EAAMH,GAAO,KACnB,EAAAP,EAAA,UAAA,KAAgB,CACdM,IAASG,IAAU,IAAA,IAAaC,IAAQ,IAAA,GAAY,IAAA,GAAY,CAAE,QAAO,KAAI,CAAC,CAChF,EAAG,CAACJ,EAAQG,EAAOC,CAAG,CAAC,CACzB,CAaA,SAAgBC,EACd,EACA,CAAE,QAAO,eAAc,YAAW,GAAGN,GACrC,CACA,IAAMC,EAASL,EAAeI,CAAO,EAC/BO,EAAmBC,GAAS,KAAO,IAAA,GAAY,OAAOA,CAAK,CAAC,CAAC,QAGnE,EAAAb,EAAA,UAAA,KAAgB,CACd,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ACtB,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"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { i as e } from "./overlayLayer-BgnMskpk.js";
|
|
2
|
+
import { t } from "./isComposing-8bRWyiLF.js";
|
|
3
|
+
import { Popover as n } from "../components/Popover/index.js";
|
|
4
|
+
import { useEffect as r, useId as i, useRef as a, useState as o } from "react";
|
|
5
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/Popover/useTooltip.tsx
|
|
7
|
+
var c = 100;
|
|
8
|
+
function l(e, t) {
|
|
9
|
+
return (n) => {
|
|
10
|
+
e?.(n), n.defaultPrevented || t(n);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function u(e) {
|
|
14
|
+
let t = typeof document > "u" ? null : document.activeElement;
|
|
15
|
+
if (!e || !t || !e.contains(t)) return !1;
|
|
16
|
+
try {
|
|
17
|
+
return t.matches(":focus-visible");
|
|
18
|
+
} catch {
|
|
19
|
+
return !0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function d(d, { placement: f, className: p } = {}) {
|
|
23
|
+
let m = e(), h = d !== !1 && d != null && d !== "", g = h && !m, _ = a(null), v = i(), [y, b] = o(!1), [x, S] = o(!1), C = a(!1), w = a(void 0);
|
|
24
|
+
!g && y && b(!1), r(() => () => clearTimeout(w.current), []), r(() => {
|
|
25
|
+
if (!y) return;
|
|
26
|
+
let e = (e) => {
|
|
27
|
+
e.key !== "Escape" || e.defaultPrevented || t(e) || (e.preventDefault(), b(!1));
|
|
28
|
+
};
|
|
29
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
30
|
+
}, [y]);
|
|
31
|
+
let T = () => {
|
|
32
|
+
clearTimeout(w.current), g && (b(!0), S(!0));
|
|
33
|
+
}, E = () => {
|
|
34
|
+
clearTimeout(w.current), w.current = setTimeout(() => {
|
|
35
|
+
!C.current && !u(_.current) && b(!1);
|
|
36
|
+
}, c);
|
|
37
|
+
}, D = () => {
|
|
38
|
+
C.current = !0, T();
|
|
39
|
+
}, O = () => {
|
|
40
|
+
C.current = !1, E();
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
anchorRef: _,
|
|
44
|
+
description: h && y ? v : void 0,
|
|
45
|
+
triggerProps: (e = {}) => ({
|
|
46
|
+
onMouseEnter: l(e.onMouseEnter, D),
|
|
47
|
+
onMouseLeave: l(e.onMouseLeave, O),
|
|
48
|
+
onFocus: l(e.onFocus, T),
|
|
49
|
+
onBlur: l(e.onBlur, E)
|
|
50
|
+
}),
|
|
51
|
+
panel: h && x ? /* @__PURE__ */ s(n, {
|
|
52
|
+
anchorRef: _,
|
|
53
|
+
isOpen: y,
|
|
54
|
+
id: v,
|
|
55
|
+
role: "tooltip",
|
|
56
|
+
placement: f,
|
|
57
|
+
className: [
|
|
58
|
+
"ds-surface-raised",
|
|
59
|
+
"ds-field-surface",
|
|
60
|
+
"ds-tooltip",
|
|
61
|
+
p
|
|
62
|
+
].filter(Boolean).join(" "),
|
|
63
|
+
children: /* @__PURE__ */ s("span", {
|
|
64
|
+
className: "ds-tooltip__content",
|
|
65
|
+
onMouseEnter: D,
|
|
66
|
+
onMouseLeave: O,
|
|
67
|
+
children: d
|
|
68
|
+
})
|
|
69
|
+
}) : null
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { d as t };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=useTooltip-DajWQyNL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltip-DajWQyNL.js","names":["useOverlayHidden","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","anchorRef","useRef","id","useId","isOpen","setIsOpen","useState","hasOpened","setHasOpened","hovered","timer","useEffect","dismiss","isComposing","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 { useOverlayHidden } from \"../../internal/overlayLayer\";\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, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\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 (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens 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 (canShow) {\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":";;;;;;AAeA,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;AAQA,SAAgBE,EACd,GACA,EAAE,cAAW,iBAA8B,CAAC,GAC5C;CACA,IAAMC,IAAcV,EAAiB,GAC/BW,IACJC,MAAY,MAASA,KAAY,QAAiCA,MAAY,IAC1EC,IAAUF,KAAa,CAACD,GACxBI,IAAYC,EAAiB,IAAI,GACjCC,IAAKC,EAAM,GACX,CAACC,GAAQC,KAAaC,EAAS,EAAK,GAEpC,CAACC,GAAWC,KAAgBF,EAAS,EAAK,GAC1CG,IAAUR,EAAO,EAAK,GACtBS,IAAQT,EAAkD,KAAA,CAAS;CAQzE,AAPI,CAACF,KAAWK,KAEdC,EAAU,EAAK,GAGjBM,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC,GAErDC,QAAgB;EACd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
const e=require("./overlayLayer-YVudmo27.cjs"),t=require("./isComposing-BrBcAANm.cjs"),n=require("../components/Popover/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=100;function o(e,t){return n=>{e?.(n),n.defaultPrevented||t(n)}}function s(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 c(c,{placement:l,className:u}={}){let d=e.i(),f=c!==!1&&c!=null&&c!==``,p=f&&!d,m=(0,r.useRef)(null),h=(0,r.useId)(),[g,_]=(0,r.useState)(!1),[v,y]=(0,r.useState)(!1),b=(0,r.useRef)(!1),x=(0,r.useRef)(void 0);!p&&g&&_(!1),(0,r.useEffect)(()=>()=>clearTimeout(x.current),[]),(0,r.useEffect)(()=>{if(!g)return;let e=e=>{e.key!==`Escape`||e.defaultPrevented||t.t(e)||(e.preventDefault(),_(!1))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[g]);let S=()=>{clearTimeout(x.current),p&&(_(!0),y(!0))},C=()=>{clearTimeout(x.current),x.current=setTimeout(()=>{!b.current&&!s(m.current)&&_(!1)},a)},w=()=>{b.current=!0,S()},T=()=>{b.current=!1,C()};return{anchorRef:m,description:f&&g?h:void 0,triggerProps:(e={})=>({onMouseEnter:o(e.onMouseEnter,w),onMouseLeave:o(e.onMouseLeave,T),onFocus:o(e.onFocus,S),onBlur:o(e.onBlur,C)}),panel:f&&v?(0,i.jsx)(n.Popover,{anchorRef:m,isOpen:g,id:h,role:`tooltip`,placement:l,className:[`ds-surface-raised`,`ds-field-surface`,`ds-tooltip`,u].filter(Boolean).join(` `),children:(0,i.jsx)(`span`,{className:`ds-tooltip__content`,onMouseEnter:w,onMouseLeave:T,children:c})}):null}}Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return c}});
|
|
2
|
+
//# sourceMappingURL=useTooltip-DtrE7QYu.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTooltip-DtrE7QYu.cjs","names":["useOverlayHidden","useRef","useId","useState","isComposing","Popover","require_overlayLayer","require_isComposing","require_components_Popover_index","react","react_jsx_runtime","CLOSE_DELAY","compose","theirs","event","ours","holdsKeyboardFocus","active","anchor","useTooltip","isSuspended","isEnabled","content","canShow","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 { useOverlayHidden } from \"../../internal/overlayLayer\";\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, and a suspended\n * dialog around it closes it, so its Escape handler never reaches the active one.\n */\nexport function useTooltip<T extends HTMLElement>(\n content: ReactNode,\n { placement, className }: TooltipOptions = {},\n) {\n const isSuspended = useOverlayHidden();\n const isEnabled =\n content !== false && content !== null && content !== undefined && content !== \"\";\n const canShow = isEnabled && !isSuspended;\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 (!canShow && isOpen) {\n // Disabling or suspending closes it, so it never reopens 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 (canShow) {\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,0LAeA,IAAMW,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,CAQA,SAAgBE,EACd,EACA,CAAE,YAAW,aAA8B,CAAC,EAC5C,CACA,IAAMC,EAAcpB,EAAAA,EAAiB,EAC/BqB,EACJC,IAAY,IAASA,GAAY,MAAiCA,IAAY,GAC1EC,EAAUF,GAAa,CAACD,EACxBI,GAAA,EAAYvB,EAAAA,OAAAA,CAAiB,IAAI,EACjCwB,GAAA,EAAKvB,EAAAA,MAAAA,CAAM,EACX,CAACwB,EAAQC,IAAA,EAAaxB,EAAAA,SAAAA,CAAS,EAAK,EAEpC,CAACyB,EAAWC,IAAA,EAAgB1B,EAAAA,SAAAA,CAAS,EAAK,EAC1C2B,GAAA,EAAU7B,EAAAA,OAAAA,CAAO,EAAK,EACtB8B,GA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AO,OAAO,CAAC,CACf,KAAK,GAAG,EAEX,UAAA,EAAA5B,EAAA,IAAA,CAAC,OAAD,CACE,UAAU,sBACV,aAAcyB,EACd,aAAcC,EAEb,SAAAd,CACG,CAAA,CACC,CAAA,EACP,IACR,CACF,C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/Drawer-CcVF_p4b.cjs"),n=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),r=require("../SideNav/index.cjs"),i=require("../TopNav/index.cjs"),a=require("../../chunks/observeElementWidth-BCJM2FAw.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=(0,o.forwardRef)(function({brand:c,navigation:l,actions:u,navigationLabel:d=`Main`,scrollMode:f=`container`,contentPadding:p=`default`,className:m,children:h,...g},_){let[v,y]=(0,o.useState)(null),[b,x]=(0,o.useState)(!1),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(!1),T=(0,o.useId)(),E=(0,o.useMemo)(()=>n.t(y,_),[_]);(0,o.useEffect)(()=>v?a.t(v,e=>{e<768||(document.getElementById(T)?.contains(document.activeElement)&&(w.current=!0),x(!1))}):void 0,[v,T]),(0,o.useEffect)(()=>{!b&&w.current&&(w.current=!1,(S.current?.querySelector(`[aria-current='page']`)??S.current?.querySelector(`a[href]`)??C.current)?.focus())},[b]);let D=u?.(`drawer`);return(0,s.jsxs)(`div`,{...g,ref:E,"data-scroll-mode":f,"data-content-padding":p,className:[`ds-appshell`,m].filter(Boolean).join(` `),children:[(0,s.jsxs)(`div`,{className:`ds-appshell__frame`,"aria-hidden":b||void 0,ref:e=>{e&&(e.inert=b)},children:[(0,s.jsx)(i.TopNav,{brand:c,actions:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(`div`,{className:`ds-appshell__actions`,children:u?.(`topnav`)}),(0,s.jsx)(e.Button,{variant:`simple`,size:`lg`,isIconOnly:!0,iconStart:`menu`,className:`ds-appshell__toggle`,"aria-label":`Open navigation`,"aria-expanded":b,"aria-controls":T,onClick:()=>x(!0)})]})}),(0,s.jsxs)(`div`,{className:`ds-appshell__body`,children:[(0,s.jsx)(r.SideNav,{ref:S,className:`ds-appshell__desktop-nav`,label:d,children:l}),(0,s.jsx)(`main`,{ref:C,className:`ds-appshell__main`,tabIndex:-1,children:h})]})]}),(0,s.jsx)(t.t,{id:T,isOpen:b,onClose:()=>x(!1),variant:`navigation`,side:`end`,portalContainer:f===`document`?void 0:v,dir:g.dir,title:c,"aria-label":`Navigation`,closeLabel:`Close navigation`,footer:D?(0,s.jsx)(r.SideNavFooter,{children:D}):void 0,children:(0,s.jsx)(r.SideNav,{className:`ds-appshell__mobile-nav`,label:d,onClick:e=>{let t=e.target instanceof Element?e.target.closest(`a[href]`):null,n=e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||t?.target===`_blank`;t&&!n&&x(!1)},children:l})})]})});exports.AppShell=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useId","useMemo","mergeRefs","observeElementWidth","TopNav","_Fragment","Button","SideNav","Drawer","SideNavFooter","require_components_Button_index","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useState","useRef","useId","useMemo","mergeRefs","observeElementWidth","TopNav","_Fragment","Button","SideNav","Drawer","SideNavFooter","require_components_Button_index","require_Drawer","require_mergeRefs","require_components_SideNav_index","require_components_TopNav_index","require_observeElementWidth","react","react_jsx_runtime","AppShell","rest","shell","setShell","isOpen","setOpen","desktopNavRef","mainRef","restoreDesktopFocus","drawerId","shellRef","ref","width","drawerActions","actions","scrollMode","contentPadding","className","node","navigationLabel","navigation","brand","link","event","opensElsewhere"],"sources":["../../../src/components/AppShell/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Drawer } from \"../Drawer\";\nimport { Button } from \"../Button\";\nimport { SideNav, SideNavFooter } from \"../SideNav\";\nimport { TopNav } from \"../TopNav\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport \"./style.css\";\n\nexport interface AppShellProps extends HTMLAttributes<HTMLDivElement> {\n /** Product brand, shared by the top bar and mobile drawer header. */\n brand: ReactNode;\n /** SideNavSection/SideNavItem content. The application owns routing and selection. */\n navigation: ReactNode;\n /** One slot with a compact top-bar and expanded drawer presentation. */\n actions?: (location: \"topnav\" | \"drawer\") => ReactNode;\n navigationLabel?: string;\n /** The default scrolls the main region; document mode follows the window. */\n scrollMode?: \"container\" | \"document\";\n /** Let full-width page layouts own their spacing. */\n contentPadding?: \"default\" | \"none\";\n /** Rendered inside the shell's main landmark. */\n children?: ReactNode;\n}\n\n/** Full-width product bar above a desktop rail, or a mobile navigation drawer. */\nexport const AppShell = forwardRef<HTMLDivElement, AppShellProps>(function AppShell(\n {\n brand,\n navigation,\n actions,\n navigationLabel = \"Main\",\n scrollMode = \"container\",\n contentPadding = \"default\",\n className,\n children,\n ...rest\n },\n ref,\n) {\n const [shell, setShell] = useState<HTMLDivElement | null>(null);\n const [isOpen, setOpen] = useState(false);\n const desktopNavRef = useRef<HTMLElement | null>(null);\n const mainRef = useRef<HTMLElement | null>(null);\n const restoreDesktopFocus = useRef(false);\n const drawerId = useId();\n const shellRef = useMemo(() => mergeRefs(setShell, ref), [ref]);\n\n useEffect(() => {\n if (!shell) {\n return;\n }\n const measure = (width: number) => {\n if (width < 768) {\n return;\n }\n // Document mode portals the drawer to the body, outside the shell.\n const drawer = document.getElementById(drawerId);\n if (drawer?.contains(document.activeElement)) {\n restoreDesktopFocus.current = true;\n }\n setOpen(false);\n };\n return observeElementWidth(shell, measure);\n }, [shell, drawerId]);\n\n useEffect(() => {\n if (isOpen || !restoreDesktopFocus.current) {\n return;\n }\n restoreDesktopFocus.current = false;\n const destination =\n desktopNavRef.current?.querySelector<HTMLElement>(\"[aria-current='page']\") ??\n desktopNavRef.current?.querySelector<HTMLElement>(\"a[href]\");\n (destination ?? mainRef.current)?.focus();\n }, [isOpen]);\n\n const drawerActions = actions?.(\"drawer\");\n\n return (\n <div\n {...rest}\n ref={shellRef}\n data-scroll-mode={scrollMode}\n data-content-padding={contentPadding}\n className={[\"ds-appshell\", className].filter(Boolean).join(\" \")}\n >\n <div\n className=\"ds-appshell__frame\"\n aria-hidden={isOpen || undefined}\n ref={(node) => {\n if (node) {\n node.inert = isOpen;\n }\n }}\n >\n <TopNav\n brand={brand}\n actions={\n <>\n <div className=\"ds-appshell__actions\">{actions?.(\"topnav\")}</div>\n <Button\n variant=\"simple\"\n size=\"lg\"\n isIconOnly\n iconStart=\"menu\"\n className=\"ds-appshell__toggle\"\n aria-label=\"Open navigation\"\n aria-expanded={isOpen}\n aria-controls={drawerId}\n onClick={() => setOpen(true)}\n />\n </>\n }\n />\n <div className=\"ds-appshell__body\">\n <SideNav\n ref={desktopNavRef}\n className=\"ds-appshell__desktop-nav\"\n label={navigationLabel}\n >\n {navigation}\n </SideNav>\n <main\n ref={mainRef}\n className=\"ds-appshell__main\"\n tabIndex={-1}\n >\n {children}\n </main>\n </div>\n </div>\n <Drawer\n id={drawerId}\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n variant=\"navigation\"\n side=\"end\"\n portalContainer={scrollMode === \"document\" ? undefined : shell}\n dir={rest.dir}\n title={brand}\n aria-label=\"Navigation\"\n closeLabel=\"Close navigation\"\n footer={drawerActions ? <SideNavFooter>{drawerActions}</SideNavFooter> : undefined}\n >\n <SideNav\n className=\"ds-appshell__mobile-nav\"\n label={navigationLabel}\n onClick={(event) => {\n const link =\n event.target instanceof Element\n ? event.target.closest<HTMLAnchorElement>(\"a[href]\")\n : null;\n // Opening a link elsewhere (modifier keys, another button, a new tab) leaves this page in place.\n const opensElsewhere =\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n link?.target === \"_blank\";\n if (link && !opensElsewhere) {\n setOpen(false);\n }\n }}\n >\n {navigation}\n </SideNav>\n </Drawer>\n </div>\n );\n});\n"],"mappings":"A,6XAmCA,IAAaqB,GAAA,EAAWrB,EAAAA,WAAAA,CAA0C,SAChE,CACE,QACA,aACA,UACA,kBAAkB,OAClB,aAAa,YACb,iBAAiB,UACjB,YACA,WACA,GAAGsB,GAEL,EACA,CACA,GAAM,CAACC,EAAOC,IAAA,EAAYvB,EAAAA,SAAAA,CAAgC,IAAI,EACxD,CAACwB,EAAQC,IAAA,EAAWzB,EAAAA,SAAAA,CAAS,EAAK,EAClC0B,GAAA,EAAgBzB,EAAAA,OAAAA,CAA2B,IAAI,EAC/C0B,GAAA,EAAU1B,EAAAA,OAAAA,CAA2B,IAAI,EACzC2B,GAAA,EAAsB3B,EAAAA,OAAAA,CAAO,EAAK,EAClC4B,GAAA,EAAW3B,EAAAA,MAAAA,CAAM,EACjB4B,GAAA,EAAW3B,EAAAA,QAAAA,KAAcC,EAAAA,EAAUmB,EAAUQ,CAAG,EAAG,CAACA,CAAG,CAAC,GAE9D,EAAAb,EAAA,UAAA,KACOI,EAcEjB,EAAAA,EAAoBiB,EAXV,GAAkB,CAC7BU,EAAQ,MAIG,SAAS,eAAeH,CACnC,CAAA,EAAQ,SAAS,SAAS,aAAa,IACzC,EAAoB,QAAU,IAEhCJ,EAAQ,EAAK,EACf,CACyC,EAbvC,OAcD,CAACH,EAAOO,CAAQ,CAAC,GAEpB,EAAAX,EAAA,UAAA,KAAgB,CACV,IAAWU,EAAoB,UAGnC,EAAoB,QAAU,IAE5BF,EAAc,SAAS,cAA2B,uBAAuB,GACzEA,EAAc,SAAS,cAA2B,SAAS,GAC7CC,EAAQ,QAAA,EAAU,M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AA,GAAYb,EACzD,IAAKD,EAAK,IACV,MAAOoB,EACP,aAAW,aACX,WAAW,mBACX,OAAQR,GAAgB,EAAAd,EAAA,IAAA,CAACR,EAAAA,cAAD,CAAA,SAAgBsB,CAA6B,CAAA,EAAI,IAAA,GAEzE,UAAA,EAAAd,EAAA,IAAA,CAACV,EAAAA,QAAD,CACE,UAAU,0BACV,MAAO8B,EACP,QAAU,GAAU,CAClB,IAAMG,EACJC,EAAM,kBAAkB,QACpBA,EAAM,OAAO,QAA2B,SAAS,EACjD,KAEAC,EACJD,EAAM,SAAW,GACjBA,EAAM,SACNA,EAAM,SACNA,EAAM,UACNA,EAAM,QACND,GAAM,SAAW,SACfA,GAAQ,CAACE,GACXnB,EAAQ,EAAK,CAEjB,EAEC,SAAAe,CACM,CAAA,CACH,CAAA,CACL,C,EAET,CAAC,E"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button as e } from "../Button/index.js";
|
|
2
|
-
import { t } from "../../chunks/
|
|
3
|
-
import {
|
|
2
|
+
import { t } from "../../chunks/Drawer-uhJvy3s9.js";
|
|
3
|
+
import { t as n } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
4
4
|
import { SideNav as r, SideNavFooter as i } from "../SideNav/index.js";
|
|
5
5
|
import { TopNav as a } from "../TopNav/index.js";
|
|
6
6
|
import { t as o } from "../../chunks/observeElementWidth-BlQOlW2t.js";
|
|
@@ -8,7 +8,7 @@ import { forwardRef as s, useEffect as c, useId as l, useMemo as u, useRef as d,
|
|
|
8
8
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
9
|
//#region src/components/AppShell/index.tsx
|
|
10
10
|
var g = s(function({ brand: s, navigation: g, actions: _, navigationLabel: v = "Main", scrollMode: y = "container", contentPadding: b = "default", className: x, children: S, ...C }, w) {
|
|
11
|
-
let [T, E] = f(null), [D, O] = f(!1), k = d(null), A = d(null), j = d(!1), M = l(), N = u(() =>
|
|
11
|
+
let [T, E] = f(null), [D, O] = f(!1), k = d(null), A = d(null), j = d(!1), M = l(), N = u(() => n(E, w), [w]);
|
|
12
12
|
c(() => T ? o(T, (e) => {
|
|
13
13
|
e < 768 || (document.getElementById(M)?.contains(document.activeElement) && (j.current = !0), O(!1));
|
|
14
14
|
}) : void 0, [T, M]), c(() => {
|
|
@@ -57,7 +57,7 @@ var g = s(function({ brand: s, navigation: g, actions: _, navigationLabel: v = "
|
|
|
57
57
|
children: S
|
|
58
58
|
})]
|
|
59
59
|
})]
|
|
60
|
-
}), /* @__PURE__ */ m(
|
|
60
|
+
}), /* @__PURE__ */ m(t, {
|
|
61
61
|
id: M,
|
|
62
62
|
isOpen: D,
|
|
63
63
|
onClose: () => O(!1),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","observeElementWidth","Fragment$1","AppShell","forwardRef","rest","shell","setShell","useState","isOpen","setOpen","desktopNavRef","useRef","mainRef","restoreDesktopFocus","drawerId","useId","shellRef","useMemo","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","mergeRefs","observeElementWidth","Fragment$1","AppShell","forwardRef","rest","shell","setShell","useState","isOpen","setOpen","desktopNavRef","useRef","mainRef","restoreDesktopFocus","drawerId","useId","shellRef","useMemo","ref","useEffect","width","drawerActions","actions","scrollMode","contentPadding","className","node","TopNav","Button","SideNav","navigationLabel","navigation","Drawer","brand","SideNavFooter","link","event","opensElsewhere"],"sources":["../../../src/components/AppShell/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Drawer } from \"../Drawer\";\nimport { Button } from \"../Button\";\nimport { SideNav, SideNavFooter } from \"../SideNav\";\nimport { TopNav } from \"../TopNav\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport \"./style.css\";\n\nexport interface AppShellProps extends HTMLAttributes<HTMLDivElement> {\n /** Product brand, shared by the top bar and mobile drawer header. */\n brand: ReactNode;\n /** SideNavSection/SideNavItem content. The application owns routing and selection. */\n navigation: ReactNode;\n /** One slot with a compact top-bar and expanded drawer presentation. */\n actions?: (location: \"topnav\" | \"drawer\") => ReactNode;\n navigationLabel?: string;\n /** The default scrolls the main region; document mode follows the window. */\n scrollMode?: \"container\" | \"document\";\n /** Let full-width page layouts own their spacing. */\n contentPadding?: \"default\" | \"none\";\n /** Rendered inside the shell's main landmark. */\n children?: ReactNode;\n}\n\n/** Full-width product bar above a desktop rail, or a mobile navigation drawer. */\nexport const AppShell = forwardRef<HTMLDivElement, AppShellProps>(function AppShell(\n {\n brand,\n navigation,\n actions,\n navigationLabel = \"Main\",\n scrollMode = \"container\",\n contentPadding = \"default\",\n className,\n children,\n ...rest\n },\n ref,\n) {\n const [shell, setShell] = useState<HTMLDivElement | null>(null);\n const [isOpen, setOpen] = useState(false);\n const desktopNavRef = useRef<HTMLElement | null>(null);\n const mainRef = useRef<HTMLElement | null>(null);\n const restoreDesktopFocus = useRef(false);\n const drawerId = useId();\n const shellRef = useMemo(() => mergeRefs(setShell, ref), [ref]);\n\n useEffect(() => {\n if (!shell) {\n return;\n }\n const measure = (width: number) => {\n if (width < 768) {\n return;\n }\n // Document mode portals the drawer to the body, outside the shell.\n const drawer = document.getElementById(drawerId);\n if (drawer?.contains(document.activeElement)) {\n restoreDesktopFocus.current = true;\n }\n setOpen(false);\n };\n return observeElementWidth(shell, measure);\n }, [shell, drawerId]);\n\n useEffect(() => {\n if (isOpen || !restoreDesktopFocus.current) {\n return;\n }\n restoreDesktopFocus.current = false;\n const destination =\n desktopNavRef.current?.querySelector<HTMLElement>(\"[aria-current='page']\") ??\n desktopNavRef.current?.querySelector<HTMLElement>(\"a[href]\");\n (destination ?? mainRef.current)?.focus();\n }, [isOpen]);\n\n const drawerActions = actions?.(\"drawer\");\n\n return (\n <div\n {...rest}\n ref={shellRef}\n data-scroll-mode={scrollMode}\n data-content-padding={contentPadding}\n className={[\"ds-appshell\", className].filter(Boolean).join(\" \")}\n >\n <div\n className=\"ds-appshell__frame\"\n aria-hidden={isOpen || undefined}\n ref={(node) => {\n if (node) {\n node.inert = isOpen;\n }\n }}\n >\n <TopNav\n brand={brand}\n actions={\n <>\n <div className=\"ds-appshell__actions\">{actions?.(\"topnav\")}</div>\n <Button\n variant=\"simple\"\n size=\"lg\"\n isIconOnly\n iconStart=\"menu\"\n className=\"ds-appshell__toggle\"\n aria-label=\"Open navigation\"\n aria-expanded={isOpen}\n aria-controls={drawerId}\n onClick={() => setOpen(true)}\n />\n </>\n }\n />\n <div className=\"ds-appshell__body\">\n <SideNav\n ref={desktopNavRef}\n className=\"ds-appshell__desktop-nav\"\n label={navigationLabel}\n >\n {navigation}\n </SideNav>\n <main\n ref={mainRef}\n className=\"ds-appshell__main\"\n tabIndex={-1}\n >\n {children}\n </main>\n </div>\n </div>\n <Drawer\n id={drawerId}\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n variant=\"navigation\"\n side=\"end\"\n portalContainer={scrollMode === \"document\" ? undefined : shell}\n dir={rest.dir}\n title={brand}\n aria-label=\"Navigation\"\n closeLabel=\"Close navigation\"\n footer={drawerActions ? <SideNavFooter>{drawerActions}</SideNavFooter> : undefined}\n >\n <SideNav\n className=\"ds-appshell__mobile-nav\"\n label={navigationLabel}\n onClick={(event) => {\n const link =\n event.target instanceof Element\n ? event.target.closest<HTMLAnchorElement>(\"a[href]\")\n : null;\n // Opening a link elsewhere (modifier keys, another button, a new tab) leaves this page in place.\n const opensElsewhere =\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n link?.target === \"_blank\";\n if (link && !opensElsewhere) {\n setOpen(false);\n }\n }}\n >\n {navigation}\n </SideNav>\n </Drawer>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAmCA,IAAaI,IAAWC,EAA0C,SAChE,EACE,UACA,eACA,YACA,qBAAkB,QAClB,gBA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,YAAA;KACA,WAAU;KACV,WAAU;KACV,cAAW;KACX,iBAAepB;KACf,iBAAeM;KACf,eAAeL,EAAQ,EAAI;IAC5B,CAAA,CACD,EAAA,CAAA;GAEL,CAAA,GACD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,kBAACoB,GAAD;KACE,KAAKnB;KACL,WAAU;KACV,OAAOoB;KAEN,UAAAC;IACM,CAAA,GACT,kBAAC,QAAD;KACE,KAAKnB;KACL,WAAU;KACV,UAAU;KAET;IACG,CAAA,CACH;GACF,CAAA,CAAA;EACL,CAAA,GAAA,kBAACoB,GAAD;GACE,IAAIlB;GACI;GACR,eAAeL,EAAQ,EAAK;GAC5B,SAAQ;GACR,MAAK;GACL,iBAAiBc,MAAe,aAAa,KAAA,IAAYlB;GACzD,KAAKD,EAAK;GACV,OAAO6B;GACP,cAAW;GACX,YAAW;GACX,QAAQZ,IAAgB,kBAACa,GAAD,EAAA,UAAgBb,EAA6B,CAAA,IAAI,KAAA;GAEzE,UAAA,kBAACQ,GAAD;IACE,WAAU;IACV,OAAOC;IACP,UAAU,MAAU;KAClB,IAAMK,IACJC,EAAM,kBAAkB,UACpBA,EAAM,OAAO,QAA2B,SAAS,IACjD,MAEAC,IACJD,EAAM,WAAW,KACjBA,EAAM,WACNA,EAAM,WACNA,EAAM,YACNA,EAAM,UACND,GAAM,WAAW;KACnB,AAAIA,KAAQ,CAACE,KACX5B,EAAQ,EAAK;IAEjB;IAEC,UAAAsB;GACM,CAAA;EACH,CAAA,CACL;;AAET,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Avatar-Cvj_DqG0.cjs");exports.Avatar=e.t,exports.AvatarGroup=e.n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-
|
|
1
|
+
export { t as Avatar, n as AvatarGroup } from "../../chunks/Avatar-6t78C9Np.js";
|