@allxsmith/bestax-bulma 5.66.2 → 5.67.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.
Files changed (73) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Command.js.map +1 -1
  4. package/dist/esm/components/HoverCard.js.map +1 -1
  5. package/dist/esm/components/Loading.js +3 -3
  6. package/dist/esm/components/Loading.js.map +1 -1
  7. package/dist/esm/components/Modal.js.map +1 -1
  8. package/dist/esm/components/Popover.js.map +1 -1
  9. package/dist/esm/components/Sidebar.js +21 -29
  10. package/dist/esm/components/Sidebar.js.map +1 -1
  11. package/dist/esm/components/Toast.js +6 -8
  12. package/dist/esm/components/Toast.js.map +1 -1
  13. package/dist/esm/elements/IconButton.js.map +1 -1
  14. package/dist/esm/form/Combobox.js.map +1 -1
  15. package/dist/esm/form/DateInputBase.js.map +1 -1
  16. package/dist/esm/form/DateRangeInputBase.js.map +1 -1
  17. package/dist/esm/form/DateTimeInputBase.js.map +1 -1
  18. package/dist/esm/form/TreeSelect.js.map +1 -1
  19. package/dist/esm/form/_pickerInternals/Calendar.js +12 -5
  20. package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
  21. package/dist/esm/form/_pickerInternals/PickerPopover.js +6 -2
  22. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  23. package/dist/esm/helpers/scrollLock.js +47 -11
  24. package/dist/esm/helpers/scrollLock.js.map +1 -1
  25. package/dist/esm/helpers/useAnchoredPosition.js +35 -11
  26. package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
  27. package/dist/esm/layout/Level.js +2 -2
  28. package/dist/esm/layout/Level.js.map +1 -1
  29. package/dist/extras.css +1 -1
  30. package/dist/extras.css.map +1 -1
  31. package/dist/index.cjs +128 -65
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/types/components/Command.d.ts +5 -5
  34. package/dist/types/components/HoverCard.d.ts +2 -4
  35. package/dist/types/components/Modal.d.ts +6 -3
  36. package/dist/types/components/Popover.d.ts +1 -3
  37. package/dist/types/components/Sidebar.d.ts +6 -2
  38. package/dist/types/components/Toast.d.ts +3 -1
  39. package/dist/types/elements/IconButton.d.ts +2 -5
  40. package/dist/types/form/Combobox.d.ts +13 -13
  41. package/dist/types/form/DateInputBase.d.ts +8 -1
  42. package/dist/types/form/DateRangeInputBase.d.ts +5 -0
  43. package/dist/types/form/DateTimeInputBase.d.ts +8 -1
  44. package/dist/types/form/TreeSelect.d.ts +4 -4
  45. package/dist/types/helpers/scrollLock.d.ts +4 -4
  46. package/dist/types/helpers/useAnchoredPosition.d.ts +14 -12
  47. package/dist/types/layout/Level.d.ts +10 -0
  48. package/dist/types-cjs/components/Command.d.ts +5 -5
  49. package/dist/types-cjs/components/HoverCard.d.ts +2 -4
  50. package/dist/types-cjs/components/Modal.d.ts +6 -3
  51. package/dist/types-cjs/components/Popover.d.ts +1 -3
  52. package/dist/types-cjs/components/Sidebar.d.ts +6 -2
  53. package/dist/types-cjs/components/Toast.d.ts +3 -1
  54. package/dist/types-cjs/elements/IconButton.d.ts +2 -5
  55. package/dist/types-cjs/form/Combobox.d.ts +13 -13
  56. package/dist/types-cjs/form/DateInputBase.d.ts +8 -1
  57. package/dist/types-cjs/form/DateRangeInputBase.d.ts +5 -0
  58. package/dist/types-cjs/form/DateTimeInputBase.d.ts +8 -1
  59. package/dist/types-cjs/form/TreeSelect.d.ts +4 -4
  60. package/dist/types-cjs/helpers/scrollLock.d.ts +4 -4
  61. package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +14 -12
  62. package/dist/types-cjs/layout/Level.d.ts +10 -0
  63. package/dist/versions/bestax-no-dark-mode.css +1 -1
  64. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  65. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  66. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  67. package/dist/versions/bestax-no-helpers.css +1 -1
  68. package/dist/versions/bestax-no-helpers.css.map +1 -1
  69. package/dist/versions/bestax-prefixed.css +1 -1
  70. package/dist/versions/bestax-prefixed.css.map +1 -1
  71. package/package.json +1 -1
  72. package/src/scss/components/_loading.scss +17 -3
  73. package/src/scss/form/_radio.scss +5 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Command.js","sources":["../../../src/components/Command.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher, type TextMatcher } from '../helpers/localeFormat';\nimport { isModalOverlayOpen } from '../helpers/overlayStack';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport { Input, InputProps } from '../form/Input';\nimport { Modal } from './Modal';\n\n/** What names a Command that's given no `label`. */\nconst defaultLabel = 'Commands';\n\n/** What a Command given `actions` shows when nothing matches, unless it's given `empty`. */\nconst defaultEmpty = 'No results';\n\n// What the status region announces: the `Command.Empty` content, as the one\n// item it's handed while that content is on screen because of the user's\n// typing.\nconst typedNoMatches = [{ id: 'empty' }];\nconst nothingToAnnounce: Array<{ id: string }> = [];\n\n/** Whether a slot was given something to show. */\nconst isShown = (node: React.ReactNode): boolean =>\n node !== undefined && node !== null && node !== false && node !== '';\n\n/** One action in a Command's `actions`. */\nexport interface CommandAction {\n /** Unique within the Command. It's the item's `value`, so `onSelect` hands it back. */\n id: string;\n /** What the item shows, and what typing matches first. */\n label: string;\n /**\n * A line under the label, such as what the action does or where it goes.\n * Typing matches it too, after the labels. A screen reader hears it after\n * the label, as the item's description.\n */\n description?: string;\n /**\n * More words typing matches, after the labels, such as `['theme']` for\n * \"Dark mode\". They aren't shown.\n */\n keywords?: string[];\n /**\n * The heading the action goes under. Groups show in the order the matches\n * first name them, so the best match is always on top, and the actions with\n * no group show together where the first of them is.\n */\n group?: string;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * Shown at the end of the row, such as the action's own keyboard shortcut in\n * a `Kbd.Group`, or a `Tag`. It only shows: nothing listens for a shortcut\n * written here. A screen reader hears it after the label, with the\n * description.\n */\n hint?: React.ReactNode;\n /** Shown, and reached with the arrows so a screen reader user finds it, but never run. */\n disabled?: boolean;\n /** Runs the action, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n}\n\n/** What a Command takes whether it's given `actions` or built from parts. */\ninterface CommandBaseProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onSelect'>,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * What the Command is for, such as \"Commands\" or \"Settings\". It's never\n * shown: it names the search field and the list for assistive tech, and in\n * `Command.Dialog` the dialog too. An empty string counts as none.\n * @defaultValue 'Commands'\n */\n label?: string;\n /**\n * The search, controlled: the text in the field. Pair it with\n * `onQueryChange`.\n */\n query?: string;\n /**\n * The search to start with when uncontrolled.\n * @defaultValue ''\n */\n defaultQuery?: string;\n /**\n * Called with the search as the user types it. Built from parts, this is\n * where the app filters its items.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Called with the picked item's `value`, an action's `id`, when it's run\n * with Enter or a click, after the item's own `onSelect`. A disabled item\n * is never run.\n */\n onSelect?: (value: string) => void;\n}\n\n/** Props for a Command given `actions`. */\nexport interface CommandActionsProps extends CommandBaseProps {\n /**\n * The actions, for a Command that renders the field, the list, the groups\n * and the empty message itself. Typing filters them by label, keywords and\n * description, ignoring case, with label matches first. Inside a\n * `LocaleProvider` with a `locale`, it ignores accents too where that\n * language does, so \"cafe\" finds \"Café\". Leave it out to build the\n * Command from parts.\n */\n actions: CommandAction[];\n /**\n * Takes over the filtering, with `actions`: it's handed the search as typed\n * and every action, and returns the ones to show, in the order to show\n * them, which is how to plug in fuzzy matching or cut the list short. It's\n * called with an empty search too.\n */\n filter?: (query: string, actions: CommandAction[]) => CommandAction[];\n /** The field's placeholder, with `actions`. */\n placeholder?: string;\n /**\n * What shows in place of the list, with `actions`, when nothing matches.\n * It's announced the way `Command.Empty` is. `null` shows nothing.\n * @defaultValue 'No results'\n */\n empty?: React.ReactNode;\n /** @internal With `actions`, the Command renders its own parts. */\n children?: never;\n}\n\n/** Props for a Command built from parts. */\nexport interface CommandPartsProps extends CommandBaseProps {\n /**\n * The parts, in order: `Command.Input`, then `Command.List` while there are\n * items and `Command.Empty` while there aren't. Nothing filters them, so\n * render the items that match the search `onQueryChange` reports. With\n * `actions` there are none to give: children given with it are ignored,\n * with a warning in development.\n */\n children?: React.ReactNode;\n /** @internal Built from parts, the app renders the items. */\n actions?: never;\n /** @internal Built from parts, the app filters. */\n filter?: never;\n /** @internal Built from parts, `Command.Input` takes the placeholder. */\n placeholder?: never;\n /** @internal Built from parts, `Command.Empty` is the empty message. */\n empty?: never;\n}\n\n/**\n * Props for the Command component: given `actions`, it renders, filters and\n * groups them itself, and without them it's built from parts. The helper\n * props, the other attributes and the `ref` land on the `div.command` around\n * the field and the list.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` around the field and the list.\n */\nexport type CommandProps = CommandActionsProps | CommandPartsProps;\n\n/** What Command.Dialog takes on top of a Command's props. */\ninterface CommandDialogOwnProps {\n /** Controlled open state. When set, opening and closing only report through `onOpenChange`. */\n open?: boolean;\n /**\n * Initial open state when uncontrolled.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the open state asked for: `true` from the `shortcut`, and\n * `false` from Escape, a click on the background, or a pick while\n * `closeOnSelect` is on. Fires in controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * A key combination that opens the dialog from anywhere on the page, such\n * as `\"mod+k\"`: modifiers and a key joined by `+`, where `mod` is Ctrl or\n * ⌘ (either one, on every platform), and the others are `ctrl`, `meta`,\n * `alt` and `shift`. It's ignored while the user is typing in a text field,\n * a select or editable content, while an IME is composing, while a modal\n * overlay is open (a `Modal`, a `Dialog`, a `Sidebar` with its overlay or a\n * full-page `Loading`), and when something else has already used the key.\n * It only opens the dialog. Off unless given.\n */\n shortcut?: string;\n /**\n * Closes the dialog once an item has run. Turn it off for an item that\n * opens another page of the palette, and close it yourself with `open`.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /**\n * Clears the search when the dialog closes: an uncontrolled one itself,\n * and a controlled one through `onQueryChange('')`.\n * @defaultValue true\n */\n clearOnClose?: boolean;\n /**\n * Renders the dialog into a portal target instead of inline. Forwarded to\n * the underlying `Modal`; see its `portal` prop for the accepted values.\n * @defaultValue false\n */\n portal?: boolean | string | HTMLElement;\n}\n\n/** Props for a Command.Dialog given `actions`. */\nexport interface CommandDialogActionsProps\n extends CommandActionsProps, CommandDialogOwnProps {}\n\n/** Props for a Command.Dialog built from parts. */\nexport interface CommandDialogPartsProps\n extends CommandPartsProps, CommandDialogOwnProps {}\n\n/**\n * Props for Command.Dialog, the Command in a modal: a Command's props, given\n * `actions` or built from parts, and the dialog's own. The helper props, the\n * other attributes and the `ref` land on the `div.command` that is the\n * dialog.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` that is the dialog.\n */\nexport type CommandDialogProps =\n CommandDialogActionsProps | CommandDialogPartsProps;\n\n/**\n * Props for Command.Input, the search field. It renders `Input`, so its\n * icons, `isLoading` and `color` work as they do there. Its text is the\n * Command's `query`, and it's `autoComplete=\"off\"`, so the browser's own\n * suggestions don't open over the list: neither is yours to set.\n */\nexport type CommandInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Command sets on the field itself:\n | 'role'\n | 'autoComplete'\n | 'value'\n | 'defaultValue'\n>;\n\n/**\n * Props for Command.List, the list. Its `id` is the one the field's\n * `aria-controls` names, so it isn't yours to set.\n */\nexport interface CommandListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Command.Item`s and `Command.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Group, items under a heading. */\nexport interface CommandGroupProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role'\n> {\n /**\n * The heading, which also names the group for assistive tech, unless you\n * give the group an `aria-label` or `aria-labelledby` of its own.\n */\n label: React.ReactNode;\n /** The group's `Command.Item`s. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Command.Item, one thing to do in the list. Its `id` follows from\n * its `value`, since the field's `aria-activedescendant` names it, so it\n * isn't yours to set.\n */\nexport interface CommandItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What the Command's `onSelect` hands back. Unique within the Command. */\n value: string;\n /**\n * Can't be run. The arrows still reach it, so a screen reader user finds\n * it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /** Runs the item, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * A line under the label. A screen reader hears it after the label, as the\n * item's description.\n */\n description?: React.ReactNode;\n /**\n * Shown at the end of the row, such as a keyboard shortcut in a\n * `Kbd.Group`, or a `Tag`. It only shows. A screen reader hears it after\n * the label, with the description.\n */\n hint?: React.ReactNode;\n /** The label, which names the item. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Empty, the message shown in place of the list. */\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No commands match\". Its text is announced when\n * typing brings it on screen and isn't read again while it stays, so a\n * message that names the search is heard for the first search only.\n */\n children?: React.ReactNode;\n}\n\n/** A handler an item registers, read when it's run. */\ntype ItemHandler = { readonly current: (() => void) | undefined };\n\n/** What the Command hands its parts. */\ninterface CommandContextValue {\n engine: ComboboxEngine;\n /** What names the field and the list. */\n label: string;\n /** The search. */\n query: string;\n /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /** Tells the Command the field's `isLoading`, which holds the empty message's announcement. */\n reportLoading: (loading: boolean) => void;\n /** Records the empty message while it's on screen. Returns the function that forgets it. */\n reportEmpty: (element: HTMLElement) => () => void;\n /** Records an item's `onSelect`. Returns the function that forgets it. */\n registerHandler: (value: string, handler: ItemHandler) => () => void;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Command reads: nothing to report to, so it\n// renders its markup and does nothing.\nconst standalone: CommandContextValue = {\n engine: {\n open: false,\n expanded: false,\n highlighted: null,\n typed: false,\n listboxId: '',\n itemId: () => '',\n rootRef: { current: null },\n inputRef: { current: null },\n listboxRef: { current: null },\n registerPopup: registerNothing,\n registerItem: registerNothing,\n onKeyDown: noop,\n onChange: noop,\n onClick: noop,\n onBlur: noop,\n hover: noop,\n pick: noop,\n keepFocus: noop,\n markInside: noop,\n },\n label: defaultLabel,\n query: '',\n onFieldChange: noop,\n reportLoading: noop,\n reportEmpty: registerNothing,\n registerHandler: registerNothing,\n};\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\n\nconst useCommand = () => useContext(CommandContext) ?? standalone;\n\n/** Hands a node to a forwarded ref and to one of the component's own. */\nfunction setRefs<T>(\n node: T | null,\n own: React.MutableRefObject<T | null>,\n forwarded: React.ForwardedRef<T>\n) {\n own.current = node;\n if (typeof forwarded === 'function') forwarded(node);\n else if (forwarded) forwarded.current = node;\n}\n\n/**\n * The default filter: the actions whose label, keywords or description hold\n * the search, ignoring case and the spaces around it, label matches first and\n * the order otherwise kept. An empty search keeps them all. `matchText`, a\n * `LocaleProvider`'s locale-aware matcher, replaces the lowercased\n * comparison when there is one.\n */\nconst filterActions = (\n query: string,\n actions: CommandAction[],\n matchText?: TextMatcher | null\n): CommandAction[] => {\n const search = query.trim();\n if (search === '') return actions;\n const term = search.toLowerCase();\n const holds = matchText\n ? (text: string) => matchText(text, search)\n : (text: string) => text.toLowerCase().includes(term);\n const byLabel: CommandAction[] = [];\n const byOther: CommandAction[] = [];\n for (const action of actions) {\n if (holds(action.label)) {\n byLabel.push(action);\n } else if (\n (action.description !== undefined && holds(action.description)) ||\n action.keywords?.some(holds)\n ) {\n byOther.push(action);\n }\n }\n return [...byLabel, ...byOther];\n};\n\n/** The search icon at the start of the field. */\nconst SearchIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n width=\"1em\"\n height=\"1em\"\n focusable=\"false\"\n >\n <circle cx=\"7\" cy=\"7\" r=\"4.75\" />\n <path d=\"M10.5 10.5L14 14\" />\n </svg>\n);\n\n/**\n * The Command built from parts: the field, the list, the keys and the run,\n * with the items and their filtering left to the app.\n */\nconst CommandParts = forwardRef<HTMLDivElement, CommandPartsProps>(\n (\n {\n children,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n ...props\n },\n ref\n ) => {\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n\n // Each item's `onSelect`, by value, read when it runs.\n const handlersRef = useRef(new Map<string, ItemHandler>());\n const registerHandler = useCallback(\n (value: string, handler: ItemHandler) => {\n const handlers = handlersRef.current;\n handlers.set(value, handler);\n return () => {\n if (handlers.get(value) === handler) handlers.delete(value);\n };\n },\n []\n );\n const run = (value: string) => {\n handlersRef.current.get(value)?.current?.();\n onSelect?.(value);\n };\n\n // Inline: the list is always on screen, nothing opens or closes it, and\n // Escape goes on to what's around it. `keepFirst` keeps the highlight on\n // the top match, so Enter runs it.\n const engine = useComboboxEngine({\n defaultOpen: true,\n onSelect: run,\n keepFirst: true,\n multiple: false,\n inline: true,\n deferred: false,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootClass = usePrefixedClassNames('command');\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Command.Empty` when the\n // user's typing leaves it on screen: once each time that happens, not\n // again on each keystroke while it stays. An empty search isn't a search,\n // so it stays quiet then, and while the field's `isLoading` says results\n // are on their way, it waits.\n const [inputLoading, setInputLoading] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && query !== '' && emptyShown && !inputLoading\n ? typedNoMatches\n : nothingToAnnounce;\n // The region reads the text on screen, whatever the message renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n const reportEmpty = useCallback((element: HTMLElement) => {\n emptyRef.current = element;\n setEmptyShown(true);\n return () => {\n emptyRef.current = null;\n setEmptyShown(false);\n };\n }, []);\n\n const onFieldChange = (value: string) => {\n if (controlledQuery === undefined) setOwnQuery(value);\n onQueryChange?.(value);\n engine.onChange();\n };\n\n // A new value each render: the engine's state and handlers are, and the\n // parts read the highlight from it.\n const context: CommandContextValue = {\n engine,\n label: label || defaultLabel,\n query,\n onFieldChange,\n reportLoading: setInputLoading,\n reportEmpty,\n registerHandler,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n return (\n // The ref after the spread, so the element stays the Command's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <CommandContext.Provider value={context}>\n {children}\n </CommandContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n }\n);\nCommandParts.displayName = 'CommandParts';\n\n/**\n * The search field, with the combobox role and the keys, rendered as an `Input` with a search icon.\n *\n * @function\n * @param {CommandInputProps} props - Props for the Command.Input component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.\n * @returns {JSX.Element} The field in its Control.\n */\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(\n (\n {\n isLoading,\n iconLeft,\n iconLeftName,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCommand();\n const { engine, reportLoading } = context;\n useClientLayoutEffect(() => {\n reportLoading(!!isLoading);\n return () => reportLoading(false);\n }, [reportLoading, isLoading]);\n const { inputRef } = engine;\n const inputRefs = useCallback(\n (node: HTMLInputElement | null) => setRefs(node, inputRef, ref),\n [inputRef, ref]\n );\n const { expanded, highlighted } = engine;\n // A name the caller gave the field wins over the Command's `label`.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n // The attributes the Command owns after the caller's, so a stray\n // `aria-expanded` never wins. A search isn't prose, so the browser's\n // spelling and autocorrect stay out of it unless the caller asks.\n <Input\n autoCorrect=\"off\"\n spellCheck={false}\n {...props}\n ref={inputRefs}\n value={context.query}\n iconLeft={\n iconLeft === undefined && !iconLeftName ? <SearchIcon /> : iconLeft\n }\n iconLeftName={iconLeftName}\n isLoading={isLoading}\n aria-label={callerNamed ? props['aria-label'] : context.label}\n role=\"combobox\"\n aria-autocomplete={ariaAutocomplete ?? 'list'}\n aria-haspopup=\"listbox\"\n aria-expanded={expanded}\n aria-controls={expanded ? engine.listboxId : undefined}\n aria-activedescendant={\n expanded && highlighted !== null\n ? engine.itemId(highlighted)\n : undefined\n }\n autoComplete=\"off\"\n onKeyDown={event => {\n onKeyDown?.(event);\n engine.onKeyDown(event);\n }}\n onChange={event => {\n onChange?.(event);\n context.onFieldChange(event.target.value);\n }}\n onClick={event => {\n onClick?.(event);\n if (!event.defaultPrevented) engine.onClick();\n }}\n onBlur={event => {\n onBlur?.(event);\n engine.onBlur(event);\n }}\n />\n );\n }\n);\nCommandInput.displayName = 'CommandInput';\n\n/**\n * The list of items, a `listbox` named by the Command's `label`.\n *\n * @function\n * @param {CommandListProps} props - Props for the Command.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const CommandList: React.FC<CommandListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, label } = useCommand();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('command-list');\n // A name the caller gave the list wins over the Command's.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(listClass, className)}\n {...props}\n ref={listboxRef}\n id={listboxId || undefined}\n role=\"listbox\"\n aria-label={callerNamed ? props['aria-label'] : label}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandList.displayName = 'CommandList';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {CommandGroupProps} props - Props for the Command.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const CommandGroup: React.FC<CommandGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('command-group');\n const labelClass = usePrefixedClassNames('command-group-label');\n // A name the caller gave the group wins over its heading's, as on the list.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(groupClass, className)}\n {...props}\n role=\"group\"\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n >\n <div className={labelClass} id={labelId}>\n {label}\n </div>\n {children}\n </div>\n );\n};\nCommandGroup.displayName = 'CommandGroup';\n\n/**\n * One thing to do in the list, named by its label and described by its description and hint.\n *\n * @function\n * @param {CommandItemProps} props - Props for the Command.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const CommandItem: React.FC<CommandItemProps> = ({\n value,\n disabled = false,\n onSelect,\n icon,\n description,\n hint,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, registerHandler } = useCommand();\n const itemRef = useRef<HTMLDivElement>(null);\n const { registerItem } = engine;\n useClientLayoutEffect(\n () =>\n registerItem(itemRef.current as HTMLDivElement, {\n value,\n disabled,\n checked: false,\n }),\n [registerItem, value, disabled]\n );\n const onSelectRef = useLatestRef(onSelect);\n useClientLayoutEffect(\n () => registerHandler(value, onSelectRef),\n [registerHandler, value, onSelectRef]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('command-item', {\n 'is-active': highlighted,\n 'is-disabled': disabled,\n });\n const iconClass = usePrefixedClassNames('command-item-icon');\n const bodyClass = usePrefixedClassNames('command-item-body');\n const labelClass = usePrefixedClassNames('command-item-label');\n const descriptionClass = usePrefixedClassNames('command-item-description');\n const hintClass = usePrefixedClassNames('command-item-hint');\n\n // Named by its label alone, so a screen reader says what it does before\n // the rest, and described by the description and the hint.\n const baseId = useId();\n const labelId = `${baseId}label`;\n const descriptionId = isShown(description)\n ? `${baseId}description`\n : undefined;\n const hintId = isShown(hint) ? `${baseId}hint` : undefined;\n const describedBy =\n [descriptionId, hintId].filter(Boolean).join(' ') || undefined;\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n <div\n className={classNames(itemClass, className)}\n aria-describedby={describedBy}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n // The highlighted option, as the ARIA Authoring Practices' combobox\n // has it, and no attribute on the rest. Never a disabled option.\n aria-selected={disabled ? undefined : highlighted || undefined}\n aria-disabled={disabled || undefined}\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n onClick={event => {\n onClick?.(event);\n if (!disabled && !event.defaultPrevented) engine.pick(value);\n }}\n onPointerMove={event => {\n onPointerMove?.(event);\n if (!disabled && !highlighted) engine.hover(value);\n }}\n >\n {isShown(icon) && (\n <span className={iconClass} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className={bodyClass}>\n <span className={labelClass} id={labelId}>\n {children}\n </span>\n {descriptionId && (\n <span className={descriptionClass} id={descriptionId}>\n {description}\n </span>\n )}\n </span>\n {hintId && (\n <span className={hintClass} id={hintId}>\n {hint}\n </span>\n )}\n </div>\n );\n};\nCommandItem.displayName = 'CommandItem';\n\n/**\n * The message shown in place of the list when nothing matches, announced when typing brings it on screen.\n *\n * @function\n * @param {CommandEmptyProps} props - Props for the Command.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const CommandEmpty: React.FC<CommandEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCommand();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('command-empty');\n return (\n <div\n className={classNames(emptyClass, className)}\n {...props}\n ref={emptyRef}\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandEmpty.displayName = 'CommandEmpty';\n\n/** What a Command given `actions` renders inside its parts root. */\ninterface CommandActionsContentProps {\n actions: CommandAction[];\n filter: CommandActionsProps['filter'];\n placeholder: string | undefined;\n empty: React.ReactNode;\n}\n\n/**\n * The field, and the actions that match the search, grouped, or the empty\n * message. The search is the parts root's, read from its context.\n */\nconst CommandActionsContent = ({\n actions,\n filter,\n placeholder,\n empty,\n}: CommandActionsContentProps) => {\n const { query } = useCommand();\n const matchText = useLocaleMatcher();\n const shown = filter\n ? filter(query, actions)\n : filterActions(query, actions, matchText);\n\n // Each group where the matches first name it, and the actions with none\n // together where the first of them is, so the best match stays on top.\n const sections = new Map<string, CommandAction[]>();\n for (const action of shown) {\n const group = action.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), action]);\n }\n const renderItem = (action: CommandAction) => (\n <CommandItem\n key={action.id}\n value={action.id}\n disabled={action.disabled}\n icon={action.icon}\n description={action.description}\n hint={action.hint}\n onSelect={action.onSelect}\n >\n {action.label}\n </CommandItem>\n );\n\n return (\n <>\n <CommandInput placeholder={placeholder} />\n {shown.length > 0 ? (\n <CommandList>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <CommandGroup key={group} label={group}>\n {members.map(renderItem)}\n </CommandGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </CommandList>\n ) : isShown(empty) ? (\n <CommandEmpty>{empty}</CommandEmpty>\n ) : null}\n </>\n );\n};\n\n/**\n * The Command given `actions`. It renders the parts itself and filters the\n * actions as the user types, so a run goes through the same parts, keys and\n * ARIA as one built by hand.\n */\nconst CommandFromActions = forwardRef<HTMLDivElement, CommandActionsProps>(\n (\n { actions, filter, placeholder, empty = defaultEmpty, children, ...rest },\n ref\n ) => {\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Command:actions-children',\n '[bestax-bulma] <Command actions> renders its own field and items, ' +\n 'so its children are ignored. Give it actions or build it from ' +\n 'parts, not both.'\n );\n }\n return (\n <CommandParts {...rest} ref={ref}>\n <CommandActionsContent\n actions={actions}\n filter={filter}\n placeholder={placeholder}\n empty={empty}\n />\n </CommandParts>\n );\n }\n);\nCommandFromActions.displayName = 'CommandFromActions';\n\n/**\n * The `Command` component is a search field over a list of things to do, which narrows as you type and runs the top match on Enter: inline by default, and a command palette in a modal as `Command.Dialog`.\n *\n * Given `actions`, it's one element. It renders the field, the list, the\n * groups and the empty message, and filters the actions by label, keywords\n * and description as the user types, with label matches first. `filter`\n * takes over the matching, for fuzzy search.\n *\n * Built from parts, the app owns the items: what's in the list and how it's\n * filtered, from the search `onQueryChange` reports. Nothing filters them,\n * so a server's answer shows as it came.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. The first enabled item is highlighted whenever\n * the items change, so Enter runs the top match. Running an item calls its\n * own `onSelect`, then the Command's.\n *\n * When typing leaves the empty message on screen, its text is announced\n * through a polite status region, once, after any loading ends. Result\n * counts aren't announced: a screen reader reads the list's size from the\n * markup, and a count on every keystroke talks over the typing.\n *\n * @function\n * @param {CommandProps} props - Props for the Command component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command`.\n * @returns {JSX.Element} The field and its list.\n *\n * @example\n * <Command\n * label=\"Settings\"\n * placeholder=\"Search settings\"\n * actions={[\n * { id: 'profile', label: 'Edit profile', onSelect: openProfile },\n * { id: 'theme', label: 'Dark mode', keywords: ['theme'], onSelect: toggleTheme },\n * ]}\n * />\n *\n * @example\n * <Command label=\"People\" onQueryChange={setQuery} onSelect={openProfile}>\n * <Command.Input placeholder=\"Find a person\" />\n * {matches.length > 0 ? (\n * <Command.List>\n * {matches.map(person => (\n * <Command.Item key={person.id} value={person.id}>\n * {person.name}\n * </Command.Item>\n * ))}\n * </Command.List>\n * ) : (\n * <Command.Empty>No one matches</Command.Empty>\n * )}\n * </Command>\n */\nconst CommandRoot = forwardRef<HTMLDivElement, CommandProps>((props, ref) =>\n props.actions === undefined ? (\n <CommandParts {...props} ref={ref} />\n ) : (\n <CommandFromActions {...props} ref={ref} />\n )\n);\n\n/** A key combination, read from a `shortcut` string. */\ninterface ParsedShortcut {\n /** The key, lowercased, as `KeyboardEvent.key` names it. */\n key: string;\n mod: boolean;\n ctrl: boolean;\n meta: boolean;\n alt: boolean;\n shift: boolean;\n}\n\n/** Other names a key goes by in a `shortcut`, for the ones `key` spells otherwise. */\nconst keyAliases: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n};\n\n/**\n * Reads a `shortcut` such as `\"mod+k\"` or `\"ctrl + shift + p\"`.\n *\n * @param shortcut - Modifiers and a key, joined by `+`.\n * @returns The combination, or `null` when it doesn't read as one.\n */\nconst parseShortcut = (shortcut: string): ParsedShortcut | null => {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map(part => part.trim());\n const key = parts.pop() as string;\n if (key === '') return null;\n const parsed: ParsedShortcut = {\n key: keyAliases[key] ?? key,\n mod: false,\n ctrl: false,\n meta: false,\n alt: false,\n shift: false,\n };\n for (const part of parts) {\n if (part === 'mod') parsed.mod = true;\n else if (part === 'ctrl' || part === 'control') parsed.ctrl = true;\n else if (part === 'meta' || part === 'cmd' || part === 'command')\n parsed.meta = true;\n else if (part === 'alt' || part === 'option') parsed.alt = true;\n else if (part === 'shift') parsed.shift = true;\n else return null;\n }\n return parsed;\n};\n\n/**\n * Whether a keydown is the combination. `mod` takes Ctrl or ⌘, and any other\n * modifier has to be as the combination says, so `mod+k` isn't\n * `mod+shift+k`. A letter or digit is matched by its key, and by where it\n * sits on the keyboard only when the key isn't a Latin letter or digit at\n * all, as on a Cyrillic layout or with Option held on a Mac, so another\n * Latin layout's own letters keep their own shortcuts.\n */\nconst matchesShortcut = (\n event: KeyboardEvent,\n shortcut: ParsedShortcut\n): boolean => {\n if (event.altKey !== shortcut.alt) return false;\n // A symbol such as `?` already says whether Shift was down, and which key\n // takes Shift to type it depends on the layout, so Shift is only checked\n // for a letter, a digit or a named key, unless the combination names it.\n const shiftMatters =\n shortcut.shift ||\n shortcut.key.length > 1 ||\n /^[a-z0-9]$/.test(shortcut.key);\n if (shiftMatters && event.shiftKey !== shortcut.shift) return false;\n if (shortcut.mod) {\n if (!event.ctrlKey && !event.metaKey) return false;\n } else if (\n event.ctrlKey !== shortcut.ctrl ||\n event.metaKey !== shortcut.meta\n ) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n if (key === shortcut.key) return true;\n if (/^[a-z0-9]$/.test(key)) return false;\n if (/^[a-z]$/.test(shortcut.key)) {\n return event.code === `Key${shortcut.key.toUpperCase()}`;\n }\n if (/^[0-9]$/.test(shortcut.key)) {\n return event.code === `Digit${shortcut.key}`;\n }\n return false;\n};\n\n/** Input types that take no typing, so a shortcut pressed in one still counts. */\nconst untypedInputs = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'hidden',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\n/**\n * Whether a keydown happened while the user was typing: in a text field, a\n * text area, a select, or editable content. The composed path's first entry\n * is the element itself, even inside a shadow root.\n */\nconst isTyping = (event: KeyboardEvent): boolean => {\n const target = event.composedPath()[0] as Partial<Element> | undefined;\n if (typeof target?.closest !== 'function') return false;\n const element = target as Element;\n const editable = element.closest('[contenteditable]');\n if (editable && editable.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n const tag = element.tagName;\n if (tag === 'TEXTAREA' || tag === 'SELECT') return true;\n return (\n tag === 'INPUT' &&\n !untypedInputs.has((element as HTMLInputElement).type.toLowerCase())\n );\n};\n\n/**\n * The Command in a modal, a command palette, opened by its `shortcut` or by `open`, that closes once an item has run.\n *\n * It renders nothing while it's closed. Open, it's a `Modal` with a\n * background and the Command's box as the `dialog`, named by `label`:\n * focus goes to the search field, Tab stays inside, Escape and a click on\n * the background close it, the page behind it doesn't scroll, and focus goes\n * back to where it was when it closes.\n *\n * @function\n * @param {CommandDialogProps} props - Props for the Command.Dialog component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command` that is the dialog.\n * @returns {JSX.Element | null} The dialog, or nothing while it's closed.\n */\nexport const CommandDialog = forwardRef<HTMLDivElement, CommandDialogProps>(\n (\n {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n shortcut,\n closeOnSelect = true,\n clearOnClose = true,\n portal,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const open = controlledOpen ?? ownOpen;\n // Only ever asked for the other state: the shortcut listens while it's\n // closed, and everything that closes it is there while it's open.\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n };\n\n // The search is held here rather than in the Command, which is only\n // mounted while the dialog is open, so it can outlive a close when\n // `clearOnClose` is off.\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n const setQuery = (next: string) => {\n if (controlledQuery === undefined) setOwnQuery(next);\n onQueryChange?.(next);\n };\n // Closing clears the search, however the dialog closed. Our own is\n // cleared during render, React's pattern for adjusting state when other\n // state changes, and a controlled one is asked for after the commit.\n const [shownOpen, setShownOpen] = useState(open);\n if (shownOpen !== open) {\n setShownOpen(open);\n if (!open && clearOnClose && controlledQuery === undefined) {\n setOwnQuery('');\n }\n }\n const wasOpenRef = useRef(open);\n const clearRef = useLatestRef(() => {\n if (clearOnClose && controlledQuery !== undefined && query !== '') {\n onQueryChange?.('');\n }\n });\n useEffect(() => {\n const wasOpen = wasOpenRef.current;\n wasOpenRef.current = open;\n if (wasOpen && !open) clearRef.current();\n }, [open, clearRef]);\n\n if (controlledOpen === undefined && !defaultOpen && !shortcut) {\n warnOnce(\n 'Command.Dialog:no-opener',\n '[bestax-bulma] <Command.Dialog> has no way to open. Give it a ' +\n 'shortcut, or open and onOpenChange.'\n );\n }\n if (shortcut && !parseShortcut(shortcut)) {\n warnOnce(\n `Command.Dialog:shortcut:${shortcut}`,\n `[bestax-bulma] <Command.Dialog> can't read the shortcut ` +\n `\"${shortcut}\". Write modifiers and a key joined by +, such as ` +\n `\"mod+k\", where the modifiers are mod, ctrl, meta, alt and shift.`\n );\n }\n\n const openFromShortcut = useLatestRef(() => setOpen(true));\n useEffect(() => {\n const combination = shortcut ? parseShortcut(shortcut) : null;\n if (!combination || open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.isComposing ||\n event.keyCode === 229 ||\n !matchesShortcut(event, combination) ||\n isTyping(event) ||\n // A Modal, a Dialog, a Sidebar with its overlay or a full-page\n // Loading has the page shut off, so the key isn't the page's. A\n // Sidebar without one leaves the page in use, so it still opens.\n isModalOverlayOpen()\n ) {\n return;\n }\n // The browser's own use of the combination, such as Ctrl+K's search\n // in the address bar, doesn't happen as well.\n event.preventDefault();\n openFromShortcut.current();\n };\n // On `window`, where a keydown arrives last, so anything on the page\n // that used the key first has said so with `preventDefault()`.\n window.addEventListener('keydown', onKeyDown);\n return () => window.removeEventListener('keydown', onKeyDown);\n }, [shortcut, open, openFromShortcut]);\n\n const dialogClass = usePrefixedClassNames('command-dialog');\n\n if (!open) return null;\n\n const close = () => setOpen(false);\n const run = (value: string) => {\n onSelect?.(value);\n if (closeOnSelect) close();\n };\n\n return (\n <Modal isActive onClose={close} role=\"presentation\" portal={portal}>\n <Modal.Background onClick={close} />\n <CommandRoot\n {...(props as CommandProps)}\n ref={ref}\n className={classNames(dialogClass, className)}\n label={label}\n query={query}\n onQueryChange={setQuery}\n onSelect={run}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={\n ariaLabelledBy === undefined\n ? ariaLabel || label || defaultLabel\n : ariaLabel\n }\n aria-labelledby={ariaLabelledBy}\n />\n </Modal>\n );\n }\n);\nCommandDialog.displayName = 'CommandDialog';\n\n/** Command with Input, List, Group, Item, Empty and Dialog sub-components. */\nexport const Command = withSubComponents(\n CommandRoot,\n {\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n Empty: CommandEmpty,\n Dialog: CommandDialog,\n },\n 'Command'\n);\n\nexport default Command;\n"],"names":["typedNoMatches","nothingToAnnounce","isShown","noop","registerNothing","standalone","setRefs","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA;AACA,MAAM,YAAY,GAAG,UAAU;AAE/B;AACA,MAAM,YAAY,GAAG,YAAY;AAEjC;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACxC,MAAMC,mBAAiB,GAA0B,EAAE;AAEnD;AACA,MAAMC,SAAO,GAAG,CAAC,IAAqB,KACpC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,EAAE;AA2TtE,MAAMC,MAAI,GAAG,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B,IAAA,MAAM,EAAE,aAAa;CACtB,EACD,SAAS;;"}
1
+ {"version":3,"file":"Command.js","sources":["../../../src/components/Command.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher, type TextMatcher } from '../helpers/localeFormat';\nimport { isModalOverlayOpen } from '../helpers/overlayStack';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport { Input, InputProps } from '../form/Input';\nimport { Modal } from './Modal';\n\n/** What names a Command that's given no `label`. */\nconst defaultLabel = 'Commands';\n\n/** What a Command given `actions` shows when nothing matches, unless it's given `empty`. */\nconst defaultEmpty = 'No results';\n\n// What the status region announces: the `Command.Empty` content, as the one\n// item it's handed while that content is on screen because of the user's\n// typing.\nconst typedNoMatches = [{ id: 'empty' }];\nconst nothingToAnnounce: Array<{ id: string }> = [];\n\n/** Whether a slot was given something to show. */\nconst isShown = (node: React.ReactNode): boolean =>\n node !== undefined && node !== null && node !== false && node !== '';\n\n/** One action in a Command's `actions`. */\nexport interface CommandAction {\n /** Unique within the Command. It's the item's `value`, so `onSelect` hands it back. */\n id: string;\n /** What the item shows, and what typing matches first. */\n label: string;\n /**\n * A line under the label, such as what the action does or where it goes.\n * Typing matches it too, after the labels. A screen reader hears it after\n * the label, as the item's description.\n */\n description?: string;\n /**\n * More words typing matches, after the labels, such as `['theme']` for\n * \"Dark mode\". They aren't shown.\n */\n keywords?: string[];\n /**\n * The heading the action goes under. Groups show in the order the matches\n * first name them, so the best match is always on top, and the actions with\n * no group show together where the first of them is.\n */\n group?: string;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * Shown at the end of the row, such as the action's own keyboard shortcut in\n * a `Kbd.Group`, or a `Tag`. It only shows: nothing listens for a shortcut\n * written here. A screen reader hears it after the label, with the\n * description.\n */\n hint?: React.ReactNode;\n /** Shown, and reached with the arrows so a screen reader user finds it, but never run. */\n disabled?: boolean;\n /** Runs the action, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n}\n\n/** What a Command takes whether it's given `actions` or built from parts. */\ninterface CommandBaseProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'onSelect'>,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * What the Command is for, such as \"Commands\" or \"Settings\". It's never\n * shown: it names the search field and the list for assistive tech, and in\n * `Command.Dialog` the dialog too. An empty string counts as none.\n * @defaultValue 'Commands'\n */\n label?: string;\n /**\n * The search, controlled: the text in the field. Pair it with\n * `onQueryChange`.\n */\n query?: string;\n /**\n * The search to start with when uncontrolled.\n * @defaultValue ''\n */\n defaultQuery?: string;\n /**\n * Called with the search as the user types it. Built from parts, this is\n * where the app filters its items.\n */\n onQueryChange?: (query: string) => void;\n /**\n * Called with the picked item's `value`, an action's `id`, when it's run\n * with Enter or a click, after the item's own `onSelect`. A disabled item\n * is never run.\n */\n onSelect?: (value: string) => void;\n}\n\n/** Props for a Command given `actions`. */\nexport interface CommandActionsProps extends CommandBaseProps {\n /**\n * The actions, for a Command that renders the field, the list, the groups\n * and the empty message itself. Typing filters them by label, keywords and\n * description, ignoring case, with label matches first. Inside a\n * `LocaleProvider` with a `locale`, it ignores accents too where that\n * language does, so \"cafe\" finds \"Café\". Leave it out to build the\n * Command from parts.\n */\n actions: CommandAction[];\n /**\n * Takes over the filtering, with `actions`: it's handed the search as typed\n * and every action, and returns the ones to show, in the order to show\n * them, which is how to plug in fuzzy matching or cut the list short. It's\n * called with an empty search too.\n */\n filter?: (query: string, actions: CommandAction[]) => CommandAction[];\n /** The field's placeholder, with `actions`. */\n placeholder?: string;\n /**\n * What shows in place of the list, with `actions`, when nothing matches.\n * It's announced the way `Command.Empty` is. `null` shows nothing.\n * @defaultValue 'No results'\n */\n empty?: React.ReactNode;\n /** With `actions`, the Command renders its own parts. */\n children?: never;\n}\n\n/** Props for a Command built from parts. */\nexport interface CommandPartsProps extends CommandBaseProps {\n /**\n * The parts, in order: `Command.Input`, then `Command.List` while there are\n * items and `Command.Empty` while there aren't. Nothing filters them, so\n * render the items that match the search `onQueryChange` reports. With\n * `actions` there are none to give: children given with it are ignored,\n * with a warning in development.\n */\n children?: React.ReactNode;\n /** Built from parts, the app renders the items. */\n actions?: never;\n /** Built from parts, the app filters. */\n filter?: never;\n /** Built from parts, `Command.Input` takes the placeholder. */\n placeholder?: never;\n /** Built from parts, `Command.Empty` is the empty message. */\n empty?: never;\n}\n\n/**\n * Props for the Command component: given `actions`, it renders, filters and\n * groups them itself, and without them it's built from parts. The helper\n * props, the other attributes and the `ref` land on the `div.command` around\n * the field and the list.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` around the field and the list.\n */\nexport type CommandProps = CommandActionsProps | CommandPartsProps;\n\n/** What Command.Dialog takes on top of a Command's props. */\ninterface CommandDialogOwnProps {\n /** Controlled open state. When set, opening and closing only report through `onOpenChange`. */\n open?: boolean;\n /**\n * Initial open state when uncontrolled.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the open state asked for: `true` from the `shortcut`, and\n * `false` from Escape, a click on the background, or a pick while\n * `closeOnSelect` is on. Fires in controlled and uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * A key combination that opens the dialog from anywhere on the page, such\n * as `\"mod+k\"`: modifiers and a key joined by `+`, where `mod` is Ctrl or\n * ⌘ (either one, on every platform), and the others are `ctrl`, `meta`,\n * `alt` and `shift`. It's ignored while the user is typing in a text field,\n * a select or editable content, while an IME is composing, while a modal\n * overlay is open (a `Modal`, a `Dialog`, a `Sidebar` with its overlay or a\n * full-page `Loading`), and when something else has already used the key.\n * It only opens the dialog. Off unless given.\n */\n shortcut?: string;\n /**\n * Closes the dialog once an item has run. Turn it off for an item that\n * opens another page of the palette, and close it yourself with `open`.\n * @defaultValue true\n */\n closeOnSelect?: boolean;\n /**\n * Clears the search when the dialog closes: an uncontrolled one itself,\n * and a controlled one through `onQueryChange('')`.\n * @defaultValue true\n */\n clearOnClose?: boolean;\n /**\n * Renders the dialog into a portal target instead of inline. Forwarded to\n * the underlying `Modal`; see its `portal` prop for the accepted values.\n * @defaultValue false\n */\n portal?: boolean | string | HTMLElement;\n}\n\n/** Props for a Command.Dialog given `actions`. */\nexport interface CommandDialogActionsProps\n extends CommandActionsProps, CommandDialogOwnProps {}\n\n/** Props for a Command.Dialog built from parts. */\nexport interface CommandDialogPartsProps\n extends CommandPartsProps, CommandDialogOwnProps {}\n\n/**\n * Props for Command.Dialog, the Command in a modal: a Command's props, given\n * `actions` or built from parts, and the dialog's own. The helper props, the\n * other attributes and the `ref` land on the `div.command` that is the\n * dialog.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.command` that is the dialog.\n */\nexport type CommandDialogProps =\n CommandDialogActionsProps | CommandDialogPartsProps;\n\n/**\n * Props for Command.Input, the search field. It renders `Input`, so its\n * icons, `isLoading` and `color` work as they do there. Its text is the\n * Command's `query`, and it's `autoComplete=\"off\"`, so the browser's own\n * suggestions don't open over the list: neither is yours to set.\n */\nexport type CommandInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Command sets on the field itself:\n | 'role'\n | 'autoComplete'\n | 'value'\n | 'defaultValue'\n>;\n\n/**\n * Props for Command.List, the list. Its `id` is the one the field's\n * `aria-controls` names, so it isn't yours to set.\n */\nexport interface CommandListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Command.Item`s and `Command.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Group, items under a heading. */\nexport interface CommandGroupProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role'\n> {\n /**\n * The heading, which also names the group for assistive tech, unless you\n * give the group an `aria-label` or `aria-labelledby` of its own.\n */\n label: React.ReactNode;\n /** The group's `Command.Item`s. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Command.Item, one thing to do in the list. Its `id` follows from\n * its `value`, since the field's `aria-activedescendant` names it, so it\n * isn't yours to set.\n */\nexport interface CommandItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What the Command's `onSelect` hands back. Unique within the Command. */\n value: string;\n /**\n * Can't be run. The arrows still reach it, so a screen reader user finds\n * it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /** Runs the item, when it's picked with Enter or a click, before the Command's `onSelect`. */\n onSelect?: () => void;\n /** Shown before the label, and hidden from assistive tech. */\n icon?: React.ReactNode;\n /**\n * A line under the label. A screen reader hears it after the label, as the\n * item's description.\n */\n description?: React.ReactNode;\n /**\n * Shown at the end of the row, such as a keyboard shortcut in a\n * `Kbd.Group`, or a `Tag`. It only shows. A screen reader hears it after\n * the label, with the description.\n */\n hint?: React.ReactNode;\n /** The label, which names the item. */\n children?: React.ReactNode;\n}\n\n/** Props for Command.Empty, the message shown in place of the list. */\nexport interface CommandEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No commands match\". Its text is announced when\n * typing brings it on screen and isn't read again while it stays, so a\n * message that names the search is heard for the first search only.\n */\n children?: React.ReactNode;\n}\n\n/** A handler an item registers, read when it's run. */\ntype ItemHandler = { readonly current: (() => void) | undefined };\n\n/** What the Command hands its parts. */\ninterface CommandContextValue {\n engine: ComboboxEngine;\n /** What names the field and the list. */\n label: string;\n /** The search. */\n query: string;\n /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /** Tells the Command the field's `isLoading`, which holds the empty message's announcement. */\n reportLoading: (loading: boolean) => void;\n /** Records the empty message while it's on screen. Returns the function that forgets it. */\n reportEmpty: (element: HTMLElement) => () => void;\n /** Records an item's `onSelect`. Returns the function that forgets it. */\n registerHandler: (value: string, handler: ItemHandler) => () => void;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Command reads: nothing to report to, so it\n// renders its markup and does nothing.\nconst standalone: CommandContextValue = {\n engine: {\n open: false,\n expanded: false,\n highlighted: null,\n typed: false,\n listboxId: '',\n itemId: () => '',\n rootRef: { current: null },\n inputRef: { current: null },\n listboxRef: { current: null },\n registerPopup: registerNothing,\n registerItem: registerNothing,\n onKeyDown: noop,\n onChange: noop,\n onClick: noop,\n onBlur: noop,\n hover: noop,\n pick: noop,\n keepFocus: noop,\n markInside: noop,\n },\n label: defaultLabel,\n query: '',\n onFieldChange: noop,\n reportLoading: noop,\n reportEmpty: registerNothing,\n registerHandler: registerNothing,\n};\n\nconst CommandContext = createContext<CommandContextValue | null>(null);\n\nconst useCommand = () => useContext(CommandContext) ?? standalone;\n\n/** Hands a node to a forwarded ref and to one of the component's own. */\nfunction setRefs<T>(\n node: T | null,\n own: React.MutableRefObject<T | null>,\n forwarded: React.ForwardedRef<T>\n) {\n own.current = node;\n if (typeof forwarded === 'function') forwarded(node);\n else if (forwarded) forwarded.current = node;\n}\n\n/**\n * The default filter: the actions whose label, keywords or description hold\n * the search, ignoring case and the spaces around it, label matches first and\n * the order otherwise kept. An empty search keeps them all. `matchText`, a\n * `LocaleProvider`'s locale-aware matcher, replaces the lowercased\n * comparison when there is one.\n */\nconst filterActions = (\n query: string,\n actions: CommandAction[],\n matchText?: TextMatcher | null\n): CommandAction[] => {\n const search = query.trim();\n if (search === '') return actions;\n const term = search.toLowerCase();\n const holds = matchText\n ? (text: string) => matchText(text, search)\n : (text: string) => text.toLowerCase().includes(term);\n const byLabel: CommandAction[] = [];\n const byOther: CommandAction[] = [];\n for (const action of actions) {\n if (holds(action.label)) {\n byLabel.push(action);\n } else if (\n (action.description !== undefined && holds(action.description)) ||\n action.keywords?.some(holds)\n ) {\n byOther.push(action);\n }\n }\n return [...byLabel, ...byOther];\n};\n\n/** The search icon at the start of the field. */\nconst SearchIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n width=\"1em\"\n height=\"1em\"\n focusable=\"false\"\n >\n <circle cx=\"7\" cy=\"7\" r=\"4.75\" />\n <path d=\"M10.5 10.5L14 14\" />\n </svg>\n);\n\n/**\n * The Command built from parts: the field, the list, the keys and the run,\n * with the items and their filtering left to the app.\n */\nconst CommandParts = forwardRef<HTMLDivElement, CommandPartsProps>(\n (\n {\n children,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n ...props\n },\n ref\n ) => {\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n\n // Each item's `onSelect`, by value, read when it runs.\n const handlersRef = useRef(new Map<string, ItemHandler>());\n const registerHandler = useCallback(\n (value: string, handler: ItemHandler) => {\n const handlers = handlersRef.current;\n handlers.set(value, handler);\n return () => {\n if (handlers.get(value) === handler) handlers.delete(value);\n };\n },\n []\n );\n const run = (value: string) => {\n handlersRef.current.get(value)?.current?.();\n onSelect?.(value);\n };\n\n // Inline: the list is always on screen, nothing opens or closes it, and\n // Escape goes on to what's around it. `keepFirst` keeps the highlight on\n // the top match, so Enter runs it.\n const engine = useComboboxEngine({\n defaultOpen: true,\n onSelect: run,\n keepFirst: true,\n multiple: false,\n inline: true,\n deferred: false,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const rootClass = usePrefixedClassNames('command');\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Command.Empty` when the\n // user's typing leaves it on screen: once each time that happens, not\n // again on each keystroke while it stays. An empty search isn't a search,\n // so it stays quiet then, and while the field's `isLoading` says results\n // are on their way, it waits.\n const [inputLoading, setInputLoading] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && query !== '' && emptyShown && !inputLoading\n ? typedNoMatches\n : nothingToAnnounce;\n // The region reads the text on screen, whatever the message renders.\n const describeEmpty = useCallback(() => {\n const node = emptyRef.current;\n /* istanbul ignore if: it's only announced while it's on screen */\n if (!node) return null;\n return spokenText(node);\n }, []);\n const reportEmpty = useCallback((element: HTMLElement) => {\n emptyRef.current = element;\n setEmptyShown(true);\n return () => {\n emptyRef.current = null;\n setEmptyShown(false);\n };\n }, []);\n\n const onFieldChange = (value: string) => {\n if (controlledQuery === undefined) setOwnQuery(value);\n onQueryChange?.(value);\n engine.onChange();\n };\n\n // A new value each render: the engine's state and handlers are, and the\n // parts read the highlight from it.\n const context: CommandContextValue = {\n engine,\n label: label || defaultLabel,\n query,\n onFieldChange,\n reportLoading: setInputLoading,\n reportEmpty,\n registerHandler,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n return (\n // The ref after the spread, so the element stays the Command's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <CommandContext.Provider value={context}>\n {children}\n </CommandContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n }\n);\nCommandParts.displayName = 'CommandParts';\n\n/**\n * The search field, with the combobox role and the keys, rendered as an `Input` with a search icon.\n *\n * @function\n * @param {CommandInputProps} props - Props for the Command.Input component.\n * @param {React.Ref<HTMLInputElement>} ref - Forwarded ref to the `<input>`.\n * @returns {JSX.Element} The field in its Control.\n */\nexport const CommandInput = forwardRef<HTMLInputElement, CommandInputProps>(\n (\n {\n isLoading,\n iconLeft,\n iconLeftName,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCommand();\n const { engine, reportLoading } = context;\n useClientLayoutEffect(() => {\n reportLoading(!!isLoading);\n return () => reportLoading(false);\n }, [reportLoading, isLoading]);\n const { inputRef } = engine;\n const inputRefs = useCallback(\n (node: HTMLInputElement | null) => setRefs(node, inputRef, ref),\n [inputRef, ref]\n );\n const { expanded, highlighted } = engine;\n // A name the caller gave the field wins over the Command's `label`.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n // The attributes the Command owns after the caller's, so a stray\n // `aria-expanded` never wins. A search isn't prose, so the browser's\n // spelling and autocorrect stay out of it unless the caller asks.\n <Input\n autoCorrect=\"off\"\n spellCheck={false}\n {...props}\n ref={inputRefs}\n value={context.query}\n iconLeft={\n iconLeft === undefined && !iconLeftName ? <SearchIcon /> : iconLeft\n }\n iconLeftName={iconLeftName}\n isLoading={isLoading}\n aria-label={callerNamed ? props['aria-label'] : context.label}\n role=\"combobox\"\n aria-autocomplete={ariaAutocomplete ?? 'list'}\n aria-haspopup=\"listbox\"\n aria-expanded={expanded}\n aria-controls={expanded ? engine.listboxId : undefined}\n aria-activedescendant={\n expanded && highlighted !== null\n ? engine.itemId(highlighted)\n : undefined\n }\n autoComplete=\"off\"\n onKeyDown={event => {\n onKeyDown?.(event);\n engine.onKeyDown(event);\n }}\n onChange={event => {\n onChange?.(event);\n context.onFieldChange(event.target.value);\n }}\n onClick={event => {\n onClick?.(event);\n if (!event.defaultPrevented) engine.onClick();\n }}\n onBlur={event => {\n onBlur?.(event);\n engine.onBlur(event);\n }}\n />\n );\n }\n);\nCommandInput.displayName = 'CommandInput';\n\n/**\n * The list of items, a `listbox` named by the Command's `label`.\n *\n * @function\n * @param {CommandListProps} props - Props for the Command.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const CommandList: React.FC<CommandListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, label } = useCommand();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('command-list');\n // A name the caller gave the list wins over the Command's.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(listClass, className)}\n {...props}\n ref={listboxRef}\n id={listboxId || undefined}\n role=\"listbox\"\n aria-label={callerNamed ? props['aria-label'] : label}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandList.displayName = 'CommandList';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {CommandGroupProps} props - Props for the Command.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const CommandGroup: React.FC<CommandGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('command-group');\n const labelClass = usePrefixedClassNames('command-group-label');\n // A name the caller gave the group wins over its heading's, as on the list.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n return (\n <div\n className={classNames(groupClass, className)}\n {...props}\n role=\"group\"\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n >\n <div className={labelClass} id={labelId}>\n {label}\n </div>\n {children}\n </div>\n );\n};\nCommandGroup.displayName = 'CommandGroup';\n\n/**\n * One thing to do in the list, named by its label and described by its description and hint.\n *\n * @function\n * @param {CommandItemProps} props - Props for the Command.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const CommandItem: React.FC<CommandItemProps> = ({\n value,\n disabled = false,\n onSelect,\n icon,\n description,\n hint,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, registerHandler } = useCommand();\n const itemRef = useRef<HTMLDivElement>(null);\n const { registerItem } = engine;\n useClientLayoutEffect(\n () =>\n registerItem(itemRef.current as HTMLDivElement, {\n value,\n disabled,\n checked: false,\n }),\n [registerItem, value, disabled]\n );\n const onSelectRef = useLatestRef(onSelect);\n useClientLayoutEffect(\n () => registerHandler(value, onSelectRef),\n [registerHandler, value, onSelectRef]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('command-item', {\n 'is-active': highlighted,\n 'is-disabled': disabled,\n });\n const iconClass = usePrefixedClassNames('command-item-icon');\n const bodyClass = usePrefixedClassNames('command-item-body');\n const labelClass = usePrefixedClassNames('command-item-label');\n const descriptionClass = usePrefixedClassNames('command-item-description');\n const hintClass = usePrefixedClassNames('command-item-hint');\n\n // Named by its label alone, so a screen reader says what it does before\n // the rest, and described by the description and the hint.\n const baseId = useId();\n const labelId = `${baseId}label`;\n const descriptionId = isShown(description)\n ? `${baseId}description`\n : undefined;\n const hintId = isShown(hint) ? `${baseId}hint` : undefined;\n const describedBy =\n [descriptionId, hintId].filter(Boolean).join(' ') || undefined;\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n\n return (\n <div\n className={classNames(itemClass, className)}\n aria-describedby={describedBy}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n // The highlighted option, as the ARIA Authoring Practices' combobox\n // has it, and no attribute on the rest. Never a disabled option.\n aria-selected={disabled ? undefined : highlighted || undefined}\n aria-disabled={disabled || undefined}\n aria-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n onClick={event => {\n onClick?.(event);\n if (!disabled && !event.defaultPrevented) engine.pick(value);\n }}\n onPointerMove={event => {\n onPointerMove?.(event);\n if (!disabled && !highlighted) engine.hover(value);\n }}\n >\n {isShown(icon) && (\n <span className={iconClass} aria-hidden=\"true\">\n {icon}\n </span>\n )}\n <span className={bodyClass}>\n <span className={labelClass} id={labelId}>\n {children}\n </span>\n {descriptionId && (\n <span className={descriptionClass} id={descriptionId}>\n {description}\n </span>\n )}\n </span>\n {hintId && (\n <span className={hintClass} id={hintId}>\n {hint}\n </span>\n )}\n </div>\n );\n};\nCommandItem.displayName = 'CommandItem';\n\n/**\n * The message shown in place of the list when nothing matches, announced when typing brings it on screen.\n *\n * @function\n * @param {CommandEmptyProps} props - Props for the Command.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const CommandEmpty: React.FC<CommandEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCommand();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('command-empty');\n return (\n <div\n className={classNames(emptyClass, className)}\n {...props}\n ref={emptyRef}\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nCommandEmpty.displayName = 'CommandEmpty';\n\n/** What a Command given `actions` renders inside its parts root. */\ninterface CommandActionsContentProps {\n actions: CommandAction[];\n filter: CommandActionsProps['filter'];\n placeholder: string | undefined;\n empty: React.ReactNode;\n}\n\n/**\n * The field, and the actions that match the search, grouped, or the empty\n * message. The search is the parts root's, read from its context.\n */\nconst CommandActionsContent = ({\n actions,\n filter,\n placeholder,\n empty,\n}: CommandActionsContentProps) => {\n const { query } = useCommand();\n const matchText = useLocaleMatcher();\n const shown = filter\n ? filter(query, actions)\n : filterActions(query, actions, matchText);\n\n // Each group where the matches first name it, and the actions with none\n // together where the first of them is, so the best match stays on top.\n const sections = new Map<string, CommandAction[]>();\n for (const action of shown) {\n const group = action.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), action]);\n }\n const renderItem = (action: CommandAction) => (\n <CommandItem\n key={action.id}\n value={action.id}\n disabled={action.disabled}\n icon={action.icon}\n description={action.description}\n hint={action.hint}\n onSelect={action.onSelect}\n >\n {action.label}\n </CommandItem>\n );\n\n return (\n <>\n <CommandInput placeholder={placeholder} />\n {shown.length > 0 ? (\n <CommandList>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <CommandGroup key={group} label={group}>\n {members.map(renderItem)}\n </CommandGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </CommandList>\n ) : isShown(empty) ? (\n <CommandEmpty>{empty}</CommandEmpty>\n ) : null}\n </>\n );\n};\n\n/**\n * The Command given `actions`. It renders the parts itself and filters the\n * actions as the user types, so a run goes through the same parts, keys and\n * ARIA as one built by hand.\n */\nconst CommandFromActions = forwardRef<HTMLDivElement, CommandActionsProps>(\n (\n { actions, filter, placeholder, empty = defaultEmpty, children, ...rest },\n ref\n ) => {\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Command:actions-children',\n '[bestax-bulma] <Command actions> renders its own field and items, ' +\n 'so its children are ignored. Give it actions or build it from ' +\n 'parts, not both.'\n );\n }\n return (\n <CommandParts {...rest} ref={ref}>\n <CommandActionsContent\n actions={actions}\n filter={filter}\n placeholder={placeholder}\n empty={empty}\n />\n </CommandParts>\n );\n }\n);\nCommandFromActions.displayName = 'CommandFromActions';\n\n/**\n * The `Command` component is a search field over a list of things to do, which narrows as you type and runs the top match on Enter: inline by default, and a command palette in a modal as `Command.Dialog`.\n *\n * Given `actions`, it's one element. It renders the field, the list, the\n * groups and the empty message, and filters the actions by label, keywords\n * and description as the user types, with label matches first. `filter`\n * takes over the matching, for fuzzy search.\n *\n * Built from parts, the app owns the items: what's in the list and how it's\n * filtered, from the search `onQueryChange` reports. Nothing filters them,\n * so a server's answer shows as it came.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. The first enabled item is highlighted whenever\n * the items change, so Enter runs the top match. Running an item calls its\n * own `onSelect`, then the Command's.\n *\n * When typing leaves the empty message on screen, its text is announced\n * through a polite status region, once, after any loading ends. Result\n * counts aren't announced: a screen reader reads the list's size from the\n * markup, and a count on every keystroke talks over the typing.\n *\n * @function\n * @param {CommandProps} props - Props for the Command component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command`.\n * @returns {JSX.Element} The field and its list.\n *\n * @example\n * <Command\n * label=\"Settings\"\n * placeholder=\"Search settings\"\n * actions={[\n * { id: 'profile', label: 'Edit profile', onSelect: openProfile },\n * { id: 'theme', label: 'Dark mode', keywords: ['theme'], onSelect: toggleTheme },\n * ]}\n * />\n *\n * @example\n * <Command label=\"People\" onQueryChange={setQuery} onSelect={openProfile}>\n * <Command.Input placeholder=\"Find a person\" />\n * {matches.length > 0 ? (\n * <Command.List>\n * {matches.map(person => (\n * <Command.Item key={person.id} value={person.id}>\n * {person.name}\n * </Command.Item>\n * ))}\n * </Command.List>\n * ) : (\n * <Command.Empty>No one matches</Command.Empty>\n * )}\n * </Command>\n */\nconst CommandRoot = forwardRef<HTMLDivElement, CommandProps>((props, ref) =>\n props.actions === undefined ? (\n <CommandParts {...props} ref={ref} />\n ) : (\n <CommandFromActions {...props} ref={ref} />\n )\n);\n\n/** A key combination, read from a `shortcut` string. */\ninterface ParsedShortcut {\n /** The key, lowercased, as `KeyboardEvent.key` names it. */\n key: string;\n mod: boolean;\n ctrl: boolean;\n meta: boolean;\n alt: boolean;\n shift: boolean;\n}\n\n/** Other names a key goes by in a `shortcut`, for the ones `key` spells otherwise. */\nconst keyAliases: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n};\n\n/**\n * Reads a `shortcut` such as `\"mod+k\"` or `\"ctrl + shift + p\"`.\n *\n * @param shortcut - Modifiers and a key, joined by `+`.\n * @returns The combination, or `null` when it doesn't read as one.\n */\nconst parseShortcut = (shortcut: string): ParsedShortcut | null => {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map(part => part.trim());\n const key = parts.pop() as string;\n if (key === '') return null;\n const parsed: ParsedShortcut = {\n key: keyAliases[key] ?? key,\n mod: false,\n ctrl: false,\n meta: false,\n alt: false,\n shift: false,\n };\n for (const part of parts) {\n if (part === 'mod') parsed.mod = true;\n else if (part === 'ctrl' || part === 'control') parsed.ctrl = true;\n else if (part === 'meta' || part === 'cmd' || part === 'command')\n parsed.meta = true;\n else if (part === 'alt' || part === 'option') parsed.alt = true;\n else if (part === 'shift') parsed.shift = true;\n else return null;\n }\n return parsed;\n};\n\n/**\n * Whether a keydown is the combination. `mod` takes Ctrl or ⌘, and any other\n * modifier has to be as the combination says, so `mod+k` isn't\n * `mod+shift+k`. A letter or digit is matched by its key, and by where it\n * sits on the keyboard only when the key isn't a Latin letter or digit at\n * all, as on a Cyrillic layout or with Option held on a Mac, so another\n * Latin layout's own letters keep their own shortcuts.\n */\nconst matchesShortcut = (\n event: KeyboardEvent,\n shortcut: ParsedShortcut\n): boolean => {\n if (event.altKey !== shortcut.alt) return false;\n // A symbol such as `?` already says whether Shift was down, and which key\n // takes Shift to type it depends on the layout, so Shift is only checked\n // for a letter, a digit or a named key, unless the combination names it.\n const shiftMatters =\n shortcut.shift ||\n shortcut.key.length > 1 ||\n /^[a-z0-9]$/.test(shortcut.key);\n if (shiftMatters && event.shiftKey !== shortcut.shift) return false;\n if (shortcut.mod) {\n if (!event.ctrlKey && !event.metaKey) return false;\n } else if (\n event.ctrlKey !== shortcut.ctrl ||\n event.metaKey !== shortcut.meta\n ) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n if (key === shortcut.key) return true;\n if (/^[a-z0-9]$/.test(key)) return false;\n if (/^[a-z]$/.test(shortcut.key)) {\n return event.code === `Key${shortcut.key.toUpperCase()}`;\n }\n if (/^[0-9]$/.test(shortcut.key)) {\n return event.code === `Digit${shortcut.key}`;\n }\n return false;\n};\n\n/** Input types that take no typing, so a shortcut pressed in one still counts. */\nconst untypedInputs = new Set([\n 'button',\n 'checkbox',\n 'color',\n 'file',\n 'hidden',\n 'image',\n 'radio',\n 'range',\n 'reset',\n 'submit',\n]);\n\n/**\n * Whether a keydown happened while the user was typing: in a text field, a\n * text area, a select, or editable content. The composed path's first entry\n * is the element itself, even inside a shadow root.\n */\nconst isTyping = (event: KeyboardEvent): boolean => {\n const target = event.composedPath()[0] as Partial<Element> | undefined;\n if (typeof target?.closest !== 'function') return false;\n const element = target as Element;\n const editable = element.closest('[contenteditable]');\n if (editable && editable.getAttribute('contenteditable') !== 'false') {\n return true;\n }\n const tag = element.tagName;\n if (tag === 'TEXTAREA' || tag === 'SELECT') return true;\n return (\n tag === 'INPUT' &&\n !untypedInputs.has((element as HTMLInputElement).type.toLowerCase())\n );\n};\n\n/**\n * The Command in a modal, a command palette, opened by its `shortcut` or by `open`, that closes once an item has run.\n *\n * It renders nothing while it's closed. Open, it's a `Modal` with a\n * background and the Command's box as the `dialog`, named by `label`:\n * focus goes to the search field, Tab stays inside, Escape and a click on\n * the background close it, the page behind it doesn't scroll, and focus goes\n * back to where it was when it closes.\n *\n * @function\n * @param {CommandDialogProps} props - Props for the Command.Dialog component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.command` that is the dialog.\n * @returns {JSX.Element | null} The dialog, or nothing while it's closed.\n */\nexport const CommandDialog = forwardRef<HTMLDivElement, CommandDialogProps>(\n (\n {\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n shortcut,\n closeOnSelect = true,\n clearOnClose = true,\n portal,\n label,\n query: controlledQuery,\n defaultQuery = '',\n onQueryChange,\n onSelect,\n className,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref\n ) => {\n const [ownOpen, setOwnOpen] = useState(defaultOpen);\n const open = controlledOpen ?? ownOpen;\n // Only ever asked for the other state: the shortcut listens while it's\n // closed, and everything that closes it is there while it's open.\n const setOpen = (next: boolean) => {\n if (controlledOpen === undefined) setOwnOpen(next);\n onOpenChange?.(next);\n };\n\n // The search is held here rather than in the Command, which is only\n // mounted while the dialog is open, so it can outlive a close when\n // `clearOnClose` is off.\n const [ownQuery, setOwnQuery] = useState(defaultQuery);\n const query = controlledQuery ?? ownQuery;\n const setQuery = (next: string) => {\n if (controlledQuery === undefined) setOwnQuery(next);\n onQueryChange?.(next);\n };\n // Closing clears the search, however the dialog closed. Our own is\n // cleared during render, React's pattern for adjusting state when other\n // state changes, and a controlled one is asked for after the commit.\n const [shownOpen, setShownOpen] = useState(open);\n if (shownOpen !== open) {\n setShownOpen(open);\n if (!open && clearOnClose && controlledQuery === undefined) {\n setOwnQuery('');\n }\n }\n const wasOpenRef = useRef(open);\n const clearRef = useLatestRef(() => {\n if (clearOnClose && controlledQuery !== undefined && query !== '') {\n onQueryChange?.('');\n }\n });\n useEffect(() => {\n const wasOpen = wasOpenRef.current;\n wasOpenRef.current = open;\n if (wasOpen && !open) clearRef.current();\n }, [open, clearRef]);\n\n if (controlledOpen === undefined && !defaultOpen && !shortcut) {\n warnOnce(\n 'Command.Dialog:no-opener',\n '[bestax-bulma] <Command.Dialog> has no way to open. Give it a ' +\n 'shortcut, or open and onOpenChange.'\n );\n }\n if (shortcut && !parseShortcut(shortcut)) {\n warnOnce(\n `Command.Dialog:shortcut:${shortcut}`,\n `[bestax-bulma] <Command.Dialog> can't read the shortcut ` +\n `\"${shortcut}\". Write modifiers and a key joined by +, such as ` +\n `\"mod+k\", where the modifiers are mod, ctrl, meta, alt and shift.`\n );\n }\n\n const openFromShortcut = useLatestRef(() => setOpen(true));\n useEffect(() => {\n const combination = shortcut ? parseShortcut(shortcut) : null;\n if (!combination || open) return undefined;\n const onKeyDown = (event: KeyboardEvent) => {\n if (\n event.defaultPrevented ||\n event.isComposing ||\n event.keyCode === 229 ||\n !matchesShortcut(event, combination) ||\n isTyping(event) ||\n // A Modal, a Dialog, a Sidebar with its overlay or a full-page\n // Loading has the page shut off, so the key isn't the page's. A\n // Sidebar without one leaves the page in use, so it still opens.\n isModalOverlayOpen()\n ) {\n return;\n }\n // The browser's own use of the combination, such as Ctrl+K's search\n // in the address bar, doesn't happen as well.\n event.preventDefault();\n openFromShortcut.current();\n };\n // On `window`, where a keydown arrives last, so anything on the page\n // that used the key first has said so with `preventDefault()`.\n window.addEventListener('keydown', onKeyDown);\n return () => window.removeEventListener('keydown', onKeyDown);\n }, [shortcut, open, openFromShortcut]);\n\n const dialogClass = usePrefixedClassNames('command-dialog');\n\n if (!open) return null;\n\n const close = () => setOpen(false);\n const run = (value: string) => {\n onSelect?.(value);\n if (closeOnSelect) close();\n };\n\n return (\n <Modal isActive onClose={close} role=\"presentation\" portal={portal}>\n <Modal.Background onClick={close} />\n <CommandRoot\n {...(props as CommandProps)}\n ref={ref}\n className={classNames(dialogClass, className)}\n label={label}\n query={query}\n onQueryChange={setQuery}\n onSelect={run}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={\n ariaLabelledBy === undefined\n ? ariaLabel || label || defaultLabel\n : ariaLabel\n }\n aria-labelledby={ariaLabelledBy}\n />\n </Modal>\n );\n }\n);\nCommandDialog.displayName = 'CommandDialog';\n\n/** Command with Input, List, Group, Item, Empty and Dialog sub-components. */\nexport const Command = withSubComponents(\n CommandRoot,\n {\n Input: CommandInput,\n List: CommandList,\n Group: CommandGroup,\n Item: CommandItem,\n Empty: CommandEmpty,\n Dialog: CommandDialog,\n },\n 'Command'\n);\n\nexport default Command;\n"],"names":["typedNoMatches","nothingToAnnounce","isShown","noop","registerNothing","standalone","setRefs","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;;;;AA2BA;AACA,MAAM,YAAY,GAAG,UAAU;AAE/B;AACA,MAAM,YAAY,GAAG,YAAY;AAEjC;AACA;AACA;AACA,MAAMA,gBAAc,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACxC,MAAMC,mBAAiB,GAA0B,EAAE;AAEnD;AACA,MAAMC,SAAO,GAAG,CAAC,IAAqB,KACpC,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,EAAE;AA2TtE,MAAMC,MAAI,GAAG,MAAK,EAAE,CAAC;AACrB,MAAMC,iBAAe,GAAG,MAAMD,MAAI;AAElC;AACA;AACA,MAAME,YAAU,GAAwB;AACtC,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,QAA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AC,KAAK,CAAC;AAClC,IAAA,MAAM,GAAG,GAAG,CAAC,KAAa,KAAI;AAC5B,QAAA,QAAQ,GAAG,KAAK,CAAC;AACjB,QAAA,IAAI,aAAa;AAAE,YAAA,KAAK,EAAE;AAC5B,IAAA,CAAC;AAED,IAAA,QACED,IAAA,CAAC,KAAK,EAAA,EAAC,QAAQ,EAAA,IAAA,EAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAC,cAAc,EAAC,MAAM,EAAE,MAAM,EAAA,QAAA,EAAA,CAChEC,GAAA,CAAC,KAAK,CAAC,UAAU,IAAC,OAAO,EAAE,KAAK,EAAA,CAAI,EACpCA,GAAA,CAAC,WAAW,EAAA,EAAA,GACL,KAAsB,EAC3B,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CAAC,WAAW,EAAE,SAAS,CAAC,EAC7C,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,QAAQ,EACvB,QAAQ,EAAE,GAAG,EACb,IAAI,EAAC,QAAQ,EAAA,YAAA,EACF,MAAM,EAAA,YAAA,EAEf,cAAc,KAAK;AACjB,sBAAE,SAAS,IAAI,KAAK,IAAI;AACxB,sBAAE,SAAS,EAAA,iBAAA,EAEE,cAAc,EAAA,CAC/B,CAAA,EAAA,CACI;AAEZ,CAAC;AAEH,aAAa,CAAC,WAAW,GAAG,eAAe;AAE3C;AACO,MAAM,OAAO,GAAG,iBAAiB,CACtC,WAAW,EACX;AACE,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE,YAAY;AACnB,IAAA,MAAM,EAAE,aAAa;CACtB,EACD,SAAS;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HoverCard.js","sources":["../../../src/components/HoverCard.tsx"],"sourcesContent":["import React, {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { marginGap, useAnchoredPosition } from '../helpers/useAnchoredPosition';\nimport { chain, useHoverOpen } from '../helpers/useHoverOpen';\nimport { isTabbableKind } from '../helpers/useFocusTrap';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport type { PickerPosition } from '../form/_pickerInternals/pickerTypes';\n\n/**\n * Where the card opens against its trigger: below (`bottom-*`) or above\n * (`top-*`), lined up with the trigger's left or right edge. `auto` picks the\n * one that keeps the card in the viewport, preferring below and lined up on\n * the left. The same union `Popover` and the date and time pickers take.\n */\nexport type HoverCardPosition = PickerPosition;\n\n/**\n * Props for the HoverCard component. `className`, `id`, the other HTML\n * attributes and the helper props land on the `span` around the trigger, not\n * on the card; `contentClassName` reaches the card.\n * @extraProp {string} [className] - Additional classes for the `span` around the trigger. The card takes `contentClassName`.\n */\nexport interface HoverCardProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element the card previews, such as a link or a `Button`. The element\n * itself has to take focus, so keyboard users can open the card too: a\n * link inside a `<span>` doesn't do, since focus comes back to the trigger\n * and its ARIA is on it. HoverCard gives it no role and no tab stop, since\n * it can't know what the element is, and a development build warns when\n * it can't take focus: use a link or a button, or give the element\n * `tabIndex={0}`. A disabled button can't take focus either. HoverCard adds\n * `aria-expanded` and `aria-controls`, both naming the card only while it\n * is on the page, so it has to be a single element that passes those to\n * its DOM node. Its own click and keys stay its own, and the card doesn't\n * toggle on them, except Escape while the card is open, which closes the\n * card before the trigger sees it.\n */\n trigger: React.ReactElement;\n /**\n * The card's content: a preview whose links and buttons are fine, but not a\n * form, which belongs in a `Popover`. The card pads itself, so content goes\n * straight in.\n */\n children?: React.ReactNode;\n /**\n * Controlled open state. When set, hover, focus and Escape only report\n * through `onOpenChange`, so an action inside the card can close it. While\n * the card is open, Escape is reported, and when focus is in the card, on\n * its trigger or nowhere, the key stops there even if you keep the card\n * open, so a `Modal` around it doesn't close from the keyboard until the\n * card does.\n */\n open?: boolean;\n /**\n * Initial open state when uncontrolled. A card that starts open stays open\n * until the pointer or focus has been and gone, or Escape closes it.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the state asked for: when `openDelay` or `closeDelay` runs\n * out, and right away on Escape. Fires in both controlled and uncontrolled\n * use. An Escape it reports stops at the card when focus is in the card,\n * on its trigger or nowhere, so nothing around it sees that key. With\n * focus anywhere else, the card still closes and the key goes on to\n * whatever has focus.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * How long the pointer or keyboard focus waits on the trigger before the\n * card opens, in milliseconds.\n * @defaultValue 600\n */\n openDelay?: number;\n /**\n * How long the card stays after the pointer and focus have left the trigger\n * and the card, in milliseconds. It is the time the pointer has to cross\n * the gap between the trigger and the card: with `0` the card closes as the\n * pointer leaves the trigger, before the pointer can reach it.\n * @defaultValue 300\n */\n closeDelay?: number;\n /**\n * Where the card opens against the trigger.\n * @defaultValue 'bottom-left'\n */\n position?: HoverCardPosition;\n /**\n * Render the card through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport,\n * so an ancestor's `overflow`, `transform` or stacking context can't clip\n * it. A trigger in running text needs it too, since the card's block\n * content can't sit inside a `<p>`. The card then shows from the commit\n * after hydration, never in server markup, and it sits in the Tab order\n * where its container is. At the end of `<body>`, the default, Tab reaches\n * it only after the rest of the page, and focus leaving the trigger on the\n * way closes it, so keyboard users can open it, read it and close it with\n * Escape, and whatever it links to has to be reachable from the page as\n * well. It is measured against the trigger when it opens and on resize and\n * scroll, so it doesn't follow content that changes size while it is open.\n * Theming variables set on an ancestor of the trigger reach it only when its\n * container is inside that ancestor.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /**\n * Open the card with a tap on a touch screen. Touch has no hover, so\n * without this a phone or tablet never opens the card. With it, a tap on\n * the trigger opens the card at once, and it stays until a second tap on\n * the trigger, a tap outside the trigger and the card, or Escape. The tap\n * still does whatever the trigger does, so turn this on only for a trigger\n * with no tap action of its own, such as a `Button` with no `onClick`: on\n * a link, the first tap would follow the link rather than show the card.\n * Mouse and pen work the same either way.\n * @defaultValue false\n */\n openOnTap?: boolean;\n /** Additional classes for the card (`.hover-card-content`). */\n contentClassName?: string;\n}\n\n/**\n * The `HoverCard` component shows a card previewing what's behind a link or a button while the pointer rests on it or keyboard focus is on it.\n *\n * Nothing moves focus when the card opens, and nothing traps it. In place,\n * the card comes right after the trigger, so Tab goes from the trigger into\n * its links and tabbing past them closes it. The pointer can move onto the\n * card, Escape closes it from anywhere, and by default touch doesn't open it,\n * so tapping the trigger just does what the trigger does. `openOnTap` opens\n * it with a tap, for a trigger with no tap action of its own. For hints with nothing to\n * click use `Tooltip`, and for content opened on purpose, such as a form,\n * use `Popover`.\n *\n * @function\n * @param {HoverCardProps} props - Props for the HoverCard component.\n * @returns {JSX.Element} The trigger in its wrapper, and the card while open.\n *\n * @example\n * <HoverCard trigger={<a href=\"/people/ada\">Ada Lovelace</a>}>\n * <Title as=\"p\" size=\"6\">Ada Lovelace</Title>\n * <SubTitle as=\"p\" size=\"6\">Analytical Engine team</SubTitle>\n * </HoverCard>\n */\nexport const HoverCard: React.FC<HoverCardProps> = ({\n trigger,\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n openDelay = 600,\n closeDelay = 300,\n position = 'bottom-left',\n appendToBody = false,\n openOnTap = false,\n className,\n contentClassName,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const {\n onPointerEnter,\n onPointerOver,\n onPointerLeave,\n onPointerDown,\n onPointerUp,\n onFocus,\n onBlur,\n ...attrs\n } = rest;\n const rootRef = useRef<HTMLSpanElement>(null);\n const cardRef = useRef<HTMLDivElement>(null);\n const cardId = `${useId()}-card`;\n\n const isControlled = controlledOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = controlledOpen ?? internalOpen;\n\n const requestOpen = useCallback(\n (next: boolean) => {\n onOpenChange?.(next);\n if (!isControlled) setInternalOpen(next);\n },\n [isControlled, onOpenChange]\n );\n\n // A portaled card has no server markup, so it only exists from the commit\n // after hydration, and nothing measures it before then.\n const hydrated = useIsHydrated();\n const cardMounted = isOpen && (hydrated || !appendToBody);\n\n const resolved = useAnchoredPosition(rootRef, cardRef, {\n active: cardMounted,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-hover-card-offset` in the stylesheet, so\n // the coordinates leave it out and `auto` reads it off the card.\n offset: 0,\n styledGap: marginGap,\n });\n\n // The trigger renders first inside the wrapper. Read when needed rather\n // than held, so a trigger that remounted is still the one found.\n const triggerRef = useMemo(\n () => ({\n get current() {\n const first = (rootRef.current as HTMLSpanElement).firstElementChild;\n return first && first !== cardRef.current\n ? (first as HTMLElement)\n : null;\n },\n }),\n []\n );\n\n const hover = useHoverOpen({\n open: isOpen,\n onOpenChange: requestOpen,\n openDelay,\n closeDelay,\n triggerRef,\n floatingRef: cardRef,\n openOnTap,\n });\n\n // A trigger that can't take focus leaves keyboard users no way to open the\n // card. It has to be the trigger element itself, not something inside it,\n // since focus comes back to it and its ARIA is on it. Judged by what the\n // element is rather than by its styles, which can hide it for now. After\n // every commit, since the trigger can change, and only in development.\n useEffect(() => {\n if (!isDev()) return;\n const triggerNode = triggerRef.current;\n if (!triggerNode) return;\n if (!triggerNode.matches(':disabled') && isTabbableKind(triggerNode)) {\n return;\n }\n warnOnce(\n 'HoverCard:unfocusable-trigger',\n \"[bestax-bulma] <HoverCard> has a trigger that can't take focus, so \" +\n \"keyboard users can't open the card. Use a link or a button as the \" +\n 'trigger, or give it tabIndex={0}.'\n );\n });\n\n // Expanded only while the card is on the page, so a portaled card that\n // waits for hydration isn't announced before it exists.\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n 'aria-expanded': cardMounted,\n 'aria-controls': cardMounted ? cardId : undefined,\n }\n );\n\n const rootClasses = classNames(\n usePrefixedClassNames('hover-card', { 'is-active': cardMounted }),\n bulmaHelperClasses,\n className\n );\n const cardClasses = classNames(\n usePrefixedClassNames('hover-card-content', {\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n }),\n contentClassName\n );\n\n return (\n // The ref after the spread: React 19 hands a function component a `ref`\n // prop like any other, and the wrapper has to stay ours. The card is in\n // the wrapper's React tree even when portaled, so the hover and focus\n // handlers here hear from both.\n <span\n className={rootClasses}\n {...attrs}\n onPointerEnter={chain(onPointerEnter, hover.onPointerEnter)}\n onPointerOver={chain(onPointerOver, hover.onPointerOver)}\n onPointerLeave={chain(onPointerLeave, hover.onPointerLeave)}\n onFocus={chain(onFocus, hover.onFocus)}\n onBlur={chain(onBlur, hover.onBlur)}\n onPointerDown={chain(onPointerDown, hover.onPointerDown)}\n onPointerUp={chain(onPointerUp, hover.onPointerUp)}\n ref={rootRef}\n >\n {clonedTrigger}\n {isOpen && (\n <Portal disabled={!appendToBody}>\n <div\n ref={cardRef}\n id={cardId}\n className={cardClasses}\n style={\n appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : undefined\n }\n >\n {children}\n </div>\n </Portal>\n )}\n </span>\n );\n};\n\nexport default HoverCard;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AAuIA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACU,SAAS,GAA6B,CAAC,EAClD,OAAO,EACP,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAW,GAAG,KAAK,EACnB,YAAY,EACZ,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,SAAS,GAAG,KAAK,EACjB,SAAS,EACT,gB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,EACE,SAAS,EAAE,WAAW,EAAA,GAClB,KAAK,EACT,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,EAC3D,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,EACxD,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,EAC3D,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACnC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,EACxD,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,EAClD,GAAG,EAAE,OAAO,aAEX,aAAa,EACb,MAAM,KACLC,GAAA,CAAC,MAAM,EAAA,EAAC,QAAQ,EAAE,CAAC,YAAY,EAAA,QAAA,EAC7BA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,WAAW,EACtB,KAAK,EACH;AACE,0BAAE;AACE,4BAAA,QAAQ,EAAE,OAAO;4BACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;4BACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;AACpB;0BACD,SAAS,EAAA,QAAA,EAGd,QAAQ,GACL,EAAA,CACC,CACV,CAAA,EAAA,CACI;AAEX;;"}
1
+ {"version":3,"file":"HoverCard.js","sources":["../../../src/components/HoverCard.tsx"],"sourcesContent":["import React, {\n cloneElement,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { marginGap, useAnchoredPosition } from '../helpers/useAnchoredPosition';\nimport { chain, useHoverOpen } from '../helpers/useHoverOpen';\nimport { isTabbableKind } from '../helpers/useFocusTrap';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport type { PickerPosition } from '../form/_pickerInternals/pickerTypes';\n\n/**\n * Where the card opens against its trigger: below (`bottom-*`) or above\n * (`top-*`), lined up with the trigger's left or right edge. `auto` picks the\n * one that keeps the card in the viewport, preferring below and lined up on\n * the left. The same union `Popover` and the date and time pickers take.\n */\nexport type HoverCardPosition = PickerPosition;\n\n/**\n * Props for the HoverCard component. `className`, `id`, the other HTML\n * attributes and the helper props land on the `span` around the trigger, not\n * on the card; `contentClassName` reaches the card.\n * @extraProp {string} [className] - Additional classes for the `span` around the trigger. The card takes `contentClassName`.\n */\nexport interface HoverCardProps\n extends\n Omit<React.HTMLAttributes<HTMLSpanElement>, 'color' | 'children'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * The element the card previews, such as a link or a `Button`. The element\n * itself has to take focus, so keyboard users can open the card too: a\n * link inside a `<span>` doesn't do, since focus comes back to the trigger\n * and its ARIA is on it. HoverCard gives it no role and no tab stop, since\n * it can't know what the element is, and a development build warns when\n * it can't take focus: use a link or a button, or give the element\n * `tabIndex={0}`. A disabled button can't take focus either. HoverCard adds\n * `aria-expanded` and `aria-controls`, both naming the card only while it\n * is on the page, so it has to be a single element that passes those to\n * its DOM node. Its own click and keys stay its own, and the card doesn't\n * toggle on them, except Escape while the card is open, which closes the\n * card before the trigger sees it.\n */\n trigger: React.ReactElement;\n /**\n * The card's content: a preview whose links and buttons are fine, but not a\n * form, which belongs in a `Popover`. The card pads itself, so content goes\n * straight in.\n */\n children?: React.ReactNode;\n /**\n * Controlled open state. When set, hover, focus and Escape only report\n * through `onOpenChange`, so an action inside the card can close it. While\n * the card is open, Escape is reported, and when focus is in the card, on\n * its trigger or nowhere, the key stops there even if you keep the card\n * open, so a `Modal` around it doesn't close from the keyboard until the\n * card does.\n */\n open?: boolean;\n /**\n * Initial open state when uncontrolled. A card that starts open stays open\n * until the pointer or focus has been and gone, or Escape closes it.\n * @defaultValue false\n */\n defaultOpen?: boolean;\n /**\n * Called with the state asked for: when `openDelay` or `closeDelay` runs\n * out, and right away on Escape. Fires in both controlled and uncontrolled\n * use. An Escape it reports stops at the card when focus is in the card,\n * on its trigger or nowhere, so nothing around it sees that key. With\n * focus anywhere else, the card still closes and the key goes on to\n * whatever has focus.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * How long the pointer or keyboard focus waits on the trigger before the\n * card opens, in milliseconds.\n * @defaultValue 600\n */\n openDelay?: number;\n /**\n * How long the card stays after the pointer and focus have left the trigger\n * and the card, in milliseconds. It is the time the pointer has to cross\n * the gap between the trigger and the card: with `0` the card closes as the\n * pointer leaves the trigger, before the pointer can reach it.\n * @defaultValue 300\n */\n closeDelay?: number;\n /**\n * Where the card opens against the trigger.\n * @defaultValue 'bottom-left'\n */\n position?: HoverCardPosition;\n /**\n * Render the card through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport,\n * so an ancestor's `overflow`, `transform` or stacking context can't clip\n * it. A trigger in running text needs it too, since the card's block\n * content can't sit inside a `<p>`. The card then shows from the commit\n * after hydration, never in server markup, and it sits in the Tab order\n * where its container is. At the end of `<body>`, the default, Tab reaches\n * it only after the rest of the page, and focus leaving the trigger on the\n * way closes it, so keyboard users can open it, read it and close it with\n * Escape, and whatever it links to has to be reachable from the page as\n * well. Theming variables set on an ancestor of the trigger reach it only\n * when its container is inside that ancestor.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /**\n * Open the card with a tap on a touch screen. Touch has no hover, so\n * without this a phone or tablet never opens the card. With it, a tap on\n * the trigger opens the card at once, and it stays until a second tap on\n * the trigger, a tap outside the trigger and the card, or Escape. The tap\n * still does whatever the trigger does, so turn this on only for a trigger\n * with no tap action of its own, such as a `Button` with no `onClick`: on\n * a link, the first tap would follow the link rather than show the card.\n * Mouse and pen work the same either way.\n * @defaultValue false\n */\n openOnTap?: boolean;\n /** Additional classes for the card (`.hover-card-content`). */\n contentClassName?: string;\n}\n\n/**\n * The `HoverCard` component shows a card previewing what's behind a link or a button while the pointer rests on it or keyboard focus is on it.\n *\n * Nothing moves focus when the card opens, and nothing traps it. In place,\n * the card comes right after the trigger, so Tab goes from the trigger into\n * its links and tabbing past them closes it. The pointer can move onto the\n * card, Escape closes it from anywhere, and by default touch doesn't open it,\n * so tapping the trigger just does what the trigger does. `openOnTap` opens\n * it with a tap, for a trigger with no tap action of its own. For hints with nothing to\n * click use `Tooltip`, and for content opened on purpose, such as a form,\n * use `Popover`.\n *\n * @function\n * @param {HoverCardProps} props - Props for the HoverCard component.\n * @returns {JSX.Element} The trigger in its wrapper, and the card while open.\n *\n * @example\n * <HoverCard trigger={<a href=\"/people/ada\">Ada Lovelace</a>}>\n * <Title as=\"p\" size=\"6\">Ada Lovelace</Title>\n * <SubTitle as=\"p\" size=\"6\">Analytical Engine team</SubTitle>\n * </HoverCard>\n */\nexport const HoverCard: React.FC<HoverCardProps> = ({\n trigger,\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n openDelay = 600,\n closeDelay = 300,\n position = 'bottom-left',\n appendToBody = false,\n openOnTap = false,\n className,\n contentClassName,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const {\n onPointerEnter,\n onPointerOver,\n onPointerLeave,\n onPointerDown,\n onPointerUp,\n onFocus,\n onBlur,\n ...attrs\n } = rest;\n const rootRef = useRef<HTMLSpanElement>(null);\n const cardRef = useRef<HTMLDivElement>(null);\n const cardId = `${useId()}-card`;\n\n const isControlled = controlledOpen !== undefined;\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const isOpen = controlledOpen ?? internalOpen;\n\n const requestOpen = useCallback(\n (next: boolean) => {\n onOpenChange?.(next);\n if (!isControlled) setInternalOpen(next);\n },\n [isControlled, onOpenChange]\n );\n\n // A portaled card has no server markup, so it only exists from the commit\n // after hydration, and nothing measures it before then.\n const hydrated = useIsHydrated();\n const cardMounted = isOpen && (hydrated || !appendToBody);\n\n const resolved = useAnchoredPosition(rootRef, cardRef, {\n active: cardMounted,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-hover-card-offset` in the stylesheet, so\n // the coordinates leave it out and `auto` reads it off the card.\n offset: 0,\n styledGap: marginGap,\n });\n\n // The trigger renders first inside the wrapper. Read when needed rather\n // than held, so a trigger that remounted is still the one found.\n const triggerRef = useMemo(\n () => ({\n get current() {\n const first = (rootRef.current as HTMLSpanElement).firstElementChild;\n return first && first !== cardRef.current\n ? (first as HTMLElement)\n : null;\n },\n }),\n []\n );\n\n const hover = useHoverOpen({\n open: isOpen,\n onOpenChange: requestOpen,\n openDelay,\n closeDelay,\n triggerRef,\n floatingRef: cardRef,\n openOnTap,\n });\n\n // A trigger that can't take focus leaves keyboard users no way to open the\n // card. It has to be the trigger element itself, not something inside it,\n // since focus comes back to it and its ARIA is on it. Judged by what the\n // element is rather than by its styles, which can hide it for now. After\n // every commit, since the trigger can change, and only in development.\n useEffect(() => {\n if (!isDev()) return;\n const triggerNode = triggerRef.current;\n if (!triggerNode) return;\n if (!triggerNode.matches(':disabled') && isTabbableKind(triggerNode)) {\n return;\n }\n warnOnce(\n 'HoverCard:unfocusable-trigger',\n \"[bestax-bulma] <HoverCard> has a trigger that can't take focus, so \" +\n \"keyboard users can't open the card. Use a link or a button as the \" +\n 'trigger, or give it tabIndex={0}.'\n );\n });\n\n // Expanded only while the card is on the page, so a portaled card that\n // waits for hydration isn't announced before it exists.\n const clonedTrigger = cloneElement(\n trigger as React.ReactElement<Record<string, unknown>>,\n {\n 'aria-expanded': cardMounted,\n 'aria-controls': cardMounted ? cardId : undefined,\n }\n );\n\n const rootClasses = classNames(\n usePrefixedClassNames('hover-card', { 'is-active': cardMounted }),\n bulmaHelperClasses,\n className\n );\n const cardClasses = classNames(\n usePrefixedClassNames('hover-card-content', {\n [`is-${resolved.position}`]: true,\n 'is-portal': appendToBody,\n }),\n contentClassName\n );\n\n return (\n // The ref after the spread: React 19 hands a function component a `ref`\n // prop like any other, and the wrapper has to stay ours. The card is in\n // the wrapper's React tree even when portaled, so the hover and focus\n // handlers here hear from both.\n <span\n className={rootClasses}\n {...attrs}\n onPointerEnter={chain(onPointerEnter, hover.onPointerEnter)}\n onPointerOver={chain(onPointerOver, hover.onPointerOver)}\n onPointerLeave={chain(onPointerLeave, hover.onPointerLeave)}\n onFocus={chain(onFocus, hover.onFocus)}\n onBlur={chain(onBlur, hover.onBlur)}\n onPointerDown={chain(onPointerDown, hover.onPointerDown)}\n onPointerUp={chain(onPointerUp, hover.onPointerUp)}\n ref={rootRef}\n >\n {clonedTrigger}\n {isOpen && (\n <Portal disabled={!appendToBody}>\n <div\n ref={cardRef}\n id={cardId}\n className={cardClasses}\n style={\n appendToBody\n ? {\n position: 'fixed',\n top: resolved.top,\n left: resolved.left,\n }\n : undefined\n }\n >\n {children}\n </div>\n </Portal>\n )}\n </span>\n );\n};\n\nexport default HoverCard;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;AAqIA;;;;;;;;;;;;;;;;;;;;;AAqBG;MACU,SAAS,GAA6B,CAAC,EAClD,OAAO,EACP,QAAQ,EACR,IAAI,EAAE,cAAc,EACpB,WAAW,GAAG,KAAK,EACnB,YAAY,EACZ,SAAS,GAAG,GAAG,EACf,UAAU,GAAG,GAAG,EAChB,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,SAAS,GAAG,KAAK,EACjB,SAAS,EACT,gBAAgB,EAChB,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;IAC3D,MAAM,EACJ,cAAc,EACd,aAAa,EACb,cAAc,EACd,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,GAAG,IAAI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Ac,CAAC,EAC3D,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EACtC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EACnC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,EACxD,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,EAClD,GAAG,EAAE,OAAO,aAEX,aAAa,EACb,MAAM,KACLC,GAAA,CAAC,MAAM,EAAA,EAAC,QAAQ,EAAE,CAAC,YAAY,EAAA,QAAA,EAC7BA,GAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,OAAO,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,WAAW,EACtB,KAAK,EACH;AACE,0BAAE;AACE,4BAAA,QAAQ,EAAE,OAAO;4BACjB,GAAG,EAAE,QAAQ,CAAC,GAAG;4BACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;AACpB;0BACD,SAAS,EAAA,QAAA,EAGd,QAAQ,GACL,EAAA,CACC,CACV,CAAA,EAAA,CACI;AAEX;;"}
@@ -94,9 +94,9 @@ const Loading = ({ active = false, isFullPage = false, size, color, canCancel =
94
94
  window.addEventListener('keydown', handleKeyDown);
95
95
  return () => window.removeEventListener('keydown', handleKeyDown);
96
96
  }, [active, canCancel, hasOnCancel, onCancelRef, isTopmost]);
97
- // Prevent body scroll when full page loading is active. Ref-counted through
98
- // the shared helper so an overlapping Modal/Dialog/Sidebar doesn't have its
99
- // lock cleared when this one releases.
97
+ // Lock the page's scrolling when full page loading is active. Ref-counted
98
+ // through the shared helper so an overlapping Modal/Dialog/Sidebar doesn't
99
+ // have its lock cleared when this one releases.
100
100
  useScrollLock(isFullPage && active);
101
101
  if (!active) {
102
102
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"Loading.js","sources":["../../../src/components/Loading.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useScrollLock } from '../helpers/scrollLock';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\nimport { useInertSiblings } from '../helpers/useInertSiblings';\n\n/**\n * Overlay opacity levels for the Loading background.\n */\nexport type LoadingOverlay = 'light' | 'dark' | 'opaque';\n\n/**\n * Color variants for the Loading spinner.\n */\nexport type LoadingColor =\n 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Props for the Loading component.\n * @extraProp {React.ReactNode} [children] - Content to display below the spinner.\n * @extraProp {string} [className] - Additional CSS classes.\n */\nexport interface LoadingProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {\n /**\n * Whether the loading overlay is visible. While it is, what it covers is\n * inert, out of reach of Tab, Enter, Space and screen readers as well as\n * the mouse: the other children of the element it's rendered in, so render\n * it directly inside the element it covers, or with `isFullPage` the rest\n * of the page. Its own content, the cancel button included, stays\n * reachable. Only what's there when it turns on is made inert, and an\n * element that was inert already is left as it was. A control under it\n * that had focus loses it, and gets it back when the loading goes away,\n * unless focus has moved on in the meantime. Show one at a time over the\n * same content: two that cover each other, such as two in one container\n * or two full-page ones, make each other inert, cancel buttons and all.\n */\n active?: boolean;\n /**\n * Cover the entire viewport. While it's active, the rest of the page is\n * inert, as it is under a modal, rather than only the element it's\n * rendered in. A full-page loading also takes its turn with\n * Modal and Sidebar for Escape: while it's the topmost open overlay, the\n * Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or\n * not the loading can be cancelled.\n */\n isFullPage?: boolean;\n /** Size of the loading spinner. */\n size?: 'small' | 'medium' | 'large';\n /** Color variant for the spinner. Default is light grey. */\n color?: LoadingColor;\n /**\n * Show a cancel button and allow closing, by a click on the overlay or by\n * Escape. With `isFullPage`, the loading is an overlay like Modal and\n * Sidebar: only the topmost open overlay answers Escape, so a full-page\n * loading shown over a Modal cancels first, and the Modal closes on the\n * next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or\n * full-page Loading is open. Either way it marks the Escape it cancels on as\n * used with `preventDefault()`. An Escape a popup on the page closed on, by\n * calling `preventDefault()`, doesn't cancel.\n */\n canCancel?: boolean;\n /** Callback when cancel is triggered. */\n onCancel?: () => void;\n /** Additional classes for the overlay. */\n overlayClassName?: string;\n /** Additional classes for the spinner icon. */\n iconClassName?: string;\n /** Custom loading indicator element. */\n indicator?: React.ReactNode;\n /** Style of the loading overlay. */\n overlay?: LoadingOverlay;\n}\n\n/**\n * The `Loading` component provides a loading overlay with a spinner animation.\n *\n * @function\n * @param {LoadingProps} props - Props for the Loading component.\n * @returns {JSX.Element | null} The rendered loading overlay or null if not active.\n *\n * @example\n * // Full page loading\n * <Loading active isFullPage />\n *\n * @example\n * // Container loading with message\n * <div style={{ position: 'relative', height: '200px' }}>\n * <Loading active>Loading data...</Loading>\n * </div>\n *\n * @example\n * // With color variant\n * <Loading active color=\"primary\" />\n *\n * @example\n * // With cancel functionality\n * <Loading\n * active={isLoading}\n * canCancel\n * onCancel={() => setIsLoading(false)}\n * />\n */\nexport const Loading: React.FC<LoadingProps> = ({\n active = false,\n isFullPage = false,\n size,\n color,\n canCancel = false,\n onCancel,\n children,\n className,\n overlayClassName,\n iconClassName,\n indicator,\n overlay,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const loadingClasses = usePrefixedClassNames('loading', {\n 'is-active': active,\n 'is-full-page': isFullPage,\n 'is-cancelable': canCancel,\n [`is-${overlay}`]: !!overlay,\n [`is-${color}`]: !!color,\n });\n\n const iconClasses = usePrefixedClassNames('loading-icon', {\n [`is-${size}`]: size,\n });\n\n // Combine classes\n const combinedClasses = classNames(\n loadingClasses,\n bulmaHelperClasses,\n className\n );\n const combinedOverlayClasses = classNames(\n usePrefixedClassNames('loading-overlay'),\n overlayClassName\n );\n const combinedIconClasses = classNames(iconClasses, iconClassName);\n const loadingContentClass = usePrefixedClassNames('loading-content');\n const loadingIconCustomClass = usePrefixedClassNames('loading-icon-custom');\n const loadingTextClass = usePrefixedClassNames('loading-text');\n const loadingCancelClass = usePrefixedClassNames('loading-cancel');\n\n // Handle cancel click\n const handleOverlayClick = () => {\n if (canCancel && onCancel) {\n onCancel();\n }\n };\n\n // Read when Escape arrives, so the key listener stays put while `onCancel`\n // changes identity, as an inline one does on every render of the parent.\n const onCancelRef = useLatestRef(onCancel);\n const hasOnCancel = Boolean(onCancel);\n\n // A full-page loading covers everything under it, so it joins the stack of\n // open overlays and takes Escape from them while it's on top. One inside a\n // container covers only that, so it stays out and waits, as a Toast does,\n // until no overlay is open.\n const isTopmost = useOverlayStack(active && isFullPage);\n\n // What the overlay covers ignores the mouse already, and is made inert so\n // Tab and screen readers skip it too: the container's other children, or\n // with `isFullPage` the rest of the page.\n const loadingRef = React.useRef<HTMLDivElement>(null);\n useInertSiblings(loadingRef, active, isFullPage);\n\n // Handle escape key. On `window`, as in `Modal`, so a popup on the page has\n // had the key first, and an Escape it closed on doesn't cancel as well. One\n // that cancels is marked used, so nothing under it acts on it too.\n React.useEffect(() => {\n if (!active || !canCancel || !hasOnCancel) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' || e.defaultPrevented || !isTopmost()) return;\n e.preventDefault();\n onCancelRef.current?.();\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [active, canCancel, hasOnCancel, onCancelRef, isTopmost]);\n\n // Prevent body scroll when full page loading is active. Ref-counted through\n // the shared helper so an overlapping Modal/Dialog/Sidebar doesn't have its\n // lock cleared when this one releases.\n useScrollLock(isFullPage && active);\n\n if (!active) {\n return null;\n }\n\n return (\n <div\n className={combinedClasses}\n role=\"alert\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n {...rest}\n ref={loadingRef}\n >\n <div\n className={combinedOverlayClasses}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n <div className={loadingContentClass}>\n {indicator ? (\n <span className={loadingIconCustomClass}>{indicator}</span>\n ) : (\n <span className={combinedIconClasses} />\n )}\n {children && <div className={loadingTextClass}>{children}</div>}\n {canCancel && (\n <button\n type=\"button\"\n className={loadingCancelClass}\n onClick={onCancel}\n aria-label=\"Cancel loading\"\n >\n Cancel\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,OAAO,GAA2B,CAAC,EAC9C,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;;AAG3D,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,eAAe,EAAE,SAAS;AAC1B,QAAA,CAAC,MAAM,OAAO,CAAA,CAAE,GAAG,CAAC,CAAC,OAAO;AAC5B,QAAA,CAAC,MAAM,KAAK,CAAA,CAAE,GAAG,CAAC,CAAC,KAAK;AACzB,KAAA,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,qBAAqB,CAAC,cAAc,EAAE;AACxD,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI;AACrB,KAAA,CAAC;;IAGF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,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,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,CAAC;QACjD,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,CAAC;AACnE,IAAA,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;;;;AAK5D,IAAA,aAAa,CAAC,UAAU,IAAI,MAAM,CAAC;IAEnC,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,OAAO,IAAI;IACb;IAEA,QACEA,cACE,SAAS,EAAE,eAAe,EAC1B,IAAI,EAAC,OAAO,EAAA,WAAA,EACF,MAAM,EAAA,YAAA,EACL,SAAS,KAChB,IAAI,EACR,GAAG,EAAE,UAAU,aAEfC,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,sBAAsB,EACjC,OAAO,EAAE,kBAAkB,iBACf,MAAM,EAAA,CAClB,EACFD,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,mBAAmB,EAAA,QAAA,EAAA,CAChC,SAAS,IACRC,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,sBAAsB,YAAG,SAAS,EAAA,CAAQ,KAE3DA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,mBAAmB,GAAI,CACzC,EACA,QAAQ,IAAIA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,gBAAgB,YAAG,QAAQ,EAAA,CAAO,EAC9D,SAAS,KACRA,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,QAAQ,EAAA,YAAA,EACN,gBAAgB,uBAGpB,CACV,CAAA,EAAA,CACG,CAAA,EAAA,CACF;AAEV;;"}
1
+ {"version":3,"file":"Loading.js","sources":["../../../src/components/Loading.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useScrollLock } from '../helpers/scrollLock';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\nimport { useInertSiblings } from '../helpers/useInertSiblings';\n\n/**\n * Overlay opacity levels for the Loading background.\n */\nexport type LoadingOverlay = 'light' | 'dark' | 'opaque';\n\n/**\n * Color variants for the Loading spinner.\n */\nexport type LoadingColor =\n 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Props for the Loading component.\n * @extraProp {React.ReactNode} [children] - Content to display below the spinner.\n * @extraProp {string} [className] - Additional CSS classes.\n */\nexport interface LoadingProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {\n /**\n * Whether the loading overlay is visible. While it is, what it covers is\n * inert, out of reach of Tab, Enter, Space and screen readers as well as\n * the mouse: the other children of the element it's rendered in, so render\n * it directly inside the element it covers, or with `isFullPage` the rest\n * of the page. Its own content, the cancel button included, stays\n * reachable. Only what's there when it turns on is made inert, and an\n * element that was inert already is left as it was. A control under it\n * that had focus loses it, and gets it back when the loading goes away,\n * unless focus has moved on in the meantime. Show one at a time over the\n * same content: two that cover each other, such as two in one container\n * or two full-page ones, make each other inert, cancel buttons and all.\n */\n active?: boolean;\n /**\n * Cover the entire viewport. While it's active, the rest of the page is\n * inert, as it is under a modal, rather than only the element it's\n * rendered in. A full-page loading also takes its turn with\n * Modal and Sidebar for Escape: while it's the topmost open overlay, the\n * Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or\n * not the loading can be cancelled.\n */\n isFullPage?: boolean;\n /** Size of the loading spinner. */\n size?: 'small' | 'medium' | 'large';\n /** Color variant for the spinner. Default is light grey. */\n color?: LoadingColor;\n /**\n * Show a cancel button and allow closing, by a click on the overlay or by\n * Escape. With `isFullPage`, the loading is an overlay like Modal and\n * Sidebar: only the topmost open overlay answers Escape, so a full-page\n * loading shown over a Modal cancels first, and the Modal closes on the\n * next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or\n * full-page Loading is open. Either way it marks the Escape it cancels on as\n * used with `preventDefault()`. An Escape a popup on the page closed on, by\n * calling `preventDefault()`, doesn't cancel.\n */\n canCancel?: boolean;\n /** Callback when cancel is triggered. */\n onCancel?: () => void;\n /** Additional classes for the overlay. */\n overlayClassName?: string;\n /** Additional classes for the spinner icon. */\n iconClassName?: string;\n /** Custom loading indicator element. */\n indicator?: React.ReactNode;\n /** Style of the loading overlay. */\n overlay?: LoadingOverlay;\n}\n\n/**\n * The `Loading` component provides a loading overlay with a spinner animation.\n *\n * @function\n * @param {LoadingProps} props - Props for the Loading component.\n * @returns {JSX.Element | null} The rendered loading overlay or null if not active.\n *\n * @example\n * // Full page loading\n * <Loading active isFullPage />\n *\n * @example\n * // Container loading with message\n * <div style={{ position: 'relative', height: '200px' }}>\n * <Loading active>Loading data...</Loading>\n * </div>\n *\n * @example\n * // With color variant\n * <Loading active color=\"primary\" />\n *\n * @example\n * // With cancel functionality\n * <Loading\n * active={isLoading}\n * canCancel\n * onCancel={() => setIsLoading(false)}\n * />\n */\nexport const Loading: React.FC<LoadingProps> = ({\n active = false,\n isFullPage = false,\n size,\n color,\n canCancel = false,\n onCancel,\n children,\n className,\n overlayClassName,\n iconClassName,\n indicator,\n overlay,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const loadingClasses = usePrefixedClassNames('loading', {\n 'is-active': active,\n 'is-full-page': isFullPage,\n 'is-cancelable': canCancel,\n [`is-${overlay}`]: !!overlay,\n [`is-${color}`]: !!color,\n });\n\n const iconClasses = usePrefixedClassNames('loading-icon', {\n [`is-${size}`]: size,\n });\n\n // Combine classes\n const combinedClasses = classNames(\n loadingClasses,\n bulmaHelperClasses,\n className\n );\n const combinedOverlayClasses = classNames(\n usePrefixedClassNames('loading-overlay'),\n overlayClassName\n );\n const combinedIconClasses = classNames(iconClasses, iconClassName);\n const loadingContentClass = usePrefixedClassNames('loading-content');\n const loadingIconCustomClass = usePrefixedClassNames('loading-icon-custom');\n const loadingTextClass = usePrefixedClassNames('loading-text');\n const loadingCancelClass = usePrefixedClassNames('loading-cancel');\n\n // Handle cancel click\n const handleOverlayClick = () => {\n if (canCancel && onCancel) {\n onCancel();\n }\n };\n\n // Read when Escape arrives, so the key listener stays put while `onCancel`\n // changes identity, as an inline one does on every render of the parent.\n const onCancelRef = useLatestRef(onCancel);\n const hasOnCancel = Boolean(onCancel);\n\n // A full-page loading covers everything under it, so it joins the stack of\n // open overlays and takes Escape from them while it's on top. One inside a\n // container covers only that, so it stays out and waits, as a Toast does,\n // until no overlay is open.\n const isTopmost = useOverlayStack(active && isFullPage);\n\n // What the overlay covers ignores the mouse already, and is made inert so\n // Tab and screen readers skip it too: the container's other children, or\n // with `isFullPage` the rest of the page.\n const loadingRef = React.useRef<HTMLDivElement>(null);\n useInertSiblings(loadingRef, active, isFullPage);\n\n // Handle escape key. On `window`, as in `Modal`, so a popup on the page has\n // had the key first, and an Escape it closed on doesn't cancel as well. One\n // that cancels is marked used, so nothing under it acts on it too.\n React.useEffect(() => {\n if (!active || !canCancel || !hasOnCancel) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' || e.defaultPrevented || !isTopmost()) return;\n e.preventDefault();\n onCancelRef.current?.();\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [active, canCancel, hasOnCancel, onCancelRef, isTopmost]);\n\n // Lock the page's scrolling when full page loading is active. Ref-counted\n // through the shared helper so an overlapping Modal/Dialog/Sidebar doesn't\n // have its lock cleared when this one releases.\n useScrollLock(isFullPage && active);\n\n if (!active) {\n return null;\n }\n\n return (\n <div\n className={combinedClasses}\n role=\"alert\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n {...rest}\n ref={loadingRef}\n >\n <div\n className={combinedOverlayClasses}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n <div className={loadingContentClass}>\n {indicator ? (\n <span className={loadingIconCustomClass}>{indicator}</span>\n ) : (\n <span className={combinedIconClasses} />\n )}\n {children && <div className={loadingTextClass}>{children}</div>}\n {canCancel && (\n <button\n type=\"button\"\n className={loadingCancelClass}\n onClick={onCancel}\n aria-label=\"Cancel loading\"\n >\n Cancel\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,OAAO,GAA2B,CAAC,EAC9C,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;;AAG3D,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,eAAe,EAAE,SAAS;AAC1B,QAAA,CAAC,MAAM,OAAO,CAAA,CAAE,GAAG,CAAC,CAAC,OAAO;AAC5B,QAAA,CAAC,MAAM,KAAK,CAAA,CAAE,GAAG,CAAC,CAAC,KAAK;AACzB,KAAA,CAAC;AAEF,IAAA,MAAM,WAAW,GAAG,qBAAqB,CAAC,cAAc,EAAE;AACxD,QAAA,CAAC,CAAA,GAAA,EAAM,IAAI,CAAA,CAAE,GAAG,IAAI;AACrB,KAAA,CAAC;;IAGF,MAAM,eAAe,GAAG,UAAU,CAChC,cAAc,EACd,kBAAkB,EAClB,SAAS,CACV;IACD,MAAM,sBAAsB,GAA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