@payloadcms/ui 4.0.0-canary.2 → 4.0.0-internal.011fd46
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/css/colors.css +3 -0
- package/dist/css/design-tokens.css +5 -0
- package/dist/css/elevations.css +4 -0
- package/dist/elements/AppHeader/index.d.ts +3 -2
- package/dist/elements/AppHeader/index.d.ts.map +1 -1
- package/dist/elements/AppHeader/index.js +2 -2
- package/dist/elements/AppHeader/index.js.map +1 -1
- package/dist/elements/ColumnSelection/Popup.d.ts +12 -0
- package/dist/elements/ColumnSelection/Popup.d.ts.map +1 -0
- package/dist/elements/{ColumnSelector/index.js → ColumnSelection/Popup.js} +23 -12
- package/dist/elements/ColumnSelection/Popup.js.map +1 -0
- package/dist/elements/ColumnSelection/index.d.ts +10 -0
- package/dist/elements/ColumnSelection/index.d.ts.map +1 -0
- package/dist/elements/{ColumnsButton → ColumnSelection}/index.js +23 -17
- package/dist/elements/ColumnSelection/index.js.map +1 -0
- package/dist/elements/DocumentControls/index.css +7 -1
- package/dist/elements/DocumentControls/index.d.ts.map +1 -1
- package/dist/elements/DocumentControls/index.js +2 -2
- package/dist/elements/DocumentControls/index.js.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js +5 -3
- package/dist/elements/DocumentDrawer/DrawerHeader/index.js.map +1 -1
- package/dist/elements/GroupBy/Popup.d.ts +21 -0
- package/dist/elements/GroupBy/Popup.d.ts.map +1 -0
- package/dist/elements/GroupBy/Popup.js +269 -0
- package/dist/elements/GroupBy/Popup.js.map +1 -0
- package/dist/elements/GroupBy/index.d.ts +12 -0
- package/dist/elements/GroupBy/index.d.ts.map +1 -0
- package/dist/elements/GroupBy/index.js +91 -0
- package/dist/elements/GroupBy/index.js.map +1 -0
- package/dist/elements/ListColumnSelectionButton/index.d.ts +11 -0
- package/dist/elements/ListColumnSelectionButton/index.d.ts.map +1 -0
- package/dist/elements/ListColumnSelectionButton/index.js +37 -0
- package/dist/elements/ListColumnSelectionButton/index.js.map +1 -0
- package/dist/elements/ListControls/index.d.ts.map +1 -1
- package/dist/elements/ListControls/index.js +7 -7
- package/dist/elements/ListControls/index.js.map +1 -1
- package/dist/elements/ListGroupByButton/index.d.ts +12 -0
- package/dist/elements/ListGroupByButton/index.d.ts.map +1 -0
- package/dist/elements/ListGroupByButton/index.js +55 -0
- package/dist/elements/ListGroupByButton/index.js.map +1 -0
- package/dist/elements/ListWhereBuilder/index.d.ts +16 -0
- package/dist/elements/ListWhereBuilder/index.d.ts.map +1 -0
- package/dist/elements/ListWhereBuilder/index.js +62 -0
- package/dist/elements/ListWhereBuilder/index.js.map +1 -0
- package/dist/elements/Popup/PopupButtonList/index.css +5 -0
- package/dist/elements/Popup/PopupGroupLabel/index.css +8 -5
- package/dist/elements/Popup/index.d.ts.map +1 -1
- package/dist/elements/Popup/index.js +42 -11
- package/dist/elements/Popup/index.js.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts +2 -1
- package/dist/elements/PublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/PublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/PublishMany/index.d.ts +2 -6
- package/dist/elements/PublishMany/index.d.ts.map +1 -1
- package/dist/elements/PublishMany/index.js +0 -38
- package/dist/elements/PublishMany/index.js.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/{index.scss → index.css} +1 -3
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js +1 -1
- package/dist/elements/QueryPresets/cells/ColumnsCell/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js +77 -48
- package/dist/elements/QueryPresets/fields/ColumnsField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/GroupByField/index.js +12 -21
- package/dist/elements/QueryPresets/fields/GroupByField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/Heading/index.css +52 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts +7 -0
- package/dist/elements/QueryPresets/fields/Heading/index.d.ts.map +1 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js +31 -0
- package/dist/elements/QueryPresets/fields/Heading/index.js.map +1 -0
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.d.ts.map +1 -1
- package/dist/elements/QueryPresets/fields/WhereField/index.js +24 -23
- package/dist/elements/QueryPresets/fields/WhereField/index.js.map +1 -1
- package/dist/elements/QueryPresets/fields/fields.css +23 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.d.ts +5 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.d.ts.map +1 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.js +10 -0
- package/dist/elements/ReactSelect/getCaptureMenuScroll.js.map +1 -0
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts +6 -0
- package/dist/elements/ReactSelect/getMenuListStyles.d.ts.map +1 -0
- package/dist/elements/ReactSelect/getMenuListStyles.js +7 -0
- package/dist/elements/ReactSelect/getMenuListStyles.js.map +1 -0
- package/dist/elements/ReactSelect/index.css +0 -1
- package/dist/elements/ReactSelect/index.d.ts.map +1 -1
- package/dist/elements/ReactSelect/index.js +168 -148
- package/dist/elements/ReactSelect/index.js.map +1 -1
- package/dist/elements/ReactSelect/types.d.ts +1 -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.js +2 -2
- package/dist/elements/RelationshipTable/index.js.map +1 -1
- package/dist/elements/SortColumn/index.css +1 -1
- package/dist/elements/Table/index.css +24 -2
- package/dist/elements/Toasts/fieldErrors.d.ts +1 -0
- package/dist/elements/Toasts/fieldErrors.d.ts.map +1 -1
- package/dist/elements/Toasts/fieldErrors.js +25 -9
- package/dist/elements/Toasts/fieldErrors.js.map +1 -1
- package/dist/elements/Toasts/index.css +5 -0
- package/dist/elements/UnpublishMany/DrawerContent.d.ts +2 -1
- package/dist/elements/UnpublishMany/DrawerContent.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/DrawerContent.js.map +1 -1
- package/dist/elements/UnpublishMany/index.d.ts +2 -4
- package/dist/elements/UnpublishMany/index.d.ts.map +1 -1
- package/dist/elements/UnpublishMany/index.js +0 -38
- package/dist/elements/UnpublishMany/index.js.map +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js +1 -1
- package/dist/elements/UserMenu/LanguageMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts +6 -2
- package/dist/elements/UserMenu/SettingsMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/SettingsMenu/index.js +15 -10
- package/dist/elements/UserMenu/SettingsMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js +1 -1
- package/dist/elements/UserMenu/ThemeMenu/index.js.map +1 -1
- package/dist/elements/UserMenu/index.d.ts +2 -1
- package/dist/elements/UserMenu/index.d.ts.map +1 -1
- package/dist/elements/UserMenu/index.js +8 -5
- package/dist/elements/UserMenu/index.js.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.d.ts +1 -0
- package/dist/elements/WhereBuilder/Condition/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/Condition/index.js +17 -2
- package/dist/elements/WhereBuilder/Condition/index.js.map +1 -1
- package/dist/elements/WhereBuilder/index.d.ts +4 -3
- package/dist/elements/WhereBuilder/index.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/index.js +71 -62
- package/dist/elements/WhereBuilder/index.js.map +1 -1
- package/dist/elements/WhereBuilder/types.d.ts +6 -5
- package/dist/elements/WhereBuilder/types.d.ts.map +1 -1
- package/dist/elements/WhereBuilder/types.js.map +1 -1
- package/dist/exports/client/index.d.ts +2 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +26 -26
- package/dist/exports/client/index.js.map +4 -4
- package/dist/fields/RadioGroup/index.css +6 -0
- package/dist/icons/Check/index.css +1 -2
- package/dist/icons/Check/index.js +1 -1
- package/dist/icons/Check/index.js.map +1 -1
- package/dist/icons/Warning/index.css +1 -7
- package/dist/icons/Warning/index.d.ts +1 -1
- package/dist/icons/Warning/index.d.ts.map +1 -1
- package/dist/icons/Warning/index.js +11 -16
- package/dist/icons/Warning/index.js.map +1 -1
- package/dist/providers/ToastContainer/index.css +208 -0
- package/dist/providers/ToastContainer/index.d.ts +1 -0
- package/dist/providers/ToastContainer/index.d.ts.map +1 -1
- package/dist/providers/ToastContainer/index.js +19 -6
- package/dist/providers/ToastContainer/index.js.map +1 -1
- package/dist/scss/app.scss +7 -2
- package/dist/styles.css +1 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +51 -9
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/reduceFieldsToOptions.js +1 -1
- package/dist/utilities/reduceFieldsToOptions.js.map +1 -1
- package/dist/views/HierarchyList/DocumentListSelection/index.js +4 -4
- package/dist/views/HierarchyList/DocumentListSelection/index.js.map +1 -1
- package/dist/views/List/ListSelection/index.js +4 -4
- package/dist/views/List/ListSelection/index.js.map +1 -1
- package/dist/views/List/index.client.d.ts.map +1 -1
- package/dist/views/List/index.client.js +3 -3
- package/dist/views/List/index.client.js.map +1 -1
- package/dist/views/List/renderListViewSlots.d.ts.map +1 -1
- package/dist/views/List/renderListViewSlots.js +9 -6
- package/dist/views/List/renderListViewSlots.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +1 -1
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Versions/index.css +0 -4
- package/package.json +5 -5
- package/dist/elements/ColumnSelector/index.d.ts +0 -9
- package/dist/elements/ColumnSelector/index.d.ts.map +0 -1
- package/dist/elements/ColumnSelector/index.js.map +0 -1
- package/dist/elements/ColumnsButton/index.d.ts +0 -7
- package/dist/elements/ColumnsButton/index.d.ts.map +0 -1
- package/dist/elements/ColumnsButton/index.js.map +0 -1
- package/dist/elements/GroupByBuilder/index.d.ts +0 -12
- package/dist/elements/GroupByBuilder/index.d.ts.map +0 -1
- package/dist/elements/GroupByBuilder/index.js +0 -164
- package/dist/elements/GroupByBuilder/index.js.map +0 -1
- package/dist/elements/GroupByBuilder/index.scss +0 -39
- package/dist/elements/GroupByControl/index.d.ts +0 -9
- package/dist/elements/GroupByControl/index.d.ts.map +0 -1
- package/dist/elements/GroupByControl/index.js +0 -254
- package/dist/elements/GroupByControl/index.js.map +0 -1
- package/dist/elements/QueryPresets/fields/ColumnsField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/GroupByField/index.scss +0 -17
- package/dist/elements/QueryPresets/fields/WhereField/index.scss +0 -23
- package/dist/scss/toasts.scss +0 -146
- /package/dist/elements/{ColumnSelector/index.css → ColumnSelection/Popup.css} +0 -0
- /package/dist/elements/{GroupByControl/index.css → GroupBy/Popup.css} +0 -0
|
@@ -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","Popup","props","id","button","buttonClassName","buttonSize","buttonType","caret","children","className","disabled","forceOpen","horizontalAlign","initActive","noBackground","onToggleClose","onToggleOpen","portalClassName","render","renderButton","showOnHover","showScrollbar","side","size","theme","verticalAlign","popupRef","triggerRef","openedViaKeyboardRef","parentPopup","mounted","setMounted","active","setActiveInternal","isOnTop","setIsOnTop","setActive","isActive","viaKeyboard","current","updatePosition","trigger","popup","triggerRect","getBoundingClientRect","popupRect","offset","sideOffset","top","left","caretLeft","window","scrollY","maxTop","innerHeight","height","Math","max","min","anchorRect","width","right","innerWidth","scrollX","onTop","bottom","topIfAbove","triggerCenter","newTop","round","newLeft","newCaretLeft","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","document","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","body"],"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\nexport type PopupProps = {\n backgroundColor?: CSSProperties['backgroundColor']\n boundingRef?: React.RefObject<HTMLElement>\n button?: React.ReactNode\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' | 'medium' | '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 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 = 'medium',\n theme = 'dark',\n verticalAlign = 'bottom',\n } = props\n\n const popupRef = useRef<HTMLDivElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\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 // 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 + window.scrollY\n const maxTop = window.scrollY + window.innerHeight - popupRect.height - offset\n top = Math.max(window.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 + window.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 + window.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 + window.scrollY - popupRect.height - offset\n if (topIfAbove >= window.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 + window.scrollY - popupRect.height - offset\n\n if (triggerRect.top - popupRect.height - offset < 0) {\n top = triggerRect.bottom + window.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 + window.scrollX)}px`\n const newCaretLeft = `${Math.round(caretLeft)}px`\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.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. ColumnSelector content rendering after hidden → visible\n // class switch), which was causing incorrect flip-to-top decisions.\n // /////////////////////////////////////\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 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,WACA,yBACA,6CACA,yBACA,2BACA,cACA,oDACA,mBACA,mBACA,UACD,CACEC,GAAG,CAAEC,CAAA,IAAM,GAAGA,CAAA,uBAAwB,EACtCC,IAAI,CAAC;AAsFR;;;;;;AAMA,OAAO,MAAMC,KAAA,GAA+BC,KAAA;EAC1C,MAAM;IACJC,EAAE;IACFC,MAAM;IACNC,eAAe;IACfC,UAAU;IACVC,UAAA,GAAa,SAAS;IACtBC,KAAA,GAAQ,IAAI;IACZC,QAAQ;IACRC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AeQ,EAAA,IAAM8G,SAAA;QACrB,cAAYxF,KAAA,KAAU,SAASwF,SAAA,GAAYxF,KAAA;QAC3C8F,GAAA,EAAK5F,QAAA;gCAELwF,IAAA,CAAC;UACCzG,SAAA,EAAW,GAAGf,SAAA,qBAA8B2B,aAAA,GAAgB,IAAI3B,SAAA,oCAA6C,GAAG,IAAI;oBAEnH8B,KAAA,KAAU,sBACT2F,KAAA,CAAAS,SAAA;uBACG1G,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;4BAGH2G,KAAA,CAAC3H,aAAA;YAAcgC,KAAA,EAAOA,KAAA;uBACnBN,MAAA,GAAS;cAAE2G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC5B,QAAA;;YAIND,KAAA,IAAS,CAACe,IAAA,iBAAQ4F,IAAA,CAAC;UAAIzG,SAAA,EAAW,GAAGf,SAAA;;;QAG1CuG,QAAA,CAAS6B,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","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 * 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' | 'medium' | '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 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 = 'medium',\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 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,Q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QACrB,cAAYzF,KAAA,KAAU,SAASyF,SAAA,GAAYzF,KAAA;QAC3C+F,GAAA,EAAK7F,QAAA;gCAELyF,IAAA,CAAC;UACC1G,SAAA,EAAW,GAAGxB,SAAA,qBAA8BoC,aAAA,GAAgB,IAAIpC,SAAA,oCAA6C,GAAG,IAAI;oBAEnHuC,KAAA,KAAU,sBACT4F,KAAA,CAAAS,SAAA;uBACG3G,MAAA,GAAS;cAAE4G,KAAA,EAAOA,CAAA,KAAMzF,SAAA,CAAU;YAAO,IACzC7B,QAAA;4BAGH4G,KAAA,CAACrI,aAAA;YAAcyC,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,GAAGxB,SAAA;;;QAG1CU,QAAA,CAASC,IAAI,IAEf;;AAGV","ignoreList":[]}
|
|
@@ -2,12 +2,13 @@ import type { Where } from 'payload';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { PublishManyProps } from './index.js';
|
|
4
4
|
type PublishManyDrawerContentProps = {
|
|
5
|
+
collection: PublishManyProps['collection'];
|
|
5
6
|
drawerSlug: string;
|
|
6
7
|
ids: (number | string)[];
|
|
7
8
|
onSuccess?: () => void;
|
|
8
9
|
selectAll: boolean;
|
|
9
10
|
where?: Where;
|
|
10
|
-
}
|
|
11
|
+
};
|
|
11
12
|
export declare function PublishManyDrawerContent(props: PublishManyDrawerContentProps): React.JSX.Element;
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=DrawerContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishMany/DrawerContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKpC,OAAO,KAAsB,MAAM,OAAO,CAAA;AAG1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAWlD,KAAK,6BAA6B,GAAG;IACnC,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,
|
|
1
|
+
{"version":3,"file":"DrawerContent.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishMany/DrawerContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAKpC,OAAO,KAAsB,MAAM,OAAO,CAAA;AAG1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAWlD,KAAK,6BAA6B,GAAG;IACnC,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,6BAA6B,qBA2K5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DrawerContent.js","names":["getTranslation","combineWhereConstraints","formatAdminURL","mergeListSearchAndWhere","qs","React","useCallback","toast","useConfig","useLocale","useRouteCache","useRouter","useSearchParams","useTranslation","requests","parseSearchParams","ConfirmationModal","PublishManyDrawerContent","props","collection","slug","labels","plural","singular","drawerSlug","ids","onSuccess","selectAll","where","clearRouteCache","config","routes","api","code","locale","router","searchParams","i18n","t","addDefaultError","error","queryString","useMemo","whereConstraints","_status","not_equals","push","queryWithSearch","collectionConfig","search","get","id","in","stringify","select","addQueryPrefix","handlePublish","url","apiRoute","path","patch","body","JSON","headers","language","then","res","json","deletedDocs","docs","length","successLabel","status","success","count","label","errors","message","description","map","join","replace","page","undefined","forEach","_err","_jsx","cancelLabel","confirmingLabel","confirmLabel","heading","modalSlug","onConfirm"],"sources":["../../../src/elements/PublishMany/DrawerContent.tsx"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { combineWhereConstraints, formatAdminURL, mergeListSearchAndWhere } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useCallback } from 'react'\nimport { toast } from 'sonner'\n\nimport type { PublishManyProps } from './index.js'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useRouteCache } from '../../providers/RouteCache/index.js'\nimport { useRouter, useSearchParams } from '../../providers/RouterAdapter/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { parseSearchParams } from '../../utilities/parseSearchParams.js'\nimport { ConfirmationModal } from '../ConfirmationModal/index.js'\n\ntype PublishManyDrawerContentProps = {\n drawerSlug: string\n ids: (number | string)[]\n onSuccess?: () => void\n selectAll: boolean\n where?: Where\n} & PublishManyProps\n\nexport function PublishManyDrawerContent(props: PublishManyDrawerContentProps) {\n const {\n collection,\n collection: { slug, labels: { plural, singular } } = {},\n drawerSlug,\n ids,\n onSuccess,\n selectAll,\n where,\n } = props\n\n const { clearRouteCache } = useRouteCache()\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const { code: locale } = useLocale()\n\n const router = useRouter()\n const searchParams = useSearchParams()\n const { i18n, t } = useTranslation()\n\n const addDefaultError = useCallback(() => {\n toast.error(t('error:unknown'))\n }, [t])\n\n const queryString = React.useMemo((): string => {\n const whereConstraints: Where[] = [\n {\n _status: {\n not_equals: 'published',\n },\n },\n ]\n\n if (where) {\n whereConstraints.push(where)\n }\n\n const queryWithSearch = mergeListSearchAndWhere({\n collectionConfig: collection,\n search: searchParams.get('search'),\n })\n\n if (queryWithSearch) {\n whereConstraints.push(queryWithSearch)\n }\n\n if (selectAll) {\n // Match the current filter/search, or default to all docs\n whereConstraints.push(\n (parseSearchParams(searchParams)?.where as Where) || {\n id: {\n not_equals: '',\n },\n },\n )\n } else {\n // If we're not selecting all, we need to select specific docs\n whereConstraints.push({\n id: {\n in: ids || [],\n },\n })\n }\n\n return qs.stringify(\n {\n locale,\n select: {},\n where: combineWhereConstraints(whereConstraints),\n },\n { addQueryPrefix: true },\n )\n }, [collection, searchParams, selectAll, ids, locale, where])\n\n const handlePublish = useCallback(async () => {\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${slug}${queryString}&draft=true`,\n })\n await requests\n .patch(url, {\n body: JSON.stringify({\n _status: 'published',\n }),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n })\n .then(async (res) => {\n try {\n const json = await res.json()\n\n const deletedDocs = json?.docs.length || 0\n const successLabel = deletedDocs > 1 ? plural : singular\n\n if (res.status < 400 || deletedDocs > 0) {\n toast.success(\n t('general:updatedCountSuccessfully', {\n count: deletedDocs,\n label: getTranslation(successLabel, i18n),\n }),\n )\n\n if (json?.errors.length > 0) {\n toast.error(json.message, {\n description: json.errors.map((error) => error.message).join('\\n'),\n })\n }\n\n router.replace(\n qs.stringify(\n {\n ...parseSearchParams(searchParams),\n page: selectAll ? '1' : undefined,\n },\n { addQueryPrefix: true },\n ),\n )\n\n clearRouteCache()\n\n if (typeof onSuccess === 'function') {\n onSuccess()\n }\n\n return null\n }\n\n if (json.errors) {\n json.errors.forEach((error) => toast.error(error.message))\n } else {\n addDefaultError()\n }\n return false\n } catch (_err) {\n return addDefaultError()\n }\n })\n }, [\n api,\n slug,\n queryString,\n i18n,\n plural,\n singular,\n t,\n router,\n searchParams,\n selectAll,\n clearRouteCache,\n addDefaultError,\n onSuccess,\n ])\n\n return (\n <ConfirmationModal\n body={t('version:aboutToPublishSelection', { label: getTranslation(plural, i18n) })}\n cancelLabel={t('general:cancel')}\n confirmingLabel={t('version:publishing')}\n confirmLabel={t('general:confirm')}\n heading={t('version:confirmPublish')}\n modalSlug={drawerSlug}\n onConfirm={handlePublish}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,uBAAuB,EAAEC,cAAc,EAAEC,uBAAuB,QAAQ;AACjF,YAAYC,EAAA,MAAQ;AACpB,OAAOC,KAAA,IAASC,WAAW,QAAQ;AACnC,SAASC,KAAK,QAAQ;AAItB,SAASC,SAAS,QAAQ;AAC1B,SAASC,SAAS,QAAQ;AAC1B,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,EAAEC,eAAe,QAAQ;AAC3C,SAASC,cAAc,QAAQ;AAC/B,SAASC,QAAQ,QAAQ;AACzB,SAASC,iBAAiB,QAAQ;AAClC,SAASC,iBAAiB,QAAQ;AAUlC,OAAO,SAASC,yBAAyBC,KAAoC;EAC3E,MAAM;IACJC,UAAU;IACVA,UAAA,EAAY;MAAEC,IAAI;MAAEC,MAAA,EAAQ;QAAEC,MAAM;QAAEC;MAAQ;IAAE,CAAE,GAAG,CAAC,CAAC;IACvDC,UAAU;IACVC,GAAG;IACHC,SAAS;IACTC,SAAS;IACTC;EAAK,CACN,GAAGV,KAAA;EAEJ,MAAM;IAAEW;EAAe,CAAE,GAAGnB,aAAA;EAE5B,MAAM;IACJoB,MAAA,EAAQ;MACNC,MAAA,EAAQ;QAAEC;MAAG;IAAE;EAChB,CACF,GAAGxB,SAAA;EAEJ,MAAM;IAAEyB,IAAA,EAAMC;EAAM,CAAE,GAAGzB,SAAA;EAEzB,MAAM0B,MAAA,GAASxB,SAAA;EACf,MAAMyB,YAAA,GAAexB,eAAA;EACrB,MAAM;IAAEyB,IAAI;IAAEC;EAAC,CAAE,GAAGzB,cAAA;EAEpB,MAAM0B,eAAA,GAAkBjC,WA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C,KAAA,CAAMiC,KAAK,CAACA,KAAA,CAAMqC,OAAO;QAC1D,OAAO;UACLtC,eAAA;QACF;QACA,OAAO;MACT,EAAE,OAAO8C,IAAA,EAAM;QACb,OAAO9C,eAAA;MACT;IACF;EACJ,GAAG,CACDP,GAAA,EACAZ,IAAA,EACAqB,WAAA,EACAJ,IAAA,EACAf,MAAA,EACAC,QAAA,EACAe,CAAA,EACAH,MAAA,EACAC,YAAA,EACAT,SAAA,EACAE,eAAA,EACAU,eAAA,EACAb,SAAA,CACD;EAED,oBACE4D,IAAA,CAACtE,iBAAA;IACC6C,IAAA,EAAMvB,CAAA,CAAE,mCAAmC;MAAEqC,KAAA,EAAO3E,cAAA,CAAesB,MAAA,EAAQe,IAAA;IAAM;IACjFkD,WAAA,EAAajD,CAAA,CAAE;IACfkD,eAAA,EAAiBlD,CAAA,CAAE;IACnBmD,YAAA,EAAcnD,CAAA,CAAE;IAChBoD,OAAA,EAASpD,CAAA,CAAE;IACXqD,SAAA,EAAWnE,UAAA;IACXoE,SAAA,EAAWpC;;AAGjB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"DrawerContent.js","names":["getTranslation","combineWhereConstraints","formatAdminURL","mergeListSearchAndWhere","qs","React","useCallback","toast","useConfig","useLocale","useRouteCache","useRouter","useSearchParams","useTranslation","requests","parseSearchParams","ConfirmationModal","PublishManyDrawerContent","props","collection","slug","labels","plural","singular","drawerSlug","ids","onSuccess","selectAll","where","clearRouteCache","config","routes","api","code","locale","router","searchParams","i18n","t","addDefaultError","error","queryString","useMemo","whereConstraints","_status","not_equals","push","queryWithSearch","collectionConfig","search","get","id","in","stringify","select","addQueryPrefix","handlePublish","url","apiRoute","path","patch","body","JSON","headers","language","then","res","json","deletedDocs","docs","length","successLabel","status","success","count","label","errors","message","description","map","join","replace","page","undefined","forEach","_err","_jsx","cancelLabel","confirmingLabel","confirmLabel","heading","modalSlug","onConfirm"],"sources":["../../../src/elements/PublishMany/DrawerContent.tsx"],"sourcesContent":["import type { Where } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { combineWhereConstraints, formatAdminURL, mergeListSearchAndWhere } from 'payload/shared'\nimport * as qs from 'qs-esm'\nimport React, { useCallback } from 'react'\nimport { toast } from 'sonner'\n\nimport type { PublishManyProps } from './index.js'\n\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useRouteCache } from '../../providers/RouteCache/index.js'\nimport { useRouter, useSearchParams } from '../../providers/RouterAdapter/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { requests } from '../../utilities/api.js'\nimport { parseSearchParams } from '../../utilities/parseSearchParams.js'\nimport { ConfirmationModal } from '../ConfirmationModal/index.js'\n\ntype PublishManyDrawerContentProps = {\n collection: PublishManyProps['collection']\n drawerSlug: string\n ids: (number | string)[]\n onSuccess?: () => void\n selectAll: boolean\n where?: Where\n}\n\nexport function PublishManyDrawerContent(props: PublishManyDrawerContentProps) {\n const {\n collection,\n collection: { slug, labels: { plural, singular } } = {},\n drawerSlug,\n ids,\n onSuccess,\n selectAll,\n where,\n } = props\n\n const { clearRouteCache } = useRouteCache()\n\n const {\n config: {\n routes: { api },\n },\n } = useConfig()\n\n const { code: locale } = useLocale()\n\n const router = useRouter()\n const searchParams = useSearchParams()\n const { i18n, t } = useTranslation()\n\n const addDefaultError = useCallback(() => {\n toast.error(t('error:unknown'))\n }, [t])\n\n const queryString = React.useMemo((): string => {\n const whereConstraints: Where[] = [\n {\n _status: {\n not_equals: 'published',\n },\n },\n ]\n\n if (where) {\n whereConstraints.push(where)\n }\n\n const queryWithSearch = mergeListSearchAndWhere({\n collectionConfig: collection,\n search: searchParams.get('search'),\n })\n\n if (queryWithSearch) {\n whereConstraints.push(queryWithSearch)\n }\n\n if (selectAll) {\n // Match the current filter/search, or default to all docs\n whereConstraints.push(\n (parseSearchParams(searchParams)?.where as Where) || {\n id: {\n not_equals: '',\n },\n },\n )\n } else {\n // If we're not selecting all, we need to select specific docs\n whereConstraints.push({\n id: {\n in: ids || [],\n },\n })\n }\n\n return qs.stringify(\n {\n locale,\n select: {},\n where: combineWhereConstraints(whereConstraints),\n },\n { addQueryPrefix: true },\n )\n }, [collection, searchParams, selectAll, ids, locale, where])\n\n const handlePublish = useCallback(async () => {\n const url = formatAdminURL({\n apiRoute: api,\n path: `/${slug}${queryString}&draft=true`,\n })\n await requests\n .patch(url, {\n body: JSON.stringify({\n _status: 'published',\n }),\n headers: {\n 'Accept-Language': i18n.language,\n 'Content-Type': 'application/json',\n },\n })\n .then(async (res) => {\n try {\n const json = await res.json()\n\n const deletedDocs = json?.docs.length || 0\n const successLabel = deletedDocs > 1 ? plural : singular\n\n if (res.status < 400 || deletedDocs > 0) {\n toast.success(\n t('general:updatedCountSuccessfully', {\n count: deletedDocs,\n label: getTranslation(successLabel, i18n),\n }),\n )\n\n if (json?.errors.length > 0) {\n toast.error(json.message, {\n description: json.errors.map((error) => error.message).join('\\n'),\n })\n }\n\n router.replace(\n qs.stringify(\n {\n ...parseSearchParams(searchParams),\n page: selectAll ? '1' : undefined,\n },\n { addQueryPrefix: true },\n ),\n )\n\n clearRouteCache()\n\n if (typeof onSuccess === 'function') {\n onSuccess()\n }\n\n return null\n }\n\n if (json.errors) {\n json.errors.forEach((error) => toast.error(error.message))\n } else {\n addDefaultError()\n }\n return false\n } catch (_err) {\n return addDefaultError()\n }\n })\n }, [\n api,\n slug,\n queryString,\n i18n,\n plural,\n singular,\n t,\n router,\n searchParams,\n selectAll,\n clearRouteCache,\n addDefaultError,\n onSuccess,\n ])\n\n return (\n <ConfirmationModal\n body={t('version:aboutToPublishSelection', { label: getTranslation(plural, i18n) })}\n cancelLabel={t('general:cancel')}\n confirmingLabel={t('version:publishing')}\n confirmLabel={t('general:confirm')}\n heading={t('version:confirmPublish')}\n modalSlug={drawerSlug}\n onConfirm={handlePublish}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,SAASC,uBAAuB,EAAE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AC,YAAA,EACAT,SAAA,EACAE,eAAA,EACAU,eAAA,EACAb,SAAA,CACD;EAED,oBACE4D,IAAA,CAACtE,iBAAA;IACC6C,IAAA,EAAMvB,CAAA,CAAE,mCAAmC;MAAEqC,KAAA,EAAO3E,cAAA,CAAesB,MAAA,EAAQe,IAAA;IAAM;IACjFkD,WAAA,EAAajD,CAAA,CAAE;IACfkD,eAAA,EAAiBlD,CAAA,CAAE;IACnBmD,YAAA,EAAcnD,CAAA,CAAE;IAChBoD,OAAA,EAASpD,CAAA,CAAE;IACXqD,SAAA,EAAWnE,UAAA;IACXoE,SAAA,EAAWpC;;AAGjB","ignoreList":[]}
|
|
@@ -2,9 +2,6 @@ import type { ClientCollectionConfig, Where } from 'payload';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export type PublishManyProps = {
|
|
4
4
|
collection: ClientCollectionConfig;
|
|
5
|
-
};
|
|
6
|
-
export declare const PublishMany: React.FC<PublishManyProps>;
|
|
7
|
-
type PublishMany_v4Props = {
|
|
8
5
|
count: number;
|
|
9
6
|
ids: (number | string)[];
|
|
10
7
|
/**
|
|
@@ -14,7 +11,6 @@ type PublishMany_v4Props = {
|
|
|
14
11
|
onSuccess?: () => void;
|
|
15
12
|
selectAll: boolean;
|
|
16
13
|
where?: Where;
|
|
17
|
-
}
|
|
18
|
-
export declare const
|
|
19
|
-
export {};
|
|
14
|
+
};
|
|
15
|
+
export declare const PublishMany: React.FC<PublishManyProps>;
|
|
20
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishMany/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG5D,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/PublishMany/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAG5D,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,EAAE,sBAAsB,CAAA;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAA;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,SAAS,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAA;CACd,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8ClD,CAAA"}
|
|
@@ -5,48 +5,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
import { useModal } from '@faceless-ui/modal';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { useAuth } from '../../providers/Auth/index.js';
|
|
8
|
-
import { SelectAllStatus, useSelection } from '../../providers/Selection/index.js';
|
|
9
8
|
import { useTranslation } from '../../providers/Translation/index.js';
|
|
10
9
|
import { ListSelectionButton } from '../ListSelection/index.js';
|
|
11
10
|
import { PublishManyDrawerContent } from './DrawerContent.js';
|
|
12
11
|
export const PublishMany = props => {
|
|
13
|
-
const $ = _c(8);
|
|
14
|
-
const {
|
|
15
|
-
count,
|
|
16
|
-
selectAll,
|
|
17
|
-
selectedIDs,
|
|
18
|
-
toggleAll
|
|
19
|
-
} = useSelection();
|
|
20
|
-
let t0;
|
|
21
|
-
if ($[0] !== toggleAll) {
|
|
22
|
-
t0 = () => toggleAll();
|
|
23
|
-
$[0] = toggleAll;
|
|
24
|
-
$[1] = t0;
|
|
25
|
-
} else {
|
|
26
|
-
t0 = $[1];
|
|
27
|
-
}
|
|
28
|
-
const t1 = selectAll === SelectAllStatus.AllAvailable;
|
|
29
|
-
let t2;
|
|
30
|
-
if ($[2] !== count || $[3] !== props || $[4] !== selectedIDs || $[5] !== t0 || $[6] !== t1) {
|
|
31
|
-
t2 = _jsx(PublishMany_v4, {
|
|
32
|
-
...props,
|
|
33
|
-
count,
|
|
34
|
-
ids: selectedIDs,
|
|
35
|
-
onSuccess: t0,
|
|
36
|
-
selectAll: t1
|
|
37
|
-
});
|
|
38
|
-
$[2] = count;
|
|
39
|
-
$[3] = props;
|
|
40
|
-
$[4] = selectedIDs;
|
|
41
|
-
$[5] = t0;
|
|
42
|
-
$[6] = t1;
|
|
43
|
-
$[7] = t2;
|
|
44
|
-
} else {
|
|
45
|
-
t2 = $[7];
|
|
46
|
-
}
|
|
47
|
-
return t2;
|
|
48
|
-
};
|
|
49
|
-
export const PublishMany_v4 = props => {
|
|
50
12
|
const $ = _c(12);
|
|
51
13
|
const {
|
|
52
14
|
collection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useModal","React","useAuth","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useModal","React","useAuth","useTranslation","ListSelectionButton","PublishManyDrawerContent","PublishMany","props","$","collection","t0","count","ids","modalPrefix","onSuccess","selectAll","where","slug","versions","undefined","permissions","t","openModal","collectionPermissions","collections","hasPermission","update","drawerSlug","drafts","t1","t2","_jsxs","Fragment","children","_jsx","onClick"],"sources":["../../../src/elements/PublishMany/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, Where } from 'payload'\n\nimport { useModal } from '@faceless-ui/modal'\nimport React from 'react'\n\nimport { useAuth } from '../../providers/Auth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { ListSelectionButton } from '../ListSelection/index.js'\nimport { PublishManyDrawerContent } from './DrawerContent.js'\n\nexport type PublishManyProps = {\n collection: ClientCollectionConfig\n count: number\n ids: (number | string)[]\n /**\n * When multiple PublishMany components are rendered on the page, this will differentiate them.\n */\n modalPrefix?: string\n onSuccess?: () => void\n selectAll: boolean\n where?: Where\n}\n\nexport const PublishMany: React.FC<PublishManyProps> = (props) => {\n const {\n collection,\n collection: { slug, versions } = {},\n count,\n ids,\n modalPrefix,\n onSuccess,\n selectAll,\n where,\n } = props\n\n const { permissions } = useAuth()\n const { t } = useTranslation()\n\n const { openModal } = useModal()\n\n const collectionPermissions = permissions?.collections?.[slug]\n const hasPermission = collectionPermissions?.update\n\n const drawerSlug = `${modalPrefix ? `${modalPrefix}-` : ''}publish-${slug}`\n\n if (!versions?.drafts || count === 0 || !hasPermission) {\n return null\n }\n\n return (\n <React.Fragment>\n <ListSelectionButton\n aria-label={t('version:publish')}\n onClick={() => {\n openModal(drawerSlug)\n }}\n >\n {t('version:publish')}\n </ListSelectionButton>\n <PublishManyDrawerContent\n collection={collection}\n drawerSlug={drawerSlug}\n ids={ids}\n onSuccess={onSuccess}\n selectAll={selectAll}\n where={where}\n />\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,QAAQ,QAAQ;AACzB,OAAOC,KAAA,MAAW;AAElB,SAASC,OAAO,QAAQ;AACxB,SAASC,cAAc,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AAezC,OAAO,MAAMC,WAAA,GAA0CC,KAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EACrD;IAAAU,UAAA;IAAAA,UAAA,EAAAC,EAAA;IAAAC,KAAA;IAAAC,GAAA;IAAAC,WAAA;IAAAC,SAAA;IAAAC,SAAA;IAAAC;EAAA,IASIT,KAAA;EAPU;IAAAU,IAAA;IAAAC;EAAA,IAAAR,EAAuB,KAAAS,SAAA,QAAvBT,EAAuB;EASrC;IAAAU;EAAA,IAAwBlB,OAAA;EACxB;IAAAmB;EAAA,IAAclB,cAAA;EAEd;IAAAmB;EAAA,IAAsBtB,QAAA;EAEtB,MAAAuB,qBAAA,GAA8B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ings":"AAAA,OAAO,KAAK,EAAoB,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,yBAAyB,EAAE,MAAM,SAAS,CAAA;AAG1E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAqBvE,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { toWords, transformColumnsToSearchParams } from 'payload/shared';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { Pill } from '../../../Pill/index.js';
|
|
5
|
-
import './index.
|
|
5
|
+
import './index.css';
|
|
6
6
|
const baseClass = 'query-preset-columns-cell';
|
|
7
7
|
export const QueryPresetsColumnsCell = ({
|
|
8
8
|
cellData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["toWords","transformColumnsToSearchParams","React","Pill","baseClass","QueryPresetsColumnsCell","cellData","_jsx","className","map","column","i","isColumnActive","startsWith","pillStyle","size"],"sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"sourcesContent":["import type { ColumnPreference, DefaultCellComponentProps } from 'payload'\n\nimport { toWords, transformColumnsToSearchParams } from 'payload/shared'\nimport React from 'react'\n\nimport { Pill } from '../../../Pill/index.js'\nimport './index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["toWords","transformColumnsToSearchParams","React","Pill","baseClass","QueryPresetsColumnsCell","cellData","_jsx","className","map","column","i","isColumnActive","startsWith","pillStyle","size"],"sources":["../../../../../src/elements/QueryPresets/cells/ColumnsCell/index.tsx"],"sourcesContent":["import type { ColumnPreference, DefaultCellComponentProps } from 'payload'\n\nimport { toWords, transformColumnsToSearchParams } from 'payload/shared'\nimport React from 'react'\n\nimport { Pill } from '../../../Pill/index.js'\nimport './index.css'\n\nconst baseClass = 'query-preset-columns-cell'\n\nexport const QueryPresetsColumnsCell: React.FC<DefaultCellComponentProps> = ({ cellData }) => {\n return (\n <div className={baseClass}>\n {cellData\n ? transformColumnsToSearchParams(cellData as ColumnPreference[]).map((column, i) => {\n const isColumnActive = !column.startsWith('-')\n\n // to void very lengthy cells, only display the active columns\n if (!isColumnActive) {\n return null\n }\n\n return (\n <Pill key={i} pillStyle={isColumnActive ? 'always-white' : 'light'} size=\"small\">\n {toWords(column)}\n </Pill>\n )\n })\n : 'No columns selected'}\n </div>\n )\n}\n"],"mappings":";AAEA,SAASA,OAAO,EAAEC,8BAA8B,QAAQ;AACxD,OAAOC,KAAA,MAAW;AAElB,SAASC,IAAI,QAAQ;AACrB,OAAO;AAEP,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,uBAAA,GAA+DA,CAAC;EAAEC;AAAQ,CAAE;EACvF,oBACEC,IAAA,CAAC;IAAIC,SAAA,EAAWJ,SAAA;cACbE,QAAA,GACGL,8BAAA,CAA+BK,QAAA,EAAgCG,GAAG,CAAC,CAACC,MAAA,EAAQC,CAAA;MAC1E,MAAMC,cAAA,GAAiB,CAACF,MAAA,CAAOG,UAAU,CAAC;MAE1C;MACA,IAAI,CAACD,cAAA,EAAgB;QACnB,OAAO;MACT;MAEA,oBACEL,IAAA,CAACJ,IAAA;QAAaW,SAAA,EAAWF,cAAA,GAAiB,iBAAiB;QAASG,IAAA,EAAK;kBACtEf,OAAA,CAAQU,MAAA;SADAC,CAAA;IAIf,KACA;;AAGV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/QueryPresets/fields/ColumnsField/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/QueryPresets/fields/ColumnsField/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAyC,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAe9F,OAAO,eAAe,CAAA;AAEtB,eAAO,MAAM,uBAAuB,EAAE,wBA8IrC,CAAA"}
|