@allxsmith/bestax-bulma 5.66.1 → 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.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/Command.js.map +1 -1
- package/dist/esm/components/HoverCard.js.map +1 -1
- package/dist/esm/components/Loading.js +3 -3
- package/dist/esm/components/Loading.js.map +1 -1
- package/dist/esm/components/Modal.js.map +1 -1
- package/dist/esm/components/Popover.js.map +1 -1
- package/dist/esm/components/Sidebar.js +21 -29
- package/dist/esm/components/Sidebar.js.map +1 -1
- package/dist/esm/components/Toast.js +6 -8
- package/dist/esm/components/Toast.js.map +1 -1
- package/dist/esm/elements/IconButton.js.map +1 -1
- package/dist/esm/form/Combobox.js.map +1 -1
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateRangeInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/TreeSelect.js.map +1 -1
- package/dist/esm/form/_pickerInternals/Calendar.js +12 -5
- package/dist/esm/form/_pickerInternals/Calendar.js.map +1 -1
- package/dist/esm/form/_pickerInternals/PickerPopover.js +6 -2
- package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
- package/dist/esm/helpers/scrollLock.js +47 -11
- package/dist/esm/helpers/scrollLock.js.map +1 -1
- package/dist/esm/helpers/useAnchoredPosition.js +35 -11
- package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
- package/dist/esm/layout/Level.js +2 -2
- package/dist/esm/layout/Level.js.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +128 -65
- package/dist/index.cjs.map +1 -1
- package/dist/types/components/Command.d.ts +5 -5
- package/dist/types/components/HoverCard.d.ts +2 -4
- package/dist/types/components/Modal.d.ts +6 -3
- package/dist/types/components/Popover.d.ts +1 -3
- package/dist/types/components/Sidebar.d.ts +6 -2
- package/dist/types/components/Toast.d.ts +3 -1
- package/dist/types/elements/IconButton.d.ts +2 -5
- package/dist/types/form/Combobox.d.ts +13 -13
- package/dist/types/form/DateInputBase.d.ts +8 -1
- package/dist/types/form/DateRangeInputBase.d.ts +5 -0
- package/dist/types/form/DateTimeInputBase.d.ts +8 -1
- package/dist/types/form/TreeSelect.d.ts +4 -4
- package/dist/types/helpers/scrollLock.d.ts +4 -4
- package/dist/types/helpers/useAnchoredPosition.d.ts +14 -12
- package/dist/types/layout/Level.d.ts +10 -0
- package/dist/types-cjs/components/Command.d.ts +5 -5
- package/dist/types-cjs/components/HoverCard.d.ts +2 -4
- package/dist/types-cjs/components/Modal.d.ts +6 -3
- package/dist/types-cjs/components/Popover.d.ts +1 -3
- package/dist/types-cjs/components/Sidebar.d.ts +6 -2
- package/dist/types-cjs/components/Toast.d.ts +3 -1
- package/dist/types-cjs/elements/IconButton.d.ts +2 -5
- package/dist/types-cjs/form/Combobox.d.ts +13 -13
- package/dist/types-cjs/form/DateInputBase.d.ts +8 -1
- package/dist/types-cjs/form/DateRangeInputBase.d.ts +5 -0
- package/dist/types-cjs/form/DateTimeInputBase.d.ts +8 -1
- package/dist/types-cjs/form/TreeSelect.d.ts +4 -4
- package/dist/types-cjs/helpers/scrollLock.d.ts +4 -4
- package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +14 -12
- package/dist/types-cjs/layout/Level.d.ts +10 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/CLAUDE.md +25 -2
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_loading.scss +17 -3
- package/src/scss/components/_navbar.scss +20 -0
- package/src/scss/form/_radio.scss +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.js","sources":["../../../src/components/Toast.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useCallback,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { isEventInside } from '../helpers/shadowDom';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { usePortalContainer } from '../helpers/portal';\nimport { LocalePortalScope } from '../helpers/LocaleProvider';\nimport { groupIntoPositionStacks } from '../helpers/positionStacks';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\n\n/** Color/style type presets for toast messages. */\nexport type ToastType =\n 'default' | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/** Screen positions where toasts can be displayed. */\nexport type ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n\n/**\n * Props for the Toast component.\n * @extraProp {string} [className] - Additional CSS classes.\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the toast element.\n */\nexport interface ToastProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color'> {\n /** The message to display (required). */\n message: string;\n /** Color variant — colors the toast **background**. */\n type?: ToastType;\n /** Color variant — colors the **action button** text. */\n actionType?: ToastType;\n /**\n * Position on the screen. Default: 'top-right'. On a standalone `<Toast>`\n * this places it. Through `toast.show()` it places that toast, and a toast\n * shown without one goes to `ToastContainer`'s `position` instead.\n */\n position?: ToastPosition;\n /** Duration in ms before auto-close. `0` disables auto-close. */\n duration?: number;\n /** Keeps the toast visible until dismissed. */\n indefinite?: boolean;\n /** Whether clicking the toast (or outside it) dismisses it. */\n dismissible?: boolean;\n /** Show an explicit close (X) button. Default: false. */\n closable?: boolean;\n /** Pill-shaped (rounded corners). */\n rounded?: boolean;\n /** Pause auto-close timer on hover. Default: false. */\n pauseOnHover?: boolean;\n /**\n * Whether the toast can be dismissed with Escape. While a Modal, Dialog,\n * Sidebar or full-page Loading is open, Escape goes to that overlay and the\n * toast stays up, so Escape dismisses the toast once none is open. An\n * Escape a popup on the page closed on, by calling `preventDefault()`,\n * leaves it up too. Default: true.\n */\n cancelable?: boolean;\n /** Text for an action button (e.g. \"Undo\"). */\n actionText?: string;\n /** Text for a cancel button. */\n cancelText?: string;\n /** Callback when the action button is clicked. */\n onAction?: () => void;\n /** Callback when toast closes. */\n onClose?: () => void;\n /**\n * CSS selector or DOM node to mount the toast into. Through `toast.show()`,\n * a toast with one portals there in a box of its own, rather than joining\n * `ToastContainer`'s stack for its position.\n */\n container?: string | HTMLElement;\n /**\n * Renders inline instead of using a portal. Through `toast.show()`, a toast\n * already renders inline in `ToastContainer`'s stack for its position, and\n * `inline` keeps one with a `container` in that stack too.\n */\n inline?: boolean;\n}\n\n/**\n * The `Toast` component provides brief notification messages with optional action and cancel buttons.\n *\n * @function\n * @param {ToastProps} props - Props for the Toast component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the toast element.\n * @returns {JSX.Element | null} The rendered toast component.\n *\n * @example\n * // Basic toast\n * <Toast message=\"Operation successful!\" type=\"success\" />\n *\n * @example\n * // Toast with action button\n * <Toast message=\"Item deleted\" actionText=\"Undo\" onAction={handleUndo} />\n */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n message,\n type = 'default',\n actionType,\n position = 'top-right',\n duration = 2000,\n indefinite = false,\n dismissible = true,\n closable = false,\n rounded = false,\n pauseOnHover = false,\n cancelable = true,\n actionText,\n cancelText,\n onAction,\n onClose,\n container,\n inline = false,\n className,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const resolveContainer = usePortalContainer();\n const [isVisible, setIsVisible] = useState(true);\n const [isPaused, setIsPaused] = useState(false);\n const toastRef = useRef<HTMLDivElement | null>(null);\n\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const handleClose = useCallback(() => {\n setIsVisible(false);\n onClose?.();\n }, [onClose]);\n\n const handleAction = useCallback(() => {\n onAction?.();\n handleClose();\n }, [onAction, handleClose]);\n\n // Read when the timer runs out, a click lands outside or Escape arrives,\n // so the timer and the listeners stay put while `onClose` changes\n // identity, as an inline one does on every render of the parent. An\n // inline one from `ToastContainer` changes whenever another toast shows.\n const handleCloseRef = useLatestRef(handleClose);\n\n useEffect(() => {\n if (indefinite || duration === 0 || isPaused) return undefined;\n\n const timer = setTimeout(() => {\n handleCloseRef.current();\n }, duration);\n\n return () => clearTimeout(timer);\n }, [duration, indefinite, isPaused, handleCloseRef]);\n\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(true);\n }\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(false);\n }\n }, [pauseOnHover]);\n\n // Click-outside dismiss — deferred so the click that spawned the toast\n // doesn't immediately dismiss it before it's even visible.\n useEffect(() => {\n if (!dismissible || !isVisible) return undefined;\n\n const handleDocumentClick = (e: MouseEvent) => {\n if (toastRef.current && !isEventInside(e, toastRef.current)) {\n handleCloseRef.current();\n }\n };\n\n const raf = requestAnimationFrame(() => {\n document.addEventListener('click', handleDocumentClick);\n });\n\n return () => {\n cancelAnimationFrame(raf);\n document.removeEventListener('click', handleDocumentClick);\n };\n }, [dismissible, isVisible, handleCloseRef]);\n\n // A toast is a notification rather than a layer, so it never joins the\n // stack of open overlays. Asking the stack tells it whether one is open:\n // an Escape while one is belongs to the overlay, and the toast waits.\n const isTopmost = useOverlayStack(false);\n\n // On `window`, as in `Modal`, so a popup on the page has had the key\n // first, and an Escape it closed on doesn't dismiss the toast as well.\n useEffect(() => {\n if (!cancelable || !isVisible) return undefined;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented && isTopmost()) {\n handleCloseRef.current();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [cancelable, isVisible, handleCloseRef, isTopmost]);\n\n const containerClasses = usePrefixedClassNames('toast-container', {\n [`is-${position}`]: true,\n });\n\n const toastClasses = usePrefixedClassNames('toast', {\n [`is-${type}`]: type !== 'default',\n [`is-action-${actionType}`]: !!actionType && actionType !== 'default',\n 'is-rounded': rounded,\n });\n\n const combinedClasses = classNames(\n toastClasses,\n bulmaHelperClasses,\n className\n );\n const toastMessageClass = usePrefixedClassNames('toast-message');\n const toastActionsClass = usePrefixedClassNames('toast-actions');\n const toastCancelClass = usePrefixedClassNames('toast-cancel');\n const toastActionClass = usePrefixedClassNames('toast-action');\n const toastButtonClass = usePrefixedClassNames('button');\n const toastCloseClass = usePrefixedClassNames('delete', 'is-small');\n\n const setRef = useCallback(\n (node: HTMLDivElement | null) => {\n toastRef.current = node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches by\n // running it instead of calling the ref with `null`; React 18 discards the\n // return value entirely. Returning it from here would be a React-19-only\n // contract, so we hold the cleanup and run it ourselves on detach — the\n // same shape as `Dropdown`, `Modal`, `Dialog`, `Sidebar` and `Carousel`.\n // The form controls that merge a forwarded ref still discard the cleanup\n // and detach with `ref(null)`, so this is not yet library-wide — grep\n // `typeof ref === 'function'` for the current split. Memoized because an\n // unstable ref identity makes React detach and re-attach on every render,\n // which would run that cleanup each time.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n if (!isVisible) {\n return null;\n }\n\n const toastElement = (\n <div\n ref={setRef}\n className={combinedClasses}\n role=\"alert\"\n aria-live={\n type === 'danger' || type === 'warning' ? 'assertive' : 'polite'\n }\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onClick={dismissible ? handleClose : undefined}\n {...rest}\n >\n <span className={toastMessageClass}>{message}</span>\n {(cancelText || actionText) && (\n <div className={toastActionsClass}>\n {cancelText && (\n <span className={toastCancelClass}>\n <button\n type=\"button\"\n className={toastButtonClass}\n onClick={e => {\n e.stopPropagation();\n handleClose();\n }}\n >\n {cancelText}\n </button>\n </span>\n )}\n {actionText && (\n <span className={toastActionClass}>\n <button\n type=\"button\"\n className={toastButtonClass}\n onClick={e => {\n e.stopPropagation();\n handleAction();\n }}\n >\n {actionText}\n </button>\n </span>\n )}\n </div>\n )}\n {closable && (\n <button\n type=\"button\"\n className={toastCloseClass}\n onClick={e => {\n e.stopPropagation();\n handleClose();\n }}\n aria-label=\"Close\"\n />\n )}\n </div>\n );\n\n if (inline) {\n return toastElement;\n }\n\n const toastContent = <div className={containerClasses}>{toastElement}</div>;\n\n if (typeof document !== 'undefined') {\n const target = resolveContainer(container);\n return createPortal(\n <LocalePortalScope target={target}>{toastContent}</LocalePortalScope>,\n target\n );\n }\n\n return null;\n }\n);\n\nToast.displayName = 'Toast';\n\n// Toast Manager for programmatic toasts\n\n/**\n * Options for showing a programmatic toast. Extends ToastProps with a required message.\n */\nexport interface ToastOptions extends Omit<ToastProps, 'message'> {\n /** The message to display. */\n message: string;\n /**\n * When true, toasts enter a FIFO queue and display one at a time, one queue\n * across every `position`. Default false.\n */\n queue?: boolean;\n}\n\n/**\n * Internal representation of a toast instance.\n */\nexport interface ToastInstance {\n /** Unique identifier for this toast. */\n id: string;\n /** Configuration options for the toast. */\n props: ToastOptions;\n}\n\nlet toastId = 0;\nconst toastListeners: Set<(toasts: ToastInstance[]) => void> = new Set();\nlet toasts: ToastInstance[] = [];\n\n// Queued toasts: FIFO queue, one at a time\nlet queuedToasts: ToastInstance[] = [];\nlet currentQueuedToast: ToastInstance | null = null;\n\n// The server has nowhere to portal a toast to, and its copy of this module is\n// shared by every request, so server rendering reads an empty list. Hydration\n// reads it too, which keeps the first client render matching the server's.\nconst noToasts: ToastInstance[] = [];\nconst getServerToasts = () => noToasts;\n\n// What a container shows right now: the stacked toasts, then the queued one on\n// screen. ToastContainer renders from this rather than from updates alone, so\n// toasts raised before it mounted still appear. It is replaced rather than\n// mutated, and only when listeners are notified, because useSyncExternalStore\n// needs the same array back between changes. An empty list is `noToasts`\n// itself, so a container that hydrates with nothing to show reads the same\n// snapshot the server did and has no reason to render again.\nlet visibleToasts: ToastInstance[] = noToasts;\nconst getVisibleToasts = () => visibleToasts;\n\nconst notifyListeners = () => {\n const allVisible = [...toasts];\n if (currentQueuedToast) {\n allVisible.push(currentQueuedToast);\n }\n visibleToasts = allVisible.length > 0 ? allVisible : noToasts;\n toastListeners.forEach(listener => listener([...allVisible]));\n};\n\nconst processQueuedToast = () => {\n if (currentQueuedToast || queuedToasts.length === 0) return;\n currentQueuedToast = queuedToasts.shift()!;\n notifyListeners();\n};\n\n/**\n * Programmatic toast API for showing, closing, and managing toasts.\n *\n * @example\n * toast.success('Saved!');\n * toast.show({ message: 'Item deleted', actionText: 'Undo', onAction: handleUndo });\n */\nexport const toast = {\n /**\n * Show a toast with the given options.\n * @param {ToastOptions} options - Toast configuration.\n * @returns {string} The unique ID of the created toast.\n */\n show: (options: ToastOptions): string => {\n const id = `toast-${++toastId}`;\n const instance = { id, props: options };\n\n if (options.queue) {\n queuedToasts.push(instance);\n processQueuedToast();\n } else {\n toasts.push(instance);\n notifyListeners();\n }\n\n return id;\n },\n\n /**\n * Show a success toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n success: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'success', ...options });\n },\n\n /**\n * Show a danger toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n danger: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'danger', ...options });\n },\n\n /**\n * Show a warning toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n warning: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'warning', ...options });\n },\n\n /**\n * Show an info toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n info: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'info', ...options });\n },\n\n /**\n * Close a specific toast by ID.\n * @param {string} id - The toast ID to close.\n */\n close: (id: string): void => {\n if (currentQueuedToast && currentQueuedToast.id === id) {\n currentQueuedToast = null;\n processQueuedToast();\n } else {\n queuedToasts = queuedToasts.filter(t => t.id !== id);\n toasts = toasts.filter(t => t.id !== id);\n }\n notifyListeners();\n },\n\n /** Close all toasts and clear the queue. */\n closeAll: (): void => {\n toasts = [];\n queuedToasts = [];\n currentQueuedToast = null;\n notifyListeners();\n },\n\n /**\n * Subscribe to toast state changes.\n * @param {(toasts: ToastInstance[]) => void} listener - Callback invoked on changes.\n * @returns {() => void} Unsubscribe function.\n */\n subscribe: (listener: (toasts: ToastInstance[]) => void): (() => void) => {\n toastListeners.add(listener);\n return () => toastListeners.delete(listener);\n },\n};\n\n// The order ToastContainer renders its stacks in: across the top of the\n// screen, then across the bottom.\nconst toastStackOrder: readonly ToastPosition[] = [\n 'top-left',\n 'top-center',\n 'top-right',\n 'bottom-left',\n 'bottom-center',\n 'bottom-right',\n];\n\n/**\n * Container component for rendering programmatic toasts.\n * Place once at your app root to enable the toast API. A toast shown with a\n * `position` appears there, and one shown without goes to the container's\n * `position`. The toasts at one position stack in one `.toast-container`,\n * with a gap between them, in the order they were shown, growing away from\n * the edge of the screen. A toast shown with a `container` of its own, and\n * not `inline`, portals there instead, in a box of its own.\n *\n * @function\n * @param {{ position?: ToastPosition }} props - Container props.\n * @returns {JSX.Element | null} The rendered toast container, or null if empty.\n */\nexport const ToastContainer: React.FC<{\n /**\n * Where a toast shown without a `position` of its own appears. Default:\n * 'top-right'. When it changes, those toasts move without remounting, but\n * one shown with its own `position` equal to the old or new value\n * remounts and starts over as if it had just been shown.\n */\n position?: ToastPosition;\n}> = ({ position = 'top-right' }) => {\n // Starts from the toasts already showing instead of an empty list, then\n // follows changes.\n const toastList = useSyncExternalStore(\n toast.subscribe,\n getVisibleToasts,\n getServerToasts\n );\n const resolveContainer = usePortalContainer();\n const classPrefix = useClassPrefix();\n\n if (typeof document === 'undefined' || toastList.length === 0) {\n return null;\n }\n\n // A toast shown with a `container` of its own, and not `inline`, portals\n // there in a box of its own. Every other toast renders inline in the stack\n // for its position, so the toasts at one position stack instead of each\n // sitting in a box of its own on top of the others. An empty `container`\n // falls back to the page, as it does on a Toast, so it means none here.\n const ownsContainer = (t: ToastInstance) =>\n !!t.props.container && !t.props.inline;\n const renderToast = (\n t: ToastInstance,\n at: ToastPosition,\n inline: boolean\n ) => {\n const { queue: _queue, ...toastProps } = t.props;\n return (\n <Toast\n key={t.id}\n {...toastProps}\n position={at}\n inline={inline}\n onClose={() => toast.close(t.id)}\n />\n );\n };\n\n const stacks = groupIntoPositionStacks(\n toastList.filter(t => !ownsContainer(t)),\n t => t.props.position,\n position,\n toastStackOrder\n );\n\n const target = resolveContainer();\n return createPortal(\n <LocalePortalScope target={target}>\n {stacks.map(stack => (\n <div\n key={stack.key}\n className={prefixedClassNames(\n classPrefix,\n 'toast-container',\n `is-${stack.position}`\n )}\n >\n {stack.items.map(t => renderToast(t, stack.position, true))}\n </div>\n ))}\n {toastList\n .filter(ownsContainer)\n .map(t => render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AAE,CACvB,EAAA,QAAA,EAEA,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAA,EAPtD,KAAK,CAAC,GAAG,CAQV,CACP,CAAC,EACD;iBACE,MAAM,CAAC,aAAa;iBACpB,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA,EAAA,CAC9C,EACpB,MAAM,CACP;AACH;;"}
|
|
1
|
+
{"version":3,"file":"Toast.js","sources":["../../../src/components/Toast.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useEffect,\n useRef,\n useState,\n useCallback,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { isEventInside } from '../helpers/shadowDom';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useClassPrefix } from '../helpers/Config';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { Portal, usePortalContainer, usePortalProp } from '../helpers/portal';\nimport { LocalePortalScope } from '../helpers/LocaleProvider';\nimport { groupIntoPositionStacks } from '../helpers/positionStacks';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\n\n/** Color/style type presets for toast messages. */\nexport type ToastType =\n 'default' | 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/** Screen positions where toasts can be displayed. */\nexport type ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n\n/**\n * Props for the Toast component.\n * @extraProp {string} [className] - Additional CSS classes.\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the toast element.\n */\nexport interface ToastProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color'> {\n /** The message to display (required). */\n message: string;\n /** Color variant — colors the toast **background**. */\n type?: ToastType;\n /** Color variant — colors the **action button** text. */\n actionType?: ToastType;\n /**\n * Position on the screen. Default: 'top-right'. On a standalone `<Toast>`\n * this places it. Through `toast.show()` it places that toast, and a toast\n * shown without one goes to `ToastContainer`'s `position` instead.\n */\n position?: ToastPosition;\n /** Duration in ms before auto-close. `0` disables auto-close. */\n duration?: number;\n /** Keeps the toast visible until dismissed. */\n indefinite?: boolean;\n /** Whether clicking the toast (or outside it) dismisses it. */\n dismissible?: boolean;\n /** Show an explicit close (X) button. Default: false. */\n closable?: boolean;\n /** Pill-shaped (rounded corners). */\n rounded?: boolean;\n /** Pause auto-close timer on hover. Default: false. */\n pauseOnHover?: boolean;\n /**\n * Whether the toast can be dismissed with Escape. While a Modal, Dialog,\n * Sidebar or full-page Loading is open, Escape goes to that overlay and the\n * toast stays up, so Escape dismisses the toast once none is open. An\n * Escape a popup on the page closed on, by calling `preventDefault()`,\n * leaves it up too. Default: true.\n */\n cancelable?: boolean;\n /** Text for an action button (e.g. \"Undo\"). */\n actionText?: string;\n /** Text for a cancel button. */\n cancelText?: string;\n /** Callback when the action button is clicked. */\n onAction?: () => void;\n /** Callback when toast closes. */\n onClose?: () => void;\n /**\n * CSS selector or DOM node to mount the toast into. Through `toast.show()`,\n * a toast with one portals there in a box of its own, rather than joining\n * `ToastContainer`'s stack for its position.\n */\n container?: string | HTMLElement;\n /**\n * Renders inline instead of using a portal. Without it, a toast renders\n * inline on the server and while hydrating, moving into the portal once the\n * client takes over, so hydration matches. Through `toast.show()`, a toast\n * already renders inline in `ToastContainer`'s stack for its position, and\n * `inline` keeps one with a `container` in that stack too.\n */\n inline?: boolean;\n}\n\n/**\n * The `Toast` component provides brief notification messages with optional action and cancel buttons.\n *\n * @function\n * @param {ToastProps} props - Props for the Toast component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the toast element.\n * @returns {JSX.Element | null} The rendered toast component.\n *\n * @example\n * // Basic toast\n * <Toast message=\"Operation successful!\" type=\"success\" />\n *\n * @example\n * // Toast with action button\n * <Toast message=\"Item deleted\" actionText=\"Undo\" onAction={handleUndo} />\n */\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n message,\n type = 'default',\n actionType,\n position = 'top-right',\n duration = 2000,\n indefinite = false,\n dismissible = true,\n closable = false,\n rounded = false,\n pauseOnHover = false,\n cancelable = true,\n actionText,\n cancelText,\n onAction,\n onClose,\n container,\n inline = false,\n className,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n // A portal has no server-rendered counterpart, so the toast renders in\n // place on the server and while hydrating, and moves into its portal\n // once the client takes over, as Modal's `portal` does.\n const portal = usePortalProp(container || true);\n const [isVisible, setIsVisible] = useState(true);\n const [isPaused, setIsPaused] = useState(false);\n const toastRef = useRef<HTMLDivElement | null>(null);\n\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const handleClose = useCallback(() => {\n setIsVisible(false);\n onClose?.();\n }, [onClose]);\n\n const handleAction = useCallback(() => {\n onAction?.();\n handleClose();\n }, [onAction, handleClose]);\n\n // Read when the timer runs out, a click lands outside or Escape arrives,\n // so the timer and the listeners stay put while `onClose` changes\n // identity, as an inline one does on every render of the parent. An\n // inline one from `ToastContainer` changes whenever another toast shows.\n const handleCloseRef = useLatestRef(handleClose);\n\n useEffect(() => {\n if (indefinite || duration === 0 || isPaused) return undefined;\n\n const timer = setTimeout(() => {\n handleCloseRef.current();\n }, duration);\n\n return () => clearTimeout(timer);\n }, [duration, indefinite, isPaused, handleCloseRef]);\n\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(true);\n }\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(false);\n }\n }, [pauseOnHover]);\n\n // Click-outside dismiss — deferred so the click that spawned the toast\n // doesn't immediately dismiss it before it's even visible.\n useEffect(() => {\n if (!dismissible || !isVisible) return undefined;\n\n const handleDocumentClick = (e: MouseEvent) => {\n if (toastRef.current && !isEventInside(e, toastRef.current)) {\n handleCloseRef.current();\n }\n };\n\n const raf = requestAnimationFrame(() => {\n document.addEventListener('click', handleDocumentClick);\n });\n\n return () => {\n cancelAnimationFrame(raf);\n document.removeEventListener('click', handleDocumentClick);\n };\n }, [dismissible, isVisible, handleCloseRef]);\n\n // A toast is a notification rather than a layer, so it never joins the\n // stack of open overlays. Asking the stack tells it whether one is open:\n // an Escape while one is belongs to the overlay, and the toast waits.\n const isTopmost = useOverlayStack(false);\n\n // On `window`, as in `Modal`, so a popup on the page has had the key\n // first, and an Escape it closed on doesn't dismiss the toast as well.\n useEffect(() => {\n if (!cancelable || !isVisible) return undefined;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && !e.defaultPrevented && isTopmost()) {\n handleCloseRef.current();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [cancelable, isVisible, handleCloseRef, isTopmost]);\n\n const containerClasses = usePrefixedClassNames('toast-container', {\n [`is-${position}`]: true,\n });\n\n const toastClasses = usePrefixedClassNames('toast', {\n [`is-${type}`]: type !== 'default',\n [`is-action-${actionType}`]: !!actionType && actionType !== 'default',\n 'is-rounded': rounded,\n });\n\n const combinedClasses = classNames(\n toastClasses,\n bulmaHelperClasses,\n className\n );\n const toastMessageClass = usePrefixedClassNames('toast-message');\n const toastActionsClass = usePrefixedClassNames('toast-actions');\n const toastCancelClass = usePrefixedClassNames('toast-cancel');\n const toastActionClass = usePrefixedClassNames('toast-action');\n const toastButtonClass = usePrefixedClassNames('button');\n const toastCloseClass = usePrefixedClassNames('delete', 'is-small');\n\n const setRef = useCallback(\n (node: HTMLDivElement | null) => {\n toastRef.current = node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches by\n // running it instead of calling the ref with `null`; React 18 discards the\n // return value entirely. Returning it from here would be a React-19-only\n // contract, so we hold the cleanup and run it ourselves on detach — the\n // same shape as `Dropdown`, `Modal`, `Dialog`, `Sidebar` and `Carousel`.\n // The form controls that merge a forwarded ref still discard the cleanup\n // and detach with `ref(null)`, so this is not yet library-wide — grep\n // `typeof ref === 'function'` for the current split. Memoized because an\n // unstable ref identity makes React detach and re-attach on every render,\n // which would run that cleanup each time.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n if (!isVisible) {\n return null;\n }\n\n const toastElement = (\n <div\n ref={setRef}\n className={combinedClasses}\n role=\"alert\"\n aria-live={\n type === 'danger' || type === 'warning' ? 'assertive' : 'polite'\n }\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onClick={dismissible ? handleClose : undefined}\n {...rest}\n >\n <span className={toastMessageClass}>{message}</span>\n {(cancelText || actionText) && (\n <div className={toastActionsClass}>\n {cancelText && (\n <span className={toastCancelClass}>\n <button\n type=\"button\"\n className={toastButtonClass}\n onClick={e => {\n e.stopPropagation();\n handleClose();\n }}\n >\n {cancelText}\n </button>\n </span>\n )}\n {actionText && (\n <span className={toastActionClass}>\n <button\n type=\"button\"\n className={toastButtonClass}\n onClick={e => {\n e.stopPropagation();\n handleAction();\n }}\n >\n {actionText}\n </button>\n </span>\n )}\n </div>\n )}\n {closable && (\n <button\n type=\"button\"\n className={toastCloseClass}\n onClick={e => {\n e.stopPropagation();\n handleClose();\n }}\n aria-label=\"Close\"\n />\n )}\n </div>\n );\n\n if (inline) {\n return toastElement;\n }\n\n return (\n <Portal disabled={!portal.isPortaled} container={portal.container}>\n <div className={containerClasses}>{toastElement}</div>\n </Portal>\n );\n }\n);\n\nToast.displayName = 'Toast';\n\n// Toast Manager for programmatic toasts\n\n/**\n * Options for showing a programmatic toast. Extends ToastProps with a required message.\n */\nexport interface ToastOptions extends Omit<ToastProps, 'message'> {\n /** The message to display. */\n message: string;\n /**\n * When true, toasts enter a FIFO queue and display one at a time, one queue\n * across every `position`. Default false.\n */\n queue?: boolean;\n}\n\n/**\n * Internal representation of a toast instance.\n */\nexport interface ToastInstance {\n /** Unique identifier for this toast. */\n id: string;\n /** Configuration options for the toast. */\n props: ToastOptions;\n}\n\nlet toastId = 0;\nconst toastListeners: Set<(toasts: ToastInstance[]) => void> = new Set();\nlet toasts: ToastInstance[] = [];\n\n// Queued toasts: FIFO queue, one at a time\nlet queuedToasts: ToastInstance[] = [];\nlet currentQueuedToast: ToastInstance | null = null;\n\n// The server has nowhere to portal a toast to, and its copy of this module is\n// shared by every request, so server rendering reads an empty list. Hydration\n// reads it too, which keeps the first client render matching the server's.\nconst noToasts: ToastInstance[] = [];\nconst getServerToasts = () => noToasts;\n\n// What a container shows right now: the stacked toasts, then the queued one on\n// screen. ToastContainer renders from this rather than from updates alone, so\n// toasts raised before it mounted still appear. It is replaced rather than\n// mutated, and only when listeners are notified, because useSyncExternalStore\n// needs the same array back between changes. An empty list is `noToasts`\n// itself, so a container that hydrates with nothing to show reads the same\n// snapshot the server did and has no reason to render again.\nlet visibleToasts: ToastInstance[] = noToasts;\nconst getVisibleToasts = () => visibleToasts;\n\nconst notifyListeners = () => {\n const allVisible = [...toasts];\n if (currentQueuedToast) {\n allVisible.push(currentQueuedToast);\n }\n visibleToasts = allVisible.length > 0 ? allVisible : noToasts;\n toastListeners.forEach(listener => listener([...allVisible]));\n};\n\nconst processQueuedToast = () => {\n if (currentQueuedToast || queuedToasts.length === 0) return;\n currentQueuedToast = queuedToasts.shift()!;\n notifyListeners();\n};\n\n/**\n * Programmatic toast API for showing, closing, and managing toasts.\n *\n * @example\n * toast.success('Saved!');\n * toast.show({ message: 'Item deleted', actionText: 'Undo', onAction: handleUndo });\n */\nexport const toast = {\n /**\n * Show a toast with the given options.\n * @param {ToastOptions} options - Toast configuration.\n * @returns {string} The unique ID of the created toast.\n */\n show: (options: ToastOptions): string => {\n const id = `toast-${++toastId}`;\n const instance = { id, props: options };\n\n if (options.queue) {\n queuedToasts.push(instance);\n processQueuedToast();\n } else {\n toasts.push(instance);\n notifyListeners();\n }\n\n return id;\n },\n\n /**\n * Show a success toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n success: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'success', ...options });\n },\n\n /**\n * Show a danger toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n danger: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'danger', ...options });\n },\n\n /**\n * Show a warning toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n warning: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'warning', ...options });\n },\n\n /**\n * Show an info toast.\n * @param {string} message - The message to display.\n * @param {Partial<ToastOptions>} [options] - Additional options.\n * @returns {string} The toast ID.\n */\n info: (message: string, options?: Partial<ToastOptions>): string => {\n return toast.show({ message, type: 'info', ...options });\n },\n\n /**\n * Close a specific toast by ID.\n * @param {string} id - The toast ID to close.\n */\n close: (id: string): void => {\n if (currentQueuedToast && currentQueuedToast.id === id) {\n currentQueuedToast = null;\n processQueuedToast();\n } else {\n queuedToasts = queuedToasts.filter(t => t.id !== id);\n toasts = toasts.filter(t => t.id !== id);\n }\n notifyListeners();\n },\n\n /** Close all toasts and clear the queue. */\n closeAll: (): void => {\n toasts = [];\n queuedToasts = [];\n currentQueuedToast = null;\n notifyListeners();\n },\n\n /**\n * Subscribe to toast state changes.\n * @param {(toasts: ToastInstance[]) => void} listener - Callback invoked on changes.\n * @returns {() => void} Unsubscribe function.\n */\n subscribe: (listener: (toasts: ToastInstance[]) => void): (() => void) => {\n toastListeners.add(listener);\n return () => toastListeners.delete(listener);\n },\n};\n\n// The order ToastContainer renders its stacks in: across the top of the\n// screen, then across the bottom.\nconst toastStackOrder: readonly ToastPosition[] = [\n 'top-left',\n 'top-center',\n 'top-right',\n 'bottom-left',\n 'bottom-center',\n 'bottom-right',\n];\n\n/**\n * Container component for rendering programmatic toasts.\n * Place once at your app root to enable the toast API. A toast shown with a\n * `position` appears there, and one shown without goes to the container's\n * `position`. The toasts at one position stack in one `.toast-container`,\n * with a gap between them, in the order they were shown, growing away from\n * the edge of the screen. A toast shown with a `container` of its own, and\n * not `inline`, portals there instead, in a box of its own.\n *\n * @function\n * @param {{ position?: ToastPosition }} props - Container props.\n * @returns {JSX.Element | null} The rendered toast container, or null if empty.\n */\nexport const ToastContainer: React.FC<{\n /**\n * Where a toast shown without a `position` of its own appears. Default:\n * 'top-right'. When it changes, those toasts move without remounting, but\n * one shown with its own `position` equal to the old or new value\n * remounts and starts over as if it had just been shown.\n */\n position?: ToastPosition;\n}> = ({ position = 'top-right' }) => {\n // Starts from the toasts already showing instead of an empty list, then\n // follows changes.\n const toastList = useSyncExternalStore(\n toast.subscribe,\n getVisibleToasts,\n getServerToasts\n );\n const resolveContainer = usePortalContainer();\n const classPrefix = useClassPrefix();\n\n if (typeof document === 'undefined' || toastList.length === 0) {\n return null;\n }\n\n // A toast shown with a `container` of its own, and not `inline`, portals\n // there in a box of its own. Every other toast renders inline in the stack\n // for its position, so the toasts at one position stack instead of each\n // sitting in a box of its own on top of the others. An empty `container`\n // falls back to the page, as it does on a Toast, so it means none here.\n const ownsContainer = (t: ToastInstance) =>\n !!t.props.container && !t.props.inline;\n const renderToast = (\n t: ToastInstance,\n at: ToastPosition,\n inline: boolean\n ) => {\n const { queue: _queue, ...toastProps } = t.props;\n return (\n <Toast\n key={t.id}\n {...toastProps}\n position={at}\n inline={inline}\n onClose={() => toast.close(t.id)}\n />\n );\n };\n\n const stacks = groupIntoPositionStacks(\n toastList.filter(t => !ownsContainer(t)),\n t => t.props.position,\n position,\n toastStackOrder\n );\n\n const target = resolveContainer();\n return createPortal(\n <LocalePortalScope target={target}>\n {stacks.map(stack => (\n <div\n key={stack.key}\n className={prefixedClassNames(\n classPrefix,\n 'toast-container',\n `is-${stack.position}`\n )}\n >\n {stack.items.map(t => renderToast(t, stack.position, true))}\n </div>\n ))}\n {toastList\n .filter(ownsContainer)\n .map(t => renderToast(t, t.props.position ?? position, false))}\n </LocalePortalScope>,\n target\n );\n};\n\nexport default Toast;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;;;;;;AAqGA;;;;;;;;;;;;;;;AAeG;AACI,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,OAAO,EACP,IAAI,GAAG,SAAS,EAChB,UAAU,EACV,QAAQ,GAAG,WAAW,EACtB,QAAQ,GAAG,IAAI,EACf,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,IAAI,EAClB,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,IAAI,EACjB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,GAAG,KAAK,EACd,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,KACD;IACF,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;;;;IAI3D,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,IAAI,IAAI,CAAC;IAC/C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;IAChD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AAC/C,IAA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AA,OAAO,YAAY,CACjBD,IAAA,CAAC,iBAAiB,EAAA,EAAC,MAAM,EAAE,MAAM,EAAA,QAAA,EAAA,CAC9B,MAAM,CAAC,GAAG,CAAC,KAAK,KACfC,GAAA,CAAA,KAAA,EAAA,EAEE,SAAS,EAAE,kBAAkB,CAC3B,WAAW,EACX,iBAAiB,EACjB,CAAA,GAAA,EAAM,KAAK,CAAC,QAAQ,CAAA,CAAE,CACvB,EAAA,QAAA,EAEA,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,EAAA,EAPtD,KAAK,CAAC,GAAG,CAQV,CACP,CAAC,EACD;iBACE,MAAM,CAAC,aAAa;iBACpB,GAAG,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAA,EAAA,CAC9C,EACpB,MAAM,CACP;AACH;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../../src/elements/IconButton.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport { Button, type ButtonOwnProps, type ButtonProps } from './Button';\nimport { Icon } from './Icon';\nimport { buttonType } from '../helpers/buttonType';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport type { PolymorphicComponent } from '../helpers/polymorphic';\n\n/**\n * The IconButton component's own props: everything `Button` takes, plus the\n * icon.\n */\nexport interface IconButtonOwnProps extends ButtonOwnProps {\n /**\n * The glyph. A string is an `Icon` name, drawn from the icon library\n * `ConfigProvider` sets. An `<Icon>` renders as given, so it can carry its\n * own `variant` or `library`. Any other node, such as an SVG or a component\n * from an icon package, goes inside an `Icon`, which gives it the `.icon`\n * wrapper Bulma keeps square. It's decorative: the button's name says what\n * it does. Give the glyph here or as `children`, not both: with both, it\n * draws `icon` and warns in development. With neither, such as an empty\n * string from `cond ? 'trash' : ''`, the button is an empty square, and that\n * warns in development too.\n */\n icon?: React.ReactNode;\n /**\n * The glyph as children, the way Mantine, MUI and Chakra take it: an\n * `<Icon>` renders as given, and any other node, such as an SVG, goes\n * inside an `Icon`, as with `icon`. Left out when `icon` is given, which\n * warns in development. Text warns too, since `aria-label` replaces it as\n * the name: a button with text is a `Button`.\n */\n children?: React.ReactNode;\n /**\n * Makes the button a circle the size of its square. The circle comes from\n * bestax's CSS, in `bestax.css` and its variants, or in `extras.css` next\n * to your own Bulma. Without it, Bulma's `is-rounded` draws a pill a little\n * wider than it is tall.\n */\n isRounded?: boolean;\n}\n\n/** Names an IconButton by the text of another element. */\nexport interface IconButtonLabelledBy {\n /** The id of the element whose text names the button, in place of `aria-label`. */\n 'aria-labelledby': string;\n /**\n * @internal Not with `aria-labelledby`, which already names the button.\n * Declared so the two can't be passed together.\n */\n 'aria-label'?: undefined;\n}\n\n/** Names an IconButton with `aria-label`, the usual way. */\nexport interface IconButtonLabel {\n /**\n * The button's name: what a screen reader announces and what a voice\n * control user says to press it. Required, or `aria-labelledby` in its\n * place, since an icon has no text to name it by. Name the action\n * (\"Delete\"), not the picture (\"Trash\"). An empty or blank one warns in\n * development.\n */\n 'aria-label': string;\n /**\n * @internal Not with `aria-label`. Declared so the two can't be passed\n * together.\n */\n 'aria-labelledby'?: undefined;\n}\n\n/**\n * How an IconButton gets its name: `aria-label`, or `aria-labelledby` in its\n * place. `IconButtonLabel` comes last because TypeScript names the union's\n * last member when neither is given: under \"No overload matches this call\",\n * each overload's error ends \"Property ''aria-label'' is missing … but\n * required in type 'IconButtonLabel'\".\n */\nexport type IconButtonName = IconButtonLabelledBy | IconButtonLabel;\n\n/**\n * Props for the IconButton component. The DOM attributes and the `ref` follow\n * `as`, exactly as they do on `Button`.\n *\n * @extraProp {string} [type='button'] - On a `<button>`, `'button'`, `'submit'` or `'reset'`, and `'button'` unless you pass one of the other two, so it never submits a form by accident. With another `as`, whatever that element or component takes, passed through as given, such as an `<a>`'s MIME type.\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`.\n */\nexport type IconButtonProps<T extends React.ElementType = 'button'> =\n IconButtonOwnProps &\n IconButtonName &\n Omit<\n React.ComponentPropsWithoutRef<T>,\n keyof IconButtonOwnProps | 'aria-label' | 'aria-labelledby' | 'as'\n > & {\n /**\n * Render as a `<button>`, an `<a>`, or a custom component such as a\n * router `Link`, as on `Button`.\n * @defaultValue 'button'\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `IconButtonProps<T>` above, and the body can't see through `T`, so\n * it reads the widest form of the props it touches.\n */\ntype IconButtonImplProps = IconButtonOwnProps & {\n as?: React.ElementType;\n type?: unknown;\n 'aria-label'?: unknown;\n 'aria-labelledby'?: unknown;\n};\n\n/** Whether a string has something in it besides spaces. */\nconst hasText = (value: unknown) =>\n typeof value === 'string' && value.trim() !== '';\n\n/** Whether a string is only spaces, which JSX leaves between elements. */\nconst isBlank = (node: React.ReactNode) =>\n typeof node === 'string' && node.trim() === '';\n\n/**\n * The glyph in one `.icon`, which is what Bulma keeps square: an `<Icon>` as\n * given, Fragments opened up and blank text left out, and anything else\n * inside an `Icon`. Null when there's nothing to draw, so an empty Fragment\n * or array counts as no glyph.\n */\nfunction iconOf(node: React.ReactNode) {\n const items = flattenChildren(node).filter(item => !isBlank(item));\n if (items.length === 0) return null;\n const [only] = items;\n if (items.length === 1 && React.isValidElement(only) && only.type === Icon) {\n return only;\n }\n return <Icon>{items}</Icon>;\n}\n\n/** The glyph `icon` draws: a string is an `Icon` name, the rest as `iconOf`. */\nfunction iconFromProp(icon: React.ReactNode) {\n if (typeof icon !== 'string') return iconOf(icon);\n return hasText(icon) ? <Icon name={icon} /> : null;\n}\n\n/**\n * The `IconButton` component renders a button that shows only an icon, and requires a name for it.\n *\n * It renders through `Button`, so it takes everything `Button` takes, and\n * adds the icon and a name the types require: `aria-label`, or\n * `aria-labelledby` in its place. Bulma keeps a button whose only child is an\n * `.icon` square at every size, and `isRounded` makes it a circle. It has no\n * tooltip of its own: wrap it in `Tooltip` for a description.\n *\n * @function\n * @param {IconButtonProps} props - Props for the IconButton component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n *\n * @example\n * <IconButton icon=\"trash\" aria-label=\"Delete\" color=\"danger\" />\n *\n * @example\n * <IconButton aria-label=\"Settings\">\n * <Icon name=\"cog\" />\n * </IconButton>\n */\nexport const IconButton = forwardRef(function IconButton(\n props: IconButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const { icon, children, className, ...rest } = props as IconButtonImplProps;\n\n const iconButtonClass = usePrefixedClassNames('icon-button');\n\n const unnamed =\n !hasText(rest['aria-label']) && !hasText(rest['aria-labelledby']);\n // Each way of giving the glyph counts only if it draws something, so an\n // empty Fragment or array as `icon` doesn't hide real children, and an\n // empty one as children doesn't warn.\n const fromIcon = iconFromProp(icon);\n const fromChildren = iconOf(children);\n const both = fromIcon !== null && fromChildren !== null;\n // One glyph, from `icon` or else from `children`, so the button's only\n // child is one `.icon`, which Bulma keeps square, and round with\n // `isRounded`.\n const glyph = fromIcon ?? fromChildren;\n const empty = glyph === null;\n // Only top-level text, Fragments opened up, and only in development, where\n // the warning below can say something about it.\n const textInside =\n isDev() &&\n flattenChildren(children).some(\n child => typeof child === 'number' || hasText(child)\n );\n useEffect(() => {\n if (unnamed) {\n warnOnce(\n 'IconButton:unnamed',\n '[bestax-bulma] <IconButton> has no accessible name. Pass ' +\n 'aria-label naming what it does (\"Delete\"), or aria-labelledby, ' +\n 'so a screen reader has something to announce.'\n );\n }\n if (empty) {\n warnOnce(\n 'IconButton:no-glyph',\n '[bestax-bulma] <IconButton> has no glyph: neither icon nor ' +\n 'children draws one, so it renders an empty square. Pass an icon ' +\n 'name, an <Icon> or another node.'\n );\n }\n if (both) {\n warnOnce(\n 'IconButton:icon-and-children',\n '[bestax-bulma] <IconButton> was given both icon and children. It ' +\n 'draws icon and leaves the children out: give the glyph one way.'\n );\n }\n if (textInside) {\n warnOnce(\n 'IconButton:text',\n '[bestax-bulma] <IconButton> was given text as children. Its ' +\n 'aria-label replaces the text as its name, so a button with text ' +\n 'is a <Button>.'\n );\n }\n }, [unnamed, empty, both, textInside]);\n\n // `type` is a button's only on a `<button>`. On an `<a>` it's the MIME hint,\n // and a custom component owns what it means, so those get it as given.\n const tag = rest.as ?? 'button';\n const typeProp =\n tag === 'button' ? { type: buttonType(rest.type) } : undefined;\n\n return (\n <Button\n // IconButton is polymorphic through to Button, which resolves the\n // element from `as`. TS can't infer that through the spread, so the\n // props and the ref are read at Button's default element.\n {...(rest as ButtonProps)}\n {...typeProp}\n ref={ref as React.Ref<HTMLButtonElement>}\n className={classNames(iconButtonClass, className)}\n >\n {glyph}\n </Button>\n );\n}) as PolymorphicComponent<IconButtonOwnProps & IconButtonName, 'button'>;\n\nIconButton.displayName = 'IconButton';\n\nexport default IconButton;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;AAkHA;AACA,MAAM,OAAO,GAAG,CAAC,KAAc,KAC7B,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;AAElD;AACA,MAAM,OAAO,GAAG,CAAC,IAAqB,KACpC,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;AAEhD;;;;;AAKG;AACH,SAAS,MAAM,CAAC,IAAqB,EAAA;AACnC,IAAA,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClE,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC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AG,KAAK,KAAK,IAAI;;;IAG5B,MAAM,UAAU,GACd,KAAK,EAAE;QACP,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,CAC5B,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,CACrD;IACH,SAAS,CAAC,MAAK;QACb,IAAI,OAAO,EAAE;YACX,QAAQ,CACN,oBAAoB,EACpB,2DAA2D;gBACzD,iEAAiE;AACjE,gBAAA,+CAA+C,CAClD;QACH;QACA,IAAI,KAAK,EAAE;YACT,QAAQ,CACN,qBAAqB,EACrB,6DAA6D;gBAC3D,kEAAkE;AAClE,gBAAA,kCAAkC,CACrC;QACH;QACA,IAAI,IAAI,EAAE;YACR,QAAQ,CACN,8BAA8B,EAC9B,mEAAmE;AACjE,gBAAA,iEAAiE,CACpE;QACH;QACA,IAAI,UAAU,EAAE;YACd,QAAQ,CACN,iBAAiB,EACjB,8DAA8D;gBAC5D,kEAAkE;AAClE,gBAAA,gBAAgB,CACnB;QACH;IACF,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;;;AAItC,IAAA,MAAM,GAAG,GAAG,IAAI,CAAC,EAAE,IAAI,QAAQ;IAC/B,MAAM,QAAQ,GACZ,GAAG,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS;IAEhE,QACEA,IAAC;;;;AAIM,MAAA,EAAA,GAAA,IAAoB,KACrB,QAAQ,EACZ,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YAEhD,KAAK,EAAA,CACC;AAEb,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/elements/IconButton.tsx"],"sourcesContent":["import React, { forwardRef, useEffect } from 'react';\nimport { Button, type ButtonOwnProps, type ButtonProps } from './Button';\nimport { Icon } from './Icon';\nimport { buttonType } from '../helpers/buttonType';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { isDev, warnOnce } from '../helpers/devWarnings';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport type { PolymorphicComponent } from '../helpers/polymorphic';\n\n/**\n * The IconButton component's own props: everything `Button` takes, plus the\n * icon.\n */\nexport interface IconButtonOwnProps extends ButtonOwnProps {\n /**\n * The glyph. A string is an `Icon` name, drawn from the icon library\n * `ConfigProvider` sets. An `<Icon>` renders as given, so it can carry its\n * own `variant` or `library`. Any other node, such as an SVG or a component\n * from an icon package, goes inside an `Icon`, which gives it the `.icon`\n * wrapper Bulma keeps square. It's decorative: the button's name says what\n * it does. Give the glyph here or as `children`, not both: with both, it\n * draws `icon` and warns in development. With neither, such as an empty\n * string from `cond ? 'trash' : ''`, the button is an empty square, and that\n * warns in development too.\n */\n icon?: React.ReactNode;\n /**\n * The glyph as children, the way Mantine, MUI and Chakra take it: an\n * `<Icon>` renders as given, and any other node, such as an SVG, goes\n * inside an `Icon`, as with `icon`. Left out when `icon` is given, which\n * warns in development. Text warns too, since `aria-label` replaces it as\n * the name: a button with text is a `Button`.\n */\n children?: React.ReactNode;\n /**\n * Makes the button a circle the size of its square. The circle comes from\n * bestax's CSS, in `bestax.css` and its variants, or in `extras.css` next\n * to your own Bulma. Without it, Bulma's `is-rounded` draws a pill a little\n * wider than it is tall.\n */\n isRounded?: boolean;\n}\n\n/** Names an IconButton by the text of another element. */\nexport interface IconButtonLabelledBy {\n /** The id of the element whose text names the button, in place of `aria-label`. */\n 'aria-labelledby': string;\n /**\n * Not with `aria-labelledby`, which already names the button.\n * Declared so the two can't be passed together.\n */\n 'aria-label'?: undefined;\n}\n\n/** Names an IconButton with `aria-label`, the usual way. */\nexport interface IconButtonLabel {\n /**\n * The button's name: what a screen reader announces and what a voice\n * control user says to press it. Required, or `aria-labelledby` in its\n * place, since an icon has no text to name it by. Name the action\n * (\"Delete\"), not the picture (\"Trash\"). An empty or blank one warns in\n * development.\n */\n 'aria-label': string;\n /** Not with `aria-label`. Declared so the two can't be passed together. */\n 'aria-labelledby'?: undefined;\n}\n\n/**\n * How an IconButton gets its name: `aria-label`, or `aria-labelledby` in its\n * place. `IconButtonLabel` comes last because TypeScript names the union's\n * last member when neither is given: under \"No overload matches this call\",\n * each overload's error ends \"Property ''aria-label'' is missing … but\n * required in type 'IconButtonLabel'\".\n */\nexport type IconButtonName = IconButtonLabelledBy | IconButtonLabel;\n\n/**\n * Props for the IconButton component. The DOM attributes and the `ref` follow\n * `as`, exactly as they do on `Button`.\n *\n * @extraProp {string} [type='button'] - On a `<button>`, `'button'`, `'submit'` or `'reset'`, and `'button'` unless you pass one of the other two, so it never submits a form by accident. With another `as`, whatever that element or component takes, passed through as given, such as an `<a>`'s MIME type.\n * @extraProp {PolymorphicRef<React.ElementType>} [ref] - Ref forwarded to the element `as` renders, typed from `as`.\n */\nexport type IconButtonProps<T extends React.ElementType = 'button'> =\n IconButtonOwnProps &\n IconButtonName &\n Omit<\n React.ComponentPropsWithoutRef<T>,\n keyof IconButtonOwnProps | 'aria-label' | 'aria-labelledby' | 'as'\n > & {\n /**\n * Render as a `<button>`, an `<a>`, or a custom component such as a\n * router `Link`, as on `Button`.\n * @defaultValue 'button'\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `IconButtonProps<T>` above, and the body can't see through `T`, so\n * it reads the widest form of the props it touches.\n */\ntype IconButtonImplProps = IconButtonOwnProps & {\n as?: React.ElementType;\n type?: unknown;\n 'aria-label'?: unknown;\n 'aria-labelledby'?: unknown;\n};\n\n/** Whether a string has something in it besides spaces. */\nconst hasText = (value: unknown) =>\n typeof value === 'string' && value.trim() !== '';\n\n/** Whether a string is only spaces, which JSX leaves between elements. */\nconst isBlank = (node: React.ReactNode) =>\n typeof node === 'string' && node.trim() === '';\n\n/**\n * The glyph in one `.icon`, which is what Bulma keeps square: an `<Icon>` as\n * given, Fragments opened up and blank text left out, and anything else\n * inside an `Icon`. Null when there's nothing to draw, so an empty Fragment\n * or array counts as no glyph.\n */\nfunction iconOf(node: React.ReactNode) {\n const items = flattenChildren(node).filter(item => !isBlank(item));\n if (items.length === 0) return null;\n const [only] = items;\n if (items.length === 1 && React.isValidElement(only) && only.type === Icon) {\n return only;\n }\n return <Icon>{items}</Icon>;\n}\n\n/** The glyph `icon` draws: a string is an `Icon` name, the rest as `iconOf`. */\nfunction iconFromProp(icon: React.ReactNode) {\n if (typeof icon !== 'string') return iconOf(icon);\n return hasText(icon) ? <Icon name={icon} /> : null;\n}\n\n/**\n * The `IconButton` component renders a button that shows only an icon, and requires a name for it.\n *\n * It renders through `Button`, so it takes everything `Button` takes, and\n * adds the icon and a name the types require: `aria-label`, or\n * `aria-labelledby` in its place. Bulma keeps a button whose only child is an\n * `.icon` square at every size, and `isRounded` makes it a circle. It has no\n * tooltip of its own: wrap it in `Tooltip` for a description.\n *\n * @function\n * @param {IconButtonProps} props - Props for the IconButton component.\n * @param {React.Ref} ref - Forwarded ref to the element `as` renders.\n * @returns {JSX.Element} The rendered button, anchor, or custom element.\n * @see {@link https://bulma.io/documentation/elements/button/ | Bulma Button documentation}\n *\n * @example\n * <IconButton icon=\"trash\" aria-label=\"Delete\" color=\"danger\" />\n *\n * @example\n * <IconButton aria-label=\"Settings\">\n * <Icon name=\"cog\" />\n * </IconButton>\n */\nexport const IconButton = forwardRef(function IconButton(\n props: IconButtonProps,\n ref: React.Ref<HTMLElement>\n) {\n const { icon, children, className, ...rest } = props as IconButtonImplProps;\n\n const iconButtonClass = usePrefixedClassNames('icon-button');\n\n const unnamed =\n !hasText(rest['aria-label']) && !hasText(rest['aria-labelledby']);\n // Each way of giving the glyph counts only if it draws something, so an\n // empty Fragment or array as `icon` doesn't hide real children, and an\n // empty one as children doesn't warn.\n const fromIcon = iconFromProp(icon);\n const fromChildren = iconOf(children);\n const both = fromIcon !== null && fromChildren !== null;\n // One glyph, from `icon` or else from `children`, so the button's only\n // child is one `.icon`, which Bulma keeps square, and round with\n // `isRounded`.\n const glyph = fromIcon ?? fromChildren;\n const empty = glyph === null;\n // Only top-level text, Fragments opened up, and only in development, where\n // the warning below can say something about it.\n const textInside =\n isDev() &&\n flattenChildren(children).some(\n child => typeof child === 'number' || hasText(child)\n );\n useEffect(() => {\n if (unnamed) {\n warnOnce(\n 'IconButton:unnamed',\n '[bestax-bulma] <IconButton> has no accessible name. Pass ' +\n 'aria-label naming what it does (\"Delete\"), or aria-labelledby, ' +\n 'so a screen reader has something to announce.'\n );\n }\n if (empty) {\n warnOnce(\n 'IconButton:no-glyph',\n '[bestax-bulma] <IconButton> has no glyph: neither icon nor ' +\n 'children draws one, so it renders an empty square. Pass an icon ' +\n 'name, an <Icon> or another node.'\n );\n }\n if (both) {\n warnOnce(\n 'IconButton:icon-and-children',\n '[bestax-bulma] <IconButton> was given both icon and children. It ' +\n 'draws icon and leaves the children out: give the glyph one way.'\n );\n }\n if (textInside) {\n warnOnce(\n 'IconButton:text',\n '[bestax-bulma] <IconButton> was given text as children. Its ' +\n 'aria-label replaces the text as its name, so a button with text ' +\n 'is a <Button>.'\n );\n }\n }, [unnamed, empty, both, textInside]);\n\n // `type` is a button's only on a `<button>`. On an `<a>` it's the MIME hint,\n // and a custom component owns what it means, so those get it as given.\n const tag = rest.as ?? 'button';\n const typeProp =\n tag === 'button' ? { type: buttonType(rest.type) } : undefined;\n\n return (\n <Button\n // IconButton is polymorphic through to Button, which resolves the\n // element from `as`. TS can't infer that through the spread, so the\n // props and the ref are read at Button's default element.\n {...(rest as ButtonProps)}\n {...typeProp}\n ref={ref as React.Ref<HTMLButtonElement>}\n className={classNames(iconButtonClass, className)}\n >\n {glyph}\n </Button>\n );\n}) as PolymorphicComponent<IconButtonOwnProps & IconButtonName, 'button'>;\n\nIconButton.displayName = 'IconButton';\n\nexport default IconButton;\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;AA+GA;AACA,MAAM,OAA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Z,GAAG,KAAK,QAAQ,GAAG,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS;IAEhE,QACEA,IAAC;;;;AAIM,MAAA,EAAA,GAAA,IAAoB,KACrB,QAAQ,EACZ,GAAG,EAAE,GAAmC,EACxC,SAAS,EAAE,UAAU,CAAC,eAAe,EAAE,SAAS,CAAC,YAEhD,KAAK,EAAA,CACC;AAEb,CAAC;AAED,UAAU,CAAC,WAAW,GAAG,YAAY;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","sources":["../../../src/form/Combobox.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\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 { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher } from '../helpers/localeFormat';\nimport {\n AnchoredPosition,\n marginGap,\n useAnchoredPosition,\n} from '../helpers/useAnchoredPosition';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport { CheckIcon } from '../helpers/checkIcon';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport type { PopoverPosition } from '../components/Popover';\nimport { Field } from './Field';\nimport { Input, InputProps } from './Input';\nimport { FormFieldProps } from './fieldProps';\nimport {\n rendersOwnField,\n useFieldsetDisabled,\n useInsideControl,\n useInsideField,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\nimport { useControlLoading } from './controlLoading';\nimport { HiddenValues, ValueTags, tagIds } from './_selectInternals/ValueTags';\n\nconst validComboboxSizes = ['small', 'medium', 'large'] as const;\n\n// What the status region announces: the `Combobox.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/**\n * One item in a Combobox's `data`. A string there is an item whose label is\n * its value.\n */\nexport interface ComboboxItemData {\n /**\n * What `onSelect` and `onChange` hand back, and what `name` posts. Unique\n * within the Combobox.\n */\n value: string;\n /** What the item shows, and what typing matches. The `value` when it's left out. */\n label?: string;\n /**\n * Can't be picked. The arrows still reach it, so a screen reader user\n * finds it.\n */\n disabled?: boolean;\n /**\n * The heading the item goes under. Groups show in the order `data` first\n * names them, and the items with no group show together where the first of\n * them is.\n */\n group?: string;\n}\n\n/** What a Combobox takes whether it's given `data` or built from parts. */\ninterface ComboboxBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'onSelect' | 'defaultValue'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /**\n * The field's label, which names `Combobox.Input` through `htmlFor`, and\n * the list through `aria-labelledby`. Dropped inside an outer `Field`,\n * whose label names both instead when it points at the field. When\n * `Combobox.Input` has an `id` of its own, server markup names the field\n * through `aria-labelledby` until the page hydrates and the label's `for`\n * catches up.\n */\n label?: React.ReactNode;\n /**\n * Props for the label element. An explicit `htmlFor` takes over the\n * association: give `Combobox.Input` the same `id`, and the list is still\n * named after the label.\n */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /**\n * Controlled open state. When set, opening and closing only report\n * through `onOpenChange`.\n */\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 typing, a click in\n * the field or Down Arrow, and `false` from Escape, Tab, a pick with one\n * value, focus leaving or a press outside. Fires in controlled and\n * uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called with an item's `value` when it's picked with Enter or a click.\n * A disabled item is never picked. With `data`, `onChange` reports the\n * value that follows. Built from parts, the Combobox keeps no value and\n * doesn't change the text in the field: update yours here.\n */\n onSelect?: (value: string) => void;\n /**\n * Highlights the first enabled item whenever the list opens or its\n * items change, so Enter picks the top match. It only highlights:\n * leaving the field still picks nothing, and so does Tab.\n * @defaultValue false\n */\n keepFirst?: boolean;\n /**\n * The list is always on screen, in the flow under the field, as in a\n * Popover or a page panel. There's no menu, so nothing closes it, and\n * Escape goes to whatever is around it.\n * @defaultValue false\n */\n inline?: boolean;\n /**\n * Where the menu opens against the field: below (`bottom-*`) or above\n * (`top-*`), lined up with its left or right edge. `auto` picks the one\n * that keeps the list in the viewport, preferring below. The same union\n * Popover takes.\n * @defaultValue 'bottom-left'\n */\n position?: PopoverPosition;\n /**\n * Renders the menu through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport\n * at the field, so a container that clips its overflow can't cut it off.\n * It then shows from the commit after hydration, never in server markup.\n * Theming variables set on an ancestor reach it only when the portal's\n * container is inside that ancestor, as with Popover. In a `Modal`, point\n * `portalContainer` inside the modal, so the list stays in the dialog for\n * assistive tech.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /** Sizes the field and the items together. */\n size?: 'small' | 'medium' | 'large';\n}\n\n/** What a Combobox given `data` takes, with one value or several. */\ninterface ComboboxDataBaseProps extends ComboboxBaseProps {\n /** The field's placeholder, with `data`. */\n placeholder?: string;\n /**\n * A form field name, with `data`. A hidden input posts the value, empty\n * while there's none, and with `multiple` a hidden input posts each value.\n */\n name?: string;\n /**\n * What the menu shows in place of the list, with `data`, when nothing\n * matches the typing, such as \"No countries match\". It's announced the way\n * `Combobox.Empty` is. Without it, the menu closes while nothing matches.\n */\n empty?: React.ReactNode;\n /**\n * Renders an item's content, with `data`, in place of its label. It's\n * handed the item from `data`, a string there arriving as\n * `{ value, label }`.\n */\n itemTemplate?: (item: ComboboxItemData) => React.ReactNode;\n /**\n * The field can't be used, with `data`: it can't be focused or typed in,\n * its items can't be picked, its tags lose their buttons, and its hidden\n * inputs don't post, the way a disabled field's value doesn't.\n */\n disabled?: boolean;\n /**\n * A value is needed, with `data`. The field is `required` while nothing is\n * picked, so the browser's own check stops the form the way it does for\n * Autocomplete's field, and it's `aria-required` the whole time. The check\n * reads the field's text, which Enter, the list closing or leaving the\n * field puts back to the pick.\n */\n required?: boolean;\n /**\n * The id of the form the value posts with, with `data`, for a field\n * outside it. It goes on the hidden inputs, and on the field so that form\n * checks `required` too.\n */\n form?: string;\n /**\n * The field's `id`, with `data`, which the label then points at, and so\n * can a label of your own. Built from parts, it lands on `div.combobox`, so\n * give `Combobox.Input` the `id` instead.\n */\n id?: string;\n /**\n * Names the field and the list, with `data`, in place of a `label`. Built\n * from parts, it lands on `div.combobox`, so put it on `Combobox.Input`.\n */\n 'aria-label'?: string;\n /**\n * The ids of what names the field and the list, with `data`, in place of\n * a `label`. Built from parts, it lands on `div.combobox`, so put it on\n * `Combobox.Input`.\n */\n 'aria-labelledby'?: string;\n /** @internal With `data`, the Combobox renders its own parts. */\n children?: never;\n}\n\n/** Props for a Combobox given `data`, with one value. */\nexport interface ComboboxSingleDataProps extends ComboboxDataBaseProps {\n /**\n * The items, for a Combobox that renders the field, the menu, the list,\n * the groups and the empty message itself. A string is an item whose label\n * is its value, and an object is `{ value, label?, disabled?, group? }`.\n * Typing filters the items by label, ignoring case, and inside a\n * `LocaleProvider` with a `locale`, ignoring accents too where that\n * language does, so \"cafe\" finds \"Café\". The Combobox keeps the value. Leave it out to build the Combobox from parts.\n */\n data: (string | ComboboxItemData)[];\n /**\n * Several values can be picked. The list stays open after a pick, it's\n * `aria-multiselectable`, and each item's `checked` is its\n * `aria-selected`. With `data`, the value is an array, and the picks show\n * as tags under the field, inside its Field, each with a button that takes\n * it off. The field's description lists them, since its text is the\n * search.\n * @defaultValue false\n */\n multiple?: false;\n /**\n * The value, controlled, with `data`: the picked item's `value`, or `null`\n * for none, and with `multiple` an array of them. With one value, the\n * field shows the picked item's label while you aren't typing in it, and\n * the list closing or the field being left puts it back over any typing.\n * A field emptied and left like that clears the value.\n */\n value?: string | null;\n /** The value to start with when uncontrolled, with `data`. */\n defaultValue?: string | null;\n /**\n * Called with the new value, with `data`, when a pick, a tag's button or\n * a field left empty changes it: an item's `value` or `null`, or with\n * `multiple` the array.\n */\n onChange?: (value: string | null) => void;\n /** @internal With one value there are no tags to name. */\n ariaCloseLabel?: never;\n}\n\n/** Props for a Combobox given `data`, with several values. */\nexport interface ComboboxMultipleDataProps extends ComboboxDataBaseProps {\n /**\n * The items, for a Combobox that renders itself. A string is an item whose\n * label is its value, and an object is `{ value, label?, disabled?, group? }`.\n */\n data: (string | ComboboxItemData)[];\n /**\n * Several values can be picked: the value is an array, and the picks show\n * as tags under the field, each with a button that takes it off. The\n * field's description lists them.\n */\n multiple: true;\n /** The values, controlled: the picked items' `value`s. */\n value?: string[];\n /** The values to start with when uncontrolled. */\n defaultValue?: string[];\n /** Called with the new array when a pick or a tag's button changes it. */\n onChange?: (value: string[]) => void;\n /**\n * Names each tag's button, in place of \"Remove\" and the item's label, as\n * Taginput's does. The button is then described by its tag's label, so it\n * still says which tag it takes off.\n */\n ariaCloseLabel?: string;\n}\n\n/** Props for a Combobox given `data`. */\ntype ComboboxDataProps = ComboboxSingleDataProps | ComboboxMultipleDataProps;\n\n/** Props for a Combobox built from parts. */\nexport interface ComboboxPartsProps extends ComboboxBaseProps {\n /**\n * The parts, in order: `Combobox.Input`, then `Combobox.Menu` with\n * `Combobox.List` and `Combobox.Empty` in it. With `inline`, the\n * `Combobox.List` and `Combobox.Empty` go straight in. Render\n * `Combobox.List` while there are items and `Combobox.Empty` while\n * there aren't: the empty message sits beside the list, not in it. With\n * `data` there are none to give: children given with it are ignored, with\n * a warning in development.\n */\n children?: React.ReactNode;\n /**\n * Several values can be picked. The list stays open after a pick, it's\n * `aria-multiselectable`, and each item's `checked` is its\n * `aria-selected`.\n * @defaultValue false\n */\n multiple?: boolean;\n /** @internal Built from parts, there's no `data`. */\n data?: never;\n /** @internal Built from parts, the app keeps the value. */\n value?: never;\n /** @internal Built from parts, the app keeps the value. */\n defaultValue?: never;\n /** @internal Built from parts, `onSelect` reports a pick. */\n onChange?: never;\n /** @internal Built from parts, `Combobox.Input` takes the placeholder. */\n placeholder?: never;\n /** @internal Built from parts, the app posts the value. */\n name?: never;\n /** @internal Built from parts, `Combobox.Empty` is the empty message. */\n empty?: never;\n /** @internal Built from parts, `Combobox.Item` renders its own content. */\n itemTemplate?: never;\n /** @internal Built from parts, `Combobox.Input` takes `disabled`. */\n disabled?: never;\n /** @internal Built from parts, `Combobox.Input` takes `required`. */\n required?: never;\n /** @internal Built from parts, the app posts the value. */\n form?: never;\n}\n\n/**\n * Props for the Combobox component: given `data`, it renders itself and\n * keeps the value, and without it, it's built from parts. The helper props,\n * the other attributes and the `ref` land on the `div.combobox` around the\n * field and the list. It renders the `Field` and the label itself, unless an\n * outer `Field` already does.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.combobox` around the field and the list.\n */\nexport type ComboboxProps =\n ComboboxSingleDataProps | ComboboxMultipleDataProps | ComboboxPartsProps;\n\n/**\n * Props for Combobox.Input, the text field. It renders `Input`, so its icons,\n * `isLoading` and `color` work as they do there. The Field props go on the\n * Combobox, and the size comes from it. The field is `autoComplete=\"off\"`,\n * so the browser's own suggestions don't open over the list, and that isn't\n * yours to set.\n */\nexport type ComboboxInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit, and\n // `__typetests__/combobox.tsx` fails if one goes missing. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Combobox sets on the field itself:\n | 'size'\n | 'role'\n | 'autoComplete'\n>;\n\n/** Props for Combobox.Menu, the floating panel under the field. */\nexport interface ComboboxMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * What the panel shows: `Combobox.List` while there are items, and\n * `Combobox.Empty` while there aren't. Children that are all `null`,\n * `false` or `''`, or empty Fragments, keep the panel shut, so write the\n * conditional here. A component that renders nothing, or a\n * `Combobox.List` with no items in it, still counts, and shows an\n * empty panel.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Combobox.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 ComboboxListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Combobox.Item`s and `Combobox.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Combobox.Item, one choice 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 ComboboxItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What `onSelect` hands back. Unique within the Combobox. */\n value: string;\n /**\n * Can't be picked. The arrows still reach it, so a screen reader user\n * finds it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * It's the value, or one of them. It shows a check mark, the list opens\n * with the highlight on it, and with `multiple` it's the `aria-selected`.\n * @defaultValue false\n */\n checked?: boolean;\n /** What the item shows: text, or text with an avatar, a tag or a hint. */\n children?: React.ReactNode;\n}\n\n/** Props for Combobox.Group, items under a heading. */\nexport interface ComboboxGroupProps 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 `Combobox.Item`s. */\n children?: React.ReactNode;\n}\n\n/** Props for Combobox.Empty, the message shown in place of the list. */\nexport interface ComboboxEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No countries 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 query is heard for the first query only.\n */\n children?: React.ReactNode;\n}\n\n/** What the Combobox hands its parts. */\ninterface ComboboxContextValue {\n engine: ComboboxEngine;\n /** The id the field takes when it's given none. */\n inputId: string | undefined;\n /** Tells the Combobox the id the field was given, so the label follows it. */\n reportInputId: (id: string | undefined) => void;\n /** The id of the label that names the field, which names the list too. */\n labelId: string | undefined;\n /**\n * The id of the label the Combobox renders itself, when it names the field.\n * The field points at it while its own `id` hasn't reached the label yet.\n */\n ownLabelId: string | undefined;\n /** Tells the Combobox 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 /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /**\n * Records the menu's panel while it's on screen, so it's placed and\n * counts as inside. Returns the function that forgets it.\n */\n reportPanel: (element: HTMLElement) => () => void;\n /** Where the panel goes against the field. */\n placement: AnchoredPosition;\n size?: ComboboxProps['size'];\n multiple: boolean;\n inline: boolean;\n appendToBody: boolean;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Combobox reads: closed, with nothing to\n// report to, so it renders its markup and does nothing.\nconst standalone: ComboboxContextValue = {\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 inputId: undefined,\n reportInputId: noop,\n labelId: undefined,\n ownLabelId: undefined,\n reportLoading: noop,\n reportEmpty: registerNothing,\n onFieldChange: noop,\n reportPanel: registerNothing,\n placement: { position: 'bottom-left' },\n multiple: false,\n inline: false,\n appendToBody: false,\n};\n\nconst ComboboxContext = createContext<ComboboxContextValue | null>(null);\n\nconst useCombobox = () => useContext(ComboboxContext) ?? 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 Combobox built from parts: the field, the menu, the list and the\n * keys, with the data, the filtering and the value left to the app.\n */\n/** What the parts root takes from the Combobox given `data`, beyond the parts' props. */\ninterface ComboboxPartsRootProps extends ComboboxPartsProps {\n /**\n * Shown under the Combobox, inside its Field and ahead of the message: the\n * tags of several values. While it's given, the two share a wrapper, so\n * they stay together in a horizontal Field's body.\n */\n below?: React.ReactNode;\n /**\n * Called when Enter goes on to the form with nothing to pick, so the\n * Combobox given `data` can put the field's text back first, `inline`\n * included, where nothing closes.\n */\n onSettle?: () => void;\n}\n\nconst ComboboxParts = forwardRef<HTMLDivElement, ComboboxPartsRootProps>(\n (\n {\n children,\n below,\n onSettle,\n open,\n defaultOpen = false,\n onOpenChange,\n onSelect,\n keepFirst = false,\n multiple = false,\n inline = false,\n position = 'bottom-left',\n appendToBody = false,\n size,\n label,\n labelSize,\n labelProps,\n horizontal,\n message,\n messageColor,\n fieldClassName,\n className,\n ...props\n },\n ref\n ) => {\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('Combobox', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // The field's own `id`, when `Combobox.Input` was given one, which the\n // label then points at.\n const [givenInputId, setGivenInputId] = useState<string | undefined>();\n const {\n controlId,\n fieldLabelProps,\n labelId: listLabelId,\n } = useAutoLabelId({\n label,\n id: givenInputId,\n labelProps,\n rendersLabel: ownField,\n needsLabelId: true,\n });\n const engine = useComboboxEngine({\n open,\n defaultOpen,\n onOpenChange,\n onSelect,\n onSettle,\n keepFirst,\n multiple,\n inline,\n // A portaled panel has no server markup to point at.\n deferred: appendToBody && !inline,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const validSize = (validComboboxSizes as readonly string[]).includes(\n size as string\n )\n ? size\n : undefined;\n const rootClass = usePrefixedClassNames('combobox', {\n [`is-${validSize}`]: !!validSize,\n 'is-inline': inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Combobox.Empty` when\n // the user's typing leaves it on screen: once each time that happens,\n // not again on each keystroke while it stays. An empty field isn't a\n // search, so it stays quiet then. While the field's `isLoading`, or a\n // loading Control around the Combobox, says results are on their way, it\n // waits, and it's said once loading ends with the message still there.\n const [inputLoading, setInputLoading] = useState(false);\n const controlLoading = useControlLoading();\n const [hasText, setHasText] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && hasText && emptyShown && !inputLoading && !controlLoading\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\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 // The menu is placed from here rather than from the part, since this\n // is where the field's element is known by the time the panel mounts.\n const panelRef = useRef<HTMLElement | null>(null);\n const [panelShown, setPanelShown] = useState(false);\n const placement = useAnchoredPosition(engine.rootRef, panelRef, {\n active: panelShown,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-combobox-menu-offset` as a margin, so\n // the coordinates leave it out and `auto` reads it off the panel.\n offset: 0,\n styledGap: marginGap,\n matchWidth: true,\n // The list filters as the user types, so the menu's height changes.\n followContent: true,\n });\n const { registerPopup } = engine;\n const reportPanel = useCallback(\n (element: HTMLElement) => {\n const forget = registerPopup(element);\n panelRef.current = element;\n setPanelShown(true);\n return () => {\n forget();\n panelRef.current = null;\n setPanelShown(false);\n };\n },\n [registerPopup]\n );\n\n const onFieldChange = (value: string) => {\n setHasText(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 and the open state from it.\n const context: ComboboxContextValue = {\n engine,\n inputId: controlId,\n reportInputId: setGivenInputId,\n labelId: listLabelId,\n ownLabelId: label && ownField ? listLabelId : undefined,\n reportLoading: setInputLoading,\n reportEmpty,\n onFieldChange,\n reportPanel,\n placement,\n size: validSize,\n multiple,\n inline,\n appendToBody,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n const comboboxElement = (\n // The ref after the spread, so the element stays the Combobox's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <ComboboxContext.Provider value={context}>\n {children}\n </ComboboxContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n const fieldElement =\n below === undefined ? (\n comboboxElement\n ) : (\n <div>\n {comboboxElement}\n {/* Part of the Combobox, as the menu is: a press here keeps focus\n in the field and doesn't count as outside, so the list and the\n search stay put. */}\n <div\n onPointerDownCapture={engine.markInside}\n onMouseDown={engine.keepFocus}\n >\n {below}\n </div>\n </div>\n );\n const messageEl = message ? <p className={helpClass}>{message}</p> : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {fieldElement}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {fieldElement}\n {messageEl}\n </>\n );\n }\n);\nComboboxParts.displayName = 'ComboboxParts';\n\n/**\n * The text field, with the combobox role and the keys, rendered as an `Input`.\n *\n * @function\n * @param {ComboboxInputProps} props - Props for the Combobox.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 ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n (\n {\n id,\n isLoading,\n controlSize,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCombobox();\n const { engine, reportInputId, reportLoading } = context;\n // Inside a caller's Control the field renders none of its own, so the\n // Combobox's size isn't handed to one there.\n const insideControl = useInsideControl();\n useClientLayoutEffect(() => {\n reportInputId(id);\n return () => reportInputId(undefined);\n }, [reportInputId, id]);\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 // An `id` of the field's own reaches the label from a layout effect, so\n // in server markup, and the first render, the label's `for` still names\n // the generated id. Until then the field points at the label itself,\n // unless the caller named it.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n const labelledBy = callerNamed\n ? props['aria-labelledby']\n : id !== undefined && id !== context.inputId\n ? context.ownLabelId\n : undefined;\n\n return (\n // The attributes the Combobox owns after the caller's, so a stray\n // `aria-expanded` never wins.\n <Input\n {...props}\n ref={inputRefs}\n id={id ?? context.inputId}\n aria-labelledby={labelledBy}\n isLoading={isLoading}\n size={context.size}\n controlSize={controlSize ?? (insideControl ? undefined : context.size)}\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);\nComboboxInput.displayName = 'ComboboxInput';\n\n/**\n * The floating panel under the field, on screen while the list is open and its children aren't all empty.\n *\n * @function\n * @param {ComboboxMenuProps} props - Props for the Combobox.Menu component.\n * @returns {JSX.Element | null} The panel, or nothing while the list is closed or its children are all empty.\n */\nexport const ComboboxMenu: React.FC<ComboboxMenuProps> = ({\n children,\n className,\n style,\n onMouseDown,\n onPointerDownCapture,\n ...props\n}) => {\n const { engine, inline, appendToBody, placement, reportPanel, size } =\n useCombobox();\n // Children that are all `null`, `false` or `''` leave no panel, whatever\n // `open` says. This reads the elements it's handed, not what they render.\n const hasContent = flattenChildren(children).some(child => child !== '');\n const shown = engine.open && !inline && hasContent;\n // A portaled panel has no server markup, so it only exists from the\n // commit after hydration. Everything that measures it waits for that.\n const hydrated = useIsHydrated();\n const mounted = shown && (hydrated || !appendToBody);\n const panelRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(() => {\n const panel = panelRef.current;\n return mounted && panel ? reportPanel(panel) : undefined;\n }, [mounted, reportPanel]);\n\n const menuClass = usePrefixedClassNames('dropdown-menu', 'combobox-menu', {\n [`is-${placement.position}`]: true,\n 'is-portal': appendToBody,\n [`is-${size}`]: !!size,\n });\n const contentClass = usePrefixedClassNames('dropdown-content');\n\n // Inline, the list is in the flow already.\n if (inline) return <>{children}</>;\n if (!shown) return null;\n\n return (\n <Portal disabled={!appendToBody}>\n <div\n {...props}\n ref={panelRef}\n className={classNames(menuClass, className)}\n style={\n appendToBody\n ? {\n ...style,\n position: 'fixed',\n top: placement.top,\n left: placement.left,\n minWidth: placement.minWidth,\n }\n : style\n }\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n onPointerDownCapture={event => {\n onPointerDownCapture?.(event);\n engine.markInside(event);\n }}\n >\n <div className={contentClass}>{children}</div>\n </div>\n </Portal>\n );\n};\nComboboxMenu.displayName = 'ComboboxMenu';\n\n/**\n * The list of items, a `listbox` named by the label that names the field.\n *\n * @function\n * @param {ComboboxListProps} props - Props for the Combobox.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const ComboboxList: React.FC<ComboboxListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, labelId, multiple } = useCombobox();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('combobox-list');\n // A name the caller gave the list wins over the label'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-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n aria-label={\n callerNamed ? props['aria-label'] : labelId ? undefined : 'Suggestions'\n }\n aria-multiselectable={multiple || undefined}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nComboboxList.displayName = 'ComboboxList';\n\n/**\n * One choice in the list, with a check mark while it's `checked`.\n *\n * @function\n * @param {ComboboxItemProps} props - Props for the Combobox.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const ComboboxItem: React.FC<ComboboxItemProps> = ({\n value,\n disabled = false,\n checked = false,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, multiple } = useCombobox();\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,\n }),\n [registerItem, value, disabled, checked]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('dropdown-item', 'combobox-item', {\n 'is-active': highlighted,\n 'is-checked': checked,\n 'is-disabled': disabled,\n });\n const checkClass = usePrefixedClassNames('combobox-check');\n // One value: the highlighted option, as the ARIA Authoring Practices'\n // combobox has it, and no attribute on the rest. Several: each option says\n // whether it's chosen. Never a disabled option.\n const selected = disabled\n ? undefined\n : multiple\n ? checked\n : highlighted || undefined;\n\n return (\n <div\n className={classNames(itemClass, className)}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled || undefined}\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 {checked && (\n <span className={checkClass} aria-hidden=\"true\">\n <CheckIcon />\n </span>\n )}\n {children}\n </div>\n );\n};\nComboboxItem.displayName = 'ComboboxItem';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {ComboboxGroupProps} props - Props for the Combobox.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const ComboboxGroup: React.FC<ComboboxGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('combobox-group');\n const labelClass = usePrefixedClassNames('combobox-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};\nComboboxGroup.displayName = 'ComboboxGroup';\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 {ComboboxEmptyProps} props - Props for the Combobox.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const ComboboxEmpty: React.FC<ComboboxEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCombobox();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('combobox-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};\nComboboxEmpty.displayName = 'ComboboxEmpty';\n\n/** An entry in `data` as an item: a string is its own label. */\nconst toItem = (entry: string | ComboboxItemData): ComboboxItemData =>\n typeof entry === 'string' ? { value: entry, label: entry } : entry;\n\nconst labelOf = (item: ComboboxItemData): string => item.label ?? item.value;\n\n/** One value or several, as a list: one value is a list of none or one. */\nconst asList = (value: string | string[] | null | undefined): string[] =>\n value == null ? [] : Array.isArray(value) ? value : [value];\n\n/**\n * The Combobox given `data`. It renders the parts itself, filters the items\n * by label as the user types, and keeps the value, so a pick goes through\n * the same parts, keys and ARIA as one built by hand.\n */\nconst ComboboxFromData = forwardRef<HTMLDivElement, ComboboxDataProps>(\n (props, ref) => {\n const {\n data,\n value,\n defaultValue,\n // Called below through `props`, which knows which value it takes.\n onChange: _onChange,\n multiple = false,\n placeholder,\n name,\n empty,\n itemTemplate,\n onSelect,\n onOpenChange,\n inline = false,\n disabled: disabledProp,\n required = false,\n form,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ariaCloseLabel,\n children,\n ...rest\n } = props;\n const disabled = useFieldsetDisabled(disabledProp);\n // A name given in place of a label is the field's and the list's, not\n // the wrapper's. Only the ones given are passed, since an\n // `aria-labelledby` that's there at all, even undefined, keeps the\n // label's name off the field.\n const named = {\n ...(ariaLabel !== undefined && { 'aria-label': ariaLabel }),\n ...(ariaLabelledBy !== undefined && {\n 'aria-labelledby': ariaLabelledBy,\n }),\n };\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Combobox:data-children',\n '[bestax-bulma] <Combobox data> renders its own field, menu and ' +\n 'items, so its children are ignored. Give it data or build it ' +\n 'from parts, not both.'\n );\n }\n const items = data.map(toItem);\n const labelFor = (picked: string) => {\n const item = items.find(entry => entry.value === picked);\n return item ? labelOf(item) : picked;\n };\n\n const controlled = value !== undefined;\n const [ownValue, setOwnValue] = useState(() => asList(defaultValue));\n const matchText = useLocaleMatcher();\n const picked = controlled ? asList(value) : ownValue;\n const change = (next: string[]) => {\n if (!controlled) setOwnValue(next);\n if (props.multiple === true) props.onChange?.(next);\n else props.onChange?.(next[0] ?? null);\n };\n\n // What's typed, or `null` while the field shows the value instead. The\n // ref holds it as it is now, since a pick sets it and the list's closing\n // reads it in the same event, before a render.\n const [query, setQueryState] = useState<string | null>(null);\n const queryRef = useRef<string | null>(null);\n const setQuery = (next: string | null) => {\n queryRef.current = next;\n setQueryState(next);\n };\n // Once the list closes or the field is left, the field shows the value\n // again: typed text goes back to the pick, and with one value a field\n // left empty clears it.\n const settle = () => {\n if (!multiple && queryRef.current === '' && picked.length > 0) {\n change([]);\n }\n setQuery(null);\n };\n const typed = (query ?? '').trim();\n const term = typed.toLowerCase();\n const shown = items.filter(item =>\n matchText\n ? matchText(labelOf(item), typed)\n : labelOf(item).toLowerCase().includes(term)\n );\n const inputRef = useRef<HTMLInputElement>(null);\n\n const select = (pick: string) => {\n onSelect?.(pick);\n if (multiple) {\n change(\n picked.includes(pick)\n ? picked.filter(v => v !== pick)\n : [...picked, pick]\n );\n } else {\n if (picked[0] !== pick) change([pick]);\n setQuery(null);\n }\n };\n const remove = (pick: string) => {\n change(picked.filter(v => v !== pick));\n inputRef.current?.focus();\n };\n // The picks, for the field's description, since its text is the search.\n const tagsId = useId();\n const ids = tagIds(tagsId, picked);\n\n // Each group where `data` first names it, and the items with none\n // together where the first of them is.\n const sections = new Map<string, ComboboxItemData[]>();\n for (const item of shown) {\n const group = item.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), item]);\n }\n const renderItem = (item: ComboboxItemData) => (\n <ComboboxItem\n key={item.value}\n value={item.value}\n disabled={disabled || item.disabled}\n checked={picked.includes(item.value)}\n >\n {itemTemplate ? itemTemplate(item) : labelOf(item)}\n </ComboboxItem>\n );\n const list =\n shown.length > 0 ? (\n <ComboboxList {...named}>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <ComboboxGroup key={group} label={group}>\n {members.map(renderItem)}\n </ComboboxGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </ComboboxList>\n ) : empty ? (\n <ComboboxEmpty>{empty}</ComboboxEmpty>\n ) : null;\n\n return (\n <ComboboxParts\n {...rest}\n ref={ref}\n multiple={multiple}\n inline={inline}\n onSelect={select}\n onSettle={settle}\n onOpenChange={next => {\n if (!next) settle();\n onOpenChange?.(next);\n }}\n below={\n multiple ? (\n <ValueTags\n values={picked}\n ids={ids}\n labelFor={labelFor}\n disabled={disabled}\n ariaCloseLabel={ariaCloseLabel}\n onRemove={remove}\n />\n ) : undefined\n }\n >\n <ComboboxInput\n {...named}\n ref={inputRef}\n id={id}\n disabled={disabled}\n // The browser's check reads the field's text, and only a pick\n // fills it for good, so it's required until there is one.\n required={required && picked.length === 0}\n aria-required={required || undefined}\n form={form}\n aria-describedby={\n multiple && picked.length > 0 ? ids.join(' ') : undefined\n }\n placeholder={placeholder}\n value={\n query ??\n (multiple || picked.length === 0 ? '' : labelFor(picked[0]))\n }\n onChange={event => setQuery(event.target.value)}\n onBlur={settle}\n />\n {inline ? list : <ComboboxMenu>{list}</ComboboxMenu>}\n <HiddenValues\n name={name}\n values={multiple ? picked : [picked[0] ?? '']}\n form={form}\n disabled={disabled}\n />\n </ComboboxParts>\n );\n }\n);\nComboboxFromData.displayName = 'ComboboxFromData';\n\n/**\n * The `Combobox` component is a text field with a list to pick from under it, for a searchable select, a multi-select with tags, grouped items or a server search: given `data` it does the rest, and built from parts it leaves the data to you.\n *\n * Given `data`, it's one element. It renders the field, the menu, the list,\n * the groups and the empty message, filters the items by label as the user\n * types, and keeps the value, which `onChange` reports. With `multiple`, the\n * picks show as tags under the field.\n *\n * Built from parts, the app owns the data: what's in the list, how it's\n * filtered, and the value. A pick calls `onSelect` with the item's `value`,\n * and the Combobox keeps no value and never changes the text in the field,\n * so the app sets both there. Nothing filters the items either, so a\n * server's answer shows as it came. For a free-text field with suggestions,\n * `Autocomplete` is the simpler choice.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. With one value, the highlighted item is the\n * `aria-selected` one, as the ARIA Authoring Practices' combobox does it, and\n * a `checked` item shows a check mark and takes the highlight when the list\n * opens. With `multiple`, `checked` is each item's `aria-selected`. Tab and\n * focus leaving close the menu without picking.\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. Show one in\n * a `role=\"status\"` line beside the field when it matters.\n *\n * @function\n * @param {ComboboxProps} props - Props for the Combobox component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.combobox`.\n * @returns {JSX.Element} The field and its list, in a `Field` with the label unless one is around it.\n *\n * @example\n * <Combobox\n * label=\"Country\"\n * data={['Canada', 'France', 'Japan']}\n * placeholder=\"Pick a country\"\n * empty=\"No countries match\"\n * />\n *\n * @example\n * <Combobox label=\"Country\" onSelect={pick}>\n * <Combobox.Input value={query} onChange={e => setQuery(e.target.value)} />\n * <Combobox.Menu>\n * {matches.length > 0 ? (\n * <Combobox.List>\n * {matches.map(c => (\n * <Combobox.Item key={c} value={c} checked={c === value}>\n * {c}\n * </Combobox.Item>\n * ))}\n * </Combobox.List>\n * ) : (\n * <Combobox.Empty>No countries match</Combobox.Empty>\n * )}\n * </Combobox.Menu>\n * </Combobox>\n */\nconst ComboboxRoot = forwardRef<HTMLDivElement, ComboboxProps>((props, ref) =>\n props.data === undefined ? (\n <ComboboxParts {...props} ref={ref} />\n ) : (\n <ComboboxFromData {...props} ref={ref} />\n )\n);\n\n/** Combobox with Input, Menu, List, Item, Group and Empty sub-components. */\nexport const Combobox = withSubComponents(\n ComboboxRoot,\n {\n Input: ComboboxInput,\n Menu: ComboboxMenu,\n List: ComboboxList,\n Item: ComboboxItem,\n Group: ComboboxGroup,\n Empty: ComboboxEmpty,\n },\n 'Combobox'\n);\n\nexport default Combobox;\n"],"names":["noop","standalone","setRefs","_jsxs","_jsx","_Fragment","asList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAEhE;AACA;AACA;AACA,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACxC,MAAM,iBAAiB,GAA0B,EAAE;AAobnD,MAAMA,MAAI,GAAG,MAAK,EAAE,CAAC;AACrB,MAAM,eAAe,GAAG,MAAMA,MAAI;AAElC;AACA;AACA,MAAMC,YAAU,GAAyB;AACvC,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,MAAM,EAAE,MAAM,EAAE;AAChB,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC1B,QAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC3B,QAAA,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC7B,QAAA,aAAa,EAAE,eAAe;AAC9B,QAAA,YAAY,EAAE,eAAe;AAC7B,QAAA,SAAS,EAAED,MAAI;AACf,QAAA,QAAQ,EAAEA,MAAI;AACd,QAAA,OAAO,EAAEA,MAAI;AACb,QAAA,MAAM,EAAEA,MAAI;AACZ,QAAA,KAAK,EAAEA,MAAI;AACX,QAAA,IAAI,EAAEA,MAAI;AACV,QAAA,SAAS,EAAEA,MAAI;AACf,QAAA,UAAU,EAAEA,MAAI;AACjB,KAAA;AACD,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,aAAa,EAAEA,MAAI;AACnB,IAAA,OAAO,EA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V,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAC7C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAAA,CAClB,CAAA,EAAA,CACY;AAEpB,CAAC,CACF;AACD,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DG;AACH,MAAM,YAAY,GAAG,UAAU,CAAgC,CAAC,KAAK,EAAE,GAAG,KACxE,KAAK,CAAC,IAAI,KAAK,SAAS,IACtBA,GAAA,CAAC,aAAa,OAAK,KAAK,EAAE,GAAG,EAAE,GAAG,GAAI,KAEtCA,IAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAA,CAAI,CAC1C,CACF;AAED;AACO,MAAM,QAAQ,GAAG,iBAAiB,CACvC,YAAY,EACZ;AACE,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,KAAK,EAAE,aAAa;AACpB,IAAA,KAAK,EAAE,aAAa;CACrB,EACD,UAAU;;"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","sources":["../../../src/form/Combobox.tsx"],"sourcesContent":["import React, {\n createContext,\n forwardRef,\n useCallback,\n useContext,\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 { Portal } from '../helpers/portal';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { useClientLayoutEffect } from '../helpers/useClientLayoutEffect';\nimport { flattenChildren } from '../helpers/flattenChildren';\nimport { warnOnce } from '../helpers/devWarnings';\nimport { useLocaleMatcher } from '../helpers/localeFormat';\nimport {\n AnchoredPosition,\n marginGap,\n useAnchoredPosition,\n} from '../helpers/useAnchoredPosition';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\nimport { CheckIcon } from '../helpers/checkIcon';\nimport {\n ComboboxEngine,\n useComboboxEngine,\n} from '../helpers/useComboboxEngine';\nimport type { PopoverPosition } from '../components/Popover';\nimport { Field } from './Field';\nimport { Input, InputProps } from './Input';\nimport { FormFieldProps } from './fieldProps';\nimport {\n rendersOwnField,\n useFieldsetDisabled,\n useInsideControl,\n useInsideField,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\nimport { useControlLoading } from './controlLoading';\nimport { HiddenValues, ValueTags, tagIds } from './_selectInternals/ValueTags';\n\nconst validComboboxSizes = ['small', 'medium', 'large'] as const;\n\n// What the status region announces: the `Combobox.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/**\n * One item in a Combobox's `data`. A string there is an item whose label is\n * its value.\n */\nexport interface ComboboxItemData {\n /**\n * What `onSelect` and `onChange` hand back, and what `name` posts. Unique\n * within the Combobox.\n */\n value: string;\n /** What the item shows, and what typing matches. The `value` when it's left out. */\n label?: string;\n /**\n * Can't be picked. The arrows still reach it, so a screen reader user\n * finds it.\n */\n disabled?: boolean;\n /**\n * The heading the item goes under. Groups show in the order `data` first\n * names them, and the items with no group show together where the first of\n * them is.\n */\n group?: string;\n}\n\n/** What a Combobox takes whether it's given `data` or built from parts. */\ninterface ComboboxBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'color' | 'onChange' | 'onSelect' | 'defaultValue'\n >,\n Omit<BulmaClassesProps, 'color'>,\n FormFieldProps {\n /**\n * The field's label, which names `Combobox.Input` through `htmlFor`, and\n * the list through `aria-labelledby`. Dropped inside an outer `Field`,\n * whose label names both instead when it points at the field. When\n * `Combobox.Input` has an `id` of its own, server markup names the field\n * through `aria-labelledby` until the page hydrates and the label's `for`\n * catches up.\n */\n label?: React.ReactNode;\n /**\n * Props for the label element. An explicit `htmlFor` takes over the\n * association: give `Combobox.Input` the same `id`, and the list is still\n * named after the label.\n */\n labelProps?: React.LabelHTMLAttributes<HTMLLabelElement> & {\n [key: string]: unknown;\n };\n /**\n * Controlled open state. When set, opening and closing only report\n * through `onOpenChange`.\n */\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 typing, a click in\n * the field or Down Arrow, and `false` from Escape, Tab, a pick with one\n * value, focus leaving or a press outside. Fires in controlled and\n * uncontrolled use.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Called with an item's `value` when it's picked with Enter or a click.\n * A disabled item is never picked. With `data`, `onChange` reports the\n * value that follows. Built from parts, the Combobox keeps no value and\n * doesn't change the text in the field: update yours here.\n */\n onSelect?: (value: string) => void;\n /**\n * Highlights the first enabled item whenever the list opens or its\n * items change, so Enter picks the top match. It only highlights:\n * leaving the field still picks nothing, and so does Tab.\n * @defaultValue false\n */\n keepFirst?: boolean;\n /**\n * The list is always on screen, in the flow under the field, as in a\n * Popover or a page panel. There's no menu, so nothing closes it, and\n * Escape goes to whatever is around it.\n * @defaultValue false\n */\n inline?: boolean;\n /**\n * Where the menu opens against the field: below (`bottom-*`) or above\n * (`top-*`), lined up with its left or right edge. `auto` picks the one\n * that keeps the list in the viewport, preferring below. The same union\n * Popover takes.\n * @defaultValue 'bottom-left'\n */\n position?: PopoverPosition;\n /**\n * Renders the menu through `Portal`, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default, fixed to the viewport\n * at the field, so a container that clips its overflow can't cut it off.\n * It then shows from the commit after hydration, never in server markup.\n * Theming variables set on an ancestor reach it only when the portal's\n * container is inside that ancestor, as with Popover. In a `Modal`, point\n * `portalContainer` inside the modal, so the list stays in the dialog for\n * assistive tech.\n * @defaultValue false\n */\n appendToBody?: boolean;\n /** Sizes the field and the items together. */\n size?: 'small' | 'medium' | 'large';\n}\n\n/** What a Combobox given `data` takes, with one value or several. */\ninterface ComboboxDataBaseProps extends ComboboxBaseProps {\n /** The field's placeholder, with `data`. */\n placeholder?: string;\n /**\n * A form field name, with `data`. A hidden input posts the value, empty\n * while there's none, and with `multiple` a hidden input posts each value.\n */\n name?: string;\n /**\n * What the menu shows in place of the list, with `data`, when nothing\n * matches the typing, such as \"No countries match\". It's announced the way\n * `Combobox.Empty` is. Without it, the menu closes while nothing matches.\n */\n empty?: React.ReactNode;\n /**\n * Renders an item's content, with `data`, in place of its label. It's\n * handed the item from `data`, a string there arriving as\n * `{ value, label }`.\n */\n itemTemplate?: (item: ComboboxItemData) => React.ReactNode;\n /**\n * The field can't be used, with `data`: it can't be focused or typed in,\n * its items can't be picked, its tags lose their buttons, and its hidden\n * inputs don't post, the way a disabled field's value doesn't.\n */\n disabled?: boolean;\n /**\n * A value is needed, with `data`. The field is `required` while nothing is\n * picked, so the browser's own check stops the form the way it does for\n * Autocomplete's field, and it's `aria-required` the whole time. The check\n * reads the field's text, which Enter, the list closing or leaving the\n * field puts back to the pick.\n */\n required?: boolean;\n /**\n * The id of the form the value posts with, with `data`, for a field\n * outside it. It goes on the hidden inputs, and on the field so that form\n * checks `required` too.\n */\n form?: string;\n /**\n * The field's `id`, with `data`, which the label then points at, and so\n * can a label of your own. Built from parts, it lands on `div.combobox`, so\n * give `Combobox.Input` the `id` instead.\n */\n id?: string;\n /**\n * Names the field and the list, with `data`, in place of a `label`. Built\n * from parts, it lands on `div.combobox`, so put it on `Combobox.Input`.\n */\n 'aria-label'?: string;\n /**\n * The ids of what names the field and the list, with `data`, in place of\n * a `label`. Built from parts, it lands on `div.combobox`, so put it on\n * `Combobox.Input`.\n */\n 'aria-labelledby'?: string;\n /** With `data`, the Combobox renders its own parts. */\n children?: never;\n}\n\n/** Props for a Combobox given `data`, with one value. */\nexport interface ComboboxSingleDataProps extends ComboboxDataBaseProps {\n /**\n * The items, for a Combobox that renders the field, the menu, the list,\n * the groups and the empty message itself. A string is an item whose label\n * is its value, and an object is `{ value, label?, disabled?, group? }`.\n * Typing filters the items by label, ignoring case, and inside a\n * `LocaleProvider` with a `locale`, ignoring accents too where that\n * language does, so \"cafe\" finds \"Café\". The Combobox keeps the value. Leave it out to build the Combobox from parts.\n */\n data: (string | ComboboxItemData)[];\n /**\n * Several values can be picked. The list stays open after a pick, it's\n * `aria-multiselectable`, and each item's `checked` is its\n * `aria-selected`. With `data`, the value is an array, and the picks show\n * as tags under the field, inside its Field, each with a button that takes\n * it off. The field's description lists them, since its text is the\n * search.\n * @defaultValue false\n */\n multiple?: false;\n /**\n * The value, controlled, with `data`: the picked item's `value`, or `null`\n * for none, and with `multiple` an array of them. With one value, the\n * field shows the picked item's label while you aren't typing in it, and\n * the list closing or the field being left puts it back over any typing.\n * A field emptied and left like that clears the value.\n */\n value?: string | null;\n /** The value to start with when uncontrolled, with `data`. */\n defaultValue?: string | null;\n /**\n * Called with the new value, with `data`, when a pick, a tag's button or\n * a field left empty changes it: an item's `value` or `null`, or with\n * `multiple` the array.\n */\n onChange?: (value: string | null) => void;\n /** With one value there are no tags to name. */\n ariaCloseLabel?: never;\n}\n\n/** Props for a Combobox given `data`, with several values. */\nexport interface ComboboxMultipleDataProps extends ComboboxDataBaseProps {\n /**\n * The items, for a Combobox that renders itself. A string is an item whose\n * label is its value, and an object is `{ value, label?, disabled?, group? }`.\n */\n data: (string | ComboboxItemData)[];\n /**\n * Several values can be picked: the value is an array, and the picks show\n * as tags under the field, each with a button that takes it off. The\n * field's description lists them.\n */\n multiple: true;\n /** The values, controlled: the picked items' `value`s. */\n value?: string[];\n /** The values to start with when uncontrolled. */\n defaultValue?: string[];\n /** Called with the new array when a pick or a tag's button changes it. */\n onChange?: (value: string[]) => void;\n /**\n * Names each tag's button, in place of \"Remove\" and the item's label, as\n * Taginput's does. The button is then described by its tag's label, so it\n * still says which tag it takes off.\n */\n ariaCloseLabel?: string;\n}\n\n/** Props for a Combobox given `data`. */\ntype ComboboxDataProps = ComboboxSingleDataProps | ComboboxMultipleDataProps;\n\n/** Props for a Combobox built from parts. */\nexport interface ComboboxPartsProps extends ComboboxBaseProps {\n /**\n * The parts, in order: `Combobox.Input`, then `Combobox.Menu` with\n * `Combobox.List` and `Combobox.Empty` in it. With `inline`, the\n * `Combobox.List` and `Combobox.Empty` go straight in. Render\n * `Combobox.List` while there are items and `Combobox.Empty` while\n * there aren't: the empty message sits beside the list, not in it. With\n * `data` there are none to give: children given with it are ignored, with\n * a warning in development.\n */\n children?: React.ReactNode;\n /**\n * Several values can be picked. The list stays open after a pick, it's\n * `aria-multiselectable`, and each item's `checked` is its\n * `aria-selected`.\n * @defaultValue false\n */\n multiple?: boolean;\n /** Built from parts, there's no `data`. */\n data?: never;\n /** Built from parts, the app keeps the value. */\n value?: never;\n /** Built from parts, the app keeps the value. */\n defaultValue?: never;\n /** Built from parts, `onSelect` reports a pick. */\n onChange?: never;\n /** Built from parts, `Combobox.Input` takes the placeholder. */\n placeholder?: never;\n /** Built from parts, the app posts the value. */\n name?: never;\n /** Built from parts, `Combobox.Empty` is the empty message. */\n empty?: never;\n /** Built from parts, `Combobox.Item` renders its own content. */\n itemTemplate?: never;\n /** Built from parts, `Combobox.Input` takes `disabled`. */\n disabled?: never;\n /** Built from parts, `Combobox.Input` takes `required`. */\n required?: never;\n /** Built from parts, the app posts the value. */\n form?: never;\n}\n\n/**\n * Props for the Combobox component: given `data`, it renders itself and\n * keeps the value, and without it, it's built from parts. The helper props,\n * the other attributes and the `ref` land on the `div.combobox` around the\n * field and the list. It renders the `Field` and the label itself, unless an\n * outer `Field` already does.\n *\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the `div.combobox` around the field and the list.\n */\nexport type ComboboxProps =\n ComboboxSingleDataProps | ComboboxMultipleDataProps | ComboboxPartsProps;\n\n/**\n * Props for Combobox.Input, the text field. It renders `Input`, so its icons,\n * `isLoading` and `color` work as they do there. The Field props go on the\n * Combobox, and the size comes from it. The field is `autoComplete=\"off\"`,\n * so the browser's own suggestions don't open over the list, and that isn't\n * yours to set.\n */\nexport type ComboboxInputProps = Omit<\n InputProps,\n // By name, since the docs read only names out of an Omit, and\n // `__typetests__/combobox.tsx` fails if one goes missing. The Field props:\n | 'label'\n | 'labelSize'\n | 'labelProps'\n | 'horizontal'\n | 'message'\n | 'messageColor'\n | 'fieldClassName'\n // And what the Combobox sets on the field itself:\n | 'size'\n | 'role'\n | 'autoComplete'\n>;\n\n/** Props for Combobox.Menu, the floating panel under the field. */\nexport interface ComboboxMenuProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * What the panel shows: `Combobox.List` while there are items, and\n * `Combobox.Empty` while there aren't. Children that are all `null`,\n * `false` or `''`, or empty Fragments, keep the panel shut, so write the\n * conditional here. A component that renders nothing, or a\n * `Combobox.List` with no items in it, still counts, and shows an\n * empty panel.\n */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Combobox.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 ComboboxListProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'id'\n> {\n /** `Combobox.Item`s and `Combobox.Group`s, in the order they're shown. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for Combobox.Item, one choice 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 ComboboxItemProps extends Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'role' | 'onSelect' | 'id'\n> {\n /** What `onSelect` hands back. Unique within the Combobox. */\n value: string;\n /**\n * Can't be picked. The arrows still reach it, so a screen reader user\n * finds it, and it's never `aria-selected`.\n * @defaultValue false\n */\n disabled?: boolean;\n /**\n * It's the value, or one of them. It shows a check mark, the list opens\n * with the highlight on it, and with `multiple` it's the `aria-selected`.\n * @defaultValue false\n */\n checked?: boolean;\n /** What the item shows: text, or text with an avatar, a tag or a hint. */\n children?: React.ReactNode;\n}\n\n/** Props for Combobox.Group, items under a heading. */\nexport interface ComboboxGroupProps 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 `Combobox.Item`s. */\n children?: React.ReactNode;\n}\n\n/** Props for Combobox.Empty, the message shown in place of the list. */\nexport interface ComboboxEmptyProps extends React.HTMLAttributes<HTMLDivElement> {\n /**\n * The message, such as \"No countries 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 query is heard for the first query only.\n */\n children?: React.ReactNode;\n}\n\n/** What the Combobox hands its parts. */\ninterface ComboboxContextValue {\n engine: ComboboxEngine;\n /** The id the field takes when it's given none. */\n inputId: string | undefined;\n /** Tells the Combobox the id the field was given, so the label follows it. */\n reportInputId: (id: string | undefined) => void;\n /** The id of the label that names the field, which names the list too. */\n labelId: string | undefined;\n /**\n * The id of the label the Combobox renders itself, when it names the field.\n * The field points at it while its own `id` hasn't reached the label yet.\n */\n ownLabelId: string | undefined;\n /** Tells the Combobox 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 /** A change to the field's value, which is the user typing. */\n onFieldChange: (value: string) => void;\n /**\n * Records the menu's panel while it's on screen, so it's placed and\n * counts as inside. Returns the function that forgets it.\n */\n reportPanel: (element: HTMLElement) => () => void;\n /** Where the panel goes against the field. */\n placement: AnchoredPosition;\n size?: ComboboxProps['size'];\n multiple: boolean;\n inline: boolean;\n appendToBody: boolean;\n}\n\nconst noop = () => {};\nconst registerNothing = () => noop;\n\n// What a part rendered outside a Combobox reads: closed, with nothing to\n// report to, so it renders its markup and does nothing.\nconst standalone: ComboboxContextValue = {\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 inputId: undefined,\n reportInputId: noop,\n labelId: undefined,\n ownLabelId: undefined,\n reportLoading: noop,\n reportEmpty: registerNothing,\n onFieldChange: noop,\n reportPanel: registerNothing,\n placement: { position: 'bottom-left' },\n multiple: false,\n inline: false,\n appendToBody: false,\n};\n\nconst ComboboxContext = createContext<ComboboxContextValue | null>(null);\n\nconst useCombobox = () => useContext(ComboboxContext) ?? 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 Combobox built from parts: the field, the menu, the list and the\n * keys, with the data, the filtering and the value left to the app.\n */\n/** What the parts root takes from the Combobox given `data`, beyond the parts' props. */\ninterface ComboboxPartsRootProps extends ComboboxPartsProps {\n /**\n * Shown under the Combobox, inside its Field and ahead of the message: the\n * tags of several values. While it's given, the two share a wrapper, so\n * they stay together in a horizontal Field's body.\n */\n below?: React.ReactNode;\n /**\n * Called when Enter goes on to the form with nothing to pick, so the\n * Combobox given `data` can put the field's text back first, `inline`\n * included, where nothing closes.\n */\n onSettle?: () => void;\n}\n\nconst ComboboxParts = forwardRef<HTMLDivElement, ComboboxPartsRootProps>(\n (\n {\n children,\n below,\n onSettle,\n open,\n defaultOpen = false,\n onOpenChange,\n onSelect,\n keepFirst = false,\n multiple = false,\n inline = false,\n position = 'bottom-left',\n appendToBody = false,\n size,\n label,\n labelSize,\n labelProps,\n horizontal,\n message,\n messageColor,\n fieldClassName,\n className,\n ...props\n },\n ref\n ) => {\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('Combobox', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // The field's own `id`, when `Combobox.Input` was given one, which the\n // label then points at.\n const [givenInputId, setGivenInputId] = useState<string | undefined>();\n const {\n controlId,\n fieldLabelProps,\n labelId: listLabelId,\n } = useAutoLabelId({\n label,\n id: givenInputId,\n labelProps,\n rendersLabel: ownField,\n needsLabelId: true,\n });\n const engine = useComboboxEngine({\n open,\n defaultOpen,\n onOpenChange,\n onSelect,\n onSettle,\n keepFirst,\n multiple,\n inline,\n // A portaled panel has no server markup to point at.\n deferred: appendToBody && !inline,\n });\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const validSize = (validComboboxSizes as readonly string[]).includes(\n size as string\n )\n ? size\n : undefined;\n const rootClass = usePrefixedClassNames('combobox', {\n [`is-${validSize}`]: !!validSize,\n 'is-inline': inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // A polite status region, in the page from the start so it's there\n // before anything is written into it, announces `Combobox.Empty` when\n // the user's typing leaves it on screen: once each time that happens,\n // not again on each keystroke while it stays. An empty field isn't a\n // search, so it stays quiet then. While the field's `isLoading`, or a\n // loading Control around the Combobox, says results are on their way, it\n // waits, and it's said once loading ends with the message still there.\n const [inputLoading, setInputLoading] = useState(false);\n const controlLoading = useControlLoading();\n const [hasText, setHasText] = useState(false);\n const emptyRef = useRef<HTMLElement | null>(null);\n const [emptyShown, setEmptyShown] = useState(false);\n const announced =\n engine.typed && hasText && emptyShown && !inputLoading && !controlLoading\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\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 // The menu is placed from here rather than from the part, since this\n // is where the field's element is known by the time the panel mounts.\n const panelRef = useRef<HTMLElement | null>(null);\n const [panelShown, setPanelShown] = useState(false);\n const placement = useAnchoredPosition(engine.rootRef, panelRef, {\n active: panelShown,\n position,\n fixed: appendToBody,\n // The gap comes from `--bulma-combobox-menu-offset` as a margin, so\n // the coordinates leave it out and `auto` reads it off the panel.\n offset: 0,\n styledGap: marginGap,\n matchWidth: true,\n // The list filters as the user types, so the menu's height changes.\n followContent: true,\n });\n const { registerPopup } = engine;\n const reportPanel = useCallback(\n (element: HTMLElement) => {\n const forget = registerPopup(element);\n panelRef.current = element;\n setPanelShown(true);\n return () => {\n forget();\n panelRef.current = null;\n setPanelShown(false);\n };\n },\n [registerPopup]\n );\n\n const onFieldChange = (value: string) => {\n setHasText(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 and the open state from it.\n const context: ComboboxContextValue = {\n engine,\n inputId: controlId,\n reportInputId: setGivenInputId,\n labelId: listLabelId,\n ownLabelId: label && ownField ? listLabelId : undefined,\n reportLoading: setInputLoading,\n reportEmpty,\n onFieldChange,\n reportPanel,\n placement,\n size: validSize,\n multiple,\n inline,\n appendToBody,\n };\n\n const { rootRef } = engine;\n const rootRefs = useCallback(\n (node: HTMLDivElement | null) => setRefs(node, rootRef, ref),\n [rootRef, ref]\n );\n\n const comboboxElement = (\n // The ref after the spread, so the element stays the Combobox's.\n <div\n className={classNames(rootClass, bulmaHelperClasses, className)}\n {...rest}\n ref={rootRefs}\n >\n <ComboboxContext.Provider value={context}>\n {children}\n </ComboboxContext.Provider>\n <StatusRegion items={announced} describe={describeEmpty} />\n </div>\n );\n const fieldElement =\n below === undefined ? (\n comboboxElement\n ) : (\n <div>\n {comboboxElement}\n {/* Part of the Combobox, as the menu is: a press here keeps focus\n in the field and doesn't count as outside, so the list and the\n search stay put. */}\n <div\n onPointerDownCapture={engine.markInside}\n onMouseDown={engine.keepFocus}\n >\n {below}\n </div>\n </div>\n );\n const messageEl = message ? <p className={helpClass}>{message}</p> : null;\n\n if (ownField) {\n return (\n <Field\n label={label}\n labelSize={labelSize}\n labelProps={fieldLabelProps}\n horizontal={horizontal}\n className={fieldClassName}\n >\n {fieldElement}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {fieldElement}\n {messageEl}\n </>\n );\n }\n);\nComboboxParts.displayName = 'ComboboxParts';\n\n/**\n * The text field, with the combobox role and the keys, rendered as an `Input`.\n *\n * @function\n * @param {ComboboxInputProps} props - Props for the Combobox.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 ComboboxInput = forwardRef<HTMLInputElement, ComboboxInputProps>(\n (\n {\n id,\n isLoading,\n controlSize,\n onKeyDown,\n onChange,\n onClick,\n onBlur,\n 'aria-autocomplete': ariaAutocomplete,\n ...props\n },\n ref\n ) => {\n const context = useCombobox();\n const { engine, reportInputId, reportLoading } = context;\n // Inside a caller's Control the field renders none of its own, so the\n // Combobox's size isn't handed to one there.\n const insideControl = useInsideControl();\n useClientLayoutEffect(() => {\n reportInputId(id);\n return () => reportInputId(undefined);\n }, [reportInputId, id]);\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 // An `id` of the field's own reaches the label from a layout effect, so\n // in server markup, and the first render, the label's `for` still names\n // the generated id. Until then the field points at the label itself,\n // unless the caller named it.\n const callerNamed = !!props['aria-label'] || 'aria-labelledby' in props;\n const labelledBy = callerNamed\n ? props['aria-labelledby']\n : id !== undefined && id !== context.inputId\n ? context.ownLabelId\n : undefined;\n\n return (\n // The attributes the Combobox owns after the caller's, so a stray\n // `aria-expanded` never wins.\n <Input\n {...props}\n ref={inputRefs}\n id={id ?? context.inputId}\n aria-labelledby={labelledBy}\n isLoading={isLoading}\n size={context.size}\n controlSize={controlSize ?? (insideControl ? undefined : context.size)}\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);\nComboboxInput.displayName = 'ComboboxInput';\n\n/**\n * The floating panel under the field, on screen while the list is open and its children aren't all empty.\n *\n * @function\n * @param {ComboboxMenuProps} props - Props for the Combobox.Menu component.\n * @returns {JSX.Element | null} The panel, or nothing while the list is closed or its children are all empty.\n */\nexport const ComboboxMenu: React.FC<ComboboxMenuProps> = ({\n children,\n className,\n style,\n onMouseDown,\n onPointerDownCapture,\n ...props\n}) => {\n const { engine, inline, appendToBody, placement, reportPanel, size } =\n useCombobox();\n // Children that are all `null`, `false` or `''` leave no panel, whatever\n // `open` says. This reads the elements it's handed, not what they render.\n const hasContent = flattenChildren(children).some(child => child !== '');\n const shown = engine.open && !inline && hasContent;\n // A portaled panel has no server markup, so it only exists from the\n // commit after hydration. Everything that measures it waits for that.\n const hydrated = useIsHydrated();\n const mounted = shown && (hydrated || !appendToBody);\n const panelRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(() => {\n const panel = panelRef.current;\n return mounted && panel ? reportPanel(panel) : undefined;\n }, [mounted, reportPanel]);\n\n const menuClass = usePrefixedClassNames('dropdown-menu', 'combobox-menu', {\n [`is-${placement.position}`]: true,\n 'is-portal': appendToBody,\n [`is-${size}`]: !!size,\n });\n const contentClass = usePrefixedClassNames('dropdown-content');\n\n // Inline, the list is in the flow already.\n if (inline) return <>{children}</>;\n if (!shown) return null;\n\n return (\n <Portal disabled={!appendToBody}>\n <div\n {...props}\n ref={panelRef}\n className={classNames(menuClass, className)}\n style={\n appendToBody\n ? {\n ...style,\n position: 'fixed',\n top: placement.top,\n left: placement.left,\n minWidth: placement.minWidth,\n }\n : style\n }\n onMouseDown={event => {\n onMouseDown?.(event);\n engine.keepFocus(event);\n }}\n onPointerDownCapture={event => {\n onPointerDownCapture?.(event);\n engine.markInside(event);\n }}\n >\n <div className={contentClass}>{children}</div>\n </div>\n </Portal>\n );\n};\nComboboxMenu.displayName = 'ComboboxMenu';\n\n/**\n * The list of items, a `listbox` named by the label that names the field.\n *\n * @function\n * @param {ComboboxListProps} props - Props for the Combobox.List component.\n * @returns {JSX.Element} The listbox.\n */\nexport const ComboboxList: React.FC<ComboboxListProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, labelId, multiple } = useCombobox();\n const { listboxRef, listboxId, keepFocus } = engine;\n const listClass = usePrefixedClassNames('combobox-list');\n // A name the caller gave the list wins over the label'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-labelledby={callerNamed ? props['aria-labelledby'] : labelId}\n aria-label={\n callerNamed ? props['aria-label'] : labelId ? undefined : 'Suggestions'\n }\n aria-multiselectable={multiple || undefined}\n onMouseDown={event => {\n onMouseDown?.(event);\n keepFocus(event);\n }}\n >\n {children}\n </div>\n );\n};\nComboboxList.displayName = 'ComboboxList';\n\n/**\n * One choice in the list, with a check mark while it's `checked`.\n *\n * @function\n * @param {ComboboxItemProps} props - Props for the Combobox.Item component.\n * @returns {JSX.Element} The item.\n */\nexport const ComboboxItem: React.FC<ComboboxItemProps> = ({\n value,\n disabled = false,\n checked = false,\n children,\n className,\n onClick,\n onPointerMove,\n ...props\n}) => {\n const { engine, multiple } = useCombobox();\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,\n }),\n [registerItem, value, disabled, checked]\n );\n const highlighted = engine.highlighted === value;\n const itemClass = usePrefixedClassNames('dropdown-item', 'combobox-item', {\n 'is-active': highlighted,\n 'is-checked': checked,\n 'is-disabled': disabled,\n });\n const checkClass = usePrefixedClassNames('combobox-check');\n // One value: the highlighted option, as the ARIA Authoring Practices'\n // combobox has it, and no attribute on the rest. Several: each option says\n // whether it's chosen. Never a disabled option.\n const selected = disabled\n ? undefined\n : multiple\n ? checked\n : highlighted || undefined;\n\n return (\n <div\n className={classNames(itemClass, className)}\n {...props}\n ref={itemRef}\n id={engine.itemId(value) || undefined}\n role=\"option\"\n aria-selected={selected}\n aria-disabled={disabled || undefined}\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 {checked && (\n <span className={checkClass} aria-hidden=\"true\">\n <CheckIcon />\n </span>\n )}\n {children}\n </div>\n );\n};\nComboboxItem.displayName = 'ComboboxItem';\n\n/**\n * Items under a heading, a `group` named by it.\n *\n * @function\n * @param {ComboboxGroupProps} props - Props for the Combobox.Group component.\n * @returns {JSX.Element} The group and its heading.\n */\nexport const ComboboxGroup: React.FC<ComboboxGroupProps> = ({\n label,\n children,\n className,\n ...props\n}) => {\n const labelId = useId();\n const groupClass = usePrefixedClassNames('combobox-group');\n const labelClass = usePrefixedClassNames('combobox-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};\nComboboxGroup.displayName = 'ComboboxGroup';\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 {ComboboxEmptyProps} props - Props for the Combobox.Empty component.\n * @returns {JSX.Element} The message.\n */\nexport const ComboboxEmpty: React.FC<ComboboxEmptyProps> = ({\n children,\n className,\n onMouseDown,\n ...props\n}) => {\n const { engine, reportEmpty } = useCombobox();\n const emptyRef = useRef<HTMLDivElement>(null);\n useClientLayoutEffect(\n () => reportEmpty(emptyRef.current as HTMLDivElement),\n [reportEmpty]\n );\n const emptyClass = usePrefixedClassNames('combobox-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};\nComboboxEmpty.displayName = 'ComboboxEmpty';\n\n/** An entry in `data` as an item: a string is its own label. */\nconst toItem = (entry: string | ComboboxItemData): ComboboxItemData =>\n typeof entry === 'string' ? { value: entry, label: entry } : entry;\n\nconst labelOf = (item: ComboboxItemData): string => item.label ?? item.value;\n\n/** One value or several, as a list: one value is a list of none or one. */\nconst asList = (value: string | string[] | null | undefined): string[] =>\n value == null ? [] : Array.isArray(value) ? value : [value];\n\n/**\n * The Combobox given `data`. It renders the parts itself, filters the items\n * by label as the user types, and keeps the value, so a pick goes through\n * the same parts, keys and ARIA as one built by hand.\n */\nconst ComboboxFromData = forwardRef<HTMLDivElement, ComboboxDataProps>(\n (props, ref) => {\n const {\n data,\n value,\n defaultValue,\n // Called below through `props`, which knows which value it takes.\n onChange: _onChange,\n multiple = false,\n placeholder,\n name,\n empty,\n itemTemplate,\n onSelect,\n onOpenChange,\n inline = false,\n disabled: disabledProp,\n required = false,\n form,\n id,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ariaCloseLabel,\n children,\n ...rest\n } = props;\n const disabled = useFieldsetDisabled(disabledProp);\n // A name given in place of a label is the field's and the list's, not\n // the wrapper's. Only the ones given are passed, since an\n // `aria-labelledby` that's there at all, even undefined, keeps the\n // label's name off the field.\n const named = {\n ...(ariaLabel !== undefined && { 'aria-label': ariaLabel }),\n ...(ariaLabelledBy !== undefined && {\n 'aria-labelledby': ariaLabelledBy,\n }),\n };\n if (flattenChildren(children).length > 0) {\n warnOnce(\n 'Combobox:data-children',\n '[bestax-bulma] <Combobox data> renders its own field, menu and ' +\n 'items, so its children are ignored. Give it data or build it ' +\n 'from parts, not both.'\n );\n }\n const items = data.map(toItem);\n const labelFor = (picked: string) => {\n const item = items.find(entry => entry.value === picked);\n return item ? labelOf(item) : picked;\n };\n\n const controlled = value !== undefined;\n const [ownValue, setOwnValue] = useState(() => asList(defaultValue));\n const matchText = useLocaleMatcher();\n const picked = controlled ? asList(value) : ownValue;\n const change = (next: string[]) => {\n if (!controlled) setOwnValue(next);\n if (props.multiple === true) props.onChange?.(next);\n else props.onChange?.(next[0] ?? null);\n };\n\n // What's typed, or `null` while the field shows the value instead. The\n // ref holds it as it is now, since a pick sets it and the list's closing\n // reads it in the same event, before a render.\n const [query, setQueryState] = useState<string | null>(null);\n const queryRef = useRef<string | null>(null);\n const setQuery = (next: string | null) => {\n queryRef.current = next;\n setQueryState(next);\n };\n // Once the list closes or the field is left, the field shows the value\n // again: typed text goes back to the pick, and with one value a field\n // left empty clears it.\n const settle = () => {\n if (!multiple && queryRef.current === '' && picked.length > 0) {\n change([]);\n }\n setQuery(null);\n };\n const typed = (query ?? '').trim();\n const term = typed.toLowerCase();\n const shown = items.filter(item =>\n matchText\n ? matchText(labelOf(item), typed)\n : labelOf(item).toLowerCase().includes(term)\n );\n const inputRef = useRef<HTMLInputElement>(null);\n\n const select = (pick: string) => {\n onSelect?.(pick);\n if (multiple) {\n change(\n picked.includes(pick)\n ? picked.filter(v => v !== pick)\n : [...picked, pick]\n );\n } else {\n if (picked[0] !== pick) change([pick]);\n setQuery(null);\n }\n };\n const remove = (pick: string) => {\n change(picked.filter(v => v !== pick));\n inputRef.current?.focus();\n };\n // The picks, for the field's description, since its text is the search.\n const tagsId = useId();\n const ids = tagIds(tagsId, picked);\n\n // Each group where `data` first names it, and the items with none\n // together where the first of them is.\n const sections = new Map<string, ComboboxItemData[]>();\n for (const item of shown) {\n const group = item.group ?? '';\n sections.set(group, [...(sections.get(group) ?? []), item]);\n }\n const renderItem = (item: ComboboxItemData) => (\n <ComboboxItem\n key={item.value}\n value={item.value}\n disabled={disabled || item.disabled}\n checked={picked.includes(item.value)}\n >\n {itemTemplate ? itemTemplate(item) : labelOf(item)}\n </ComboboxItem>\n );\n const list =\n shown.length > 0 ? (\n <ComboboxList {...named}>\n {Array.from(sections, ([group, members]) =>\n group ? (\n <ComboboxGroup key={group} label={group}>\n {members.map(renderItem)}\n </ComboboxGroup>\n ) : (\n members.map(renderItem)\n )\n )}\n </ComboboxList>\n ) : empty ? (\n <ComboboxEmpty>{empty}</ComboboxEmpty>\n ) : null;\n\n return (\n <ComboboxParts\n {...rest}\n ref={ref}\n multiple={multiple}\n inline={inline}\n onSelect={select}\n onSettle={settle}\n onOpenChange={next => {\n if (!next) settle();\n onOpenChange?.(next);\n }}\n below={\n multiple ? (\n <ValueTags\n values={picked}\n ids={ids}\n labelFor={labelFor}\n disabled={disabled}\n ariaCloseLabel={ariaCloseLabel}\n onRemove={remove}\n />\n ) : undefined\n }\n >\n <ComboboxInput\n {...named}\n ref={inputRef}\n id={id}\n disabled={disabled}\n // The browser's check reads the field's text, and only a pick\n // fills it for good, so it's required until there is one.\n required={required && picked.length === 0}\n aria-required={required || undefined}\n form={form}\n aria-describedby={\n multiple && picked.length > 0 ? ids.join(' ') : undefined\n }\n placeholder={placeholder}\n value={\n query ??\n (multiple || picked.length === 0 ? '' : labelFor(picked[0]))\n }\n onChange={event => setQuery(event.target.value)}\n onBlur={settle}\n />\n {inline ? list : <ComboboxMenu>{list}</ComboboxMenu>}\n <HiddenValues\n name={name}\n values={multiple ? picked : [picked[0] ?? '']}\n form={form}\n disabled={disabled}\n />\n </ComboboxParts>\n );\n }\n);\nComboboxFromData.displayName = 'ComboboxFromData';\n\n/**\n * The `Combobox` component is a text field with a list to pick from under it, for a searchable select, a multi-select with tags, grouped items or a server search: given `data` it does the rest, and built from parts it leaves the data to you.\n *\n * Given `data`, it's one element. It renders the field, the menu, the list,\n * the groups and the empty message, filters the items by label as the user\n * types, and keeps the value, which `onChange` reports. With `multiple`, the\n * picks show as tags under the field.\n *\n * Built from parts, the app owns the data: what's in the list, how it's\n * filtered, and the value. A pick calls `onSelect` with the item's `value`,\n * and the Combobox keeps no value and never changes the text in the field,\n * so the app sets both there. Nothing filters the items either, so a\n * server's answer shows as it came. For a free-text field with suggestions,\n * `Autocomplete` is the simpler choice.\n *\n * Either way, focus stays in the field, and the highlighted item is its\n * `aria-activedescendant`. With one value, the highlighted item is the\n * `aria-selected` one, as the ARIA Authoring Practices' combobox does it, and\n * a `checked` item shows a check mark and takes the highlight when the list\n * opens. With `multiple`, `checked` is each item's `aria-selected`. Tab and\n * focus leaving close the menu without picking.\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. Show one in\n * a `role=\"status\"` line beside the field when it matters.\n *\n * @function\n * @param {ComboboxProps} props - Props for the Combobox component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the `div.combobox`.\n * @returns {JSX.Element} The field and its list, in a `Field` with the label unless one is around it.\n *\n * @example\n * <Combobox\n * label=\"Country\"\n * data={['Canada', 'France', 'Japan']}\n * placeholder=\"Pick a country\"\n * empty=\"No countries match\"\n * />\n *\n * @example\n * <Combobox label=\"Country\" onSelect={pick}>\n * <Combobox.Input value={query} onChange={e => setQuery(e.target.value)} />\n * <Combobox.Menu>\n * {matches.length > 0 ? (\n * <Combobox.List>\n * {matches.map(c => (\n * <Combobox.Item key={c} value={c} checked={c === value}>\n * {c}\n * </Combobox.Item>\n * ))}\n * </Combobox.List>\n * ) : (\n * <Combobox.Empty>No countries match</Combobox.Empty>\n * )}\n * </Combobox.Menu>\n * </Combobox>\n */\nconst ComboboxRoot = forwardRef<HTMLDivElement, ComboboxProps>((props, ref) =>\n props.data === undefined ? (\n <ComboboxParts {...props} ref={ref} />\n ) : (\n <ComboboxFromData {...props} ref={ref} />\n )\n);\n\n/** Combobox with Input, Menu, List, Item, Group and Empty sub-components. */\nexport const Combobox = withSubComponents(\n ComboboxRoot,\n {\n Input: ComboboxInput,\n Menu: ComboboxMenu,\n List: ComboboxList,\n Item: ComboboxItem,\n Group: ComboboxGroup,\n Empty: ComboboxEmpty,\n },\n 'Combobox'\n);\n\nexport default Combobox;\n"],"names":["noop","standalone","setRefs","_jsxs","_jsx","_Fragment","asList"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2CA,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAU;AAEhE;AACA;AACA;AACA,MAAM,cAAc,GAAG,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC;AACxC,MAAM,iBAAiB,GAA0B,EAAE;AAobnD,MAAMA,MAAI,GAAG,MAAK,EAAE,CAAC;AACrB,MAAM,eAAe,GAAG,MAAMA,MAAI;AAElC;AACA;AACA,MAAMC,YAAU,GAAyB;AACvC,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,KAAK;AACX,QAAA,QAAQ,EAAE,KAAK;AACf,QAAA,WAAW,EAAE,IAAI;AACjB,QAAA,KAAK,EAAE,KAAK;AACZ,QAAA,SAAS,EAAE,EAAE;AACb,QAAA,MAAM,EAAE,MAAM,EAAE;AAChB,QAAA,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC1B,QAAA,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;AAC3B,QAAA,UAAU,EAAE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