@namroodinc/liquid-editorial 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1568 -139
- package/UPGRADING.md +131 -0
- package/dist/chunks/{Board-BUJ5CinL.cjs → Board-BaQ04nWg.cjs} +2 -2
- package/dist/chunks/Board-BaQ04nWg.cjs.map +1 -0
- package/dist/chunks/{Board-Cyrda2qG.js → Board-CUhF8pTX.js} +2 -2
- package/dist/chunks/Board-CUhF8pTX.js.map +1 -0
- package/dist/chunks/ColourField-Bd4twbaG.js +499 -0
- package/dist/chunks/ColourField-Bd4twbaG.js.map +1 -0
- package/dist/chunks/ColourField-BdAbjgmY.cjs +2 -0
- package/dist/chunks/ColourField-BdAbjgmY.cjs.map +1 -0
- package/dist/chunks/FormEditor-DRmPFe2E.js.map +1 -1
- package/dist/chunks/FormEditor-PVkvKep1.cjs.map +1 -1
- package/dist/chunks/{Icon-CW6qJcDy.cjs → Icon-BBoWP_Y6.cjs} +2 -2
- package/dist/chunks/Icon-BBoWP_Y6.cjs.map +1 -0
- package/dist/chunks/{Icon-ByUB0L1a.js → Icon-XNismJDm.js} +21 -20
- package/dist/chunks/Icon-XNismJDm.js.map +1 -0
- package/dist/chunks/RichTextEditor-C7nMfDmE.cjs.map +1 -1
- package/dist/chunks/RichTextEditor-DjR10XJ-.js.map +1 -1
- package/dist/chunks/binding-Bshy43sG.js.map +1 -1
- package/dist/chunks/binding-tMjrUzkU.cjs.map +1 -1
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs +2 -0
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +1 -0
- package/dist/chunks/dialogFocus-BFoyeTpA.js +48 -0
- package/dist/chunks/dialogFocus-BFoyeTpA.js.map +1 -0
- package/dist/chunks/dialogStack-6yv3NXFD.js.map +1 -1
- package/dist/chunks/dialogStack-C9SLVu6Q.cjs.map +1 -1
- package/dist/chunks/group-CzbacuAY.js.map +1 -1
- package/dist/chunks/group-pKDQtq-9.cjs.map +1 -1
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs.map +1 -1
- package/dist/chunks/mergeRefs-DGM402mE.js.map +1 -1
- package/dist/chunks/observeElementWidth-BCJM2FAw.cjs.map +1 -1
- package/dist/chunks/observeElementWidth-BlQOlW2t.js.map +1 -1
- package/dist/components/AppShell/index.cjs.map +1 -1
- package/dist/components/AppShell/index.d.cts.map +1 -1
- package/dist/components/AppShell/index.d.ts.map +1 -1
- package/dist/components/AppShell/index.js.map +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.cjs.map +1 -1
- package/dist/components/AssetCard/index.d.cts.map +1 -1
- package/dist/components/AssetCard/index.d.ts.map +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetCard/index.js.map +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Badge/index.cjs.map +1 -1
- package/dist/components/Badge/index.d.cts.map +1 -1
- package/dist/components/Badge/index.d.ts.map +1 -1
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.d.cts.map +1 -1
- package/dist/components/Board/index.d.ts.map +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Board/keyboard.d.cts.map +1 -1
- package/dist/components/Board/keyboard.d.ts.map +1 -1
- package/dist/components/Board/moves.d.cts.map +1 -1
- package/dist/components/Board/moves.d.ts.map +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.d.cts.map +1 -1
- package/dist/components/Choice/index.d.ts.map +1 -1
- package/dist/components/Choice/index.js.map +1 -1
- package/dist/components/ColourField/colour.d.cts +12 -0
- package/dist/components/ColourField/colour.d.cts.map +1 -0
- package/dist/components/ColourField/colour.d.ts +12 -0
- package/dist/components/ColourField/colour.d.ts.map +1 -0
- package/dist/components/ColourField/focus.d.cts +3 -0
- package/dist/components/ColourField/focus.d.cts.map +1 -0
- package/dist/components/ColourField/focus.d.ts +3 -0
- package/dist/components/ColourField/focus.d.ts.map +1 -0
- package/dist/components/ColourField/index.cjs +1 -0
- package/dist/components/ColourField/index.d.cts +15 -0
- package/dist/components/ColourField/index.d.cts.map +1 -0
- package/dist/components/ColourField/index.d.ts +15 -0
- package/dist/components/ColourField/index.d.ts.map +1 -0
- package/dist/components/ColourField/index.js +1 -0
- package/dist/components/ColourField/panel.d.cts +21 -0
- package/dist/components/ColourField/panel.d.cts.map +1 -0
- package/dist/components/ColourField/panel.d.ts +21 -0
- package/dist/components/ColourField/panel.d.ts.map +1 -0
- package/dist/components/ColourField/square.d.cts +9 -0
- package/dist/components/ColourField/square.d.cts.map +1 -0
- package/dist/components/ColourField/square.d.ts +9 -0
- package/dist/components/ColourField/square.d.ts.map +1 -0
- package/dist/components/ColourField/style.css +266 -0
- package/dist/components/ColourField/value.d.cts +13 -0
- package/dist/components/ColourField/value.d.cts.map +1 -0
- package/dist/components/ColourField/value.d.ts +13 -0
- package/dist/components/ColourField/value.d.ts.map +1 -0
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.cjs.map +1 -1
- package/dist/components/DatePicker/index.d.cts +6 -2
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts +6 -2
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +45 -42
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +69 -73
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +69 -56
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.cjs.map +1 -1
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/index.js.map +1 -1
- package/dist/components/Field/binding.d.cts.map +1 -1
- package/dist/components/Field/binding.d.ts.map +1 -1
- package/dist/components/Field/group.d.cts.map +1 -1
- package/dist/components/Field/group.d.ts.map +1 -1
- package/dist/components/FieldAffix/index.cjs +1 -1
- package/dist/components/FieldAffix/index.cjs.map +1 -1
- package/dist/components/FieldAffix/index.d.cts +3 -1
- package/dist/components/FieldAffix/index.d.cts.map +1 -1
- package/dist/components/FieldAffix/index.d.ts +3 -1
- package/dist/components/FieldAffix/index.d.ts.map +1 -1
- package/dist/components/FieldAffix/index.js +20 -16
- package/dist/components/FieldAffix/index.js.map +1 -1
- package/dist/components/FieldAffix/style.css +1 -0
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/Icon/icons.d.cts +1 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +1 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.d.cts.map +1 -1
- package/dist/components/ImageCropper/index.d.ts.map +1 -1
- package/dist/components/ImageCropper/index.js.map +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +40 -48
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberField/index.cjs.map +1 -1
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js.map +1 -1
- package/dist/components/Pagination/index.cjs.map +1 -1
- package/dist/components/Pagination/index.d.cts.map +1 -1
- package/dist/components/Pagination/index.d.ts.map +1 -1
- package/dist/components/Pagination/index.js.map +1 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +52 -37
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.cjs.map +1 -1
- package/dist/components/SideNav/index.d.cts.map +1 -1
- package/dist/components/SideNav/index.d.ts.map +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SideNav/index.js.map +1 -1
- package/dist/components/Slider/index.cjs.map +1 -1
- package/dist/components/Slider/index.d.cts.map +1 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.cjs.map +1 -1
- package/dist/components/SortableList/index.d.cts.map +1 -1
- package/dist/components/SortableList/index.d.ts.map +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/SortableList/index.js.map +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.cjs.map +1 -1
- package/dist/components/Stepper/index.d.cts.map +1 -1
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/Stepper/index.js.map +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.d.cts.map +1 -1
- package/dist/components/TagsInput/index.d.ts.map +1 -1
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/Time/index.cjs.map +1 -1
- package/dist/components/Time/index.d.cts.map +1 -1
- package/dist/components/Time/index.d.ts.map +1 -1
- package/dist/components/Time/index.js.map +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.cjs.map +1 -1
- package/dist/components/Toast/index.d.cts.map +1 -1
- package/dist/components/Toast/index.d.ts.map +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/internal/dialogFocus.d.cts +17 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -0
- package/dist/internal/dialogFocus.d.ts +17 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -0
- package/dist/internal/dialogStack.d.cts.map +1 -1
- package/dist/internal/dialogStack.d.ts.map +1 -1
- package/dist/internal/lockBodyScroll.d.cts.map +1 -1
- package/dist/internal/lockBodyScroll.d.ts.map +1 -1
- package/dist/internal/mergeRefs.d.cts.map +1 -1
- package/dist/internal/mergeRefs.d.ts.map +1 -1
- package/dist/internal/observeElementWidth.d.cts.map +1 -1
- package/dist/internal/observeElementWidth.d.ts.map +1 -1
- package/dist/styles.css +1 -0
- package/package.json +3 -2
- package/dist/chunks/Board-BUJ5CinL.cjs.map +0 -1
- package/dist/chunks/Board-Cyrda2qG.js.map +0 -1
- package/dist/chunks/Icon-ByUB0L1a.js.map +0 -1
- package/dist/chunks/Icon-CW6qJcDy.cjs.map +0 -1
- package/dist/components/Board/keyboard.test.d.cts +0 -2
- package/dist/components/Board/keyboard.test.d.cts.map +0 -1
- package/dist/components/Board/keyboard.test.d.ts +0 -2
- package/dist/components/Board/keyboard.test.d.ts.map +0 -1
- package/dist/components/Board/moves.test.d.cts +0 -2
- package/dist/components/Board/moves.test.d.cts.map +0 -1
- package/dist/components/Board/moves.test.d.ts +0 -2
- package/dist/components/Board/moves.test.d.ts.map +0 -1
- package/dist/test/dragEvent.d.cts +0 -3
- package/dist/test/dragEvent.d.cts.map +0 -1
- package/dist/test/dragEvent.d.ts +0 -3
- package/dist/test/dragEvent.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","observeElementWidth","Fragment$1","AppShell","forwardRef","rest","shell","setShell","useState","isOpen","setOpen","desktopNavRef","useRef","mainRef","restoreDesktopFocus","drawerId","useId","shellRef","useMemo","mergeRefs","ref","useEffect","width","drawerActions","actions","scrollMode","contentPadding","className","node","TopNav","Button","SideNav","navigationLabel","navigation","Drawer","brand","SideNavFooter","link","event","opensElsewhere"],"sources":["../../../src/components/AppShell/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Drawer } from \"../Drawer\";\nimport { Button } from \"../Button\";\nimport { SideNav, SideNavFooter } from \"../SideNav\";\nimport { TopNav } from \"../TopNav\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport \"./style.css\";\n\nexport interface AppShellProps extends HTMLAttributes<HTMLDivElement> {\n /** Product brand, shared by the top bar and mobile drawer header. */\n brand: ReactNode;\n /** SideNavSection/SideNavItem content. The application owns routing and selection. */\n navigation: ReactNode;\n /** One slot with a compact top-bar and expanded drawer presentation. */\n actions?: (location: \"topnav\" | \"drawer\") => ReactNode;\n navigationLabel?: string;\n /** The default scrolls the main region; document mode follows the window. */\n scrollMode?: \"container\" | \"document\";\n /** Let full-width page layouts own their spacing. */\n contentPadding?: \"default\" | \"none\";\n /** Rendered inside the shell's main landmark. */\n children?: ReactNode;\n}\n\n/** Full-width product bar above a desktop rail, or a mobile navigation drawer. */\nexport const AppShell = forwardRef<HTMLDivElement, AppShellProps>(function AppShell(\n {\n brand,\n navigation,\n actions,\n navigationLabel = \"Main\",\n scrollMode = \"container\",\n contentPadding = \"default\",\n className,\n children,\n ...rest\n },\n ref,\n) {\n const [shell, setShell] = useState<HTMLDivElement | null>(null);\n const [isOpen, setOpen] = useState(false);\n const desktopNavRef = useRef<HTMLElement | null>(null);\n const mainRef = useRef<HTMLElement | null>(null);\n const restoreDesktopFocus = useRef(false);\n const drawerId = useId();\n const shellRef = useMemo(() => mergeRefs(setShell, ref), [ref]);\n\n useEffect(() => {\n if (!shell) return;\n const measure = (width: number) => {\n if (width < 768) return;\n // Document mode portals the drawer to the body, outside the shell.\n const drawer = document.getElementById(drawerId);\n if (drawer?.contains(document.activeElement)) restoreDesktopFocus.current = true;\n setOpen(false);\n };\n return observeElementWidth(shell, measure);\n }, [shell, drawerId]);\n\n useEffect(() => {\n if (isOpen || !restoreDesktopFocus.current) return;\n restoreDesktopFocus.current = false;\n const destination =\n desktopNavRef.current?.querySelector<HTMLElement>(\"[aria-current='page']\") ??\n desktopNavRef.current?.querySelector<HTMLElement>(\"a[href]\");\n (destination ?? mainRef.current)?.focus();\n }, [isOpen]);\n\n const drawerActions = actions?.(\"drawer\");\n\n return (\n <div\n {...rest}\n ref={shellRef}\n data-scroll-mode={scrollMode}\n data-content-padding={contentPadding}\n className={[\"ds-appshell\", className].filter(Boolean).join(\" \")}\n >\n <div\n className=\"ds-appshell__frame\"\n aria-hidden={isOpen || undefined}\n ref={(node) => {\n if (node) node.inert = isOpen;\n }}\n >\n <TopNav\n brand={brand}\n actions={\n <>\n <div className=\"ds-appshell__actions\">{actions?.(\"topnav\")}</div>\n <Button\n variant=\"simple\"\n size=\"lg\"\n isIconOnly\n iconStart=\"menu\"\n className=\"ds-appshell__toggle\"\n aria-label=\"Open navigation\"\n aria-expanded={isOpen}\n aria-controls={drawerId}\n onClick={() => setOpen(true)}\n />\n </>\n }\n />\n <div className=\"ds-appshell__body\">\n <SideNav\n ref={desktopNavRef}\n className=\"ds-appshell__desktop-nav\"\n label={navigationLabel}\n >\n {navigation}\n </SideNav>\n <main\n ref={mainRef}\n className=\"ds-appshell__main\"\n tabIndex={-1}\n >\n {children}\n </main>\n </div>\n </div>\n <Drawer\n id={drawerId}\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n variant=\"navigation\"\n side=\"end\"\n portalContainer={scrollMode === \"document\" ? undefined : shell}\n dir={rest.dir}\n title={brand}\n aria-label=\"Navigation\"\n closeLabel=\"Close navigation\"\n footer={drawerActions ? <SideNavFooter>{drawerActions}</SideNavFooter> : undefined}\n >\n <SideNav\n className=\"ds-appshell__mobile-nav\"\n label={navigationLabel}\n onClick={(event) => {\n const link =\n event.target instanceof Element\n ? event.target.closest<HTMLAnchorElement>(\"a[href]\")\n : null;\n // Opening a link elsewhere (modifier keys, another button, a new tab) leaves this page in place.\n const opensElsewhere =\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n link?.target === \"_blank\";\n if (link && !opensElsewhere) setOpen(false);\n }}\n >\n {navigation}\n </SideNav>\n </Drawer>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAmCA,IAAaG,IAAWC,EAA0C,SAChE,EACE,UACA,eACA,YACA,qBAAkB,QAClB,gBAAa,aACb,oBAAiB,WACjB,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAOC,KAAYC,EAAgC,IAAI,GACxD,CAACC,GAAQC,KAAWF,EAAS,EAAK,GAClCG,IAAgBC,EAA2B,IAAI,GAC/CC,IAAUD,EAA2B,IAAI,GACzCE,IAAsBF,EAAO,EAAK,GAClCG,IAAWC,EAAM,GACjBC,IAAWC,QAAcC,EAAUZ,GAAUa,CAAG,GAAG,CAACA,CAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","observeElementWidth","Fragment$1","AppShell","forwardRef","rest","shell","setShell","useState","isOpen","setOpen","desktopNavRef","useRef","mainRef","restoreDesktopFocus","drawerId","useId","shellRef","useMemo","mergeRefs","ref","useEffect","width","drawerActions","actions","scrollMode","contentPadding","className","node","TopNav","Button","SideNav","navigationLabel","navigation","Drawer","brand","SideNavFooter","link","event","opensElsewhere"],"sources":["../../../src/components/AppShell/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Drawer } from \"../Drawer\";\nimport { Button } from \"../Button\";\nimport { SideNav, SideNavFooter } from \"../SideNav\";\nimport { TopNav } from \"../TopNav\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { observeElementWidth } from \"../../internal/observeElementWidth\";\nimport \"./style.css\";\n\nexport interface AppShellProps extends HTMLAttributes<HTMLDivElement> {\n /** Product brand, shared by the top bar and mobile drawer header. */\n brand: ReactNode;\n /** SideNavSection/SideNavItem content. The application owns routing and selection. */\n navigation: ReactNode;\n /** One slot with a compact top-bar and expanded drawer presentation. */\n actions?: (location: \"topnav\" | \"drawer\") => ReactNode;\n navigationLabel?: string;\n /** The default scrolls the main region; document mode follows the window. */\n scrollMode?: \"container\" | \"document\";\n /** Let full-width page layouts own their spacing. */\n contentPadding?: \"default\" | \"none\";\n /** Rendered inside the shell's main landmark. */\n children?: ReactNode;\n}\n\n/** Full-width product bar above a desktop rail, or a mobile navigation drawer. */\nexport const AppShell = forwardRef<HTMLDivElement, AppShellProps>(function AppShell(\n {\n brand,\n navigation,\n actions,\n navigationLabel = \"Main\",\n scrollMode = \"container\",\n contentPadding = \"default\",\n className,\n children,\n ...rest\n },\n ref,\n) {\n const [shell, setShell] = useState<HTMLDivElement | null>(null);\n const [isOpen, setOpen] = useState(false);\n const desktopNavRef = useRef<HTMLElement | null>(null);\n const mainRef = useRef<HTMLElement | null>(null);\n const restoreDesktopFocus = useRef(false);\n const drawerId = useId();\n const shellRef = useMemo(() => mergeRefs(setShell, ref), [ref]);\n\n useEffect(() => {\n if (!shell) {\n return;\n }\n const measure = (width: number) => {\n if (width < 768) {\n return;\n }\n // Document mode portals the drawer to the body, outside the shell.\n const drawer = document.getElementById(drawerId);\n if (drawer?.contains(document.activeElement)) {\n restoreDesktopFocus.current = true;\n }\n setOpen(false);\n };\n return observeElementWidth(shell, measure);\n }, [shell, drawerId]);\n\n useEffect(() => {\n if (isOpen || !restoreDesktopFocus.current) {\n return;\n }\n restoreDesktopFocus.current = false;\n const destination =\n desktopNavRef.current?.querySelector<HTMLElement>(\"[aria-current='page']\") ??\n desktopNavRef.current?.querySelector<HTMLElement>(\"a[href]\");\n (destination ?? mainRef.current)?.focus();\n }, [isOpen]);\n\n const drawerActions = actions?.(\"drawer\");\n\n return (\n <div\n {...rest}\n ref={shellRef}\n data-scroll-mode={scrollMode}\n data-content-padding={contentPadding}\n className={[\"ds-appshell\", className].filter(Boolean).join(\" \")}\n >\n <div\n className=\"ds-appshell__frame\"\n aria-hidden={isOpen || undefined}\n ref={(node) => {\n if (node) {\n node.inert = isOpen;\n }\n }}\n >\n <TopNav\n brand={brand}\n actions={\n <>\n <div className=\"ds-appshell__actions\">{actions?.(\"topnav\")}</div>\n <Button\n variant=\"simple\"\n size=\"lg\"\n isIconOnly\n iconStart=\"menu\"\n className=\"ds-appshell__toggle\"\n aria-label=\"Open navigation\"\n aria-expanded={isOpen}\n aria-controls={drawerId}\n onClick={() => setOpen(true)}\n />\n </>\n }\n />\n <div className=\"ds-appshell__body\">\n <SideNav\n ref={desktopNavRef}\n className=\"ds-appshell__desktop-nav\"\n label={navigationLabel}\n >\n {navigation}\n </SideNav>\n <main\n ref={mainRef}\n className=\"ds-appshell__main\"\n tabIndex={-1}\n >\n {children}\n </main>\n </div>\n </div>\n <Drawer\n id={drawerId}\n isOpen={isOpen}\n onClose={() => setOpen(false)}\n variant=\"navigation\"\n side=\"end\"\n portalContainer={scrollMode === \"document\" ? undefined : shell}\n dir={rest.dir}\n title={brand}\n aria-label=\"Navigation\"\n closeLabel=\"Close navigation\"\n footer={drawerActions ? <SideNavFooter>{drawerActions}</SideNavFooter> : undefined}\n >\n <SideNav\n className=\"ds-appshell__mobile-nav\"\n label={navigationLabel}\n onClick={(event) => {\n const link =\n event.target instanceof Element\n ? event.target.closest<HTMLAnchorElement>(\"a[href]\")\n : null;\n // Opening a link elsewhere (modifier keys, another button, a new tab) leaves this page in place.\n const opensElsewhere =\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n link?.target === \"_blank\";\n if (link && !opensElsewhere) {\n setOpen(false);\n }\n }}\n >\n {navigation}\n </SideNav>\n </Drawer>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;AAmCA,IAAaG,IAAWC,EAA0C,SAChE,EACE,UACA,eACA,YACA,qBAAkB,QAClB,gBAAa,aACb,oBAAiB,WACjB,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAOC,KAAYC,EAAgC,IAAI,GACxD,CAACC,GAAQC,KAAWF,EAAS,EAAK,GAClCG,IAAgBC,EAA2B,IAAI,GAC/CC,IAAUD,EAA2B,IAAI,GACzCE,IAAsBF,EAAO,EAAK,GAClCG,IAAWC,EAAM,GACjBC,IAAWC,QAAcC,EAAUZ,GAAUa,CAAG,GAAG,CAACA,CAAG,CAAC;CAoB9D,AAlBAC,QACOf,IAcEL,EAAoBK,IAXV,MAAkB;EACjC,AAAIgB,IAAQ,QAIG,SAAS,eAAeP,CACnC,CAAA,EAAQ,SAAS,SAAS,aAAa,MACzC,EAAoB,UAAU,KAEhCL,EAAQ,EAAK;CACf,CACyC,IAbvC,QAcD,CAACJ,GAAOS,CAAQ,CAAC,GAEpBM,QAAgB;EACd,AAAI,MAAWP,EAAoB,YAGnC,EAAoB,UAAU,KAE5BH,EAAc,SAAS,cAA2B,uBAAuB,KACzEA,EAAc,SAAS,cAA2B,SAAS,KAC7CE,EAAQ,QAAA,EAAU,MAAM;CAC1C,GAAG,CAACJ,CAAM,CAAC;CAEX,IAAMc,IAAgBC,IAAU,QAAQ;CAExC,OACE,kBAAC,OAAD;EACE,GAAInB;EACJ,KAAKY;EACL,oBAAkBQ;EAClB,wBAAsBC;EACtB,WAAW,CAAC,eAAeC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EALhE,UAAA,CAOE,kBAAC,OAAD;GACE,W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|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-BBoWP_Y6.cjs"),t=require("../Button/index.cjs"),n=require("../Skeleton/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a({icon:t,label:n}){return(0,i.jsx)(`span`,{className:`ds-asset-card__placeholder ds-asset-tile__placeholder`,children:(0,i.jsx)(e.t,{name:t,size:24,"aria-label":n})})}function o({src:e,alt:t}){let[o,s]=(0,r.useState)(`loading`),[c,l]=(0,r.useState)(),u=(0,r.useCallback)(e=>{s(`loaded`),e.naturalWidth&&e.naturalHeight&&l(e.naturalWidth/e.naturalHeight)},[]),d=(0,r.useCallback)(e=>{e?.complete&&(e.naturalWidth>0?u(e):e.decode().then(()=>u(e),()=>{}))},[u]);return o===`failed`?(0,i.jsx)(a,{icon:`alert-triangle`,label:t?`${t} (preview unavailable)`:`Preview unavailable`}):(0,i.jsxs)(i.Fragment,{children:[o===`loading`&&(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton`}),(0,i.jsx)(`img`,{ref:d,src:e,alt:t,loading:`lazy`,"data-loaded":o===`loaded`||void 0,style:c?{"--asset-ratio":c}:void 0,onLoad:e=>u(e.currentTarget),onError:()=>s(`failed`)})]})}var s=(0,r.forwardRef)(function({name:n,src:r,alt:s=``,icon:c=`image`,fit:l=`cover`,meta:u,description:d,isSelected:f=!1,isPending:p=!1,onSelect:m,actions:h,footer:g,className:_,...v},y){return(0,i.jsxs)(`div`,{ref:y,className:[`ds-asset-card`,`ds-asset-tile`,_].filter(Boolean).join(` `),"data-fit":l,"data-selected":f||void 0,"data-pending":p||void 0,...v,children:[(0,i.jsxs)(`div`,{className:`ds-asset-card__thumb ds-asset-tile__thumb`,children:[r?(0,i.jsx)(o,{src:r,alt:s},r):(0,i.jsx)(a,{icon:c}),p&&(0,i.jsxs)(`span`,{className:`ds-asset-card__pending ds-asset-tile__pending`,role:`status`,children:[(0,i.jsx)(e.t,{name:`spinner`,size:20,className:`ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin`}),(0,i.jsx)(`span`,{className:`ds-asset-card__pending-label ds-asset-tile__pending-label`,children:`Uploading`})]}),h?(0,i.jsx)(`div`,{className:`ds-asset-card__actions ds-asset-tile__actions`,children:h}):null,m&&(0,i.jsx)(t.Button,{variant:`simple`,className:`ds-asset-card__hit ds-asset-tile__hit`,"aria-pressed":f,"aria-label":n,isDisabled:p,onClick:m})]}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text ds-asset-tile__text`,children:[(0,i.jsx)(`span`,{className:`ds-asset-card__name ds-asset-tile__name`,children:n}),u?(0,i.jsx)(`div`,{className:`ds-asset-card__meta ds-asset-tile__meta`,children:u}):null,d?(0,i.jsx)(`div`,{className:`ds-asset-card__description`,children:d}):null]}),g?(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:g}):null]})});function c({index:e=0,description:t=!1,footer:r=!1}){let a={animationDelay:`calc(var(--skeleton-stagger) * ${e})`};return(0,i.jsxs)(`div`,{className:`ds-asset-card ds-asset-tile`,"data-loading":`true`,"aria-hidden":`true`,children:[(0,i.jsx)(n.Skeleton,{shape:`block`,className:`ds-asset-card__thumb ds-asset-tile__thumb`,style:a}),(0,i.jsxs)(`div`,{className:`ds-asset-card__text ds-asset-tile__text`,children:[(0,i.jsx)(n.Skeleton,{shape:`text`,width:`80%`,style:a}),(0,i.jsx)(n.Skeleton,{shape:`text`,width:`45%`,style:a}),t&&(0,i.jsx)(n.Skeleton,{shape:`text`,width:`65%`,style:a})]}),r&&(0,i.jsx)(`div`,{className:`ds-asset-card__footer`,children:(0,i.jsx)(n.Skeleton,{shape:`block`,width:`45%`,style:{...a,blockSize:`var(--field-height-sm)`}})})]})}exports.AssetCard=s,exports.AssetCardSkeleton=c;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["Icon","useState","useCallback","_Fragment","Skeleton","forwardRef","Button","require_Icon","require_components_Button_index","require_components_Skeleton_index","react","react_jsx_runtime","Placeholder","icon","label","AssetImage","status","setStatus","ratio","setRatio","adopt","image","imageRef","alt","event","AssetCard","rest","className","fit","isSelected","isPending","src","actions","onSelect","name","meta","description","footer","AssetCardSkeleton","delay","index"],"sources":["../../../src/components/AssetCard/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { Skeleton } from \"../Skeleton\";\nimport \"./style.css\";\n\nexport interface AssetCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\" | \"title\"> {\n /** File name or crop label, displayed in full. */\n name: string;\n /** Thumbnail source. Omit to display the fallback icon. */\n src?: string;\n /** Alternative text for the preview; empty when the image is decorative. */\n alt?: string;\n /** Fallback for assets without a thumbnail, such as videos and PDFs. */\n icon?: IconName;\n /** Fill the frame, or show the complete image on an inset preview stage. */\n fit?: \"cover\" | \"contain\";\n /** Dimensions, size, ratio, or other metadata below the name. */\n meta?: ReactNode;\n /** Supporting content below the metadata, such as a source file name. */\n description?: ReactNode;\n /** Paint the selection fill and rail without changing the card's size. */\n isSelected?: boolean;\n /** Show an uploading overlay and disable the thumbnail action. */\n isPending?: boolean;\n /** Makes the thumbnail a selection toggle, independent of overlay and footer controls. */\n onSelect?: () => void;\n /** Badges, buttons, or menus pinned across the top of the thumbnail. */\n actions?: ReactNode;\n /** Actions or content below the card's text. */\n footer?: ReactNode;\n}\n\nfunction Placeholder({ icon, label }: { icon: IconName; label?: string }) {\n return (\n <span className=\"ds-asset-card__placeholder ds-asset-tile__placeholder\">\n <Icon\n name={icon}\n size={24}\n aria-label={label}\n />\n </span>\n );\n}\n\n/** Remount for each source so failed and loaded states cannot leak to another image. */\nfunction AssetImage({ src, alt }: { src: string; alt: string }) {\n const [status, setStatus] = useState<\"loading\" | \"loaded\" | \"failed\">(\"loading\");\n // The picture's own shape lets a contained preview fill the stage exactly.\n const [ratio, setRatio] = useState<number>();\n const adopt = useCallback((image: HTMLImageElement) => {\n setStatus(\"loaded\");\n if (image.naturalWidth && image.naturalHeight)\n setRatio(image.naturalWidth / image.naturalHeight);\n }, []);\n // A cached image can finish before onLoad is attached. Only success is read\n // here: an SVG without intrinsic size and a deferred lazy image also report\n // a zero naturalWidth, so failure is left to the error event.\n const imageRef = useCallback(\n (image: HTMLImageElement | null) => {\n if (!image?.complete) return;\n if (image.naturalWidth > 0) adopt(image);\n else\n image.decode().then(\n () => adopt(image),\n () => {},\n );\n },\n [adopt],\n );\n\n if (status === \"failed\") {\n return (\n <Placeholder\n icon=\"alert-triangle\"\n label={alt ? `${alt} (preview unavailable)` : \"Preview unavailable\"}\n />\n );\n }\n\n return (\n <>\n {status === \"loading\" && (\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton\"\n />\n )}\n <img\n ref={imageRef}\n src={src}\n alt={alt}\n loading=\"lazy\"\n data-loaded={status === \"loaded\" || undefined}\n style={ratio ? ({ \"--asset-ratio\": ratio } as CSSProperties) : undefined}\n onLoad={(event) => adopt(event.currentTarget)}\n onError={() => setStatus(\"failed\")}\n />\n </>\n );\n}\n\n/** Shared presentation for assets, source files, and crop variants. */\nexport const AssetCard = forwardRef<HTMLDivElement, AssetCardProps>(function AssetCard(\n {\n name,\n src,\n alt = \"\",\n icon = \"image\",\n fit = \"cover\",\n meta,\n description,\n isSelected = false,\n isPending = false,\n onSelect,\n actions,\n footer,\n className,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={[\"ds-asset-card\", \"ds-asset-tile\", className].filter(Boolean).join(\" \")}\n data-fit={fit}\n data-selected={isSelected || undefined}\n data-pending={isPending || undefined}\n {...rest}\n >\n <div className=\"ds-asset-card__thumb ds-asset-tile__thumb\">\n {src ? (\n <AssetImage\n key={src}\n src={src}\n alt={alt}\n />\n ) : (\n <Placeholder icon={icon} />\n )}\n {isPending && (\n <span\n className=\"ds-asset-card__pending ds-asset-tile__pending\"\n role=\"status\"\n >\n <Icon\n name=\"spinner\"\n size={20}\n className=\"ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin\"\n />\n <span className=\"ds-asset-card__pending-label ds-asset-tile__pending-label\">\n Uploading\n </span>\n </span>\n )}\n {/* Slots render only for truthy content, so `count && …` never leaves a stray 0. */}\n {actions ? (\n <div className=\"ds-asset-card__actions ds-asset-tile__actions\">{actions}</div>\n ) : null}\n {onSelect && (\n <Button\n variant=\"simple\"\n className=\"ds-asset-card__hit ds-asset-tile__hit\"\n aria-pressed={isSelected}\n aria-label={name}\n isDisabled={isPending}\n onClick={onSelect}\n />\n )}\n </div>\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <span className=\"ds-asset-card__name ds-asset-tile__name\">{name}</span>\n {meta ? <div className=\"ds-asset-card__meta ds-asset-tile__meta\">{meta}</div> : null}\n {description ? <div className=\"ds-asset-card__description\">{description}</div> : null}\n </div>\n {footer ? <div className=\"ds-asset-card__footer\">{footer}</div> : null}\n </div>\n );\n});\n\nexport interface AssetCardSkeletonProps {\n /** Position in the collection, used for the skeleton stagger. */\n index?: number;\n /** Reserve the description line, for cards that pass `description`. */\n description?: boolean;\n /** Reserve a footer row the height of a small Button, for cards that pass `footer`. */\n footer?: boolean;\n}\n\n/** A loading card. Match its slots to the real cards so nothing moves when they arrive. */\nexport function AssetCardSkeleton({\n index = 0,\n description = false,\n footer = false,\n}: AssetCardSkeletonProps) {\n const delay = { animationDelay: `calc(var(--skeleton-stagger) * ${index})` };\n return (\n <div\n className=\"ds-asset-card ds-asset-tile\"\n data-loading=\"true\"\n aria-hidden=\"true\"\n >\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb ds-asset-tile__thumb\"\n style={delay}\n />\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <Skeleton\n shape=\"text\"\n width=\"80%\"\n style={delay}\n />\n <Skeleton\n shape=\"text\"\n width=\"45%\"\n style={delay}\n />\n {description && (\n <Skeleton\n shape=\"text\"\n width=\"65%\"\n style={delay}\n />\n )}\n </div>\n {footer && (\n <div className=\"ds-asset-card__footer\">\n <Skeleton\n shape=\"block\"\n width=\"45%\"\n style={{ ...delay, blockSize: \"var(--field-height-sm)\" }}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"A,+OAyCA,SAASY,EAAY,CAAE,OAAM,SAA6C,CACxE,OACE,EAAAD,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wDACd,UAAA,EAAAA,EAAA,IAAA,CAACX,EAAAA,EAAD,CACE,KAAMa,EACN,KAAM,GACN,aAAYC,CACb,CAAA,CACG,CAAA,CAEV,CAGA,SAASC,EAAW,CAAE,MAAK,OAAqC,CAC9D,GAAM,CAACC,EAAQC,IAAA,EAAahB,EAAAA,SAAAA,CAA0C,SAAS,EAEzE,CAACiB,EAAOC,IAAA,EAAYlB,EAAAA,SAAAA,CAAiB,EACrCmB,GAAA,EAAQlB,EAAAA,YAAAA,CAAa,GAA4B,CACrDe,EAAU,QAAQ,EACdI,EAAM,cAAgBA,EAAM,eAC9BF,EAASE,EAAM,aAAeA,EAAM,aAAa,CACrD,EAAG,CAAC,CAAC,EAICC,GAAA,EAAWpB,EAAAA,YAAAA,CACd,GAAmC,CAC7BmB,GAAO,WACRA,EAAM,aAAe,EAAGD,EAAMC,CAAK,EAErCA,EAAM,OAAO,CAAC,CAAC,SACPD,EAAMC,CAAK,MACX,CAAC,CACT,EACJ,EACA,CAACD,CAAK,CACR,EAWA,OATIJ,IAAW,UAEX,EAAAL,EAAA,IAAA,CAACC,EAAD,CACE,KAAK,iBACL,MAAOW,EAAM,GAAGA,EAAI,wBAA0B,q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MAAM,MACN,MAAOmC,CACR,CAAA,EACAH,IACC,EAAAzB,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,OACN,MAAM,MACN,MAAOmC,CACR,CAAA,CAEA,C,GACJF,IACC,EAAA1B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,wBACb,UAAA,EAAAA,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,QACN,MAAM,MACN,MAAO,CAAE,GAAGmC,EAAO,UAAW,wBAAyB,CACxD,CAAA,CACE,CAAA,CAEJ,C,EAET,C"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Icon","useState","useCallback","_Fragment","Skeleton","forwardRef","Button","require_Icon","require_components_Button_index","require_components_Skeleton_index","react","react_jsx_runtime","Placeholder","icon","label","AssetImage","status","setStatus","ratio","setRatio","adopt","image","imageRef","alt","event","AssetCard","rest","className","fit","isSelected","isPending","src","actions","onSelect","name","meta","description","footer","AssetCardSkeleton","delay","index"],"sources":["../../../src/components/AssetCard/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { Skeleton } from \"../Skeleton\";\nimport \"./style.css\";\n\nexport interface AssetCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\" | \"title\"> {\n /** File name or crop label, displayed in full. */\n name: string;\n /** Thumbnail source. Omit to display the fallback icon. */\n src?: string;\n /** Alternative text for the preview; empty when the image is decorative. */\n alt?: string;\n /** Fallback for assets without a thumbnail, such as videos and PDFs. */\n icon?: IconName;\n /** Fill the frame, or show the complete image on an inset preview stage. */\n fit?: \"cover\" | \"contain\";\n /** Dimensions, size, ratio, or other metadata below the name. */\n meta?: ReactNode;\n /** Supporting content below the metadata, such as a source file name. */\n description?: ReactNode;\n /** Paint the selection fill and rail without changing the card's size. */\n isSelected?: boolean;\n /** Show an uploading overlay and disable the thumbnail action. */\n isPending?: boolean;\n /** Makes the thumbnail a selection toggle, independent of overlay and footer controls. */\n onSelect?: () => void;\n /** Badges, buttons, or menus pinned across the top of the thumbnail. */\n actions?: ReactNode;\n /** Actions or content below the card's text. */\n footer?: ReactNode;\n}\n\nfunction Placeholder({ icon, label }: { icon: IconName; label?: string }) {\n return (\n <span className=\"ds-asset-card__placeholder ds-asset-tile__placeholder\">\n <Icon\n name={icon}\n size={24}\n aria-label={label}\n />\n </span>\n );\n}\n\n/** Remount for each source so failed and loaded states cannot leak to another image. */\nfunction AssetImage({ src, alt }: { src: string; alt: string }) {\n const [status, setStatus] = useState<\"loading\" | \"loaded\" | \"failed\">(\"loading\");\n // The picture's own shape lets a contained preview fill the stage exactly.\n const [ratio, setRatio] = useState<number>();\n const adopt = useCallback((image: HTMLImageElement) => {\n setStatus(\"loaded\");\n if (image.naturalWidth && image.naturalHeight) {\n setRatio(image.naturalWidth / image.naturalHeight);\n }\n }, []);\n // A cached image can finish before onLoad is attached. Only success is read\n // here: an SVG without intrinsic size and a deferred lazy image also report\n // a zero naturalWidth, so failure is left to the error event.\n const imageRef = useCallback(\n (image: HTMLImageElement | null) => {\n if (!image?.complete) {\n return;\n }\n if (image.naturalWidth > 0) {\n adopt(image);\n } else {\n image.decode().then(\n () => adopt(image),\n () => {},\n );\n }\n },\n [adopt],\n );\n\n if (status === \"failed\") {\n return (\n <Placeholder\n icon=\"alert-triangle\"\n label={alt ? `${alt} (preview unavailable)` : \"Preview unavailable\"}\n />\n );\n }\n\n return (\n <>\n {status === \"loading\" && (\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton\"\n />\n )}\n <img\n ref={imageRef}\n src={src}\n alt={alt}\n loading=\"lazy\"\n data-loaded={status === \"loaded\" || undefined}\n style={ratio ? ({ \"--asset-ratio\": ratio } as CSSProperties) : undefined}\n onLoad={(event) => adopt(event.currentTarget)}\n onError={() => setStatus(\"failed\")}\n />\n </>\n );\n}\n\n/** Shared presentation for assets, source files, and crop variants. */\nexport const AssetCard = forwardRef<HTMLDivElement, AssetCardProps>(function AssetCard(\n {\n name,\n src,\n alt = \"\",\n icon = \"image\",\n fit = \"cover\",\n meta,\n description,\n isSelected = false,\n isPending = false,\n onSelect,\n actions,\n footer,\n className,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={[\"ds-asset-card\", \"ds-asset-tile\", className].filter(Boolean).join(\" \")}\n data-fit={fit}\n data-selected={isSelected || undefined}\n data-pending={isPending || undefined}\n {...rest}\n >\n <div className=\"ds-asset-card__thumb ds-asset-tile__thumb\">\n {src ? (\n <AssetImage\n key={src}\n src={src}\n alt={alt}\n />\n ) : (\n <Placeholder icon={icon} />\n )}\n {isPending && (\n <span\n className=\"ds-asset-card__pending ds-asset-tile__pending\"\n role=\"status\"\n >\n <Icon\n name=\"spinner\"\n size={20}\n className=\"ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin\"\n />\n <span className=\"ds-asset-card__pending-label ds-asset-tile__pending-label\">\n Uploading\n </span>\n </span>\n )}\n {/* Slots render only for truthy content, so `count && …` never leaves a stray 0. */}\n {actions ? (\n <div className=\"ds-asset-card__actions ds-asset-tile__actions\">{actions}</div>\n ) : null}\n {onSelect && (\n <Button\n variant=\"simple\"\n className=\"ds-asset-card__hit ds-asset-tile__hit\"\n aria-pressed={isSelected}\n aria-label={name}\n isDisabled={isPending}\n onClick={onSelect}\n />\n )}\n </div>\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <span className=\"ds-asset-card__name ds-asset-tile__name\">{name}</span>\n {meta ? <div className=\"ds-asset-card__meta ds-asset-tile__meta\">{meta}</div> : null}\n {description ? <div className=\"ds-asset-card__description\">{description}</div> : null}\n </div>\n {footer ? <div className=\"ds-asset-card__footer\">{footer}</div> : null}\n </div>\n );\n});\n\nexport interface AssetCardSkeletonProps {\n /** Position in the collection, used for the skeleton stagger. */\n index?: number;\n /** Reserve the description line, for cards that pass `description`. */\n description?: boolean;\n /** Reserve a footer row the height of a small Button, for cards that pass `footer`. */\n footer?: boolean;\n}\n\n/** A loading card. Match its slots to the real cards so nothing moves when they arrive. */\nexport function AssetCardSkeleton({\n index = 0,\n description = false,\n footer = false,\n}: AssetCardSkeletonProps) {\n const delay = { animationDelay: `calc(var(--skeleton-stagger) * ${index})` };\n return (\n <div\n className=\"ds-asset-card ds-asset-tile\"\n data-loading=\"true\"\n aria-hidden=\"true\"\n >\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb ds-asset-tile__thumb\"\n style={delay}\n />\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <Skeleton\n shape=\"text\"\n width=\"80%\"\n style={delay}\n />\n <Skeleton\n shape=\"text\"\n width=\"45%\"\n style={delay}\n />\n {description && (\n <Skeleton\n shape=\"text\"\n width=\"65%\"\n style={delay}\n />\n )}\n </div>\n {footer && (\n <div className=\"ds-asset-card__footer\">\n <Skeleton\n shape=\"block\"\n width=\"45%\"\n style={{ ...delay, blockSize: \"var(--field-height-sm)\" }}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"A,+OAyCA,SAASY,EAAY,CAAE,OAAM,SAA6C,CACxE,OACE,EAAAD,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,wDACd,UAAA,EAAAA,EAAA,IAAA,CAACX,EAAAA,EAAD,CACE,KAAMa,EACN,KAAM,GACN,aAAYC,CACb,CAAA,CACG,CAAA,CAEV,CAGA,SAASC,EAAW,CAAE,MAAK,OAAqC,CAC9D,GAAM,CAACC,EAAQC,IAAA,EAAahB,EAAAA,SAAAA,CAA0C,SAAS,EAEzE,CAACiB,EAAOC,IAAA,EAAYlB,EAAAA,SAAAA,CAAiB,EACrCmB,GAAA,EAAQlB,EAAAA,YAAAA,CAAa,GAA4B,CACrDe,EAAU,QAAQ,EACdI,EAAM,cAAgBA,EAAM,eAC9BF,EAASE,EAAM,aAAeA,EAAM,aAAa,CAErD,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ACb,cAAY,OAHd,SAAA,EAKE,EAAAA,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,QACN,UAAU,4CACV,MAAOmC,CACR,CAAA,GACD,EAAA5B,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,0CAAf,SAAA,EACE,EAAAA,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,OACN,MAAM,MACN,MAAOmC,CACR,CAAA,GACD,EAAA5B,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,OACN,MAAM,MACN,MAAOmC,CACR,CAAA,EACAH,IACC,EAAAzB,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,OACN,MAAM,MACN,MAAOmC,CACR,CAAA,CAEA,C,GACJF,IACC,EAAA1B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,wBACb,UAAA,EAAAA,EAAA,IAAA,CAACP,EAAAA,SAAD,CACE,MAAM,QACN,MAAM,MACN,MAAO,CAAE,GAAGmC,EAAO,UAAW,wBAAyB,CACxD,CAAA,CACE,CAAA,CAEJ,C,EAET,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/AssetCard/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAChG,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB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;AA4ED,uEAAuE;AACvE,eAAO,MAAM,SAAS,2GA4EpB,CAAC;AAEH,MAAM,WAAW,sBAAsB;IACrC,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,uFAAuF;IACvF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,EAChC,KAAS,EACT,WAAmB,EACnB,MAAc,GACf,EAAE,sBAAsB,+BA2CxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Icon-
|
|
1
|
+
import { t as e } from "../../chunks/Icon-XNismJDm.js";
|
|
2
2
|
import { Button as t } from "../Button/index.js";
|
|
3
3
|
import { Skeleton as n } from "../Skeleton/index.js";
|
|
4
4
|
import { forwardRef as r, useCallback as i, useState as a } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_Fragment","Icon","Fragment$1","Placeholder","icon","label","AssetImage","status","setStatus","useState","ratio","setRatio","adopt","useCallback","image","imageRef","alt","Skeleton","event","AssetCard","forwardRef","rest","className","fit","isSelected","isPending","src","actions","onSelect","Button","name","meta","description","footer","AssetCardSkeleton","delay","index"],"sources":["../../../src/components/AssetCard/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { Skeleton } from \"../Skeleton\";\nimport \"./style.css\";\n\nexport interface AssetCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\" | \"title\"> {\n /** File name or crop label, displayed in full. */\n name: string;\n /** Thumbnail source. Omit to display the fallback icon. */\n src?: string;\n /** Alternative text for the preview; empty when the image is decorative. */\n alt?: string;\n /** Fallback for assets without a thumbnail, such as videos and PDFs. */\n icon?: IconName;\n /** Fill the frame, or show the complete image on an inset preview stage. */\n fit?: \"cover\" | \"contain\";\n /** Dimensions, size, ratio, or other metadata below the name. */\n meta?: ReactNode;\n /** Supporting content below the metadata, such as a source file name. */\n description?: ReactNode;\n /** Paint the selection fill and rail without changing the card's size. */\n isSelected?: boolean;\n /** Show an uploading overlay and disable the thumbnail action. */\n isPending?: boolean;\n /** Makes the thumbnail a selection toggle, independent of overlay and footer controls. */\n onSelect?: () => void;\n /** Badges, buttons, or menus pinned across the top of the thumbnail. */\n actions?: ReactNode;\n /** Actions or content below the card's text. */\n footer?: ReactNode;\n}\n\nfunction Placeholder({ icon, label }: { icon: IconName; label?: string }) {\n return (\n <span className=\"ds-asset-card__placeholder ds-asset-tile__placeholder\">\n <Icon\n name={icon}\n size={24}\n aria-label={label}\n />\n </span>\n );\n}\n\n/** Remount for each source so failed and loaded states cannot leak to another image. */\nfunction AssetImage({ src, alt }: { src: string; alt: string }) {\n const [status, setStatus] = useState<\"loading\" | \"loaded\" | \"failed\">(\"loading\");\n // The picture's own shape lets a contained preview fill the stage exactly.\n const [ratio, setRatio] = useState<number>();\n const adopt = useCallback((image: HTMLImageElement) => {\n setStatus(\"loaded\");\n if (image.naturalWidth && image.naturalHeight)\n setRatio(image.naturalWidth / image.naturalHeight);\n }, []);\n // A cached image can finish before onLoad is attached. Only success is read\n // here: an SVG without intrinsic size and a deferred lazy image also report\n // a zero naturalWidth, so failure is left to the error event.\n const imageRef = useCallback(\n (image: HTMLImageElement | null) => {\n if (!image?.complete) return;\n if (image.naturalWidth > 0) adopt(image);\n else\n image.decode().then(\n () => adopt(image),\n () => {},\n );\n },\n [adopt],\n );\n\n if (status === \"failed\") {\n return (\n <Placeholder\n icon=\"alert-triangle\"\n label={alt ? `${alt} (preview unavailable)` : \"Preview unavailable\"}\n />\n );\n }\n\n return (\n <>\n {status === \"loading\" && (\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton\"\n />\n )}\n <img\n ref={imageRef}\n src={src}\n alt={alt}\n loading=\"lazy\"\n data-loaded={status === \"loaded\" || undefined}\n style={ratio ? ({ \"--asset-ratio\": ratio } as CSSProperties) : undefined}\n onLoad={(event) => adopt(event.currentTarget)}\n onError={() => setStatus(\"failed\")}\n />\n </>\n );\n}\n\n/** Shared presentation for assets, source files, and crop variants. */\nexport const AssetCard = forwardRef<HTMLDivElement, AssetCardProps>(function AssetCard(\n {\n name,\n src,\n alt = \"\",\n icon = \"image\",\n fit = \"cover\",\n meta,\n description,\n isSelected = false,\n isPending = false,\n onSelect,\n actions,\n footer,\n className,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={[\"ds-asset-card\", \"ds-asset-tile\", className].filter(Boolean).join(\" \")}\n data-fit={fit}\n data-selected={isSelected || undefined}\n data-pending={isPending || undefined}\n {...rest}\n >\n <div className=\"ds-asset-card__thumb ds-asset-tile__thumb\">\n {src ? (\n <AssetImage\n key={src}\n src={src}\n alt={alt}\n />\n ) : (\n <Placeholder icon={icon} />\n )}\n {isPending && (\n <span\n className=\"ds-asset-card__pending ds-asset-tile__pending\"\n role=\"status\"\n >\n <Icon\n name=\"spinner\"\n size={20}\n className=\"ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin\"\n />\n <span className=\"ds-asset-card__pending-label ds-asset-tile__pending-label\">\n Uploading\n </span>\n </span>\n )}\n {/* Slots render only for truthy content, so `count && …` never leaves a stray 0. */}\n {actions ? (\n <div className=\"ds-asset-card__actions ds-asset-tile__actions\">{actions}</div>\n ) : null}\n {onSelect && (\n <Button\n variant=\"simple\"\n className=\"ds-asset-card__hit ds-asset-tile__hit\"\n aria-pressed={isSelected}\n aria-label={name}\n isDisabled={isPending}\n onClick={onSelect}\n />\n )}\n </div>\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <span className=\"ds-asset-card__name ds-asset-tile__name\">{name}</span>\n {meta ? <div className=\"ds-asset-card__meta ds-asset-tile__meta\">{meta}</div> : null}\n {description ? <div className=\"ds-asset-card__description\">{description}</div> : null}\n </div>\n {footer ? <div className=\"ds-asset-card__footer\">{footer}</div> : null}\n </div>\n );\n});\n\nexport interface AssetCardSkeletonProps {\n /** Position in the collection, used for the skeleton stagger. */\n index?: number;\n /** Reserve the description line, for cards that pass `description`. */\n description?: boolean;\n /** Reserve a footer row the height of a small Button, for cards that pass `footer`. */\n footer?: boolean;\n}\n\n/** A loading card. Match its slots to the real cards so nothing moves when they arrive. */\nexport function AssetCardSkeleton({\n index = 0,\n description = false,\n footer = false,\n}: AssetCardSkeletonProps) {\n const delay = { animationDelay: `calc(var(--skeleton-stagger) * ${index})` };\n return (\n <div\n className=\"ds-asset-card ds-asset-tile\"\n data-loading=\"true\"\n aria-hidden=\"true\"\n >\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb ds-asset-tile__thumb\"\n style={delay}\n />\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <Skeleton\n shape=\"text\"\n width=\"80%\"\n style={delay}\n />\n <Skeleton\n shape=\"text\"\n width=\"45%\"\n style={delay}\n />\n {description && (\n <Skeleton\n shape=\"text\"\n width=\"65%\"\n style={delay}\n />\n )}\n </div>\n {footer && (\n <div className=\"ds-asset-card__footer\">\n <Skeleton\n shape=\"block\"\n width=\"45%\"\n style={{ ...delay, blockSize: \"var(--field-height-sm)\" }}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAyCA,SAASG,EAAY,EAAE,SAAM,YAA6C;CACxE,OACE,kBAAC,QAAD;EAAM,WAAU;EACd,UAAA,kBAACF,GAAD;GACE,MAAMG;GACN,MAAM;GACN,cAAYC;EACb,CAAA;CACG,CAAA;AAEV;AAGA,SAASC,EAAW,EAAE,QAAK,UAAqC;CAC9D,IAAM,CAACC,GAAQC,KAAaC,EAA0C,SAAS,GAEzE,CAACC,GAAOC,KAAYF,EAAiB,GACrCG,IAAQC,GAAa,MAA4B;EAErD,AADAL,EAA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WAAU;IACb,UAAA,kBAAChB,GAAD;KACE,OAAM;KACN,OAAM;KACN,OAAO;MAAE,GAAGkB;MAAO,WAAW;KAAyB;IACxD,CAAA;GACE,CAAA;EAEJ;;AAET"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_Fragment","Icon","Fragment$1","Placeholder","icon","label","AssetImage","status","setStatus","useState","ratio","setRatio","adopt","useCallback","image","imageRef","alt","Skeleton","event","AssetCard","forwardRef","rest","className","fit","isSelected","isPending","src","actions","onSelect","Button","name","meta","description","footer","AssetCardSkeleton","delay","index"],"sources":["../../../src/components/AssetCard/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Icon } from \"../Icon\";\nimport type { IconName } from \"../Icon/icons\";\nimport { Skeleton } from \"../Skeleton\";\nimport \"./style.css\";\n\nexport interface AssetCardProps extends Omit<HTMLAttributes<HTMLDivElement>, \"onSelect\" | \"title\"> {\n /** File name or crop label, displayed in full. */\n name: string;\n /** Thumbnail source. Omit to display the fallback icon. */\n src?: string;\n /** Alternative text for the preview; empty when the image is decorative. */\n alt?: string;\n /** Fallback for assets without a thumbnail, such as videos and PDFs. */\n icon?: IconName;\n /** Fill the frame, or show the complete image on an inset preview stage. */\n fit?: \"cover\" | \"contain\";\n /** Dimensions, size, ratio, or other metadata below the name. */\n meta?: ReactNode;\n /** Supporting content below the metadata, such as a source file name. */\n description?: ReactNode;\n /** Paint the selection fill and rail without changing the card's size. */\n isSelected?: boolean;\n /** Show an uploading overlay and disable the thumbnail action. */\n isPending?: boolean;\n /** Makes the thumbnail a selection toggle, independent of overlay and footer controls. */\n onSelect?: () => void;\n /** Badges, buttons, or menus pinned across the top of the thumbnail. */\n actions?: ReactNode;\n /** Actions or content below the card's text. */\n footer?: ReactNode;\n}\n\nfunction Placeholder({ icon, label }: { icon: IconName; label?: string }) {\n return (\n <span className=\"ds-asset-card__placeholder ds-asset-tile__placeholder\">\n <Icon\n name={icon}\n size={24}\n aria-label={label}\n />\n </span>\n );\n}\n\n/** Remount for each source so failed and loaded states cannot leak to another image. */\nfunction AssetImage({ src, alt }: { src: string; alt: string }) {\n const [status, setStatus] = useState<\"loading\" | \"loaded\" | \"failed\">(\"loading\");\n // The picture's own shape lets a contained preview fill the stage exactly.\n const [ratio, setRatio] = useState<number>();\n const adopt = useCallback((image: HTMLImageElement) => {\n setStatus(\"loaded\");\n if (image.naturalWidth && image.naturalHeight) {\n setRatio(image.naturalWidth / image.naturalHeight);\n }\n }, []);\n // A cached image can finish before onLoad is attached. Only success is read\n // here: an SVG without intrinsic size and a deferred lazy image also report\n // a zero naturalWidth, so failure is left to the error event.\n const imageRef = useCallback(\n (image: HTMLImageElement | null) => {\n if (!image?.complete) {\n return;\n }\n if (image.naturalWidth > 0) {\n adopt(image);\n } else {\n image.decode().then(\n () => adopt(image),\n () => {},\n );\n }\n },\n [adopt],\n );\n\n if (status === \"failed\") {\n return (\n <Placeholder\n icon=\"alert-triangle\"\n label={alt ? `${alt} (preview unavailable)` : \"Preview unavailable\"}\n />\n );\n }\n\n return (\n <>\n {status === \"loading\" && (\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb-skeleton ds-asset-tile__thumb-skeleton\"\n />\n )}\n <img\n ref={imageRef}\n src={src}\n alt={alt}\n loading=\"lazy\"\n data-loaded={status === \"loaded\" || undefined}\n style={ratio ? ({ \"--asset-ratio\": ratio } as CSSProperties) : undefined}\n onLoad={(event) => adopt(event.currentTarget)}\n onError={() => setStatus(\"failed\")}\n />\n </>\n );\n}\n\n/** Shared presentation for assets, source files, and crop variants. */\nexport const AssetCard = forwardRef<HTMLDivElement, AssetCardProps>(function AssetCard(\n {\n name,\n src,\n alt = \"\",\n icon = \"image\",\n fit = \"cover\",\n meta,\n description,\n isSelected = false,\n isPending = false,\n onSelect,\n actions,\n footer,\n className,\n ...rest\n },\n ref,\n) {\n return (\n <div\n ref={ref}\n className={[\"ds-asset-card\", \"ds-asset-tile\", className].filter(Boolean).join(\" \")}\n data-fit={fit}\n data-selected={isSelected || undefined}\n data-pending={isPending || undefined}\n {...rest}\n >\n <div className=\"ds-asset-card__thumb ds-asset-tile__thumb\">\n {src ? (\n <AssetImage\n key={src}\n src={src}\n alt={alt}\n />\n ) : (\n <Placeholder icon={icon} />\n )}\n {isPending && (\n <span\n className=\"ds-asset-card__pending ds-asset-tile__pending\"\n role=\"status\"\n >\n <Icon\n name=\"spinner\"\n size={20}\n className=\"ds-asset-card__spinner ds-asset-tile__spinner ds-icon--spin\"\n />\n <span className=\"ds-asset-card__pending-label ds-asset-tile__pending-label\">\n Uploading\n </span>\n </span>\n )}\n {/* Slots render only for truthy content, so `count && …` never leaves a stray 0. */}\n {actions ? (\n <div className=\"ds-asset-card__actions ds-asset-tile__actions\">{actions}</div>\n ) : null}\n {onSelect && (\n <Button\n variant=\"simple\"\n className=\"ds-asset-card__hit ds-asset-tile__hit\"\n aria-pressed={isSelected}\n aria-label={name}\n isDisabled={isPending}\n onClick={onSelect}\n />\n )}\n </div>\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <span className=\"ds-asset-card__name ds-asset-tile__name\">{name}</span>\n {meta ? <div className=\"ds-asset-card__meta ds-asset-tile__meta\">{meta}</div> : null}\n {description ? <div className=\"ds-asset-card__description\">{description}</div> : null}\n </div>\n {footer ? <div className=\"ds-asset-card__footer\">{footer}</div> : null}\n </div>\n );\n});\n\nexport interface AssetCardSkeletonProps {\n /** Position in the collection, used for the skeleton stagger. */\n index?: number;\n /** Reserve the description line, for cards that pass `description`. */\n description?: boolean;\n /** Reserve a footer row the height of a small Button, for cards that pass `footer`. */\n footer?: boolean;\n}\n\n/** A loading card. Match its slots to the real cards so nothing moves when they arrive. */\nexport function AssetCardSkeleton({\n index = 0,\n description = false,\n footer = false,\n}: AssetCardSkeletonProps) {\n const delay = { animationDelay: `calc(var(--skeleton-stagger) * ${index})` };\n return (\n <div\n className=\"ds-asset-card ds-asset-tile\"\n data-loading=\"true\"\n aria-hidden=\"true\"\n >\n <Skeleton\n shape=\"block\"\n className=\"ds-asset-card__thumb ds-asset-tile__thumb\"\n style={delay}\n />\n <div className=\"ds-asset-card__text ds-asset-tile__text\">\n <Skeleton\n shape=\"text\"\n width=\"80%\"\n style={delay}\n />\n <Skeleton\n shape=\"text\"\n width=\"45%\"\n style={delay}\n />\n {description && (\n <Skeleton\n shape=\"text\"\n width=\"65%\"\n style={delay}\n />\n )}\n </div>\n {footer && (\n <div className=\"ds-asset-card__footer\">\n <Skeleton\n shape=\"block\"\n width=\"45%\"\n style={{ ...delay, blockSize: \"var(--field-height-sm)\" }}\n />\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;AAyCA,SAASG,EAAY,EAAE,SAAM,YAA6C;CACxE,OACE,kBAAC,QAAD;EAAM,WAAU;EACd,UAAA,kBAACF,GAAD;GACE,MAAMG;GACN,MAAM;GACN,cAAYC;EACb,CAAA;CACG,CAAA;AAEV;AAGA,SAASC,EAAW,EAAE,QAAK,UAAqC;CAC9D,IAAM,CAACC,GAAQC,KAAaC,EAA0C,SAAS,GAEzE,CAACC,GAAOC,KAAYF,EAAiB,GACrCG,IAAQC,GAAa,MAA4B;EAErD,AADAL,EAAU,QAAQ,GACdM,EAAM,gBAAgBA,EAAM,iBAC9BH,EAASG,EAAM,eAAeA,EAAM,aAAa;CAErD,GAAG,CAAC,CAAC,GAICC,IAAWF,GACd,MAAmC;EAClC,AAAKC,GAAO,aAGRA,EAAM,eAAe,IACvBF,EAAME,CAAK,IAEXA,EAAM,OAAO,CAAC,CAAC,WACPF,EAAME,CAAK,SACX,CAAC,CACT;CAEJ,GACA,CAACF,CAAK,CACR;CAWA,OATIL,MAAW,WAEX,kBAACJ,GAAD;EACE,MAAK;EACL,OAAOa,IAAM,GAAGA,EAAI,0BAA0B;CAC/C,CAAA,IAKH,kBAAAhB,GAAA,EAAA,UAAA,CACGO,MAAW,aACV,kBAACU,G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AE;KAAW,CAAA;KACrEC,IAAO,kBAAC,OAAD;MAAK,WAAU;MAA2C,UAAAA;KAAU,CAAA,IAAI;KAC/EC,IAAc,kBAAC,OAAD;MAAK,WAAU;MAA8B,UAAAA;KAAiB,CAAA,IAAI;IAC9E;;GACJC,IAAS,kBAAC,OAAD;IAAK,WAAU;IAAyB,UAAAA;GAAY,CAAA,IAAI;EAC/D;;AAET,CAAC;AAYD,SAAgBC,EAAkB,EAChC,WAAQ,GACR,iBAAc,IACd,YAAS,MACgB;CACzB,IAAMC,IAAQ,EAAE,gBAAgB,kCAAkCC,EAAM,GAAG;CAC3E,OACE,kBAAC,OAAD;EACE,WAAU;EACV,gBAAa;EACb,eAAY;EAHd,UAAA;GAKE,kBAACnB,GAAD;IACE,OAAM;IACN,WAAU;IACV,OAAOkB;GACR,CAAA;GACD,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,kBAAClB,GAAD;MACE,OAAM;MACN,OAAM;MACN,OAAOkB;KACR,CAAA;KACD,kBAAClB,GAAD;MACE,OAAM;MACN,OAAM;MACN,OAAOkB;KACR,CAAA;KACAH,KACC,kBAACf,GAAD;MACE,OAAM;MACN,OAAM;MACN,OAAOkB;KACR,CAAA;IAEA;;GACJF,KACC,kBAAC,OAAD;IAAK,WAAU;IACb,UAAA,kBAAChB,GAAD;KACE,OAAM;KACN,OAAM;KACN,OAAO;MAAE,GAAGkB;MAAO,WAAW;KAAyB;IACxD,CAAA;GACE,CAAA;EAEJ;;AAET"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-BBoWP_Y6.cjs"),t=require("../Grid/index.cjs"),n=require("../AssetCard/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({isLoading:e=!1,loadingCount:r=8,loadingCard:o,className:s,children:c,...l},u){return(0,i.jsx)(t.Grid,{ref:u,columns:`auto`,gap:`md`,minColumnWidth:`var(--asset-tile-min-width)`,className:a(`ds-asset-grid`,s),"aria-busy":e||void 0,...l,children:e?Array.from({length:r},(e,t)=>(0,i.jsx)(n.AssetCardSkeleton,{...o,index:t},t)):c})});function s({title:t,description:n,action:r}){return(0,i.jsxs)(`div`,{className:`ds-asset-empty`,children:[(0,i.jsx)(e.t,{name:`image`,size:24}),(0,i.jsx)(`span`,{className:`ds-asset-empty__title`,children:t}),n&&(0,i.jsx)(`span`,{className:`ds-asset-empty__description`,children:n}),r]})}exports.AssetGrid=o,exports.AssetGridEmpty=s,exports.AssetTile=n.AssetCard,exports.AssetTileSkeleton=n.AssetCardSkeleton;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Icon-
|
|
1
|
+
import { t as e } from "../../chunks/Icon-XNismJDm.js";
|
|
2
2
|
import { Grid as t } from "../Grid/index.js";
|
|
3
3
|
import { AssetCard as n, AssetCardSkeleton as r } from "../AssetCard/index.js";
|
|
4
4
|
import { forwardRef as i } from "react";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","react","react_jsx_runtime","Badge","rest","shape","isCountExact","value","children","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\n\n/**\n * How much ink the badge spends.\n * - `outline` — the tone as a 2px stroke on the surface. The quiet default.\n * - `soft` — the tone's soft fill behind tone-coloured text. For dense tables.\n * - `solid` — the tone as a full fill. Reserve it for the one state a row is\n * really about; a table of solid badges reads as noise.\n */\nexport type BadgeAppearance = \"outline\" | \"soft\" | \"solid\";\n\n/** Six publication states, and no seventh without a decision record. */\nexport type StatusTone =\n \"draft\" | \"scheduled\" | \"published\" | \"changed\" | \"unpublished\" | \"archived\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n shape?: BadgeShape;\n /** Required on `status`, forbidden on `tag` and `count`. */\n tone?: StatusTone;\n appearance?: BadgeAppearance;\n /** Show count values in full, including zero. Other count badges keep their compact defaults. */\n isCountExact?: boolean;\n children?: ReactNode;\n}\n\n/**\n * A small, non-interactive label attached to something else. Never a button,\n * never a filter. Status tones are reserved for publication state.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n {\n shape = \"tag\",\n tone,\n appearance = \"outline\",\n isCountExact = false,\n className,\n children,\n ...rest\n },\n ref,\n) {\n if (shape === \"count\" && !isCountExact) {\n const value = Number(children);\n if (!Number.isNaN(value)) {\n if (value === 0) return null;\n children = value > 99 ? \"99+\" : String(value);\n }\n }\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-appearance={appearance}\n data-tone={shape === \"status\" ? tone : undefined}\n className={[\"ds-badge\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {shape === \"status\" && (\n <span\n className=\"ds-badge__dot\"\n aria-hidden=\"true\"\n />\n )}\n {children}\n </span>\n );\n});\n"],"mappings":"A,yHAgCA,IAAaG,GAAA,EAAQH,EAAAA,WAAAA,CAAwC,SAC3D,CACE,QAAQ,MACR,OACA,aAAa,UACb,eAAe,GACf,YACA,WACA,GAAGI,GAEL,EACA,CACA,GAAIC,IAAU,SAAW,CAACC,EAAc,CACtC,IAAMC,EAAQ,OAAOC,CAAQ,EAC7B,GAAI,CAAC,OAAO,MAAMD,CAAK,EAAG,CACxB,GAAIA,IAAU,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","react","react_jsx_runtime","Badge","rest","shape","isCountExact","value","children","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\n\n/**\n * How much ink the badge spends.\n * - `outline` — the tone as a 2px stroke on the surface. The quiet default.\n * - `soft` — the tone's soft fill behind tone-coloured text. For dense tables.\n * - `solid` — the tone as a full fill. Reserve it for the one state a row is\n * really about; a table of solid badges reads as noise.\n */\nexport type BadgeAppearance = \"outline\" | \"soft\" | \"solid\";\n\n/** Six publication states, and no seventh without a decision record. */\nexport type StatusTone =\n \"draft\" | \"scheduled\" | \"published\" | \"changed\" | \"unpublished\" | \"archived\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n shape?: BadgeShape;\n /** Required on `status`, forbidden on `tag` and `count`. */\n tone?: StatusTone;\n appearance?: BadgeAppearance;\n /** Show count values in full, including zero. Other count badges keep their compact defaults. */\n isCountExact?: boolean;\n children?: ReactNode;\n}\n\n/**\n * A small, non-interactive label attached to something else. Never a button,\n * never a filter. Status tones are reserved for publication state.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n {\n shape = \"tag\",\n tone,\n appearance = \"outline\",\n isCountExact = false,\n className,\n children,\n ...rest\n },\n ref,\n) {\n if (shape === \"count\" && !isCountExact) {\n const value = Number(children);\n if (!Number.isNaN(value)) {\n if (value === 0) {\n return null;\n }\n children = value > 99 ? \"99+\" : String(value);\n }\n }\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-appearance={appearance}\n data-tone={shape === \"status\" ? tone : undefined}\n className={[\"ds-badge\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {shape === \"status\" && (\n <span\n className=\"ds-badge__dot\"\n aria-hidden=\"true\"\n />\n )}\n {children}\n </span>\n );\n});\n"],"mappings":"A,yHAgCA,IAAaG,GAAA,EAAQH,EAAAA,WAAAA,CAAwC,SAC3D,CACE,QAAQ,MACR,OACA,aAAa,UACb,eAAe,GACf,YACA,WACA,GAAGI,GAEL,EACA,CACA,GAAIC,IAAU,SAAW,CAACC,EAAc,CACtC,I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C;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iGAAiG;IACjG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,wGAwChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iGAAiG;IACjG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,wEAAwE;AACxE,MAAM,MAAM,UAAU,GACpB,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAE/E,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,eAAe,CAAC;IACjE,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,iGAAiG;IACjG,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,wGAwChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Badge","forwardRef","rest","shape","isCountExact","value","children","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\n\n/**\n * How much ink the badge spends.\n * - `outline` — the tone as a 2px stroke on the surface. The quiet default.\n * - `soft` — the tone's soft fill behind tone-coloured text. For dense tables.\n * - `solid` — the tone as a full fill. Reserve it for the one state a row is\n * really about; a table of solid badges reads as noise.\n */\nexport type BadgeAppearance = \"outline\" | \"soft\" | \"solid\";\n\n/** Six publication states, and no seventh without a decision record. */\nexport type StatusTone =\n \"draft\" | \"scheduled\" | \"published\" | \"changed\" | \"unpublished\" | \"archived\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n shape?: BadgeShape;\n /** Required on `status`, forbidden on `tag` and `count`. */\n tone?: StatusTone;\n appearance?: BadgeAppearance;\n /** Show count values in full, including zero. Other count badges keep their compact defaults. */\n isCountExact?: boolean;\n children?: ReactNode;\n}\n\n/**\n * A small, non-interactive label attached to something else. Never a button,\n * never a filter. Status tones are reserved for publication state.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n {\n shape = \"tag\",\n tone,\n appearance = \"outline\",\n isCountExact = false,\n className,\n children,\n ...rest\n },\n ref,\n) {\n if (shape === \"count\" && !isCountExact) {\n const value = Number(children);\n if (!Number.isNaN(value)) {\n if (value === 0) return null;\n children = value > 99 ? \"99+\" : String(value);\n }\n }\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-appearance={appearance}\n data-tone={shape === \"status\" ? tone : undefined}\n className={[\"ds-badge\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {shape === \"status\" && (\n <span\n className=\"ds-badge__dot\"\n aria-hidden=\"true\"\n />\n )}\n {children}\n </span>\n );\n});\n"],"mappings":";;;AAgCA,IAAaA,IAAQC,EAAwC,SAC3D,EACE,WAAQ,OACR,SACA,gBAAa,WACb,kBAAe,IACf,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAIC,MAAU,WAAW,CAACC,GAAc;EACtC,IAAMC,IAAQ,OAAOC,CAAQ;EAC7B,IAAI,CAAC,OAAO,MAAMD,CAAK,GAAG;GACxB,IAAIA,MAAU,
|
|
1
|
+
{"version":3,"file":"index.js","names":["Badge","forwardRef","rest","shape","isCountExact","value","children","appearance","tone","className"],"sources":["../../../src/components/Badge/index.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport type BadgeShape = \"status\" | \"tag\" | \"count\";\n\n/**\n * How much ink the badge spends.\n * - `outline` — the tone as a 2px stroke on the surface. The quiet default.\n * - `soft` — the tone's soft fill behind tone-coloured text. For dense tables.\n * - `solid` — the tone as a full fill. Reserve it for the one state a row is\n * really about; a table of solid badges reads as noise.\n */\nexport type BadgeAppearance = \"outline\" | \"soft\" | \"solid\";\n\n/** Six publication states, and no seventh without a decision record. */\nexport type StatusTone =\n \"draft\" | \"scheduled\" | \"published\" | \"changed\" | \"unpublished\" | \"archived\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n shape?: BadgeShape;\n /** Required on `status`, forbidden on `tag` and `count`. */\n tone?: StatusTone;\n appearance?: BadgeAppearance;\n /** Show count values in full, including zero. Other count badges keep their compact defaults. */\n isCountExact?: boolean;\n children?: ReactNode;\n}\n\n/**\n * A small, non-interactive label attached to something else. Never a button,\n * never a filter. Status tones are reserved for publication state.\n */\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n {\n shape = \"tag\",\n tone,\n appearance = \"outline\",\n isCountExact = false,\n className,\n children,\n ...rest\n },\n ref,\n) {\n if (shape === \"count\" && !isCountExact) {\n const value = Number(children);\n if (!Number.isNaN(value)) {\n if (value === 0) {\n return null;\n }\n children = value > 99 ? \"99+\" : String(value);\n }\n }\n\n return (\n <span\n ref={ref}\n data-shape={shape}\n data-appearance={appearance}\n data-tone={shape === \"status\" ? tone : undefined}\n className={[\"ds-badge\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {shape === \"status\" && (\n <span\n className=\"ds-badge__dot\"\n aria-hidden=\"true\"\n />\n )}\n {children}\n </span>\n );\n});\n"],"mappings":";;;AAgCA,IAAaA,IAAQC,EAAwC,SAC3D,EACE,WAAQ,OACR,SACA,gBAAa,WACb,kBAAe,IACf,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAIC,MAAU,WAAW,CAACC,GAAc;EACtC,IAAMC,IAAQ,OAAOC,CAAQ;EAC7B,IAAI,CAAC,OAAO,MAAMD,CAAK,GAAG;GACxB,IAAIA,MAAU,GACZ,OAAO;GAET,IAAWA,IAAQ,KAAK,QAAQ,OAAOA,CAAK;EAC9C;CACF;CAEA,OACE,kBAAC,QAAD;EACO;EACL,cAAYF;EACZ,mBAAiBI;EACjB,aAAWJ,MAAU,WAAWK,IAAO,KAAA;EACvC,WAAW,CAAC,YAAYC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC3D,GAAIP;EANN,UAAA,CAQGC,MAAU,YACT,kBAAC,QAAD;GACE,WAAU;GACV,eAAY;EACb,CAAA,GAEFG,CACG;;AAEV,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Board-BaQ04nWg.cjs");exports.Board=e.t,exports.BoardCard=e.n,exports.BoardColumn=e.r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Board/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE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AM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,wCAAwC;IACxC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,0GA8DtB,CAAC;AAEH,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,cAAc,CAAC;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,2GAgCpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Board/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA6Bf,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Board/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK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,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,0GA8DtB,CAAC;AAEH,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,cAAc,CAAC;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,2GAgCpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-
|
|
1
|
+
export { t as Board, n as BoardCard, r as BoardColumn } from "../../chunks/Board-CUhF8pTX.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.cts","sourceRoot":"","sources":["../../../src/components/Board/keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"keyboard.d.cts","sourceRoot":"","sources":["../../../src/components/Board/keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,wBAyBnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../src/components/Board/keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../src/components/Board/keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAG9D;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,wBAyBnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moves.d.cts","sourceRoot":"","sources":["../../../src/components/Board/moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAEpD,wBAAgB,UAAU,CACxB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,EAC9B,SAAS,EAAE,MAAM,EAAE,GAClB,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"moves.d.cts","sourceRoot":"","sources":["../../../src/components/Board/moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAEpD,wBAAgB,UAAU,CACxB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,EAC9B,SAAS,EAAE,MAAM,EAAE,GAClB,eAAe,GAAG,SAAS,CAW7B;AAED,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAmB9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moves.d.ts","sourceRoot":"","sources":["../../../src/components/Board/moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAEpD,wBAAgB,UAAU,CACxB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,EAC9B,SAAS,EAAE,MAAM,EAAE,GAClB,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"moves.d.ts","sourceRoot":"","sources":["../../../src/components/Board/moves.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAEpD,wBAAgB,UAAU,CACxB,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,EAC9B,SAAS,EAAE,MAAM,EAAE,GAClB,eAAe,GAAG,SAAS,CAW7B;AAED,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS,CAmB9E"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-BBoWP_Y6.cjs");let t=require("react"),n=require("react/jsx-runtime");var r=(0,t.forwardRef)(function({variant:t=`neutral`,size:r=`md`,iconStart:i,iconEnd:a,isIconOnly:o=!1,isDisabled:s=!1,isPending:c=!1,className:l,children:u,type:d=`button`,...f},p){let m=r===`lg`?20:16;return(0,n.jsxs)(`button`,{ref:p,type:d,disabled:s||c,"data-variant":t,"data-size":r,"data-icon-only":o||void 0,"data-pending":c||void 0,className:[`ds-button`,l].filter(Boolean).join(` `),...f,children:[c?(0,n.jsx)(e.t,{name:`spinner`,size:m,className:`ds-button__spinner ds-icon--spin`}):i&&(0,n.jsx)(e.t,{name:i,size:m}),(!o||!i&&!c)&&u,a&&!o&&(0,n.jsx)(e.t,{name:a,size:m})]})});exports.Button=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldGroup","Stack","Grid","require_group","require_components_Grid_index","react","react_jsx_runtime","Checkbox","rest","inner","isIndeterminate","className","node","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\nexport interface CheckboxProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\"\n> {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (inner.current) inner.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control\"\n data-kind=\"checkbox\"\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={ref}\n type=\"radio\"\n className=\"ds-choice__control\"\n data-kind=\"radio\"\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,2MAeA,IAAaS,GAAA,EAAWT,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGU,GACnD,EACA,CACA,IAAMC,GAAA,EAAQV,EAAAA,OAAAA,CAAgC,IAAI,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldGroup","Stack","Grid","require_group","require_components_Grid_index","react","react_jsx_runtime","Checkbox","rest","inner","isIndeterminate","className","node","ref","children","Radio","ChoiceGroup","fieldProps","columns"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\nexport interface CheckboxProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\"\n> {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control\"\n data-kind=\"checkbox\"\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={ref}\n type=\"radio\"\n className=\"ds-choice__control\"\n data-kind=\"radio\"\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":"A,2MAeA,IAAaS,GAAA,EAAWT,EAAAA,WAAAA,CAA4C,SAClE,CAAE,kBAAkB,GAAO,YAAW,WAAU,GAAGU,GACnD,EACA,CACA,IAAMC,GAAA,EAAQV,EAAAA,OAAAA,CAAgC,IAAI,EAQlD,OANA,EAAAM,EAAA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CAAA,GAEjC,EAAAK,EAAA,IAAA,CAACJ,EAAAA,KAAD,CACW,UACT,IAAI,KAEH,UACG,CAAA,CAEE,CAAA,CAEhB,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Choice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,CAChB;IACC,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,uEAAuE;AACvE,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Choice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,CAChB;IACC,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,uEAAuE;AACvE,eAAO,MAAM,QAAQ,4GA+BnB,CAAC;AAEH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9F,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,0EAA0E;AAC1E,eAAO,MAAM,KAAK,yGAgBhB,CAAC;AAEH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,UAAU,EACd,EAAE,gBAAgB,+BAmBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,CAChB;IACC,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,uEAAuE;AACvE,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Choice/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,mBAAmB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChG,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,MAAM,CAChB;IACC,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,uEAAuE;AACvE,eAAO,MAAM,QAAQ,4GA+BnB,CAAC;AAEH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9F,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,0EAA0E;AAC1E,eAAO,MAAM,KAAK,yGAgBhB,CAAC;AAEH,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAW,EACX,QAAQ,EACR,SAAS,EACT,GAAG,UAAU,EACd,EAAE,gBAAgB,+BAmBlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["FieldGroup","Checkbox","forwardRef","rest","inner","useRef","useEffect","isIndeterminate","className","node","ref","children","Radio","ChoiceGroup","fieldProps","columns","Stack","Grid"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\nexport interface CheckboxProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\"\n> {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (inner.current) inner.current.indeterminate = isIndeterminate;\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control\"\n data-kind=\"checkbox\"\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={ref}\n type=\"radio\"\n className=\"ds-choice__control\"\n data-kind=\"radio\"\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;AAeA,IAAaC,IAAWC,EAA4C,SAClE,EAAE,qBAAkB,IAAO,cAAW,aAAU,GAAGC,KACnD,GACA;CACA,IAAMC,IAAQC,EAAgC,IAAI;
|
|
1
|
+
{"version":3,"file":"index.js","names":["FieldGroup","Checkbox","forwardRef","rest","inner","useRef","useEffect","isIndeterminate","className","node","ref","children","Radio","ChoiceGroup","fieldProps","columns","Stack","Grid"],"sources":["../../../src/components/Choice/index.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, Stack } from \"../Grid\";\nimport \"./style.css\";\n\nexport interface CheckboxProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\"\n> {\n /** Display state only — clicking an indeterminate box selects all. */\n isIndeterminate?: boolean;\n children?: ReactNode;\n}\n\n/** An independent yes/no. 20px box at every size, in every context. */\nexport const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(\n { isIndeterminate = false, className, children, ...rest },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (inner.current) {\n inner.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n type=\"checkbox\"\n className=\"ds-choice__control\"\n data-kind=\"checkbox\"\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }}\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface RadioProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\"> {\n children?: ReactNode;\n}\n\n/** One of two or more mutually exclusive choices, all of them visible. */\nexport const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(\n { className, children, ...rest },\n ref,\n) {\n return (\n <label className={[\"ds-choice\", className].filter(Boolean).join(\" \")}>\n <input\n ref={ref}\n type=\"radio\"\n className=\"ds-choice__control\"\n data-kind=\"radio\"\n {...rest}\n />\n {children && <span className=\"ds-choice__label\">{children}</span>}\n </label>\n );\n});\n\nexport interface ChoiceGroupProps extends FieldGroupProps {\n /**\n * Run a long list in columns instead of one stack. Steps down to a single\n * column inside a narrow container.\n */\n columns?: 1 | 2 | 3;\n children: ReactNode;\n}\n\n/** A set of checkboxes or radios under one group label, spaced by Stack or Grid. */\nexport function ChoiceGroup({\n label,\n columns = 1,\n children,\n className,\n ...fieldProps\n}: ChoiceGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-choice-group\", className].filter(Boolean).join(\" \")}\n >\n {columns === 1 ? (\n <Stack gap=\"sm\">{children}</Stack>\n ) : (\n <Grid\n columns={columns}\n gap=\"sm\"\n >\n {children}\n </Grid>\n )}\n </FieldGroup>\n );\n}\n"],"mappings":";;;;;AAeA,IAAaC,IAAWC,EAA4C,SAClE,EAAE,qBAAkB,IAAO,cAAW,aAAU,GAAGC,KACnD,GACA;CACA,IAAMC,IAAQC,EAAgC,IAAI;CAQlD,OANAC,QAAgB;EACd,AAAIF,EAAM,YACR,EAAM,QAAQ,gBAAgBG;CAElC,GAAG,CAACA,CAAe,CAAC,GAGlB,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAaC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACE,MAAK;GACL,WAAU;GACV,aAAU;GACV,MAAM,MAAS;IAEb,AADA,EAAM,UAAUC,GACZ,OAAOC,KAAQ,aACjBA,EAAID,CAAI,IACCC,MACT,EAAI,UAAUD;GAElB;GACA,GAAIN;EACL,CAAA,GACAQ,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC,GAOYC,IAAQV,EAAyC,SAC5D,EAAE,cAAW,aAAU,GAAGC,KAC1B,GACA;CACA,OACE,kBAAC,SAAD;EAAO,WAAW,CAAC,aAAaK,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAAnE,UAAA,CACE,kBAAC,SAAD;GACO;GACL,MAAK;GACL,WAAU;GACV,aAAU;GACV,GAAIL;EACL,CAAA,GACAQ,KAAY,kBAAC,QAAD;GAAM,WAAU;GAAoB;EAAe,CAAA,CAC3D;;AAEX,CAAC;AAYD,SAAgBE,EAAY,EAC1B,UACA,aAAU,GACV,aACA,cACA,GAAGC,KACgB;CACnB,OACE,kBAACd,GAAD;EACE,GAAIc;EACG;EACP,WAAW,CAAC,mBAAmBN,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAEjE,UAAAO,MAAY,IACX,kBAACC,GAAD;GAAO,KAAI;GAAM;EAAgB,CAAA,IAEjC,kBAACC,GAAD;GACW;GACT,KAAI;GAEH;EACG,CAAA;CAEE,CAAA;AAEhB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Colour {
|
|
2
|
+
h: number;
|
|
3
|
+
s: number;
|
|
4
|
+
v: number;
|
|
5
|
+
a: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseColour(value: string): import("colord").Colord | null;
|
|
8
|
+
export declare function colourHex(colour: Colour): string;
|
|
9
|
+
export declare function normaliseColour(value: string): string;
|
|
10
|
+
/** Preserve latent hue in greys, and saturation in black, including parent echoes. */
|
|
11
|
+
export declare function colourState(value: string, previous?: Colour): Colour;
|
|
12
|
+
//# sourceMappingURL=colour.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colour.d.cts","sourceRoot":"","sources":["../../../src/components/ColourField/colour.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,kCAkBxC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,UAEvC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,UAE5C;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAc,GAAG,MAAM,CAsBzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface Colour {
|
|
2
|
+
h: number;
|
|
3
|
+
s: number;
|
|
4
|
+
v: number;
|
|
5
|
+
a: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseColour(value: string): import("colord").Colord | null;
|
|
8
|
+
export declare function colourHex(colour: Colour): string;
|
|
9
|
+
export declare function normaliseColour(value: string): string;
|
|
10
|
+
/** Preserve latent hue in greys, and saturation in black, including parent echoes. */
|
|
11
|
+
export declare function colourState(value: string, previous?: Colour): Colour;
|
|
12
|
+
//# sourceMappingURL=colour.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colour.d.ts","sourceRoot":"","sources":["../../../src/components/ColourField/colour.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,MAAM;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,kCAkBxC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,UAEvC;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,UAE5C;AAED,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAc,GAAG,MAAM,CAsBzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.cts","sourceRoot":"","sources":["../../../src/components/ColourField/focus.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,QAMhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../../src/components/ColourField/focus.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,QAMhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-BdAbjgmY.cjs");exports.ColourField=e.t,exports.ColourPanel=e.n;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PopoverPlacement } from "../Popover/index.cjs";
|
|
2
|
+
import { type TextFieldProps } from "../TextField/index.cjs";
|
|
3
|
+
import { type ColourPickerOptions } from "./panel.cjs";
|
|
4
|
+
import { type ColourValueProps } from "./value.cjs";
|
|
5
|
+
export { ColourPanel } from "./panel.cjs";
|
|
6
|
+
export type { ColourPanelProps } from "./panel.cjs";
|
|
7
|
+
export interface ColourFieldProps extends Omit<TextFieldProps, "value" | "defaultValue" | "onChange" | "type" | "children">, ColourValueProps, ColourPickerOptions {
|
|
8
|
+
isInvalid?: boolean;
|
|
9
|
+
placement?: PopoverPlacement;
|
|
10
|
+
/** Parsing validity; an empty value is valid and native required validation remains separate. */
|
|
11
|
+
onValidityChange?: (isValid: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
/** A typed colour value and a visual picker, bound to the shared Field frame. */
|
|
14
|
+
export declare const ColourField: import("react").ForwardRefExoticComponent<ColourFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/ColourField/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9D,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,gBACf,SACE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC,EACjF,gBAAgB,EAChB,mBAAmB;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,+GAkOtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type PopoverPlacement } from "../Popover/index.js";
|
|
2
|
+
import { type TextFieldProps } from "../TextField/index.js";
|
|
3
|
+
import { type ColourPickerOptions } from "./panel.js";
|
|
4
|
+
import { type ColourValueProps } from "./value.js";
|
|
5
|
+
export { ColourPanel } from "./panel.js";
|
|
6
|
+
export type { ColourPanelProps } from "./panel.js";
|
|
7
|
+
export interface ColourFieldProps extends Omit<TextFieldProps, "value" | "defaultValue" | "onChange" | "type" | "children">, ColourValueProps, ColourPickerOptions {
|
|
8
|
+
isInvalid?: boolean;
|
|
9
|
+
placement?: PopoverPlacement;
|
|
10
|
+
/** Parsing validity; an empty value is valid and native required validation remains separate. */
|
|
11
|
+
onValidityChange?: (isValid: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
/** A typed colour value and a visual picker, bound to the shared Field frame. */
|
|
14
|
+
export declare const ColourField: import("react").ForwardRefExoticComponent<ColourFieldProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ColourField/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9D,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACvE,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,YAAY,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,MAAM,WAAW,gBACf,SACE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC,EACjF,gBAAgB,EAChB,mBAAmB;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,iGAAiG;IACjG,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC/C;AAED,iFAAiF;AACjF,eAAO,MAAM,WAAW,+GAkOtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-Bd4twbaG.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HTMLAttributes } from "react";
|
|
2
|
+
import { type Colour } from "./colour.cjs";
|
|
3
|
+
import { type ColourValueProps } from "./value.cjs";
|
|
4
|
+
export interface ColourPickerOptions {
|
|
5
|
+
presets?: string[];
|
|
6
|
+
showPresets?: boolean;
|
|
7
|
+
picker?: "custom" | "native";
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ColourPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange">, ColourValueProps, ColourPickerOptions {
|
|
11
|
+
}
|
|
12
|
+
/** A standalone colour selection surface, also composed by ColourField. */
|
|
13
|
+
export declare const ColourPanel: import("react").ForwardRefExoticComponent<ColourPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
interface ColourPanelContentProps extends Omit<ColourPanelProps, "value" | "defaultValue" | "onValueChange"> {
|
|
15
|
+
colour: Colour;
|
|
16
|
+
current: string;
|
|
17
|
+
onColourChange: (colour: Colour | string) => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const ColourPanelContent: import("react").ForwardRefExoticComponent<ColourPanelContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=panel.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"panel.d.cts","sourceRoot":"","sources":["../../../src/components/ColourField/panel.tsx"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAwD,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAE7F,OAAO,EAAkB,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBACf,SACE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,EACjE,gBAAgB,EAChB,mBAAmB;CAAG;AAkC1B,2EAA2E;AAC3E,eAAO,MAAM,WAAW,6GActB,CAAC;AAEH,UAAU,uBAAwB,SAAQ,IAAI,CAC5C,gBAAgB,EAChB,OAAO,GAAG,cAAc,GAAG,eAAe,CAC3C;IACC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,eAAO,MAAM,kBAAkB,oHA4Q9B,CAAC"}
|