@namroodinc/liquid-editorial 0.13.5 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/UPGRADING.md +47 -0
- package/dist/chunks/{Avatar-UjhjcHh5.js → Avatar-BToMaTdL.js} +2 -2
- package/dist/chunks/{Avatar-UjhjcHh5.js.map → Avatar-BToMaTdL.js.map} +1 -1
- package/dist/chunks/{Avatar-BY0dAItT.cjs → Avatar-Dw7EWd_-.cjs} +2 -2
- package/dist/chunks/{Avatar-BY0dAItT.cjs.map → Avatar-Dw7EWd_-.cjs.map} +1 -1
- package/dist/chunks/{Board-CQ1GTuRB.cjs → Board-DeXtaWNO.cjs} +2 -2
- package/dist/chunks/{Board-CQ1GTuRB.cjs.map → Board-DeXtaWNO.cjs.map} +1 -1
- package/dist/chunks/{Board-DUX76d2R.js → Board-XeDG9nWP.js} +2 -2
- package/dist/chunks/{Board-DUX76d2R.js.map → Board-XeDG9nWP.js.map} +1 -1
- package/dist/chunks/{CollectionView-JRNdXHti.js → CollectionView-C0_bTO2v.js} +2 -2
- package/dist/chunks/{CollectionView-JRNdXHti.js.map → CollectionView-C0_bTO2v.js.map} +1 -1
- package/dist/chunks/{CollectionView-CIJdNwcq.cjs → CollectionView-Dbg4d_tA.cjs} +2 -2
- package/dist/chunks/{CollectionView-CIJdNwcq.cjs.map → CollectionView-Dbg4d_tA.cjs.map} +1 -1
- package/dist/chunks/{ColourField-BG5oGj9f.js → ColourField-Bb8H87fg.js} +3 -3
- package/dist/chunks/{ColourField-BG5oGj9f.js.map → ColourField-Bb8H87fg.js.map} +1 -1
- package/dist/chunks/{ColourField-DFvRASVe.cjs → ColourField-DAFzOIOq.cjs} +2 -2
- package/dist/chunks/{ColourField-DFvRASVe.cjs.map → ColourField-DAFzOIOq.cjs.map} +1 -1
- package/dist/chunks/{DatePicker-LqaePc57.js → DatePicker-COm1giw8.js} +3 -3
- package/dist/chunks/{DatePicker-LqaePc57.js.map → DatePicker-COm1giw8.js.map} +1 -1
- package/dist/chunks/{DatePicker-ClOqS6oH.cjs → DatePicker-DOg3iQYy.cjs} +2 -2
- package/dist/chunks/{DatePicker-ClOqS6oH.cjs.map → DatePicker-DOg3iQYy.cjs.map} +1 -1
- package/dist/chunks/{Drawer-DdIH9jpe.cjs → Drawer-B2dcTh5l.cjs} +2 -2
- package/dist/chunks/{Drawer-DdIH9jpe.cjs.map → Drawer-B2dcTh5l.cjs.map} +1 -1
- package/dist/chunks/{Drawer-Ck5XKT_V.js → Drawer-nUTJtwX_.js} +3 -3
- package/dist/chunks/{Drawer-Ck5XKT_V.js.map → Drawer-nUTJtwX_.js.map} +1 -1
- package/dist/chunks/EntryPicker-BwEYRtQl.cjs +2 -0
- package/dist/chunks/EntryPicker-BwEYRtQl.cjs.map +1 -0
- package/dist/chunks/{use-picker-session-BSpOwnQ-.js → EntryPicker-Ie9T47hA.js} +367 -202
- package/dist/chunks/EntryPicker-Ie9T47hA.js.map +1 -0
- package/dist/chunks/FormEditor-D1HUnjMI.cjs +2 -0
- package/dist/chunks/FormEditor-D1HUnjMI.cjs.map +1 -0
- package/dist/chunks/FormEditor-DgDV5aeR.js +30 -0
- package/dist/chunks/FormEditor-DgDV5aeR.js.map +1 -0
- package/dist/chunks/Icon-Bxvp1-td.js +102 -0
- package/dist/chunks/Icon-Bxvp1-td.js.map +1 -0
- package/dist/chunks/{Icon-3ucBRgrd.cjs → Icon-CnnTrtNb.cjs} +2 -2
- package/dist/chunks/Icon-CnnTrtNb.cjs.map +1 -0
- package/dist/chunks/{Message-yhdaBpaz.cjs → Message-B0A5bz8V.cjs} +2 -2
- package/dist/chunks/{Message-yhdaBpaz.cjs.map → Message-B0A5bz8V.cjs.map} +1 -1
- package/dist/chunks/{Message-d6lqiMQ6.js → Message-VJTPhId7.js} +2 -2
- package/dist/chunks/{Message-d6lqiMQ6.js.map → Message-VJTPhId7.js.map} +1 -1
- package/dist/chunks/RichTextEditor-DPhEkDxi.js +2108 -0
- package/dist/chunks/RichTextEditor-DPhEkDxi.js.map +1 -0
- package/dist/chunks/RichTextEditor-DV7NZp_k.cjs +2 -0
- package/dist/chunks/RichTextEditor-DV7NZp_k.cjs.map +1 -0
- package/dist/chunks/{dialogLabel-DT7rCr3_.js → dialogLabel-C153NosD.js} +2 -2
- package/dist/chunks/{dialogLabel-DT7rCr3_.js.map → dialogLabel-C153NosD.js.map} +1 -1
- package/dist/chunks/{dialogLabel-_-MTckE_.cjs → dialogLabel-CNNQbtob.cjs} +2 -2
- package/dist/chunks/{dialogLabel-_-MTckE_.cjs.map → dialogLabel-CNNQbtob.cjs.map} +1 -1
- package/dist/chunks/overlayLayer-CtOTt1xB.cjs +2 -0
- package/dist/chunks/overlayLayer-CtOTt1xB.cjs.map +1 -0
- package/dist/chunks/{overlayLayer-lU4iWSjO.js → overlayLayer-Og07sIyl.js} +21 -3
- package/dist/chunks/overlayLayer-Og07sIyl.js.map +1 -0
- package/dist/chunks/{useTooltip-DnJEFBLg.js → useTooltip-Du8PutGX.js} +2 -2
- package/dist/chunks/{useTooltip-DnJEFBLg.js.map → useTooltip-Du8PutGX.js.map} +1 -1
- package/dist/chunks/{useTooltip-C7ON4nkV.cjs → useTooltip-ekdwMJFz.cjs} +2 -2
- package/dist/chunks/{useTooltip-C7ON4nkV.cjs.map → useTooltip-ekdwMJFz.cjs.map} +1 -1
- package/dist/components/AppShell/index.cjs +1 -1
- package/dist/components/AppShell/index.js +1 -1
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Avatar/index.cjs +1 -1
- package/dist/components/Avatar/index.js +1 -1
- package/dist/components/Banner/index.cjs +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Choice/index.cjs +1 -1
- package/dist/components/Choice/index.cjs.map +1 -1
- package/dist/components/Choice/index.js +5 -5
- package/dist/components/CollectionView/index.cjs +1 -1
- package/dist/components/CollectionView/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.js +1 -1
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.js +4 -4
- package/dist/components/EntryPicker/dialog.d.cts +11 -1
- package/dist/components/EntryPicker/dialog.d.cts.map +1 -1
- package/dist/components/EntryPicker/dialog.d.ts +11 -1
- package/dist/components/EntryPicker/dialog.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.cts +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.ts +1 -1
- package/dist/components/EntryPicker/use-picker-data.d.ts.map +1 -1
- package/dist/components/EntryPicker/use-picker-session.d.cts +4 -1
- package/dist/components/EntryPicker/use-picker-session.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-picker-session.d.ts +4 -1
- package/dist/components/EntryPicker/use-picker-session.d.ts.map +1 -1
- package/dist/components/EntryPicker/use-selected-items.d.cts +2 -0
- package/dist/components/EntryPicker/use-selected-items.d.cts.map +1 -1
- package/dist/components/EntryPicker/use-selected-items.d.ts +2 -0
- package/dist/components/EntryPicker/use-selected-items.d.ts.map +1 -1
- package/dist/components/FormEditor/README.md +155 -24
- package/dist/components/FormEditor/control.d.cts +11 -2
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts +11 -2
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/form.d.cts +33 -0
- package/dist/components/FormEditor/form.d.cts.map +1 -0
- package/dist/components/FormEditor/form.d.ts +33 -0
- package/dist/components/FormEditor/form.d.ts.map +1 -0
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts +3 -27
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts +3 -27
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +3 -3
- package/dist/components/FormEditor/model.d.cts +2 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +2 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/rich-text-control.d.cts +4 -0
- package/dist/components/FormEditor/rich-text-control.d.cts.map +1 -0
- package/dist/components/FormEditor/rich-text-control.d.ts +4 -0
- package/dist/components/FormEditor/rich-text-control.d.ts.map +1 -0
- package/dist/components/Icon/icons.d.cts +11 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +11 -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 +1 -1
- package/dist/components/ImageCropper/index.cjs.map +1 -1
- package/dist/components/ImageCropper/index.js +6 -6
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts +3 -2
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts +3 -2
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +64 -51
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/RichTextEditor/document.d.cts +6 -2
- package/dist/components/RichTextEditor/document.d.cts.map +1 -1
- package/dist/components/RichTextEditor/document.d.ts +6 -2
- package/dist/components/RichTextEditor/document.d.ts.map +1 -1
- package/dist/components/RichTextEditor/embed-context.d.cts +5 -0
- package/dist/components/RichTextEditor/embed-context.d.cts.map +1 -1
- package/dist/components/RichTextEditor/embed-context.d.ts +5 -0
- package/dist/components/RichTextEditor/embed-context.d.ts.map +1 -1
- package/dist/components/RichTextEditor/embed-types.d.cts +6 -4
- package/dist/components/RichTextEditor/embed-types.d.cts.map +1 -1
- package/dist/components/RichTextEditor/embed-types.d.ts +6 -4
- package/dist/components/RichTextEditor/embed-types.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +8 -0
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +8 -0
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -2
- package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
- package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
- package/dist/components/RichTextEditor/style.css +44 -46
- package/dist/components/RichTextEditor/tables.d.cts +7 -0
- package/dist/components/RichTextEditor/tables.d.cts.map +1 -0
- package/dist/components/RichTextEditor/tables.d.ts +7 -0
- package/dist/components/RichTextEditor/tables.d.ts.map +1 -0
- package/dist/components/RichTextEditor/use-embeds.d.cts.map +1 -1
- package/dist/components/RichTextEditor/use-embeds.d.ts.map +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +2 -2
- package/dist/components/SelectionCard/index.cjs +1 -1
- package/dist/components/SelectionCard/index.cjs.map +1 -1
- package/dist/components/SelectionCard/index.js +4 -4
- package/dist/components/SelectionCard/index.js.map +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Time/index.cjs +1 -1
- package/dist/components/Time/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +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.js +28 -28
- package/dist/internal/dialogFocus.d.cts +6 -1
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +6 -1
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/package.json +8 -6
- package/dist/chunks/EntryPicker-B4dAsObz.cjs +0 -2
- package/dist/chunks/EntryPicker-B4dAsObz.cjs.map +0 -1
- package/dist/chunks/EntryPicker-DDXHytMN.js +0 -160
- package/dist/chunks/EntryPicker-DDXHytMN.js.map +0 -1
- package/dist/chunks/FormEditor-BGzE-rqk.cjs +0 -2
- package/dist/chunks/FormEditor-BGzE-rqk.cjs.map +0 -1
- package/dist/chunks/FormEditor-ChH4e5sB.js +0 -693
- package/dist/chunks/FormEditor-ChH4e5sB.js.map +0 -1
- package/dist/chunks/Icon-3ucBRgrd.cjs.map +0 -1
- package/dist/chunks/Icon-dPXyBYe5.js +0 -91
- package/dist/chunks/Icon-dPXyBYe5.js.map +0 -1
- package/dist/chunks/RichTextEditor-BFblqw8m.js +0 -1144
- package/dist/chunks/RichTextEditor-BFblqw8m.js.map +0 -1
- package/dist/chunks/RichTextEditor-DU9CVeRD.cjs +0 -2
- package/dist/chunks/RichTextEditor-DU9CVeRD.cjs.map +0 -1
- package/dist/chunks/overlayLayer-iGhuAByk.cjs +0 -2
- package/dist/chunks/overlayLayer-iGhuAByk.cjs.map +0 -1
- package/dist/chunks/overlayLayer-lU4iWSjO.js.map +0 -1
- package/dist/chunks/use-picker-session-BSpOwnQ-.js.map +0 -1
- package/dist/chunks/use-picker-session-ouqHBmVA.cjs +0 -2
- package/dist/chunks/use-picker-session-ouqHBmVA.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useOverlayOpen","cx","parts","Menu","forwardRef","rest","open","setOpen","useState","isOpen","rootRef","useRef","triggerRef","listRef","menuId","useId","close","useCallback","restoreTriggerFocus","useEffect","node","ref","onPointerDown","target","event","onKeyDown","onListKeyDown","items","index","trigger","Popover","className","onClick","MenuItem","Button","tone","icon","children","shortcut","MenuSeparator","MenuLabel"],"sources":["../../../src/components/Menu/index.tsx"],"sourcesContent":["import { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Popover } from \"../Popover\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport type MenuAlign = \"start\" | \"end\";\n\nexport interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Receives the props that open the menu — usually a `Button`. */\n trigger: (props: {\n \"aria-haspopup\": \"menu\";\n \"aria-expanded\": boolean;\n \"aria-controls\"?: string;\n onClick: () => void;\n }) => ReactElement;\n align?: MenuAlign;\n /** Menu items, labels and separators. */\n children: ReactNode;\n}\n\n/**\n * A short list of actions attached to a control. Closes on Escape, on outside\n * click and after any item is chosen; arrow keys walk the items.\n */\nexport const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu(\n { trigger, align = \"start\", className, children, onClick, onKeyDown, ...rest },\n ref,\n) {\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const menuId = useId();\n\n const close = useCallback(() => setOpen(false), []);\n const restoreTriggerFocus = useCallback(() => {\n const focusTarget =\n triggerRef.current?.querySelector<HTMLElement>(\"button, [href], [tabindex]\") ??\n triggerRef.current;\n focusTarget?.focus();\n }, []);\n\n useEffect(() => {\n // A closing panel stays mounted, inert, for its fade-out; the forwarded ref\n // follows the open menu only, so it is null whenever the menu is closed.\n const node = isOpen ? listRef.current : null;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }, [isOpen, ref]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !listRef.current?.contains(target)) {\n close();\n }\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n close();\n restoreTriggerFocus();\n }\n };\n\n document.addEventListener(\"mousedown\", onPointerDown);\n document.addEventListener(\"keydown\", onKeyDown);\n listRef.current?.querySelector<HTMLButtonElement>(\"button:not(:disabled)\")?.focus();\n\n return () => {\n document.removeEventListener(\"mousedown\", onPointerDown);\n document.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [isOpen, close, restoreTriggerFocus]);\n\n const onListKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\") {\n return;\n }\n event.preventDefault();\n const items = Array.from(\n listRef.current?.querySelectorAll<HTMLButtonElement>(\"button:not(:disabled)\") ?? [],\n );\n if (items.length === 0) {\n return;\n }\n const index = items.indexOf(document.activeElement as HTMLButtonElement);\n const next =\n event.key === \"ArrowDown\"\n ? items[(index + 1) % items.length]\n : items[(index - 1 + items.length) % items.length];\n next?.focus();\n };\n\n return (\n <div\n className=\"ds-menu-root\"\n ref={rootRef}\n >\n <span\n ref={triggerRef}\n className=\"ds-menu-root\"\n >\n {trigger({\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? menuId : undefined,\n onClick: () => setOpen((open) => !open),\n })}\n </span>\n <Popover\n anchorRef={triggerRef}\n isOpen={isOpen}\n align={align}\n offset={8}\n id={menuId}\n role=\"menu\"\n className={cx(\"ds-surface-raised\", \"ds-field-surface\", \"ds-menu\", className)}\n panelRef={listRef}\n >\n <div\n className=\"ds-menu__list\"\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) {\n onListKeyDown(event);\n }\n }}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n close();\n restoreTriggerFocus();\n }\n }}\n {...rest}\n >\n {children}\n </div>\n </Popover>\n </div>\n );\n});\n\nexport type MenuItemTone = \"neutral\" | \"danger\";\n\nexport interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n icon?: IconName;\n tone?: MenuItemTone;\n /** Rendered right-aligned and muted, e.g. \"⌘K\". */\n shortcut?: string;\n isDisabled?: boolean;\n children?: ReactNode;\n}\n\nexport const MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(function MenuItem(\n { icon, tone = \"neutral\", shortcut, isDisabled = false, className, children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n variant={tone === \"danger\" ? \"danger\" : \"simple\"}\n size=\"sm\"\n iconStart={icon}\n role=\"menuitem\"\n isDisabled={isDisabled}\n data-tone={tone === \"danger\" ? \"danger\" : undefined}\n className={cx(\"ds-menu-item\", className)}\n {...rest}\n >\n {children}\n {shortcut && <span className=\"ds-menu-item__shortcut\">{shortcut}</span>}\n </Button>\n );\n});\n\nexport function MenuSeparator() {\n return (\n <div\n className=\"ds-menu-separator\"\n role=\"separator\"\n />\n );\n}\n\nexport function MenuLabel({ children }: { children: ReactN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AChF,GACA;CACA,OACE,kBAAC6B,GAAD;EACO;EACL,SAASC,MAAS,WAAW,WAAW;EACxC,MAAK;EACL,WAAWC;EACX,MAAK;EACO;EACZ,aAAWD,MAAS,WAAW,WAAW,KAAA;EAC1C,WAAWlC,EAAG,gBAAgB8B,CAAS;EACvC,GAAI1B;EATN,UAAA,CAWGgC,GACAC,KAAY,kBAAC,QAAD;GAAM,WAAU;GAA0B,UAAAA;EAAe,CAAA,CAChE;;AAEZ,CAAC;AAED,SAAgBC,IAAgB;CAC9B,OACE,kBAAC,OAAD;EACE,WAAU;EACV,MAAK;CACN,CAAA;AAEL;AAEA,SAAgBC,EAAU,EAAE,eAAqC;CAC/D,OAAO,kBAAC,OAAD;EAAK,WAAU;EAAiB;CAAc,CAAA;AACvD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["cannotHoldFocus","focusAfterField","useOverlayOpen","cx","parts","Menu","forwardRef","ariaLabel","labelledBy","rest","open","setOpen","useState","isOpen","rootRef","useRef","triggerRef","listRef","menuId","useId","close","useCallback","restoreTriggerFocus","useEffect","node","ref","onPointerDown","target","event","onKeyDown","list","onListKeyDown","items","index","trigger","Popover","className","active","MenuItem","Button","tone","icon","children","shortcut","MenuSeparator","MenuLabel"],"sources":["../../../src/components/Menu/index.tsx"],"sourcesContent":["import { cannotHoldFocus, focusAfterField } from \"../../internal/dialogFocus\";\nimport { useOverlayOpen } from \"../../internal/overlayLayer\";\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useRef,\n useState,\n type ButtonHTMLAttributes,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { Popover } from \"../Popover\";\nimport type { IconName } from \"../Icon/icons\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport type MenuAlign = \"start\" | \"end\";\n\nexport interface MenuProps extends Omit<HTMLAttributes<HTMLDivElement>, \"children\"> {\n /** Receives the props that open the menu — usually a `Button`. */\n trigger: (props: {\n \"aria-haspopup\": \"menu\";\n \"aria-expanded\": boolean;\n \"aria-controls\"?: string;\n onClick: () => void;\n }) => ReactElement;\n align?: MenuAlign;\n /** Menu items, labels and separators. */\n children: ReactNode;\n}\n\n/**\n * A short list of actions attached to a control. Opens on its checked item, if\n * any, else its first. Closes on Escape, on outside click, on Tab and after an\n * item is chosen; arrow keys walk the items. Its label names the menu.\n */\nexport const Menu = forwardRef<HTMLDivElement, MenuProps>(function Menu(\n {\n trigger,\n align = \"start\",\n className,\n children,\n onClick,\n onKeyDown,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": labelledBy,\n ...rest\n },\n ref,\n) {\n const [open, setOpen] = useState(false);\n const isOpen = useOverlayOpen(open);\n const rootRef = useRef<HTMLDivElement | null>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const listRef = useRef<HTMLDivElement | null>(null);\n const menuId = useId();\n\n const close = useCallback(() => setOpen(false), []);\n const restoreTriggerFocus = useCallback(() => {\n const focusTarget =\n triggerRef.current?.querySelector<HTMLElement>(\"button, [href], [tabindex]\") ??\n triggerRef.current;\n focusTarget?.focus();\n }, []);\n\n useEffect(() => {\n // A closing panel stays mounted, inert, for its fade-out; the forwarded ref\n // follows the open menu only, so it is null whenever the menu is closed.\n const node = isOpen ? listRef.current : null;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n }, [isOpen, ref]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const onPointerDown = (event: MouseEvent) => {\n const target = event.target as Node;\n if (!rootRef.current?.contains(target) && !listRef.current?.contains(target)) {\n close();\n }\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n close();\n restoreTriggerFocus();\n }\n };\n\n document.addEventListener(\"mousedown\", onPointerDown);\n document.addEventListener(\"keydown\", onKeyDown);\n // A checked item, such as the current choice among radio items, takes focus first.\n const list = listRef.current;\n (\n list?.querySelector<HTMLElement>('[aria-checked=\"true\"]:not(:disabled)') ??\n list?.querySelector<HTMLButtonElement>(\"button:not(:disabled)\")\n )?.focus();\n\n return () => {\n document.removeEventListener(\"mousedown\", onPointerDown);\n document.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [isOpen, close, restoreTriggerFocus]);\n\n const onListKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Tab leaves the menu as it would leave the trigger: onward past it, or back to it.\n if (event.key === \"Tab\") {\n event.preventDefault();\n close();\n if (event.shiftKey) {\n restoreTriggerFocus();\n } else if (rootRef.current) {\n focusAfterField(rootRef.current);\n }\n return;\n }\n if (event.key !== \"ArrowDown\" && event.key !== \"ArrowUp\") {\n return;\n }\n event.preventDefault();\n const items = Array.from(\n listRef.current?.querySelectorAll<HTMLButtonElement>(\"button:not(:disabled)\") ?? [],\n );\n if (items.length === 0) {\n return;\n }\n const index = items.indexOf(document.activeElement as HTMLButtonElement);\n const next =\n event.key === \"ArrowDown\"\n ? items[(index + 1) % items.length]\n : items[(index - 1 + items.length) % items.length];\n next?.focus();\n };\n\n return (\n <div\n className=\"ds-menu-root\"\n ref={rootRef}\n >\n <span\n ref={triggerRef}\n className=\"ds-menu-root\"\n >\n {trigger({\n \"aria-haspopup\": \"menu\",\n \"aria-expanded\": isOpen,\n \"aria-controls\": isOpen ? menuId : undefined,\n onClick: () => setOpen((open) => !open),\n })}\n </span>\n <Popover\n anchorRef={triggerRef}\n isOpen={isOpen}\n align={align}\n offset={8}\n id={menuId}\n role=\"menu\"\n aria-label={ariaLabel}\n aria-labelledby={labelledBy}\n className={cx(\"ds-surface-raised\", \"ds-field-surface\", \"ds-menu\", className)}\n panelRef={listRef}\n >\n <div\n className=\"ds-menu__list\"\n onKeyDown={(event) => {\n onKeyDown?.(event);\n if (!event.defaultPrevented) {\n onListKeyDown(event);\n }\n }}\n onClick={(event) => {\n onClick?.(event);\n // Only a chosen item closes the menu, not a click on a label, separator or gap.\n const target = event.target;\n if (\n event.defaultPrevented ||\n !(target instanceof Element) ||\n !target.closest(\"button\")\n ) {\n return;\n }\n close();\n // An item that moved focus, such as into the editor it changed, keeps it there.\n const active = document.activeElement;\n if (cannotHoldFocus(active) || listRef.current?.contains(active)) {\n restoreTriggerFocus();\n }\n }}\n {...rest}\n >\n {children}\n </div>\n </Popover>\n </div>\n );\n});\n\nexport type MenuItemTone = \"neutral\" | \"danger\";\n\nexport interface MenuItemProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"disabled\"> {\n icon?: IconName;\n tone?: MenuItemTone;\n /** Rendered right-aligned and muted, e.g. \"⌘K\". */\n shortcut?: string;\n isDisabled?: boolean;\n children?: ReactNode;\n}\n\nexport const MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(function MenuItem(\n { icon, tone = \"neutral\", shortcut, isDisabled = false, className, children, ...rest },\n ref,\n) {\n return (\n <Button\n ref={ref}\n variant={tone === \"danger\" ? \"danger\" : \"simple\"}\n size=\"sm\"\n iconStart={icon}\n role=\"menuitem\"\n isDisabled={isDisabled}\n data-tone={tone === \"danger\" ? \"danger\" : undefined}\n className={cx(\"ds-menu-item\", className)}\n {...rest}\n >\n {children}\n {shortcut && <span className=\"ds-menu-item__shortcut\">{shortcut}</span>}\n </Button>\n );\n});\n\nexport function MenuSeparator() {\n return (\n <div\n className=\"ds-menu-separator\"\n role=\"separator\"\n />\n );\n}\n\nexport function MenuLabel({ children }: { children: ReactNode }) {\n return <div className=\"ds-menu-label\">{children}</div>;\n}\n"],"mappings":";;;;;;AAmBA,SAASG,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAsBA,IAAaC,IAAOC,EAAsC,SACxD,EACE,YACA,WAAQ,SACR,cACA,aACA,YACA,cACA,cAAcC,GACd,mBAAmBC,GACnB,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAMC,KAAWC,EAAS,EAAK,GAChCC,IAASX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AET,CAAC,GAaY6B,IAAWhC,EAA6C,SACnE,EAAE,SAAM,UAAO,WAAW,aAAU,gBAAa,IAAO,cAAW,aAAU,GAAGG,KAChF,GACA;CACA,OACE,kBAAC8B,GAAD;EACO;EACL,SAASC,MAAS,WAAW,WAAW;EACxC,MAAK;EACL,WAAWC;EACX,MAAK;EACO;EACZ,aAAWD,MAAS,WAAW,WAAW,KAAA;EAC1C,WAAWrC,EAAG,gBAAgBiC,CAAS;EACvC,GAAI3B;EATN,UAAA,CAWGiC,GACAC,KAAY,kBAAC,QAAD;GAAM,WAAU;GAA0B,UAAAA;EAAe,CAAA,CAChE;;AAEZ,CAAC;AAED,SAAgBC,IAAgB;CAC9B,OACE,kBAAC,OAAD;EACE,WAAU;EACV,MAAK;CACN,CAAA;AAEL;AAEA,SAAgBC,EAAU,EAAE,eAAqC;CAC/D,OAAO,kBAAC,OAAD;EAAK,WAAU;EAAiB;CAAc,CAAA;AACvD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),n=require("../../chunks/overlayLayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),n=require("../../chunks/overlayLayer-CtOTt1xB.cjs"),r=require("../../chunks/dialogLabel-CNNQbtob.cjs");let i=require("react"),a=require("react-dom"),o=require("react/jsx-runtime");var s=(0,i.forwardRef)(function({isOpen:s,isHidden:c=!1,onClose:l,title:u,description:d,size:f=`md`,hasHeader:p=!0,overlayLayer:m,footer:h,className:g,children:_,...v},y){let{layer:b,isVisible:x,isResumed:S}=n.r(s,c,m),C=(0,i.useRef)(null),w=(0,i.useRef)(null),T=(0,i.useId)(),E=(0,i.useId)(),{onScrimMouseDown:D,order:O}=r.n({isOpen:s,isActive:x,panelRef:C,onClose:l,layer:b}),k=r.r(O,s);return n.c(w,s),!s||!k?null:(0,a.createPortal)((0,o.jsx)(n.t,{layer:b,isSuspended:!x,children:(0,o.jsx)(`div`,{ref:e=>{w.current=e,e&&(e.inert=!x)},className:`ds-scrim`,hidden:!x,"data-resumed":S||void 0,"aria-hidden":!x||void 0,style:{zIndex:b},onMouseDown:D,children:(0,o.jsxs)(`div`,{...v,ref:t.t(C,y),...r.t(v,T,E,!!d,x),tabIndex:-1,"data-size":f,className:[`ds-modal`,`ds-field-surface`,g].filter(Boolean).join(` `),children:[(0,o.jsxs)(`header`,{className:`ds-modal__head`,hidden:!p,children:[(0,o.jsxs)(`div`,{className:`ds-modal__titles`,children:[(0,o.jsx)(`h2`,{id:T,className:`ds-modal__title`,children:u}),d&&(0,o.jsx)(`p`,{id:E,className:`ds-modal__description`,children:d})]}),p&&(0,o.jsx)(e.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Close`,className:`ds-modal__close`,onClick:l})]}),(0,o.jsx)(`div`,{className:`ds-modal__body`,children:_}),h&&(0,o.jsx)(`footer`,{className:`ds-modal__footer ds-field-surface`,children:h})]})})}),k)});exports.Modal=s,exports.OverlayLayer=n.n;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Button as e } from "../Button/index.js";
|
|
2
2
|
import { t } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
3
|
-
import { c as n, n as r, r as i, t as a } from "../../chunks/overlayLayer-
|
|
4
|
-
import { n as o, r as s, t as c } from "../../chunks/dialogLabel-
|
|
3
|
+
import { c as n, n as r, r as i, t as a } from "../../chunks/overlayLayer-Og07sIyl.js";
|
|
4
|
+
import { n as o, r as s, t as c } from "../../chunks/dialogLabel-C153NosD.js";
|
|
5
5
|
import { forwardRef as l, useId as u, useRef as d } from "react";
|
|
6
6
|
import { createPortal as f } from "react-dom";
|
|
7
7
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/transitionDuration-B4UnScFc.cjs"),t=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),n=require("../../chunks/overlayLayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/transitionDuration-B4UnScFc.cjs"),t=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),n=require("../../chunks/overlayLayer-CtOTt1xB.cjs"),r=require("../../chunks/useIsomorphicLayoutEffect-XM4Ot6x5.cjs");let i=require("react"),a=require("react-dom"),o=require("react/jsx-runtime");function s(...e){return e.filter(Boolean).join(` `)}var c=8;function l({anchorRef:l,anchorId:u,isOpen:d,align:f=`center`,placement:p=`bottom`,matchAnchorWidth:m=!1,offset:h=4,className:g,children:_,role:v,id:y,panelRef:b,...x}){let S=n.o(d),C=n.i(),w=n.a(),T=(0,i.useRef)(null),[E,D]=(0,i.useState)(S),[O,k]=(0,i.useState)(!1);E!==S&&(D(S),k(!S));let A=(0,i.useId)(),j=y??A,M=(0,i.useMemo)(()=>({get current(){return l.current??(u?document.getElementById(u):null)}}),[u,l]);n.l(T,S||O,()=>M.current);let N=(0,i.useCallback)(()=>{let e=l.current??(u?document.getElementById(u):null),t=T.current;if(!e||!t)return;let n=e.getBoundingClientRect();m&&(t.style.width=`${n.width}px`);let r=t.getBoundingClientRect(),i=r.height+Math.max(0,t.scrollHeight-t.clientHeight),a={width:r.width,height:i},o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,d=Math.max(0,s-16),g=Math.max(0,Math.min(d,s-n.bottom-h-c)),_=Math.max(0,Math.min(d,n.top-h-c)),v=p===`top`?_>=a.height||_>g:g<a.height&&_>g,y=v?_:g,b=Math.min(a.height,y),x=v?n.top-h-b:n.bottom+h,S=Math.max(c,Math.min(x,s-c-b)),C=f===`center`?n.left+(n.width-a.width)/2:f===`end`?n.right-a.width:n.left,w=Math.max(c,Math.min(C,o-a.width-c));t.style.left=`${Math.round(w)}px`,t.style.top=`${Math.round(S)}px`,t.style.setProperty(`--popover-max-block-size`,`${Math.round(y)}px`),t.style.visibility=`visible`},[f,u,l,m,h,p]);if(r.t(()=>{S&&N()}),(0,i.useEffect)(()=>{let t=T.current;if(!S){if(!O||!t)return;let n=e.t(t),r=window.setTimeout(()=>k(!1),n);return()=>window.clearTimeout(r)}let r=l.current??(u?document.getElementById(u):null),i=t&&r?n.h(t,r):void 0;N();let a=()=>N(),o=({target:e})=>{e instanceof Node&&t?.contains(e)||N()},s=typeof ResizeObserver>`u`?void 0:new ResizeObserver(a);r&&s?.observe(r);let c=()=>{if(t&&s){s.observe(t);for(let e of t.children)s.observe(e)}};c();let d=new MutationObserver(c);return t&&d.observe(t,{childList:!0}),window.addEventListener(`resize`,a),window.addEventListener(`scroll`,o,!0),()=>{window.removeEventListener(`resize`,a),window.removeEventListener(`scroll`,o,!0),s?.disconnect(),d.disconnect(),i?.()}},[u,l,S,O,N]),!S&&!O||typeof document>`u`)return null;let P=(0,o.jsx)(`div`,{ref:e=>{t.t(T,b)(e),e?.toggleAttribute(`inert`,!S)},hidden:C,style:{zIndex:w},id:j,role:v,className:s(`ds-popover`,g),...x,"data-state":S?`open`:`closed`,"aria-hidden":!S||void 0,onTransitionEnd:e=>{e.target===e.currentTarget&&e.propertyName===`opacity`&&!S&&k(!1)},children:(0,o.jsx)(n.s.Provider,{value:M,children:_})});return(0,a.createPortal)(P,document.body)}exports.Popover=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/transitionDuration-BIBA3V7G.js";
|
|
2
2
|
import { t } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
3
|
-
import { a as n, h as r, i, l as a, o, s } from "../../chunks/overlayLayer-
|
|
3
|
+
import { a as n, h as r, i, l as a, o, s } from "../../chunks/overlayLayer-Og07sIyl.js";
|
|
4
4
|
import { t as c } from "../../chunks/useIsomorphicLayoutEffect-Bc9hxFMc.js";
|
|
5
5
|
import { useCallback as l, useEffect as u, useId as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
6
6
|
import { createPortal as h } from "react-dom";
|
|
@@ -4,13 +4,17 @@ export type RichTextDocument = JSONContent & {
|
|
|
4
4
|
type: "doc";
|
|
5
5
|
};
|
|
6
6
|
export declare const emptyDocument: RichTextDocument;
|
|
7
|
+
export interface RichTextSchemaOptions {
|
|
8
|
+
/** Include table nodes. Defaults to true. */
|
|
9
|
+
tables?: boolean;
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* The shared schema's extensions. The editor passes its node-view variant of
|
|
9
13
|
* `storyblock`; every call returns the same configured instances, so an editor
|
|
10
14
|
* keeps the same extension identities across renders.
|
|
11
15
|
*/
|
|
12
|
-
export declare function richTextExtensions(storyblock?: typeof Storyblock): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>)[];
|
|
16
|
+
export declare function richTextExtensions(storyblock?: typeof Storyblock, { tables }?: RichTextSchemaOptions): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
|
|
13
17
|
/** ProseMirror represents an empty writing surface with one empty paragraph. */
|
|
14
18
|
export declare function normalizeDocument(document: RichTextDocument): RichTextDocument;
|
|
15
|
-
export declare function documentError(value: unknown): string | undefined;
|
|
19
|
+
export declare function documentError(value: unknown, { tables }?: RichTextSchemaOptions): string | undefined;
|
|
16
20
|
//# sourceMappingURL=document.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/document.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"document.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAO7E,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7D,eAAO,MAAM,aAAa,EAAE,gBAAoE,CAAC;AA6EjG,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,GAAE,OAAO,UAAuB,EAC1C,EAAE,MAAa,EAAE,GAAE,qBAA0B,qYAK9C;AAOD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,gBAAgB,CAE9E;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,EAAE,MAAa,EAAE,GAAE,qBAA0B,GAC5C,MAAM,GAAG,SAAS,CA6CpB"}
|
|
@@ -4,13 +4,17 @@ export type RichTextDocument = JSONContent & {
|
|
|
4
4
|
type: "doc";
|
|
5
5
|
};
|
|
6
6
|
export declare const emptyDocument: RichTextDocument;
|
|
7
|
+
export interface RichTextSchemaOptions {
|
|
8
|
+
/** Include table nodes. Defaults to true. */
|
|
9
|
+
tables?: boolean;
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* The shared schema's extensions. The editor passes its node-view variant of
|
|
9
13
|
* `storyblock`; every call returns the same configured instances, so an editor
|
|
10
14
|
* keeps the same extension identities across renders.
|
|
11
15
|
*/
|
|
12
|
-
export declare function richTextExtensions(storyblock?: typeof Storyblock): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any>)[];
|
|
16
|
+
export declare function richTextExtensions(storyblock?: typeof Storyblock, { tables }?: RichTextSchemaOptions): (import("@tiptap/core").Node<any, any> | import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-link").LinkOptions, any> | import("@tiptap/core").Node<import("@tiptap/extension-table").TableOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-table").TableKitOptions, any>)[];
|
|
13
17
|
/** ProseMirror represents an empty writing surface with one empty paragraph. */
|
|
14
18
|
export declare function normalizeDocument(document: RichTextDocument): RichTextDocument;
|
|
15
|
-
export declare function documentError(value: unknown): string | undefined;
|
|
19
|
+
export declare function documentError(value: unknown, { tables }?: RichTextSchemaOptions): string | undefined;
|
|
16
20
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/document.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAO7E,OAAO,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAE3D,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC;AAE7D,eAAO,MAAM,aAAa,EAAE,gBAAoE,CAAC;AA6EjG,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,GAAE,OAAO,UAAuB,EAC1C,EAAE,MAAa,EAAE,GAAE,qBAA0B,qYAK9C;AAOD,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,gBAAgB,CAE9E;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EACd,EAAE,MAAa,EAAE,GAAE,qBAA0B,GAC5C,MAAM,GAAG,SAAS,CA6CpB"}
|
|
@@ -3,6 +3,11 @@ import type { SeedCopy } from "../EntryPicker/use-selected-items.cjs";
|
|
|
3
3
|
import type { RichTextEmbedKind, RichTextEmbedSource } from "./embed-types.cjs";
|
|
4
4
|
/** Whether a source can offer something to embed: choices to list, or one to create. */
|
|
5
5
|
export declare function canEmbed(source: RichTextEmbedSource | undefined): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a source's insertion stages a batch: always, when it has choices to
|
|
8
|
+
* list. A source that can only create offers one item, so it stays single.
|
|
9
|
+
*/
|
|
10
|
+
export declare function canBatch(source: RichTextEmbedSource | undefined): boolean;
|
|
6
11
|
/**
|
|
7
12
|
* What a block's node view reads from its source. Callbacks are stable wrappers
|
|
8
13
|
* over the latest source and the rest are plain values, so an application that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-context.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/embed-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAE5E,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,WAE/D;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAA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SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC3E,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;IACpB,cAAc,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACxC;AAED,eAAO,MAAM,YAAY;WAChB,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;cAChD,OAAO;IACjB,mFAAmF;UAC7E,OAAO;aACJ,CAAC,IAAI,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI;IAC5D;;;OAGG;eACQ,MAAM;IACjB,qFAAqF;UAC/E,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS;IACnE,gFAAgF;gBACpE,CAAC,IAAI,EAAE,iBAAiB,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,KAAK,IAAI;EASzE,CAAC"}
|
|
@@ -3,6 +3,11 @@ import type { SeedCopy } from "../EntryPicker/use-selected-items.js";
|
|
|
3
3
|
import type { RichTextEmbedKind, RichTextEmbedSource } from "./embed-types.js";
|
|
4
4
|
/** Whether a source can offer something to embed: choices to list, or one to create. */
|
|
5
5
|
export declare function canEmbed(source: RichTextEmbedSource | undefined): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a source's insertion stages a batch: always, when it has choices to
|
|
8
|
+
* list. A source that can only create offers one item, so it stays single.
|
|
9
|
+
*/
|
|
10
|
+
export declare function canBatch(source: RichTextEmbedSource | undefined): boolean;
|
|
6
11
|
/**
|
|
7
12
|
* What a block's node view reads from its source. Callbacks are stable wrappers
|
|
8
13
|
* over the latest source and the rest are plain values, so an application that
|
|
@@ -1 +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AAQ,KAAK,IAAI;EASzE,CAAC"}
|
|
@@ -9,10 +9,12 @@ export interface RichTextEmbedTarget {
|
|
|
9
9
|
commit: (item: RichTextEmbedItem) => boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Embedding is offered when the source can list choices (`loadPage` or `items`)
|
|
13
|
+
* or create one (`onCreate`); a source with only `resolveItem` displays existing blocks.
|
|
14
|
+
* Insertion from listed choices always stages any number of items and inserts
|
|
15
|
+
* them together; replacement and creation choose one. EntryPicker's `mode` and
|
|
16
|
+
* `max` don't apply. Give a remote source `resolveItem`, so a refresh can
|
|
17
|
+
* deselect staged items no longer available.
|
|
16
18
|
*/
|
|
17
19
|
export interface RichTextEmbedSource extends Omit<EntryPickerSource, "onCreate" | "mode" | "max"> {
|
|
18
20
|
/** Static choices, searched by title and keywords, when there is no `loadPage`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-types.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/embed-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,iFAAiF;IACjF,MAAM,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;CAC9C;AAED
|
|
1
|
+
{"version":3,"file":"embed-types.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/embed-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,iFAAiF;IACjF,MAAM,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;IAC/F,mFAAmF;IACnF,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC"}
|
|
@@ -9,10 +9,12 @@ export interface RichTextEmbedTarget {
|
|
|
9
9
|
commit: (item: RichTextEmbedItem) => boolean;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* Embedding is offered when the source can list choices (`loadPage` or `items`)
|
|
13
|
+
* or create one (`onCreate`); a source with only `resolveItem` displays existing blocks.
|
|
14
|
+
* Insertion from listed choices always stages any number of items and inserts
|
|
15
|
+
* them together; replacement and creation choose one. EntryPicker's `mode` and
|
|
16
|
+
* `max` don't apply. Give a remote source `resolveItem`, so a refresh can
|
|
17
|
+
* deselect staged items no longer available.
|
|
16
18
|
*/
|
|
17
19
|
export interface RichTextEmbedSource extends Omit<EntryPickerSource, "onCreate" | "mode" | "max"> {
|
|
18
20
|
/** Static choices, searched by title and keywords, when there is no `loadPage`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed-types.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/embed-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,iFAAiF;IACjF,MAAM,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;CAC9C;AAED
|
|
1
|
+
{"version":3,"file":"embed-types.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/embed-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnE,6EAA6E;AAC7E,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,iFAAiF;IACjF,MAAM,EAAE,CAAC,IAAI,EAAE,iBAAiB,KAAK,OAAO,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,CAAC;IAC/F,mFAAmF;IACnF,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;CAClD;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAC5B,KAAK,CAAC,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`})
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/RichTextEditor-DV7NZp_k.cjs");exports.RichTextEditor=e.t;
|
|
@@ -21,6 +21,14 @@ interface RichTextEditorCommonProps extends FieldBinding {
|
|
|
21
21
|
/** Extra controls appended to the toolbar, e.g. a word count. */
|
|
22
22
|
toolbarExtra?: ReactNode;
|
|
23
23
|
embeds?: RichTextEmbedSources;
|
|
24
|
+
/**
|
|
25
|
+
* Offer Insert table and accept table nodes. Defaults to true. With false, a
|
|
26
|
+
* pasted table keeps only its text, and a JSON value with tables is unsupported
|
|
27
|
+
* content. Changing it recreates the editor from its current document,
|
|
28
|
+
* unfocused, and closes an open embed picker. An uncontrolled HTML table is
|
|
29
|
+
* restored when tables are re-enabled if the table-free editor reported no change.
|
|
30
|
+
*/
|
|
31
|
+
tables?: boolean;
|
|
24
32
|
isRequired?: boolean;
|
|
25
33
|
}
|
|
26
34
|
export type RichTextEditorProps = RichTextEditorCommonProps & ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAsB,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAsB,KAAK,2BAA2B,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,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC7F;IACE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD,CACJ,CAAC;AAocJ,eAAO,MAAM,cAAc,gHAiQ1B,CAAC"}
|
|
@@ -21,6 +21,14 @@ interface RichTextEditorCommonProps extends FieldBinding {
|
|
|
21
21
|
/** Extra controls appended to the toolbar, e.g. a word count. */
|
|
22
22
|
toolbarExtra?: ReactNode;
|
|
23
23
|
embeds?: RichTextEmbedSources;
|
|
24
|
+
/**
|
|
25
|
+
* Offer Insert table and accept table nodes. Defaults to true. With false, a
|
|
26
|
+
* pasted table keeps only its text, and a JSON value with tables is unsupported
|
|
27
|
+
* content. Changing it recreates the editor from its current document,
|
|
28
|
+
* unfocused, and closes an open embed picker. An uncontrolled HTML table is
|
|
29
|
+
* restored when tables are re-enabled if the table-free editor reported no change.
|
|
30
|
+
*/
|
|
31
|
+
tables?: boolean;
|
|
24
32
|
isRequired?: boolean;
|
|
25
33
|
}
|
|
26
34
|
export type RichTextEditorProps = RichTextEditorCommonProps & ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAoBf,OAAO,EAAsB,KAAK,2BAA2B,EAAE,MAAM,aAAa,CAAC;AACnF,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,YAAY,CAAC;AACpB,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAA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AAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GACzD,CACI;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC7F;IACE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAC;CACjD,CACJ,CAAC;AAocJ,eAAO,MAAM,cAAc,gHAiQ1B,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { t as RichTextEditor } from "../../chunks/RichTextEditor-BFblqw8m.js";
|
|
1
|
+
export { t as RichTextEditor } from "../../chunks/RichTextEditor-DPhEkDxi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyblock-view.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/storyblock-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storyblock-view.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/storyblock-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AA6QpE,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,gBAAgB,GACjB,EAAE,aAAa,+BA8Ff"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storyblock-view.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/storyblock-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storyblock-view.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/storyblock-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AA6QpE,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,MAAM,EACN,gBAAgB,GACjB,EAAE,aAAa,+BA8Ff"}
|
|
@@ -137,6 +137,50 @@
|
|
|
137
137
|
margin-block-start: var(--space-3);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
.ds-rte__content .tableWrapper {
|
|
141
|
+
display: flow-root;
|
|
142
|
+
max-inline-size: 100%;
|
|
143
|
+
contain: inline-size;
|
|
144
|
+
overflow-x: auto;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* A table rests on the canvas, as storyblocks do, a step apart from the
|
|
148
|
+
* writing surface's fill, and the 2px gaps between its cells draw the grid.
|
|
149
|
+
* The header row takes the pressed step off the canvas, beyond the surface's
|
|
150
|
+
* rest and hover fills, so it stays distinct while the editor is focused. */
|
|
151
|
+
.ds-rte__content table {
|
|
152
|
+
--field-bg: var(--color-canvas);
|
|
153
|
+
|
|
154
|
+
inline-size: 100%;
|
|
155
|
+
border-collapse: separate;
|
|
156
|
+
border-spacing: 2px;
|
|
157
|
+
table-layout: fixed;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ds-rte__content :is(th, td) {
|
|
161
|
+
padding: var(--space-2);
|
|
162
|
+
background: var(--field-bg);
|
|
163
|
+
vertical-align: top;
|
|
164
|
+
overflow-wrap: anywhere;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.ds-rte__content th {
|
|
168
|
+
background: color-mix(in srgb, var(--color-text) var(--tint-pressed), var(--field-bg));
|
|
169
|
+
font-weight: var(--font-weight-semibold);
|
|
170
|
+
text-align: start;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.ds-rte__content .selectedCell {
|
|
174
|
+
--field-paint: var(--color-primary-soft);
|
|
175
|
+
|
|
176
|
+
background: var(--color-primary-soft);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* Before and after follow the writing direction, so their arrows turn with it. */
|
|
180
|
+
.ds-rte__table-action--inline:dir(rtl) .ds-icon {
|
|
181
|
+
scale: -1 1;
|
|
182
|
+
}
|
|
183
|
+
|
|
140
184
|
.ds-rte__content h2 {
|
|
141
185
|
font-size: var(--font-size-lg);
|
|
142
186
|
font-weight: var(--font-weight-bold);
|
|
@@ -412,50 +456,4 @@
|
|
|
412
456
|
--badge-soft: var(--color-danger);
|
|
413
457
|
--badge-ink: var(--color-text-on-solid);
|
|
414
458
|
}
|
|
415
|
-
|
|
416
|
-
.ds-storyblock__popover.ds-popover {
|
|
417
|
-
inline-size: 264px;
|
|
418
|
-
padding: var(--space-3);
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/* The gap alone spaces the alignment section, the actions section, the
|
|
422
|
-
* separator and Remove, so the separator stays centred whichever actions a
|
|
423
|
-
* block offers. */
|
|
424
|
-
.ds-storyblock__popover-content {
|
|
425
|
-
display: flex;
|
|
426
|
-
flex-direction: column;
|
|
427
|
-
gap: var(--space-3);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.ds-storyblock__popover-section {
|
|
431
|
-
display: flex;
|
|
432
|
-
flex-direction: column;
|
|
433
|
-
gap: var(--space-1);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
.ds-storyblock__popover-label {
|
|
437
|
-
padding-inline: var(--space-1);
|
|
438
|
-
padding-block-end: var(--space-1);
|
|
439
|
-
color: var(--color-text-muted);
|
|
440
|
-
font-size: var(--font-size-xs);
|
|
441
|
-
font-weight: var(--font-weight-bold);
|
|
442
|
-
letter-spacing: var(--table-head-tracking);
|
|
443
|
-
text-transform: uppercase;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.ds-storyblock__alignment.ds-button-group {
|
|
447
|
-
display: grid;
|
|
448
|
-
grid-template-columns: repeat(3, minmax(max-content, 1fr));
|
|
449
|
-
width: 100%;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/* Actions keep Button's md size and variants; only their layout is a list's. */
|
|
453
|
-
.ds-storyblock__action.ds-button {
|
|
454
|
-
justify-content: start;
|
|
455
|
-
text-align: start;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
.ds-storyblock__popover-content > .ds-menu-separator {
|
|
459
|
-
margin-block: 0;
|
|
460
|
-
}
|
|
461
459
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/tables.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA6Q5C,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,+BA6EA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/tables.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AA6Q5C,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB,+BA6EA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-embeds.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/use-embeds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"use-embeds.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/use-embeds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAQ1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAEV,iBAAiB,EAEjB,oBAAoB,EAErB,MAAM,eAAe,CAAC;AAMvB;;;GAGG;AACH,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAqWrD,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,oBAAoB,YAAY,EACzC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,MAAM;;;;;;;;;wBAwKK,iBAAiB,YAAY,MAAM;qBACtC,iBAAiB,MAAM,MAAM;2BAEvB,iBAAiB,MAAM,MAAM,QAAQ,QAAQ;;IAmChE;;;OAGG;;;;EAyCN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-embeds.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/use-embeds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"use-embeds.d.ts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/use-embeds.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAgB,MAAM,eAAe,CAAC;AAQ1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAElE,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAEV,iBAAiB,EAEjB,oBAAoB,EAErB,MAAM,eAAe,CAAC;AAMvB;;;GAGG;AACH,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAqWrD,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,EAAE,oBAAoB,YAAY,EACzC,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,MAAM;;;;;;;;;wBAwKK,iBAAiB,YAAY,MAAM;qBACtC,iBAAiB,MAAM,MAAM;2BAEvB,iBAAiB,MAAM,MAAM,QAAQ,QAAQ;;IAmChE;;;OAGG;;;;EAyCN"}
|
|
@@ -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-CnnTrtNb.cjs"),t=require("../Button/index.cjs"),n=require("../../chunks/mergeRefs-CZ-SArlE.cjs"),r=require("../../chunks/isComposing-BrBcAANm.cjs");;/* empty css */const i=require("../../chunks/useLimit-CCv6sAUS.cjs"),a=require("../FieldAffix/index.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=(0,o.forwardRef)(function({size:c=`md`,isDisabled:l=!1,isBusy:u=!1,onClear:d,className:f,placeholder:p=`Search`,value:m,disabled:h,onKeyDown:g,..._},v){let y=(0,o.useRef)(null),b=(0,o.useMemo)(()=>n.t(y,v),[v]);i.n(y,{..._,value:m});let x=m!==void 0,S=x&&String(m).length>0,C=S&&d;return(0,s.jsx)(a.FieldAffix,{className:f,lead:(0,s.jsx)(e.t,{name:`search`,size:16}),isTrailInteractive:!0,trail:u||C?(0,s.jsxs)(s.Fragment,{children:[u&&(0,s.jsx)(e.t,{name:`spinner`,size:16,className:`ds-icon--spin`}),C&&(0,s.jsx)(t.Button,{variant:`simple`,size:`xs`,isIconOnly:!0,iconStart:`x`,"aria-label":`Clear search`,isDisabled:l||h,onClick:()=>{d(),y.current?.focus()}})]}):void 0,children:(0,s.jsx)(`input`,{ref:b,type:`search`,"aria-busy":u||void 0,value:m,placeholder:p,disabled:l||h,"data-size":c,className:`ds-field-skin ds-search__input`,onKeyDown:e=>{e.key===`Escape`&&d&&!r.t(e.nativeEvent)&&(S?(e.preventDefault(),d()):x||d()),g?.(e)},..._})})});exports.SearchField=c;
|
|
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-Bxvp1-td.js";
|
|
2
2
|
import { Button as t } from "../Button/index.js";
|
|
3
3
|
import { t as n } from "../../chunks/mergeRefs-C6_5pADN.js";
|
|
4
4
|
import { t as r } from "../../chunks/isComposing-8bRWyiLF.js";
|
|
@@ -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-CnnTrtNb.cjs"),t=require("../Button/index.cjs"),n=require("../../chunks/overlayLayer-CtOTt1xB.cjs");;/* empty css */const r=require("../Popover/index.cjs");let i=require("react"),a=require("react/jsx-runtime");function o(...e){return e.filter(Boolean).join(` `)}var s=(0,i.forwardRef)(function({options:s,value:c,defaultValue:l,onValueChange:u,placeholder:d=`Select an option`,size:f=`md`,isDisabled:p=!1,isInvalid:m=!1,"aria-invalid":h,required:g,menuPlacement:_=`bottom`,className:v,disabled:y,onClick:b,onKeyDown:x,...S},C){let[w,T]=(0,i.useState)(l??``),E=c??w,[D,O]=(0,i.useState)(!1),k=n.o(D),[A,j]=(0,i.useState)(0),M=(0,i.useRef)(null),N=(0,i.useRef)(null),P=(0,i.useRef)(null),F=(0,i.useId)(),I=p||y,L=k&&!I,R=s.find(e=>e.value===E),z=s.filter(e=>!e.isDisabled),B=(0,i.useCallback)(e=>{c===void 0&&T(e),u?.(e),O(!1)},[u,c]);(0,i.useEffect)(()=>{if(!L)return;let e=s.findIndex(e=>e.value===E&&!e.isDisabled);j(e<0?s.indexOf(z[0]):e);let t=e=>{let t=e.target;!M.current?.contains(t)&&!P.current?.contains(t)&&O(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[L]),(0,i.useEffect)(()=>{L&&(P.current?.querySelectorAll(`[role='option']`)[A])?.scrollIntoView({block:`nearest`})},[A,L]);let V=e=>{let t=s.map((e,t)=>({option:e,index:t})).filter(e=>!e.option.isDisabled);if(t.length===0)return;let n=t[(t.findIndex(e=>e.index===A)+e+t.length)%t.length];j(n.index)},H=e=>{switch(e.key){case`Escape`:e.preventDefault(),O(!1),N.current?.focus();break;case`Tab`:O(!1);break;case`ArrowDown`:case`ArrowUp`:e.preventDefault(),V(e.key===`ArrowDown`?1:-1);break;case`Home`:case`End`:{e.preventDefault();let t=e.key===`Home`?z[0]:z[z.length-1];t&&j(s.indexOf(t));break}case`Enter`:case` `:{e.preventDefault();let t=s[A];t&&!t.isDisabled&&B(t.value);break}}},U=e=>{I||(L?H(e):[`ArrowDown`,`ArrowUp`,`Enter`,` `].includes(e.key)&&(e.preventDefault(),O(!0)))};return(0,a.jsxs)(`div`,{className:`ds-select-root`,ref:M,children:[(0,a.jsxs)(t.Button,{ref:e=>{N.current=e,typeof C==`function`?C(e):C&&(C.current=e)},size:f,role:`combobox`,"aria-required":g||void 0,"aria-haspopup":`listbox`,"aria-expanded":L,"aria-controls":L?F:void 0,"aria-activedescendant":L&&s[A]&&!s[A].isDisabled?`${F}-option-${A}`:void 0,"aria-invalid":m||h||void 0,isDisabled:I,"data-placeholder":R?void 0:``,className:o(`ds-field-skin`,`ds-select`,v),onClick:e=>{b?.(e),e.defaultPrevented||O(e=>!e)},onKeyDown:e=>{x?.(e),e.defaultPrevented||U(e)},...S,children:[(0,a.jsx)(`span`,{className:`ds-select__value`,children:R?R.label:d}),(0,a.jsx)(e.t,{name:`chevron-down`,size:16,className:`ds-select__chevron`})]}),(0,a.jsx)(r.Popover,{anchorRef:N,isOpen:L,align:`start`,placement:_,matchAnchorWidth:!0,panelRef:P,id:F,role:`listbox`,"aria-label":S[`aria-labelledby`]?void 0:S[`aria-label`]??d,"aria-labelledby":S[`aria-labelledby`],className:`ds-surface-raised ds-field-surface ds-select__menu`,children:(0,a.jsx)(`div`,{onKeyDown:U,onPointerDown:e=>e.preventDefault(),children:s.map((n,r)=>(0,a.jsxs)(t.Button,{variant:r===A?`active`:`simple`,size:`sm`,isDisabled:n.isDisabled,tabIndex:-1,id:`${F}-option-${r}`,role:`option`,"aria-selected":n.value===E,"aria-disabled":n.isDisabled||void 0,"data-active":r===A||void 0,className:`ds-select__option`,onMouseEnter:()=>!n.isDisabled&&j(r),onClick:()=>{n.isDisabled||(B(n.value),N.current?.focus())},children:[(0,a.jsxs)(`span`,{className:`ds-select__option-body`,children:[(0,a.jsx)(`span`,{className:`ds-select__option-label`,children:n.label}),n.description&&(0,a.jsx)(`span`,{className:`ds-select__option-description`,children:n.description})]}),n.value===E&&(0,a.jsx)(e.t,{name:`check`,size:16})]},n.value))})})]})});exports.Select=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "../../chunks/Icon-
|
|
1
|
+
import { t as e } from "../../chunks/Icon-Bxvp1-td.js";
|
|
2
2
|
import { Button as t } from "../Button/index.js";
|
|
3
|
-
import { o as n } from "../../chunks/overlayLayer-
|
|
3
|
+
import { o as n } from "../../chunks/overlayLayer-Og07sIyl.js";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { Popover as r } from "../Popover/index.js";
|
|
6
6
|
import { forwardRef as i, useCallback as a, useEffect as o, useId as s, useRef as c, useState as l } from "react";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Grid/index.cjs"),t=require("../../chunks/style-nulIa2_8.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({kind:e,title:t,description:n,children:i,className:a,inputProps:o,inputRef:s}){return(0,r.jsxs)(`label`,{className:[`ds-selection-card`,`ds-field-surface`,a].filter(Boolean).join(` `),children:[(0,r.jsx)(`input`,{ref:s,type:e,"data-kind":e,className:`ds-selection-card__control ds-indicator`,...o}),(0,r.jsxs)(`span`,{className:`ds-selection-card__text`,children:[(0,r.jsx)(`span`,{className:`ds-selection-card__title`,children:t}),n&&(0,r.jsx)(`span`,{className:`ds-selection-card__description`,children:n}),i&&(0,r.jsx)(`span`,{className:`ds-selection-card__extra`,children:i})]})]})}var a=(0,n.forwardRef)(function({title:e,description:t,children:n,className:a,...o},s){return(0,r.jsx)(i,{kind:`checkbox`,title:e,description:t,className:a,inputProps:o,inputRef:s,children:n})}),o=(0,n.forwardRef)(function({title:e,description:t,children:n,className:a,...o},s){return(0,r.jsx)(i,{kind:`radio`,title:e,description:t,className:a,inputProps:o,inputRef:s,children:n})});function s({label:n,columns:i=2,gap:a=`md`,children:o,className:s,...c}){return(0,r.jsx)(t.t,{...c,label:n,className:[`ds-selection-card-group`,s].filter(Boolean).join(` `),children:(0,r.jsx)(e.Grid,{columns:i,gap:a,className:`ds-selection-card-group__grid ds-field-group-grid`,style:{"--field-group-columns":i},children:o})})}exports.CheckboxCard=a,exports.RadioCard=o,exports.SelectionCardGroup=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","FieldGroup","Grid","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","FieldGroup","Grid","require_components_Grid_index","require_style","react","react_jsx_runtime","CardBody","className","inputRef","kind","inputProps","title","description","children","CheckboxCard","rest","ref","RadioCard","SelectionCardGroup","fieldProps","columns"],"sources":["../../../src/components/SelectionCard/index.tsx"],"sourcesContent":["import { forwardRef, type CSSProperties, type InputHTMLAttributes, type ReactNode } from \"react\";\nimport { FieldGroup, type FieldGroupProps } from \"../Field/group\";\nimport { Grid, type GapSize } from \"../Grid\";\nimport \"../Choice/style.css\";\nimport \"./style.css\";\n\ninterface SelectionCardBase {\n /** The commitment, in the user's words. */\n title: ReactNode;\n /** One line on what picking this means. Takes nodes, so a chip or a link can sit inline. */\n description?: ReactNode;\n /** Extra content under the description — a price, a sample, a badge. */\n children?: ReactNode;\n}\n\ntype NativeInput = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\" | \"size\" | \"children\" | \"title\"\n>;\n\nfunction CardBody({\n kind,\n title,\n description,\n children,\n className,\n inputProps,\n inputRef,\n}: SelectionCardBase & {\n kind: \"checkbox\" | \"radio\";\n className?: string;\n inputProps: NativeInput;\n inputRef: React.Ref<HTMLInputElement>;\n}) {\n return (\n <label\n className={[\"ds-selection-card\", \"ds-field-surface\", className].filter(Boolean).join(\" \")}\n >\n <input\n ref={inputRef}\n type={kind}\n data-kind={kind}\n className=\"ds-selection-card__control ds-indicator\"\n {...inputProps}\n />\n <span className=\"ds-selection-card__text\">\n <span className=\"ds-selection-card__title\">{title}</span>\n {description && <span className=\"ds-selection-card__description\">{description}</span>}\n {children && <span className=\"ds-selection-card__extra\">{children}</span>}\n </span>\n </label>\n );\n}\n\nexport interface CheckboxCardProps extends SelectionCardBase, NativeInput {}\n\n/**\n * A checkbox with room to explain itself. Same 20px box as the bare control —\n * the card is a bigger target, not a different decision.\n */\nexport const CheckboxCard = forwardRef<HTMLInputElement, CheckboxCardProps>(function CheckboxCard(\n { title, description, children, className, ...rest },\n ref,\n) {\n return (\n <CardBody\n kind=\"checkbox\"\n title={title}\n description={description}\n className={className}\n inputProps={rest}\n inputRef={ref}\n >\n {children}\n </CardBody>\n );\n});\n\nexport interface RadioCardProps extends SelectionCardBase, NativeInput {}\n\n/** One of a set of mutually exclusive options, each with its own explanation. */\nexport const RadioCard = forwardRef<HTMLInputElement, RadioCardProps>(function RadioCard(\n { title, description, children, className, ...rest },\n ref,\n) {\n return (\n <CardBody\n kind=\"radio\"\n title={title}\n description={description}\n className={className}\n inputProps={rest}\n inputRef={ref}\n >\n {children}\n </CardBody>\n );\n});\n\nexport interface SelectionCardGroupProps extends FieldGroupProps {\n /** Group label — the question the cards answer. */\n label: string;\n /** Cards per row at full width. Steps down inside a narrow container. */\n columns?: 1 | 2 | 3;\n /** Space between cards in both axes, using Grid's spacing scale. Defaults to `md`. */\n gap?: GapSize;\n children: ReactNode;\n}\n\n/** A grid of selection cards under one legend, spaced by the shared Grid. */\nexport function SelectionCardGroup({\n label,\n columns = 2,\n gap = \"md\",\n children,\n className,\n ...fieldProps\n}: SelectionCardGroupProps) {\n return (\n <FieldGroup\n {...fieldProps}\n label={label}\n className={[\"ds-selection-card-group\", className].filter(Boolean).join(\" \")}\n >\n <Grid\n columns={columns}\n gap={gap}\n className=\"ds-selection-card-group__grid ds-field-group-grid\"\n style={{ \"--field-group-columns\": columns } as CSSProperties}\n >\n {children}\n </Grid>\n </FieldGroup>\n );\n}\n"],"mappings":"A,2MAoBA,SAASO,EAAS,CAChB,OACA,QACA,cACA,WACA,YACA,aACA,YAMC,CACD,OACE,EAAAD,EAAA,KAAA,CAAC,QAAD,CACE,UAAW,CAAC,oBAAqB,mBAAoBE,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAD1F,SAAA,EAGE,EAAAF,EAAA,IAAA,CAAC,QAAD,CACE,IAAKG,EACL,KAAMC,EACN,YAAWA,EACX,UAAU,0CACV,GAAIC,CACL,CAAA,GACD,EAAAL,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,0BAAhB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA4B,SAAAM,CAAY,CAAA,EACvDC,IAAe,EAAAP,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,iCAAkC,SAAAO,CAAkB,CAAA,EACnFC,IAAY,EAAAR,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,2BAA4B,UAAe,CAAA,CACpE,CACD,CAAA,CAAA,C,EAEX,CAQA,I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