@plexui/ui 0.44.3 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Dialog/Dialog.js +3 -3
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Page/Page.js +70 -14
- package/dist/es/components/Page/Page.js.map +1 -1
- package/dist/es/components/TabBar/TabBar.js +2 -2
- package/dist/es/components/TabBar/TabBar.js.map +1 -1
- package/dist/es/components/Toolbar/Toolbar.js +173 -26
- package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
- package/dist/es/components/Toolbar/index.js.map +1 -1
- package/dist/types/components/Dialog/Dialog.d.ts +2 -2
- package/dist/types/components/Page/Page.d.ts +3 -3
- package/dist/types/components/TabBar/TabBar.d.ts +3 -3
- package/dist/types/components/Toolbar/Toolbar.d.ts +38 -8
- package/dist/types/components/Toolbar/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -10,7 +10,7 @@ import { inToastRegion } from "../../lib/toastRegion.js";
|
|
|
10
10
|
import { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from "../../lib/helpers.js";
|
|
11
11
|
import { useStableCallback } from "../../hooks/useStableCallback.js";
|
|
12
12
|
import { NavigationButton } from "../Button/NavigationButton.js";
|
|
13
|
-
import { Toolbar, ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
13
|
+
import { barBackground, Toolbar, ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
14
14
|
import { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges } from "../../lib/scrollEdges.js";
|
|
15
15
|
import { TransitionGroup } from "../Transition/index.js";
|
|
16
16
|
import { createExitGuard, overlayTiming, overlayTimingLarge } from "../Transition/shared.js";
|
|
@@ -198,7 +198,7 @@ const Header = ({ children, className, background = "glass" }) => {
|
|
|
198
198
|
// at the trailing edge, all on one 44px row 16px under the top edge.
|
|
199
199
|
return (_jsxs(_Fragment, { children: [_jsx(Toolbar, { background: background, className: className, "data-dialog-bar": "", children: _jsxs(DialogBarContext.Provider, { value: true, children: [sheet.showClose && !parts.some(isLeadingAction) && (_jsx(Toolbar.Leading, { className: s.BarClose, children: _jsx(RadixDialog.Close, { asChild: true, children: _jsx(NavigationButton, { action: "close", variant: "ghost", "aria-label": "Close dialog" }) }) })), parts.filter(isLeadingAction), _jsx("div", { className: clsx(t.Heading, s.BarHeading), children: parts.filter((part) => !isHeaderAction(part) && !isDescription(part)) }), parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))] }) }), description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)] }));
|
|
200
200
|
}
|
|
201
|
-
return _jsx("div", { className: clsx(s.Header, className), "data-background": background, "data-scrolled": scrolled ? "" : undefined, children: children });
|
|
201
|
+
return _jsx("div", { className: clsx(s.Header, className), "data-background": barBackground(background), "data-scrolled": scrolled ? "" : undefined, children: children });
|
|
202
202
|
};
|
|
203
203
|
const HeaderAction = ({ children, className, side = "trailing" }) => {
|
|
204
204
|
const bar = useContext(DialogBarContext);
|
|
@@ -245,7 +245,7 @@ const Footer = ({ children, className, mobileLayout, background = "soft" }) => {
|
|
|
245
245
|
// where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the
|
|
246
246
|
// actions in the order they are seen.
|
|
247
247
|
const parts = sheet && phone && mobileLayout !== "inline" ? headerParts(children).reverse() : children;
|
|
248
|
-
return (_jsx("div", { ref: setFooter, className: clsx(s.Footer, className), "data-mobile-layout": mobileLayout, "data-background": background, "data-content-below": contentBelow ? "" : undefined, children: parts }));
|
|
248
|
+
return (_jsx("div", { ref: setFooter, className: clsx(s.Footer, className), "data-mobile-layout": mobileLayout, "data-background": barBackground(background), "data-content-below": contentBelow ? "" : undefined, children: parts }));
|
|
249
249
|
};
|
|
250
250
|
const Title = ({ children, className }) => {
|
|
251
251
|
const bar = useContext(DialogBarContext);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file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,EAAE,cAAc,EAAE,iBAAiB,YAC5K,kCAAiC,EAAE,EAAC,QAAQ,EAAE,CAAC,CAAC,YAAG,QAAQ,IAAjD,IAAI,CAAoD,GAClD,GACd,CACP,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACtD,OAAO,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,kBAAE,QAAQ,GAAqB,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/**\n * A press or a focus outside the dialog, or a phone sheet pulled down to close; `event.detail.originalEvent` is the\n * browser's event (a TouchEvent for the sheet).\n */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent | TouchEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /**\n * Where a phone sheet stands at 767px and below: `bottom`, or `fullscreen` for the whole screen. `center` is the\n * alert's place: without `mobileVariant` it makes the dialog an alert. @default \"fullscreen\" for a fullscreen\n * dialog, else \"bottom\"\n */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /**\n * The iOS presentation at 767px and below. A phone has two modal views: the sheet, which iOS gives any view it\n * presents, and the alert, a short question with its answers (UIAlertController). @default \"sheet\"\n */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog, and on a phone sheet pulled down to close, before it closes. Call\n * `event.preventDefault()` to keep it open, such as for a form with unsaved changes (the sheet then returns, as an\n * iOS sheet does under `isModalInPresentation`), or for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant: requestedMobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n // A phone has no other modal view than the sheet and the alert (owner 12.11: «нет такого в iOS»): a centered\n // dialog is an alert, any other a sheet, at the bottom or over the whole screen.\n const mobileVariant = requestedMobileVariant ?? (requestedMobilePlacement === \"center\" ? \"alert\" : \"sheet\")\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : (requestedMobilePlacement ?? placement) === \"fullscreen\" ? \"fullscreen\" : \"bottom\"\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n // A sheet crosses the screen on a phone, and wherever its owner asked for one; a dialog left to its defaults stays\n // the centred panel on a desktop, with that panel's timing.\n const phone = usePhoneLayout() || layout === \"phone\"\n const sheetCrosses = (phone || requestedMobileVariant === \"sheet\" || requestedMobilePlacement !== undefined) &&\n (mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\")\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || sheetCrosses\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n // A sheet pulled down asks as a press outside does: an owner that keeps the dialog open on one, such as a form\n // with unsaved changes, keeps it on the other, and the sheet returns.\n const dismissByDrag = useStableCallback((originalEvent: TouchEvent) => {\n if (onInteractOutside) {\n const request: DialogInteractOutsideEvent = new CustomEvent(\"dialog.sheetDrag\", { cancelable: true, detail: { originalEvent } })\n onInteractOutside(request)\n if (request.defaultPrevented) return false\n }\n setOpen(false)\n return true\n })\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, dismissByDrag)\n }, [panel, mobilePlacement, dismissByDrag])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isLeadingAction = (part: ReactNode): part is ReactElement<DialogHeaderActionProps> =>\n isHeaderAction(part) && (part.props as DialogHeaderActionProps).side === \"leading\"\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row 16px under the top edge.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {/* A step's Back takes the leading place, as the back button of a screen pushed inside an iOS sheet */}\n {sheet.showClose && !parts.some(isLeadingAction) && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n {parts.filter(isLeadingAction)}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={background} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nexport type DialogHeaderActionProps = DialogSlotProps & {\n /**\n * `leading` puts the action before the title, such as the Back of a step in `Dialog.Steps`: on a phone Sheet it\n * takes the place of Close, as the back button of a screen pushed inside an iOS sheet does.\n * @default \"trailing\"\n */\n side?: \"leading\" | \"trailing\"\n}\n\nconst HeaderAction = ({ children, className, side = \"trailing\" }: DialogHeaderActionProps) => {\n const bar = useContext(DialogBarContext)\n if (bar && side === \"leading\") return <Toolbar.Leading className={clsx(s.BarClose, className)}>{children}</Toolbar.Leading>\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)} data-side={side === \"leading\" ? \"leading\" : undefined}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet stacks its main action on top, as an iOS setup sheet does. A footer is written with it last,\n // where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the\n // actions in the order they are seen.\n const parts = sheet && phone && mobileLayout !== \"inline\" ? headerParts(children).reverse() : children\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {parts}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../../src/components/Dialog/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gBAAgB,EAAE,cAAc,EAAE,iBAAiB,YAC5K,kCAAiC,EAAE,EAAC,QAAQ,EAAE,CAAC,CAAC,YAAG,QAAQ,IAAjD,IAAI,CAAoD,GAClD,GACd,CACP,CAAA;AAED,MAAM,KAAK,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IACtD,OAAO,KAAC,WAAW,CAAC,KAAK,IAAC,OAAO,kBAAE,QAAQ,GAAqB,CAAA;AAClE,CAAC,CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAA;AACxB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,YAAY,GAAG,YAAY,CAAA;AAClC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAA;AAClB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAA;AACtB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,WAAW,GAAG,WAAW,CAAA;AAChC,MAAM,CAAC,eAAe,GAAG,eAAe,CAAA;AACxC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA;AACpB,MAAM,CAAC,KAAK,GAAG,KAAK,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport { Dialog as RadixDialog } from \"radix-ui\"\nimport {\n Children,\n cloneElement,\n createContext,\n Fragment,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type ReactElement,\n type ReactNode,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { useEscCloseStack } from \"../../hooks/useEscCloseStack\"\nimport { inToastRegion } from \"../../lib/toastRegion\"\nimport { cancelableKeyCopy, dataAttributes, keepMovedFocus, preventDefaultHandler, toCssVariables } from \"../../lib/helpers\"\nimport { useStableCallback } from \"../../hooks/useStableCallback\"\nimport { NavigationButton } from \"../Button/NavigationButton\"\nimport { barBackground, Toolbar, ToolbarHostContext, type BarBackground, type BarBackgroundAlias, type ToolbarHost } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport { TransitionGroup } from \"../Transition\"\nimport { createExitGuard, overlayTiming, overlayTimingLarge } from \"../Transition/shared\"\nimport { attachSheetDrag } from \"./sheetDrag\"\nimport { watchDialogViewport } from \"./dialogViewport\"\nimport { enterStep, leaveStep, releaseStepHeight, settleStepHeight, STEP_TIMING } from \"./dialogSteps\"\nimport { PhoneLayoutContext, usePhoneLayout, type PhoneLayoutValue } from \"../PhoneLayout/PhoneLayout\"\nimport { usePopoverDismissableSurface } from \"../Popover/deferredOutsidePress\"\nimport s from \"@plexui/styles/components/Dialog/Dialog.module.css\"\nimport t from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\ntype DialogContextValue = {\n open: boolean\n setOpen: (nextState: boolean) => void\n}\n\nconst DOUBLE_CLICK = 300\n\nconst DialogContext = createContext<DialogContextValue | null>(null)\n\nconst useDialogContext = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw new Error(\"Dialog compound components must be used inside <Dialog>\")\n }\n\n return context\n}\n\nexport type DialogProps = {\n open?: boolean\n onOpenChange?: (open: boolean) => void\n children: ReactNode\n}\n\nexport const Dialog = ({\n open: controlledOpen,\n onOpenChange: controlledOnOpenChange,\n children,\n}: DialogProps) => {\n const [open, setOpen] = useState<boolean>(false)\n const isOpen = controlledOpen ?? open\n\n const handleOpenChange = useCallback(\n (nextState: boolean) => {\n controlledOnOpenChange?.(nextState)\n setOpen(nextState)\n },\n [controlledOnOpenChange],\n )\n\n const store = useMemo<DialogContextValue>(\n () => ({\n open: isOpen,\n setOpen: handleOpenChange,\n }),\n [isOpen, handleOpenChange],\n )\n\n return (\n <DialogContext value={store}>\n <RadixDialog.Root open={isOpen} onOpenChange={handleOpenChange}>\n {children}\n </RadixDialog.Root>\n </DialogContext>\n )\n}\n\nconst Trigger = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Trigger asChild>{children}</RadixDialog.Trigger>\n}\n\nexport type DialogPlacement = \"center\" | \"top\" | \"bottom\" | \"start\" | \"end\" | \"fullscreen\"\n\n/**\n * A press or a focus outside the dialog, or a phone sheet pulled down to close; `event.detail.originalEvent` is the\n * browser's event (a TouchEvent for the sheet).\n */\nexport type DialogInteractOutsideEvent = CustomEvent<{ originalEvent: PointerEvent | FocusEvent | TouchEvent }>\n\n/** Class, style and data attributes for one of the dialog's layers. */\nexport type DialogLayerProps = {\n className?: string\n style?: CSSProperties\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nexport type DialogContentProps = {\n children: ReactNode\n width?: number | string\n showClose?: boolean\n /**\n * Rounder panel and a round close button, for dialogs that sit beside pill controls.\n * @default false\n */\n pill?: boolean\n className?: string\n /**\n * Where the panel sits: centered, near the top (search, command lists),\n * a sheet along the bottom, a full-height panel on the start or end side,\n * or the whole screen.\n * @default center\n */\n placement?: DialogPlacement\n /**\n * Where a phone sheet stands at 767px and below: `bottom`, or `fullscreen` for the whole screen. `center` is the\n * alert's place: without `mobileVariant` it makes the dialog an alert. @default \"fullscreen\" for a fullscreen\n * dialog, else \"bottom\"\n */\n mobilePlacement?: Extract<DialogPlacement, \"center\" | \"bottom\" | \"fullscreen\">\n /**\n * The iOS presentation at 767px and below. A phone has two modal views: the sheet, which iOS gives any view it\n * presents, and the alert, a short question with its answers (UIAlertController). @default \"sheet\"\n */\n mobileVariant?: \"alert\" | \"sheet\"\n /** Mobile panel palette; dark mode uses elevated surfaces. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n /**\n * Called when focus moves into the dialog on open. Call\n * `event.preventDefault()` to focus something else yourself.\n */\n onOpenAutoFocus?: (event: Event) => void\n /** Called when focus returns on close. Call `event.preventDefault()` to keep it elsewhere. */\n onCloseAutoFocus?: (event: Event) => void\n /**\n * Called on Escape before the dialog closes. Call `event.preventDefault()` to keep it open, such as for a form\n * with unsaved changes.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void\n /**\n * Called on a press or a focus outside the dialog, and on a phone sheet pulled down to close, before it closes. Call\n * `event.preventDefault()` to keep it open, such as for a form with unsaved changes (the sheet then returns, as an\n * iOS sheet does under `isModalInPresentation`), or for a press on a developer panel over the page.\n */\n onInteractOutside?: (event: DialogInteractOutsideEvent) => void\n /** Stack order of the overlay and the dialog. @default 50 */\n zIndex?: number\n /** Class, style and data attributes for the fixed layer that holds the panel. Data attributes of Content land here too. */\n rootProps?: DialogLayerProps\n /** Class, style and data attributes for the overlay. */\n overlayProps?: DialogLayerProps\n /**\n * `phone` lays the dialog out as on a phone at any window width. Inside a PhoneLayout it always is.\n * @default \"auto\"\n */\n layout?: \"auto\" | \"phone\"\n [dataAttribute: `data-${string}`]: string | number | boolean | undefined\n}\n\nconst Content = ({\n children,\n width = 480,\n showClose = true,\n pill = false,\n className,\n placement = \"center\",\n mobilePlacement: requestedMobilePlacement,\n mobileVariant: requestedMobileVariant,\n surface = \"plain\",\n onOpenAutoFocus,\n onCloseAutoFocus,\n onEscapeKeyDown,\n onInteractOutside,\n zIndex,\n rootProps,\n overlayProps,\n layout = \"auto\",\n ...rest\n}: DialogContentProps) => {\n const { open, setOpen } = useDialogContext()\n const outerPhoneLayout = useContext(PhoneLayoutContext)\n // A dialog laid out as on a phone by its own prop, outside a PhoneLayout, keeps the window: what it holds and\n // the dialogs it opens are phone ones too.\n const phoneLayout = useMemo<PhoneLayoutValue | null>(\n () => outerPhoneLayout ?? (layout === \"phone\" ? { container: null } : null),\n [outerPhoneLayout, layout],\n )\n const [content, setContent] = useState<HTMLDivElement | null>(null)\n useDialogViewport(content, outerPhoneLayout?.container ?? null)\n const overlaySurfaceRef = usePopoverDismissableSurface()\n // A phone has no other modal view than the sheet and the alert (owner 12.11: «нет такого в iOS»): a centered\n // dialog is an alert, any other a sheet, at the bottom or over the whole screen.\n const mobileVariant = requestedMobileVariant ?? (requestedMobilePlacement === \"center\" ? \"alert\" : \"sheet\")\n const mobilePlacement =\n mobileVariant === \"alert\"\n ? \"center\"\n : (requestedMobilePlacement ?? placement) === \"fullscreen\" ? \"fullscreen\" : \"bottom\"\n const [exitGuard] = useState(createExitGuard)\n const [panel, setPanel] = useState<HTMLDivElement | null>(null)\n // Dialog.Body reports where content lies under the bars: they show their lines with it.\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const scroll = useMemo(() => ({ edges, setEdges }), [edges, setEdges])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"dialog\", scrolled: edges.scrolled, contentBelow: edges.contentBelow }), [edges])\n // Where a phone Sheet's description goes: the first text of the content, under the bar. Dialog.Body offers\n // its top; a Dialog.DescriptionSlot of the content's own, such as a scroller inside a form, comes first.\n const [bodySlot, setBodySlot] = useState<HTMLElement | null>(null)\n const [ownSlot, setOwnSlot] = useState<HTMLElement | null>(null)\n const descriptionSlot = ownSlot ?? bodySlot\n const sheet = useMemo<DialogSheetValue | null>(\n () => (mobileVariant === \"sheet\" ? { showClose, descriptionSlot, setBodySlot, setOwnSlot } : null),\n [mobileVariant, showClose, descriptionSlot],\n )\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setPanelRef = useCallback((node: HTMLDivElement | null) => { setPanel(node); setRoot(node) }, [setRoot])\n const openedAt = useRef(0)\n // A sheet crosses the screen on a phone, and wherever its owner asked for one; a dialog left to its defaults stays\n // the centred panel on a desktop, with that panel's timing.\n const phone = usePhoneLayout() || layout === \"phone\"\n const sheetCrosses = (phone || requestedMobileVariant === \"sheet\" || requestedMobilePlacement !== undefined) &&\n (mobilePlacement === \"bottom\" || mobilePlacement === \"fullscreen\")\n const crossesScreen =\n placement === \"bottom\" || placement === \"start\" || placement === \"end\" || placement === \"fullscreen\" || sheetCrosses\n\n // The content of a closing dialog is frozen for its exit, so this reads the owner's latest\n // handler: state that changes together with the close decides where focus returns.\n const handleCloseAutoFocus = useStableCallback((event: Event) => {\n onCloseAutoFocus?.(event)\n keepMovedFocus(event)\n })\n\n useEscCloseStack(open, (event) => {\n if (onEscapeKeyDown) {\n const request = cancelableKeyCopy(event)\n onEscapeKeyDown(request)\n if (request.defaultPrevented) return\n }\n setOpen(false)\n })\n\n useEffect(() => {\n if (open) openedAt.current = performance.now()\n }, [open])\n\n // A sheet pulled down asks as a press outside does: an owner that keeps the dialog open on one, such as a form\n // with unsaved changes, keeps it on the other, and the sheet returns.\n const dismissByDrag = useStableCallback((originalEvent: TouchEvent) => {\n if (onInteractOutside) {\n const request: DialogInteractOutsideEvent = new CustomEvent(\"dialog.sheetDrag\", { cancelable: true, detail: { originalEvent } })\n onInteractOutside(request)\n if (request.defaultPrevented) return false\n }\n setOpen(false)\n return true\n })\n\n useEffect(() => {\n if (!panel || mobilePlacement !== \"bottom\") return undefined\n return attachSheetDrag(panel, dismissByDrag)\n }, [panel, mobilePlacement, dismissByDrag])\n\n useLayoutEffect(() => {\n if (!panel) return\n const update = () => {\n // A phone Toolbar takes the place of the header or footer bar on its side: one the dialog places itself\n // before the bar its header becomes.\n const header = panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}:not([data-dialog-bar])`)\n ?? panel.querySelector<HTMLElement>(`:scope > ${TOP_TOOLBAR}`)\n ?? panel.querySelector<HTMLElement>(`:scope > .${s.Header}`)\n const footer = panel.querySelector<HTMLElement>(`:scope > ${BOTTOM_TOOLBAR}`) ?? panel.querySelector<HTMLElement>(`:scope > .${s.Footer}`)\n panel.style.setProperty(\"--dialog-header-height\", `${header?.offsetHeight ?? 0}px`)\n panel.style.setProperty(\"--dialog-footer-height\", `${footer?.offsetHeight ?? 0}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeBars = () => {\n observer?.disconnect()\n panel.querySelectorAll<HTMLElement>(`:scope > .${s.Header}, :scope > .${s.Footer}, :scope > [data-toolbar]`)\n .forEach((bar) => observer?.observe(bar, { box: \"border-box\" }))\n update()\n }\n observeBars()\n // A form can add or remove its action bar while the dialog stays open.\n const children = new MutationObserver(observeBars)\n children.observe(panel, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [panel])\n\n const layerStyle = toCssVariables({ \"dialog-z-index\": zIndex === undefined ? undefined : String(zIndex) })\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PhoneLayoutContext value={phoneLayout}>\n <RadixDialog.Portal forceMount container={outerPhoneLayout?.container ?? undefined}>\n {/* Portaled out of any phone layout, a phone dialog carries its own scope, above its transition: the phone\n rules of the style sheet start there. */}\n <PhoneScope enabled={phoneLayout !== null && !outerPhoneLayout?.container}>\n {/* A dialog mounted open enters too, as `open` set with the mount does */}\n <TransitionGroup\n {...(crossesScreen ? overlayTimingLarge : overlayTiming)}\n {...exitGuard.transition}\n className={s.Transition}\n overlay\n preventInitialTransition={false}\n >\n {open && (\n <div key=\"dialog\">\n <RadixDialog.Overlay\n {...overlayProps}\n ref={overlaySurfaceRef}\n className={clsx(s.Overlay, overlayProps?.className)}\n style={{ ...layerStyle, ...overlayProps?.style }}\n />\n <RadixDialog.Content\n {...dataAttributes(rest)}\n {...rootProps}\n ref={setContent}\n forceMount\n className={clsx(s.Content, rootProps?.className)}\n data-plex-dialog=\"\"\n style={{ ...toCssVariables({ \"dialog-width\": width }), ...layerStyle, ...rootProps?.style }}\n data-placement={placement === \"center\" ? undefined : placement}\n data-mobile-placement={mobilePlacement}\n data-mobile-variant={mobileVariant}\n data-surface={surface}\n data-pill={pill ? \"\" : undefined}\n onEscapeKeyDown={preventDefaultHandler}\n onInteractOutside={(event) => {\n // A press or focus in a toast is not outside: the toast region is a layer above the dialog. The\n // Toaster stops these before Radix sees them; this holds when the Toaster mounted after the dialog.\n if (inToastRegion(event.detail.originalEvent.target)) return event.preventDefault()\n onInteractOutside?.(event)\n if (event.defaultPrevented) return\n // The second click of a double click lands on the overlay: it must not undo the first\n if (performance.now() - openedAt.current < DOUBLE_CLICK) event.preventDefault()\n else exitGuard.onInteractOutside(event)\n }}\n onOpenAutoFocus={onOpenAutoFocus}\n onCloseAutoFocus={handleCloseAutoFocus}\n >\n <div ref={setPanelRef} className={clsx(s.Panel, className)}>\n {showClose && (\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" className={s.CloseButton} aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n )}\n <DialogScrollContext.Provider value={scroll}>\n <DialogSheetContext.Provider value={sheet}>\n {/* A dialog opened from a header action is not inside that header's bar */}\n <DialogBarContext.Provider value={false}>\n <ToolbarHostContext.Provider value={toolbarHost}>{children}</ToolbarHostContext.Provider>\n </DialogBarContext.Provider>\n </DialogSheetContext.Provider>\n </DialogScrollContext.Provider>\n </div>\n </RadixDialog.Content>\n </div>\n )}\n </TransitionGroup>\n </PhoneScope>\n </RadixDialog.Portal>\n </PhoneLayoutContext>\n </FloatingBoundaryProvider>\n )\n}\n\ntype DialogScrollValue = { edges: ScrollEdges; setEdges: (edges: ScrollEdges) => void }\nconst DialogScrollContext = createContext<DialogScrollValue | null>(null)\n// What the header of a Sheet needs from its Content to become the Sheet's bar on a phone\ntype DialogSheetValue = {\n showClose: boolean\n descriptionSlot: HTMLElement | null\n setBodySlot: (slot: HTMLElement | null) => void\n setOwnSlot: (slot: HTMLElement | null) => void\n}\nconst DialogSheetContext = createContext<DialogSheetValue | null>(null)\n// Inside that bar: the title, the description and the header actions take the Toolbar's parts\nconst DialogBarContext = createContext(false)\n\nconst PhoneScope = ({ enabled, children }: { enabled: boolean; children: ReactNode }) =>\n enabled ? <div className={s.PhoneScope} data-plex-layout=\"phone\">{children}</div> : children\n\nconst useDialogViewport = (content: HTMLElement | null, container: HTMLElement | null) => {\n useLayoutEffect(() => (content ? watchDialogViewport(content, container) : undefined), [content, container])\n}\nconst TOP_TOOLBAR = '[data-toolbar][data-placement=\"top\"]'\nconst BOTTOM_TOOLBAR = '[data-toolbar][data-placement=\"bottom\"]'\n\ntype DialogSlotProps = {\n children: ReactNode\n className?: string\n}\n\n/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */\nexport type DialogBarBackground = BarBackground | BarBackgroundAlias\nexport type DialogHeaderProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"glass\" */\n background?: DialogBarBackground\n}\n\n// The header's own parts, fragments opened up, so its actions can stand at the end of the bar. A part from a\n// fragment keeps the fragment's key before its own, so two parts never share a key.\nconst headerParts = (children: ReactNode, prefix = \"\"): ReactNode[] =>\n Children.toArray(children).flatMap((part) => {\n if (!isValidElement<{ children?: ReactNode }>(part)) return [part]\n if (part.type === Fragment) return headerParts(part.props.children, `${prefix}${String(part.key)}/`)\n return [prefix ? cloneElement(part, { key: `${prefix}${String(part.key)}` }) : part]\n })\nconst isHeaderAction = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === HeaderAction\nconst isLeadingAction = (part: ReactNode): part is ReactElement<DialogHeaderActionProps> =>\n isHeaderAction(part) && (part.props as DialogHeaderActionProps).side === \"leading\"\nconst isDescription = (part: ReactNode): part is ReactElement => isValidElement(part) && part.type === Description\n\nconst Header = ({ children, className, background = \"glass\" }: DialogHeaderProps) => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const scrolled = useContext(DialogScrollContext)?.edges.scrolled\n if (sheet && phone) {\n const parts = headerParts(children)\n const descriptions = parts.filter(isDescription)\n // The description reads as the first text of the content, at the top of Dialog.Body when there is one\n const description = descriptions.length > 0 && <div className={s.SheetDescription}>{descriptions}</div>\n // On a phone the header of a Sheet is its Toolbar (iOS 27 kit Sheets 507-24684, Toolbar - Top - iPhone\n // 1-54520): Close at the leading edge, the title alone centered on the row of controls, the header actions\n // at the trailing edge, all on one 44px row 16px under the top edge.\n return (\n <>\n <Toolbar background={background} className={className} data-dialog-bar=\"\">\n <DialogBarContext.Provider value={true}>\n {/* A step's Back takes the leading place, as the back button of a screen pushed inside an iOS sheet */}\n {sheet.showClose && !parts.some(isLeadingAction) && (\n <Toolbar.Leading className={s.BarClose}>\n <RadixDialog.Close asChild>\n <NavigationButton action=\"close\" variant=\"ghost\" aria-label=\"Close dialog\" />\n </RadixDialog.Close>\n </Toolbar.Leading>\n )}\n {parts.filter(isLeadingAction)}\n <div className={clsx(t.Heading, s.BarHeading)}>{parts.filter((part) => !isHeaderAction(part) && !isDescription(part))}</div>\n {parts.filter((part) => isHeaderAction(part) && !isLeadingAction(part))}\n </DialogBarContext.Provider>\n </Toolbar>\n {description && (sheet.descriptionSlot ? createPortal(description, sheet.descriptionSlot) : description)}\n </>\n )\n }\n return <div className={clsx(s.Header, className)} data-background={barBackground(background)} data-scrolled={scrolled ? \"\" : undefined}>{children}</div>\n}\n\nexport type DialogHeaderActionProps = DialogSlotProps & {\n /**\n * `leading` puts the action before the title, such as the Back of a step in `Dialog.Steps`: on a phone Sheet it\n * takes the place of Close, as the back button of a screen pushed inside an iOS sheet does.\n * @default \"trailing\"\n */\n side?: \"leading\" | \"trailing\"\n}\n\nconst HeaderAction = ({ children, className, side = \"trailing\" }: DialogHeaderActionProps) => {\n const bar = useContext(DialogBarContext)\n if (bar && side === \"leading\") return <Toolbar.Leading className={clsx(s.BarClose, className)}>{children}</Toolbar.Leading>\n if (bar) return <Toolbar.Trailing className={className}>{children}</Toolbar.Trailing>\n return <div className={clsx(s.HeaderAction, className)} data-side={side === \"leading\" ? \"leading\" : undefined}>{children}</div>\n}\n\n/** The scrolling part between Header and Footer: with it, only the body scrolls */\nconst Body = ({ children, className }: DialogSlotProps) => {\n const setEdges = useContext(DialogScrollContext)?.setEdges\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet's description starts the body (Dialog.Header portals it here)\n const setDescriptionSlot = sheet && phone ? sheet.setBodySlot : null\n const element = useRef<HTMLDivElement | null>(null)\n useLayoutEffect(() => {\n const body = element.current\n if (!body || !setEdges) return\n const stop = observeScrollEdges(body, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n return (\n <div ref={element} className={clsx(s.Body, className)}>\n {setDescriptionSlot && <div ref={setDescriptionSlot} className={s.SheetDescriptionSlot} />}\n {children}\n </div>\n )\n}\n\n/**\n * Where a phone Sheet's description goes in content of your own, such as a scroller inside a form so that Enter\n * submits: the description starts it, as it starts Dialog.Body, and it comes before the body's place. It renders\n * nothing outside a phone Sheet.\n */\nconst DescriptionSlot = () => {\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n const setOwnSlot = sheet && phone ? sheet.setOwnSlot : null\n return setOwnSlot ? <div ref={setOwnSlot} className={s.SheetDescriptionSlot} /> : null\n}\n\nexport type DialogFooterProps = DialogSlotProps & {\n /** How the bar meets the content scrolled under it in a phone Sheet. @default \"soft\" */\n background?: DialogBarBackground\n /** Override the mobile action layout. Two alert actions default to inline, three or more and sheets to stacked. */\n mobileLayout?: \"inline\" | \"stacked\"\n}\n\nconst Footer = ({ children, className, mobileLayout, background = \"soft\" }: DialogFooterProps) => {\n const setFooter = useFloatingBoundaryRegistration()?.setFooter\n const contentBelow = useContext(DialogScrollContext)?.edges.contentBelow\n const sheet = useContext(DialogSheetContext)\n const phone = usePhoneLayout()\n // A phone Sheet stacks its main action on top, as an iOS setup sheet does. A footer is written with it last,\n // where a desktop row ends, so the order is turned in the page itself: focus and a screen reader meet the\n // actions in the order they are seen.\n const parts = sheet && phone && mobileLayout !== \"inline\" ? headerParts(children).reverse() : children\n return (\n <div\n ref={setFooter}\n className={clsx(s.Footer, className)}\n data-mobile-layout={mobileLayout}\n data-background={barBackground(background)}\n data-content-below={contentBelow ? \"\" : undefined}\n >\n {parts}\n </div>\n )\n}\n\nconst Title = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n return <RadixDialog.Title className={clsx(bar ? t.Title : s.Title, className)}>{children}</RadixDialog.Title>\n}\n\nconst Description = ({ children, className }: DialogSlotProps) => {\n const bar = useContext(DialogBarContext)\n const element = useRef<HTMLParagraphElement | null>(null)\n const [shown, setShown] = useState(false)\n useLayoutEffect(() => {\n // The header leaves its own descriptions out of the bar. One the bar still holds, inside a part of the\n // header's own, is the title's second line (Toolbar's subtitle) when the reader sees it; one that is only\n // read out, visually hidden, leaves the title on its one line.\n const node = element.current\n // A measurement of the laid-out description, which only an effect after layout can read\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setShown(bar && !!node && node.offsetHeight > 1 && node.offsetWidth > 1)\n }, [bar, children, className])\n return (\n <RadixDialog.Description ref={element} className={clsx(bar && shown ? t.Subtitle : s.Description, className)}>\n {children}\n </RadixDialog.Description>\n )\n}\n\nexport type DialogStepsProps = {\n /** The step on screen. A new value brings its content in. */\n step: string | number\n /**\n * `forward` brings the new step in from the trailing edge over the one before, as a push on iOS; `back` returns to\n * a step before it.\n * @default \"forward\"\n */\n direction?: \"forward\" | \"back\"\n children: ReactNode\n className?: string\n}\n\n/** The steps of a flow inside a dialog, such as a sign-in that asks for an email and then a code. */\nconst Steps = ({ step, direction = \"forward\", children, className }: DialogStepsProps) => (\n <div className={clsx(s.Steps, className)} data-direction={direction}>\n <TransitionGroup {...STEP_TIMING} as=\"div\" overlay className={s.Step} onEnter={enterStep} onExit={leaveStep} onExitActive={settleStepHeight} onExitComplete={releaseStepHeight}>\n <div key={step} data-dialog-step=\"\" tabIndex={-1}>{children}</div>\n </TransitionGroup>\n </div>\n)\n\nconst Close = ({ children }: { children: ReactNode }) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>\n}\n\nDialog.Trigger = Trigger\nDialog.Content = Content\nDialog.Header = Header\nDialog.HeaderAction = HeaderAction\nDialog.Body = Body\nDialog.Footer = Footer\nDialog.Title = Title\nDialog.Description = Description\nDialog.DescriptionSlot = DescriptionSlot\nDialog.Close = Close\nDialog.Steps = Steps\n"]}
|
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { createContext, useContext, useCallback, useMemo, useLayoutEffect, useRef, useState, } from "react";
|
|
5
5
|
import { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from "../../hooks/useFloatingBoundary.js";
|
|
6
|
-
import { ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
6
|
+
import { barBackground, ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
7
7
|
import { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges } from "../../lib/scrollEdges.js";
|
|
8
8
|
import s from "@plexui/styles/components/Page/Page.module.css";
|
|
9
|
+
/**
|
|
10
|
+
* Follows the rows of a large title's bar (Toolbar.Row) in the content. They stand under the title and, scrolled up to
|
|
11
|
+
* the bar, stay under its controls (`position: sticky`): they are pinned once the sticky offset moves them off the
|
|
12
|
+
* title's bottom, where they would stand. It reports that and their height, which the bar's background takes in.
|
|
13
|
+
*/
|
|
14
|
+
function followTitleRows(content, rows, report) {
|
|
15
|
+
let last = "";
|
|
16
|
+
const update = () => {
|
|
17
|
+
const height = rows.offsetHeight;
|
|
18
|
+
const title = rows.previousElementSibling;
|
|
19
|
+
const pinned = height > 0 && !!title && rows.getBoundingClientRect().top - title.getBoundingClientRect().bottom > 0.5;
|
|
20
|
+
if (`${pinned} ${height}` === last)
|
|
21
|
+
return;
|
|
22
|
+
last = `${pinned} ${height}`;
|
|
23
|
+
report(pinned, height);
|
|
24
|
+
};
|
|
25
|
+
update();
|
|
26
|
+
content.addEventListener("scroll", update, { passive: true });
|
|
27
|
+
const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
|
|
28
|
+
observer?.observe(rows);
|
|
29
|
+
observer?.observe(content);
|
|
30
|
+
// The title changing its height (a subtitle shown or gone) moves the rows with no scroll (Codex #7).
|
|
31
|
+
const title = rows.previousElementSibling;
|
|
32
|
+
if (title)
|
|
33
|
+
observer?.observe(title);
|
|
34
|
+
return () => {
|
|
35
|
+
content.removeEventListener("scroll", update);
|
|
36
|
+
observer?.disconnect();
|
|
37
|
+
report(false, 0);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
9
40
|
const PageContext = createContext(null);
|
|
10
41
|
function usePageContext(part) {
|
|
11
42
|
const context = useContext(PageContext);
|
|
@@ -17,14 +48,12 @@ function usePageContext(part) {
|
|
|
17
48
|
function PageRoot({ width = "full", surface = "plain", className, children, style, ref, ...restProps }) {
|
|
18
49
|
const boundary = useFloatingBoundaryScope();
|
|
19
50
|
const setRoot = boundary.setRoot;
|
|
20
|
-
const root = useRef(null);
|
|
21
51
|
const setRef = useCallback((node) => {
|
|
22
|
-
root.current = node;
|
|
23
52
|
setRoot(node);
|
|
24
53
|
if (typeof ref === "function") {
|
|
25
54
|
const cleanup = ref(node);
|
|
26
55
|
if (typeof cleanup === "function")
|
|
27
|
-
return () => {
|
|
56
|
+
return () => { setRoot(null); cleanup(); };
|
|
28
57
|
return;
|
|
29
58
|
}
|
|
30
59
|
if (ref)
|
|
@@ -34,8 +63,6 @@ function PageRoot({ width = "full", surface = "plain", className, children, styl
|
|
|
34
63
|
const setEdges = useCallback((next) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), []);
|
|
35
64
|
const [footerHeight, setFooterHeight] = useState(0);
|
|
36
65
|
const [headerHeight, setHeaderHeight] = useState();
|
|
37
|
-
// Written straight to the element: a scroll frame must not render the page again.
|
|
38
|
-
const setScrollY = useCallback((scrollY) => root.current?.style.setProperty("--page-scroll-y", String(Math.max(0, scrollY))), []);
|
|
39
66
|
const scrollListeners = useRef(new Set());
|
|
40
67
|
const notifyScroll = useCallback((scrollY) => scrollListeners.current.forEach((listener) => listener(scrollY)), []);
|
|
41
68
|
const subscribeScroll = useCallback((listener) => {
|
|
@@ -43,17 +70,41 @@ function PageRoot({ width = "full", surface = "plain", className, children, styl
|
|
|
43
70
|
listeners.add(listener);
|
|
44
71
|
return () => { listeners.delete(listener); };
|
|
45
72
|
}, []);
|
|
46
|
-
|
|
73
|
+
// A large Toolbar title lives in the content, where the browser scrolls it with the content and its overscroll;
|
|
74
|
+
// Page.Content keeps a place for it at its top while a title asks for one.
|
|
75
|
+
const [largeTitleRequests, setLargeTitleRequests] = useState(0);
|
|
76
|
+
const [largeTitleSlot, setLargeTitleSlot] = useState(null);
|
|
77
|
+
const requestLargeTitleSlot = useCallback(() => {
|
|
78
|
+
setLargeTitleRequests((count) => count + 1);
|
|
79
|
+
return () => setLargeTitleRequests((count) => count - 1);
|
|
80
|
+
}, []);
|
|
81
|
+
const largeTitle = largeTitleRequests > 0;
|
|
82
|
+
// The bar's rows under a large title have a place of their own under it, which pins them under the bar once scrolled.
|
|
83
|
+
const [largeTitleRowSlot, setLargeTitleRowSlot] = useState(null);
|
|
84
|
+
const [titleRows, setTitleRowsState] = useState({ pinned: false, height: 0 });
|
|
85
|
+
const setTitleRows = useCallback((pinned, height) => setTitleRowsState((current) => (current.pinned === pinned && current.height === height ? current : { pinned, height })), []);
|
|
86
|
+
const context = useMemo(() => ({ edges, setEdges, setFooterHeight, setHeaderHeight, notifyScroll, largeTitle, setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, setTitleRows }), [edges, setEdges, notifyScroll, largeTitle, largeTitleRowSlot, setTitleRows]);
|
|
47
87
|
// A phone Toolbar replaces the header and footer bars; it reports its own heights.
|
|
48
88
|
const [toolbarTop, setToolbarTop] = useState();
|
|
49
89
|
const [toolbarBottom, setToolbarBottom] = useState();
|
|
50
90
|
const setToolbarHeight = useCallback((placement, height) => (placement === "top" ? setToolbarTop : setToolbarBottom)(height), []);
|
|
51
|
-
const toolbarHost = useMemo(() => ({
|
|
91
|
+
const toolbarHost = useMemo(() => ({
|
|
92
|
+
kind: "page",
|
|
93
|
+
setHeight: setToolbarHeight,
|
|
94
|
+
scrolled: edges.scrolled,
|
|
95
|
+
contentBelow: edges.contentBelow,
|
|
96
|
+
subscribeScroll,
|
|
97
|
+
requestLargeTitleSlot,
|
|
98
|
+
largeTitleSlot: largeTitle ? largeTitleSlot : null,
|
|
99
|
+
largeTitleRowSlot: largeTitle ? largeTitleRowSlot : null,
|
|
100
|
+
rowsPinned: largeTitle && titleRows.pinned,
|
|
101
|
+
}), [setToolbarHeight, edges, subscribeScroll, requestLargeTitleSlot, largeTitle, largeTitleSlot, largeTitleRowSlot, titleRows.pinned]);
|
|
52
102
|
const pageStyle = {
|
|
53
103
|
"--page-footer-height": `${footerHeight}px`,
|
|
54
104
|
...(headerHeight !== undefined ? { "--page-header-height": `${headerHeight}px` } : {}),
|
|
55
105
|
...(toolbarTop !== undefined ? { "--page-toolbar-height": `${toolbarTop}px` } : {}),
|
|
56
106
|
...(toolbarBottom !== undefined ? { "--page-toolbar-bottom-height": `${toolbarBottom}px` } : {}),
|
|
107
|
+
...(titleRows.height > 0 ? { "--page-toolbar-rows-height": `${titleRows.height}px` } : {}),
|
|
57
108
|
...style,
|
|
58
109
|
};
|
|
59
110
|
return (_jsx(FloatingBoundaryProvider, { value: boundary, children: _jsx(PageContext.Provider, { value: context, children: _jsx(ToolbarHostContext.Provider, { value: toolbarHost, children: _jsx("div", { ref: setRef, className: clsx(s.Page, className), "data-width": width, "data-surface": surface, style: pageStyle, ...restProps, children: children }) }) }) }));
|
|
@@ -79,7 +130,7 @@ function PageHeader({ divider = true, background = "glass", className, children,
|
|
|
79
130
|
observer?.observe(header, { box: "border-box" });
|
|
80
131
|
return () => { observer?.disconnect(); setHeaderHeight(undefined); };
|
|
81
132
|
}, [setHeaderHeight]);
|
|
82
|
-
return (_jsx("div", { ref: setRef, className: clsx(s.Header, className), "data-background": background, "data-scrolled": scrolled ? "" : undefined, "data-divider": divider ? "" : undefined, ...restProps, children: _jsx("div", { className: s.Head, children: children }) }));
|
|
133
|
+
return (_jsx("div", { ref: setRef, className: clsx(s.Header, className), "data-background": barBackground(background), "data-scrolled": scrolled ? "" : undefined, "data-divider": divider ? "" : undefined, ...restProps, children: _jsx("div", { className: s.Head, children: children }) }));
|
|
83
134
|
}
|
|
84
135
|
PageHeader.displayName = "Page.Header";
|
|
85
136
|
function PageBar({ className, ref, ...restProps }) {
|
|
@@ -131,7 +182,7 @@ function PageActions({ className, ...restProps }) {
|
|
|
131
182
|
}
|
|
132
183
|
PageActions.displayName = "Page.Actions";
|
|
133
184
|
function PageContent({ fill = false, className, children, onScroll, ref, ...restProps }) {
|
|
134
|
-
const { setEdges,
|
|
185
|
+
const { setEdges, notifyScroll, largeTitle, setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, setTitleRows } = usePageContext("Content");
|
|
135
186
|
const element = useRef(null);
|
|
136
187
|
const setRef = useCallback((node) => {
|
|
137
188
|
element.current = node;
|
|
@@ -147,12 +198,17 @@ function PageContent({ fill = false, className, children, onScroll, ref, ...rest
|
|
|
147
198
|
const stop = observeScrollEdges(content, setEdges);
|
|
148
199
|
return () => { stop(); setEdges(NO_SCROLL_EDGES); };
|
|
149
200
|
}, [setEdges]);
|
|
201
|
+
useLayoutEffect(() => {
|
|
202
|
+
const content = element.current;
|
|
203
|
+
if (!content || !largeTitleRowSlot)
|
|
204
|
+
return;
|
|
205
|
+
return followTitleRows(content, largeTitleRowSlot, setTitleRows);
|
|
206
|
+
}, [largeTitleRowSlot, setTitleRows]);
|
|
150
207
|
const handleScroll = (event) => {
|
|
151
|
-
setScrollY(event.currentTarget.scrollTop);
|
|
152
208
|
notifyScroll(event.currentTarget.scrollTop);
|
|
153
209
|
onScroll?.(event);
|
|
154
210
|
};
|
|
155
|
-
return (_jsx("div", { ref: setRef, className: clsx(s.Content, className), "data-fill": fill ? "" : undefined, onScroll: handleScroll, ...restProps, children:
|
|
211
|
+
return (_jsx("div", { ref: setRef, className: clsx(s.Content, className), "data-fill": fill ? "" : undefined, onScroll: handleScroll, ...restProps, children: _jsxs("div", { className: s.Column, children: [largeTitle && _jsx("div", { ref: setLargeTitleSlot, className: s.LargeTitle }), largeTitle && _jsx("div", { ref: setLargeTitleRowSlot, className: s.LargeTitleRows }), children] }) }));
|
|
156
212
|
}
|
|
157
213
|
PageContent.displayName = "Page.Content";
|
|
158
214
|
/** Actions that remain below the scrolling content, inside the page's safe area. */
|
|
@@ -182,7 +238,7 @@ function PageFooter({ className, children, background = "soft", ref, ...restProp
|
|
|
182
238
|
observer?.observe(footer, { box: "border-box" });
|
|
183
239
|
return () => { observer?.disconnect(); setFooterHeight(0); };
|
|
184
240
|
}, [setFooterHeight]);
|
|
185
|
-
return (_jsx("div", { ref: setRef, className: clsx(s.Footer, className), "data-background": background, "data-content-below": contentBelow ? "" : undefined, ...restProps, children: _jsx("div", { className: s.FooterContent, children: children }) }));
|
|
241
|
+
return (_jsx("div", { ref: setRef, className: clsx(s.Footer, className), "data-background": barBackground(background), "data-content-below": contentBelow ? "" : undefined, ...restProps, children: _jsx("div", { className: s.FooterContent, children: children }) }));
|
|
186
242
|
}
|
|
187
243
|
PageFooter.displayName = "Page.Footer";
|
|
188
244
|
/* ------------------------------------------------------------------ */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Page.js","sourceRoot":"","sources":["../../../../src/components/Page/Page.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,eAAe,EACf,MAAM,EACN,QAAQ,GAKT,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AACrI,OAAO,EAAE,kBAAkB,EAA+D,MAAM,oBAAoB,CAAA;AACpH,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAoB,MAAM,uBAAuB,CAAA;AAC9G,OAAO,CAAC,MAAM,g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IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;AACtB,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAA;AAC5B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,OAAO,GAAG,WAAW,CAAA;AAC1B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useContext,\n useCallback,\n useMemo,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type CSSProperties,\n type Ref,\n type UIEvent,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { ToolbarHostContext, type BarBackground, type ToolbarHost, type ToolbarPlacement } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. */\nexport type PageBarBackground = BarBackground\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\ntype PageContextValue = {\n /** Content under the header (scrolled) and under the footer (content below). */\n edges: ScrollEdges\n setEdges: (edges: ScrollEdges) => void\n setFooterHeight: (height: number) => void\n setHeaderHeight: (height: number | undefined) => void\n /** Writes the content's scroll offset to the page as `--page-scroll-y`, which a large Toolbar title follows. */\n setScrollY: (scrollY: number) => void\n /** Tells the bars that follow the scroll, such as a minimizing TabBar, the content's scroll offset. */\n notifyScroll: (scrollY: number) => void\n}\n\nconst PageContext = createContext<PageContextValue | null>(null)\n\nfunction usePageContext(part: string): PageContextValue {\n const context = useContext(PageContext)\n if (!context) {\n throw new Error(`Page.${part} must be used within Page`)\n }\n return context\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type PageProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Width of the column that header and content share.\n * - `\"full\"` — edge to edge, for tables (default)\n * - `\"wide\"` — 1280px, centred, for overviews\n * - `\"column\"` — 768px, centred, for settings and forms\n *\n * Set `--page-width` on the page for any other width.\n * @default \"full\"\n */\n width?: PageWidth\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageRoot({ width = \"full\", surface = \"plain\", className, children, style, ref, ...restProps }: PageProps) {\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const root = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n root.current = node\n setRoot(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { root.current = null; setRoot(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setRoot])\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const [footerHeight, setFooterHeight] = useState(0)\n const [headerHeight, setHeaderHeight] = useState<number>()\n // Written straight to the element: a scroll frame must not render the page again.\n const setScrollY = useCallback((scrollY: number) => root.current?.style.setProperty(\"--page-scroll-y\", String(Math.max(0, scrollY))), [])\n const scrollListeners = useRef(new Set<(scrollTop: number) => void>())\n const notifyScroll = useCallback((scrollY: number) => scrollListeners.current.forEach((listener) => listener(scrollY)), [])\n const subscribeScroll = useCallback((listener: (scrollTop: number) => void) => {\n const listeners = scrollListeners.current\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n }, [])\n const context = useMemo(() => ({ edges, setEdges, setFooterHeight, setHeaderHeight, setScrollY, notifyScroll }), [edges, setEdges, setScrollY, notifyScroll])\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const [toolbarTop, setToolbarTop] = useState<number>()\n const [toolbarBottom, setToolbarBottom] = useState<number>()\n const setToolbarHeight = useCallback((placement: ToolbarPlacement, height: number | undefined) => (placement === \"top\" ? setToolbarTop : setToolbarBottom)(height), [])\n const toolbarHost = useMemo<ToolbarHost>(() => ({ kind: \"page\", setHeight: setToolbarHeight, scrolled: edges.scrolled, contentBelow: edges.contentBelow, subscribeScroll }), [setToolbarHeight, edges, subscribeScroll])\n const pageStyle = {\n \"--page-footer-height\": `${footerHeight}px`,\n ...(headerHeight !== undefined ? { \"--page-header-height\": `${headerHeight}px` } : {}),\n ...(toolbarTop !== undefined ? { \"--page-toolbar-height\": `${toolbarTop}px` } : {}),\n ...(toolbarBottom !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom}px` } : {}),\n ...style,\n } as CSSProperties\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PageContext.Provider value={context}>\n <ToolbarHostContext.Provider value={toolbarHost}>\n <div ref={setRef} className={clsx(s.Page, className)} data-width={width} data-surface={surface} style={pageStyle} {...restProps}>\n {children}\n </div>\n </ToolbarHostContext.Provider>\n </PageContext.Provider>\n </FloatingBoundaryProvider>\n )\n}\nPageRoot.displayName = \"Page\"\n\n/* ------------------------------------------------------------------ */\n/* Header */\n/* ------------------------------------------------------------------ */\n\nexport type PageHeaderProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Shows a divider once the content has scrolled under the header: on a desktop layout, and on a phone\n * with a `\"hard\"` or `\"glass\"` background.\n * Turn it off when the content already draws a line of its own at that place.\n * @default true\n */\n divider?: boolean\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" */\n background?: PageBarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageHeader({ divider = true, background = \"glass\", className, children, ref, ...restProps }: PageHeaderProps) {\n const { edges: { scrolled }, setHeaderHeight } = usePageContext(\"Header\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const header = element.current\n if (!header) return\n const update = () => setHeaderHeight(header.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeaderHeight(undefined) }\n }, [setHeaderHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Header, className)}\n data-background={background}\n data-scrolled={scrolled ? \"\" : undefined}\n data-divider={divider ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.Head}>{children}</div>\n </div>\n )\n}\nPageHeader.displayName = \"Page.Header\"\n\n/* ------------------------------------------------------------------ */\n/* Slots */\n/* ------------------------------------------------------------------ */\n\nexport type PageSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction PageBar({ className, ref, ...restProps }: PageSlotProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n const children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [])\n return <div ref={setRef} className={clsx(s.Bar, className)} {...restProps} />\n}\nPageBar.displayName = \"Page.Bar\"\n\nfunction PageLeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nPageLeading.displayName = \"Page.Leading\"\n\nfunction PageHeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Heading, className)} {...restProps} />\n}\nPageHeading.displayName = \"Page.Heading\"\n\nfunction PageTitle({\n className,\n ...restProps\n}: HTMLAttributes<HTMLHeadingElement> & { ref?: Ref<HTMLHeadingElement> }) {\n return <h1 className={clsx(s.Title, className)} {...restProps} />\n}\nPageTitle.displayName = \"Page.Title\"\n\nfunction PageSubtitle({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Subtitle, className)} {...restProps} />\n}\nPageSubtitle.displayName = \"Page.Subtitle\"\n\nfunction PageActions({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Actions, className)} {...restProps} />\n}\nPageActions.displayName = \"Page.Actions\"\n\n/* ------------------------------------------------------------------ */\n/* Content */\n/* ------------------------------------------------------------------ */\n\nexport type PageContentProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The content fills the page and scrolls inside itself, as a table does: the page stops\n * scrolling from 768px up.\n * @default false\n */\n fill?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageContent({ fill = false, className, children, onScroll, ref, ...restProps }: PageContentProps) {\n const { setEdges, setScrollY, notifyScroll } = usePageContext(\"Content\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const content = element.current\n if (!content) return\n const stop = observeScrollEdges(content, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n\n const handleScroll = (event: UIEvent<HTMLDivElement>) => {\n setScrollY(event.currentTarget.scrollTop)\n notifyScroll(event.currentTarget.scrollTop)\n onScroll?.(event)\n }\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Content, className)}\n data-fill={fill ? \"\" : undefined}\n onScroll={handleScroll}\n {...restProps}\n >\n <div className={s.Column}>{children}</div>\n </div>\n )\n}\nPageContent.displayName = \"Page.Content\"\n\nexport type PageFooterProps = PageSlotProps & {\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background?: PageBarBackground\n}\n\n/** Actions that remain below the scrolling content, inside the page's safe area. */\nfunction PageFooter({ className, children, background = \"soft\", ref, ...restProps }: PageFooterProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const { edges: { contentBelow }, setFooterHeight } = usePageContext(\"Footer\")\n const setFloatingFooter = useFloatingBoundaryRegistration()?.setFooter\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n setFloatingFooter?.(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { element.current = null; setFloatingFooter?.(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setFloatingFooter])\n useLayoutEffect(() => {\n const footer = element.current\n if (!footer) return\n const update = () => setFooterHeight(footer.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(footer, { box: \"border-box\" })\n return () => { observer?.disconnect(); setFooterHeight(0) }\n }, [setFooterHeight])\n return (\n <div\n ref={setRef}\n className={clsx(s.Footer, className)}\n data-background={background}\n data-content-below={contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.FooterContent}>{children}</div>\n </div>\n )\n}\nPageFooter.displayName = \"Page.Footer\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Page = PageRoot as typeof PageRoot & {\n Header: typeof PageHeader\n Bar: typeof PageBar\n Leading: typeof PageLeading\n Heading: typeof PageHeading\n Title: typeof PageTitle\n Subtitle: typeof PageSubtitle\n Actions: typeof PageActions\n Content: typeof PageContent\n Footer: typeof PageFooter\n}\nPage.Header = PageHeader\nPage.Bar = PageBar\nPage.Leading = PageLeading\nPage.Heading = PageHeading\nPage.Title = PageTitle\nPage.Subtitle = PageSubtitle\nPage.Actions = PageActions\nPage.Content = PageContent\nPage.Footer = PageFooter\n"]}
|
|
1
|
+
{"version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"clsx\"\nimport {\n createContext,\n useContext,\n useCallback,\n useMemo,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type CSSProperties,\n type Ref,\n type UIEvent,\n} from \"react\"\nimport { FloatingBoundaryProvider, useFloatingBoundaryRegistration, useFloatingBoundaryScope } from \"../../hooks/useFloatingBoundary\"\nimport { barBackground, ToolbarHostContext, type BarBackground, type BarBackgroundAlias, type ToolbarHost, type ToolbarPlacement } from \"../Toolbar/Toolbar\"\nimport { NO_SCROLL_EDGES, observeScrollEdges, sameScrollEdges, type ScrollEdges } from \"../../lib/scrollEdges\"\nimport s from \"@plexui/styles/components/Page/Page.module.css\"\n\n/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. `\"solid\"` is the earlier name of `\"hard\"`. */\nexport type PageBarBackground = BarBackground | BarBackgroundAlias\n\nexport type PageWidth = \"full\" | \"wide\" | \"column\"\n\ntype PageContextValue = {\n /** Content under the header (scrolled) and under the footer (content below). */\n edges: ScrollEdges\n setEdges: (edges: ScrollEdges) => void\n setFooterHeight: (height: number) => void\n setHeaderHeight: (height: number | undefined) => void\n /** Tells the bars that follow the scroll, such as a minimizing TabBar or a large title, the content's scroll offset. */\n notifyScroll: (scrollY: number) => void\n /** A large Toolbar title asks for a place at the top of the content, where it scrolls with the content. */\n largeTitle: boolean\n setLargeTitleSlot: (slot: HTMLDivElement | null) => void\n /** The place of the bar's rows under a large title, which pins them under the bar. */\n largeTitleRowSlot: HTMLDivElement | null\n setLargeTitleRowSlot: (slot: HTMLDivElement | null) => void\n setTitleRows: (pinned: boolean, height: number) => void\n}\n\n/**\n * Follows the rows of a large title's bar (Toolbar.Row) in the content. They stand under the title and, scrolled up to\n * the bar, stay under its controls (`position: sticky`): they are pinned once the sticky offset moves them off the\n * title's bottom, where they would stand. It reports that and their height, which the bar's background takes in.\n */\nfunction followTitleRows(content: HTMLElement, rows: HTMLElement, report: (pinned: boolean, height: number) => void) {\n let last = \"\"\n const update = () => {\n const height = rows.offsetHeight\n const title = rows.previousElementSibling\n const pinned = height > 0 && !!title && rows.getBoundingClientRect().top - title.getBoundingClientRect().bottom > 0.5\n if (`${pinned} ${height}` === last) return\n last = `${pinned} ${height}`\n report(pinned, height)\n }\n update()\n content.addEventListener(\"scroll\", update, { passive: true })\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(rows)\n observer?.observe(content)\n // The title changing its height (a subtitle shown or gone) moves the rows with no scroll (Codex #7).\n const title = rows.previousElementSibling\n if (title) observer?.observe(title)\n return () => {\n content.removeEventListener(\"scroll\", update)\n observer?.disconnect()\n report(false, 0)\n }\n}\n\nconst PageContext = createContext<PageContextValue | null>(null)\n\nfunction usePageContext(part: string): PageContextValue {\n const context = useContext(PageContext)\n if (!context) {\n throw new Error(`Page.${part} must be used within Page`)\n }\n return context\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type PageProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Width of the column that header and content share.\n * - `\"full\"` — edge to edge, for tables (default)\n * - `\"wide\"` — 1280px, centred, for overviews\n * - `\"column\"` — 768px, centred, for settings and forms\n *\n * Set `--page-width` on the page for any other width.\n * @default \"full\"\n */\n width?: PageWidth\n /** Mobile canvas and grouped-field palette. @default \"plain\" */\n surface?: \"plain\" | \"grouped\"\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageRoot({ width = \"full\", surface = \"plain\", className, children, style, ref, ...restProps }: PageProps) {\n const boundary = useFloatingBoundaryScope()\n const setRoot = boundary.setRoot\n const setRef = useCallback((node: HTMLDivElement | null) => {\n setRoot(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { setRoot(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setRoot])\n const [edges, setEdgesState] = useState(NO_SCROLL_EDGES)\n const setEdges = useCallback((next: ScrollEdges) => setEdgesState((current) => sameScrollEdges(current, next) ? current : next), [])\n const [footerHeight, setFooterHeight] = useState(0)\n const [headerHeight, setHeaderHeight] = useState<number>()\n const scrollListeners = useRef(new Set<(scrollTop: number) => void>())\n const notifyScroll = useCallback((scrollY: number) => scrollListeners.current.forEach((listener) => listener(scrollY)), [])\n const subscribeScroll = useCallback((listener: (scrollTop: number) => void) => {\n const listeners = scrollListeners.current\n listeners.add(listener)\n return () => { listeners.delete(listener) }\n }, [])\n // A large Toolbar title lives in the content, where the browser scrolls it with the content and its overscroll;\n // Page.Content keeps a place for it at its top while a title asks for one.\n const [largeTitleRequests, setLargeTitleRequests] = useState(0)\n const [largeTitleSlot, setLargeTitleSlot] = useState<HTMLDivElement | null>(null)\n const requestLargeTitleSlot = useCallback(() => {\n setLargeTitleRequests((count) => count + 1)\n return () => setLargeTitleRequests((count) => count - 1)\n }, [])\n const largeTitle = largeTitleRequests > 0\n // The bar's rows under a large title have a place of their own under it, which pins them under the bar once scrolled.\n const [largeTitleRowSlot, setLargeTitleRowSlot] = useState<HTMLDivElement | null>(null)\n const [titleRows, setTitleRowsState] = useState({ pinned: false, height: 0 })\n const setTitleRows = useCallback((pinned: boolean, height: number) => setTitleRowsState((current) => (current.pinned === pinned && current.height === height ? current : { pinned, height })), [])\n const context = useMemo(\n () => ({ edges, setEdges, setFooterHeight, setHeaderHeight, notifyScroll, largeTitle, setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, setTitleRows }),\n [edges, setEdges, notifyScroll, largeTitle, largeTitleRowSlot, setTitleRows],\n )\n // A phone Toolbar replaces the header and footer bars; it reports its own heights.\n const [toolbarTop, setToolbarTop] = useState<number>()\n const [toolbarBottom, setToolbarBottom] = useState<number>()\n const setToolbarHeight = useCallback((placement: ToolbarPlacement, height: number | undefined) => (placement === \"top\" ? setToolbarTop : setToolbarBottom)(height), [])\n const toolbarHost = useMemo<ToolbarHost>(() => ({\n kind: \"page\",\n setHeight: setToolbarHeight,\n scrolled: edges.scrolled,\n contentBelow: edges.contentBelow,\n subscribeScroll,\n requestLargeTitleSlot,\n largeTitleSlot: largeTitle ? largeTitleSlot : null,\n largeTitleRowSlot: largeTitle ? largeTitleRowSlot : null,\n rowsPinned: largeTitle && titleRows.pinned,\n }), [setToolbarHeight, edges, subscribeScroll, requestLargeTitleSlot, largeTitle, largeTitleSlot, largeTitleRowSlot, titleRows.pinned])\n const pageStyle = {\n \"--page-footer-height\": `${footerHeight}px`,\n ...(headerHeight !== undefined ? { \"--page-header-height\": `${headerHeight}px` } : {}),\n ...(toolbarTop !== undefined ? { \"--page-toolbar-height\": `${toolbarTop}px` } : {}),\n ...(toolbarBottom !== undefined ? { \"--page-toolbar-bottom-height\": `${toolbarBottom}px` } : {}),\n ...(titleRows.height > 0 ? { \"--page-toolbar-rows-height\": `${titleRows.height}px` } : {}),\n ...style,\n } as CSSProperties\n\n return (\n <FloatingBoundaryProvider value={boundary}>\n <PageContext.Provider value={context}>\n <ToolbarHostContext.Provider value={toolbarHost}>\n <div ref={setRef} className={clsx(s.Page, className)} data-width={width} data-surface={surface} style={pageStyle} {...restProps}>\n {children}\n </div>\n </ToolbarHostContext.Provider>\n </PageContext.Provider>\n </FloatingBoundaryProvider>\n )\n}\nPageRoot.displayName = \"Page\"\n\n/* ------------------------------------------------------------------ */\n/* Header */\n/* ------------------------------------------------------------------ */\n\nexport type PageHeaderProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * Shows a divider once the content has scrolled under the header: on a desktop layout, and on a phone\n * with a `\"hard\"` or `\"glass\"` background.\n * Turn it off when the content already draws a line of its own at that place.\n * @default true\n */\n divider?: boolean\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" */\n background?: PageBarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageHeader({ divider = true, background = \"glass\", className, children, ref, ...restProps }: PageHeaderProps) {\n const { edges: { scrolled }, setHeaderHeight } = usePageContext(\"Header\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const header = element.current\n if (!header) return\n const update = () => setHeaderHeight(header.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(header, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeaderHeight(undefined) }\n }, [setHeaderHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Header, className)}\n data-background={barBackground(background)}\n data-scrolled={scrolled ? \"\" : undefined}\n data-divider={divider ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.Head}>{children}</div>\n </div>\n )\n}\nPageHeader.displayName = \"Page.Header\"\n\n/* ------------------------------------------------------------------ */\n/* Slots */\n/* ------------------------------------------------------------------ */\n\nexport type PageSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction PageBar({ className, ref, ...restProps }: PageSlotProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar) return\n const sides = () => bar.querySelectorAll<HTMLElement>(`:scope > .${s.Leading}, :scope > .${s.Actions}`)\n const update = () => {\n const width = Math.max(44, ...Array.from(sides(), (side) => side.offsetWidth))\n bar.style.setProperty(\"--page-bar-side-width\", `${width}px`)\n }\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n const observeSides = () => { observer?.disconnect(); sides().forEach((side) => observer?.observe(side, { box: \"border-box\" })); update() }\n observeSides()\n const children = new MutationObserver(observeSides)\n children.observe(bar, { childList: true })\n return () => { observer?.disconnect(); children.disconnect() }\n }, [])\n return <div ref={setRef} className={clsx(s.Bar, className)} {...restProps} />\n}\nPageBar.displayName = \"Page.Bar\"\n\nfunction PageLeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nPageLeading.displayName = \"Page.Leading\"\n\nfunction PageHeading({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Heading, className)} {...restProps} />\n}\nPageHeading.displayName = \"Page.Heading\"\n\nfunction PageTitle({\n className,\n ...restProps\n}: HTMLAttributes<HTMLHeadingElement> & { ref?: Ref<HTMLHeadingElement> }) {\n return <h1 className={clsx(s.Title, className)} {...restProps} />\n}\nPageTitle.displayName = \"Page.Title\"\n\nfunction PageSubtitle({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Subtitle, className)} {...restProps} />\n}\nPageSubtitle.displayName = \"Page.Subtitle\"\n\nfunction PageActions({ className, ...restProps }: PageSlotProps) {\n return <div className={clsx(s.Actions, className)} {...restProps} />\n}\nPageActions.displayName = \"Page.Actions\"\n\n/* ------------------------------------------------------------------ */\n/* Content */\n/* ------------------------------------------------------------------ */\n\nexport type PageContentProps = HTMLAttributes<HTMLDivElement> & {\n /**\n * The content fills the page and scrolls inside itself, as a table does: the page stops\n * scrolling from 768px up.\n * @default false\n */\n fill?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nfunction PageContent({ fill = false, className, children, onScroll, ref, ...restProps }: PageContentProps) {\n const { setEdges, notifyScroll, largeTitle, setLargeTitleSlot, largeTitleRowSlot, setLargeTitleRowSlot, setTitleRows } = usePageContext(\"Content\")\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n const content = element.current\n if (!content) return\n const stop = observeScrollEdges(content, setEdges)\n return () => { stop(); setEdges(NO_SCROLL_EDGES) }\n }, [setEdges])\n useLayoutEffect(() => {\n const content = element.current\n if (!content || !largeTitleRowSlot) return\n return followTitleRows(content, largeTitleRowSlot, setTitleRows)\n }, [largeTitleRowSlot, setTitleRows])\n\n const handleScroll = (event: UIEvent<HTMLDivElement>) => {\n notifyScroll(event.currentTarget.scrollTop)\n onScroll?.(event)\n }\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Content, className)}\n data-fill={fill ? \"\" : undefined}\n onScroll={handleScroll}\n {...restProps}\n >\n <div className={s.Column}>\n {largeTitle && <div ref={setLargeTitleSlot} className={s.LargeTitle} />}\n {largeTitle && <div ref={setLargeTitleRowSlot} className={s.LargeTitleRows} />}\n {children}\n </div>\n </div>\n )\n}\nPageContent.displayName = \"Page.Content\"\n\nexport type PageFooterProps = PageSlotProps & {\n /** How the bar meets the content scrolled under it on a phone. @default \"soft\" */\n background?: PageBarBackground\n}\n\n/** Actions that remain below the scrolling content, inside the page's safe area. */\nfunction PageFooter({ className, children, background = \"soft\", ref, ...restProps }: PageFooterProps) {\n const element = useRef<HTMLDivElement | null>(null)\n const { edges: { contentBelow }, setFooterHeight } = usePageContext(\"Footer\")\n const setFloatingFooter = useFloatingBoundaryRegistration()?.setFooter\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n setFloatingFooter?.(node)\n if (typeof ref === \"function\") {\n const cleanup = ref(node)\n if (typeof cleanup === \"function\") return () => { element.current = null; setFloatingFooter?.(null); cleanup() }\n return\n }\n if (ref) ref.current = node\n }, [ref, setFloatingFooter])\n useLayoutEffect(() => {\n const footer = element.current\n if (!footer) return\n const update = () => setFooterHeight(footer.offsetHeight)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(footer, { box: \"border-box\" })\n return () => { observer?.disconnect(); setFooterHeight(0) }\n }, [setFooterHeight])\n return (\n <div\n ref={setRef}\n className={clsx(s.Footer, className)}\n data-background={barBackground(background)}\n data-content-below={contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <div className={s.FooterContent}>{children}</div>\n </div>\n )\n}\nPageFooter.displayName = \"Page.Footer\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Page = PageRoot as typeof PageRoot & {\n Header: typeof PageHeader\n Bar: typeof PageBar\n Leading: typeof PageLeading\n Heading: typeof PageHeading\n Title: typeof PageTitle\n Subtitle: typeof PageSubtitle\n Actions: typeof PageActions\n Content: typeof PageContent\n Footer: typeof PageFooter\n}\nPage.Header = PageHeader\nPage.Bar = PageBar\nPage.Leading = PageLeading\nPage.Heading = PageHeading\nPage.Title = PageTitle\nPage.Subtitle = PageSubtitle\nPage.Actions = PageActions\nPage.Content = PageContent\nPage.Footer = PageFooter\n"]}
|
|
@@ -5,7 +5,7 @@ import { createContext, useCallback, useContext, useEffect, useLayoutEffect, use
|
|
|
5
5
|
import s from "@plexui/styles/components/TabBar/TabBar.module.css";
|
|
6
6
|
import { useLatestValue } from "../../hooks/useLatestValue.js";
|
|
7
7
|
import { Search as SearchIcon } from "../Icon/index.js";
|
|
8
|
-
import { ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
8
|
+
import { barBackground, ToolbarHostContext } from "../Toolbar/Toolbar.js";
|
|
9
9
|
/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */
|
|
10
10
|
const MINIMIZE_AFTER = 8;
|
|
11
11
|
const TabBarContext = createContext(null);
|
|
@@ -95,7 +95,7 @@ function TabBarRoot({ value: valueProp, defaultValue, onValueChange, search, pro
|
|
|
95
95
|
const accessoryCapsule = hasAccessory && _jsx("div", { className: s.Accessory, children: accessory }, "accessory");
|
|
96
96
|
const tabs = (_jsxs("div", { className: s.Tabs, children: [children, search && prominent && _jsx(TabBarItem, { value: search.value, label: search.label ?? "Search", icon: _jsx(SearchIcon, {}) })] }, "tabs"));
|
|
97
97
|
const circle = prominent ? (_jsx(TabBarItem, { className: s.Prominent, value: prominent.value, label: prominent.label, icon: prominent.icon, hideLabel: true }, "prominent")) : search && (_jsx(TabBarItem, { className: s.Search, value: search.value, label: search.label ?? "Search", icon: _jsx(SearchIcon, {}), hideLabel: true }, "search"));
|
|
98
|
-
return (_jsx("nav", { ref: setRef, "aria-label": ariaLabel, className: clsx(s.TabBar, className), "data-host": host?.kind, "data-background": background, "data-content-below": host?.contentBelow ? "" : undefined, "data-minimized": minimized ? "" : undefined, "data-search": search && !prominent ? "" : undefined, "data-prominent": prominent ? "" : undefined, "data-accessory": hasAccessory ? "" : undefined, children: _jsx(TabBarContext.Provider, { value: context, children: minimized ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle] }) }));
|
|
98
|
+
return (_jsx("nav", { ref: setRef, "aria-label": ariaLabel, className: clsx(s.TabBar, className), "data-host": host?.kind, "data-background": barBackground(background), "data-content-below": host?.contentBelow ? "" : undefined, "data-minimized": minimized ? "" : undefined, "data-search": search && !prominent ? "" : undefined, "data-prominent": prominent ? "" : undefined, "data-accessory": hasAccessory ? "" : undefined, children: _jsx(TabBarContext.Provider, { value: context, children: minimized ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle] }) }));
|
|
99
99
|
}
|
|
100
100
|
TabBarRoot.displayName = "TabBar";
|
|
101
101
|
/** A badge shows unless it is empty: nothing, false, an empty text or a count of 0 (iOS hides `.badge(0)`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,eAAe,EACf,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO,CAAC,MAAM,oDAAoD,CAAA;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,SAAS,CAAA;AAC9C,OAAO,EAAE,kBAAkB,EAAsB,MAAM,oBAAoB,CAAA;AAE3E,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,CAAA;AASxB,MAAM,aAAa,GAAG,aAAa,CAA4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AK,SAAS,IAAI,CAAC,QAAQ;QAAE,OAAO,YAAG,IAAI,EAAE,IAAI,KAAM,KAAK,YAAG,OAAO,GAAK,CAAA;IACnF,OAAO,iBAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,QAAQ,KAAM,KAAK,YAAG,OAAO,GAAU,CAAA;AAChF,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type MouseEvent,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { Search as SearchIcon } from \"../Icon\"\nimport { ToolbarHostContext, type BarBackground } from \"../Toolbar/Toolbar\"\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContextValue = {\n value: string | undefined\n minimized: boolean\n select: (value: string) => void\n expand: () => void\n}\n\nconst TabBarContext = createContext<TabBarContextValue | null>(null)\n\nfunction useTabBarContext(part: string) {\n const context = useContext(TabBarContext)\n if (!context) throw new Error(`${part} must be used within TabBar`)\n return context\n}\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n /** The symbol, a PlexUI icon. */\n icon: ReactNode\n}\n\nexport type TabBarProps = {\n /** The controlled value of the selected tab. Use with `onValueChange`. */\n value?: string\n /** The selected tab when it is initially rendered. */\n defaultValue?: string\n /** Called with the value of the tab a person selects. */\n onValueChange?: (value: string) => void\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search?: TabBarSearch\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role. It takes the circle of the search tab: with both, search\n * is the last tab of the capsule, as iOS gives search that place only when no other tab is prominent.\n */\n prominent?: TabBarProminent\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior?: \"never\" | \"onScrollDown\"\n /** Controlled minimized state. Use with `onMinimizedChange`. */\n minimized?: boolean\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized?: boolean\n /** Called when the bar minimizes or expands. */\n onMinimizedChange?: (minimized: boolean) => void\n /** How the bar meets the content scrolled under it; see `BarBackground`. @default \"soft\" */\n background?: BarBackground\n /**\n * Content in a glass capsule above the tabs, a now playing row or a status, as the iOS 27 bottom accessory;\n * minimized, it stands between the two circles. The bar grows by its height.\n */\n accessory?: ReactNode\n /** Accessible name of the navigation. @default \"Tabs\" */\n \"aria-label\"?: string\n /** `TabBar.Item` elements. */\n children?: ReactNode\n /** CSS classes applied to the bar */\n className?: string\n ref?: Ref<HTMLElement>\n}\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nfunction TabBarRoot({\n value: valueProp,\n defaultValue,\n onValueChange,\n search,\n prominent,\n minimizeBehavior = \"never\",\n minimized: minimizedProp,\n defaultMinimized = false,\n onMinimizedChange,\n background = \"soft\",\n accessory,\n \"aria-label\": ariaLabel = \"Tabs\",\n children,\n className,\n ref,\n}: TabBarProps) {\n const host = useContext(ToolbarHostContext)\n const [internalValue, setInternalValue] = useState(defaultValue)\n const value = valueProp ?? internalValue\n const [internalMinimized, setInternalMinimized] = useState(defaultMinimized)\n const minimized = minimizedProp ?? internalMinimized\n const onValueChangeRef = useLatestValue(onValueChange)\n const onMinimizedChangeRef = useLatestValue(onMinimizedChange)\n const minimizedRef = useLatestValue(minimized)\n const controlledMinimized = minimizedProp !== undefined\n\n const select = useCallback((next: string) => {\n if (valueProp === undefined) setInternalValue(next)\n onValueChangeRef.current?.(next)\n }, [valueProp, onValueChangeRef])\n\n const setMinimized = useCallback((next: boolean) => {\n if (next === minimizedRef.current) return\n // A controlled state changes only when the owner passes it back.\n if (!controlledMinimized) {\n minimizedRef.current = next\n setInternalMinimized(next)\n }\n onMinimizedChangeRef.current?.(next)\n }, [controlledMinimized, minimizedRef, onMinimizedChangeRef])\n\n const expand = useCallback(() => setMinimized(false), [setMinimized])\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n const subscribeScroll = host?.subscribeScroll\n useEffect(() => {\n if (minimizeBehavior !== \"onScrollDown\" || !subscribeScroll) return\n let anchor = 0\n return subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimizedRef.current ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimizedRef.current)\n }\n return\n }\n anchor = scrollTop\n })\n }, [minimizeBehavior, subscribeScroll, setMinimized, minimizedRef])\n\n const element = useRef<HTMLElement | null>(null)\n const setRef = useCallback((node: HTMLElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(\"bottom\", undefined) }\n }, [setHeight])\n\n const context = { value, minimized, select, expand }\n // `accessory={playing && <NowPlaying />}` leaves no empty capsule when nothing plays.\n const hasAccessory = accessory != null && typeof accessory !== \"boolean\" && accessory !== \"\"\n const accessoryCapsule = hasAccessory && <div key=\"accessory\" className={s.Accessory}>{accessory}</div>\n const tabs = (\n <div key=\"tabs\" className={s.Tabs}>\n {children}\n {search && prominent && <TabBarItem value={search.value} label={search.label ?? \"Search\"} icon={<SearchIcon />} />}\n </div>\n )\n const circle = prominent ? (\n <TabBarItem key=\"prominent\" className={s.Prominent} value={prominent.value} label={prominent.label} icon={prominent.icon} hideLabel />\n ) : search && (\n <TabBarItem key=\"search\" className={s.Search} value={search.value} label={search.label ?? \"Search\"} icon={<SearchIcon />} hideLabel />\n )\n\n return (\n <nav\n ref={setRef}\n aria-label={ariaLabel}\n className={clsx(s.TabBar, className)}\n data-host={host?.kind}\n data-background={background}\n data-content-below={host?.contentBelow ? \"\" : undefined}\n data-minimized={minimized ? \"\" : undefined}\n data-search={search && !prominent ? \"\" : undefined}\n data-prominent={prominent ? \"\" : undefined}\n data-accessory={hasAccessory ? \"\" : undefined}\n >\n <TabBarContext.Provider value={context}>\n {/* The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys\n move it there without remounting its content. */}\n {minimized ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle]}\n </TabBarContext.Provider>\n </nav>\n )\n}\nTabBarRoot.displayName = \"TabBar\"\n\nexport type TabBarItemProps = {\n /** The value of the tab. */\n value: string\n /** The label under the symbol, and the accessible name of the tab. */\n label: string\n /** The symbol, a PlexUI icon. */\n icon: ReactNode\n /**\n * A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.\n * A count of 0 shows none, as on iOS.\n */\n badge?: ReactNode\n /** Makes the tab a link to this URL. */\n href?: string\n /** When `true`, the tab cannot be selected. */\n disabled?: boolean\n /** Called when the tab is pressed, before it is selected. */\n onClick?: (event: MouseEvent<HTMLElement>) => void\n /** CSS classes applied to the tab */\n className?: string\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel?: boolean\n}\n\n/** A badge shows unless it is empty: nothing, false, an empty text or a count of 0 (iOS hides `.badge(0)`). */\nconst hasBadge = (badge: ReactNode) => badge != null && badge !== false && badge !== \"\" && badge !== 0\n\nfunction TabBarItem({ value, label, icon, badge, href, disabled = false, onClick, className, hideLabel = false }: TabBarItemProps) {\n const context = useTabBarContext(\"TabBar.Item\")\n const selected = context.value === value\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = context.minimized && selected && !hideLabel\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n onClick?.(event)\n if (event.defaultPrevented || disabled) return\n if (collapsed) {\n event.preventDefault()\n return context.expand()\n }\n context.select(value)\n }\n const content = (\n <>\n <span className={s.Icon} aria-hidden=\"true\">{icon}</span>\n {!hideLabel && <span className={s.Label}>{label}</span>}\n {/* The space keeps the accessible name \"Inbox 3\", not \"Inbox3\". */}\n {hasBadge(badge) && <>{\" \"}<span className={s.Badge}>{badge}</span></>}\n </>\n )\n const props = {\n \"className\": clsx(s.Item, className),\n \"aria-current\": selected ? (\"page\" as const) : undefined,\n \"aria-label\": hideLabel ? label : undefined,\n \"aria-expanded\": collapsed ? false : undefined,\n \"data-selected\": selected ? \"\" : undefined,\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-value\": value,\n \"onClick\": handleClick,\n }\n if (href !== undefined && !disabled) return <a href={href} {...props}>{content}</a>\n return <button type=\"button\" disabled={disabled} {...props}>{content}</button>\n}\nTabBarItem.displayName = \"TabBar.Item\"\n\nexport const TabBar = Object.assign(TabBarRoot, { Item: TabBarItem })\n"]}
|
|
1
|
+
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../../../src/components/TabBar/TabBar.tsx"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AW,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC;QACpC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAE,MAAgB,CAAC,CAAC,CAAC,SAAS;QACxD,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC3C,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;QAC9C,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC1C,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;QAC1C,YAAY,EAAE,KAAK;QACnB,SAAS,EAAE,WAAW;KACvB,CAAA;IACD,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,QAAQ;QAAE,OAAO,YAAG,IAAI,EAAE,IAAI,KAAM,KAAK,YAAG,OAAO,GAAK,CAAA;IACnF,OAAO,iBAAQ,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,QAAQ,KAAM,KAAK,YAAG,OAAO,GAAU,CAAA;AAChF,CAAC;AACD,UAAU,CAAC,WAAW,GAAG,aAAa,CAAA;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n type MouseEvent,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport s from \"@plexui/styles/components/TabBar/TabBar.module.css\"\nimport { useLatestValue } from \"../../hooks/useLatestValue\"\nimport { Search as SearchIcon } from \"../Icon\"\nimport { barBackground, ToolbarHostContext, type BarBackground, type BarBackgroundAlias } from \"../Toolbar/Toolbar\"\n\n/** A scroll of at least this many pixels in one direction minimizes or expands the bar. */\nconst MINIMIZE_AFTER = 8\n\ntype TabBarContextValue = {\n value: string | undefined\n minimized: boolean\n select: (value: string) => void\n expand: () => void\n}\n\nconst TabBarContext = createContext<TabBarContextValue | null>(null)\n\nfunction useTabBarContext(part: string) {\n const context = useContext(TabBarContext)\n if (!context) throw new Error(`${part} must be used within TabBar`)\n return context\n}\n\nexport type TabBarSearch = {\n /** The value of the search tab. */\n value: string\n /** Accessible name of the search tab. @default \"Search\" */\n label?: string\n}\n\nexport type TabBarProminent = {\n /** The value of the prominent tab. */\n value: string\n /** Accessible name of the prominent tab: its circle shows the symbol only. */\n label: string\n /** The symbol, a PlexUI icon. */\n icon: ReactNode\n}\n\nexport type TabBarProps = {\n /** The controlled value of the selected tab. Use with `onValueChange`. */\n value?: string\n /** The selected tab when it is initially rendered. */\n defaultValue?: string\n /** Called with the value of the tab a person selects. */\n onValueChange?: (value: string) => void\n /** A search tab in a glass circle of its own at the trailing end, as the iOS 26 separate search tab. */\n search?: TabBarSearch\n /**\n * The one destination the app lifts out of the capsule, a cart or a library, in a glass circle of its own at\n * the trailing end, as the iOS 27 prominent tab role. It takes the circle of the search tab: with both, search\n * is the last tab of the capsule, as iOS gives search that place only when no other tab is prominent.\n */\n prominent?: TabBarProminent\n /**\n * `onScrollDown` minimizes the bar to the selected tab while the content of the `Page` scrolls down and\n * expands it when the content scrolls back up; a tap on the minimized tab expands it too. @default \"never\"\n */\n minimizeBehavior?: \"never\" | \"onScrollDown\"\n /** Controlled minimized state. Use with `onMinimizedChange`. */\n minimized?: boolean\n /** The minimized state when it is initially rendered. @default false */\n defaultMinimized?: boolean\n /** Called when the bar minimizes or expands. */\n onMinimizedChange?: (minimized: boolean) => void\n /** How the bar meets the content scrolled under it; see `BarBackground` (`\"solid\"` is the earlier name of `\"hard\"`). @default \"soft\" */\n background?: BarBackground | BarBackgroundAlias\n /**\n * Content in a glass capsule above the tabs, a now playing row or a status, as the iOS 27 bottom accessory;\n * minimized, it stands between the two circles. The bar grows by its height.\n */\n accessory?: ReactNode\n /** Accessible name of the navigation. @default \"Tabs\" */\n \"aria-label\"?: string\n /** `TabBar.Item` elements. */\n children?: ReactNode\n /** CSS classes applied to the bar */\n className?: string\n ref?: Ref<HTMLElement>\n}\n\n/**\n * The tab bar of a phone screen after the iOS 26 kit Tab Bar - iPhone (507:24689): two to five tabs, each a\n * symbol over a label, in a floating glass capsule at the bottom, the selected tab on a pill, and an optional\n * search or prominent tab in a circle of its own. It minimizes to the selected tab while the content scrolls\n * down. A desktop layout navigates with a Sidebar or Tabs, so the bar never renders from 768px up.\n */\nfunction TabBarRoot({\n value: valueProp,\n defaultValue,\n onValueChange,\n search,\n prominent,\n minimizeBehavior = \"never\",\n minimized: minimizedProp,\n defaultMinimized = false,\n onMinimizedChange,\n background = \"soft\",\n accessory,\n \"aria-label\": ariaLabel = \"Tabs\",\n children,\n className,\n ref,\n}: TabBarProps) {\n const host = useContext(ToolbarHostContext)\n const [internalValue, setInternalValue] = useState(defaultValue)\n const value = valueProp ?? internalValue\n const [internalMinimized, setInternalMinimized] = useState(defaultMinimized)\n const minimized = minimizedProp ?? internalMinimized\n const onValueChangeRef = useLatestValue(onValueChange)\n const onMinimizedChangeRef = useLatestValue(onMinimizedChange)\n const minimizedRef = useLatestValue(minimized)\n const controlledMinimized = minimizedProp !== undefined\n\n const select = useCallback((next: string) => {\n if (valueProp === undefined) setInternalValue(next)\n onValueChangeRef.current?.(next)\n }, [valueProp, onValueChangeRef])\n\n const setMinimized = useCallback((next: boolean) => {\n if (next === minimizedRef.current) return\n // A controlled state changes only when the owner passes it back.\n if (!controlledMinimized) {\n minimizedRef.current = next\n setInternalMinimized(next)\n }\n onMinimizedChangeRef.current?.(next)\n }, [controlledMinimized, minimizedRef, onMinimizedChangeRef])\n\n const expand = useCallback(() => setMinimized(false), [setMinimized])\n\n // The bar follows the Page content: down by MINIMIZE_AFTER minimizes it, up by as much (or the top) expands it.\n const subscribeScroll = host?.subscribeScroll\n useEffect(() => {\n if (minimizeBehavior !== \"onScrollDown\" || !subscribeScroll) return\n let anchor = 0\n return subscribeScroll((scrollTop) => {\n if (scrollTop <= 0) {\n anchor = 0\n return setMinimized(false)\n }\n const delta = scrollTop - anchor\n if (minimizedRef.current ? delta < 0 : delta > 0) {\n if (Math.abs(delta) >= MINIMIZE_AFTER) {\n anchor = scrollTop\n setMinimized(!minimizedRef.current)\n }\n return\n }\n anchor = scrollTop\n })\n }, [minimizeBehavior, subscribeScroll, setMinimized, minimizedRef])\n\n const element = useRef<HTMLElement | null>(null)\n const setRef = useCallback((node: HTMLElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n\n // Like a bottom Toolbar, the bar reserves its height on the Page; a desktop layout hides it.\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n const update = () => setHeight(\"bottom\", bar.offsetHeight || undefined)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(\"bottom\", undefined) }\n }, [setHeight])\n\n const context = { value, minimized, select, expand }\n // `accessory={playing && <NowPlaying />}` leaves no empty capsule when nothing plays.\n const hasAccessory = accessory != null && typeof accessory !== \"boolean\" && accessory !== \"\"\n const accessoryCapsule = hasAccessory && <div key=\"accessory\" className={s.Accessory}>{accessory}</div>\n const tabs = (\n <div key=\"tabs\" className={s.Tabs}>\n {children}\n {search && prominent && <TabBarItem value={search.value} label={search.label ?? \"Search\"} icon={<SearchIcon />} />}\n </div>\n )\n const circle = prominent ? (\n <TabBarItem key=\"prominent\" className={s.Prominent} value={prominent.value} label={prominent.label} icon={prominent.icon} hideLabel />\n ) : search && (\n <TabBarItem key=\"search\" className={s.Search} value={search.value} label={search.label ?? \"Search\"} icon={<SearchIcon />} hideLabel />\n )\n\n return (\n <nav\n ref={setRef}\n aria-label={ariaLabel}\n className={clsx(s.TabBar, className)}\n data-host={host?.kind}\n data-background={barBackground(background)}\n data-content-below={host?.contentBelow ? \"\" : undefined}\n data-minimized={minimized ? \"\" : undefined}\n data-search={search && !prominent ? \"\" : undefined}\n data-prominent={prominent ? \"\" : undefined}\n data-accessory={hasAccessory ? \"\" : undefined}\n >\n <TabBarContext.Provider value={context}>\n {/* The accessory is read where it stands: above the tabs, and minimized between the two circles. The keys\n move it there without remounting its content. */}\n {minimized ? [tabs, accessoryCapsule, circle] : [accessoryCapsule, tabs, circle]}\n </TabBarContext.Provider>\n </nav>\n )\n}\nTabBarRoot.displayName = \"TabBar\"\n\nexport type TabBarItemProps = {\n /** The value of the tab. */\n value: string\n /** The label under the symbol, and the accessible name of the tab. */\n label: string\n /** The symbol, a PlexUI icon. */\n icon: ReactNode\n /**\n * A count or a short word in a red capsule over the symbol, as an iOS tab badge; it is read after the label.\n * A count of 0 shows none, as on iOS.\n */\n badge?: ReactNode\n /** Makes the tab a link to this URL. */\n href?: string\n /** When `true`, the tab cannot be selected. */\n disabled?: boolean\n /** Called when the tab is pressed, before it is selected. */\n onClick?: (event: MouseEvent<HTMLElement>) => void\n /** CSS classes applied to the tab */\n className?: string\n /** @internal The search and the prominent tab show their symbol only. */\n hideLabel?: boolean\n}\n\n/** A badge shows unless it is empty: nothing, false, an empty text or a count of 0 (iOS hides `.badge(0)`). */\nconst hasBadge = (badge: ReactNode) => badge != null && badge !== false && badge !== \"\" && badge !== 0\n\nfunction TabBarItem({ value, label, icon, badge, href, disabled = false, onClick, className, hideLabel = false }: TabBarItemProps) {\n const context = useTabBarContext(\"TabBar.Item\")\n const selected = context.value === value\n // A minimized bar shows the selected tab only; pressing it brings the other tabs back.\n const collapsed = context.minimized && selected && !hideLabel\n const handleClick = (event: MouseEvent<HTMLElement>) => {\n onClick?.(event)\n if (event.defaultPrevented || disabled) return\n if (collapsed) {\n event.preventDefault()\n return context.expand()\n }\n context.select(value)\n }\n const content = (\n <>\n <span className={s.Icon} aria-hidden=\"true\">{icon}</span>\n {!hideLabel && <span className={s.Label}>{label}</span>}\n {/* The space keeps the accessible name \"Inbox 3\", not \"Inbox3\". */}\n {hasBadge(badge) && <>{\" \"}<span className={s.Badge}>{badge}</span></>}\n </>\n )\n const props = {\n \"className\": clsx(s.Item, className),\n \"aria-current\": selected ? (\"page\" as const) : undefined,\n \"aria-label\": hideLabel ? label : undefined,\n \"aria-expanded\": collapsed ? false : undefined,\n \"data-selected\": selected ? \"\" : undefined,\n \"data-disabled\": disabled ? \"\" : undefined,\n \"data-value\": value,\n \"onClick\": handleClick,\n }\n if (href !== undefined && !disabled) return <a href={href} {...props}>{content}</a>\n return <button type=\"button\" disabled={disabled} {...props}>{content}</button>\n}\nTabBarItem.displayName = \"TabBar.Item\"\n\nexport const TabBar = Object.assign(TabBarRoot, { Item: TabBarItem })\n"]}
|
|
@@ -1,16 +1,79 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
import { createContext, useCallback, useContext, useLayoutEffect, useRef, } from "react";
|
|
4
|
+
import { createContext, useCallback, useContext, useLayoutEffect, useRef, useState, } from "react";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
5
6
|
import s from "@plexui/styles/components/Toolbar/Toolbar.module.css";
|
|
7
|
+
/** The background a bar draws, from its current name or an earlier one. */
|
|
8
|
+
export const barBackground = (background) => background === "edge" ? "soft" : background === "solid" ? "hard" : background;
|
|
6
9
|
export const ToolbarHostContext = createContext(null);
|
|
7
10
|
// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.
|
|
8
11
|
const ToolbarTitleStyleContext = createContext(undefined);
|
|
12
|
+
// The bar itself, which a large title in the content marks once it has gone under the bar. It is state, so a title
|
|
13
|
+
// that mounts before its bar (a bar replaced under a page that keeps its content) follows the bar once it is there.
|
|
14
|
+
const ToolbarElementContext = createContext(null);
|
|
15
|
+
// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.
|
|
16
|
+
const LARGE_TITLE_TOKENS = [
|
|
17
|
+
"--toolbar-padding-bottom",
|
|
18
|
+
"--toolbar-large-title-gap",
|
|
19
|
+
"--toolbar-large-title-font-size",
|
|
20
|
+
"--toolbar-large-title-line-height",
|
|
21
|
+
"--toolbar-large-title-descent",
|
|
22
|
+
"--toolbar-large-subtitle-font-size",
|
|
23
|
+
"--toolbar-large-subtitle-line-height",
|
|
24
|
+
"--toolbar-large-subtitle-descent",
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line
|
|
28
|
+
* is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a
|
|
29
|
+
* phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it
|
|
30
|
+
* again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has
|
|
31
|
+
* not gone under anything.
|
|
32
|
+
*/
|
|
33
|
+
function followLargeTitle(bar, heading, subscribeScroll) {
|
|
34
|
+
const collapse = () => {
|
|
35
|
+
const box = heading.getBoundingClientRect();
|
|
36
|
+
bar.toggleAttribute("data-title-collapsed", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom);
|
|
37
|
+
};
|
|
38
|
+
const layout = () => {
|
|
39
|
+
const own = getComputedStyle(bar);
|
|
40
|
+
const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined;
|
|
41
|
+
for (const token of LARGE_TITLE_TOKENS) {
|
|
42
|
+
const value = own.getPropertyValue(token).trim();
|
|
43
|
+
if (value && value !== place?.getPropertyValue(token).trim())
|
|
44
|
+
heading.style.setProperty(token, value);
|
|
45
|
+
else
|
|
46
|
+
heading.style.removeProperty(token);
|
|
47
|
+
}
|
|
48
|
+
collapse();
|
|
49
|
+
};
|
|
50
|
+
layout();
|
|
51
|
+
const unsubscribe = subscribeScroll(collapse);
|
|
52
|
+
const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(layout) : undefined;
|
|
53
|
+
observer?.observe(bar);
|
|
54
|
+
observer?.observe(heading);
|
|
55
|
+
const mutations = typeof MutationObserver !== "undefined" ? new MutationObserver(layout) : undefined;
|
|
56
|
+
// A token reaches the bar or the content from the class or style of either or of anything around them.
|
|
57
|
+
for (const start of [bar, heading.parentElement]) {
|
|
58
|
+
for (let node = start; node; node = node.parentElement)
|
|
59
|
+
mutations?.observe(node, { attributes: true, attributeFilter: ["class", "style"] });
|
|
60
|
+
}
|
|
61
|
+
return () => {
|
|
62
|
+
unsubscribe();
|
|
63
|
+
observer?.disconnect();
|
|
64
|
+
mutations?.disconnect();
|
|
65
|
+
bar.removeAttribute("data-title-collapsed");
|
|
66
|
+
for (const token of LARGE_TITLE_TOKENS)
|
|
67
|
+
heading.style.removeProperty(token);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
9
70
|
function ToolbarRoot({ placement = "top", titleStyle = "inline", titleAlign = "center", background = placement === "bottom" ? "soft" : "glass", className, children, ref, ...restProps }) {
|
|
10
71
|
const host = useContext(ToolbarHostContext);
|
|
11
72
|
const element = useRef(null);
|
|
73
|
+
const [barElement, setBarElement] = useState(null);
|
|
12
74
|
const setRef = useCallback((node) => {
|
|
13
75
|
element.current = node;
|
|
76
|
+
setBarElement(node);
|
|
14
77
|
if (typeof ref === "function")
|
|
15
78
|
return ref(node);
|
|
16
79
|
if (ref)
|
|
@@ -22,32 +85,15 @@ function ToolbarRoot({ placement = "top", titleStyle = "inline", titleAlign = "c
|
|
|
22
85
|
if (!bar || !setHeight)
|
|
23
86
|
return;
|
|
24
87
|
// A desktop layout hides the bar; its height then leaves the host's own header in charge.
|
|
25
|
-
const update = () =>
|
|
26
|
-
setHeight(placement, bar.offsetHeight || undefined);
|
|
27
|
-
measureLargeTitle(bar);
|
|
28
|
-
};
|
|
88
|
+
const update = () => setHeight(placement, bar.offsetHeight || undefined);
|
|
29
89
|
update();
|
|
30
90
|
const observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(update) : undefined;
|
|
31
91
|
observer?.observe(bar, { box: "border-box" });
|
|
32
92
|
return () => { observer?.disconnect(); setHeight(placement, undefined); };
|
|
33
93
|
}, [placement, setHeight]);
|
|
34
|
-
return (_jsx("div", { ref: setRef, className: clsx(s.Toolbar, className), "data-toolbar": "", "data-placement": placement, "data-title-style": placement === "top" ? titleStyle : undefined, "data-title-align": placement === "top" ? titleAlign : undefined, "data-background": background
|
|
94
|
+
return (_jsx("div", { ref: setRef, className: clsx(s.Toolbar, className), "data-toolbar": "", "data-placement": placement, "data-title-style": placement === "top" ? titleStyle : undefined, "data-title-align": placement === "top" ? titleAlign : undefined, "data-background": barBackground(background), "data-host": host?.kind, "data-scrolled": placement === "top" && host?.scrolled ? "" : undefined, "data-content-below": placement === "bottom" && host?.contentBelow ? "" : undefined, "data-rows-pinned": placement === "top" && host?.rowsPinned ? "" : undefined, ...restProps, children: _jsx(ToolbarElementContext.Provider, { value: barElement, children: _jsx(ToolbarTitleStyleContext.Provider, { value: placement === "top" ? titleStyle : undefined, children: children }) }) }));
|
|
35
95
|
}
|
|
36
96
|
ToolbarRoot.displayName = "Toolbar";
|
|
37
|
-
/**
|
|
38
|
-
* A large title on a page scrolls up with the content under the row of controls; the row shows the
|
|
39
|
-
* title inline once it has gone. The distance it travels (the gap above it and its height) goes to
|
|
40
|
-
* `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.
|
|
41
|
-
*/
|
|
42
|
-
function measureLargeTitle(bar) {
|
|
43
|
-
if (bar.dataset.titleStyle !== "large")
|
|
44
|
-
return;
|
|
45
|
-
const heading = Array.from(bar.children).find((child) => child instanceof HTMLElement && child.classList.contains(s.Heading));
|
|
46
|
-
if (!heading)
|
|
47
|
-
return;
|
|
48
|
-
const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0;
|
|
49
|
-
bar.style.setProperty("--toolbar-large-title-travel", String(heading.offsetHeight + gap));
|
|
50
|
-
}
|
|
51
97
|
function ToolbarLeading({ className, ...restProps }) {
|
|
52
98
|
return _jsx("div", { className: clsx(s.Leading, className), ...restProps });
|
|
53
99
|
}
|
|
@@ -66,18 +112,118 @@ function ToolbarGroup({ className, ...restProps }) {
|
|
|
66
112
|
return _jsx("div", { role: "group", className: clsx(s.Group, className), ...restProps });
|
|
67
113
|
}
|
|
68
114
|
ToolbarGroup.displayName = "Toolbar.Group";
|
|
115
|
+
const rowOfAnchor = new WeakMap();
|
|
116
|
+
/**
|
|
117
|
+
* Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field
|
|
118
|
+
* shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among
|
|
119
|
+
* the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them
|
|
120
|
+
* as they stand (Codex #7); a row added or removed in the bar orders them again.
|
|
121
|
+
*/
|
|
122
|
+
function followRowOrder(anchor, row) {
|
|
123
|
+
const bar = anchor.closest("[data-toolbar]") ?? anchor.parentElement;
|
|
124
|
+
if (!bar)
|
|
125
|
+
return () => { };
|
|
126
|
+
rowOfAnchor.set(anchor, row);
|
|
127
|
+
const place = () => {
|
|
128
|
+
const slot = row.parentElement;
|
|
129
|
+
if (!slot)
|
|
130
|
+
return;
|
|
131
|
+
const rows = Array.from(bar.querySelectorAll("[data-toolbar-row-anchor]"), (mark) => rowOfAnchor.get(mark))
|
|
132
|
+
.filter((each) => each?.parentElement === slot);
|
|
133
|
+
// From the last row back, a row that does not stand before the next one goes right before it: only a row out of
|
|
134
|
+
// place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,
|
|
135
|
+
// where the browser has it, keeps it even in the row that moves.
|
|
136
|
+
const move = slot.moveBefore;
|
|
137
|
+
for (let index = rows.length - 2; index >= 0; index--) {
|
|
138
|
+
const each = rows[index];
|
|
139
|
+
const next = rows[index + 1];
|
|
140
|
+
if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
141
|
+
continue;
|
|
142
|
+
try {
|
|
143
|
+
if (move) {
|
|
144
|
+
move.call(slot, each, next);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
catch {
|
|
149
|
+
// falls back to a plain move
|
|
150
|
+
}
|
|
151
|
+
slot.insertBefore(each, next);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
place();
|
|
155
|
+
const observer = typeof MutationObserver !== "undefined" ? new MutationObserver(place) : undefined;
|
|
156
|
+
observer?.observe(bar, { childList: true, subtree: true });
|
|
157
|
+
return () => {
|
|
158
|
+
observer?.disconnect();
|
|
159
|
+
rowOfAnchor.delete(anchor);
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's
|
|
164
|
+
* folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in
|
|
165
|
+
* their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,
|
|
166
|
+
* at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a
|
|
167
|
+
* safeAreaBar under a large title's bar.
|
|
168
|
+
*/
|
|
169
|
+
function ToolbarRow({ className, ref, ...restProps }) {
|
|
170
|
+
const host = useContext(ToolbarHostContext);
|
|
171
|
+
const titleStyle = useContext(ToolbarTitleStyleContext);
|
|
172
|
+
const large = titleStyle === "large" && host?.kind === "page";
|
|
173
|
+
const requestSlot = large ? host?.requestLargeTitleSlot : undefined;
|
|
174
|
+
const slot = large ? host?.largeTitleRowSlot ?? null : null;
|
|
175
|
+
useLayoutEffect(() => requestSlot?.(), [requestSlot]);
|
|
176
|
+
const element = useRef(null);
|
|
177
|
+
const anchor = useRef(null);
|
|
178
|
+
const setRef = useCallback((node) => {
|
|
179
|
+
element.current = node;
|
|
180
|
+
if (typeof ref === "function")
|
|
181
|
+
return ref(node);
|
|
182
|
+
if (ref)
|
|
183
|
+
ref.current = node;
|
|
184
|
+
}, [ref]);
|
|
185
|
+
useLayoutEffect(() => {
|
|
186
|
+
if (!slot || !anchor.current || !element.current)
|
|
187
|
+
return;
|
|
188
|
+
return followRowOrder(anchor.current, element.current);
|
|
189
|
+
}, [slot]);
|
|
190
|
+
const row = _jsx("div", { ref: setRef, className: clsx(s.Row, className), "data-toolbar-row": "", "data-in-content": slot ? "" : undefined, ...restProps });
|
|
191
|
+
// Under a large title the row waits for its place in the content (it comes before the first paint) and never stands
|
|
192
|
+
// in the bar first: moving it from the bar into the portal would mount its children again, and a switcher that holds
|
|
193
|
+
// its own selection would lose it (Codex #5).
|
|
194
|
+
if (large)
|
|
195
|
+
return slot ? _jsxs(_Fragment, { children: [createPortal(row, slot), _jsx("span", { ref: anchor, "data-toolbar-row-anchor": "", hidden: true })] }) : null;
|
|
196
|
+
return row;
|
|
197
|
+
}
|
|
198
|
+
ToolbarRow.displayName = "Toolbar.Row";
|
|
69
199
|
function ToolbarTitle({ children, subtitle, as, className, ref, ...restProps }) {
|
|
70
200
|
const host = useContext(ToolbarHostContext);
|
|
71
201
|
const titleStyle = useContext(ToolbarTitleStyleContext);
|
|
202
|
+
const bar = useContext(ToolbarElementContext);
|
|
203
|
+
const headingRef = useRef(null);
|
|
204
|
+
const large = titleStyle === "large" && host?.kind === "page";
|
|
205
|
+
const requestSlot = large ? host?.requestLargeTitleSlot : undefined;
|
|
206
|
+
const slot = large ? host?.largeTitleSlot ?? null : null;
|
|
207
|
+
const subscribeScroll = host?.subscribeScroll;
|
|
208
|
+
useLayoutEffect(() => requestSlot?.(), [requestSlot]);
|
|
209
|
+
// In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has
|
|
210
|
+
// gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.
|
|
211
|
+
useLayoutEffect(() => {
|
|
212
|
+
const heading = headingRef.current;
|
|
213
|
+
if (!slot || !bar || !heading || !subscribeScroll)
|
|
214
|
+
return;
|
|
215
|
+
return followLargeTitle(bar, heading, subscribeScroll);
|
|
216
|
+
}, [bar, slot, subscribeScroll]);
|
|
72
217
|
const decorative = host?.kind === "dialog";
|
|
73
218
|
const Tag = as ?? "h1";
|
|
74
219
|
const hasSubtitle = subtitle != null && subtitle !== false && subtitle !== "";
|
|
75
|
-
const heading = (_jsxs("div", { className: s.Heading, "aria-hidden": decorative || undefined, children: [_jsx(Tag, { ref: ref, className: clsx(s.Title, className), ...restProps, children: children }), hasSubtitle && _jsx("p", { className: s.Subtitle, children: subtitle })] }));
|
|
76
|
-
if (
|
|
220
|
+
const heading = (_jsxs("div", { ref: headingRef, className: s.Heading, "aria-hidden": decorative || undefined, "data-in-content": slot ? "" : undefined, children: [_jsx(Tag, { ref: ref, className: clsx(s.Title, className), ...restProps, children: children }), hasSubtitle && _jsx("p", { className: s.Subtitle, children: subtitle })] }));
|
|
221
|
+
if (!large)
|
|
77
222
|
return heading;
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
|
|
223
|
+
// Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar
|
|
224
|
+
// where it will stand in the content. The inline copy the row of controls shows once the large title has gone
|
|
225
|
+
// under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).
|
|
226
|
+
return (_jsxs(_Fragment, { children: [slot ? createPortal(heading, slot) : heading, _jsx("span", { className: s.CollapsedTitle, "aria-hidden": "true", children: hasSubtitle ? _jsxs(_Fragment, { children: [_jsx("span", { className: s.CollapsedLine, children: children }), _jsx("span", { className: s.CollapsedSubtitle, children: subtitle })] }) : children })] }));
|
|
81
227
|
}
|
|
82
228
|
ToolbarTitle.displayName = "Toolbar.Title";
|
|
83
229
|
/* ------------------------------------------------------------------ */
|
|
@@ -89,4 +235,5 @@ Toolbar.Title = ToolbarTitle;
|
|
|
89
235
|
Toolbar.Content = ToolbarContent;
|
|
90
236
|
Toolbar.Group = ToolbarGroup;
|
|
91
237
|
Toolbar.Trailing = ToolbarTrailing;
|
|
238
|
+
Toolbar.Row = ToolbarRow;
|
|
92
239
|
//# sourceMappingURL=Toolbar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,MAAM,GAIP,MAAM,OAAO,CAAA;AACd,OAAO,CAAC,MAAM,sDAAsD,CAAA;AAkCpE,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAqB,IAAI,CAAC,CAAA;AAEzE,2GAA2G;AAC3G,MAAM,wBAAwB,GAAG,aAAa,CAAgC,SAAS,CAAC,CAAA;AAkBxF,SAAS,WAAW,CAAC,EACnB,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,QAAQ,EACrB,UAAU,GAAG,QAAQ,EACrB,UAAU,GAAG,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EACT,QAAQ,EACR,GAAG,EACH,GAAG,SAAS,EACC;IACb,MAAM,IAAI,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAA;IACnD,MAAM,MAAM,GAAG,WAAW,CAAC,CAAC,IAA2B,EAAE,EAAE;QACzD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;QACtB,IAAI,OAAO,GAAG,KAAK,UAAU;YAAE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,GAAG;YAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAA;IAC7B,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IACT,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,CAAA;IACjC,eAAe,CAAC,GAAG,EAAE;QACn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AE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,KAAM,SAAS,YAAG,QAAQ,GAAO,EAClF,WAAW,IAAI,YAAG,SAAS,EAAE,CAAC,CAAC,QAAQ,YAAG,QAAQ,GAAK,IACpD,CACP,CAAA;IACD,IAAI,UAAU,KAAK,OAAO,IAAI,IAAI,EAAE,IAAI,KAAK,MAAM;QAAE,OAAO,OAAO,CAAA;IACnE,yGAAyG;IACzG,8FAA8F;IAC9F,OAAO,CACL,8BACG,OAAO,EACR,eAAM,SAAS,EAAE,CAAC,CAAC,cAAc,iBAAc,MAAM,YAClD,WAAW,CAAC,CAAC,CAAC,8BAAE,eAAM,SAAS,EAAE,CAAC,CAAC,aAAa,YAAG,QAAQ,GAAQ,EAAA,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,YAAG,QAAQ,GAAQ,IAAG,CAAC,CAAC,CAAC,QAAQ,GACpI,IACN,CACJ,CAAA;AACH,CAAC;AACD,YAAY,CAAC,WAAW,GAAG,eAAe,CAAA;AAE1C,wEAAwE;AACxE,yEAAyE;AACzE,wEAAwE;AAExE,MAAM,CAAC,MAAM,OAAO,GAAG,WAMtB,CAAA;AAED,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,OAAO,GAAG,cAAc,CAAA;AAChC,OAAO,CAAC,KAAK,GAAG,YAAY,CAAA;AAC5B,OAAO,CAAC,QAAQ,GAAG,eAAe,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, the canvas color covers the content under the bar's controls and fades out past them, over a\n * light blur; at the bottom of a page the content stays clear under and around the controls, as on native iOS 26,\n * and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a line once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"solid\"`: an opaque bar of the canvas color without a line\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`. */\nexport type ToolbarBackground = BarBackground | \"edge\"\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: boolean\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: boolean\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n}\n\nexport const ToolbarHostContext = createContext<ToolbarHost | null>(null)\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst ToolbarTitleStyleContext = createContext<ToolbarTitleStyle | undefined>(undefined)\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarProps = HTMLAttributes<HTMLDivElement> & {\n /** @default \"top\" */\n placement?: ToolbarPlacement\n /** Layout of `Toolbar.Title` in a top bar. @default \"inline\" */\n titleStyle?: ToolbarTitleStyle\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction ToolbarRoot({\n placement = \"top\",\n titleStyle = \"inline\",\n titleAlign = \"center\",\n background = placement === \"bottom\" ? \"soft\" : \"glass\",\n className,\n children,\n ref,\n ...restProps\n}: ToolbarProps) {\n const host = useContext(ToolbarHostContext)\n const element = useRef<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => {\n setHeight(placement, bar.offsetHeight || undefined)\n measureLargeTitle(bar)\n }\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(placement, undefined) }\n }, [placement, setHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Toolbar, className)}\n data-toolbar=\"\"\n data-placement={placement}\n data-title-style={placement === \"top\" ? titleStyle : undefined}\n data-title-align={placement === \"top\" ? titleAlign : undefined}\n data-background={background === \"edge\" ? \"soft\" : background}\n data-host={host?.kind}\n data-scrolled={placement === \"top\" && host?.scrolled ? \"\" : undefined}\n data-content-below={placement === \"bottom\" && host?.contentBelow ? \"\" : undefined}\n {...restProps}\n >\n <ToolbarTitleStyleContext.Provider value={placement === \"top\" ? titleStyle : undefined}>{children}</ToolbarTitleStyleContext.Provider>\n </div>\n )\n}\nToolbarRoot.displayName = \"Toolbar\"\n\n/**\n * A large title on a page scrolls up with the content under the row of controls; the row shows the\n * title inline once it has gone. The distance it travels (the gap above it and its height) goes to\n * `--toolbar-large-title-travel`, in pixels as a number, as the page's `--page-scroll-y` is.\n */\nfunction measureLargeTitle(bar: HTMLElement) {\n if (bar.dataset.titleStyle !== \"large\") return\n const heading = Array.from(bar.children).find((child): child is HTMLElement => child instanceof HTMLElement && child.classList.contains(s.Heading))\n if (!heading) return\n const gap = Number.parseFloat(getComputedStyle(bar).rowGap) || 0\n bar.style.setProperty(\"--toolbar-large-title-travel\", String(heading.offsetHeight + gap))\n}\n\n/* ------------------------------------------------------------------ */\n/* Parts */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction ToolbarLeading({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nToolbarLeading.displayName = \"Toolbar.Leading\"\n\nfunction ToolbarTrailing({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Trailing, className)} {...restProps} />\n}\nToolbarTrailing.displayName = \"Toolbar.Trailing\"\n\nexport type ToolbarContentProps = ToolbarSlotProps & {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill?: boolean\n}\n\n/** Custom middle content: a search field, a segmented control or a single centered action. */\nfunction ToolbarContent({ fill = false, className, ...restProps }: ToolbarContentProps) {\n return <div className={clsx(s.Content, className)} data-fill={fill ? \"\" : undefined} {...restProps} />\n}\nToolbarContent.displayName = \"Toolbar.Content\"\n\n/** Buttons that share one capsule. */\nfunction ToolbarGroup({ className, ...restProps }: ToolbarSlotProps) {\n return <div role=\"group\" className={clsx(s.Group, className)} {...restProps} />\n}\nToolbarGroup.displayName = \"Toolbar.Group\"\n\nexport type ToolbarTitleProps = Omit<HTMLAttributes<HTMLHeadingElement>, \"children\"> & {\n children: ReactNode\n /** A second, smaller line below the title. */\n subtitle?: ReactNode\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden from\n * assistive technology there. @default \"h1\"\n */\n as?: \"h1\" | \"h2\" | \"h3\"\n ref?: Ref<HTMLHeadingElement>\n}\n\nfunction ToolbarTitle({ children, subtitle, as, className, ref, ...restProps }: ToolbarTitleProps) {\n const host = useContext(ToolbarHostContext)\n const titleStyle = useContext(ToolbarTitleStyleContext)\n const decorative = host?.kind === \"dialog\"\n const Tag = as ?? \"h1\"\n const hasSubtitle = subtitle != null && subtitle !== false && subtitle !== \"\"\n const heading = (\n <div className={s.Heading} aria-hidden={decorative || undefined}>\n <Tag ref={ref} className={clsx(s.Title, className)} {...restProps}>{children}</Tag>\n {hasSubtitle && <p className={s.Subtitle}>{subtitle}</p>}\n </div>\n )\n if (titleStyle !== \"large\" || host?.kind !== \"page\") return heading\n // The inline copy the row of controls shows once the large title has scrolled under it. A subtitle stays\n // as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n return (\n <>\n {heading}\n <span className={s.CollapsedTitle} aria-hidden=\"true\">\n {hasSubtitle ? <><span className={s.CollapsedLine}>{children}</span><span className={s.CollapsedSubtitle}>{subtitle}</span></> : children}\n </span>\n </>\n )\n}\nToolbarTitle.displayName = \"Toolbar.Title\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Toolbar = ToolbarRoot as typeof ToolbarRoot & {\n Leading: typeof ToolbarLeading\n Title: typeof ToolbarTitle\n Content: typeof ToolbarContent\n Group: typeof ToolbarGroup\n Trailing: typeof ToolbarTrailing\n}\n\nToolbar.Leading = ToolbarLeading\nToolbar.Title = ToolbarTitle\nToolbar.Content = ToolbarContent\nToolbar.Group = ToolbarGroup\nToolbar.Trailing = ToolbarTrailing\n"]}
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/Toolbar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,eAAe,EACf,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAA;AACd,OAAO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AQ,GAAG,eAAe,CAAA;AAClC,OAAO,CAAC,GAAG,GAAG,UAAU,CAAA","sourcesContent":["\"use client\"\n\nimport clsx from \"clsx\"\nimport {\n createContext,\n useCallback,\n useContext,\n useLayoutEffect,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\"\nimport { createPortal } from \"react-dom\"\nimport s from \"@plexui/styles/components/Toolbar/Toolbar.module.css\"\n\nexport type ToolbarPlacement = \"top\" | \"bottom\"\n/** Title layouts of the phone top bar. */\nexport type ToolbarTitleStyle = \"inline\" | \"large\" | \"compact-large\" | \"compact-medium\"\nexport type ToolbarTitleAlign = \"center\" | \"start\"\n/**\n * How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:\n * - `\"soft\"` (the default of a bottom bar): at the top, once content is under the bar, a blur that grows toward the top under a\n * thin veil of the canvas color, with no line, which lets go past the bar; at the bottom of a page the content stays clear\n * under and around the controls, as on native iOS 26, and a Sheet's bottom bar fades its content into the panel\n * - `\"hard\"`: an opaque bar of the canvas color with a hairline once content is under it\n * - `\"glass\"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it\n * - `\"blur\"`: no fill and no line, once content is under the bar: the content blurred a little over the bar and past it,\n * and heavily toward the screen's edge\n *\n * iOS 27.2 has two scroll edges, soft and hard; glass is the bar of earlier iOS and blur an app's own.\n */\nexport type BarBackground = \"soft\" | \"hard\" | \"glass\" | \"blur\"\n/**\n * `\"solid\"` is the earlier name of `\"hard\"`: iOS has no opaque bar without a line, and it draws the line of a hard edge\n * only once content is under the bar, so at rest the two look the same.\n */\nexport type BarBackgroundAlias = \"solid\"\n/** `\"edge\"` is the earlier name of `\"soft\"`, `\"solid\"` of `\"hard\"`. */\nexport type ToolbarBackground = BarBackground | BarBackgroundAlias | \"edge\"\n\n/** The background a bar draws, from its current name or an earlier one. */\nexport const barBackground = (background: ToolbarBackground | undefined): BarBackground | undefined =>\n background === \"edge\" ? \"soft\" : background === \"solid\" ? \"hard\" : background\n\n/**\n * A surface that places phone toolbars: `Page` puts the top bar over its content\n * and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.\n */\nexport type ToolbarHost = {\n kind: \"page\" | \"dialog\"\n setHeight?: (placement: ToolbarPlacement, height: number | undefined) => void\n /** Content has scrolled under the top bar, so its glass casts a shadow and a hard or glass bar shows its line. */\n scrolled?: boolean\n /** Content continues under the bottom bar, so a hard or glass bar shows its line. */\n contentBelow?: boolean\n /** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */\n subscribeScroll?: (listener: (scrollTop: number) => void) => () => void\n /** A large title asks for a place in the content; returns the release. */\n requestLargeTitleSlot?: () => () => void\n /** The place at the top of the content where a large title scrolls with it, once the content has made one. */\n largeTitleSlot?: HTMLElement | null\n /** The place under a large title where the bar's rows stand, pinned under the bar once scrolled up to it. */\n largeTitleRowSlot?: HTMLElement | null\n /** The rows under a large title are pinned under the bar, so its background reaches under them. */\n rowsPinned?: boolean\n}\n\nexport const ToolbarHostContext = createContext<ToolbarHost | null>(null)\n\n// The title style of the top bar, which a large title on a page needs to show itself inline once scrolled.\nconst ToolbarTitleStyleContext = createContext<ToolbarTitleStyle | undefined>(undefined)\n// The bar itself, which a large title in the content marks once it has gone under the bar. It is state, so a title\n// that mounts before its bar (a bar replaced under a page that keeps its content) follows the bar once it is there.\nconst ToolbarElementContext = createContext<HTMLDivElement | null>(null)\n\n// The tokens of a large title a bar can set for itself, which the title in the content no longer inherits from it.\nconst LARGE_TITLE_TOKENS = [\n \"--toolbar-padding-bottom\",\n \"--toolbar-large-title-gap\",\n \"--toolbar-large-title-font-size\",\n \"--toolbar-large-title-line-height\",\n \"--toolbar-large-title-descent\",\n \"--toolbar-large-subtitle-font-size\",\n \"--toolbar-large-subtitle-line-height\",\n \"--toolbar-large-subtitle-descent\",\n]\n\n/**\n * Follows a large title in the content: it takes the large title tokens the bar sets for itself, and once its last line\n * is at the bar's bottom the bar shows it inline. Scrolling moves it; a change of layout (a wide window turning into a\n * phone's, which shows the bar and the title) or of a class or style on the bar, the content or around them measures it\n * again. A token the bar shares with the content stays inherited, so it follows the page's changes. A hidden title has\n * not gone under anything.\n */\nfunction followLargeTitle(bar: HTMLElement, heading: HTMLElement, subscribeScroll: (listener: () => void) => () => void) {\n const collapse = () => {\n const box = heading.getBoundingClientRect()\n bar.toggleAttribute(\"data-title-collapsed\", box.height > 0 && box.bottom <= bar.getBoundingClientRect().bottom)\n }\n const layout = () => {\n const own = getComputedStyle(bar)\n const place = heading.parentElement ? getComputedStyle(heading.parentElement) : undefined\n for (const token of LARGE_TITLE_TOKENS) {\n const value = own.getPropertyValue(token).trim()\n if (value && value !== place?.getPropertyValue(token).trim()) heading.style.setProperty(token, value)\n else heading.style.removeProperty(token)\n }\n collapse()\n }\n layout()\n const unsubscribe = subscribeScroll(collapse)\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(layout) : undefined\n observer?.observe(bar)\n observer?.observe(heading)\n const mutations = typeof MutationObserver !== \"undefined\" ? new MutationObserver(layout) : undefined\n // A token reaches the bar or the content from the class or style of either or of anything around them.\n for (const start of [bar, heading.parentElement]) {\n for (let node = start; node; node = node.parentElement) mutations?.observe(node, { attributes: true, attributeFilter: [\"class\", \"style\"] })\n }\n return () => {\n unsubscribe()\n observer?.disconnect()\n mutations?.disconnect()\n bar.removeAttribute(\"data-title-collapsed\")\n for (const token of LARGE_TITLE_TOKENS) heading.style.removeProperty(token)\n }\n}\n\n/* ------------------------------------------------------------------ */\n/* Root */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarProps = HTMLAttributes<HTMLDivElement> & {\n /** @default \"top\" */\n placement?: ToolbarPlacement\n /** Layout of `Toolbar.Title` in a top bar. @default \"inline\" */\n titleStyle?: ToolbarTitleStyle\n /** Alignment of an inline title. Compact and large titles always start at the leading edge. @default \"center\" */\n titleAlign?: ToolbarTitleAlign\n /** How the bar meets the content scrolled under it on a phone. @default \"glass\" at the top, \"soft\" at the bottom */\n background?: ToolbarBackground\n ref?: Ref<HTMLDivElement>\n}\n\nfunction ToolbarRoot({\n placement = \"top\",\n titleStyle = \"inline\",\n titleAlign = \"center\",\n background = placement === \"bottom\" ? \"soft\" : \"glass\",\n className,\n children,\n ref,\n ...restProps\n}: ToolbarProps) {\n const host = useContext(ToolbarHostContext)\n const element = useRef<HTMLDivElement | null>(null)\n const [barElement, setBarElement] = useState<HTMLDivElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n setBarElement(node)\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n const setHeight = host?.setHeight\n useLayoutEffect(() => {\n const bar = element.current\n if (!bar || !setHeight) return\n // A desktop layout hides the bar; its height then leaves the host's own header in charge.\n const update = () => setHeight(placement, bar.offsetHeight || undefined)\n update()\n const observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(update) : undefined\n observer?.observe(bar, { box: \"border-box\" })\n return () => { observer?.disconnect(); setHeight(placement, undefined) }\n }, [placement, setHeight])\n\n return (\n <div\n ref={setRef}\n className={clsx(s.Toolbar, className)}\n data-toolbar=\"\"\n data-placement={placement}\n data-title-style={placement === \"top\" ? titleStyle : undefined}\n data-title-align={placement === \"top\" ? titleAlign : undefined}\n data-background={barBackground(background)}\n data-host={host?.kind}\n data-scrolled={placement === \"top\" && host?.scrolled ? \"\" : undefined}\n data-content-below={placement === \"bottom\" && host?.contentBelow ? \"\" : undefined}\n data-rows-pinned={placement === \"top\" && host?.rowsPinned ? \"\" : undefined}\n {...restProps}\n >\n <ToolbarElementContext.Provider value={barElement}>\n <ToolbarTitleStyleContext.Provider value={placement === \"top\" ? titleStyle : undefined}>{children}</ToolbarTitleStyleContext.Provider>\n </ToolbarElementContext.Provider>\n </div>\n )\n}\nToolbarRoot.displayName = \"Toolbar\"\n\n/* ------------------------------------------------------------------ */\n/* Parts */\n/* ------------------------------------------------------------------ */\n\nexport type ToolbarSlotProps = HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement> }\n\nfunction ToolbarLeading({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Leading, className)} {...restProps} />\n}\nToolbarLeading.displayName = \"Toolbar.Leading\"\n\nfunction ToolbarTrailing({ className, ...restProps }: ToolbarSlotProps) {\n return <div className={clsx(s.Trailing, className)} {...restProps} />\n}\nToolbarTrailing.displayName = \"Toolbar.Trailing\"\n\nexport type ToolbarContentProps = ToolbarSlotProps & {\n /** Stretch between the leading and trailing items, as a search field does. */\n fill?: boolean\n}\n\n/** Custom middle content: a search field, a segmented control or a single centered action. */\nfunction ToolbarContent({ fill = false, className, ...restProps }: ToolbarContentProps) {\n return <div className={clsx(s.Content, className)} data-fill={fill ? \"\" : undefined} {...restProps} />\n}\nToolbarContent.displayName = \"Toolbar.Content\"\n\n/** Buttons that share one capsule. */\nfunction ToolbarGroup({ className, ...restProps }: ToolbarSlotProps) {\n return <div role=\"group\" className={clsx(s.Group, className)} {...restProps} />\n}\nToolbarGroup.displayName = \"Toolbar.Group\"\n\nconst rowOfAnchor = new WeakMap<Element, HTMLElement>()\n\n/**\n * Under a large title each row is portaled into the rows' place as it mounts, so a row that comes later (a search field\n * shown over a segmented control already there) would stand last. An empty anchor in the bar keeps the row's place among\n * the bar's rows, and the rows are moved into that order in the content, so the keyboard and a screen reader meet them\n * as they stand (Codex #7); a row added or removed in the bar orders them again.\n */\nfunction followRowOrder(anchor: HTMLElement, row: HTMLElement) {\n const bar = anchor.closest(\"[data-toolbar]\") ?? anchor.parentElement\n if (!bar) return () => {}\n rowOfAnchor.set(anchor, row)\n const place = () => {\n const slot = row.parentElement\n if (!slot) return\n const rows = Array.from(bar.querySelectorAll(\"[data-toolbar-row-anchor]\"), (mark) => rowOfAnchor.get(mark))\n .filter((each): each is HTMLElement => each?.parentElement === slot)\n // From the last row back, a row that does not stand before the next one goes right before it: only a row out of\n // place moves (the one that came later), so a field focused in another row keeps its focus (Codex #8); moveBefore,\n // where the browser has it, keeps it even in the row that moves.\n const move = (slot as HTMLElement & { moveBefore?: (node: Node, child: Node | null) => void }).moveBefore\n for (let index = rows.length - 2; index >= 0; index--) {\n const each = rows[index]\n const next = rows[index + 1]\n if (each.compareDocumentPosition(next) & Node.DOCUMENT_POSITION_FOLLOWING) continue\n try {\n if (move) {\n move.call(slot, each, next)\n continue\n }\n } catch {\n // falls back to a plain move\n }\n slot.insertBefore(each, next)\n }\n }\n place()\n const observer = typeof MutationObserver !== \"undefined\" ? new MutationObserver(place) : undefined\n observer?.observe(bar, { childList: true, subtree: true })\n return () => {\n observer?.disconnect()\n rowOfAnchor.delete(anchor)\n }\n}\n\n/**\n * A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's\n * folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in\n * their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,\n * at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a\n * safeAreaBar under a large title's bar.\n */\nfunction ToolbarRow({ className, ref, ...restProps }: ToolbarSlotProps) {\n const host = useContext(ToolbarHostContext)\n const titleStyle = useContext(ToolbarTitleStyleContext)\n const large = titleStyle === \"large\" && host?.kind === \"page\"\n const requestSlot = large ? host?.requestLargeTitleSlot : undefined\n const slot = large ? host?.largeTitleRowSlot ?? null : null\n useLayoutEffect(() => requestSlot?.(), [requestSlot])\n const element = useRef<HTMLDivElement | null>(null)\n const anchor = useRef<HTMLSpanElement | null>(null)\n const setRef = useCallback((node: HTMLDivElement | null) => {\n element.current = node\n if (typeof ref === \"function\") return ref(node)\n if (ref) ref.current = node\n }, [ref])\n useLayoutEffect(() => {\n if (!slot || !anchor.current || !element.current) return\n return followRowOrder(anchor.current, element.current)\n }, [slot])\n const row = <div ref={setRef} className={clsx(s.Row, className)} data-toolbar-row=\"\" data-in-content={slot ? \"\" : undefined} {...restProps} />\n // Under a large title the row waits for its place in the content (it comes before the first paint) and never stands\n // in the bar first: moving it from the bar into the portal would mount its children again, and a switcher that holds\n // its own selection would lose it (Codex #5).\n if (large) return slot ? <>{createPortal(row, slot)}<span ref={anchor} data-toolbar-row-anchor=\"\" hidden /></> : null\n return row\n}\nToolbarRow.displayName = \"Toolbar.Row\"\n\nexport type ToolbarTitleProps = Omit<HTMLAttributes<HTMLHeadingElement>, \"children\"> & {\n children: ReactNode\n /** A second, smaller line below the title. */\n subtitle?: ReactNode\n /**\n * Heading level. In a Dialog the dialog's own title names the Sheet, so the bar title is hidden from\n * assistive technology there. @default \"h1\"\n */\n as?: \"h1\" | \"h2\" | \"h3\"\n ref?: Ref<HTMLHeadingElement>\n}\n\nfunction ToolbarTitle({ children, subtitle, as, className, ref, ...restProps }: ToolbarTitleProps) {\n const host = useContext(ToolbarHostContext)\n const titleStyle = useContext(ToolbarTitleStyleContext)\n const bar = useContext(ToolbarElementContext)\n const headingRef = useRef<HTMLDivElement | null>(null)\n const large = titleStyle === \"large\" && host?.kind === \"page\"\n const requestSlot = large ? host?.requestLargeTitleSlot : undefined\n const slot = large ? host?.largeTitleSlot ?? null : null\n const subscribeScroll = host?.subscribeScroll\n useLayoutEffect(() => requestSlot?.(), [requestSlot])\n // In the content the title scrolls with it, on the compositor and through the overscroll, as on iOS 26. Once it has\n // gone under the bar (its last line at the bar's bottom), the bar shows it inline and a hard or glass bar its line.\n useLayoutEffect(() => {\n const heading = headingRef.current\n if (!slot || !bar || !heading || !subscribeScroll) return\n return followLargeTitle(bar, heading, subscribeScroll)\n }, [bar, slot, subscribeScroll])\n const decorative = host?.kind === \"dialog\"\n const Tag = as ?? \"h1\"\n const hasSubtitle = subtitle != null && subtitle !== false && subtitle !== \"\"\n const heading = (\n <div ref={headingRef} className={s.Heading} aria-hidden={decorative || undefined} data-in-content={slot ? \"\" : undefined}>\n <Tag ref={ref} className={clsx(s.Title, className)} {...restProps}>{children}</Tag>\n {hasSubtitle && <p className={s.Subtitle}>{subtitle}</p>}\n </div>\n )\n if (!large) return heading\n // Until the content has made its place (a server-rendered page before it hydrates), the title stands in the bar\n // where it will stand in the content. The inline copy the row of controls shows once the large title has gone\n // under it keeps a subtitle as a second line, as in the inline title (iOS 26 kit Toolbar - Top - iPhone, Title 2 Line).\n return (\n <>\n {slot ? createPortal(heading, slot) : heading}\n <span className={s.CollapsedTitle} aria-hidden=\"true\">\n {hasSubtitle ? <><span className={s.CollapsedLine}>{children}</span><span className={s.CollapsedSubtitle}>{subtitle}</span></> : children}\n </span>\n </>\n )\n}\nToolbarTitle.displayName = \"Toolbar.Title\"\n\n/* ------------------------------------------------------------------ */\n/* Compound */\n/* ------------------------------------------------------------------ */\n\nexport const Toolbar = ToolbarRoot as typeof ToolbarRoot & {\n Leading: typeof ToolbarLeading\n Title: typeof ToolbarTitle\n Content: typeof ToolbarContent\n Group: typeof ToolbarGroup\n Trailing: typeof ToolbarTrailing\n Row: typeof ToolbarRow\n}\n\nToolbar.Leading = ToolbarLeading\nToolbar.Title = ToolbarTitle\nToolbar.Content = ToolbarContent\nToolbar.Group = ToolbarGroup\nToolbar.Trailing = ToolbarTrailing\nToolbar.Row = ToolbarRow\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Toolbar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,kBAAkB,GAYnB,MAAM,WAAW,CAAA","sourcesContent":["export {\n Toolbar,\n ToolbarHostContext,\n type BarBackground,\n type BarBackgroundAlias,\n type ToolbarBackground,\n type ToolbarContentProps,\n type ToolbarHost,\n type ToolbarPlacement,\n type ToolbarProps,\n type ToolbarSlotProps,\n type ToolbarTitleAlign,\n type ToolbarTitleProps,\n type ToolbarTitleStyle,\n} from \"./Toolbar\"\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties, type ReactNode } from "react";
|
|
2
|
-
import { type BarBackground } from "../Toolbar/Toolbar.js";
|
|
2
|
+
import { type BarBackground, type BarBackgroundAlias } from "../Toolbar/Toolbar.js";
|
|
3
3
|
export type DialogProps = {
|
|
4
4
|
open?: boolean;
|
|
5
5
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -103,7 +103,7 @@ type DialogSlotProps = {
|
|
|
103
103
|
className?: string;
|
|
104
104
|
};
|
|
105
105
|
/** How a Sheet's bar meets the content scrolled under it; see `BarBackground`. */
|
|
106
|
-
export type DialogBarBackground = BarBackground;
|
|
106
|
+
export type DialogBarBackground = BarBackground | BarBackgroundAlias;
|
|
107
107
|
export type DialogHeaderProps = DialogSlotProps & {
|
|
108
108
|
/** How the bar meets the content scrolled under it in a phone Sheet. @default "glass" */
|
|
109
109
|
background?: DialogBarBackground;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type HTMLAttributes, type Ref } from "react";
|
|
2
|
-
import { type BarBackground } from "../Toolbar/Toolbar.js";
|
|
3
|
-
/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. */
|
|
4
|
-
export type PageBarBackground = BarBackground;
|
|
2
|
+
import { type BarBackground, type BarBackgroundAlias } from "../Toolbar/Toolbar.js";
|
|
3
|
+
/** How a phone bar of the page meets the content scrolled under it; see `BarBackground`. `"solid"` is the earlier name of `"hard"`. */
|
|
4
|
+
export type PageBarBackground = BarBackground | BarBackgroundAlias;
|
|
5
5
|
export type PageWidth = "full" | "wide" | "column";
|
|
6
6
|
export type PageProps = HTMLAttributes<HTMLDivElement> & {
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type MouseEvent, type ReactNode, type Ref } from "react";
|
|
2
|
-
import { type BarBackground } from "../Toolbar/Toolbar.js";
|
|
2
|
+
import { type BarBackground, type BarBackgroundAlias } from "../Toolbar/Toolbar.js";
|
|
3
3
|
export type TabBarSearch = {
|
|
4
4
|
/** The value of the search tab. */
|
|
5
5
|
value: string;
|
|
@@ -40,8 +40,8 @@ export type TabBarProps = {
|
|
|
40
40
|
defaultMinimized?: boolean;
|
|
41
41
|
/** Called when the bar minimizes or expands. */
|
|
42
42
|
onMinimizedChange?: (minimized: boolean) => void;
|
|
43
|
-
/** How the bar meets the content scrolled under it; see `BarBackground
|
|
44
|
-
background?: BarBackground;
|
|
43
|
+
/** How the bar meets the content scrolled under it; see `BarBackground` (`"solid"` is the earlier name of `"hard"`). @default "soft" */
|
|
44
|
+
background?: BarBackground | BarBackgroundAlias;
|
|
45
45
|
/**
|
|
46
46
|
* Content in a glass capsule above the tabs, a now playing row or a status, as the iOS 27 bottom accessory;
|
|
47
47
|
* minimized, it stands between the two circles. The bar grows by its height.
|
|
@@ -5,16 +5,26 @@ export type ToolbarTitleStyle = "inline" | "large" | "compact-large" | "compact-
|
|
|
5
5
|
export type ToolbarTitleAlign = "center" | "start";
|
|
6
6
|
/**
|
|
7
7
|
* How a bar meets the content scrolled under it, after the scroll edge effect of iOS 26:
|
|
8
|
-
* - `"soft"` (the default of a bottom bar): at the top,
|
|
9
|
-
*
|
|
10
|
-
* and a Sheet's bottom bar fades its content into the panel
|
|
11
|
-
* - `"hard"`: an opaque bar of the canvas color with a
|
|
8
|
+
* - `"soft"` (the default of a bottom bar): at the top, once content is under the bar, a blur that grows toward the top under a
|
|
9
|
+
* thin veil of the canvas color, with no line, which lets go past the bar; at the bottom of a page the content stays clear
|
|
10
|
+
* under and around the controls, as on native iOS 26, and a Sheet's bottom bar fades its content into the panel
|
|
11
|
+
* - `"hard"`: an opaque bar of the canvas color with a hairline once content is under it
|
|
12
12
|
* - `"glass"` (the default of a top bar): a translucent, blurred bar with a hairline, shown once content is under it
|
|
13
|
-
* - `"
|
|
13
|
+
* - `"blur"`: no fill and no line, once content is under the bar: the content blurred a little over the bar and past it,
|
|
14
|
+
* and heavily toward the screen's edge
|
|
15
|
+
*
|
|
16
|
+
* iOS 27.2 has two scroll edges, soft and hard; glass is the bar of earlier iOS and blur an app's own.
|
|
14
17
|
*/
|
|
15
|
-
export type BarBackground = "soft" | "hard" | "glass" | "
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
+
export type BarBackground = "soft" | "hard" | "glass" | "blur";
|
|
19
|
+
/**
|
|
20
|
+
* `"solid"` is the earlier name of `"hard"`: iOS has no opaque bar without a line, and it draws the line of a hard edge
|
|
21
|
+
* only once content is under the bar, so at rest the two look the same.
|
|
22
|
+
*/
|
|
23
|
+
export type BarBackgroundAlias = "solid";
|
|
24
|
+
/** `"edge"` is the earlier name of `"soft"`, `"solid"` of `"hard"`. */
|
|
25
|
+
export type ToolbarBackground = BarBackground | BarBackgroundAlias | "edge";
|
|
26
|
+
/** The background a bar draws, from its current name or an earlier one. */
|
|
27
|
+
export declare const barBackground: (background: ToolbarBackground | undefined) => BarBackground | undefined;
|
|
18
28
|
/**
|
|
19
29
|
* A surface that places phone toolbars: `Page` puts the top bar over its content
|
|
20
30
|
* and reserves the space; `Dialog` puts it 16px under the Sheet's top edge.
|
|
@@ -28,6 +38,14 @@ export type ToolbarHost = {
|
|
|
28
38
|
contentBelow?: boolean;
|
|
29
39
|
/** Calls the listener with the content's scroll offset on every scroll; returns the unsubscribe. A TabBar minimizes with it. */
|
|
30
40
|
subscribeScroll?: (listener: (scrollTop: number) => void) => () => void;
|
|
41
|
+
/** A large title asks for a place in the content; returns the release. */
|
|
42
|
+
requestLargeTitleSlot?: () => () => void;
|
|
43
|
+
/** The place at the top of the content where a large title scrolls with it, once the content has made one. */
|
|
44
|
+
largeTitleSlot?: HTMLElement | null;
|
|
45
|
+
/** The place under a large title where the bar's rows stand, pinned under the bar once scrolled up to it. */
|
|
46
|
+
largeTitleRowSlot?: HTMLElement | null;
|
|
47
|
+
/** The rows under a large title are pinned under the bar, so its background reaches under them. */
|
|
48
|
+
rowsPinned?: boolean;
|
|
31
49
|
};
|
|
32
50
|
export declare const ToolbarHostContext: import("react").Context<ToolbarHost | null>;
|
|
33
51
|
export type ToolbarProps = HTMLAttributes<HTMLDivElement> & {
|
|
@@ -70,6 +88,17 @@ declare function ToolbarGroup({ className, ...restProps }: ToolbarSlotProps): im
|
|
|
70
88
|
declare namespace ToolbarGroup {
|
|
71
89
|
var displayName: string;
|
|
72
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* A row under the controls, part of the bar: a segmented control that switches the screen's views (a chat list's
|
|
93
|
+
* folders under its bar), or a search field. It spans the bar, and a control in it fills the row; several rows stand in
|
|
94
|
+
* their order (a search field over a segmented control). Under a large title on a page the rows stand under the title,
|
|
95
|
+
* at the top of the content, and once scrolled up to the bar they stay pinned under its controls, as iOS 27.2 pins a
|
|
96
|
+
* safeAreaBar under a large title's bar.
|
|
97
|
+
*/
|
|
98
|
+
declare function ToolbarRow({ className, ref, ...restProps }: ToolbarSlotProps): import("react/jsx-runtime").JSX.Element | null;
|
|
99
|
+
declare namespace ToolbarRow {
|
|
100
|
+
var displayName: string;
|
|
101
|
+
}
|
|
73
102
|
export type ToolbarTitleProps = Omit<HTMLAttributes<HTMLHeadingElement>, "children"> & {
|
|
74
103
|
children: ReactNode;
|
|
75
104
|
/** A second, smaller line below the title. */
|
|
@@ -91,5 +120,6 @@ export declare const Toolbar: typeof ToolbarRoot & {
|
|
|
91
120
|
Content: typeof ToolbarContent;
|
|
92
121
|
Group: typeof ToolbarGroup;
|
|
93
122
|
Trailing: typeof ToolbarTrailing;
|
|
123
|
+
Row: typeof ToolbarRow;
|
|
94
124
|
};
|
|
95
125
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Toolbar, ToolbarHostContext, type BarBackground, type ToolbarBackground, type ToolbarContentProps, type ToolbarHost, type ToolbarPlacement, type ToolbarProps, type ToolbarSlotProps, type ToolbarTitleAlign, type ToolbarTitleProps, type ToolbarTitleStyle, } from "./Toolbar.js";
|
|
1
|
+
export { Toolbar, ToolbarHostContext, type BarBackground, type BarBackgroundAlias, type ToolbarBackground, type ToolbarContentProps, type ToolbarHost, type ToolbarPlacement, type ToolbarProps, type ToolbarSlotProps, type ToolbarTitleAlign, type ToolbarTitleProps, type ToolbarTitleStyle, } from "./Toolbar.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexui/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"description": "Modern design system for building high-quality applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@maskito/core": "^5.2.2",
|
|
100
100
|
"@maskito/kit": "^5.2.2",
|
|
101
101
|
"@maskito/react": "^5.2.2",
|
|
102
|
-
"@plexui/styles": "^0.
|
|
102
|
+
"@plexui/styles": "^0.4.0",
|
|
103
103
|
"@radix-ui/react-dismissable-layer": "1.2.1",
|
|
104
104
|
"@radix-ui/react-focus-guards": "1.2.0",
|
|
105
105
|
"@radix-ui/react-focus-scope": "1.3.1",
|