@payloadcms/ui 4.0.0-internal.a7ca468 → 4.0.0-internal.af6aad0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/elements/AddNewRelation/index.css +0 -4
- package/dist/elements/AddNewRelation/index.js +2 -2
- package/dist/elements/AddNewRelation/index.js.map +1 -1
- package/dist/elements/AppHeader/index.css +5 -0
- package/dist/elements/AppHeader/index.d.ts +1 -8
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +4 -13
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ArrayAction/index.d.ts +1 -0
- package/dist/elements/ArrayAction/index.d.ts.map +1 -1
- package/dist/elements/ArrayAction/index.js +45 -32
- package/dist/elements/ArrayAction/index.js.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.css +10 -4
- package/dist/elements/BulkUpload/AddFilesView/index.d.ts.map +1 -1
- package/dist/elements/BulkUpload/AddFilesView/index.js +71 -51
- package/dist/elements/BulkUpload/AddFilesView/index.js.map +1 -1
- package/dist/elements/Button/index.css +25 -2
- package/dist/elements/Button/index.d.ts.map +1 -1
- package/dist/elements/Button/index.js +2 -0
- package/dist/elements/Button/index.js.map +1 -1
- package/dist/elements/Button/types.d.ts +1 -1
- package/dist/elements/Button/types.d.ts.map +1 -1
- package/dist/elements/Button/types.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts +10 -0
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.d.ts.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js +65 -3
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.js.map +1 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js +345 -1
- package/dist/elements/ClipboardAction/mergeFormStateFromClipboard.spec.js.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.css +1 -0
- package/dist/elements/DefaultListViewTabs/index.d.ts.map +1 -1
- package/dist/elements/DefaultListViewTabs/index.js +84 -62
- package/dist/elements/DefaultListViewTabs/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts +1 -1
- package/dist/elements/DocumentDrawer/types.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/types.js.map +1 -1
- package/dist/elements/Drawer/index.css +10 -4
- package/dist/elements/Drawer/types.d.ts +2 -2
- package/dist/elements/Drawer/types.d.ts.map +1 -1
- package/dist/elements/Drawer/types.js.map +1 -1
- package/dist/elements/Dropzone/index.css +10 -4
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js +3 -2
- package/dist/elements/DuplicateDocument/SelectLocalesDrawer/index.js.map +1 -1
- package/dist/elements/FileManager/index.css +0 -30
- package/dist/elements/FileManager/index.d.ts.map +1 -1
- package/dist/elements/FileManager/index.js +379 -287
- package/dist/elements/FileManager/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.css +22 -4
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js +68 -49
- package/dist/elements/Hierarchy/ColumnBrowser/Column/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.css +100 -15
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js +97 -137
- package/dist/elements/Hierarchy/ColumnBrowser/ColumnItem/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/index.js +51 -23
- package/dist/elements/Hierarchy/ColumnBrowser/index.js.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts +26 -3
- package/dist/elements/Hierarchy/ColumnBrowser/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/ColumnBrowser/types.js.map +1 -1
- package/dist/elements/Hierarchy/CreateNewButton/index.css +9 -0
- package/dist/elements/Hierarchy/CreateNewButton/index.d.ts +9 -0
- package/dist/elements/Hierarchy/CreateNewButton/index.d.ts.map +1 -0
- package/dist/elements/Hierarchy/CreateNewButton/index.js +111 -0
- package/dist/elements/Hierarchy/CreateNewButton/index.js.map +1 -0
- package/dist/elements/Hierarchy/DocHeaderButton/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.js +6 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.js.map +1 -1
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.js +1 -3
- package/dist/elements/Hierarchy/DocHeaderButton/index.server.js.map +1 -1
- package/dist/elements/Hierarchy/Field/index.client.d.ts +5 -0
- package/dist/elements/Hierarchy/Field/index.client.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Field/index.client.js +120 -95
- package/dist/elements/Hierarchy/Field/index.client.js.map +1 -1
- package/dist/elements/Hierarchy/Field/index.css +3 -34
- package/dist/elements/Hierarchy/Modal/Footer/index.css +45 -0
- package/dist/elements/Hierarchy/Modal/Footer/index.d.ts +28 -0
- package/dist/elements/Hierarchy/Modal/Footer/index.d.ts.map +1 -0
- package/dist/elements/Hierarchy/Modal/Footer/index.js +166 -0
- package/dist/elements/Hierarchy/Modal/Footer/index.js.map +1 -0
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts +18 -4
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js +88 -24
- package/dist/elements/Hierarchy/Modal/fetchAncestorPath.js.map +1 -1
- package/dist/elements/Hierarchy/Modal/index.css +4 -53
- package/dist/elements/Hierarchy/Modal/index.d.ts +5 -2
- package/dist/elements/Hierarchy/Modal/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/index.js +136 -99
- package/dist/elements/Hierarchy/Modal/index.js.map +1 -1
- package/dist/elements/Hierarchy/Modal/types.d.ts +15 -0
- package/dist/elements/Hierarchy/Modal/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Modal/types.js.map +1 -1
- package/dist/elements/Hierarchy/MoveMany/index.d.ts +7 -3
- package/dist/elements/Hierarchy/MoveMany/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/MoveMany/index.js +43 -170
- package/dist/elements/Hierarchy/MoveMany/index.js.map +1 -1
- package/dist/elements/Hierarchy/Search/index.css +2 -9
- package/dist/elements/Hierarchy/Search/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/index.js +6 -73
- package/dist/elements/Hierarchy/Search/index.js.map +1 -1
- package/dist/elements/Hierarchy/Search/types.d.ts +2 -6
- package/dist/elements/Hierarchy/Search/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Search/types.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts +0 -4
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js +101 -186
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js +1 -21
- package/dist/elements/Hierarchy/Tree/HierarchySidebarTab.server.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/LoadMore/index.css +3 -3
- package/dist/elements/Hierarchy/Tree/TreeNode/index.css +59 -29
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js +54 -10
- package/dist/elements/Hierarchy/Tree/TreeNode/index.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.css +8 -9
- package/dist/elements/Hierarchy/Tree/index.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/index.js +29 -47
- package/dist/elements/Hierarchy/Tree/index.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/types.d.ts +9 -1
- package/dist/elements/Hierarchy/Tree/types.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/types.js.map +1 -1
- package/dist/elements/Hierarchy/Tree/useChildren.d.ts.map +1 -1
- package/dist/elements/Hierarchy/Tree/useChildren.js +11 -1
- package/dist/elements/Hierarchy/Tree/useChildren.js.map +1 -1
- package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts +22 -0
- package/dist/elements/Hierarchy/getFolderHierarchySlug.d.ts.map +1 -0
- package/dist/elements/Hierarchy/getFolderHierarchySlug.js +17 -0
- package/dist/elements/Hierarchy/getFolderHierarchySlug.js.map +1 -0
- package/dist/elements/Hierarchy/move/moveDocuments.d.ts +34 -0
- package/dist/elements/Hierarchy/move/moveDocuments.d.ts.map +1 -0
- package/dist/elements/Hierarchy/move/moveDocuments.js +94 -0
- package/dist/elements/Hierarchy/move/moveDocuments.js.map +1 -0
- package/dist/elements/IDLabel/index.css +6 -0
- package/dist/elements/IDLabel/index.d.ts +1 -1
- package/dist/elements/IDLabel/index.d.ts.map +1 -1
- package/dist/elements/IDLabel/index.js +16 -21
- package/dist/elements/IDLabel/index.js.map +1 -1
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +3 -2
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListControls/types.d.ts +4 -0
- package/dist/elements/ListControls/types.d.ts.map +1 -1
- package/dist/elements/ListControls/types.js.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts +1 -7
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.d.ts.map +1 -1
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js +26 -32
- package/dist/elements/ListHeader/TitleActions/ListBulkUploadButton.js.map +1 -1
- package/dist/elements/Nav/NavSidebarToggle/index.js +1 -1
- package/dist/elements/Nav/NavSidebarToggle/index.js.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.d.ts +1 -0
- package/dist/elements/Nav/NavWrapper/index.d.ts.map +1 -1
- package/dist/elements/Nav/NavWrapper/index.js +12 -18
- package/dist/elements/Nav/NavWrapper/index.js.map +1 -1
- package/dist/elements/Nav/SidebarTabs/index.css +1 -2
- package/dist/elements/Nav/context.d.ts +0 -1
- package/dist/elements/Nav/context.d.ts.map +1 -1
- package/dist/elements/Nav/context.js +92 -67
- package/dist/elements/Nav/context.js.map +1 -1
- package/dist/elements/Nav/index.css +47 -42
- package/dist/elements/Nav/index.d.ts +4 -0
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +16 -1
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/elements/NavGroup/index.css +29 -15
- package/dist/elements/Popup/PopupButtonList/index.css +33 -17
- package/dist/elements/Popup/index.css +6 -0
- package/dist/elements/Popup/index.d.ts +10 -0
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +13 -6
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js +1 -1
- package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
- package/dist/elements/QueryPresets/QueryPresetBar/index.js +1 -3
- package/dist/elements/QueryPresets/QueryPresetBar/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +5 -0
- package/dist/elements/ReactSelect/types.d.ts.map +1 -1
- package/dist/elements/ReactSelect/types.js.map +1 -1
- package/dist/elements/RelationshipTable/index.d.ts.map +1 -1
- package/dist/elements/RelationshipTable/index.js +5 -2
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/SegmentedControl/index.css +58 -0
- package/dist/elements/SegmentedControl/index.d.ts +19 -0
- package/dist/elements/SegmentedControl/index.d.ts.map +1 -0
- package/dist/elements/SegmentedControl/index.js +104 -0
- package/dist/elements/SegmentedControl/index.js.map +1 -0
- package/dist/elements/SelectAll/index.d.ts.map +1 -1
- package/dist/elements/SelectAll/index.js +1 -2
- package/dist/elements/SelectAll/index.js.map +1 -1
- package/dist/elements/SelectRow/index.d.ts.map +1 -1
- package/dist/elements/SelectRow/index.js +1 -2
- package/dist/elements/SelectRow/index.js.map +1 -1
- package/dist/elements/SidebarRow/index.css +1 -5
- package/dist/elements/SidebarToggle/index.css +3 -1
- package/dist/elements/SortHeader/index.d.ts.map +1 -1
- package/dist/elements/SortHeader/index.js +29 -26
- package/dist/elements/SortHeader/index.js.map +1 -1
- package/dist/elements/StepNav/DropTarget/index.css +20 -0
- package/dist/elements/StepNav/DropTarget/index.d.ts +16 -0
- package/dist/elements/StepNav/DropTarget/index.d.ts.map +1 -0
- package/dist/elements/StepNav/DropTarget/index.js +71 -0
- package/dist/elements/StepNav/DropTarget/index.js.map +1 -0
- package/dist/elements/StepNav/index.css +64 -14
- package/dist/elements/StepNav/index.d.ts.map +1 -1
- package/dist/elements/StepNav/index.js +147 -69
- package/dist/elements/StepNav/index.js.map +1 -1
- package/dist/elements/StepNav/types.d.ts +6 -0
- package/dist/elements/StepNav/types.d.ts.map +1 -1
- package/dist/elements/StepNav/types.js.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.css +5 -7
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js +14 -3
- package/dist/elements/Table/DefaultCell/fields/Hierarchy/index.js.map +1 -1
- package/dist/elements/Table/DefaultCell/index.d.ts.map +1 -1
- package/dist/elements/Table/DefaultCell/index.js +3 -11
- package/dist/elements/Table/DefaultCell/index.js.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.d.ts.map +1 -1
- package/dist/elements/Upload/UploadFromURLModal/index.js.map +1 -1
- package/dist/elements/Upload/index.css +39 -32
- package/dist/elements/Upload/index.d.ts.map +1 -1
- package/dist/elements/Upload/index.js +37 -99
- package/dist/elements/Upload/index.js.map +1 -1
- package/dist/elements/Upload/usePasteFromClipboard.d.ts +14 -0
- package/dist/elements/Upload/usePasteFromClipboard.d.ts.map +1 -0
- package/dist/elements/Upload/usePasteFromClipboard.js +93 -0
- package/dist/elements/Upload/usePasteFromClipboard.js.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts +20 -0
- package/dist/elements/Upload/useUploadFromUrl.d.ts.map +1 -0
- package/dist/elements/Upload/useUploadFromUrl.js +201 -0
- package/dist/elements/Upload/useUploadFromUrl.js.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.css +31 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts +17 -0
- package/dist/elements/UploadDropzoneContent/index.d.ts.map +1 -0
- package/dist/elements/UploadDropzoneContent/index.js +62 -0
- package/dist/elements/UploadDropzoneContent/index.js.map +1 -0
- package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts +18 -0
- package/dist/elements/UserMenu/HoverSubmenuGroup.d.ts.map +1 -0
- package/dist/elements/UserMenu/HoverSubmenuGroup.js +38 -0
- package/dist/elements/UserMenu/HoverSubmenuGroup.js.map +1 -0
- package/dist/elements/UserMenu/LanguageMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js +83 -39
- package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.js +57 -21
- package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js +83 -39
- package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/index.css +32 -2
- package/dist/elements/UserMenu/index.d.ts +1 -0
- package/dist/elements/UserMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/index.js +77 -51
- package/dist/elements/UserMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/useHoverSubmenu.d.ts +21 -0
- package/dist/elements/UserMenu/useHoverSubmenu.d.ts.map +1 -0
- package/dist/elements/UserMenu/useHoverSubmenu.js +260 -0
- package/dist/elements/UserMenu/useHoverSubmenu.js.map +1 -0
- package/dist/elements/ViewModeToggle/index.d.ts +8 -0
- package/dist/elements/ViewModeToggle/index.d.ts.map +1 -0
- package/dist/elements/ViewModeToggle/index.js +29 -0
- package/dist/elements/ViewModeToggle/index.js.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts +32 -0
- package/dist/elements/WhereBuilder/conditionValue.d.ts.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.js +32 -0
- package/dist/elements/WhereBuilder/conditionValue.js.map +1 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js +65 -0
- package/dist/elements/WhereBuilder/conditionValue.spec.js.map +1 -0
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +15 -4
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/exports/client/index.d.ts +6 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +1 -1
- package/dist/exports/client/index.js.map +3 -3
- package/dist/fields/Array/ArrayRow.d.ts +1 -0
- package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
- package/dist/fields/Array/ArrayRow.js +2 -0
- package/dist/fields/Array/ArrayRow.js.map +1 -1
- package/dist/fields/Array/index.d.ts.map +1 -1
- package/dist/fields/Array/index.js +38 -10
- package/dist/fields/Array/index.js.map +1 -1
- package/dist/fields/Blocks/BlockRow.d.ts +1 -0
- package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
- package/dist/fields/Blocks/BlockRow.js +2 -0
- package/dist/fields/Blocks/BlockRow.js.map +1 -1
- package/dist/fields/Blocks/RowActions.d.ts +1 -0
- package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
- package/dist/fields/Blocks/RowActions.js +22 -19
- package/dist/fields/Blocks/RowActions.js.map +1 -1
- package/dist/fields/Blocks/index.d.ts.map +1 -1
- package/dist/fields/Blocks/index.js +35 -7
- package/dist/fields/Blocks/index.js.map +1 -1
- package/dist/fields/Checkbox/Input.d.ts +2 -2
- package/dist/fields/Checkbox/Input.d.ts.map +1 -1
- package/dist/fields/Checkbox/Input.js +134 -152
- package/dist/fields/Checkbox/Input.js.map +1 -1
- package/dist/fields/Checkbox/index.css +168 -155
- package/dist/fields/Relationship/Input.d.ts.map +1 -1
- package/dist/fields/Relationship/Input.js +24 -6
- package/dist/fields/Relationship/Input.js.map +1 -1
- package/dist/fields/Relationship/optionsReducer.d.ts.map +1 -1
- package/dist/fields/Relationship/optionsReducer.js +2 -0
- package/dist/fields/Relationship/optionsReducer.js.map +1 -1
- package/dist/fields/Relationship/types.d.ts +24 -0
- package/dist/fields/Relationship/types.d.ts.map +1 -1
- package/dist/fields/Relationship/types.js.map +1 -1
- package/dist/fields/Upload/Input.d.ts.map +1 -1
- package/dist/fields/Upload/Input.js +44 -16
- package/dist/fields/Upload/Input.js.map +1 -1
- package/dist/fields/Upload/Input.spec.js +241 -0
- package/dist/fields/Upload/Input.spec.js.map +1 -0
- package/dist/forms/Form/index.d.ts.map +1 -1
- package/dist/forms/Form/index.js +4 -1
- package/dist/forms/Form/index.js.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.d.ts.map +1 -1
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js +1 -0
- package/dist/forms/fieldSchemasToFormState/addFieldStatePromise.js.map +1 -1
- package/dist/icons/CollapseLayers/index.css +5 -0
- package/dist/icons/CollapseLayers/index.d.ts +7 -0
- package/dist/icons/CollapseLayers/index.d.ts.map +1 -0
- package/dist/icons/CollapseLayers/index.js +23 -0
- package/dist/icons/CollapseLayers/index.js.map +1 -0
- package/dist/icons/Edit/index.d.ts +0 -1
- package/dist/icons/Edit/index.d.ts.map +1 -1
- package/dist/icons/Edit/index.js +4 -4
- package/dist/icons/Edit/index.js.map +1 -1
- package/dist/icons/Table/index.css +5 -0
- package/dist/icons/Table/index.d.ts +7 -0
- package/dist/icons/Table/index.d.ts.map +1 -0
- package/dist/icons/Table/index.js +25 -0
- package/dist/icons/Table/index.js.map +1 -0
- package/dist/providers/Actions/index.d.ts +1 -0
- package/dist/providers/Actions/index.d.ts.map +1 -1
- package/dist/providers/Actions/index.js +43 -11
- package/dist/providers/Actions/index.js.map +1 -1
- package/dist/providers/Auth/AuthSessionDebug/index.css +48 -0
- package/dist/providers/Auth/AuthSessionDebug/index.d.ts +13 -0
- package/dist/providers/Auth/AuthSessionDebug/index.d.ts.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/index.js +93 -0
- package/dist/providers/Auth/AuthSessionDebug/index.js.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts +21 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.d.ts.map +1 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.js +53 -0
- package/dist/providers/Auth/AuthSessionDebug/utilities.js.map +1 -0
- package/dist/providers/Auth/authSessionRequests.d.ts +27 -0
- package/dist/providers/Auth/authSessionRequests.d.ts.map +1 -0
- package/dist/providers/Auth/authSessionRequests.js +119 -0
- package/dist/providers/Auth/authSessionRequests.js.map +1 -0
- package/dist/providers/Auth/authSessionRequests.spec.js +121 -0
- package/dist/providers/Auth/authSessionRequests.spec.js.map +1 -0
- package/dist/providers/Auth/index.d.ts +2 -56
- package/dist/providers/Auth/index.d.ts.map +1 -1
- package/dist/providers/Auth/index.js +283 -135
- package/dist/providers/Auth/index.js.map +1 -1
- package/dist/providers/Auth/sessionActivity.d.ts +23 -0
- package/dist/providers/Auth/sessionActivity.d.ts.map +1 -0
- package/dist/providers/Auth/sessionActivity.js +49 -0
- package/dist/providers/Auth/sessionActivity.js.map +1 -0
- package/dist/providers/Auth/sessionActivity.spec.js +44 -0
- package/dist/providers/Auth/sessionActivity.spec.js.map +1 -0
- package/dist/providers/Auth/sessionTiming.d.ts +11 -0
- package/dist/providers/Auth/sessionTiming.d.ts.map +1 -0
- package/dist/providers/Auth/sessionTiming.js +18 -0
- package/dist/providers/Auth/sessionTiming.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/index.d.ts +17 -0
- package/dist/providers/Auth/tabSessionSync/index.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/index.js +263 -0
- package/dist/providers/Auth/tabSessionSync/index.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/index.spec.js +463 -0
- package/dist/providers/Auth/tabSessionSync/index.spec.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/types.d.ts +107 -0
- package/dist/providers/Auth/tabSessionSync/types.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/types.js +6 -0
- package/dist/providers/Auth/tabSessionSync/types.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts +11 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js +90 -0
- package/dist/providers/Auth/tabSessionSync/useTabSessionSync.js.map +1 -0
- package/dist/providers/Auth/tabSessionSync/utilities.d.ts +26 -0
- package/dist/providers/Auth/tabSessionSync/utilities.d.ts.map +1 -0
- package/dist/providers/Auth/tabSessionSync/utilities.js +159 -0
- package/dist/providers/Auth/tabSessionSync/utilities.js.map +1 -0
- package/dist/providers/Auth/types.d.ts +65 -0
- package/dist/providers/Auth/types.d.ts.map +1 -0
- package/dist/providers/Auth/types.js +2 -0
- package/dist/providers/Auth/types.js.map +1 -0
- package/dist/providers/Auth/useAuthSessionTimers.d.ts +26 -0
- package/dist/providers/Auth/useAuthSessionTimers.d.ts.map +1 -0
- package/dist/providers/Auth/useAuthSessionTimers.js +203 -0
- package/dist/providers/Auth/useAuthSessionTimers.js.map +1 -0
- package/dist/providers/Auth/useAuthSessionTimers.spec.js +311 -0
- package/dist/providers/Auth/useAuthSessionTimers.spec.js.map +1 -0
- package/dist/providers/FormErrorHandler/index.d.ts +5 -1
- package/dist/providers/FormErrorHandler/index.d.ts.map +1 -1
- package/dist/providers/FormErrorHandler/index.js.map +1 -1
- package/dist/providers/Hierarchy/index.d.ts.map +1 -1
- package/dist/providers/Hierarchy/index.js +53 -24
- package/dist/providers/Hierarchy/index.js.map +1 -1
- package/dist/providers/Hierarchy/types.d.ts +2 -0
- package/dist/providers/Hierarchy/types.d.ts.map +1 -1
- package/dist/providers/Hierarchy/types.js.map +1 -1
- package/dist/providers/HierarchyDnd/index.css +51 -0
- package/dist/providers/HierarchyDnd/index.d.ts +21 -0
- package/dist/providers/HierarchyDnd/index.d.ts.map +1 -0
- package/dist/providers/HierarchyDnd/index.js +163 -0
- package/dist/providers/HierarchyDnd/index.js.map +1 -0
- package/dist/providers/HierarchyDnd/types.d.ts +56 -0
- package/dist/providers/HierarchyDnd/types.d.ts.map +1 -0
- package/dist/providers/HierarchyDnd/types.js +21 -0
- package/dist/providers/HierarchyDnd/types.js.map +1 -0
- package/dist/providers/Locale/index.d.ts.map +1 -1
- package/dist/providers/Locale/index.js +41 -36
- package/dist/providers/Locale/index.js.map +1 -1
- package/dist/providers/Root/index.js +4 -4
- package/dist/providers/Root/index.js.map +1 -1
- package/dist/providers/RouteTransition/ProgressBar/index.js +4 -1
- package/dist/providers/RouteTransition/ProgressBar/index.js.map +1 -1
- package/dist/providers/RouteTransition/ProgressBar/index.spec.js +44 -0
- package/dist/providers/RouteTransition/ProgressBar/index.spec.js.map +1 -0
- package/dist/providers/RouteTransition/index.d.ts +2 -0
- package/dist/providers/RouteTransition/index.d.ts.map +1 -1
- package/dist/providers/RouteTransition/index.js +42 -14
- package/dist/providers/RouteTransition/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/templates/Default/Wrapper/index.css +2 -1
- package/dist/templates/Default/Wrapper/index.d.ts +2 -0
- package/dist/templates/Default/Wrapper/index.d.ts.map +1 -1
- package/dist/templates/Default/Wrapper/index.js +12 -6
- package/dist/templates/Default/Wrapper/index.js.map +1 -1
- package/dist/templates/Default/index.css +3 -1
- package/dist/templates/Default/index.d.ts +1 -0
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +19 -15
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/formatMetadata.d.ts.map +1 -1
- package/dist/utilities/formatMetadata.js +0 -5
- package/dist/utilities/formatMetadata.js.map +1 -1
- package/dist/utilities/getFilesFromClipboard.d.ts +10 -0
- package/dist/utilities/getFilesFromClipboard.d.ts.map +1 -0
- package/dist/utilities/getFilesFromClipboard.js +49 -0
- package/dist/utilities/getFilesFromClipboard.js.map +1 -0
- package/dist/utilities/slugify.d.ts.map +1 -1
- package/dist/utilities/slugify.js +1 -0
- package/dist/utilities/slugify.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js +3 -2
- package/dist/views/Dashboard/Default/ModularDashboard/DashboardStepNav.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js +7 -7
- package/dist/views/Dashboard/Default/ModularDashboard/WidgetEditControl.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.d.ts.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js +104 -66
- package/dist/views/Dashboard/Default/ModularDashboard/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/ModularDashboard/index.css +33 -140
- package/dist/views/Edit/SetDocumentTitle/index.d.ts.map +1 -1
- package/dist/views/Edit/SetDocumentTitle/index.js +4 -1
- package/dist/views/Edit/SetDocumentTitle/index.js.map +1 -1
- package/dist/views/Edit/index.d.ts.map +1 -1
- package/dist/views/Edit/index.js +3 -2
- package/dist/views/Edit/index.js.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.js +100 -105
- package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.css +216 -0
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts +20 -0
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js +182 -0
- package/dist/views/HierarchyList/HierarchyCards/DocumentCard/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.css +38 -0
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts +15 -0
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js +85 -0
- package/dist/views/HierarchyList/HierarchyCards/DragPreviewItem/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.css +98 -0
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts +27 -0
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js +84 -0
- package/dist/views/HierarchyList/HierarchyCards/FolderCard/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts +19 -0
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js +100 -0
- package/dist/views/HierarchyList/HierarchyCards/HierarchyCard/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts +53 -0
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js +145 -0
- package/dist/views/HierarchyList/HierarchyCards/PlaneItem/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts +8 -0
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js +21 -0
- package/dist/views/HierarchyList/HierarchyCards/getThumbnailSrc.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/index.css +115 -0
- package/dist/views/HierarchyList/HierarchyCards/index.d.ts +80 -0
- package/dist/views/HierarchyList/HierarchyCards/index.d.ts.map +1 -0
- package/dist/views/HierarchyList/HierarchyCards/index.js +457 -0
- package/dist/views/HierarchyList/HierarchyCards/index.js.map +1 -0
- package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts +6 -1
- package/dist/views/HierarchyList/HierarchyListHeader/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyListHeader/index.js +10 -8
- package/dist/views/HierarchyList/HierarchyListHeader/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js +11 -10
- package/dist/views/HierarchyList/HierarchyTable/ChildNameCell.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.js +3 -6
- package/dist/views/HierarchyList/HierarchyTable/SlotTable.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.css +51 -0
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts +13 -1
- package/dist/views/HierarchyList/HierarchyTable/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/index.js +156 -38
- package/dist/views/HierarchyList/HierarchyTable/index.js.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/types.d.ts +6 -0
- package/dist/views/HierarchyList/HierarchyTable/types.d.ts.map +1 -1
- package/dist/views/HierarchyList/HierarchyTable/types.js.map +1 -1
- package/dist/views/HierarchyList/index.d.ts.map +1 -1
- package/dist/views/HierarchyList/index.js +103 -20
- package/dist/views/HierarchyList/index.js.map +1 -1
- package/dist/views/List/ListHeader/index.d.ts +1 -10
- package/dist/views/List/ListHeader/index.d.ts.map +1 -1
- package/dist/views/List/ListHeader/index.js +1 -3
- package/dist/views/List/ListHeader/index.js.map +1 -1
- package/dist/views/List/ListSelection/index.d.ts.map +1 -1
- package/dist/views/List/ListSelection/index.js +138 -122
- package/dist/views/List/ListSelection/index.js.map +1 -1
- package/dist/views/List/handleHierarchy.d.ts +6 -1
- package/dist/views/List/handleHierarchy.d.ts.map +1 -1
- package/dist/views/List/handleHierarchy.js +34 -3
- package/dist/views/List/handleHierarchy.js.map +1 -1
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +128 -18
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/List/index.css +5 -0
- package/dist/views/List/index.d.ts.map +1 -1
- package/dist/views/List/index.js +27 -16
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomCollectionViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.d.ts.map +1 -1
- package/dist/views/Root/getCustomGlobalViewByRoute.js.map +1 -1
- package/dist/views/Root/getCustomViewByKey.d.ts.map +1 -1
- package/dist/views/Root/getCustomViewByKey.js.map +1 -1
- package/dist/views/Root/getRouteData.d.ts.map +1 -1
- package/dist/views/Root/getRouteData.js +8 -2
- package/dist/views/Root/getRouteData.js.map +1 -1
- package/dist/views/Root/index.d.ts.map +1 -1
- package/dist/views/Root/index.js +1 -0
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Version/generateVersionViewMetadata.js.map +1 -1
- package/dist/views/Versions/generateVersionsViewMetadata.js.map +1 -1
- package/package.json +4 -4
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.css +0 -36
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts +0 -13
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.d.ts.map +0 -1
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.js +0 -141
- package/dist/elements/Hierarchy/Field/SelectedHierarchies.js.map +0 -1
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
font-weight: var(--text-body-medium-font-weight);
|
|
52
52
|
letter-spacing: var(--text-body-medium-letter-spacing);
|
|
53
53
|
line-height: var(--text-body-medium-line-height);
|
|
54
|
-
padding: var(--spacer-1) var(--spacer-2)
|
|
54
|
+
padding: var(--spacer-1) var(--spacer-2);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
.popup-button-list__button:focus-visible {
|
|
@@ -93,10 +93,6 @@
|
|
|
93
93
|
flex-shrink: 0;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.popup-button-list__submenu-icon {
|
|
97
|
-
flex-shrink: 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
96
|
/* RadioGroup - selected items show only the checkmark, no background fill */
|
|
101
97
|
.popup-button-list--with-icons .popup-button-list__button--selected {
|
|
102
98
|
background-color: transparent;
|
|
@@ -148,27 +144,47 @@
|
|
|
148
144
|
padding: 0 0 0 var(--spacer-1);
|
|
149
145
|
}
|
|
150
146
|
|
|
151
|
-
/*
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
.popup-button-
|
|
157
|
-
|
|
158
|
-
align-items: center;
|
|
159
|
-
justify-content: center;
|
|
160
|
-
padding-inline-start: var(--spacer-1);
|
|
147
|
+
/*
|
|
148
|
+
* Submenu trigger buttons: rendered inside a PopupList.MenuItem wrapper so their
|
|
149
|
+
* icon/label spacing (via --with-actions --large) matches other menu items (e.g. Log Out)
|
|
150
|
+
* exactly. The label grows to push the chevron flush against the trigger's trailing edge.
|
|
151
|
+
*/
|
|
152
|
+
.popup-button-list__button--submenu-trigger .popup-button-list__label {
|
|
153
|
+
flex: 1;
|
|
161
154
|
}
|
|
162
155
|
|
|
163
156
|
.popup-button-list__chevron {
|
|
164
157
|
display: flex;
|
|
165
158
|
align-items: center;
|
|
166
|
-
margin-left: auto;
|
|
167
159
|
opacity: 0.5;
|
|
160
|
+
flex-shrink: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.popup-button-list__button--submenu-trigger:hover,
|
|
164
|
+
.popup-button-list__button--submenu-trigger[aria-expanded='true'] {
|
|
165
|
+
background-color: var(--color-bg-brand);
|
|
166
|
+
color: var(--color-text-onbrand);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/*
|
|
170
|
+
* The submenu content panel is portaled to document.body, so it isn't a DOM descendant of
|
|
171
|
+
* its trigger button - a plain descendant selector can't reach it. `:has()` lets us query
|
|
172
|
+
* from a shared ancestor (body) instead, reflecting real-time :hover state directly rather
|
|
173
|
+
* than an approximated JS-tracked one, so the trigger only highlights while an item inside
|
|
174
|
+
* its own submenu is actually being hovered.
|
|
175
|
+
*/
|
|
176
|
+
body:has(.popup-button-list__submenu-content-theme:hover)
|
|
177
|
+
.popup-button-list__button--submenu-trigger-theme,
|
|
178
|
+
body:has(.popup-button-list__submenu-content-language:hover)
|
|
179
|
+
.popup-button-list__button--submenu-trigger-language,
|
|
180
|
+
body:has(.popup-button-list__submenu-content-settings:hover)
|
|
181
|
+
.popup-button-list__button--submenu-trigger-settings {
|
|
182
|
+
background-color: var(--color-bg-secondary);
|
|
183
|
+
color: var(--color-text);
|
|
168
184
|
}
|
|
169
185
|
|
|
170
186
|
.popup-button-list__button--submenu-trigger:hover .popup-button-list__chevron,
|
|
171
|
-
.popup-button-list__button--
|
|
187
|
+
.popup-button-list__button--submenu-trigger[aria-expanded='true'] .popup-button-list__chevron {
|
|
172
188
|
opacity: 1;
|
|
173
189
|
}
|
|
174
190
|
}
|
|
@@ -60,6 +60,16 @@ export type PopupProps = {
|
|
|
60
60
|
onKeyDown: React.KeyboardEventHandler;
|
|
61
61
|
}) => React.ReactNode;
|
|
62
62
|
showOnHover?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Renders a full-viewport, click-capturing layer beneath the popup content while it is open.
|
|
65
|
+
* This blocks interaction with the rest of the page until the popup is dismissed, instead of
|
|
66
|
+
* allowing a click to both close the popup and activate whatever was underneath it.
|
|
67
|
+
*
|
|
68
|
+
* Has no effect on nested (child) popups — only the outermost popup in a stack renders it.
|
|
69
|
+
*
|
|
70
|
+
* @default false
|
|
71
|
+
*/
|
|
72
|
+
showScrim?: boolean;
|
|
63
73
|
/**
|
|
64
74
|
* By default, the scrollbar is hidden. If you want to show it, set this to true.
|
|
65
75
|
* In both cases, the container is still scrollable.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Popup/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAA;AAEvD,OAAO,KAAuE,MAAM,OAAO,CAAA;AAK3F,OAAO,aAAa,CAAA;AA4CpB,MAAM,MAAM,UAAU,GAAG;IACvB,eAAe,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAA;IAClD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAC1C,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACxB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IAC/B,UAAU,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IACjC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAA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AAM,CAAA;IACxB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAA;IACzD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE;QACrB,MAAM,EAAE,OAAO,CAAA;QACf,eAAe,EAAE,OAAO,CAAA;QACxB,eAAe,EAAE,IAAI,CAAA;QACrB,OAAO,EAAE,KAAK,CAAC,iBAAiB,CAAA;QAChC,SAAS,EAAE,KAAK,CAAC,oBAAoB,CAAA;KACtC,KAAK,KAAK,CAAC,SAAS,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACvB,IAAI,CAAC,EAAE,aAAa,GAAG,OAAO,GAAG,OAAO,CAAA;IACxC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;IACjC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAA;CACjC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CA4ftC,CAAA"}
|
|
@@ -56,6 +56,7 @@ export const Popup = props => {
|
|
|
56
56
|
render,
|
|
57
57
|
renderButton,
|
|
58
58
|
showOnHover = false,
|
|
59
|
+
showScrim = false,
|
|
59
60
|
showScrollbar = false,
|
|
60
61
|
side,
|
|
61
62
|
size = 'fit-content',
|
|
@@ -113,9 +114,13 @@ export const Popup = props => {
|
|
|
113
114
|
const scrollY = useFixed ? 0 : window.scrollY;
|
|
114
115
|
const scrollX = useFixed ? 0 : window.scrollX;
|
|
115
116
|
// Gap between the popup and the trigger/viewport edges (in pixels)
|
|
116
|
-
const offset =
|
|
117
|
+
const offset = 8;
|
|
117
118
|
// Additional gap used in side mode so the child popup has breathing room from its parent
|
|
118
119
|
const sideOffset = 4;
|
|
120
|
+
// `.popup__scroll-container` has this much padding above its first item, so aligning the
|
|
121
|
+
// popup's top edge with the trigger's top edge would leave the first item sitting this many
|
|
122
|
+
// pixels lower than the trigger row. Subtract it so the content - not the container - aligns.
|
|
123
|
+
const contentTopInset = 8;
|
|
119
124
|
let top;
|
|
120
125
|
let left;
|
|
121
126
|
let caretLeft;
|
|
@@ -126,8 +131,8 @@ export const Popup = props => {
|
|
|
126
131
|
// top-aligned with the trigger. Flips to the opposite side if there is not enough
|
|
127
132
|
// viewport space.
|
|
128
133
|
// /////////////////////////////////////
|
|
129
|
-
// Top: align with trigger top, clamped to viewport
|
|
130
|
-
top = triggerRect.top + scrollY;
|
|
134
|
+
// Top: align the popup's first item with the trigger top, clamped to viewport
|
|
135
|
+
top = triggerRect.top + scrollY - contentTopInset;
|
|
131
136
|
const maxTop = scrollY + window.innerHeight - popupRect.height - offset;
|
|
132
137
|
top = Math.max(scrollY + offset, Math.min(top, maxTop));
|
|
133
138
|
// Use the parent popup's bounding rect as the reference for left/right positioning
|
|
@@ -413,11 +418,13 @@ export const Popup = props => {
|
|
|
413
418
|
// Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since
|
|
414
419
|
// that closes the popup due to the click outside handler.
|
|
415
420
|
/*#__PURE__*/
|
|
416
|
-
createPortal(/*#__PURE__*/
|
|
421
|
+
createPortal(/*#__PURE__*/_jsxs(PopupContext, {
|
|
417
422
|
value: {
|
|
418
423
|
popupRef
|
|
419
424
|
},
|
|
420
|
-
children: /*#__PURE__*/
|
|
425
|
+
children: [active && showScrim && !parentPopup && /*#__PURE__*/_jsx("div", {
|
|
426
|
+
className: `${baseClass}__scrim`
|
|
427
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
421
428
|
className: active ? [`${baseClass}__content`, `${baseClass}--size-${size}`, side ? `${baseClass}--side-${side}` : isOnTop ? `${baseClass}--v-top` : `${baseClass}--v-bottom`, portalClassName].filter(Boolean).join(' ') :
|
|
422
429
|
// tests do not accidentally target inactive popups.
|
|
423
430
|
`${baseClass}__hidden-content`,
|
|
@@ -439,7 +446,7 @@ export const Popup = props => {
|
|
|
439
446
|
}), caret && !side && /*#__PURE__*/_jsx("div", {
|
|
440
447
|
className: `${baseClass}__caret`
|
|
441
448
|
})]
|
|
442
|
-
})
|
|
449
|
+
})]
|
|
443
450
|
}), document.body) : null]
|
|
444
451
|
});
|
|
445
452
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["PopupList","React","createContext","use","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","ThemeProvider","PopupTrigger","baseClass","PopupContext","TABBABLE_SELECTOR","map","s","join","hasFixedAncestor","element","node","parentElement","document","body","window","getComputedStyle","position","Popup","props","id","button","buttonAriaLabel","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","isFixedRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","useFixed","scrollY","scrollX","offset","sideOffset","top","left","caretLeft","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","newPosition","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","value","_Fragment","close"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport { ThemeProvider } from '../../providers/Theme/index.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\ntype PopupContextValue = {\n popupRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst PopupContext = createContext<null | PopupContextValue>(null)\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\n/**\n * Returns whether the element has a `position: fixed` ancestor (e.g. an open Drawer).\n * Such popups must be positioned with `fixed` so they don't drift when the background scrolls.\n */\nconst hasFixedAncestor = (element: HTMLElement | null): boolean => {\n let node = element?.parentElement\n while (node && node !== document.body) {\n if (window.getComputedStyle(node).position === 'fixed') {\n return true\n }\n node = node.parentElement\n }\n return false\n}\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * Accessible label for the trigger button.\n * Necessary when the button has an icon-only content,\n * so the button has an accessible name for screen readers.\n */\n buttonAriaLabel?: string\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n /**\n * Position the popup to the side of the trigger instead of above/below.\n * The popup's top edge aligns with the trigger's top edge (with viewport clamping).\n * Automatically flips to the opposite side if there is not enough space.\n * When set, `verticalAlign`, `horizontalAlign`, and the caret are ignored.\n */\n side?: 'left' | 'right'\n size?: 'fit-content' | 'large' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonAriaLabel,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrollbar = false,\n side,\n size = 'fit-content',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Whether the trigger is inside a `position: fixed` ancestor (e.g. a Drawer),\n * in which case the popup is positioned with `fixed` instead of `absolute`.\n */\n const isFixedRef = useRef(false)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const parentPopup = use(PopupContext)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Inside a fixed ancestor, use `fixed` (no scroll offset) so background scrolling\n // doesn't shift the popup. Otherwise use page coordinates (absolute).\n const useFixed = isFixedRef.current\n const scrollY = useFixed ? 0 : window.scrollY\n const scrollX = useFixed ? 0 : window.scrollX\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 10\n // Additional gap used in side mode so the child popup has breathing room from its parent\n const sideOffset = 4\n\n let top: number\n let left: number\n let caretLeft: number\n\n if (side) {\n // /////////////////////////////////////\n // Side Positioning\n // Places the popup to the left or right of the parent popup (not just the trigger),\n // top-aligned with the trigger. Flips to the opposite side if there is not enough\n // viewport space.\n // /////////////////////////////////////\n\n // Top: align with trigger top, clamped to viewport\n top = triggerRect.top + scrollY\n const maxTop = scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(scrollY + offset, Math.min(top, maxTop))\n\n // Use the parent popup's bounding rect as the reference for left/right positioning\n // so the child appears 4px from the parent popup edge, not just the trigger button.\n const anchorRect = parentPopup?.popupRef.current\n ? parentPopup.popupRef.current.getBoundingClientRect()\n : triggerRect\n\n if (side === 'left') {\n left = anchorRect.left - popupRect.width - sideOffset\n if (left < offset) {\n // flip to right side\n left = anchorRect.right + sideOffset\n }\n } else {\n left = anchorRect.right + sideOffset\n if (left + popupRect.width + offset > window.innerWidth) {\n // flip to left side\n left = anchorRect.left - popupRect.width - sideOffset\n }\n }\n\n left = left + scrollX\n // Caret not used in side mode; set a neutral value\n caretLeft = popupRect.width / 2\n\n setIsOnTop(false)\n } else {\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + scrollY - popupRect.height - offset\n if (topIfAbove >= scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n }\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n const newPosition = useFixed ? 'fixed' : ''\n\n if (popup.style.position !== newPosition) {\n popup.style.position = newPosition\n }\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n // Don't close if clicking a nested popup's trigger — it will manage its own open state\n if (actionable.closest(`.${baseClass}__trigger-wrap`)) {\n return\n }\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n const popup = popupRef.current\n if (popup) {\n // Clear inline position styles so the CSS `top: -9999px` rule on\n // `.popup__hidden-content` takes effect. Without this, the inline\n // styles set during positioning would win over the CSS rule, keeping\n // portaled children (e.g. a ReactSelect menu) visually on-screen.\n popup.style.position = ''\n popup.style.top = ''\n popup.style.left = ''\n }\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelection popup content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n // Decide the positioning strategy once per open.\n isFixedRef.current = hasFixedAncestor(triggerRef.current)\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonAriaLabel={buttonAriaLabel}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <PopupContext value={{ popupRef }}>\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n side\n ? `${baseClass}--side-${side}`\n : isOnTop\n ? `${baseClass}--v-top`\n : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {theme === 'auto' ? (\n <>\n {render?.({ close: () => setActive(false) })}\n {children}\n </>\n ) : (\n <ThemeProvider theme={theme}>\n {render?.({ close: () => setActive(false) })}\n {children}\n </ThemeProvider>\n )}\n </div>\n {caret && !side && <div className={`${baseClass}__caret`} />}\n </div>\n </PopupContext>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACpF,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAMlB,MAAMC,YAAA,gBAAeX,aAAA,CAAwC;AAE7D;;;AAGA,MAAMY,iBAAA,GAAoB,CACxB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AAK7F,QAAA;gCAELyF,IAAA,CAAC;UACC1G,SAAA,EAAW,GAAGzB,SAAA,qBAA8BqC,aAAA,GAAgB,IAAIrC,SAAA,oCAA6C,GAAG,IAAI;oBAEnHwC,KAAA,KAAU,sBACT4F,KAAA,CAAAS,SAAA;uBACG3G,MAAA,GAAS;cAAE4G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC7B,QAAA;4BAGH4G,KAAA,CAACtI,aAAA;YAAc0C,KAAA,EAAOA,KAAA;uBACnBN,MAAA,GAAS;cAAE4G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC7B,QAAA;;YAIND,KAAA,IAAS,CAACe,IAAA,iBAAQ6F,IAAA,CAAC;UAAI1G,SAAA,EAAW,GAAGzB,SAAA;;;QAG1CU,QAAA,CAASC,IAAI,IAEf;;AAGV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["PopupList","React","createContext","use","useCallback","useEffect","useRef","useState","createPortal","useEffectEvent","ThemeProvider","PopupTrigger","baseClass","PopupContext","TABBABLE_SELECTOR","map","s","join","hasFixedAncestor","element","node","parentElement","document","body","window","getComputedStyle","position","Popup","props","id","button","buttonAriaLabel","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrim","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","isFixedRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","useFixed","scrollY","scrollX","offset","sideOffset","contentTopInset","top","left","caretLeft","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","newPosition","style","getPropertyValue","setProperty","handleClickOutside","e","target","isOutsidePopup","contains","isOutsideTrigger","clickedPopupContent","closest","isInsideChildPopup","handleKeyDown","key","preventDefault","querySelector","focus","focusable","Array","from","querySelectorAll","length","currentIndex","findIndex","el","activeElement","goBackward","shiftKey","nextIndex","handleActionableClick","actionable","rafId","requestAnimationFrame","firstFocusable","addEventListener","capture","passive","cancelAnimationFrame","removeEventListener","undefined","Trigger","_jsx","_jsxs","filter","Boolean","ref","onMouseEnter","onMouseLeave","role","tabIndex","value","_Fragment","close"],"sources":["../../../src/elements/Popup/index.tsx"],"sourcesContent":["'use client'\nimport type { CSSProperties } from 'react'\n\nexport * as PopupList from './PopupButtonList/index.js'\n\nimport React, { createContext, use, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEffectEvent } from '../../hooks/useEffectEvent.js'\nimport { ThemeProvider } from '../../providers/Theme/index.js'\nimport './index.css'\nimport { PopupTrigger } from './PopupTrigger/index.js'\n\nconst baseClass = 'popup'\n\ntype PopupContextValue = {\n popupRef: React.RefObject<HTMLDivElement | null>\n}\n\nconst PopupContext = createContext<null | PopupContextValue>(null)\n\n/**\n * Selector for all elements the browser considers tabbable.\n */\nconst TABBABLE_SELECTOR = [\n 'a[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n '[tabindex]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n 'audio[controls]',\n 'video[controls]',\n 'summary',\n]\n .map((s) => `${s}:not([tabindex=\"-1\"])`)\n .join(', ')\n\n/**\n * Returns whether the element has a `position: fixed` ancestor (e.g. an open Drawer).\n * Such popups must be positioned with `fixed` so they don't drift when the background scrolls.\n */\nconst hasFixedAncestor = (element: HTMLElement | null): boolean => {\n let node = element?.parentElement\n while (node && node !== document.body) {\n if (window.getComputedStyle(node).position === 'fixed') {\n return true\n }\n node = node.parentElement\n }\n return false\n}\n\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\n /**\n * Accessible label for the trigger button.\n * Necessary when the button has an icon-only content,\n * so the button has an accessible name for screen readers.\n */\n buttonAriaLabel?: string\n /**\n * The class name to apply to the button that triggers the popup.\n */\n buttonClassName?: string\n buttonSize?: 'large' | 'medium'\n buttonType?: 'custom' | 'default'\n caret?: boolean\n children?: React.ReactNode\n /**\n * The class name to apply to the popup container containing the trigger.\n * This does not wrap the actual popup content, which is rendered in a portal.\n */\n className?: string\n disabled?: boolean\n /**\n * Force control the open state of the popup, regardless of the trigger.\n */\n forceOpen?: boolean\n /**\n * Preferred horizontal alignment of the popup, if there is enough space available.\n *\n * @default 'left'\n */\n horizontalAlign?: 'center' | 'left' | 'right'\n id?: string\n initActive?: boolean\n noBackground?: boolean\n onToggleClose?: () => void\n onToggleOpen?: (active: boolean) => void\n /**\n * Class name to apply to the portal container.\n */\n portalClassName?: string\n render?: (args: { close: () => void }) => React.ReactNode\n /**\n * Render prop for custom trigger button. Receives onClick/onKeyDown/aria props.\n * When provided, `button` and `buttonType` are ignored.\n */\n renderButton?: (props: {\n active: boolean\n 'aria-expanded': boolean\n 'aria-haspopup': true\n onClick: React.MouseEventHandler\n onKeyDown: React.KeyboardEventHandler\n }) => React.ReactNode\n showOnHover?: boolean\n /**\n * Renders a full-viewport, click-capturing layer beneath the popup content while it is open.\n * This blocks interaction with the rest of the page until the popup is dismissed, instead of\n * allowing a click to both close the popup and activate whatever was underneath it.\n *\n * Has no effect on nested (child) popups — only the outermost popup in a stack renders it.\n *\n * @default false\n */\n showScrim?: boolean\n /**\n * By default, the scrollbar is hidden. If you want to show it, set this to true.\n * In both cases, the container is still scrollable.\n *\n * @default false\n */\n showScrollbar?: boolean\n /**\n * Position the popup to the side of the trigger instead of above/below.\n * The popup's top edge aligns with the trigger's top edge (with viewport clamping).\n * Automatically flips to the opposite side if there is not enough space.\n * When set, `verticalAlign`, `horizontalAlign`, and the caret are ignored.\n */\n side?: 'left' | 'right'\n size?: 'fit-content' | 'large' | 'small'\n /**\n * Theme for the popup content. Defaults to 'dark'.\n * Set to 'auto' to inherit the current theme.\n *\n * @default 'dark'\n */\n theme?: 'auto' | 'dark' | 'light'\n /**\n * Preferred vertical alignment of the popup (position below or above the trigger),\n * if there is enough space available.\n *\n * If the popup is too close to the edge of the viewport, it will flip to the opposite side\n * regardless of the preferred vertical alignment.\n *\n * @default 'bottom'\n */\n verticalAlign?: 'bottom' | 'top'\n}\n\n/**\n * Component that renders a popup, as well as a button that triggers the popup.\n *\n * The popup is rendered in a portal, and is automatically positioned above / below the trigger,\n * depending on the verticalAlign prop and the space available.\n */\nexport const Popup: React.FC<PopupProps> = (props) => {\n const {\n id,\n button,\n buttonAriaLabel,\n buttonClassName,\n buttonSize,\n buttonType = 'default',\n caret = true,\n children,\n className,\n disabled,\n forceOpen,\n horizontalAlign = 'left',\n initActive = false,\n noBackground,\n onToggleClose,\n onToggleOpen,\n portalClassName,\n render,\n renderButton,\n showOnHover = false,\n showScrim = false,\n showScrollbar = false,\n side,\n size = 'fit-content',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n /**\n * Whether the trigger is inside a `position: fixed` ancestor (e.g. a Drawer),\n * in which case the popup is positioned with `fixed` instead of `absolute`.\n */\n const isFixedRef = useRef(false)\n\n /**\n * Keeps track of whether the popup was opened via keyboard.\n * This is used to determine whether to autofocus the first element in the popup.\n * If the popup was opened via mouse, we do not want to autofocus the first element.\n */\n const openedViaKeyboardRef = useRef(false)\n\n const parentPopup = use(PopupContext)\n\n const [mounted, setMounted] = useState(false)\n const [active, setActiveInternal] = useState(initActive)\n const [isOnTop, setIsOnTop] = useState(verticalAlign === 'top')\n\n // Track when component is mounted to avoid SSR/client hydration mismatch\n useEffect(() => {\n setMounted(true)\n }, [])\n\n const setActive = useCallback(\n (isActive: boolean, viaKeyboard = false) => {\n if (isActive) {\n openedViaKeyboardRef.current = viaKeyboard\n onToggleOpen?.(true)\n } else {\n onToggleClose?.()\n }\n setActiveInternal(isActive)\n },\n [onToggleClose, onToggleOpen],\n )\n\n // /////////////////////////////////////\n // Position Calculation\n //\n // Calculates and applies popup position relative to trigger.\n // Always checks viewport bounds (for flipping), but only updates\n // styles if the calculated position differs from current position.\n // /////////////////////////////////////\n\n const updatePosition = useEffectEvent(() => {\n const trigger = triggerRef.current\n const popup = popupRef.current\n if (!trigger || !popup) {\n return\n }\n\n const triggerRect = trigger.getBoundingClientRect()\n const popupRect = popup.getBoundingClientRect()\n\n // Inside a fixed ancestor, use `fixed` (no scroll offset) so background scrolling\n // doesn't shift the popup. Otherwise use page coordinates (absolute).\n const useFixed = isFixedRef.current\n const scrollY = useFixed ? 0 : window.scrollY\n const scrollX = useFixed ? 0 : window.scrollX\n\n // Gap between the popup and the trigger/viewport edges (in pixels)\n const offset = 8\n // Additional gap used in side mode so the child popup has breathing room from its parent\n const sideOffset = 4\n // `.popup__scroll-container` has this much padding above its first item, so aligning the\n // popup's top edge with the trigger's top edge would leave the first item sitting this many\n // pixels lower than the trigger row. Subtract it so the content - not the container - aligns.\n const contentTopInset = 8\n\n let top: number\n let left: number\n let caretLeft: number\n\n if (side) {\n // /////////////////////////////////////\n // Side Positioning\n // Places the popup to the left or right of the parent popup (not just the trigger),\n // top-aligned with the trigger. Flips to the opposite side if there is not enough\n // viewport space.\n // /////////////////////////////////////\n\n // Top: align the popup's first item with the trigger top, clamped to viewport\n top = triggerRect.top + scrollY - contentTopInset\n const maxTop = scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(scrollY + offset, Math.min(top, maxTop))\n\n // Use the parent popup's bounding rect as the reference for left/right positioning\n // so the child appears 4px from the parent popup edge, not just the trigger button.\n const anchorRect = parentPopup?.popupRef.current\n ? parentPopup.popupRef.current.getBoundingClientRect()\n : triggerRect\n\n if (side === 'left') {\n left = anchorRect.left - popupRect.width - sideOffset\n if (left < offset) {\n // flip to right side\n left = anchorRect.right + sideOffset\n }\n } else {\n left = anchorRect.right + sideOffset\n if (left + popupRect.width + offset > window.innerWidth) {\n // flip to left side\n left = anchorRect.left - popupRect.width - sideOffset\n }\n }\n\n left = left + scrollX\n // Caret not used in side mode; set a neutral value\n caretLeft = popupRect.width / 2\n\n setIsOnTop(false)\n } else {\n // /////////////////////////////////////\n // Vertical Positioning\n // Calculates the `top` position in absolute page coordinates.\n // Uses `verticalAlign` prop as the preferred direction, but flips\n // to the opposite side if there's not enough viewport space.\n // /////////////////////////////////////\n\n let onTop = verticalAlign === 'top'\n\n if (verticalAlign === 'bottom') {\n top = triggerRect.bottom + scrollY + offset\n\n if (triggerRect.bottom + popupRect.height + offset > window.innerHeight) {\n // Try to flip above — only do so if there's actually enough room\n const topIfAbove = triggerRect.top + scrollY - popupRect.height - offset\n if (topIfAbove >= scrollY) {\n top = topIfAbove\n onTop = true\n }\n // else: not enough room above either — keep below and let it overflow rather than going off-screen\n }\n } else {\n top = triggerRect.top + scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + scrollY + offset\n onTop = false\n }\n }\n\n setIsOnTop(onTop)\n\n // /////////////////////////////////////\n // Horizontal Positioning\n // Calculates the `left` position based on `horizontalAlign` prop:\n // - 'left': aligns popup's left edge with trigger's left edge\n // - 'right': aligns popup's right edge with trigger's right edge\n // - 'center': centers popup horizontally relative to trigger\n // Then clamps to keep the popup within viewport bounds.\n // /////////////////////////////////////\n\n left =\n horizontalAlign === 'right'\n ? triggerRect.right - popupRect.width\n : horizontalAlign === 'center'\n ? triggerRect.left + triggerRect.width / 2 - popupRect.width / 2\n : triggerRect.left\n\n left = Math.max(offset, Math.min(left, window.innerWidth - popupRect.width - offset))\n\n // /////////////////////////////////////\n // Caret Positioning\n // Positions the caret arrow to point at the trigger's horizontal center.\n // Clamps between 12px from edges to prevent caret from overflowing the popup.\n // /////////////////////////////////////\n\n const triggerCenter = triggerRect.left + triggerRect.width / 2\n caretLeft = Math.max(12, Math.min(triggerCenter - left, popupRect.width - 12))\n }\n\n // /////////////////////////////////////\n // Apply Styles (only if changed)\n // Compares calculated position with current styles to avoid unnecessary\n // DOM updates during scroll. This prevents visual lag by relying on the absolute\n // positioning where possible (popup slightly lags behind when scrolling really fast),\n // while still allowing position changes when needed (e.g., sticky parent, viewport flip).\n // Values are rounded to match browser's CSS precision and avoid false updates.\n // /////////////////////////////////////\n\n const newTop = `${Math.round(top)}px`\n const newLeft = `${Math.round(left + scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\n const newPosition = useFixed ? 'fixed' : ''\n\n if (popup.style.position !== newPosition) {\n popup.style.position = newPosition\n }\n if (popup.style.top !== newTop) {\n popup.style.top = newTop\n }\n if (popup.style.left !== newLeft) {\n popup.style.left = newLeft\n }\n if (popup.style.getPropertyValue('--caret-left') !== newCaretLeft) {\n popup.style.setProperty('--caret-left', newCaretLeft)\n }\n })\n\n // /////////////////////////////////////\n // Click Outside Handler\n // Closes popup when clicking outside both the popup and trigger.\n // Distinguishes between parent and child popups:\n // - Click in child popup: parent stays open\n // - Click in parent popup: child closes\n // /////////////////////////////////////\n\n const handleClickOutside = useEffectEvent((e: MouseEvent) => {\n const target = e.target as Node\n const isOutsidePopup = !popupRef.current?.contains(target)\n const isOutsideTrigger = !triggerRef.current?.contains(target)\n\n // Check if click is inside a popup portal\n const clickedPopupContent = (target as Element).closest?.('.popup__content')\n\n // If the clicked popup contains this popup's trigger, it's a parent popup\n // and we should close. If it doesn't contain our trigger, it's a child popup\n // and we should stay open to avoid closing parent when interacting with child.\n const isInsideChildPopup =\n clickedPopupContent && !clickedPopupContent.contains(triggerRef.current)\n\n if (isOutsidePopup && isOutsideTrigger && !isInsideChildPopup) {\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Keyboard Navigation\n // Handles keyboard interactions when popup is open:\n // - Escape: closes popup and returns focus to trigger\n // - Tab/Shift+Tab: cycles through focusable items with wrapping\n // - ArrowUp/ArrowDown: same as Shift+Tab/Tab for menu-style navigation\n // Focus is managed manually to support elements the browser might skip.\n // /////////////////////////////////////\n\n const handleKeyDown = useEffectEvent((e: KeyboardEvent) => {\n const popup = popupRef.current\n if (!popup || !active) {\n return\n }\n\n if (e.key === 'Escape') {\n e.preventDefault()\n setActive(false)\n triggerRef.current?.querySelector<HTMLElement>('button, [tabindex=\"0\"]')?.focus()\n return\n }\n\n if (e.key === 'Tab' || e.key === 'ArrowDown' || e.key === 'ArrowUp') {\n const focusable = Array.from(popup.querySelectorAll<HTMLElement>(TABBABLE_SELECTOR))\n if (focusable.length === 0) {\n return\n }\n\n e.preventDefault()\n\n const currentIndex = focusable.findIndex((el) => el === document.activeElement)\n const goBackward = e.key === 'ArrowUp' || (e.key === 'Tab' && e.shiftKey)\n\n let nextIndex: number\n if (currentIndex === -1) {\n nextIndex = goBackward ? focusable.length - 1 : 0\n } else if (goBackward) {\n nextIndex = currentIndex === 0 ? focusable.length - 1 : currentIndex - 1\n } else {\n nextIndex = currentIndex === focusable.length - 1 ? 0 : currentIndex + 1\n }\n\n focusable[nextIndex].focus()\n }\n })\n\n // /////////////////////////////////////\n // Click Handler for Actionable Elements\n // Closes popup when buttons/links inside are clicked (includes Enter/Space activation).\n // /////////////////////////////////////\n\n const handleActionableClick = useEffectEvent((e: MouseEvent) => {\n const target = e.target as HTMLElement\n\n // Allow opting out with data-popup-prevent-close attribute on element or ancestor\n if (target.closest('[data-popup-prevent-close]')) {\n return\n }\n\n // Check if the clicked element or any ancestor is an actionable element\n const actionable = target.closest('button, a[href], [role=\"button\"], [role=\"menuitem\"]')\n if (actionable && popupRef.current?.contains(actionable)) {\n // Don't close if clicking a nested popup's trigger — it will manage its own open state\n if (actionable.closest(`.${baseClass}__trigger-wrap`)) {\n return\n }\n setActive(false)\n }\n })\n\n // /////////////////////////////////////\n // Effect: Setup/Teardown position and focus management\n // /////////////////////////////////////\n\n useEffect(() => {\n if (!active) {\n const popup = popupRef.current\n if (popup) {\n // Clear inline position styles so the CSS `top: -9999px` rule on\n // `.popup__hidden-content` takes effect. Without this, the inline\n // styles set during positioning would win over the CSS rule, keeping\n // portaled children (e.g. a ReactSelect menu) visually on-screen.\n popup.style.position = ''\n popup.style.top = ''\n popup.style.left = ''\n }\n return\n }\n\n const popup = popupRef.current\n if (!popup) {\n return\n }\n\n // /////////////////////////////////////\n // Initial Position\n // Calculate and apply popup position.\n // getBoundingClientRect() forces synchronous layout.\n //\n // We call updatePosition() twice: once synchronously (so the popup\n // snaps to roughly the right place immediately rather than flashing\n // from -9999px) and once in a requestAnimationFrame, which fires\n // after the browser has finished laying out the newly-visible popup\n // content. The rAF call is the authoritative one — it catches cases\n // where the popup height wasn't stable yet during the first call\n // (e.g. ColumnSelection popup content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\n\n // Decide the positioning strategy once per open.\n isFixedRef.current = hasFixedAncestor(triggerRef.current)\n\n updatePosition()\n const rafId = requestAnimationFrame(() => {\n updatePosition()\n })\n\n // /////////////////////////////////////\n // Focus Management\n // When opened via keyboard, autofocus the first focusable button.\n // When opened via mouse, skip autofocus to avoid unwanted highlights.\n // /////////////////////////////////////\n\n if (openedViaKeyboardRef.current) {\n // Use requestAnimationFrame to ensure DOM is ready.\n requestAnimationFrame(() => {\n const firstFocusable = popup.querySelector<HTMLElement>(TABBABLE_SELECTOR)\n firstFocusable?.focus()\n })\n }\n\n // /////////////////////////////////////\n // Event Listeners\n // - resize/scroll: recalculate position (only applies styles if changed)\n // - mousedown: detect clicks outside to close\n // - keydown: handle keyboard navigation\n // /////////////////////////////////////\n\n window.addEventListener('resize', updatePosition)\n window.addEventListener('scroll', updatePosition, { capture: true, passive: true })\n document.addEventListener('mousedown', handleClickOutside)\n document.addEventListener('keydown', handleKeyDown)\n popup.addEventListener('click', handleActionableClick)\n\n return () => {\n cancelAnimationFrame(rafId)\n window.removeEventListener('resize', updatePosition)\n window.removeEventListener('scroll', updatePosition, { capture: true })\n document.removeEventListener('mousedown', handleClickOutside)\n document.removeEventListener('keydown', handleKeyDown)\n popup.removeEventListener('click', handleActionableClick)\n }\n }, [active])\n\n useEffect(() => {\n if (forceOpen !== undefined) {\n setActive(forceOpen)\n }\n }, [forceOpen, setActive])\n\n const Trigger = (\n <PopupTrigger\n active={active}\n button={button}\n buttonAriaLabel={buttonAriaLabel}\n buttonType={buttonType}\n className={buttonClassName}\n disabled={disabled}\n noBackground={noBackground}\n renderButton={renderButton}\n setActive={setActive}\n size={buttonSize}\n />\n )\n\n return (\n <div className={[baseClass, className].filter(Boolean).join(' ')} id={id}>\n <div className={`${baseClass}__trigger-wrap`} ref={triggerRef}>\n {showOnHover ? (\n <div\n className={`${baseClass}__on-hover-watch`}\n onMouseEnter={() => setActive(true)}\n onMouseLeave={() => setActive(false)}\n role=\"button\"\n tabIndex={0}\n >\n {Trigger}\n </div>\n ) : (\n Trigger\n )}\n </div>\n\n {mounted\n ? // We need to make sure the popup is part of the DOM (although invisible), even if it's not active.\n // This ensures that components within the popup, like modals, do not unmount when the popup closes.\n // Otherwise, modals opened from the popup will close unexpectedly when clicking within the modal, since\n // that closes the popup due to the click outside handler.\n createPortal(\n <PopupContext value={{ popupRef }}>\n {active && showScrim && !parentPopup && <div className={`${baseClass}__scrim`} />}\n <div\n className={\n active\n ? [\n `${baseClass}__content`,\n `${baseClass}--size-${size}`,\n side\n ? `${baseClass}--side-${side}`\n : isOnTop\n ? `${baseClass}--v-top`\n : `${baseClass}--v-bottom`,\n portalClassName,\n ]\n .filter(Boolean)\n .join(' ')\n : // Do not share any class names between active and disabled popups, to make sure\n // tests do not accidentally target inactive popups.\n `${baseClass}__hidden-content`\n }\n data-popup-id={id || undefined}\n data-theme={theme === 'auto' ? undefined : theme}\n ref={popupRef}\n >\n <div\n className={`${baseClass}__scroll-container${showScrollbar ? ` ${baseClass}__scroll-container--show-scrollbar` : ''}`}\n >\n {theme === 'auto' ? (\n <>\n {render?.({ close: () => setActive(false) })}\n {children}\n </>\n ) : (\n <ThemeProvider theme={theme}>\n {render?.({ close: () => setActive(false) })}\n {children}\n </ThemeProvider>\n )}\n </div>\n {caret && !side && <div className={`${baseClass}__caret`} />}\n </div>\n </PopupContext>,\n document.body,\n )\n : null}\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM;AAE3B,OAAOC,KAAA,IAASC,aAAa,EAAEC,GAAG,EAAEC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AACpF,SAASC,YAAY,QAAQ;AAE7B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAC9B,OAAO;AACP,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY;AAMlB,MAAMC,YAAA,gBAAeX,aAAA,CAAwC;AAE7D;;;AAGA,MAAMY,iBAAA,GAAoB,CACxB,WACA,yBACA,6CACA,yBACA,2BACA,cACA,oDACA,mBACA,mBACA,UACD,CACEC,GAAG,CAAEC,CAAA,IAAM,GAAGA,CAAA,uBAAwB,EACtCC,IAAI,CAAC;AAER;;;;AAIA,MAAMC,gBAAA,GAAoBC,OAAA;EACxB,IAAIC,IAAA,GAAOD,OAAA,EAASE,aAAA;EACpB,OAAOD,IAAA,IAAQA,IAAA,KAASE,QAAA,CAASC,IAAI,EAAE;IACrC,IAAIC,MAAA,CAAOC,gBAAgB,CAACL,IAAA,EAAMM,QAAQ,KAAK,SAAS;MACtD,OAAO;IACT;IACAN,IAAA,GAAOA,IAAA,CAAKC,aAAa;EAC3B;EACA,OAAO;AACT;AAsGA;;;;;;AAMA,OAAO,MAAMM,KAAA,GAA+BC,KAAA;EAC1C,MAAM;IACJC,EAAE;IACFC,MAAM;IACNC,eAAe;IACfC,eAAe;IACfC,UAAU;IACVC,UAAA,GAAa,SAAS;IACtBC,KAAA,GAAQ,IAAI;IACZC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRC,SAAS;IACTC,eAAA,GAAkB,MAAM;IACxBC,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I,IAEf;;AAGV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TZDateMini","TZDate","getTranslation","endOfToday","isToday","startOfDay","transpose","formatAdminURL","qs","React","useCallback","useMemo","toast","FieldLabel","Radio","useConfig","useDocumentInfo","useDocumentTitle","useServerFunctions","useTranslation","requests","Banner","Button","DatePickerField","Drawer","Gutter","ReactSelect","ShimmerEffect","Table","TimezonePicker","buildUpcomingColumns","buildUpcomingScheduleWhere","baseClass","defaultLocaleOption","label","value","ScheduleDrawer","slug","defaultType","onUpcomingChange","schedulePublishConfig","config","admin","dateFormat","timezones","defaultTimezone","supportedTimezones","localization","routes","api","id","collectionSlug","globalSlug","title","i18n","t","schedulePublish","type","setType","useState","date","setDate","timezone","setTimezone","locale","setLocale","processing","setProcessing","modalTitle","upcoming","setUpcoming","upcomingColumns","setUpcomingColumns","deleteHandlerRef","useRef","userTimezone","Intl","DateTimeFormat","resolvedOptions","timeZone","localeOptions","options","locales","map","code","unshift","fetchUpcoming","query","sort","where","docs","post","apiRoute","path","body","stringify","headers","language","then","res","json","deleteHandler","current","length","deleteID","success","err","console","error","message","useEffect","handleSave","localeToPublish","doc","relationTo","String","undefined","global","displayedValue","DateWithOriginalTz","tz","DateWithUserTz","modifiedDate","withTimeZone","dateWithTimezone","dateWithUserTimezone","toISOString","onChangeDate","incomingDate","tzDateWithUTC","dateToUserTz","fetchInitialUpcoming","minTime","Date","_jsxs","className","_jsx","required","isSelected","onChange","option","readOnly","maxTime","minDate","e","pickerAppearance","timeFormat","timeIntervals","selectedTimezone","buttonStyle","disabled","onClick","appearance","columns","data"],"sources":["../../../../src/elements/PublishButton/ScheduleDrawer/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\n'use client'\n\nimport type { Column, SchedulePublish, Where } from 'payload'\n\nimport { TZDateMini as TZDate } from '@date-fns/tz/date/mini'\nimport { getTranslation } from '@payloadcms/translations'\nimport { endOfToday, isToday, startOfDay } from 'date-fns'\nimport { transpose } from 'date-fns/transpose'\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useMemo } from 'react'\nimport { toast } from 'sonner'\n\nimport type { PublishType, UpcomingEvent } from './types.js'\n\nimport { FieldLabel } from '../../../fields/FieldLabel/index.js'\nimport { Radio } from '../../../fields/RadioGroup/Radio/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useDocumentTitle } from '../../../providers/DocumentTitle/index.js'\nimport { useServerFunctions } from '../../../providers/ServerFunctions/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { requests } from '../../../utilities/api.js'\nimport { Banner } from '../../Banner/index.js'\nimport { Button } from '../../Button/index.js'\nimport { DatePickerField } from '../../DatePicker/index.js'\nimport { Drawer } from '../../Drawer/index.js'\nimport { Gutter } from '../../Gutter/index.js'\nimport './index.css'\nimport { ReactSelect } from '../../ReactSelect/index.js'\nimport { ShimmerEffect } from '../../ShimmerEffect/index.js'\nimport { Table } from '../../Table/index.js'\nimport { TimezonePicker } from '../../TimezonePicker/index.js'\nimport { buildUpcomingColumns } from './buildUpcomingColumns.js'\nimport { buildUpcomingScheduleWhere } from './buildUpcomingScheduleWhere.js'\n\nconst baseClass = 'schedule-publish'\n\ntype Props = {\n defaultType?: PublishType\n onUpcomingChange?: (hasUpcoming: boolean) => void\n schedulePublishConfig?: SchedulePublish\n slug: string\n}\n\nconst defaultLocaleOption = {\n label: 'All',\n value: 'all',\n}\n\nexport const ScheduleDrawer: React.FC<Props> = ({\n slug,\n defaultType,\n onUpcomingChange,\n schedulePublishConfig,\n}) => {\n const {\n config: {\n admin: {\n dateFormat,\n timezones: { defaultTimezone, supportedTimezones },\n },\n localization,\n routes: { api },\n },\n } = useConfig()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const { title } = useDocumentTitle()\n const { i18n, t } = useTranslation()\n const { schedulePublish } = useServerFunctions()\n const [type, setType] = React.useState<PublishType>(defaultType || 'publish')\n const [date, setDate] = React.useState<Date>()\n const [timezone, setTimezone] = React.useState<string>(defaultTimezone)\n const [locale, setLocale] = React.useState<{ label: string; value: string }>(defaultLocaleOption)\n const [processing, setProcessing] = React.useState(false)\n const modalTitle = t('general:schedulePublishFor', { title })\n const [upcoming, setUpcoming] = React.useState<UpcomingEvent[]>()\n const [upcomingColumns, setUpcomingColumns] = React.useState<Column[]>()\n const deleteHandlerRef = React.useRef<((id: number | string) => Promise<void>) | null>(() => null)\n\n // Get the user timezone so we can adjust the displayed value against it\n const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone\n\n const localeOptions = React.useMemo(() => {\n if (localization) {\n const options = localization.locales.map(({ code, label }) => ({\n label: getTranslation(label, i18n),\n value: code,\n }))\n\n options.unshift(defaultLocaleOption)\n\n return options\n }\n\n return []\n }, [localization, i18n])\n\n const fetchUpcoming = React.useCallback(async () => {\n const query: { sort: string; where: Where } = {\n sort: 'waitUntil',\n where: buildUpcomingScheduleWhere({ id, collectionSlug, globalSlug }),\n }\n\n const { docs } = await requests\n .post(formatAdminURL({ apiRoute: api, path: `/payload-jobs` }), {\n body: qs.stringify(query),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Payload-HTTP-Method-Override': 'GET',\n },\n })\n .then((res) => res.json())\n\n setUpcomingColumns(\n buildUpcomingColumns({\n dateFormat,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n deleteHandler: deleteHandlerRef.current,\n docs,\n i18n,\n localization,\n supportedTimezones,\n t,\n }),\n )\n setUpcoming(docs)\n onUpcomingChange?.(docs.length > 0)\n }, [\n collectionSlug,\n globalSlug,\n api,\n i18n,\n dateFormat,\n localization,\n supportedTimezones,\n t,\n id,\n onUpcomingChange,\n ])\n\n const deleteHandler = React.useCallback(\n async (id: number | string) => {\n try {\n await schedulePublish({\n deleteID: id,\n })\n await fetchUpcoming()\n toast.success(t('general:deletedSuccessfully'))\n } catch (err) {\n console.error(err)\n toast.error(err.message)\n }\n },\n [fetchUpcoming, schedulePublish, t],\n )\n\n React.useEffect(() => {\n deleteHandlerRef.current = deleteHandler\n }, [deleteHandler])\n\n const handleSave = React.useCallback(async () => {\n if (!date) {\n return toast.error(t('general:noDateSelected'))\n }\n\n setProcessing(true)\n\n let localeToPublish: string\n\n if (typeof locale === 'object' && locale.value !== 'all' && type === 'publish') {\n localeToPublish = locale.value\n }\n\n try {\n await schedulePublish({\n type,\n date,\n doc: collectionSlug\n ? {\n relationTo: collectionSlug,\n value: String(id),\n }\n : undefined,\n global: globalSlug || undefined,\n localeToPublish,\n timezone,\n })\n\n setDate(undefined)\n toast.success(t('version:scheduledSuccessfully'))\n void fetchUpcoming()\n } catch (err) {\n console.error(err)\n toast.error(err.message)\n }\n\n setProcessing(false)\n }, [\n date,\n locale,\n type,\n t,\n schedulePublish,\n collectionSlug,\n id,\n globalSlug,\n timezone,\n fetchUpcoming,\n ])\n\n const displayedValue = useMemo(() => {\n if (timezone && userTimezone && date) {\n // Create TZDate instances for the selected timezone and the user's timezone\n // These instances allow us to transpose the date between timezones while keeping the same time value\n const DateWithOriginalTz = TZDate.tz(timezone)\n const DateWithUserTz = TZDate.tz(userTimezone)\n\n const modifiedDate = new TZDate(date).withTimeZone(timezone)\n\n // Transpose the date to the selected timezone\n const dateWithTimezone = transpose(modifiedDate, DateWithOriginalTz)\n\n // Transpose the date to the user's timezone - this is necessary because the react-datepicker component insists on displaying the date in the user's timezone\n const dateWithUserTimezone = transpose(dateWithTimezone, DateWithUserTz)\n\n return dateWithUserTimezone.toISOString()\n }\n\n return date\n }, [timezone, date, userTimezone])\n\n const onChangeDate = useCallback(\n (incomingDate: Date) => {\n if (timezone && incomingDate) {\n // Create TZDate instances for the selected timezone\n const tzDateWithUTC = TZDate.tz(timezone)\n\n // Creates a TZDate instance for the user's timezone — this is default behaviour of TZDate as it wraps the Date constructor\n const dateToUserTz = new TZDate(incomingDate)\n\n // Transpose the date to the selected timezone\n const dateWithTimezone = transpose(dateToUserTz, tzDateWithUTC)\n\n setDate(dateWithTimezone || null)\n } else {\n setDate(incomingDate || null)\n }\n },\n [setDate, timezone],\n )\n\n React.useEffect(() => {\n if (!upcoming) {\n const fetchInitialUpcoming = async () => {\n await fetchUpcoming()\n }\n\n void fetchInitialUpcoming()\n }\n }, [upcoming, fetchUpcoming])\n\n const minTime = useMemo(() => {\n if (date && isToday(date)) {\n return new Date()\n }\n\n return startOfDay(new Date())\n }, [date])\n\n return (\n <Drawer className={baseClass} slug={slug} title={modalTitle}>\n <Gutter className={`${baseClass}__scheduler`}>\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('version:type')} required />\n <ul className={`${baseClass}__type`}>\n <li>\n <Radio\n id={`${slug}-type`}\n isSelected={type === 'publish'}\n onChange={() => setType('publish')}\n option={{ label: t('version:publish'), value: 'publish' }}\n path={`${slug}-type`}\n readOnly={processing}\n />\n </li>\n <li>\n <Radio\n id={`${slug}-type`}\n isSelected={type === 'unpublish'}\n onChange={() => setType('unpublish')}\n option={{ label: t('version:unpublish'), value: 'unpublish' }}\n path={`${slug}-type`}\n readOnly={processing}\n />\n </li>\n </ul>\n </div>\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('general:time')} path={'time'} required />\n <DatePickerField\n id=\"time\"\n maxTime={endOfToday()}\n minDate={new Date()}\n minTime={minTime}\n onChange={(e) => onChangeDate(e)}\n pickerAppearance=\"dayAndTime\"\n readOnly={processing}\n timeFormat={schedulePublishConfig?.timeFormat}\n timeIntervals={schedulePublishConfig?.timeIntervals ?? 5}\n value={displayedValue}\n />\n {supportedTimezones.length > 0 && (\n <TimezonePicker\n id={`timezone-picker`}\n onChange={setTimezone}\n options={supportedTimezones}\n selectedTimezone={timezone}\n />\n )}\n </div>\n {localeOptions.length > 0 && type === 'publish' && (\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('localization:localeToPublish')} />\n <ReactSelect\n onChange={(e) => setLocale(e as { label: string; value: string })}\n options={localeOptions}\n value={locale}\n />\n </div>\n )}\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"primary\"\n disabled={processing}\n id=\"scheduled-publish-save\"\n onClick={handleSave}\n type=\"button\"\n >\n {t('general:save')}\n </Button>\n {processing ? <span>{t('general:saving')}</span> : null}\n </div>\n </Gutter>\n <Gutter className={`${baseClass}__upcoming`}>\n <h4>{t('general:upcomingEvents')}</h4>\n {!upcoming && <ShimmerEffect />}\n {upcoming?.length === 0 && <Banner>{t('general:noUpcomingEventsScheduled')}</Banner>}\n {upcoming?.length > 0 && (\n <Table appearance=\"condensed\" columns={upcomingColumns} data={upcoming} />\n )}\n </Gutter>\n </Drawer>\n )\n}\n"],"mappings":"AAAA,+BACA;;;AAIA,SAASA,UAAA,IAAcC,MAAM,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,EAAEC,OAAO,EAAEC,UAAU,QAAQ;AAChD,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAC5C,SAASC,KAAK,QAAQ;AAItB,SAASC,UAAU,QAAQ;AAC3B,SAASC,KAAK,QAAQ;AACtB,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,OAAO;AACP,SAASC,WAAW,QAAQ;AAC5B,SAASC,aAAa,QAAQ;AAC9B,SAASC,KAAK,QAAQ;AACtB,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ;AAC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AkBtF;;UAIvBkB,aAAA,CAAcuB,MAAM,GAAG,KAAK9C,IAAA,KAAS,0BACpC6E,KAAA,CAAC;QAAIC,SAAA,EAAW,GAAGvG,SAAA,WAAoB;gCACrCwG,IAAA,CAAC3H,UAAA;UAAWqB,KAAA,EAAOqB,CAAA,CAAE;yBACrBiF,IAAA,CAAC9G,WAAA;UACCiH,QAAA,EAAWK,GAAA,IAAM/E,SAAA,CAAU+E,GAAA;UAC3B/D,OAAA,EAASD,aAAA;UACT7C,KAAA,EAAO6B;;uBAIbsE,KAAA,CAAC;QAAIC,SAAA,EAAW,GAAGvG,SAAA,WAAoB;gCACrCwG,IAAA,CAAClH,MAAA;UACC+H,WAAA,EAAY;UACZC,QAAA,EAAUpF,UAAA;UACVhB,EAAA,EAAG;UACHqG,OAAA,EAASxC,UAAA;UACTtD,IAAA,EAAK;oBAEJF,CAAA,CAAE;YAEJW,UAAA,gBAAasE,IAAA,CAAC;oBAAMjF,CAAA,CAAE;aAA4B;;qBAGvD+E,KAAA,CAAC7G,MAAA;MAAO8G,SAAA,EAAW,GAAGvG,SAAA,YAAqB;8BACzCwG,IAAA,CAAC;kBAAIjF,CAAA,CAAE;UACN,CAACc,QAAA,iBAAYmE,IAAA,CAAC7G,aAAA,OACd0C,QAAA,EAAUkC,MAAA,KAAW,kBAAKiC,IAAA,CAACnH,MAAA;kBAAQkC,CAAA,CAAE;UACrCc,QAAA,EAAUkC,MAAA,GAAS,kBAClBiC,IAAA,CAAC5G,KAAA;QAAM4H,UAAA,EAAW;QAAYC,OAAA,EAASlF,eAAA;QAAiBmF,IAAA,EAAMrF;;;;AAKxE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["TZDateMini","TZDate","getTranslation","endOfToday","isToday","startOfDay","transpose","formatAdminURL","qs","React","useCallback","useMemo","toast","FieldLabel","Radio","useConfig","useDocumentInfo","useDocumentTitle","useServerFunctions","useTranslation","requests","Banner","Button","DatePickerField","Drawer","Gutter","ReactSelect","ShimmerEffect","Table","TimezonePicker","buildUpcomingColumns","buildUpcomingScheduleWhere","baseClass","defaultLocaleOption","label","value","ScheduleDrawer","slug","defaultType","onUpcomingChange","schedulePublishConfig","config","admin","dateFormat","timezones","defaultTimezone","supportedTimezones","localization","routes","api","id","collectionSlug","globalSlug","title","i18n","t","schedulePublish","type","setType","useState","date","setDate","timezone","setTimezone","locale","setLocale","processing","setProcessing","modalTitle","upcoming","setUpcoming","upcomingColumns","setUpcomingColumns","deleteHandlerRef","useRef","userTimezone","Intl","DateTimeFormat","resolvedOptions","timeZone","localeOptions","options","locales","map","code","unshift","fetchUpcoming","query","sort","where","docs","post","apiRoute","path","body","stringify","headers","language","then","res","json","deleteHandler","current","length","deleteID","success","err","console","error","message","useEffect","handleSave","localeToPublish","doc","relationTo","String","undefined","global","displayedValue","DateWithOriginalTz","tz","DateWithUserTz","modifiedDate","withTimeZone","dateWithTimezone","dateWithUserTimezone","toISOString","onChangeDate","incomingDate","tzDateWithUTC","dateToUserTz","fetchInitialUpcoming","minTime","Date","_jsxs","className","_jsx","required","isSelected","onChange","option","readOnly","maxTime","minDate","e","pickerAppearance","timeFormat","timeIntervals","selectedTimezone","buttonStyle","disabled","onClick","appearance","columns","data"],"sources":["../../../../src/elements/PublishButton/ScheduleDrawer/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\n'use client'\n\nimport type { Column, SchedulePublish, Where } from 'payload'\n\nimport { TZDateMini as TZDate } from '@date-fns/tz/date/mini'\nimport { getTranslation } from '@payloadcms/translations'\nimport { endOfToday, isToday, startOfDay } from 'date-fns'\nimport { transpose } from 'date-fns/transpose'\nimport { formatAdminURL } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useCallback, useMemo } from 'react'\nimport { toast } from 'sonner'\n\nimport type { PublishType, UpcomingEvent } from './types.js'\n\nimport { FieldLabel } from '../../../fields/FieldLabel/index.js'\nimport { Radio } from '../../../fields/RadioGroup/Radio/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../../providers/DocumentInfo/index.js'\nimport { useDocumentTitle } from '../../../providers/DocumentTitle/index.js'\nimport { useServerFunctions } from '../../../providers/ServerFunctions/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { requests } from '../../../utilities/api.js'\nimport { Banner } from '../../Banner/index.js'\nimport { Button } from '../../Button/index.js'\nimport { DatePickerField } from '../../DatePicker/index.js'\nimport { Drawer } from '../../Drawer/index.js'\nimport { Gutter } from '../../Gutter/index.js'\nimport './index.css'\nimport { ReactSelect } from '../../ReactSelect/index.js'\nimport { ShimmerEffect } from '../../ShimmerEffect/index.js'\nimport { Table } from '../../Table/index.js'\nimport { TimezonePicker } from '../../TimezonePicker/index.js'\nimport { buildUpcomingColumns } from './buildUpcomingColumns.js'\nimport { buildUpcomingScheduleWhere } from './buildUpcomingScheduleWhere.js'\n\nconst baseClass = 'schedule-publish'\n\ntype Props = {\n defaultType?: PublishType\n onUpcomingChange?: (hasUpcoming: boolean) => void\n schedulePublishConfig?: SchedulePublish\n slug: string\n}\n\nconst defaultLocaleOption = {\n label: 'All',\n value: 'all',\n}\n\nexport const ScheduleDrawer: React.FC<Props> = ({\n slug,\n defaultType,\n onUpcomingChange,\n schedulePublishConfig,\n}) => {\n const {\n config: {\n admin: {\n dateFormat,\n timezones: { defaultTimezone, supportedTimezones },\n },\n localization,\n routes: { api },\n },\n } = useConfig()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const { title } = useDocumentTitle()\n const { i18n, t } = useTranslation()\n const { schedulePublish } = useServerFunctions()\n const [type, setType] = React.useState<PublishType>(defaultType || 'publish')\n const [date, setDate] = React.useState<Date>()\n const [timezone, setTimezone] = React.useState<string>(defaultTimezone)\n const [locale, setLocale] = React.useState<{ label: string; value: string }>(defaultLocaleOption)\n const [processing, setProcessing] = React.useState(false)\n const modalTitle = t('general:schedulePublishFor', { title })\n const [upcoming, setUpcoming] = React.useState<UpcomingEvent[]>()\n const [upcomingColumns, setUpcomingColumns] = React.useState<Column[]>()\n const deleteHandlerRef = React.useRef<((id: number | string) => Promise<void>) | null>(() => null)\n\n // Get the user timezone so we can adjust the displayed value against it\n const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone\n\n const localeOptions = React.useMemo(() => {\n if (localization) {\n const options = localization.locales.map(({ code, label }) => ({\n label: getTranslation(label, i18n),\n value: code,\n }))\n\n options.unshift(defaultLocaleOption)\n\n return options\n }\n\n return []\n }, [localization, i18n])\n\n const fetchUpcoming = React.useCallback(async () => {\n const query: { sort: string; where: Where } = {\n sort: 'waitUntil',\n where: buildUpcomingScheduleWhere({ id, collectionSlug, globalSlug }),\n }\n\n const { docs } = await requests\n .post(formatAdminURL({ apiRoute: api, path: `/payload-jobs` }), {\n body: qs.stringify(query),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'X-Payload-HTTP-Method-Override': 'GET',\n },\n })\n .then((res) => res.json())\n\n setUpcomingColumns(\n buildUpcomingColumns({\n dateFormat,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n deleteHandler: deleteHandlerRef.current,\n docs,\n i18n,\n localization,\n supportedTimezones,\n t,\n }),\n )\n setUpcoming(docs)\n onUpcomingChange?.(docs.length > 0)\n }, [\n collectionSlug,\n globalSlug,\n api,\n i18n,\n dateFormat,\n localization,\n supportedTimezones,\n t,\n id,\n onUpcomingChange,\n ])\n\n const deleteHandler = React.useCallback(\n async (id: number | string) => {\n try {\n await schedulePublish({\n deleteID: id,\n })\n await fetchUpcoming()\n toast.success(t('general:deletedSuccessfully'))\n } catch (err) {\n console.error(err)\n toast.error(err.message)\n }\n },\n [fetchUpcoming, schedulePublish, t],\n )\n\n React.useEffect(() => {\n deleteHandlerRef.current = deleteHandler\n }, [deleteHandler])\n\n const handleSave = React.useCallback(async () => {\n if (!date) {\n return toast.error(t('general:noDateSelected'))\n }\n\n setProcessing(true)\n\n let localeToPublish: string\n\n if (typeof locale === 'object' && locale.value !== 'all' && type === 'publish') {\n localeToPublish = locale.value\n }\n\n try {\n await schedulePublish({\n type,\n date,\n doc: collectionSlug\n ? {\n relationTo: collectionSlug,\n value: String(id),\n }\n : undefined,\n global: globalSlug || undefined,\n localeToPublish,\n timezone,\n })\n\n setDate(undefined)\n toast.success(t('version:scheduledSuccessfully'))\n void fetchUpcoming()\n } catch (err) {\n console.error(err)\n toast.error(err.message)\n }\n\n setProcessing(false)\n }, [\n date,\n locale,\n type,\n t,\n schedulePublish,\n collectionSlug,\n id,\n globalSlug,\n timezone,\n fetchUpcoming,\n ])\n\n const displayedValue = useMemo(() => {\n if (timezone && userTimezone && date) {\n // Create TZDate instances for the selected timezone and the user's timezone\n // These instances allow us to transpose the date between timezones while keeping the same time value\n const DateWithOriginalTz = TZDate.tz(timezone)\n const DateWithUserTz = TZDate.tz(userTimezone)\n\n const modifiedDate = new TZDate(date).withTimeZone(timezone)\n\n // Transpose the date to the selected timezone\n const dateWithTimezone = transpose(modifiedDate, DateWithOriginalTz)\n\n // Transpose the date to the user's timezone - this is necessary because the react-datepicker component insists on displaying the date in the user's timezone\n const dateWithUserTimezone = transpose(dateWithTimezone, DateWithUserTz)\n\n return dateWithUserTimezone.toISOString()\n }\n\n return date\n }, [timezone, date, userTimezone])\n\n const onChangeDate = useCallback(\n (incomingDate: Date) => {\n if (timezone && incomingDate) {\n // Create TZDate instances for the selected timezone\n const tzDateWithUTC = TZDate.tz(timezone)\n\n // Creates a TZDate instance for the user's timezone — this is default behaviour of TZDate as it wraps the Date constructor\n const dateToUserTz = new TZDate(incomingDate)\n\n // Transpose the date to the selected timezone\n const dateWithTimezone = transpose(dateToUserTz, tzDateWithUTC)\n\n setDate(dateWithTimezone || null)\n } else {\n setDate(incomingDate || null)\n }\n },\n [setDate, timezone],\n )\n\n React.useEffect(() => {\n if (!upcoming) {\n const fetchInitialUpcoming = async () => {\n await fetchUpcoming()\n }\n\n void fetchInitialUpcoming()\n }\n }, [upcoming, fetchUpcoming])\n\n const minTime = useMemo(() => {\n if (!date || isToday(date)) {\n return new Date()\n }\n\n return startOfDay(new Date())\n }, [date])\n\n return (\n <Drawer className={baseClass} slug={slug} title={modalTitle}>\n <Gutter className={`${baseClass}__scheduler`}>\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('version:type')} required />\n <ul className={`${baseClass}__type`}>\n <li>\n <Radio\n id={`${slug}-type`}\n isSelected={type === 'publish'}\n onChange={() => setType('publish')}\n option={{ label: t('version:publish'), value: 'publish' }}\n path={`${slug}-type`}\n readOnly={processing}\n />\n </li>\n <li>\n <Radio\n id={`${slug}-type`}\n isSelected={type === 'unpublish'}\n onChange={() => setType('unpublish')}\n option={{ label: t('version:unpublish'), value: 'unpublish' }}\n path={`${slug}-type`}\n readOnly={processing}\n />\n </li>\n </ul>\n </div>\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('general:time')} path={'time'} required />\n <DatePickerField\n id=\"time\"\n maxTime={endOfToday()}\n minDate={new Date()}\n minTime={minTime}\n onChange={(e) => onChangeDate(e)}\n pickerAppearance=\"dayAndTime\"\n readOnly={processing}\n timeFormat={schedulePublishConfig?.timeFormat}\n timeIntervals={schedulePublishConfig?.timeIntervals ?? 5}\n value={displayedValue}\n />\n {supportedTimezones.length > 0 && (\n <TimezonePicker\n id={`timezone-picker`}\n onChange={setTimezone}\n options={supportedTimezones}\n selectedTimezone={timezone}\n />\n )}\n </div>\n {localeOptions.length > 0 && type === 'publish' && (\n <div className={`${baseClass}__section`}>\n <FieldLabel label={t('localization:localeToPublish')} />\n <ReactSelect\n onChange={(e) => setLocale(e as { label: string; value: string })}\n options={localeOptions}\n value={locale}\n />\n </div>\n )}\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"primary\"\n disabled={processing}\n id=\"scheduled-publish-save\"\n onClick={handleSave}\n type=\"button\"\n >\n {t('general:save')}\n </Button>\n {processing ? <span>{t('general:saving')}</span> : null}\n </div>\n </Gutter>\n <Gutter className={`${baseClass}__upcoming`}>\n <h4>{t('general:upcomingEvents')}</h4>\n {!upcoming && <ShimmerEffect />}\n {upcoming?.length === 0 && <Banner>{t('general:noUpcomingEventsScheduled')}</Banner>}\n {upcoming?.length > 0 && (\n <Table appearance=\"condensed\" columns={upcomingColumns} data={upcoming} />\n )}\n </Gutter>\n </Drawer>\n )\n}\n"],"mappings":"AAAA,+BACA;;;AAIA,SAASA,UAAA,IAAcC,MAAM,QAAQ;AACrC,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,EAAEC,OAAO,EAAEC,UAAU,QAAQ;AAChD,SAASC,SAAS,QAAQ;AAC1B,SAASC,cAAc,QAAQ;AAC/B,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAC5C,SAASC,KAAK,QAAQ;AAItB,SAASC,UAAU,QAAQ;AAC3B,SAASC,KAAK,QAAQ;AACtB,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,eAAe,QAAQ;AAChC,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,OAAO;AACP,SAASC,WAAW,QAAQ;AAC5B,SAASC,aAAa,QAAQ;AAC9B,SAASC,KAAK,QAAQ;AACtB,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAE3C,MAAMC,SAAA,GAAY;AASlB,MAAMC,mBAAA,GAAsB;EAC1BC,KAAA,EAAO;EACPC,KAAA,EAAO;AACT;AAEA,OAAO,MAAMC,cAAA,GAAkCA,CAAC;EAC9CC,IAAI;EACJC,WAAW;EACXC,gBAAgB;EAChBC;AAAqB,CACtB;EACC,MAAM;IACJC,MAAA,EAAQ;MACNC,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/E,SAAA,CAAU+E,GAAA;UAC3B/D,OAAA,EAASD,aAAA;UACT7C,KAAA,EAAO6B;;uBAIbsE,KAAA,CAAC;QAAIC,SAAA,EAAW,GAAGvG,SAAA,WAAoB;gCACrCwG,IAAA,CAAClH,MAAA;UACC+H,WAAA,EAAY;UACZC,QAAA,EAAUpF,UAAA;UACVhB,EAAA,EAAG;UACHqG,OAAA,EAASxC,UAAA;UACTtD,IAAA,EAAK;oBAEJF,CAAA,CAAE;YAEJW,UAAA,gBAAasE,IAAA,CAAC;oBAAMjF,CAAA,CAAE;aAA4B;;qBAGvD+E,KAAA,CAAC7G,MAAA;MAAO8G,SAAA,EAAW,GAAGvG,SAAA,YAAqB;8BACzCwG,IAAA,CAAC;kBAAIjF,CAAA,CAAE;UACN,CAACc,QAAA,iBAAYmE,IAAA,CAAC7G,aAAA,OACd0C,QAAA,EAAUkC,MAAA,KAAW,kBAAKiC,IAAA,CAACnH,MAAA;kBAAQkC,CAAA,CAAE;UACrCc,QAAA,EAAUkC,MAAA,GAAS,kBAClBiC,IAAA,CAAC5G,KAAA;QAAM4H,UAAA,EAAW;QAAYC,OAAA,EAASlF,eAAA;QAAiBmF,IAAA,EAAMrF;;;;AAKxE","ignoreList":[]}
|
|
@@ -285,9 +285,7 @@ export const QueryPresetBar = ({
|
|
|
285
285
|
},
|
|
286
286
|
children: activePreset?.isShared ? t('general:updateForEveryone') : t('fields:saveChanges')
|
|
287
287
|
}), queryPresetPermissions?.update && /*#__PURE__*/_jsx(PopupList.Button, {
|
|
288
|
-
icon: /*#__PURE__*/_jsx(EditIcon, {
|
|
289
|
-
size: 16
|
|
290
|
-
}),
|
|
288
|
+
icon: /*#__PURE__*/_jsx(EditIcon, {}),
|
|
291
289
|
id: "edit-preset",
|
|
292
290
|
onClick: () => {
|
|
293
291
|
close();
|