@aglyn/plugins-mui 1.0.0-beta.143
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/LICENSE +201 -0
- package/README.md +22 -0
- package/package.json +47 -0
- package/src/index.d.ts +21 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/accordion.d.ts +96 -0
- package/src/lib/components/accordion.js +392 -0
- package/src/lib/components/accordion.js.map +1 -0
- package/src/lib/components/app-bar.d.ts +32 -0
- package/src/lib/components/app-bar.js +86 -0
- package/src/lib/components/app-bar.js.map +1 -0
- package/src/lib/components/blocks.d.ts +46 -0
- package/src/lib/components/blocks.js +1007 -0
- package/src/lib/components/blocks.js.map +1 -0
- package/src/lib/components/box.d.ts +47 -0
- package/src/lib/components/box.js +125 -0
- package/src/lib/components/box.js.map +1 -0
- package/src/lib/components/breadcrumbs.d.ts +44 -0
- package/src/lib/components/breadcrumbs.js +172 -0
- package/src/lib/components/breadcrumbs.js.map +1 -0
- package/src/lib/components/button.d.ts +89 -0
- package/src/lib/components/button.js +272 -0
- package/src/lib/components/button.js.map +1 -0
- package/src/lib/components/card.d.ts +61 -0
- package/src/lib/components/card.js +336 -0
- package/src/lib/components/card.js.map +1 -0
- package/src/lib/components/collection.d.ts +514 -0
- package/src/lib/components/collection.js +2999 -0
- package/src/lib/components/collection.js.map +1 -0
- package/src/lib/components/container.d.ts +42 -0
- package/src/lib/components/container.js +169 -0
- package/src/lib/components/container.js.map +1 -0
- package/src/lib/components/custom-html.d.ts +78 -0
- package/src/lib/components/custom-html.js +219 -0
- package/src/lib/components/custom-html.js.map +1 -0
- package/src/lib/components/data-table.d.ts +57 -0
- package/src/lib/components/data-table.js +216 -0
- package/src/lib/components/data-table.js.map +1 -0
- package/src/lib/components/document-root.d.ts +77 -0
- package/src/lib/components/document-root.js +118 -0
- package/src/lib/components/document-root.js.map +1 -0
- package/src/lib/components/drawer.d.ts +93 -0
- package/src/lib/components/drawer.js +566 -0
- package/src/lib/components/drawer.js.map +1 -0
- package/src/lib/components/function-controls.d.ts +66 -0
- package/src/lib/components/function-controls.js +207 -0
- package/src/lib/components/function-controls.js.map +1 -0
- package/src/lib/components/function-scope.d.ts +110 -0
- package/src/lib/components/function-scope.js +478 -0
- package/src/lib/components/function-scope.js.map +1 -0
- package/src/lib/components/function-widget.d.ts +75 -0
- package/src/lib/components/function-widget.js +307 -0
- package/src/lib/components/function-widget.js.map +1 -0
- package/src/lib/components/grid.d.ts +91 -0
- package/src/lib/components/grid.js +322 -0
- package/src/lib/components/grid.js.map +1 -0
- package/src/lib/components/icon.d.ts +54 -0
- package/src/lib/components/icon.js +163 -0
- package/src/lib/components/icon.js.map +1 -0
- package/src/lib/components/image-list.d.ts +58 -0
- package/src/lib/components/image-list.js +336 -0
- package/src/lib/components/image-list.js.map +1 -0
- package/src/lib/components/image.d.ts +154 -0
- package/src/lib/components/image.js +451 -0
- package/src/lib/components/image.js.map +1 -0
- package/src/lib/components/inline-text.d.ts +74 -0
- package/src/lib/components/inline-text.js +407 -0
- package/src/lib/components/inline-text.js.map +1 -0
- package/src/lib/components/language-switcher.d.ts +35 -0
- package/src/lib/components/language-switcher.js +179 -0
- package/src/lib/components/language-switcher.js.map +1 -0
- package/src/lib/components/layout-slot.d.ts +68 -0
- package/src/lib/components/layout-slot.js +192 -0
- package/src/lib/components/layout-slot.js.map +1 -0
- package/src/lib/components/link-box-accessible-name.d.ts +79 -0
- package/src/lib/components/link-box-accessible-name.js +158 -0
- package/src/lib/components/link-box-accessible-name.js.map +1 -0
- package/src/lib/components/link-box.d.ts +66 -0
- package/src/lib/components/link-box.js +212 -0
- package/src/lib/components/link-box.js.map +1 -0
- package/src/lib/components/list-item-text.d.ts +22 -0
- package/src/lib/components/list-item-text.js +86 -0
- package/src/lib/components/list-item-text.js.map +1 -0
- package/src/lib/components/list-item.d.ts +32 -0
- package/src/lib/components/list-item.js +127 -0
- package/src/lib/components/list-item.js.map +1 -0
- package/src/lib/components/list.d.ts +34 -0
- package/src/lib/components/list.js +108 -0
- package/src/lib/components/list.js.map +1 -0
- package/src/lib/components/markdown.d.ts +129 -0
- package/src/lib/components/markdown.js +853 -0
- package/src/lib/components/markdown.js.map +1 -0
- package/src/lib/components/nav-menu.d.ts +68 -0
- package/src/lib/components/nav-menu.js +683 -0
- package/src/lib/components/nav-menu.js.map +1 -0
- package/src/lib/components/pagination.d.ts +59 -0
- package/src/lib/components/pagination.js +243 -0
- package/src/lib/components/pagination.js.map +1 -0
- package/src/lib/components/paper.d.ts +47 -0
- package/src/lib/components/paper.js +202 -0
- package/src/lib/components/paper.js.map +1 -0
- package/src/lib/components/plugin-frame.d.ts +64 -0
- package/src/lib/components/plugin-frame.js +335 -0
- package/src/lib/components/plugin-frame.js.map +1 -0
- package/src/lib/components/plugin.d.ts +95 -0
- package/src/lib/components/plugin.js +304 -0
- package/src/lib/components/plugin.js.map +1 -0
- package/src/lib/components/product.d.ts +40 -0
- package/src/lib/components/product.js +287 -0
- package/src/lib/components/product.js.map +1 -0
- package/src/lib/components/reusable-instance.d.ts +57 -0
- package/src/lib/components/reusable-instance.js +126 -0
- package/src/lib/components/reusable-instance.js.map +1 -0
- package/src/lib/components/screen-link.d.ts +85 -0
- package/src/lib/components/screen-link.js +324 -0
- package/src/lib/components/screen-link.js.map +1 -0
- package/src/lib/components/search-box.d.ts +41 -0
- package/src/lib/components/search-box.js +125 -0
- package/src/lib/components/search-box.js.map +1 -0
- package/src/lib/components/section.d.ts +56 -0
- package/src/lib/components/section.js +132 -0
- package/src/lib/components/section.js.map +1 -0
- package/src/lib/components/stack.d.ts +55 -0
- package/src/lib/components/stack.js +309 -0
- package/src/lib/components/stack.js.map +1 -0
- package/src/lib/components/tabs.d.ts +288 -0
- package/src/lib/components/tabs.js +788 -0
- package/src/lib/components/tabs.js.map +1 -0
- package/src/lib/components/theme-mode-switcher.d.ts +38 -0
- package/src/lib/components/theme-mode-switcher.js +168 -0
- package/src/lib/components/theme-mode-switcher.js.map +1 -0
- package/src/lib/components/toolbar.d.ts +37 -0
- package/src/lib/components/toolbar.js +117 -0
- package/src/lib/components/toolbar.js.map +1 -0
- package/src/lib/components/typography.d.ts +33 -0
- package/src/lib/components/typography.js +433 -0
- package/src/lib/components/typography.js.map +1 -0
- package/src/lib/components/video-lightbox-controls.d.ts +131 -0
- package/src/lib/components/video-lightbox-controls.js +536 -0
- package/src/lib/components/video-lightbox-controls.js.map +1 -0
- package/src/lib/components/video-lightbox.d.ts +60 -0
- package/src/lib/components/video-lightbox.js +247 -0
- package/src/lib/components/video-lightbox.js.map +1 -0
- package/src/lib/components/video-playback-beacon.d.ts +80 -0
- package/src/lib/components/video-playback-beacon.js +128 -0
- package/src/lib/components/video-playback-beacon.js.map +1 -0
- package/src/lib/components/video-player-frame.d.ts +58 -0
- package/src/lib/components/video-player-frame.js +51 -0
- package/src/lib/components/video-player-frame.js.map +1 -0
- package/src/lib/components/video.d.ts +220 -0
- package/src/lib/components/video.js +874 -0
- package/src/lib/components/video.js.map +1 -0
- package/src/lib/constants/bundle-common.d.ts +17 -0
- package/src/lib/constants/bundle-common.js +18 -0
- package/src/lib/constants/bundle-common.js.map +1 -0
- package/src/lib/constants/field-presets.d.ts +93 -0
- package/src/lib/constants/field-presets.js +248 -0
- package/src/lib/constants/field-presets.js.map +1 -0
- package/src/lib/plugin.d.ts +80 -0
- package/src/lib/plugin.js +599 -0
- package/src/lib/plugin.js.map +1 -0
- package/src/lib/utils/author-html-label.d.ts +73 -0
- package/src/lib/utils/author-html-label.js +89 -0
- package/src/lib/utils/author-html-label.js.map +1 -0
- package/src/lib/utils/drop-cleared-props.d.ts +18 -0
- package/src/lib/utils/drop-cleared-props.js +74 -0
- package/src/lib/utils/drop-cleared-props.js.map +1 -0
- package/src/lib/utils/element-picker.d.ts +99 -0
- package/src/lib/utils/element-picker.js +140 -0
- package/src/lib/utils/element-picker.js.map +1 -0
- package/src/lib/utils/generate-preset-id.d.ts +19 -0
- package/src/lib/utils/generate-preset-id.js +25 -0
- package/src/lib/utils/generate-preset-id.js.map +1 -0
- package/src/lib/utils/link-target-props.d.ts +53 -0
- package/src/lib/utils/link-target-props.js +53 -0
- package/src/lib/utils/link-target-props.js.map +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/nav-menu.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { mdiChevronDown, mdiFormDropdown, mdiViewGridOutline } from '@aglyn/shared-data-mdi'\nimport { MdiIcon } from '@aglyn/shared-ui-jsx'\nimport Box, { type BoxProps } from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport ClickAwayListener from '@mui/material/ClickAwayListener'\nimport Paper from '@mui/material/Paper'\nimport Stack from '@mui/material/Stack'\nimport Typography from '@mui/material/Typography'\nimport {\n forwardRef,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport type { SxProps } from '@mui/material/styles'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { generatePresetId } from '../utils/generate-preset-id'\nimport { isLeafSelectedWithin, parseLeafNodeId } from './drawer'\n\n// Component ids are persisted in screen documents; never rename.\nexport const NAV_MENU_ID: Aglyn.ComponentId = 'muiNavMenu'\nexport const MEGA_MENU_ID: Aglyn.ComponentId = 'muiMegaMenu'\n\nexport type MegaMenuPanelWidth = 'auto' | 'wide' | 'full'\n\n/** Hover close grace period so the pointer can cross into the panel. */\nconst HOVER_CLOSE_DELAY_MS = 150\n\nexport interface NavMenuProps {\n /** Visible trigger text of the nav item. */\n label?: string\n /**\n * Authored node styles, handed over by the renderer rather than typed into\n * an attribute. It lands on the element root and the trigger inherits, which\n * is what lets an author override the default text transform (AGL-1198) —\n * so it has to be expressible by a typed caller too (AGL-1323).\n */\n sx?: SxProps\n children?: ReactNode\n}\n\nexport interface MegaMenuProps {\n label?: string\n /** Panel width preset: content-sized, wide (720px), or full-bleed. */\n panelWidth?: MegaMenuPanelWidth\n /** Authored node styles — see `NavMenuProps.sx`. */\n sx?: SxProps\n children?: ReactNode\n}\n\n/**\n * Mounted menus in mount order (AGL-568). Broadcast commands (no target\n * node id) are answered by the FIRST registered menu only, mirroring the\n * drawer bus, so a page with one menu needs no wiring at all.\n */\nconst mountedMenus: string[] = []\n\n/**\n * The panel sx per mega-menu width preset. Wide/full center under the\n * trigger with the 50%/translate trick, so no measuring is needed and\n * SSR markup is stable.\n */\nexport function megaMenuPanelSx(panelWidth: MegaMenuPanelWidth): SxProps {\n switch (panelWidth) {\n case 'full':\n return {\n width: '100vw',\n maxWidth: '100vw',\n left: '50%',\n transform: 'translateX(-50%)',\n borderRadius: 0,\n }\n case 'wide':\n return {\n width: 'min(90vw, 720px)',\n left: '50%',\n transform: 'translateX(-50%)',\n }\n default:\n return { minWidth: 280, left: 0 }\n }\n}\n\n/**\n * Shared dropdown shell (AGL-562, interactions-driven since AGL-568): a\n * trigger button plus an absolutely positioned panel inside a relative\n * wrapper. Keeping the panel inside the wrapper's DOM (no portal) makes\n * pointer leave of trigger + panel a single mouseleave and keeps SSR\n * hydration trivial — the panel simply isn't rendered until opened, so\n * the server ships a closed menu.\n *\n * Open/close behavior: clicking the trigger toggles the menu (the\n * zero-config default), and the interactions system drives it over the\n * menu command bus (`dispatchMenuCommand`) keyed by node id — e.g. \"On\n * hover → Open menu (this element)\". Hover-opened menus close on their\n * own when the pointer leaves the trigger + panel surface (with a short\n * grace period); click/command opens stay put until click-away, Escape,\n * or an explicit close.\n *\n * On the static besigner canvas (flagged by ScreenLinkContext.editorInert)\n * the menu mirrors the live site's collapsed state: just the trigger, no\n * panel (AGL-571). Only while the menu or one of its descendants is selected\n * (the renderer stamps `data-aglyn-selected-within` on the leaf) does the\n * panel expand inline, like form fields do, so its contents stay selectable\n * and editable without fighting a popup — and it collapses again the moment\n * selection leaves the subtree. The Preview surface is NOT inert (AGL-830):\n * it suppresses link navigation but runs interactions for real, so the menu\n * takes the live branch and opens on hover exactly like the tenant site.\n */\ninterface MenuShellProps extends BoxProps {\n label: string\n editorHint: string\n panelSx: SxProps\n}\n\n/**\n * Trigger typography (AGL-1198). A menu label sits in a nav beside plain\n * links, so it reads as navigation, not as a call to action — MUI's\n * uppercase Button transform shouts \"PRODUCT\" next to \"Pricing\". The\n * default lives on the WRAPPER and the Button inherits it, so an author\n * who does want uppercase can set it in STYLES → Typography on the\n * element and have it win; before this there was no way to change it at\n * all, because the Button is internal to the element.\n */\nconst TRIGGER_SHELL_SX = {\n position: 'relative',\n display: 'inline-flex',\n textTransform: 'none',\n} as const\n/**\n * The rest of the same argument, generalized (AGL-2542).\n *\n * `textTransform` was one symptom of a whole button's worth of them. The\n * trigger still arrived as a `Button`: 0.875rem where the links beside it\n * were 15px, `min-width: 64px` padding \"Docs\" out to a width its own text\n * never asked for, and `6px 8px` of padding widening the visual gap on two\n * items out of five. In a nav laid out on a flat gap, that is a rhythm one\n * element breaks and no author can fix — the Button is internal, so a font\n * size set in STYLES lands on the wrapper and MUI's own class outranks it.\n *\n * So every typographic property is handed back to the wrapper the same way\n * `textTransform` was, and the button chrome that has no meaning on a nav\n * item is dropped. The element now renders as what it is — a label in a nav\n * — and STYLES → Typography on it reaches the label, which is the control an\n * author was reaching for when they found there wasn't one.\n *\n * `endIcon`'s negative right margin goes with the padding it was tucking\n * into; left at -4px against zero padding, the chevron would hang outside\n * the element and break the gap it just stopped breaking.\n *\n * ⚠️ Padding is where the hover target came from, and a hover-opened menu is\n * only as reachable as its trigger. It belongs on the WRAPPER now — which is\n * both what an author can actually edit and what `onMouseLeave` measures, so\n * padding added there enlarges the target instead of merely looking like it.\n */\nconst TRIGGER_SX = {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n fontWeight: 'inherit',\n lineHeight: 'inherit',\n letterSpacing: 'inherit',\n textTransform: 'inherit',\n color: 'inherit',\n minWidth: 0,\n padding: 0,\n '& .MuiButton-endIcon': { marginRight: 0 },\n} as const\n\nconst MenuShell = forwardRef<HTMLDivElement, MenuShellProps>((props, ref) => {\n const { label, editorHint, panelSx, sx, children, ...rest } = props\n // Node styles ride the sx prop the renderer merges; keep them by\n // composing with the shell's own layout sx (stack.ts pattern).\n const nodeSx = Array.isArray(sx) ? sx : sx ? [sx] : []\n const { editorInert } = Aglyn.useScreenLink(undefined)\n const [open, setOpen] = useState(false)\n // True while the menu is open BECAUSE a hover interaction opened it —\n // only then does pointer leave close the menu.\n const hoverOpenRef = useRef(false)\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null)\n // The renderer stamps the node id on every leaf; commands target it.\n const nodeId = useMemo(\n () => parseLeafNodeId((rest as Record<string, unknown>)['data-aglyn']),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [(rest as Record<string, unknown>)['data-aglyn']],\n )\n\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current)\n closeTimer.current = null\n }\n }, [])\n const closeNow = useCallback(() => {\n cancelClose()\n hoverOpenRef.current = false\n setOpen(false)\n }, [cancelClose])\n const scheduleClose = useCallback(() => {\n cancelClose()\n closeTimer.current = setTimeout(closeNow, HOVER_CLOSE_DELAY_MS)\n }, [cancelClose, closeNow])\n\n // Menu command bus enrollment (AGL-568): mirrors the drawer exactly —\n // live surfaces only, keyed by node id, broadcasts answered by the\n // first mounted menu.\n useEffect(() => {\n if (editorInert || !nodeId) return undefined\n mountedMenus.push(nodeId)\n const unsubscribe = Aglyn.subscribeMenuCommands((detail) => {\n // Match on the un-namespaced suffix (AGL-573): a command authored on\n // a layout-scoped menu carries the raw canvas id while this menu's\n // live id is `layout__`-namespaced (or vice versa) — leafIdsMatch\n // compares them equal without re-authoring the persisted action.\n const targeted = detail.nodeId\n ? Aglyn.leafIdsMatch(detail.nodeId, nodeId)\n : mountedMenus[0] === nodeId\n if (!targeted) return\n cancelClose()\n if (detail.command === 'close') {\n hoverOpenRef.current = false\n setOpen(false)\n return\n }\n // open/toggle: remember hover provenance so pointer leave closes\n // hover-opened menus (and never click/command-opened ones).\n hoverOpenRef.current = Boolean(detail.hover)\n if (detail.command === 'open') setOpen(true)\n else setOpen((value) => !value)\n })\n return () => {\n unsubscribe()\n cancelClose()\n const index = mountedMenus.indexOf(nodeId)\n if (index >= 0) mountedMenus.splice(index, 1)\n }\n }, [editorInert, nodeId, cancelClose])\n\n if (editorInert) {\n // Editor affordance (AGL-571): collapsed trigger by default — exactly\n // what the live site shows — expanding to the editable panel only while\n // the menu subtree holds the selection.\n const authoring = isLeafSelectedWithin(rest as Record<string, unknown>)\n return (\n <Box\n ref={ref}\n {...rest}\n // Relative so the authoring panel drops UNDER the trigger as an\n // overlay (AGL-830). The old inline-block expanded the panel in the\n // toolbar's flow, shoving and overlapping the other nav items in a\n // horizontal app bar; positioning it like the live popup keeps the\n // bar intact while the panel stays selectable and editable in place.\n sx={[TRIGGER_SHELL_SX, ...nodeSx]}\n >\n <Button\n color=\"inherit\"\n aria-expanded={authoring || undefined}\n endIcon={<MdiIcon path={mdiChevronDown.path} />}\n sx={TRIGGER_SX}\n >\n {label}\n </Button>\n {authoring ? (\n <Paper\n elevation={4}\n aria-label={label}\n sx={[\n {\n position: 'absolute',\n top: '100%',\n mt: 0.5,\n zIndex: (theme) => theme.zIndex.modal,\n p: 1,\n border: '1px dashed',\n borderColor: 'divider',\n },\n panelSx as never,\n ]}\n >\n <Typography\n variant=\"caption\"\n color=\"text.secondary\"\n sx={{ display: 'block', mb: 0.5, px: 1 }}\n >\n {editorHint}\n </Typography>\n {children}\n </Paper>\n ) : null}\n </Box>\n )\n }\n\n return (\n <ClickAwayListener onClickAway={() => open && closeNow()}>\n <Box\n ref={ref}\n {...rest}\n // Hover-close choreography (AGL-568): the panel renders inside\n // this wrapper (no portal), so trigger + panel share one\n // enter/leave pair. Only hover-opened menus follow the pointer\n // out; enter always cancels a pending close so the pointer can\n // travel between trigger and panel.\n onMouseEnter={cancelClose}\n onMouseLeave={() => {\n if (hoverOpenRef.current) scheduleClose()\n }}\n onKeyDown={(event: KeyboardEvent) => {\n if (event.key === 'Escape') closeNow()\n }}\n sx={[TRIGGER_SHELL_SX, ...nodeSx]}\n >\n <Button\n color=\"inherit\"\n aria-haspopup=\"true\"\n aria-expanded={open || undefined}\n endIcon={<MdiIcon path={mdiChevronDown.path} />}\n sx={TRIGGER_SX}\n onClick={() => {\n // Zero-config default: the trigger click-toggles its menu;\n // a click also \"pins\" a hover-opened menu.\n cancelClose()\n hoverOpenRef.current = false\n setOpen((value) => !value)\n }}\n >\n {label}\n </Button>\n {open ? (\n <Paper\n elevation={4}\n aria-label={label}\n sx={[\n {\n position: 'absolute',\n top: '100%',\n zIndex: (theme) => theme.zIndex.modal,\n p: 1,\n },\n panelSx as never,\n ]}\n >\n {children}\n </Paper>\n ) : null}\n </Box>\n </ClickAwayListener>\n )\n})\nMenuShell.displayName = 'AglynMenuShell'\n\n/**\n * Strips the pre-AGL-568 \"Open on\" attribute persisted docs may still\n * carry. Behavior configuration rides the interactions system now; the\n * stored value is ignored silently — no migrations, no warnings — and\n * must never leak onto the DOM.\n */\nfunction stripLegacyTrigger(rest: Record<string, unknown>): void {\n delete rest['trigger']\n}\n\n/**\n * Dropdown nav item (AGL-562): a labeled nav button whose children —\n * screen links, buttons, anything — open in a dropdown panel. Clicking\n * the trigger toggles it; interactions drive it over the menu command\n * bus (AGL-568). SSR ships the menu closed; no window access happens at\n * render.\n */\nconst NavMenu = forwardRef<HTMLDivElement, NavMenuProps>((props, ref) => {\n const { label, children, ...rest } = props\n stripLegacyTrigger(rest as Record<string, unknown>)\n return (\n <MenuShell\n ref={ref}\n label={label || 'Menu'}\n editorHint=\"Dropdown items — shown in a menu on the live site\"\n panelSx={{ minWidth: 220, left: 0 }}\n {...rest}\n >\n <Stack spacing={0.5} sx={{ alignItems: 'stretch' }}>\n {children}\n </Stack>\n </MenuShell>\n )\n})\nNavMenu.displayName = 'AglynNavMenu'\n\n/**\n * Mega menu (AGL-562): a SaaS-style wide panel anchored under a nav\n * item with a free-form canvas slot — columns of links, promos,\n * whatever the author drops in. Click-toggles like the dropdown; the\n * SaaS hover-open convention is one interaction away (\"On hover → Open\n * menu\", AGL-568) and then closes itself on pointer leave.\n */\nexport const MegaMenu = forwardRef<HTMLDivElement, MegaMenuProps>(\n (props, ref) => {\n const { label, panelWidth, children, ...rest } = props\n stripLegacyTrigger(rest as Record<string, unknown>)\n return (\n <MenuShell\n ref={ref}\n label={label || 'Menu'}\n editorHint=\"Mega menu panel — opens under the nav item on the live site\"\n panelSx={{ p: 3, ...megaMenuPanelSx(panelWidth || 'auto') } as never}\n {...rest}\n >\n {children}\n </MenuShell>\n )\n },\n)\nMegaMenu.displayName = 'AglynMegaMenu'\n\nexport const navMenuSchema: Aglyn.ComponentSchema<NavMenuProps> = {\n $id: NAV_MENU_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Dropdown Menu',\n description: 'A nav item that opens a dropdown of links beneath it.',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: { path: mdiFormDropdown.path, sx: { color: '#2196f3' } },\n // Open/close behavior deliberately has NO attribute (AGL-568): click\n // toggles by default and everything else is authored as an\n // interaction (e.g. \"On hover → Open menu\").\n attributes: [\n {\n name: 'label',\n description: 'Text on the nav item that opens the dropdown.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n label: 'Label',\n },\n ],\n}\n\nexport const megaMenuSchema: Aglyn.ComponentSchema<MegaMenuProps> = {\n $id: MEGA_MENU_ID,\n pluginId: BUNDLE_ID,\n displayName: 'Mega Menu',\n description:\n 'A nav item that opens a wide panel — columns of links, promos, whatever you build.',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: { path: mdiViewGridOutline.path, sx: { color: '#2196f3' } },\n // Open/close behavior deliberately has NO attribute (AGL-568) — see\n // navMenuSchema.\n attributes: [\n {\n name: 'label',\n description: 'Text on the nav item that opens the panel.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n label: 'Label',\n },\n {\n name: 'panelWidth',\n description: 'How wide the opened panel is.',\n component: Aglyn.FieldComponentType.SELECT,\n label: 'Panel width',\n // `auto` is the `MegaMenuPanelWidth` member `megaMenuPanelSx` already\n // switches on, so the sentinel names the case that existed in code\n // but not in the option list (AGL-1451); `''` could not persist\n // (AGL-1191), so a wide panel could not be narrowed again.\n options: [\n { value: 'auto', label: 'Fit content' },\n { value: 'wide', label: 'Wide (720px)' },\n { value: 'full', label: 'Full width' },\n ],\n },\n ],\n}\n\nconst navLink = (label: string) => ({\n $id: null,\n componentId: 'muiScreenLink',\n pluginId: BUNDLE_ID,\n props: { children: label, color: 'inherit' },\n})\n\nconst megaColumn = (title: string, links: string[]) => ({\n $id: null,\n componentId: 'muiStack',\n pluginId: BUNDLE_ID,\n props: { spacing: 0.5 },\n // Styling goes on the node's own sx, never in props (AGL-1346) — that is\n // the record the Styles panel edits.\n sx: { minWidth: 180, alignItems: 'flex-start' },\n nodes: [\n {\n $id: null,\n componentId: 'muiTypography',\n pluginId: BUNDLE_ID,\n props: { variant: 'overline', color: 'text.secondary', children: title },\n },\n ...links.map(navLink),\n ],\n})\n\nexport const navMenuPresets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(NAV_MENU_ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Dropdown Menu',\n pluginId: BUNDLE_ID,\n description: 'Nav item that opens a dropdown of links',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: navMenuSchema.icon,\n data: {\n $id: null,\n componentId: NAV_MENU_ID,\n pluginId: BUNDLE_ID,\n props: { label: 'More' },\n nodes: [navLink('About'), navLink('Blog'), navLink('Contact')],\n },\n },\n // Primitive dropdown scaffold (AGL-589): the same result as the menu\n // elements but built from a Stack + Button + hidden panel, with the\n // hover choreography (grace delay, Esc/outside-click dismissal)\n // pre-wired as real interactions the user can edit or remove. The\n // panel carries `aglyn-hidden` so it starts closed on the live site;\n // the canvas shows it for editing (the hidden style only injects at\n // runtime).\n {\n $id: generatePresetId('muiStack', 'dropdown-panel'),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Dropdown Panel',\n pluginId: BUNDLE_ID,\n description:\n 'Trigger + hover panel built from primitives — opens on hover, ' +\n 'closes on leave with a grace delay, dismisses on Esc or outside ' +\n 'click; the wiring arrives as editable interactions',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: { path: mdiFormDropdown.path, sx: { color: '#2196f3' } },\n data: {\n $id: null,\n presetRef: 'wrapper',\n componentId: 'muiStack',\n pluginId: BUNDLE_ID,\n props: {},\n sx: { position: 'relative', display: 'inline-flex' },\n nodes: [\n {\n $id: null,\n presetRef: 'trigger',\n componentId: 'muiButton',\n pluginId: BUNDLE_ID,\n props: { children: 'Explore', color: 'inherit' },\n },\n {\n $id: null,\n presetRef: 'panel',\n componentId: 'muiStack',\n pluginId: BUNDLE_ID,\n props: {\n className: 'aglyn-hidden',\n direction: 'row',\n spacing: 4,\n },\n // The panel's whole positioning. It lived in `props.sx` on the\n // documents this preset seeded, where the Styles panel could\n // neither show nor clear it (AGL-1339/AGL-1346); a fresh insert\n // now puts it where a click can reach it. Same keys, same order,\n // and `node.sx` composes last — the panel renders identically.\n sx: {\n position: 'absolute',\n top: '100%',\n left: 0,\n zIndex: 1300,\n paddingTop: 3,\n paddingRight: 3,\n paddingBottom: 3,\n paddingLeft: 3,\n minWidth: 560,\n flexWrap: 'wrap',\n backgroundColor: 'background.paper',\n color: 'text.primary',\n boxShadow: 8,\n borderRadius: 1,\n },\n nodes: [\n megaColumn('Shop', ['New arrivals', 'Best sellers', 'Sale']),\n megaColumn('Company', ['About', 'Careers', 'Press']),\n megaColumn('Support', ['Help center', 'Contact']),\n ],\n },\n ],\n },\n interactionTemplates: [\n {\n name: 'Dropdown panel — open on hover',\n event: 'elementHoverEnter',\n triggerRef: 'wrapper',\n steps: [\n {\n type: 'showElement',\n targetRef: 'panel',\n dismissOn: ['escape', 'outsideClick'],\n },\n ],\n },\n {\n name: 'Dropdown panel — close on hover leave',\n event: 'elementHoverLeave',\n triggerRef: 'wrapper',\n steps: [{ type: 'hideElement', targetRef: 'panel', delayMs: 250 }],\n },\n ],\n },\n {\n $id: generatePresetId(MEGA_MENU_ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Mega Menu',\n pluginId: BUNDLE_ID,\n description:\n 'Wide panel with columns of links; add a hover interaction to ' +\n 'open it on hover',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: megaMenuSchema.icon,\n data: {\n $id: null,\n componentId: MEGA_MENU_ID,\n pluginId: BUNDLE_ID,\n props: { label: 'Products', panelWidth: 'wide' },\n nodes: [\n {\n $id: null,\n componentId: 'muiStack',\n pluginId: BUNDLE_ID,\n props: { direction: 'row', spacing: 4 },\n sx: { flexWrap: 'wrap' },\n nodes: [\n megaColumn('Shop', ['New arrivals', 'Best sellers', 'Sale']),\n megaColumn('Company', ['About', 'Careers', 'Press']),\n megaColumn('Support', ['Help center', 'Contact']),\n ],\n },\n ],\n },\n },\n]\n\nexport default NavMenu\n"],"names":["Aglyn","mdiChevronDown","mdiFormDropdown","mdiViewGridOutline","MdiIcon","Box","Button","ClickAwayListener","Paper","Stack","Typography","forwardRef","useCallback","useEffect","useMemo","useRef","useState","BUNDLE_ID","generatePresetId","isLeafSelectedWithin","parseLeafNodeId","NAV_MENU_ID","MEGA_MENU_ID","HOVER_CLOSE_DELAY_MS","mountedMenus","megaMenuPanelSx","panelWidth","width","maxWidth","left","transform","borderRadius","minWidth","TRIGGER_SHELL_SX","position","display","textTransform","TRIGGER_SX","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","color","padding","marginRight","MenuShell","props","ref","label","editorHint","panelSx","sx","children","rest","nodeSx","Array","isArray","editorInert","useScreenLink","undefined","open","setOpen","hoverOpenRef","closeTimer","nodeId","cancelClose","current","clearTimeout","closeNow","scheduleClose","setTimeout","push","unsubscribe","subscribeMenuCommands","detail","targeted","leafIdsMatch","command","Boolean","hover","value","index","indexOf","splice","authoring","aria-expanded","endIcon","path","elevation","aria-label","top","mt","zIndex","theme","modal","p","border","borderColor","variant","mb","px","onClickAway","onMouseEnter","onMouseLeave","onKeyDown","event","key","aria-haspopup","onClick","displayName","stripLegacyTrigger","NavMenu","spacing","alignItems","MegaMenu","navMenuSchema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","attributes","name","component","FieldComponentType","TEXT_FIELD","megaMenuSchema","SELECT","options","navLink","componentId","megaColumn","title","links","nodes","map","navMenuPresets","type","NodeType","PRESET","data","presetRef","className","direction","paddingTop","paddingRight","paddingBottom","paddingLeft","flexWrap","backgroundColor","boxShadow","interactionTemplates","triggerRef","steps","targetRef","dismissOn","delayMs"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,cAAc,EAAEC,eAAe,EAAEC,kBAAkB,QAAQ,yBAAwB;AAC5F,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,OAAOC,SAA4B,oBAAmB;AACtD,OAAOC,YAAY,uBAAsB;AACzC,OAAOC,uBAAuB,kCAAiC;AAC/D,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,WAAW,sBAAqB;AACvC,OAAOC,gBAAgB,2BAA0B;AACjD,SACEC,UAAU,EAGVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAO;AAEd,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,cAAU;AAEhE,iEAAiE;AACjE,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BAAiB,CAACC,UAAU;QAC5CC,MAAMM,eAAeN,IAAI;QACzBoB,MAAM;YACJ1B,KAAK;YACLgB,aAAa/G;YACbgG,UAAUrG;YACV8B,OAAO;gBAAEE,OAAO;gBAAYvB,YAAY;YAAO;YAC/C+G,OAAO;gBACL;oBACEpB,KAAK;oBACLgB,aAAa;oBACbf,UAAUrG;oBACV8B,OAAO;wBAAEmG,WAAW;wBAAOjC,SAAS;oBAAE;oBACtC7D,IAAI;wBAAEmG,UAAU;oBAAO;oBACvBd,OAAO;wBACLH,WAAW,QAAQ;4BAAC;4BAAgB;4BAAgB;yBAAO;wBAC3DA,WAAW,WAAW;4BAAC;4BAAS;4BAAW;yBAAQ;wBACnDA,WAAW,WAAW;4BAAC;4BAAe;yBAAU;qBACjD;gBACH;aACD;QACH;IACF;CACD,CAAA;AAED,eAAetB,QAAO"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
export declare const ID: Aglyn.ComponentId;
|
|
20
|
+
export interface PaginationElementProps {
|
|
21
|
+
count?: number | string;
|
|
22
|
+
defaultPage?: number | string;
|
|
23
|
+
color?: 'primary' | 'secondary' | 'standard';
|
|
24
|
+
shape?: 'circular' | 'rounded';
|
|
25
|
+
size?: 'small' | 'medium' | 'large';
|
|
26
|
+
variant?: 'text' | 'outlined';
|
|
27
|
+
siblingCount?: number | string;
|
|
28
|
+
boundaryCount?: number | string;
|
|
29
|
+
showFirstButton?: boolean;
|
|
30
|
+
showLastButton?: boolean;
|
|
31
|
+
hidePrevButton?: boolean;
|
|
32
|
+
hideNextButton?: boolean;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Accepted and dropped. The element is self-closing (see `flags`), so the
|
|
36
|
+
* editor never authors children — but the renderer builds elements from
|
|
37
|
+
* persisted props, and a stray child from an older document would reach
|
|
38
|
+
* MUI's Pagination and render beside the page list. Declared because the
|
|
39
|
+
* implementation deliberately discards it (AGL-1323).
|
|
40
|
+
*/
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Pagination control (https://mui.com/material-ui/react-pagination/).
|
|
45
|
+
*
|
|
46
|
+
* Uncontrolled: it tracks and highlights the page a visitor picks, but
|
|
47
|
+
* it does not by itself fetch or filter anything — pair it with an
|
|
48
|
+
* interaction, or with a repeat that reads the page. That is stated in
|
|
49
|
+
* the element's own description too, because a page-picker that looks
|
|
50
|
+
* wired and isn't is worse than one that says what it is.
|
|
51
|
+
*
|
|
52
|
+
* The `size` here is MUI's own three-value scale; the shared FIELD_SIZE
|
|
53
|
+
* preset also offers `inherit`, which Pagination does not accept, so the
|
|
54
|
+
* shared field is narrowed rather than re-declared.
|
|
55
|
+
*/
|
|
56
|
+
declare const PaginationElement: import("react").ForwardRefExoticComponent<PaginationElementProps & import("react").RefAttributes<HTMLElement>>;
|
|
57
|
+
export declare const schema: Aglyn.ComponentSchema<PaginationElementProps>;
|
|
58
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
59
|
+
export default PaginationElement;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2026 Aglyn LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/ import * as Aglyn from "@aglyn/aglyn";
|
|
20
|
+
import { mdiFormatListNumbered } from "@aglyn/shared-data-mdi";
|
|
21
|
+
import MuiPagination from "@mui/material/Pagination";
|
|
22
|
+
import { forwardRef } from "react";
|
|
23
|
+
import { BUNDLE_ID } from "../constants/bundle-common.js";
|
|
24
|
+
import { FIELD_DISABLED, FIELD_SIZE } from "../constants/field-presets.js";
|
|
25
|
+
import { dropClearedProps } from "../utils/drop-cleared-props.js";
|
|
26
|
+
import { generatePresetId } from "../utils/generate-preset-id.js";
|
|
27
|
+
// Component ids are persisted in screen documents; never rename.
|
|
28
|
+
export const ID = 'muiPagination';
|
|
29
|
+
/** Number-typed attribute fields round-trip as strings. */ function toCount(value, fallback) {
|
|
30
|
+
if (value == null || value === '') return fallback;
|
|
31
|
+
const parsed = Number(value);
|
|
32
|
+
if (!Number.isFinite(parsed) || parsed < 0) return fallback;
|
|
33
|
+
return Math.round(parsed);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pagination control (https://mui.com/material-ui/react-pagination/).
|
|
37
|
+
*
|
|
38
|
+
* Uncontrolled: it tracks and highlights the page a visitor picks, but
|
|
39
|
+
* it does not by itself fetch or filter anything — pair it with an
|
|
40
|
+
* interaction, or with a repeat that reads the page. That is stated in
|
|
41
|
+
* the element's own description too, because a page-picker that looks
|
|
42
|
+
* wired and isn't is worse than one that says what it is.
|
|
43
|
+
*
|
|
44
|
+
* The `size` here is MUI's own three-value scale; the shared FIELD_SIZE
|
|
45
|
+
* preset also offers `inherit`, which Pagination does not accept, so the
|
|
46
|
+
* shared field is narrowed rather than re-declared.
|
|
47
|
+
*/ const PaginationElement = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
48
|
+
const { count, defaultPage, siblingCount, boundaryCount, children: _children } = props, spread = _object_without_properties_loose(props, [
|
|
49
|
+
"count",
|
|
50
|
+
"defaultPage",
|
|
51
|
+
"siblingCount",
|
|
52
|
+
"boundaryCount",
|
|
53
|
+
"children"
|
|
54
|
+
]);
|
|
55
|
+
// A cleared `color`/`size` persists as null; MUI capitalizes both and
|
|
56
|
+
// throws during SSR, 500ing the page (AGL-1226).
|
|
57
|
+
const rest = dropClearedProps(spread);
|
|
58
|
+
const total = toCount(count, 10);
|
|
59
|
+
return /*#__PURE__*/ _jsx(MuiPagination, _extends({
|
|
60
|
+
ref: ref,
|
|
61
|
+
count: total,
|
|
62
|
+
// Out-of-range defaults make MUI drop the selection entirely.
|
|
63
|
+
defaultPage: Math.min(Math.max(toCount(defaultPage, 1), 1), total),
|
|
64
|
+
siblingCount: toCount(siblingCount, 1),
|
|
65
|
+
boundaryCount: toCount(boundaryCount, 1)
|
|
66
|
+
}, rest));
|
|
67
|
+
});
|
|
68
|
+
PaginationElement.displayName = 'AglynPagination';
|
|
69
|
+
export const schema = {
|
|
70
|
+
$id: ID,
|
|
71
|
+
pluginId: BUNDLE_ID,
|
|
72
|
+
displayName: 'Pagination',
|
|
73
|
+
description: 'Page picker. It highlights the chosen page; wire an interaction to ' + 'make it change what the page shows.',
|
|
74
|
+
category: Aglyn.ComponentCategory.NAVIGATION,
|
|
75
|
+
icon: {
|
|
76
|
+
path: mdiFormatListNumbered.path,
|
|
77
|
+
sx: {
|
|
78
|
+
color: '#2196f3'
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
flags: {
|
|
82
|
+
selfClosing: Aglyn.FEATURE_FLAG.ENABLED
|
|
83
|
+
},
|
|
84
|
+
attributes: [
|
|
85
|
+
{
|
|
86
|
+
name: 'count',
|
|
87
|
+
label: 'Pages',
|
|
88
|
+
description: 'Total number of pages. Default 10.',
|
|
89
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
90
|
+
type: 'number'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'defaultPage',
|
|
94
|
+
label: 'Starting page',
|
|
95
|
+
description: 'The page selected when a visitor arrives. Default 1.',
|
|
96
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
97
|
+
type: 'number'
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'variant',
|
|
101
|
+
label: 'Variant',
|
|
102
|
+
description: 'Outlined draws a border around each page item.',
|
|
103
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
104
|
+
// REAL SENTINELS here, not deletions (AGL-1453) — the opposite call
|
|
105
|
+
// from Button's and Typography's "Default" options, for a reason that
|
|
106
|
+
// is visible in the lists themselves: those name MUI's default among
|
|
107
|
+
// their choices, so `''` was a duplicate. These four offered ONLY the
|
|
108
|
+
// non-default alternative, so `''` was the sole route back — and it
|
|
109
|
+
// could not persist (AGL-1191). Picking Outlined, Rounded, Primary or
|
|
110
|
+
// Small was a one-way door: the "(default)" option reverted on save and
|
|
111
|
+
// the field snapped back to what it was.
|
|
112
|
+
//
|
|
113
|
+
// Each sentinel is MUI Pagination's own literal default for that prop
|
|
114
|
+
// (`Pagination.js`: `variant = 'text'`, `shape = 'circular'`,
|
|
115
|
+
// `color = 'standard'`, `size = 'medium'`), so the labels stop lying
|
|
116
|
+
// and a stored value renders exactly what an unset one did.
|
|
117
|
+
options: [
|
|
118
|
+
{
|
|
119
|
+
value: 'text',
|
|
120
|
+
label: 'Text (default)'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
value: 'outlined',
|
|
124
|
+
label: 'Outlined'
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'shape',
|
|
130
|
+
label: 'Shape',
|
|
131
|
+
description: 'Rounded squares instead of circles.',
|
|
132
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
133
|
+
options: [
|
|
134
|
+
{
|
|
135
|
+
value: 'circular',
|
|
136
|
+
label: 'Circular (default)'
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
value: 'rounded',
|
|
140
|
+
label: 'Rounded'
|
|
141
|
+
}
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'color',
|
|
146
|
+
label: 'Theme color',
|
|
147
|
+
description: 'Color of the selected page item.',
|
|
148
|
+
component: Aglyn.FieldComponentType.SELECT,
|
|
149
|
+
options: [
|
|
150
|
+
{
|
|
151
|
+
value: 'standard',
|
|
152
|
+
label: 'Standard (default)'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
value: 'primary',
|
|
156
|
+
label: 'Primary'
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
value: 'secondary',
|
|
160
|
+
label: 'Secondary'
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
_extends({}, FIELD_SIZE, {
|
|
165
|
+
options: [
|
|
166
|
+
{
|
|
167
|
+
value: 'medium',
|
|
168
|
+
label: 'Medium (default)'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
value: 'small',
|
|
172
|
+
label: 'Small'
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
value: 'large',
|
|
176
|
+
label: 'Large'
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
{
|
|
181
|
+
name: 'siblingCount',
|
|
182
|
+
label: 'Sibling pages',
|
|
183
|
+
description: 'How many page numbers to show either side of the current one.',
|
|
184
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
185
|
+
type: 'number'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'boundaryCount',
|
|
189
|
+
label: 'Boundary pages',
|
|
190
|
+
description: 'How many page numbers to always show at the start and end.',
|
|
191
|
+
component: Aglyn.FieldComponentType.TEXT_FIELD,
|
|
192
|
+
type: 'number'
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'showFirstButton',
|
|
196
|
+
label: 'Show first-page button?',
|
|
197
|
+
description: 'Adds a jump-to-first control.',
|
|
198
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: 'showLastButton',
|
|
202
|
+
label: 'Show last-page button?',
|
|
203
|
+
description: 'Adds a jump-to-last control.',
|
|
204
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: 'hidePrevButton',
|
|
208
|
+
label: 'Hide previous button?',
|
|
209
|
+
description: 'Removes the previous-page arrow.',
|
|
210
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'hideNextButton',
|
|
214
|
+
label: 'Hide next button?',
|
|
215
|
+
description: 'Removes the next-page arrow.',
|
|
216
|
+
component: Aglyn.FieldComponentType.SWITCH
|
|
217
|
+
},
|
|
218
|
+
FIELD_DISABLED
|
|
219
|
+
]
|
|
220
|
+
};
|
|
221
|
+
export const presets = [
|
|
222
|
+
{
|
|
223
|
+
$id: generatePresetId(ID),
|
|
224
|
+
type: Aglyn.NodeType.PRESET,
|
|
225
|
+
displayName: 'Pagination',
|
|
226
|
+
pluginId: BUNDLE_ID,
|
|
227
|
+
description: 'Page picker with previous/next arrows',
|
|
228
|
+
category: Aglyn.ComponentCategory.NAVIGATION,
|
|
229
|
+
icon: schema.icon,
|
|
230
|
+
data: {
|
|
231
|
+
$id: null,
|
|
232
|
+
componentId: ID,
|
|
233
|
+
pluginId: BUNDLE_ID,
|
|
234
|
+
props: {
|
|
235
|
+
count: 10,
|
|
236
|
+
color: 'primary'
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
];
|
|
241
|
+
export default PaginationElement;
|
|
242
|
+
|
|
243
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/mui/src/lib/components/pagination.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as Aglyn from '@aglyn/aglyn'\nimport { mdiFormatListNumbered } from '@aglyn/shared-data-mdi'\nimport MuiPagination from '@mui/material/Pagination'\nimport { forwardRef, type ReactNode } from 'react'\nimport { BUNDLE_ID } from '../constants/bundle-common'\nimport { FIELD_DISABLED, FIELD_SIZE } from '../constants/field-presets'\nimport { dropClearedProps } from '../utils/drop-cleared-props'\nimport { generatePresetId } from '../utils/generate-preset-id'\n\n// Component ids are persisted in screen documents; never rename.\nexport const ID: Aglyn.ComponentId = 'muiPagination'\n\nexport interface PaginationElementProps {\n count?: number | string\n defaultPage?: number | string\n color?: 'primary' | 'secondary' | 'standard'\n shape?: 'circular' | 'rounded'\n size?: 'small' | 'medium' | 'large'\n variant?: 'text' | 'outlined'\n siblingCount?: number | string\n boundaryCount?: number | string\n showFirstButton?: boolean\n showLastButton?: boolean\n hidePrevButton?: boolean\n hideNextButton?: boolean\n disabled?: boolean\n /**\n * Accepted and dropped. The element is self-closing (see `flags`), so the\n * editor never authors children — but the renderer builds elements from\n * persisted props, and a stray child from an older document would reach\n * MUI's Pagination and render beside the page list. Declared because the\n * implementation deliberately discards it (AGL-1323).\n */\n children?: ReactNode\n}\n\n/** Number-typed attribute fields round-trip as strings. */\nfunction toCount(value: unknown, fallback: number): number {\n if (value == null || value === '') return fallback\n const parsed = Number(value)\n if (!Number.isFinite(parsed) || parsed < 0) return fallback\n return Math.round(parsed)\n}\n\n/**\n * Pagination control (https://mui.com/material-ui/react-pagination/).\n *\n * Uncontrolled: it tracks and highlights the page a visitor picks, but\n * it does not by itself fetch or filter anything — pair it with an\n * interaction, or with a repeat that reads the page. That is stated in\n * the element's own description too, because a page-picker that looks\n * wired and isn't is worse than one that says what it is.\n *\n * The `size` here is MUI's own three-value scale; the shared FIELD_SIZE\n * preset also offers `inherit`, which Pagination does not accept, so the\n * shared field is narrowed rather than re-declared.\n */\nconst PaginationElement = forwardRef<HTMLElement, PaginationElementProps>(\n (props, ref) => {\n const {\n count,\n defaultPage,\n siblingCount,\n boundaryCount,\n children: _children,\n ...spread\n } = props\n // A cleared `color`/`size` persists as null; MUI capitalizes both and\n // throws during SSR, 500ing the page (AGL-1226).\n const rest = dropClearedProps(spread)\n const total = toCount(count, 10)\n return (\n <MuiPagination\n ref={ref}\n count={total}\n // Out-of-range defaults make MUI drop the selection entirely.\n defaultPage={Math.min(Math.max(toCount(defaultPage, 1), 1), total)}\n siblingCount={toCount(siblingCount, 1)}\n boundaryCount={toCount(boundaryCount, 1)}\n {...rest}\n />\n )\n },\n)\nPaginationElement.displayName = 'AglynPagination'\n\nexport const schema: Aglyn.ComponentSchema<PaginationElementProps> = {\n $id: ID,\n pluginId: BUNDLE_ID,\n displayName: 'Pagination',\n description:\n 'Page picker. It highlights the chosen page; wire an interaction to ' +\n 'make it change what the page shows.',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: { path: mdiFormatListNumbered.path, sx: { color: '#2196f3' } },\n flags: { selfClosing: Aglyn.FEATURE_FLAG.ENABLED },\n attributes: [\n {\n name: 'count',\n label: 'Pages',\n description: 'Total number of pages. Default 10.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'defaultPage',\n label: 'Starting page',\n description: 'The page selected when a visitor arrives. Default 1.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'variant',\n label: 'Variant',\n description: 'Outlined draws a border around each page item.',\n component: Aglyn.FieldComponentType.SELECT,\n // REAL SENTINELS here, not deletions (AGL-1453) — the opposite call\n // from Button's and Typography's \"Default\" options, for a reason that\n // is visible in the lists themselves: those name MUI's default among\n // their choices, so `''` was a duplicate. These four offered ONLY the\n // non-default alternative, so `''` was the sole route back — and it\n // could not persist (AGL-1191). Picking Outlined, Rounded, Primary or\n // Small was a one-way door: the \"(default)\" option reverted on save and\n // the field snapped back to what it was.\n //\n // Each sentinel is MUI Pagination's own literal default for that prop\n // (`Pagination.js`: `variant = 'text'`, `shape = 'circular'`,\n // `color = 'standard'`, `size = 'medium'`), so the labels stop lying\n // and a stored value renders exactly what an unset one did.\n options: [\n { value: 'text', label: 'Text (default)' },\n { value: 'outlined', label: 'Outlined' },\n ],\n },\n {\n name: 'shape',\n label: 'Shape',\n description: 'Rounded squares instead of circles.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'circular', label: 'Circular (default)' },\n { value: 'rounded', label: 'Rounded' },\n ],\n },\n {\n name: 'color',\n label: 'Theme color',\n description: 'Color of the selected page item.',\n component: Aglyn.FieldComponentType.SELECT,\n options: [\n { value: 'standard', label: 'Standard (default)' },\n { value: 'primary', label: 'Primary' },\n { value: 'secondary', label: 'Secondary' },\n ],\n },\n {\n // Narrowed from the shared preset: Pagination has no `inherit`\n // size, and offering it would render nothing different.\n ...FIELD_SIZE,\n options: [\n { value: 'medium', label: 'Medium (default)' },\n { value: 'small', label: 'Small' },\n { value: 'large', label: 'Large' },\n ],\n },\n {\n name: 'siblingCount',\n label: 'Sibling pages',\n description:\n 'How many page numbers to show either side of the current one.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'boundaryCount',\n label: 'Boundary pages',\n description:\n 'How many page numbers to always show at the start and end.',\n component: Aglyn.FieldComponentType.TEXT_FIELD,\n type: 'number',\n },\n {\n name: 'showFirstButton',\n label: 'Show first-page button?',\n description: 'Adds a jump-to-first control.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'showLastButton',\n label: 'Show last-page button?',\n description: 'Adds a jump-to-last control.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'hidePrevButton',\n label: 'Hide previous button?',\n description: 'Removes the previous-page arrow.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n {\n name: 'hideNextButton',\n label: 'Hide next button?',\n description: 'Removes the next-page arrow.',\n component: Aglyn.FieldComponentType.SWITCH,\n },\n FIELD_DISABLED,\n ],\n}\n\nexport const presets: Aglyn.PresetSchema[] = [\n {\n $id: generatePresetId(ID),\n type: Aglyn.NodeType.PRESET,\n displayName: 'Pagination',\n pluginId: BUNDLE_ID,\n description: 'Page picker with previous/next arrows',\n category: Aglyn.ComponentCategory.NAVIGATION,\n icon: schema.icon,\n data: {\n $id: null,\n componentId: ID,\n pluginId: BUNDLE_ID,\n props: { count: 10, color: 'primary' },\n },\n },\n]\n\nexport default PaginationElement\n"],"names":["Aglyn","mdiFormatListNumbered","MuiPagination","forwardRef","BUNDLE_ID","FIELD_DISABLED","FIELD_SIZE","dropClearedProps","generatePresetId","ID","toCount","value","fallback","parsed","Number","isFinite","Math","round","PaginationElement","props","ref","count","defaultPage","siblingCount","boundaryCount","children","_children","spread","rest","total","min","max","displayName","schema","$id","pluginId","description","category","ComponentCategory","NAVIGATION","icon","path","sx","color","flags","selfClosing","FEATURE_FLAG","ENABLED","attributes","name","label","component","FieldComponentType","TEXT_FIELD","type","SELECT","options","SWITCH","presets","NodeType","PRESET","data","componentId"],"mappings":";;;AAAA;;;;;;;;;;;;;;;CAeC,GAED,YAAYA,WAAW,eAAc;AACrC,SAASC,qBAAqB,QAAQ,yBAAwB;AAC9D,OAAOC,mBAAmB,2BAA0B;AACpD,SAASC,UAAU,QAAwB,QAAO;AAClD,SAASC,SAAS,QAAQ,gCAA4B;AACtD,SAASC,cAAc,EAAEC,UAAU,QAAQ,gCAA4B;AACvE,SAASC,gBAAgB,QAAQ,iCAA6B;AAC9D,SAASC,gBAAgB,QAAQ,iCAA6B;AAE9D,iEAAiE;AACjE,OAAO,MAAMC,KAAwB,gBAAe;AA0BpD,yDAAyD,GACzD,SAASC,QAAQC,KAAc,EAAEC,QAAgB;IAC/C,IAAID,SAAS,QAAQA,UAAU,IAAI,OAAOC;IAC1C,MAAMC,SAASC,OAAOH;IACtB,IAAI,CAACG,OAAOC,QAAQ,CAACF,WAAWA,SAAS,GAAG,OAAOD;IACnD,OAAOI,KAAKC,KAAK,CAACJ;AACpB;AAEA;;;;;;;;;;;;CAYC,GACD,MAAMK,kCAAoBf,WACxB,CAACgB,OAAOC;IACN,MAAM,EACJC,KAAK,EACLC,WAAW,EACXC,YAAY,EACZC,aAAa,EACbC,UAAUC,SAAS,EAEpB,GAAGP,OADCQ,0CACDR;;;;;;;IACJ,sEAAsE;IACtE,iDAAiD;IACjD,MAAMS,OAAOrB,iBAAiBoB;IAC9B,MAAME,QAAQnB,QAAQW,OAAO;IAC7B,qBACE,KAACnB;QACCkB,KAAKA;QACLC,OAAOQ;QACP,8DAA8D;QAC9DP,aAAaN,KAAKc,GAAG,CAACd,KAAKe,GAAG,CAACrB,QAAQY,aAAa,IAAI,IAAIO;QAC5DN,cAAcb,QAAQa,cAAc;QACpCC,eAAed,QAAQc,eAAe;OAClCI;AAGV;AAEFV,kBAAkBc,WAAW,GAAG;AAEhC,OAAO,MA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47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import * as Aglyn from '@aglyn/aglyn';
|
|
18
|
+
import { type ReactNode } from 'react';
|
|
19
|
+
export declare const ID: Aglyn.ComponentId;
|
|
20
|
+
export interface PaperElementProps {
|
|
21
|
+
/** Shadow depth, 0–24. Ignored by MUI when `variant` is `outlined`. */
|
|
22
|
+
elevation?: number | string;
|
|
23
|
+
variant?: 'elevation' | 'outlined';
|
|
24
|
+
/** If true, corners are not rounded. */
|
|
25
|
+
square?: boolean;
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/** MUI's shadow scale tops out at 24; anything above renders unshadowed. */
|
|
29
|
+
export declare const MAX_ELEVATION = 24;
|
|
30
|
+
/**
|
|
31
|
+
* Coerces a persisted elevation to the number MUI's shadow lookup needs.
|
|
32
|
+
*
|
|
33
|
+
* Number-typed attribute fields round-trip through the document as
|
|
34
|
+
* strings often enough that this can't be assumed away: `elevation="3"`
|
|
35
|
+
* indexes MUI's shadow array with a string and yields `undefined`, i.e. a
|
|
36
|
+
* paper the author gave a shadow renders completely flat.
|
|
37
|
+
*/
|
|
38
|
+
export declare function toElevation(value: unknown): number | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Surface primitive (https://mui.com/material-ui/react-paper/): the
|
|
41
|
+
* themed background + shadow that Card, Accordion and Drawer are all
|
|
42
|
+
* built on, exposed on its own for panels and callouts.
|
|
43
|
+
*/
|
|
44
|
+
declare const PaperElement: import("react").ForwardRefExoticComponent<PaperElementProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
45
|
+
export declare const schema: Aglyn.ComponentSchema<PaperElementProps>;
|
|
46
|
+
export declare const presets: Aglyn.PresetSchema[];
|
|
47
|
+
export default PaperElement;
|