@allxsmith/bestax-bulma 5.27.8 → 5.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Dialog.js +8 -4
  4. package/dist/esm/components/Dialog.js.map +1 -1
  5. package/dist/esm/components/HoverCard.js +127 -0
  6. package/dist/esm/components/HoverCard.js.map +1 -0
  7. package/dist/esm/components/Modal.js +19 -11
  8. package/dist/esm/components/Modal.js.map +1 -1
  9. package/dist/esm/components/Popover.js.map +1 -1
  10. package/dist/esm/components/Sidebar.js +12 -3
  11. package/dist/esm/components/Sidebar.js.map +1 -1
  12. package/dist/esm/components/Toast.js +5 -3
  13. package/dist/esm/components/Toast.js.map +1 -1
  14. package/dist/esm/elements/Notification.js +3 -1
  15. package/dist/esm/elements/Notification.js.map +1 -1
  16. package/dist/esm/form/DateInput.js.map +1 -1
  17. package/dist/esm/form/DateInputBase.js.map +1 -1
  18. package/dist/esm/form/DateRangeInputBase.js.map +1 -1
  19. package/dist/esm/form/DateTimeInput.js.map +1 -1
  20. package/dist/esm/form/DateTimeInputBase.js.map +1 -1
  21. package/dist/esm/form/Field.js.map +1 -1
  22. package/dist/esm/form/File.js.map +1 -1
  23. package/dist/esm/form/Input.js.map +1 -1
  24. package/dist/esm/form/Numberinput.js.map +1 -1
  25. package/dist/esm/form/Select.js.map +1 -1
  26. package/dist/esm/form/Slider.js.map +1 -1
  27. package/dist/esm/form/Taginput.js.map +1 -1
  28. package/dist/esm/form/TextArea.js.map +1 -1
  29. package/dist/esm/form/TimeInput.js.map +1 -1
  30. package/dist/esm/form/TimeInputBase.js.map +1 -1
  31. package/dist/esm/form/_pickerInternals/PickerPopover.js +3 -1
  32. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  33. package/dist/esm/helpers/Config.js +5 -2
  34. package/dist/esm/helpers/Config.js.map +1 -1
  35. package/dist/esm/helpers/portal.js +30 -5
  36. package/dist/esm/helpers/portal.js.map +1 -1
  37. package/dist/esm/helpers/useFocusTrap.js +2 -1
  38. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  39. package/dist/esm/helpers/useHoverOpen.js +390 -0
  40. package/dist/esm/helpers/useHoverOpen.js.map +1 -0
  41. package/dist/extras.css +1 -1
  42. package/dist/extras.css.map +1 -1
  43. package/dist/index.cjs +574 -27
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.esm.js +1 -0
  46. package/dist/index.esm.js.map +1 -1
  47. package/dist/types/components/HoverCard.d.ts +138 -0
  48. package/dist/types/components/Modal.d.ts +2 -1
  49. package/dist/types/components/Popover.d.ts +8 -7
  50. package/dist/types/form/DateInput.d.ts +1 -1
  51. package/dist/types/form/DateInputBase.d.ts +4 -1
  52. package/dist/types/form/DateRangeInputBase.d.ts +4 -1
  53. package/dist/types/form/DateTimeInput.d.ts +1 -1
  54. package/dist/types/form/DateTimeInputBase.d.ts +4 -1
  55. package/dist/types/form/Field.d.ts +1 -1
  56. package/dist/types/form/File.d.ts +1 -1
  57. package/dist/types/form/Input.d.ts +1 -1
  58. package/dist/types/form/Numberinput.d.ts +1 -1
  59. package/dist/types/form/Select.d.ts +1 -1
  60. package/dist/types/form/Slider.d.ts +1 -1
  61. package/dist/types/form/Taginput.d.ts +1 -1
  62. package/dist/types/form/TextArea.d.ts +1 -1
  63. package/dist/types/form/TimeInput.d.ts +1 -1
  64. package/dist/types/form/TimeInputBase.d.ts +2 -1
  65. package/dist/types/helpers/Config.d.ts +34 -3
  66. package/dist/types/helpers/portal.d.ts +27 -5
  67. package/dist/types/helpers/useFocusTrap.d.ts +9 -0
  68. package/dist/types/helpers/useHoverOpen.d.ts +98 -0
  69. package/dist/types/index.d.ts +1 -0
  70. package/dist/types-cjs/components/HoverCard.d.ts +138 -0
  71. package/dist/types-cjs/components/Modal.d.ts +2 -1
  72. package/dist/types-cjs/components/Popover.d.ts +8 -7
  73. package/dist/types-cjs/form/DateInput.d.ts +1 -1
  74. package/dist/types-cjs/form/DateInputBase.d.ts +4 -1
  75. package/dist/types-cjs/form/DateRangeInputBase.d.ts +4 -1
  76. package/dist/types-cjs/form/DateTimeInput.d.ts +1 -1
  77. package/dist/types-cjs/form/DateTimeInputBase.d.ts +4 -1
  78. package/dist/types-cjs/form/Field.d.ts +1 -1
  79. package/dist/types-cjs/form/File.d.ts +1 -1
  80. package/dist/types-cjs/form/Input.d.ts +1 -1
  81. package/dist/types-cjs/form/Numberinput.d.ts +1 -1
  82. package/dist/types-cjs/form/Select.d.ts +1 -1
  83. package/dist/types-cjs/form/Slider.d.ts +1 -1
  84. package/dist/types-cjs/form/Taginput.d.ts +1 -1
  85. package/dist/types-cjs/form/TextArea.d.ts +1 -1
  86. package/dist/types-cjs/form/TimeInput.d.ts +1 -1
  87. package/dist/types-cjs/form/TimeInputBase.d.ts +2 -1
  88. package/dist/types-cjs/helpers/Config.d.ts +34 -3
  89. package/dist/types-cjs/helpers/portal.d.ts +27 -5
  90. package/dist/types-cjs/helpers/useFocusTrap.d.ts +9 -0
  91. package/dist/types-cjs/helpers/useHoverOpen.d.ts +98 -0
  92. package/dist/types-cjs/index.d.ts +1 -0
  93. package/dist/versions/bestax-no-dark-mode.css +1 -1
  94. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  95. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  96. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  97. package/dist/versions/bestax-no-helpers.css +1 -1
  98. package/dist/versions/bestax-no-helpers.css.map +1 -1
  99. package/dist/versions/bestax-prefixed.css +1 -1
  100. package/dist/versions/bestax-prefixed.css.map +1 -1
  101. package/package.json +2 -2
  102. package/src/scss/components/_hovercard.scss +118 -0
  103. package/src/scss/components/_index.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Notification.js","sources":["../../../src/elements/Notification.tsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useRef,\n useState,\n useCallback,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnUnstyledColor } from '../helpers/colorDeprecations';\nimport { groupIntoPositionStacks } from '../helpers/positionStacks';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\n\n/**\n * Props for the Notification component.\n */\nexport interface NotificationProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * Bulma color modifier for the notification (renders `is-<color>`).\n *\n * Only `primary`, `link`, `info`, `success`, `warning`, `danger`, `black`,\n * `white`, `light`, and `dark` have shipped CSS for `.notification`. Every\n * other value the union accepts emits a class no CSS rule matches, so the\n * notification renders unstyled; those log a console warning in development\n * and will be removed from this union in the next major version.\n */\n color?: (typeof validColors)[number];\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Use the light color variant. */\n isLight?: boolean;\n /**\n * Shows a close (delete) button in the notification. It renders\n * `type=\"button\"`, so it does not submit a form around it.\n *\n * The notification also takes `has-delete`, which pads its end by\n * `--bulma-notification-delete-padding-inline-end` so the text clears the\n * button. That rule ships in bestax's stylesheets, not Bulma's, so an app\n * styled by Bulma's CSS alone keeps Bulma's padding.\n */\n hasDelete?: boolean;\n /** Callback fired when the delete button is clicked. */\n onDelete?: () => void;\n /** Content inside the notification. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Notification` component is a Bulma-styled alert/message area for providing feedback, warnings, or information to users.\n *\n * @function\n * @param {NotificationProps} props - Props for the Notification component.\n * @returns {JSX.Element} The rendered notification element.\n * @see {@link https://bulma.io/documentation/elements/notification/ | Bulma Notification documentation}\n */\nexport const Notification: React.FC<NotificationProps> = ({\n className,\n color,\n textColor,\n isLight,\n hasDelete,\n onDelete,\n children,\n ...props\n}) => {\n warnUnstyledColor('Notification', color);\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('notification', {\n [`is-${color}`]: color && validColors.includes(color),\n 'is-light': isLight,\n 'has-delete': hasDelete,\n });\n\n const deleteClasses = usePrefixedClassNames('delete');\n\n const notificationClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div className={notificationClasses} {...rest}>\n {hasDelete && (\n <button\n type=\"button\"\n className={deleteClasses}\n onClick={onDelete}\n aria-label=\"Close notification\"\n />\n )}\n {children}\n </div>\n );\n};\n\n// Programmatic Notification API\n\n/** Screen positions where programmatic notifications can be displayed. */\nexport type NotificationPosition =\n 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right';\n\n/**\n * Options for showing a programmatic notification.\n */\nexport interface NotificationOptions {\n /**\n * The message to display.\n *\n * For a notification other than `danger` and `warning`, NotificationContainer\n * announces the text the message renders, with an element's `aria-label`,\n * or an image's `alt`, standing in for what's inside it, a break between\n * block-level elements, and parts that are `aria-hidden`, `hidden` or\n * inline-styled `display: none` left out. Other ways of naming or hiding\n * content, such as `aria-labelledby`, CSS-generated content or a\n * stylesheet's `display: none`, aren't followed, so a message that relies on\n * them can be announced differently from what a screen reader would read.\n */\n message: string | React.ReactNode;\n /**\n * Bulma color modifier for the notification (renders `is-<color>`).\n *\n * Only `primary`, `link`, `info`, `success`, `warning`, `danger`, `black`,\n * `white`, `light`, and `dark` have shipped CSS for `.notification`. Every\n * other value the union accepts emits a class no CSS rule matches, so the\n * notification renders unstyled; those log a console warning in development\n * and will be removed from this union in the next major version.\n */\n color?: (typeof validColors)[number];\n /** Use the light color variant. */\n isLight?: boolean;\n /** Duration in ms before auto-close. Default 3000. */\n duration?: number;\n /**\n * Position on the screen. A notification shown without one goes to\n * `NotificationContainer`'s `position`.\n */\n position?: NotificationPosition;\n /**\n * When true, notifications enter a FIFO queue and display one at a time,\n * one queue across every `position`. Default false.\n */\n queue?: boolean;\n /** Show a delete (close) button. Default true. */\n hasDelete?: boolean;\n /** Stay open until dismissed. */\n indefinite?: boolean;\n /** Pause auto-close timer on hover. Default true. */\n pauseOnHover?: boolean;\n}\n\n/**\n * Internal representation of a notification instance.\n */\ninterface NotificationInstance {\n /** Unique identifier for this notification. */\n id: string;\n /** Configuration options for the notification. */\n options: NotificationOptions;\n}\n\nlet notificationId = 0;\nconst notificationListeners: Set<(items: NotificationInstance[]) => void> =\n new Set();\nlet notifications: NotificationInstance[] = [];\n\n// Queue support\nlet queuedNotifications: NotificationInstance[] = [];\nlet currentQueuedNotification: NotificationInstance | null = null;\n\n// The server has nowhere to portal a notification to, and its copy of this\n// module is shared by every request, so server rendering reads an empty list.\n// Hydration reads it too, which keeps the first client render matching the\n// server's.\nconst noNotifications: NotificationInstance[] = [];\nconst getServerNotifications = () => noNotifications;\n\n// What a container shows right now: the stacked notifications, then the queued\n// one on screen. NotificationContainer renders from this rather than from\n// updates alone, so notifications raised before it mounted still appear. It is\n// replaced rather than mutated, and only when listeners are notified, because\n// useSyncExternalStore needs the same array back between changes. An empty\n// list is `noNotifications` itself, so an empty store reads the same snapshot\n// on the client as on the server, and a notify that leaves nothing showing\n// when nothing was showing doesn't render the container again.\nlet visibleNotifications: NotificationInstance[] = noNotifications;\nconst getVisibleNotifications = () => visibleNotifications;\n\nconst notifyNotificationListeners = () => {\n const allVisible = [...notifications];\n if (currentQueuedNotification) {\n allVisible.push(currentQueuedNotification);\n }\n visibleNotifications = allVisible.length > 0 ? allVisible : noNotifications;\n notificationListeners.forEach(listener => listener([...allVisible]));\n};\n\nconst processQueuedNotification = () => {\n if (currentQueuedNotification || queuedNotifications.length === 0) return;\n currentQueuedNotification = queuedNotifications.shift()!;\n notifyNotificationListeners();\n};\n\n/**\n * Programmatic notification API for showing, closing, and managing notifications.\n *\n * @example\n * notification.success('File saved successfully');\n * notification.danger('Something went wrong', { duration: 5000 });\n */\nexport const notification = {\n /**\n * Show a notification with the given options.\n * @param {NotificationOptions} options - Notification configuration.\n * @returns {string} The unique ID of the created notification.\n */\n show: (options: NotificationOptions): string => {\n const id = `notification-${++notificationId}`;\n const instance = { id, options };\n\n if (options.queue) {\n queuedNotifications.push(instance);\n processQueuedNotification();\n } else {\n notifications.push(instance);\n notifyNotificationListeners();\n }\n\n return id;\n },\n\n /**\n * Show a success notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n success: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'success', ...options });\n },\n\n /**\n * Show a danger notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n danger: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'danger', ...options });\n },\n\n /**\n * Show a warning notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n warning: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'warning', ...options });\n },\n\n /**\n * Show an info notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n info: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'info', ...options });\n },\n\n /**\n * Close a specific notification by ID.\n * @param {string} id - The notification ID to close.\n */\n close: (id: string): void => {\n if (currentQueuedNotification && currentQueuedNotification.id === id) {\n currentQueuedNotification = null;\n processQueuedNotification();\n } else {\n queuedNotifications = queuedNotifications.filter(n => n.id !== id);\n notifications = notifications.filter(n => n.id !== id);\n }\n notifyNotificationListeners();\n },\n\n /** Close all notifications and clear the queue. */\n closeAll: (): void => {\n notifications = [];\n queuedNotifications = [];\n currentQueuedNotification = null;\n notifyNotificationListeners();\n },\n\n /**\n * Subscribe to notification state changes.\n * @param {(items: NotificationInstance[]) => void} listener - Callback invoked on changes.\n * @returns {() => void} Unsubscribe function.\n */\n subscribe: (\n listener: (items: NotificationInstance[]) => void\n ): (() => void) => {\n notificationListeners.add(listener);\n return () => notificationListeners.delete(listener);\n },\n};\n\n/**\n * Whether a notification of this color announces itself as an alert, rather\n * than politely through NotificationContainer's status region.\n *\n * @function isUrgentColor\n * @param {NotificationOptions['color']} color - The notification's color.\n * @returns {boolean} True for `danger` and `warning`.\n */\nconst isUrgentColor = (color: NotificationOptions['color']): boolean =>\n color === 'danger' || color === 'warning';\n\n/**\n * Single auto-dismissing notification item used by NotificationContainer.\n *\n * @function\n * @param {{ instance: NotificationInstance; onClose: (id: string) => void; registerMessage: (id: string, node: HTMLElement | null) => void }} props - Component props.\n * @returns {JSX.Element} The rendered notification item.\n */\nconst NotificationItem: React.FC<{\n instance: NotificationInstance;\n onClose: (id: string) => void;\n registerMessage: (id: string, node: HTMLElement | null) => void;\n}> = ({ instance, onClose, registerMessage }) => {\n const {\n message,\n color,\n isLight,\n duration = 3000,\n hasDelete = true,\n indefinite = false,\n pauseOnHover = true,\n } = instance.options;\n\n const [isPaused, setIsPaused] = useState(false);\n const urgent = isUrgentColor(color);\n\n const handleClose = useCallback(() => {\n onClose(instance.id);\n }, [onClose, instance.id]);\n\n const messageRef = useCallback(\n (node: HTMLElement | null) => {\n registerMessage(instance.id, node);\n },\n [registerMessage, instance.id]\n );\n\n // Auto-close timer\n useEffect(() => {\n if (indefinite || duration === 0 || isPaused) return undefined;\n\n const timer = setTimeout(handleClose, duration);\n return () => clearTimeout(timer);\n }, [duration, indefinite, isPaused, handleClose]);\n\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) setIsPaused(true);\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) setIsPaused(false);\n }, [pauseOnHover]);\n\n return (\n <Notification\n color={color}\n isLight={isLight}\n hasDelete={hasDelete}\n onDelete={handleClose}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n style={{ pointerEvents: 'auto' }}\n >\n {/* Only the message is announced, not the close button Notification\n renders ahead of its children. Danger and warning announce\n themselves as an assertive alert, which a screen reader reliably\n reads out even when it arrives with its text. The rest are announced\n through the container's status region, which reads their text from\n this span, so it carries no role of its own that would announce them\n a second time. */}\n {urgent ? (\n <span role=\"alert\" aria-live=\"assertive\">\n {message}\n </span>\n ) : (\n <span ref={messageRef}>{message}</span>\n )}\n </Notification>\n );\n};\n\n// The order NotificationContainer renders its stacks in: across the top of the\n// screen, then across the bottom.\nconst notificationStackOrder: readonly NotificationPosition[] = [\n 'top-left',\n 'top',\n 'top-right',\n 'bottom-left',\n 'bottom',\n 'bottom-right',\n];\n\n/**\n * Inline style that fixes a stack of notifications to its place on the screen.\n *\n * @function\n * @param {NotificationPosition} position - Where the stack sits.\n * @returns {React.CSSProperties} The stack's style.\n */\nconst notificationStackStyle = (\n position: NotificationPosition\n): React.CSSProperties => {\n const isBottom = position.startsWith('bottom');\n const isCenter = position === 'top' || position === 'bottom';\n const isRight = position.endsWith('right');\n\n return {\n position: 'fixed',\n zIndex: 100,\n display: 'flex',\n flexDirection: isBottom ? 'column-reverse' : 'column',\n gap: '0.75rem',\n padding: '1rem',\n pointerEvents: 'none',\n maxWidth: '100%',\n ...(isBottom ? { bottom: 0 } : { top: 0 }),\n ...(isCenter\n ? { left: '50%', transform: 'translateX(-50%)', alignItems: 'center' }\n : isRight\n ? { right: 0, alignItems: 'flex-end' }\n : { left: 0, alignItems: 'flex-start' }),\n };\n};\n\n/**\n * Container component for rendering programmatic notifications.\n * Place once at your app root to enable the notification API. A notification\n * shown with a `position` appears there, and one shown without goes to the\n * container's `position`, so the container renders a stack for each position\n * in use.\n *\n * It keeps a visually hidden `role=\"status\"` live region in the page from the\n * moment it mounts, even while nothing is showing, and announces every\n * notification other than `danger` and `warning` through it, a moment after\n * the notification appears. Those notifications carry no `role=\"status\"` of\n * their own, so `getByRole('status')` finds the region, not the notification.\n * The text stays in the region briefly, even if the notification closes in\n * the meantime, and while both are up the page holds two copies of it. A\n * polite notification that closes before its announcement is written, a\n * moment after it appears, isn't announced at all. `danger` and `warning`\n * notifications announce themselves as assertive alerts. The region is hidden\n * with inline styles, so it needs no stylesheet.\n *\n * @function\n * @param {{ position?: NotificationPosition }} props - Container props.\n * @returns {JSX.Element | null} The rendered notification container, or null on the server and while hydrating.\n */\nexport const NotificationContainer: React.FC<{\n /**\n * Where a notification shown without a `position` of its own appears.\n * Default: 'top-right'. When it changes, those notifications move without\n * remounting, but one shown with its own `position` equal to the old or new\n * value remounts and starts over as if it had just been shown.\n */\n position?: NotificationPosition;\n}> = ({ position = 'top-right' }) => {\n // Starts from the notifications already showing instead of an empty list,\n // then follows changes.\n const items = useSyncExternalStore(\n notification.subscribe,\n getVisibleNotifications,\n getServerNotifications\n );\n // A portal needs a document, and it has no server-rendered counterpart, so\n // the server render and the hydrating one render nothing, and the container\n // portals in from the render after hydration.\n const isHydrated = useIsHydrated();\n\n // The notifications the status region announces. Danger and warning\n // announce themselves.\n const politeItems = useMemo(\n () => items.filter(item => !isUrgentColor(item.options.color)),\n [items]\n );\n\n // Each polite notification's message element, so the text the region\n // announces is the text on screen, whatever the message renders.\n const messageNodesRef = useRef(new Map<string, HTMLElement>());\n const registerMessage = useCallback(\n (id: string, node: HTMLElement | null) => {\n if (node) {\n messageNodesRef.current.set(id, node);\n } else {\n messageNodesRef.current.delete(id);\n }\n },\n []\n );\n // StatusRegion only describes polite notifications that are on screen, and\n // each of those registered its message element when it mounted. The\n // fallback is for a notification announced without being rendered, should\n // the container ever render fewer than it announces: a plain-text message\n // still says itself, and anything else is skipped.\n const describe = useCallback((item: NotificationInstance) => {\n const node = messageNodesRef.current.get(item.id);\n /* istanbul ignore if: every polite notification on screen registers its message element when it mounts */\n if (!node) {\n const { message } = item.options;\n return typeof message === 'string' ? message : null;\n }\n return spokenText(node);\n }, []);\n\n if (typeof document === 'undefined' || !isHydrated) {\n return null;\n }\n\n const stacks = groupIntoPositionStacks(\n items,\n item => item.options.position,\n position,\n notificationStackOrder\n );\n\n return createPortal(\n <>\n {stacks.map(stack => (\n <div key={stack.key} style={notificationStackStyle(stack.position)}>\n {stack.items.map(item => (\n <NotificationItem\n key={item.id}\n instance={item}\n onClose={notification.close}\n registerMessage={registerMessage}\n />\n ))}\n </div>\n ))}\n <StatusRegion items={politeItems} describe={describe} />\n </>,\n document.body\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;AA2DA;;;;;;;AAOG;AACI,MAAM,YAAY,GAAgC,CAAC,EACxD,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,iBAAiB,CAAC,cAAc,EAAE,KAAK,CAAC;AAExC;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,cAAc,EAAE;AACzD,QAAA,CAAC,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;AACrD,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACxB,KAAA,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,qBAAqB,CAAC,QAAQ,CAAC;IAErD,MAAM,mBAAmB,GAAG,UAAU,CACpC,YAAY,EACZ,kBAAkB,EAClB,SAAS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W,IAAI,CAAC,UAAU,EAAE;AAClD,QAAA,OAAO,IAAI;IACb;IAEA,MAAM,MAAM,GAAG,uBAAuB,CACpC,KAAK,EACL,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,EAC7B,QAAQ,EACR,sBAAsB,CACvB;AAED,IAAA,OAAO,YAAY,CACjBD,IAAA,CAAAE,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,MAAM,CAAC,GAAG,CAAC,KAAK,KACfD,GAAA,CAAA,KAAA,EAAA,EAAqB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,YAC/D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KACnBA,GAAA,CAAC,gBAAgB,EAAA,EAEf,QAAQ,EAAE,IAAI,EACd,OAAO,EAAE,YAAY,CAAC,KAAK,EAC3B,eAAe,EAAE,eAAe,EAAA,EAH3B,IAAI,CAAC,EAAE,CAIZ,CACH,CAAC,EAAA,EARM,KAAK,CAAC,GAAG,CASb,CACP,CAAC,EACFA,GAAA,CAAC,YAAY,IAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAA,EAAA,CACvD,EACH,QAAQ,CAAC,IAAI,CACd;AACH;;"}
1
+ {"version":3,"file":"Notification.js","sources":["../../../src/elements/Notification.tsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useRef,\n useState,\n useCallback,\n useSyncExternalStore,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport {\n useBulmaClasses,\n BulmaClassesProps,\n validColors,\n} from '../helpers/useBulmaClasses';\nimport { warnUnstyledColor } from '../helpers/colorDeprecations';\nimport { groupIntoPositionStacks } from '../helpers/positionStacks';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { usePortalContainer } from '../helpers/portal';\nimport { StatusRegion, spokenText } from '../helpers/statusRegion';\n\n/**\n * Props for the Notification component.\n */\nexport interface NotificationProps\n extends\n React.HTMLAttributes<HTMLDivElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Additional CSS classes to apply. */\n className?: string;\n /**\n * Bulma color modifier for the notification (renders `is-<color>`).\n *\n * Only `primary`, `link`, `info`, `success`, `warning`, `danger`, `black`,\n * `white`, `light`, and `dark` have shipped CSS for `.notification`. Every\n * other value the union accepts emits a class no CSS rule matches, so the\n * notification renders unstyled; those log a console warning in development\n * and will be removed from this union in the next major version.\n */\n color?: (typeof validColors)[number];\n /** Text color helper. */\n textColor?: (typeof validColors)[number] | 'inherit' | 'current';\n /** Use the light color variant. */\n isLight?: boolean;\n /**\n * Shows a close (delete) button in the notification. It renders\n * `type=\"button\"`, so it does not submit a form around it.\n *\n * The notification also takes `has-delete`, which pads its end by\n * `--bulma-notification-delete-padding-inline-end` so the text clears the\n * button. That rule ships in bestax's stylesheets, not Bulma's, so an app\n * styled by Bulma's CSS alone keeps Bulma's padding.\n */\n hasDelete?: boolean;\n /** Callback fired when the delete button is clicked. */\n onDelete?: () => void;\n /** Content inside the notification. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Notification` component is a Bulma-styled alert/message area for providing feedback, warnings, or information to users.\n *\n * @function\n * @param {NotificationProps} props - Props for the Notification component.\n * @returns {JSX.Element} The rendered notification element.\n * @see {@link https://bulma.io/documentation/elements/notification/ | Bulma Notification documentation}\n */\nexport const Notification: React.FC<NotificationProps> = ({\n className,\n color,\n textColor,\n isLight,\n hasDelete,\n onDelete,\n children,\n ...props\n}) => {\n warnUnstyledColor('Notification', color);\n\n /**\n * Generates Bulma helper classes and separates out remaining props.\n */\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color: textColor,\n ...props,\n });\n\n const bulmaClasses = usePrefixedClassNames('notification', {\n [`is-${color}`]: color && validColors.includes(color),\n 'is-light': isLight,\n 'has-delete': hasDelete,\n });\n\n const deleteClasses = usePrefixedClassNames('delete');\n\n const notificationClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div className={notificationClasses} {...rest}>\n {hasDelete && (\n <button\n type=\"button\"\n className={deleteClasses}\n onClick={onDelete}\n aria-label=\"Close notification\"\n />\n )}\n {children}\n </div>\n );\n};\n\n// Programmatic Notification API\n\n/** Screen positions where programmatic notifications can be displayed. */\nexport type NotificationPosition =\n 'top-left' | 'top' | 'top-right' | 'bottom-left' | 'bottom' | 'bottom-right';\n\n/**\n * Options for showing a programmatic notification.\n */\nexport interface NotificationOptions {\n /**\n * The message to display.\n *\n * For a notification other than `danger` and `warning`, NotificationContainer\n * announces the text the message renders, with an element's `aria-label`,\n * or an image's `alt`, standing in for what's inside it, a break between\n * block-level elements, and parts that are `aria-hidden`, `hidden` or\n * inline-styled `display: none` left out. Other ways of naming or hiding\n * content, such as `aria-labelledby`, CSS-generated content or a\n * stylesheet's `display: none`, aren't followed, so a message that relies on\n * them can be announced differently from what a screen reader would read.\n */\n message: string | React.ReactNode;\n /**\n * Bulma color modifier for the notification (renders `is-<color>`).\n *\n * Only `primary`, `link`, `info`, `success`, `warning`, `danger`, `black`,\n * `white`, `light`, and `dark` have shipped CSS for `.notification`. Every\n * other value the union accepts emits a class no CSS rule matches, so the\n * notification renders unstyled; those log a console warning in development\n * and will be removed from this union in the next major version.\n */\n color?: (typeof validColors)[number];\n /** Use the light color variant. */\n isLight?: boolean;\n /** Duration in ms before auto-close. Default 3000. */\n duration?: number;\n /**\n * Position on the screen. A notification shown without one goes to\n * `NotificationContainer`'s `position`.\n */\n position?: NotificationPosition;\n /**\n * When true, notifications enter a FIFO queue and display one at a time,\n * one queue across every `position`. Default false.\n */\n queue?: boolean;\n /** Show a delete (close) button. Default true. */\n hasDelete?: boolean;\n /** Stay open until dismissed. */\n indefinite?: boolean;\n /** Pause auto-close timer on hover. Default true. */\n pauseOnHover?: boolean;\n}\n\n/**\n * Internal representation of a notification instance.\n */\ninterface NotificationInstance {\n /** Unique identifier for this notification. */\n id: string;\n /** Configuration options for the notification. */\n options: NotificationOptions;\n}\n\nlet notificationId = 0;\nconst notificationListeners: Set<(items: NotificationInstance[]) => void> =\n new Set();\nlet notifications: NotificationInstance[] = [];\n\n// Queue support\nlet queuedNotifications: NotificationInstance[] = [];\nlet currentQueuedNotification: NotificationInstance | null = null;\n\n// The server has nowhere to portal a notification to, and its copy of this\n// module is shared by every request, so server rendering reads an empty list.\n// Hydration reads it too, which keeps the first client render matching the\n// server's.\nconst noNotifications: NotificationInstance[] = [];\nconst getServerNotifications = () => noNotifications;\n\n// What a container shows right now: the stacked notifications, then the queued\n// one on screen. NotificationContainer renders from this rather than from\n// updates alone, so notifications raised before it mounted still appear. It is\n// replaced rather than mutated, and only when listeners are notified, because\n// useSyncExternalStore needs the same array back between changes. An empty\n// list is `noNotifications` itself, so an empty store reads the same snapshot\n// on the client as on the server, and a notify that leaves nothing showing\n// when nothing was showing doesn't render the container again.\nlet visibleNotifications: NotificationInstance[] = noNotifications;\nconst getVisibleNotifications = () => visibleNotifications;\n\nconst notifyNotificationListeners = () => {\n const allVisible = [...notifications];\n if (currentQueuedNotification) {\n allVisible.push(currentQueuedNotification);\n }\n visibleNotifications = allVisible.length > 0 ? allVisible : noNotifications;\n notificationListeners.forEach(listener => listener([...allVisible]));\n};\n\nconst processQueuedNotification = () => {\n if (currentQueuedNotification || queuedNotifications.length === 0) return;\n currentQueuedNotification = queuedNotifications.shift()!;\n notifyNotificationListeners();\n};\n\n/**\n * Programmatic notification API for showing, closing, and managing notifications.\n *\n * @example\n * notification.success('File saved successfully');\n * notification.danger('Something went wrong', { duration: 5000 });\n */\nexport const notification = {\n /**\n * Show a notification with the given options.\n * @param {NotificationOptions} options - Notification configuration.\n * @returns {string} The unique ID of the created notification.\n */\n show: (options: NotificationOptions): string => {\n const id = `notification-${++notificationId}`;\n const instance = { id, options };\n\n if (options.queue) {\n queuedNotifications.push(instance);\n processQueuedNotification();\n } else {\n notifications.push(instance);\n notifyNotificationListeners();\n }\n\n return id;\n },\n\n /**\n * Show a success notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n success: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'success', ...options });\n },\n\n /**\n * Show a danger notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n danger: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'danger', ...options });\n },\n\n /**\n * Show a warning notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n warning: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'warning', ...options });\n },\n\n /**\n * Show an info notification.\n * @param {string|React.ReactNode} message - The message to display.\n * @param {Partial<NotificationOptions>} [options] - Additional options.\n * @returns {string} The notification ID.\n */\n info: (\n message: string | React.ReactNode,\n options?: Partial<NotificationOptions>\n ): string => {\n return notification.show({ message, color: 'info', ...options });\n },\n\n /**\n * Close a specific notification by ID.\n * @param {string} id - The notification ID to close.\n */\n close: (id: string): void => {\n if (currentQueuedNotification && currentQueuedNotification.id === id) {\n currentQueuedNotification = null;\n processQueuedNotification();\n } else {\n queuedNotifications = queuedNotifications.filter(n => n.id !== id);\n notifications = notifications.filter(n => n.id !== id);\n }\n notifyNotificationListeners();\n },\n\n /** Close all notifications and clear the queue. */\n closeAll: (): void => {\n notifications = [];\n queuedNotifications = [];\n currentQueuedNotification = null;\n notifyNotificationListeners();\n },\n\n /**\n * Subscribe to notification state changes.\n * @param {(items: NotificationInstance[]) => void} listener - Callback invoked on changes.\n * @returns {() => void} Unsubscribe function.\n */\n subscribe: (\n listener: (items: NotificationInstance[]) => void\n ): (() => void) => {\n notificationListeners.add(listener);\n return () => notificationListeners.delete(listener);\n },\n};\n\n/**\n * Whether a notification of this color announces itself as an alert, rather\n * than politely through NotificationContainer's status region.\n *\n * @function isUrgentColor\n * @param {NotificationOptions['color']} color - The notification's color.\n * @returns {boolean} True for `danger` and `warning`.\n */\nconst isUrgentColor = (color: NotificationOptions['color']): boolean =>\n color === 'danger' || color === 'warning';\n\n/**\n * Single auto-dismissing notification item used by NotificationContainer.\n *\n * @function\n * @param {{ instance: NotificationInstance; onClose: (id: string) => void; registerMessage: (id: string, node: HTMLElement | null) => void }} props - Component props.\n * @returns {JSX.Element} The rendered notification item.\n */\nconst NotificationItem: React.FC<{\n instance: NotificationInstance;\n onClose: (id: string) => void;\n registerMessage: (id: string, node: HTMLElement | null) => void;\n}> = ({ instance, onClose, registerMessage }) => {\n const {\n message,\n color,\n isLight,\n duration = 3000,\n hasDelete = true,\n indefinite = false,\n pauseOnHover = true,\n } = instance.options;\n\n const [isPaused, setIsPaused] = useState(false);\n const urgent = isUrgentColor(color);\n\n const handleClose = useCallback(() => {\n onClose(instance.id);\n }, [onClose, instance.id]);\n\n const messageRef = useCallback(\n (node: HTMLElement | null) => {\n registerMessage(instance.id, node);\n },\n [registerMessage, instance.id]\n );\n\n // Auto-close timer\n useEffect(() => {\n if (indefinite || duration === 0 || isPaused) return undefined;\n\n const timer = setTimeout(handleClose, duration);\n return () => clearTimeout(timer);\n }, [duration, indefinite, isPaused, handleClose]);\n\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) setIsPaused(true);\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) setIsPaused(false);\n }, [pauseOnHover]);\n\n return (\n <Notification\n color={color}\n isLight={isLight}\n hasDelete={hasDelete}\n onDelete={handleClose}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n style={{ pointerEvents: 'auto' }}\n >\n {/* Only the message is announced, not the close button Notification\n renders ahead of its children. Danger and warning announce\n themselves as an assertive alert, which a screen reader reliably\n reads out even when it arrives with its text. The rest are announced\n through the container's status region, which reads their text from\n this span, so it carries no role of its own that would announce them\n a second time. */}\n {urgent ? (\n <span role=\"alert\" aria-live=\"assertive\">\n {message}\n </span>\n ) : (\n <span ref={messageRef}>{message}</span>\n )}\n </Notification>\n );\n};\n\n// The order NotificationContainer renders its stacks in: across the top of the\n// screen, then across the bottom.\nconst notificationStackOrder: readonly NotificationPosition[] = [\n 'top-left',\n 'top',\n 'top-right',\n 'bottom-left',\n 'bottom',\n 'bottom-right',\n];\n\n/**\n * Inline style that fixes a stack of notifications to its place on the screen.\n *\n * @function\n * @param {NotificationPosition} position - Where the stack sits.\n * @returns {React.CSSProperties} The stack's style.\n */\nconst notificationStackStyle = (\n position: NotificationPosition\n): React.CSSProperties => {\n const isBottom = position.startsWith('bottom');\n const isCenter = position === 'top' || position === 'bottom';\n const isRight = position.endsWith('right');\n\n return {\n position: 'fixed',\n zIndex: 100,\n display: 'flex',\n flexDirection: isBottom ? 'column-reverse' : 'column',\n gap: '0.75rem',\n padding: '1rem',\n pointerEvents: 'none',\n maxWidth: '100%',\n ...(isBottom ? { bottom: 0 } : { top: 0 }),\n ...(isCenter\n ? { left: '50%', transform: 'translateX(-50%)', alignItems: 'center' }\n : isRight\n ? { right: 0, alignItems: 'flex-end' }\n : { left: 0, alignItems: 'flex-start' }),\n };\n};\n\n/**\n * Container component for rendering programmatic notifications.\n * Place once at your app root to enable the notification API. A notification\n * shown with a `position` appears there, and one shown without goes to the\n * container's `position`, so the container renders a stack for each position\n * in use.\n *\n * It keeps a visually hidden `role=\"status\"` live region in the page from the\n * moment it mounts, even while nothing is showing, and announces every\n * notification other than `danger` and `warning` through it, a moment after\n * the notification appears. Those notifications carry no `role=\"status\"` of\n * their own, so `getByRole('status')` finds the region, not the notification.\n * The text stays in the region briefly, even if the notification closes in\n * the meantime, and while both are up the page holds two copies of it. A\n * polite notification that closes before its announcement is written, a\n * moment after it appears, isn't announced at all. `danger` and `warning`\n * notifications announce themselves as assertive alerts. The region is hidden\n * with inline styles, so it needs no stylesheet.\n *\n * @function\n * @param {{ position?: NotificationPosition }} props - Container props.\n * @returns {JSX.Element | null} The rendered notification container, or null on the server and while hydrating.\n */\nexport const NotificationContainer: React.FC<{\n /**\n * Where a notification shown without a `position` of its own appears.\n * Default: 'top-right'. When it changes, those notifications move without\n * remounting, but one shown with its own `position` equal to the old or new\n * value remounts and starts over as if it had just been shown.\n */\n position?: NotificationPosition;\n}> = ({ position = 'top-right' }) => {\n // Starts from the notifications already showing instead of an empty list,\n // then follows changes.\n const items = useSyncExternalStore(\n notification.subscribe,\n getVisibleNotifications,\n getServerNotifications\n );\n // A portal needs a document, and it has no server-rendered counterpart, so\n // the server render and the hydrating one render nothing, and the container\n // portals in from the render after hydration.\n const isHydrated = useIsHydrated();\n const resolveContainer = usePortalContainer();\n\n // The notifications the status region announces. Danger and warning\n // announce themselves.\n const politeItems = useMemo(\n () => items.filter(item => !isUrgentColor(item.options.color)),\n [items]\n );\n\n // Each polite notification's message element, so the text the region\n // announces is the text on screen, whatever the message renders.\n const messageNodesRef = useRef(new Map<string, HTMLElement>());\n const registerMessage = useCallback(\n (id: string, node: HTMLElement | null) => {\n if (node) {\n messageNodesRef.current.set(id, node);\n } else {\n messageNodesRef.current.delete(id);\n }\n },\n []\n );\n // StatusRegion only describes polite notifications that are on screen, and\n // each of those registered its message element when it mounted. The\n // fallback is for a notification announced without being rendered, should\n // the container ever render fewer than it announces: a plain-text message\n // still says itself, and anything else is skipped.\n const describe = useCallback((item: NotificationInstance) => {\n const node = messageNodesRef.current.get(item.id);\n /* istanbul ignore if: every polite notification on screen registers its message element when it mounts */\n if (!node) {\n const { message } = item.options;\n return typeof message === 'string' ? message : null;\n }\n return spokenText(node);\n }, []);\n\n if (typeof document === 'undefined' || !isHydrated) {\n return null;\n }\n\n const stacks = groupIntoPositionStacks(\n items,\n item => item.options.position,\n position,\n notificationStackOrder\n );\n\n return createPortal(\n <>\n {stacks.map(stack => (\n <div key={stack.key} style={notificationStackStyle(stack.position)}>\n {stack.items.map(item => (\n <NotificationItem\n key={item.id}\n instance={item}\n onClose={notification.close}\n registerMessage={registerMessage}\n />\n ))}\n </div>\n ))}\n <StatusRegion items={politeItems} describe={describe} />\n </>,\n resolveContainer()\n );\n};\n"],"names":["_jsxs","_jsx","_Fragment"],"mappings":";;;;;;;;;;;;;AA4DA;;;;;;;AAOG;AACI,MAAM,YAAY,GAAgC,CAAC,EACxD,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,iBAAiB,CAAC,cAAc,EAAE,KAAK,CAAC;AAExC;;AAEG;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;AACnD,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;AAEF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,cAAc,EAAE;AACzD,QAAA,CAAC,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;AACrD,QAAA,UAAU,EAAE,OAAO;AACnB,QAAA,YAAY,EAAE,SAAS;AACxB,KAAA,CAAC;AAEF,IAAA,MAAM,aAAa,GAAG,qBAAqB,CAAC,QAAQ,CAAC;IAErD,MAAM,mBAAmB,GAAG,UAAU,CACpC,YAAY,EACZ,kBAAkB,EAClB,SAAS,CACV;AAED,IAAA,QACEA,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,mBAAmB,EAAA,GAAM,IAAI,EAAA,QAAA,EAAA,CAC1C,SAAS,KACRC,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,QAAQ,EAAA,YAAA,EACN,oBAAoB,EAAA,CAC/B,CACH,EACA,QAAQ,CAAA,EAAA,CACL;AAEV;AAmEA,IAA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AAC,GAAG,CAAC,KAAK,KACfD,GAAA,CAAA,KAAA,EAAA,EAAqB,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,QAAQ,CAAC,YAC/D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,KACnBA,GAAA,CAAC,gBAAgB,EAAA,EAEf,QAAQ,EAAE,IAAI,EACd,OAAO,EAAE,YAAY,CAAC,KAAK,EAC3B,eAAe,EAAE,eAAe,EAAA,EAH3B,IAAI,CAAC,EAAE,CAIZ,CACH,CAAC,EAAA,EARM,KAAK,CAAC,GAAG,CASb,CACP,CAAC,EACFA,GAAA,CAAC,YAAY,EAAA,EAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAA,CAAI,CAAA,EAAA,CACvD,EACH,gBAAgB,EAAE,CACnB;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.js","sources":["../../../src/form/DateInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport { Field, FieldProps } from './Field';\nimport { Control, ControlBaseProps } from './Control';\nimport { DateInputBase, DateInputBaseProps } from './DateInputBase';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n rendersOwnControl,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\n\n/**\n * Props for the DateInput convenience wrapper. Extends `DateInputBaseProps`\n * with Field-level (label, horizontal) and Control-level (icons, loading) props.\n * Inside an existing `Control` it renders no `Control` of its own, so its\n * Control-level props do nothing there and warn in development; set them on\n * that `Control` instead. In `inline` mode it renders no `Control` anywhere,\n * so they do nothing inside a `Control` or out, and warn in development\n * there too. Inside an outer `Field`, or a `Control` with no `Field` around\n * it, it renders no `Field` of its own either.\n * The exception is `label`, `message`, `horizontal` or `fieldClassName` in that\n * bare `Control`: it keeps a `Field` for them, nested in the `.control`, and\n * warns in development. Wrap the `Control` in a `Field` instead, and set the\n * `label`, `horizontal` and class name on that `Field`.\n * @extraProp {string} [name] - Form field name. The text field submits the text it displays. The native input on touch devices submits the ISO value (`YYYY-MM-DD`, or `YYYY-MM` at month granularity), and an `inline` calendar, which has no visible input, submits it from a hidden input (`YYYY-MM-DD`, `YYYY-MM` or `YYYY`).\n * @extraProp {string} [form] - Form id the input belongs to.\n * @extraProp {boolean} [required=false] - Marks the input as required.\n * @extraProp {string} [className] - Additional CSS classes for the input.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.\n */\nexport interface DateInputProps extends DateInputBaseProps {\n /** Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`). */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: FieldProps['labelSize'];\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: FieldProps['labelProps'];\n /** Render the field with horizontal layout. */\n horizontal?: boolean;\n /**\n * Icon props for the left icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconLeft?: ControlBaseProps['iconLeft'];\n /**\n * Icon props for the right icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconRight?: ControlBaseProps['iconRight'];\n /** Shortcut for the right icon name. */\n iconRightName?: string;\n /** Shortcut for left icon size. */\n iconLeftSize?: ControlBaseProps['iconLeftSize'];\n /** Shortcut for right icon size. */\n iconRightSize?: ControlBaseProps['iconRightSize'];\n /** Force the left icon container. */\n hasIconsLeft?: boolean;\n /** Force the right icon container. */\n hasIconsRight?: boolean;\n /**\n * Shows a loading spinner on the `Control` it renders, and hides the\n * launcher (`triggerIcon`) while it does. Inside your own `Control` it\n * renders none, so this draws nothing and warns in development; set\n * `isLoading` on that `Control`.\n * Under `prefers-reduced-motion: reduce` the spinner stops and stays\n * drawn (with bestax's CSS loaded).\n */\n isLoading?: boolean;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a spinner shows at the same right edge: this\n * component's `isLoading` when it renders its own `Control`, or the\n * enclosing `Control`'s `isLoading` inside one.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Expand the control to fill its container. */\n isExpanded?: boolean;\n /** Size of the wrapping Control. */\n controlSize?: ControlBaseProps['size'];\n /** Help/validation text below the input. */\n message?: React.ReactNode;\n /** Color modifier for the help message. */\n messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Additional CSS classes for the Field wrapper. */\n fieldClassName?: string;\n /** Additional CSS classes for the Control wrapper. */\n controlClassName?: string;\n}\n\n/**\n * The `DateInput` component is a form input that opens a popover calendar for date selection.\n *\n * @function\n * @param {DateInputProps} props - Props for the DateInput.\n * @returns {JSX.Element}\n *\n * @example\n * <DateInput label=\"Date of birth\" defaultValue={new Date(1990, 0, 1)} />\n *\n * @example\n * <DateInput\n * label=\"Booking\"\n * min={new Date()}\n * shouldDisableDate={d => d.getDay() === 0 || d.getDay() === 6}\n * />\n */\nexport const DateInput = forwardRef<HTMLInputElement, DateInputProps>(\n (props, ref) => {\n const {\n label,\n labelSize,\n labelProps,\n horizontal,\n iconLeft,\n iconRight,\n iconLeftName = 'calendar',\n iconRightName,\n iconLeftSize,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isLoading,\n isExpanded,\n controlSize,\n message,\n messageColor,\n fieldClassName,\n controlClassName,\n ...baseProps\n } = props;\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('DateInput', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // Inline mode renders a bare calendar with no input, so the Control's\n // icon-left container has nothing to anchor to, and it renders no\n // Control inside one or out. The left icon is checked as the caller\n // passed it: the default glyph is this component's own choice, not a\n // prop the caller set, so it goes in only for the advice.\n const ownControl = rendersOwnControl('DateInput', {\n insideControl,\n inline: baseProps.inline,\n isLoading,\n iconLeft,\n iconLeftName: props.iconLeftName,\n defaultIconLeftName: iconLeftName,\n iconLeftSize,\n iconRight,\n iconRightName,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isExpanded,\n controlSize,\n controlClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: baseProps.id,\n labelProps,\n // Inline mode renders a bare calendar with no input to label.\n rendersLabel: ownField && !baseProps.inline,\n hasInput: !baseProps.inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // The base hides its launcher while the Control it sits in is loading,\n // whether that is the one rendered below or an enclosing one.\n let content: React.ReactNode = (\n <DateInputBase ref={ref} {...baseProps} id={controlId} />\n );\n\n if (ownControl) {\n content = (\n <Control\n iconLeft={iconLeft}\n iconRight={iconRight}\n iconLeftName={iconLeftName}\n iconRightName={iconRightName}\n iconLeftSize={iconLeftSize}\n iconRightSize={iconRightSize}\n hasIconsLeft={hasIconsLeft || !!iconLeftName}\n hasIconsRight={hasIconsRight}\n isLoading={isLoading}\n isExpanded={isExpanded}\n size={controlSize}\n className={controlClassName}\n >\n {content}\n </Control>\n );\n }\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 {content}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {content}\n {messageEl}\n </>\n );\n }\n);\n\nDateInput.displayName = 'DateInput';\n\nexport default DateInput;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AA8FA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,SAAS,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,MAAM,EACJ,KAAK,E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CAAC,aAAa,IAAC,GAAG,EAAE,GAAG,EAAA,GAAM,SAAS,EAAE,EAAE,EAAE,SAAS,EAAA,CAAI,CAC1D;IAED,IAAI,UAAU,EAAE;AACd,QAAA,OAAO,IACLA,GAAA,CAAC,OAAO,EAAA,EACN,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,YAAY,IAAI,CAAC,CAAC,YAAY,EAC5C,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,gBAAgB,EAAA,QAAA,EAE1B,OAAO,EAAA,CACA,CACX;IACH;AAEA,IAAA,MAAM,SAAS,GAAG,OAAO,GAAGA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,SAAS,YAAG,OAAO,EAAA,CAAK,GAAG,IAAI;IAEzE,IAAI,QAAQ,EAAE;AACZ,QAAA,QACEC,IAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,cAAc,EAAA,QAAA,EAAA,CAExB,OAAO,EACP,SAAS,CAAA,EAAA,CACJ;IAEZ;AAEA,IAAA,QACEA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,OAAO,EACP,SAAS,CAAA,EAAA,CACT;AAEP,CAAC;AAGH,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
1
+ {"version":3,"file":"DateInput.js","sources":["../../../src/form/DateInput.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { usePrefixedClassNames } from '../helpers/classNames';\nimport { Field, FieldProps } from './Field';\nimport { Control, ControlBaseProps } from './Control';\nimport { DateInputBase, DateInputBaseProps } from './DateInputBase';\nimport {\n useInsideField,\n useInsideControl,\n rendersOwnField,\n rendersOwnControl,\n} from './FormContext';\nimport { useAutoLabelId } from './useAutoLabelId';\n\n/**\n * Props for the DateInput convenience wrapper. Extends `DateInputBaseProps`\n * with Field-level (label, horizontal) and Control-level (icons, loading) props.\n * Inside an existing `Control` it renders no `Control` of its own, so its\n * Control-level props do nothing there and warn in development; set them on\n * that `Control` instead. In `inline` mode it renders no `Control` anywhere,\n * so they do nothing inside a `Control` or out, and warn in development\n * there too. Inside an outer `Field`, or a `Control` with no `Field` around\n * it, it renders no `Field` of its own either.\n * The exception is `label`, `message`, `horizontal` or `fieldClassName` in that\n * bare `Control`: it keeps a `Field` for them, nested in the `.control`, and\n * warns in development. Wrap the `Control` in a `Field` instead, and set the\n * `label`, `horizontal` and class name on that `Field`.\n * @extraProp {string} [name] - Form field name. The text field submits the text it displays. The native input on touch devices submits the ISO value (`YYYY-MM-DD`, or `YYYY-MM` at month granularity), and an `inline` calendar, which has no visible input, submits it from a hidden input (`YYYY-MM-DD`, `YYYY-MM` or `YYYY`).\n * @extraProp {string} [form] - Form id the input belongs to.\n * @extraProp {boolean} [required=false] - Marks the input as required.\n * @extraProp {string} [className] - Additional CSS classes for the input.\n * @extraProp {React.Ref<HTMLInputElement>} [ref] - Forwarded to the underlying `<input>`.\n */\nexport interface DateInputProps extends DateInputBaseProps {\n /** Field label (component auto-wraps in a `Field` if not already inside). Automatically associated with the input via `htmlFor` — uses your `id` when provided, otherwise a generated one. Not wired in `inline` mode (no visible input to label). Dropped inside an outer `Field`, whose own label associates instead when that `Field` generates a target id (not `grouped`/`hasAddons`, no explicit `labelProps.htmlFor`) and you set no `id` here. */\n label?: React.ReactNode;\n /** Size for the label. */\n labelSize?: FieldProps['labelSize'];\n /** Props for the label element. An explicit `htmlFor` here overrides the automatic association (no id is generated then). */\n labelProps?: FieldProps['labelProps'];\n /** Render the field with horizontal layout. */\n horizontal?: boolean;\n /**\n * Icon props for the left icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconLeft?: ControlBaseProps['iconLeft'];\n /**\n * Icon props for the right icon.\n * Bulma gives control icons `pointer-events: none`, so a clickable node here\n * never receives a click. Put a button beside the input in its own addon `Control` instead.\n */\n iconRight?: ControlBaseProps['iconRight'];\n /** Shortcut for the right icon name. */\n iconRightName?: string;\n /** Shortcut for left icon size. */\n iconLeftSize?: ControlBaseProps['iconLeftSize'];\n /** Shortcut for right icon size. */\n iconRightSize?: ControlBaseProps['iconRightSize'];\n /** Force the left icon container. */\n hasIconsLeft?: boolean;\n /** Force the right icon container. */\n hasIconsRight?: boolean;\n /**\n * Shows a loading spinner on the `Control` it renders, and hides the\n * launcher (`triggerIcon`) while it does. Inside your own `Control` it\n * renders none, so this draws nothing and warns in development; set\n * `isLoading` on that `Control`.\n * Under `prefers-reduced-motion: reduce` the spinner stops and stays\n * drawn (with bestax's CSS loaded).\n */\n isLoading?: boolean;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a spinner shows at the same right edge: this\n * component's `isLoading` when it renders its own `Control`, or the\n * enclosing `Control`'s `isLoading` inside one.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Expand the control to fill its container. */\n isExpanded?: boolean;\n /** Size of the wrapping Control. */\n controlSize?: ControlBaseProps['size'];\n /** Help/validation text below the input. */\n message?: React.ReactNode;\n /** Color modifier for the help message. */\n messageColor?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Additional CSS classes for the Field wrapper. */\n fieldClassName?: string;\n /** Additional CSS classes for the Control wrapper. */\n controlClassName?: string;\n}\n\n/**\n * The `DateInput` component is a form input that opens a popover calendar for date selection.\n *\n * @function\n * @param {DateInputProps} props - Props for the DateInput.\n * @returns {JSX.Element}\n *\n * @example\n * <DateInput label=\"Date of birth\" defaultValue={new Date(1990, 0, 1)} />\n *\n * @example\n * <DateInput\n * label=\"Booking\"\n * min={new Date()}\n * shouldDisableDate={d => d.getDay() === 0 || d.getDay() === 6}\n * />\n */\nexport const DateInput = forwardRef<HTMLInputElement, DateInputProps>(\n (props, ref) => {\n const {\n label,\n labelSize,\n labelProps,\n horizontal,\n iconLeft,\n iconRight,\n iconLeftName = 'calendar',\n iconRightName,\n iconLeftSize,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isLoading,\n isExpanded,\n controlSize,\n message,\n messageColor,\n fieldClassName,\n controlClassName,\n ...baseProps\n } = props;\n const insideField = useInsideField();\n const insideControl = useInsideControl();\n const ownField = rendersOwnField('DateInput', {\n insideField,\n insideControl,\n label,\n message,\n horizontal,\n fieldClassName,\n });\n // Inline mode renders a bare calendar with no input, so the Control's\n // icon-left container has nothing to anchor to, and it renders no\n // Control inside one or out. The left icon is checked as the caller\n // passed it: the default glyph is this component's own choice, not a\n // prop the caller set, so it goes in only for the advice.\n const ownControl = rendersOwnControl('DateInput', {\n insideControl,\n inline: baseProps.inline,\n isLoading,\n iconLeft,\n iconLeftName: props.iconLeftName,\n defaultIconLeftName: iconLeftName,\n iconLeftSize,\n iconRight,\n iconRightName,\n iconRightSize,\n hasIconsLeft,\n hasIconsRight,\n isExpanded,\n controlSize,\n controlClassName,\n });\n const { controlId, fieldLabelProps } = useAutoLabelId({\n label,\n id: baseProps.id,\n labelProps,\n // Inline mode renders a bare calendar with no input to label.\n rendersLabel: ownField && !baseProps.inline,\n hasInput: !baseProps.inline,\n });\n const helpClass = usePrefixedClassNames('help', {\n [`is-${messageColor}`]: !!messageColor,\n });\n\n // The base hides its launcher while the Control it sits in is loading,\n // whether that is the one rendered below or an enclosing one.\n let content: React.ReactNode = (\n <DateInputBase ref={ref} {...baseProps} id={controlId} />\n );\n\n if (ownControl) {\n content = (\n <Control\n iconLeft={iconLeft}\n iconRight={iconRight}\n iconLeftName={iconLeftName}\n iconRightName={iconRightName}\n iconLeftSize={iconLeftSize}\n iconRightSize={iconRightSize}\n hasIconsLeft={hasIconsLeft || !!iconLeftName}\n hasIconsRight={hasIconsRight}\n isLoading={isLoading}\n isExpanded={isExpanded}\n size={controlSize}\n className={controlClassName}\n >\n {content}\n </Control>\n );\n }\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 {content}\n {messageEl}\n </Field>\n );\n }\n\n return (\n <>\n {content}\n {messageEl}\n </>\n );\n }\n);\n\nDateInput.displayName = 'DateInput';\n\nexport default DateInput;\n"],"names":["_jsx","_jsxs","_Fragment"],"mappings":";;;;;;;;;;AA8FA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,SAAS,GAAG,UAAU,CACjC,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,MAAM,EACJ,KAAK,EACL,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GAAG,UAAU,EACzB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,EACT,UAAU,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,GAAG,SAAS,EACb,GAAG,KAAK;AACT,IAAA,MAAM,WAAW,GAAG,cAAc,EAAE;AACpC,IAAA,MAAM,aAAa,GAAG,gBAAgB,EAAE;AACxC,IAAA,MAAM,QAAQ,GAAG,eAAe,CAAC,WAAW,EAAE;QAC5C,WAAW;QACX,aAAa;QACb,KAAK;QACL,OAAO;QACP,UAAU;QACV,cAAc;AACf,KAAA,CAAC;;;;;;AAMF,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,WAAW,EAAE;QAChD,aAAa;QACb,MAAM,EAAE,SAAS,CAAC,MAAM;QACxB,SAAS;QACT,QAAQ;QACR,YAAY,EAAE,KAAK,CAAC,YAAY;AAChC,QAAA,mBAAmB,EAAE,YAAY;QACjC,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Q,EAAE;AACZ,QAAA,QACEC,IAAA,CAAC,KAAK,EAAA,EACJ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,eAAe,EAC3B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,cAAc,EAAA,QAAA,EAAA,CAExB,OAAO,EACP,SAAS,CAAA,EAAA,CACJ;IAEZ;AAEA,IAAA,QACEA,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACG,OAAO,EACP,SAAS,CAAA,EAAA,CACT;AAEP,CAAC;AAGH,SAAS,CAAC,WAAW,GAAG,WAAW;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateInputBase.js","sources":["../../../src/form/DateInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n PickerPosition,\n DayOfWeek,\n DateGranularity,\n PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatDate,\n parseDate,\n DateFormatOption,\n DEFAULT_DATE_FORMAT,\n DEFAULT_MONTH_FORMAT,\n DEFAULT_YEAR_FORMAT,\n fromIsoValue,\n toIsoValue,\n} from './_pickerInternals/formatters';\nimport {\n isWithin,\n clampDate,\n floorMin,\n isSameDay,\n isPeriodUnselectable,\n startOfDay,\n startOfPeriod,\n endOfPeriod,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport { supportsInputType } from './_pickerInternals/nativeInputSupport';\nimport type { SegmentKind } from './_pickerInternals/segmentMap';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget } from './FormContext';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { Icon } from '../elements/Icon';\n\nconst DEFAULT_FORMATS: Record<DateGranularity, string> = {\n day: DEFAULT_DATE_FORMAT,\n month: DEFAULT_MONTH_FORMAT,\n year: DEFAULT_YEAR_FORMAT,\n};\n\n// Segments finer than the granularity render but are never edited.\nconst SKIPPED_SEGMENTS: Record<\n DateGranularity,\n readonly SegmentKind[] | undefined\n> = {\n day: undefined,\n month: ['day'],\n year: ['month', 'day'],\n};\n\n/**\n * Props for the raw DateInput base. Use the higher-level `DateInput` for\n * Field/Control composition; `DateInputBase` is the input + popover only.\n */\nexport interface DateInputBaseProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'size'\n | 'color'\n | 'min'\n | 'max'\n | 'type'\n | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /** Controlled selected date. */\n value?: Date | null;\n /** Initial date for uncontrolled usage. */\n defaultValue?: Date | null;\n /**\n * Fired when the value changes. A day picked in the calendar, by click or\n * by key, arrives at local midnight.\n */\n onChange?: (d: Date | null) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Earliest selectable date. A `min` before year 1 is raised to 1 January of\n * year 1, where the range starts without one too: HTML's date and month\n * inputs hold no earlier year, so the calendar and typing stop there.\n */\n min?: Date;\n /** Latest selectable date. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Make the input read-only. */\n readOnly?: boolean;\n /** Placeholder text for the input. */\n placeholder?: string;\n /**\n * What the calendar shows and what a selection means: `'day'` shows the\n * day grid, `'month'` a grid of the focused year's months whose header\n * steps a year at a time, and `'year'` the year list. A month or year value\n * is the first day of that period at local midnight, so `onChange` gets\n * `new Date(2026, 5, 1)` for June 2026. A `value` elsewhere in the period\n * shows as that period and stays as given until the user picks a period or\n * types a different one. `min`, `max`,\n * `shouldDisableDate` and `unselectableDates` judge whole periods: a month\n * or year can be picked while any day in it can, so a `min` of 15 June\n * still allows June, and June commits as 1 June, earlier than that `min`.\n * The default `format` follows the granularity (`'YYYY-MM'`, `'YYYY'`); a\n * custom `format` with finer tokens still renders them, but typing skips\n * them. `firstDayOfWeek`, `dayNames` and `nearbyMonthDays` only affect the\n * day grid, and an `inline` calendar's hidden form value is `YYYY-MM` or\n * `YYYY`. The `labels` keys `chooseMonth` / `chooseYear` name the launcher\n * and popover, and `prevYear` / `nextYear` the month grid's header buttons.\n * @defaultValue 'day'\n */\n granularity?: DateGranularity;\n /**\n * Token format string or `Intl.DateTimeFormat` options. Defaults to\n * `'YYYY-MM-DD'`, or to `'YYYY-MM'` / `'YYYY'` when `granularity` is\n * `'month'` / `'year'`.\n * @defaultValue 'YYYY-MM-DD'\n */\n format?: DateFormatOption;\n /**\n * Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).\n * Enter and leaving the field call it only if the user changed the text,\n * so focus passing through commits nothing and the value keeps what the\n * format leaves out, such as the time of day.\n */\n parse?: (s: string) => Date | null;\n /** BCP-47 locale tag for day/month names and Intl formatting. */\n locale?: string;\n /** Render the calendar inline (no popover). */\n inline?: boolean;\n /**\n * Use `<input type=\"date\">` on coarse-pointer + small-viewport devices. At\n * `'month'` granularity it uses `<input type=\"month\">` where the browser\n * implements one, as Chromium browsers, Safari on iOS and Firefox for\n * Android do, and the calendar where it doesn't, as in desktop Firefox.\n * Desktop Safari accepts the type but draws no month control, so forcing\n * `true` there shows a plain text box. HTML has no year input, so `'year'`\n * granularity always renders the calendar.\n */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). */\n popover?: boolean;\n /**\n * Open the popover when the input is focused. Focus that a closing popover\n * hands back to the input leaves it closed. Dismissing it commits nothing:\n * an empty field stays empty, and leaving afterwards commits only what was\n * typed since. With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /** Close the popover after a date is selected. */\n closeOnSelect?: boolean;\n /** Popover anchor position relative to the input. */\n position?: PickerPosition;\n /** Render the popover into `document.body` via portal. */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the calendar, where it\n * colors the selected date. Today's date and the keyboard focus ring take\n * the color's `-on-scheme` variant, which Bulma adjusts to contrast with the\n * background, so pale colors stay readable. Unset, the calendar uses its\n * `--bulma-dateinput-*` variables, which follow `primary` the same way by\n * default.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the input with rounded corners. */\n isRounded?: boolean;\n /** Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. */\n unselectableDates?: Date[];\n /** Day the week starts on (0 = Sunday). */\n firstDayOfWeek?: DayOfWeek;\n /** Override the 7 day-name labels (in calendar order, post-rotation). */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months in the grid. */\n nearbyMonthDays?: boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /** Optional translatable string overrides (ARIA labels, button text). */\n labels?: PickerLabels;\n}\n\n/**\n * Raw DateInput — input + popover calendar without Field/Control wrapping.\n * Use `DateInput` for the convenience wrapper.\n *\n * @function\n * @param {DateInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateInputBase = forwardRef<HTMLInputElement, DateInputBaseProps>(\n (props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled,\n readOnly,\n placeholder,\n granularity = 'day',\n format,\n parse,\n locale,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = true,\n position = 'bottom-left',\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek = 0,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n className,\n name,\n form,\n required,\n id: idProp,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n labels,\n ...rest\n } = props;\n // Inside a labeled Field the input takes the id the label points at\n // when the caller set none, as InputBase does, and the popover's ids\n // follow it. Inline there is no input to name, so nothing takes the\n // Field's id or builds on it.\n const id = useFieldLabelTarget(idProp, !inline);\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n\n const t = mergeLabels(labels);\n const isDayGranularity = granularity === 'day';\n const resolvedFormat = format ?? DEFAULT_FORMATS[granularity];\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<Date | null>(\n defaultValue ?? null\n );\n const value = isControlled ? (controlledValue ?? null) : internalValue;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const initialFocused = useMemo(\n () => clampDate(value ?? new Date(), lowerBound, max),\n // intentionally only on mount: keep focusedDate stable until value/open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n const [focusedDate, setFocusedDate] = useState<Date>(initialFocused);\n // Re-clamp focusedDate if min/max change after mount so the focused cell\n // never disappears outside the displayable range.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n const [open, setOpenState] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatDate(value, resolvedFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n\n const { shouldUseNative } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n // The day picker goes native as it always has. A month picker does only\n // where the browser implements the month input, asked after hydration so\n // the server and the first client render agree. HTML has no year input,\n // so a year picker always renders the calendar.\n const hydrated = useIsHydrated();\n const hasNativeInput =\n isDayGranularity ||\n (granularity === 'month' && hydrated && supportsInputType('month'));\n const useNative = !inline && shouldUseNative && hasNativeInput;\n\n const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('dateinput-container');\n const triggerClass = usePrefixedClassNames('dateinput-trigger');\n\n // What the latest request asked for, so a second request in the same\n // event sees it before React renders. The callbacks fire here rather than\n // in a state updater, which StrictMode calls twice, and after the state\n // is set, so a request a callback makes is the one that lands last.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) onOpen?.();\n else onClose?.();\n },\n [onOpen, onClose]\n );\n\n // Sync displayed text with value when value changes externally.\n useEffect(() => {\n setText(value ? formatDate(value, resolvedFormat, locale) : '');\n }, [value, resolvedFormat, locale]);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n // A month or year value is its period's first day, however the\n // calendar, typing or parsing arrived at it.\n const committed =\n next && !isDayGranularity ? startOfPeriod(next, granularity) : next;\n if (!isControlled) setInternalValue(committed);\n // Keep the calendar's focused cell tracking typed / parsed values.\n if (committed) setFocusedDate(committed);\n onChange?.(committed);\n },\n [isControlled, onChange, isDayGranularity, granularity]\n );\n\n // At month or year granularity the bounds widen to the periods holding\n // them, so the month or year containing `min` stays reachable.\n const periodMin = useMemo(\n () =>\n isDayGranularity ? lowerBound : startOfPeriod(lowerBound, granularity),\n [lowerBound, isDayGranularity, granularity]\n );\n const periodMax = useMemo(\n () => (max && !isDayGranularity ? endOfPeriod(max, granularity) : max),\n [max, isDayGranularity, granularity]\n );\n\n // A pick is the day at midnight, as a click on its cell gives. Enter hands\n // over the focused date, which can carry a time of day from the clock, a\n // value or a bound, so its time is dropped here.\n const handleSelect = useCallback(\n (picked: Date) => {\n const d = startOfDay(picked);\n if (!isWithin(d, periodMin, periodMax)) return;\n commitValue(d);\n setFocusedDate(d);\n if (closeOnSelect) setOpen(false);\n },\n [periodMin, periodMax, commitValue, closeOnSelect, setOpen]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseDate(trimmed, fmt ?? DEFAULT_FORMATS[granularity], locale);\n },\n [parse, format, locale, granularity]\n );\n\n // The Date the user edits when starting without a current value (today at\n // midnight, or the start of this month or year; the hook clamps to\n // min/max on commit).\n const makeBaseDate = useCallback((): Date => {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return isDayGranularity ? d : startOfPeriod(d, granularity);\n }, [isDayGranularity, granularity]);\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n // Blocking predicate for manual entry, matching the calendar's\n // disabled-cell logic (shouldDisableDate + unselectableDates by day, or\n // every day of the month or year blocked at those granularities).\n const isBlocked = useMemo(() => {\n if (!isDayGranularity) {\n const constraints = { min, max, shouldDisableDate, unselectableDates };\n return (d: Date) => isPeriodUnselectable(d, granularity, constraints);\n }\n if (!shouldDisableDate && !unselectableDates?.length) return undefined;\n return (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d));\n }, [\n isDayGranularity,\n granularity,\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n ]);\n\n // Typing, and the re-parse on blur or Enter, that lands in the period the\n // value already holds commits nothing, so a `value` elsewhere in its month\n // or year changes only when the user picks or types a different period.\n const commitTyped = useCallback(\n (next: Date | null) => {\n if (\n next &&\n value &&\n !isDayGranularity &&\n startOfPeriod(next, granularity).getTime() ===\n startOfPeriod(value, granularity).getTime()\n ) {\n setText(formatDate(value, resolvedFormat, locale));\n return;\n }\n commitValue(next);\n },\n [\n value,\n isDayGranularity,\n granularity,\n resolvedFormat,\n locale,\n commitValue,\n ]\n );\n\n const { inputHandlers } = useSegmentedEntry({\n format: resolvedFormat,\n skipKinds: SKIPPED_SEGMENTS[granularity],\n value,\n commitValue: commitTyped,\n formatFn: formatDate,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: periodMin,\n max: periodMax,\n isBlocked,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n });\n\n const handlePopoverClose = useCallback(() => setOpen(false), [setOpen]);\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (inputRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n },\n [ref]\n );\n\n // Native mobile path renders <input type=\"date\"> (type=\"month\" for a\n // month picker).\n if (useNative) {\n return (\n <input\n {...cleanRest}\n ref={combinedRef}\n type={isDayGranularity ? 'date' : 'month'}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoValue(value, granularity) : ''}\n onChange={e => {\n const parsed = e.target.value\n ? fromIsoValue(e.target.value, granularity)\n : null;\n commitValue(parsed);\n }}\n min={min ? toIsoValue(lowerBound, granularity) : undefined}\n max={max ? toIsoValue(max, granularity) : undefined}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n name={name}\n form={form}\n required={required}\n id={id}\n />\n );\n }\n\n const chooseLabel =\n granularity === 'month'\n ? t.chooseMonth\n : granularity === 'year'\n ? t.chooseYear\n : t.chooseDate;\n\n const calendar = (\n <Calendar\n // A new granularity starts the calendar over on its own view.\n key={granularity}\n granularity={granularity}\n value={value}\n focusedDate={focusedDate}\n onSelect={handleSelect}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n // The popover panel takes `popoverId`, so the calendar inside it\n // takes one of its own. Inline there is no panel, and the calendar\n // keeps the id it released with.\n id={inline ? popoverId : `${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n );\n\n if (inline) {\n return (\n <div\n {...cleanRest}\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n >\n {calendar}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n value={value ? toIsoValue(value, granularity) : ''}\n required={required}\n />\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n {...cleanRest}\n >\n <input\n ref={combinedRef}\n type=\"text\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={popoverId}\n autoComplete=\"off\"\n className={inputClass}\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={inputReadOnlyAttr}\n name={name}\n form={form}\n required={required}\n id={id}\n {...inputHandlers}\n />\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n onClick={() => {\n if (canOpen) setOpen(!open);\n }}\n disabled={!canOpen}\n aria-label={chooseLabel}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n isOpen={open}\n onClose={handlePopoverClose}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={chooseLabel}\n id={popoverId}\n restoreFocusRef={inputRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {calendar}\n </PickerPopover>\n )}\n </div>\n );\n }\n);\n\nDateInputBase.displayName = 'DateInputBase';\n\nexport default DateInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,MAAM,eAAe,GAAoC;AACvD,IAAA,GAAG,EAAE,mBAAmB;AACxB,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,IAAI,EAAE,mBAAmB;CAC1B;AAED;AACA,MAAM,gBAAgB,GAGlB;AACF,IAAA,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,CAAC,KAAK,CAAC;AACd,IAAA,IAAI,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC;CACvB;AAyJD;;;;;;;AAOG;AACI,MAAM,aAAa,GAAG,UAAU,CACrC,CAAC,KAAK,EAAE,GAAG,KAAI;AACb,IAAA,MAAM,EACJ,KAAK,EAAE,eAAe,EACtB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,WAAW,GAAG,KAAK,EACnB,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,GAAG,KAAK,EACd,YAAY,GAAG,MAAM,EACrB,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,IAAI,EAClB,aAAa,GAAG,IAAI,EACpB,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GAAG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AiB,EAC3B,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,KACF,aAAa,EAAA,CACjB,EACD,OAAO,IAAI,WAAW,KACrBA,GAAA,CAAA,QAAA,EAAA,EACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,MAAK;AACZ,oBAAA,IAAI,OAAO;AAAE,wBAAA,OAAO,CAAC,CAAC,IAAI,CAAC;AAC7B,gBAAA,CAAC,EACD,QAAQ,EAAE,CAAC,OAAO,EAAA,YAAA,EACN,WAAW,EAAA,eAAA,EACT,QAAQ,mBACP,SAAS,EAAA,eAAA,EACT,IAAI,EACnB,QAAQ,EAAE,OAAO,GAAG,CAAC,GAAG,EAAE,YAE1BA,GAAA,CAAC,IAAI,IAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI,GACpC,CACV,EACA,OAAO,KACNA,GAAA,CAAC,aAAa,IACZ,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,EAAE,SAAS,EACb,eAAe,EAAE,QAAQ,EACzB,oBAAoB,EAAE,qBAAqB,EAAA,QAAA,EAE1C,QAAQ,GACK,CACjB,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
1
+ {"version":3,"file":"DateInputBase.js","sources":["../../../src/form/DateInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n PickerPosition,\n DayOfWeek,\n DateGranularity,\n PickerLabels,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n formatDate,\n parseDate,\n DateFormatOption,\n DEFAULT_DATE_FORMAT,\n DEFAULT_MONTH_FORMAT,\n DEFAULT_YEAR_FORMAT,\n fromIsoValue,\n toIsoValue,\n} from './_pickerInternals/formatters';\nimport {\n isWithin,\n clampDate,\n floorMin,\n isSameDay,\n isPeriodUnselectable,\n startOfDay,\n startOfPeriod,\n endOfPeriod,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport { supportsInputType } from './_pickerInternals/nativeInputSupport';\nimport type { SegmentKind } from './_pickerInternals/segmentMap';\nimport { useControlLoading } from './controlLoading';\nimport { useFieldLabelTarget } from './FormContext';\nimport { useIsHydrated } from '../helpers/useIsHydrated';\nimport { Icon } from '../elements/Icon';\n\nconst DEFAULT_FORMATS: Record<DateGranularity, string> = {\n day: DEFAULT_DATE_FORMAT,\n month: DEFAULT_MONTH_FORMAT,\n year: DEFAULT_YEAR_FORMAT,\n};\n\n// Segments finer than the granularity render but are never edited.\nconst SKIPPED_SEGMENTS: Record<\n DateGranularity,\n readonly SegmentKind[] | undefined\n> = {\n day: undefined,\n month: ['day'],\n year: ['month', 'day'],\n};\n\n/**\n * Props for the raw DateInput base. Use the higher-level `DateInput` for\n * Field/Control composition; `DateInputBase` is the input + popover only.\n */\nexport interface DateInputBaseProps\n extends\n Omit<\n React.InputHTMLAttributes<HTMLInputElement>,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'size'\n | 'color'\n | 'min'\n | 'max'\n | 'type'\n | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /** Controlled selected date. */\n value?: Date | null;\n /** Initial date for uncontrolled usage. */\n defaultValue?: Date | null;\n /**\n * Fired when the value changes. A day picked in the calendar, by click or\n * by key, arrives at local midnight.\n */\n onChange?: (d: Date | null) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Earliest selectable date. A `min` before year 1 is raised to 1 January of\n * year 1, where the range starts without one too: HTML's date and month\n * inputs hold no earlier year, so the calendar and typing stop there.\n */\n min?: Date;\n /** Latest selectable date. */\n max?: Date;\n /** Disable the input. */\n disabled?: boolean;\n /** Make the input read-only. */\n readOnly?: boolean;\n /** Placeholder text for the input. */\n placeholder?: string;\n /**\n * What the calendar shows and what a selection means: `'day'` shows the\n * day grid, `'month'` a grid of the focused year's months whose header\n * steps a year at a time, and `'year'` the year list. A month or year value\n * is the first day of that period at local midnight, so `onChange` gets\n * `new Date(2026, 5, 1)` for June 2026. A `value` elsewhere in the period\n * shows as that period and stays as given until the user picks a period or\n * types a different one. `min`, `max`,\n * `shouldDisableDate` and `unselectableDates` judge whole periods: a month\n * or year can be picked while any day in it can, so a `min` of 15 June\n * still allows June, and June commits as 1 June, earlier than that `min`.\n * The default `format` follows the granularity (`'YYYY-MM'`, `'YYYY'`); a\n * custom `format` with finer tokens still renders them, but typing skips\n * them. `firstDayOfWeek`, `dayNames` and `nearbyMonthDays` only affect the\n * day grid, and an `inline` calendar's hidden form value is `YYYY-MM` or\n * `YYYY`. The `labels` keys `chooseMonth` / `chooseYear` name the launcher\n * and popover, and `prevYear` / `nextYear` the month grid's header buttons.\n * @defaultValue 'day'\n */\n granularity?: DateGranularity;\n /**\n * Token format string or `Intl.DateTimeFormat` options. Defaults to\n * `'YYYY-MM-DD'`, or to `'YYYY-MM'` / `'YYYY'` when `granularity` is\n * `'month'` / `'year'`.\n * @defaultValue 'YYYY-MM-DD'\n */\n format?: DateFormatOption;\n /**\n * Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).\n * Enter and leaving the field call it only if the user changed the text,\n * so focus passing through commits nothing and the value keeps what the\n * format leaves out, such as the time of day.\n */\n parse?: (s: string) => Date | null;\n /** BCP-47 locale tag for day/month names and Intl formatting. */\n locale?: string;\n /** Render the calendar inline (no popover). */\n inline?: boolean;\n /**\n * Use `<input type=\"date\">` on coarse-pointer + small-viewport devices. At\n * `'month'` granularity it uses `<input type=\"month\">` where the browser\n * implements one, as Chromium browsers, Safari on iOS and Firefox for\n * Android do, and the calendar where it doesn't, as in desktop Firefox.\n * Desktop Safari accepts the type but draws no month control, so forcing\n * `true` there shows a plain text box. HTML has no year input, so `'year'`\n * granularity always renders the calendar.\n */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in the input (type the date directly, auto-advancing across segments). `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar popover exists. `false` makes the field input-only (segmented typing, no popover). */\n popover?: boolean;\n /**\n * Open the popover when the input is focused. Focus that a closing popover\n * hands back to the input leaves it closed. Dismissing it commits nothing:\n * an empty field stays empty, and leaving afterwards commits only what was\n * typed since. With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /** Close the popover after a date is selected. */\n closeOnSelect?: boolean;\n /** Popover anchor position relative to the input. */\n position?: PickerPosition;\n /**\n * Render the popover through a portal, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the input, also carried by the calendar, where it\n * colors the selected date. Today's date and the keyboard focus ring take\n * the color's `-on-scheme` variant, which Bulma adjusts to contrast with the\n * background, so pale colors stay readable. Unset, the calendar uses its\n * `--bulma-dateinput-*` variables, which follow `primary` the same way by\n * default.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the input with rounded corners. */\n isRounded?: boolean;\n /** Predicate to disable specific dates (e.g. weekends). Blocked dates are also rejected during manual typing. */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day and also rejected during manual typing. */\n unselectableDates?: Date[];\n /** Day the week starts on (0 = Sunday). */\n firstDayOfWeek?: DayOfWeek;\n /** Override the 7 day-name labels (in calendar order, post-rotation). */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months in the grid. */\n nearbyMonthDays?: boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /** Optional translatable string overrides (ARIA labels, button text). */\n labels?: PickerLabels;\n}\n\n/**\n * Raw DateInput — input + popover calendar without Field/Control wrapping.\n * Use `DateInput` for the convenience wrapper.\n *\n * @function\n * @param {DateInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateInputBase = forwardRef<HTMLInputElement, DateInputBaseProps>(\n (props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled,\n readOnly,\n placeholder,\n granularity = 'day',\n format,\n parse,\n locale,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = true,\n position = 'bottom-left',\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n firstDayOfWeek = 0,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n className,\n name,\n form,\n required,\n id: idProp,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n labels,\n ...rest\n } = props;\n // Inside a labeled Field the input takes the id the label points at\n // when the caller set none, as InputBase does, and the popover's ids\n // follow it. Inline there is no input to name, so nothing takes the\n // Field's id or builds on it.\n const id = useFieldLabelTarget(idProp, !inline);\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n\n const t = mergeLabels(labels);\n const isDayGranularity = granularity === 'day';\n const resolvedFormat = format ?? DEFAULT_FORMATS[granularity];\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<Date | null>(\n defaultValue ?? null\n );\n const value = isControlled ? (controlledValue ?? null) : internalValue;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const initialFocused = useMemo(\n () => clampDate(value ?? new Date(), lowerBound, max),\n // intentionally only on mount: keep focusedDate stable until value/open change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n const [focusedDate, setFocusedDate] = useState<Date>(initialFocused);\n // Re-clamp focusedDate if min/max change after mount so the focused cell\n // never disappears outside the displayable range.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n const [open, setOpenState] = useState(false);\n const [text, setText] = useState<string>(\n value ? formatDate(value, resolvedFormat, locale) : ''\n );\n\n const inputRef = useRef<HTMLInputElement>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n\n const { shouldUseNative } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n // The day picker goes native as it always has. A month picker does only\n // where the browser implements the month input, asked after hydration so\n // the server and the first client render agree. HTML has no year input,\n // so a year picker always renders the calendar.\n const hydrated = useIsHydrated();\n const hasNativeInput =\n isDayGranularity ||\n (granularity === 'month' && hydrated && supportsInputType('month'));\n const useNative = !inline && shouldUseNative && hasNativeInput;\n\n const inputClass = usePrefixedClassNames('input', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n });\n const containerClass = usePrefixedClassNames('dateinput-container');\n const triggerClass = usePrefixedClassNames('dateinput-trigger');\n\n // What the latest request asked for, so a second request in the same\n // event sees it before React renders. The callbacks fire here rather than\n // in a state updater, which StrictMode calls twice, and after the state\n // is set, so a request a callback makes is the one that lands last.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) onOpen?.();\n else onClose?.();\n },\n [onOpen, onClose]\n );\n\n // Sync displayed text with value when value changes externally.\n useEffect(() => {\n setText(value ? formatDate(value, resolvedFormat, locale) : '');\n }, [value, resolvedFormat, locale]);\n\n const commitValue = useCallback(\n (next: Date | null) => {\n // A month or year value is its period's first day, however the\n // calendar, typing or parsing arrived at it.\n const committed =\n next && !isDayGranularity ? startOfPeriod(next, granularity) : next;\n if (!isControlled) setInternalValue(committed);\n // Keep the calendar's focused cell tracking typed / parsed values.\n if (committed) setFocusedDate(committed);\n onChange?.(committed);\n },\n [isControlled, onChange, isDayGranularity, granularity]\n );\n\n // At month or year granularity the bounds widen to the periods holding\n // them, so the month or year containing `min` stays reachable.\n const periodMin = useMemo(\n () =>\n isDayGranularity ? lowerBound : startOfPeriod(lowerBound, granularity),\n [lowerBound, isDayGranularity, granularity]\n );\n const periodMax = useMemo(\n () => (max && !isDayGranularity ? endOfPeriod(max, granularity) : max),\n [max, isDayGranularity, granularity]\n );\n\n // A pick is the day at midnight, as a click on its cell gives. Enter hands\n // over the focused date, which can carry a time of day from the clock, a\n // value or a bound, so its time is dropped here.\n const handleSelect = useCallback(\n (picked: Date) => {\n const d = startOfDay(picked);\n if (!isWithin(d, periodMin, periodMax)) return;\n commitValue(d);\n setFocusedDate(d);\n if (closeOnSelect) setOpen(false);\n },\n [periodMin, periodMax, commitValue, closeOnSelect, setOpen]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseDate(trimmed, fmt ?? DEFAULT_FORMATS[granularity], locale);\n },\n [parse, format, locale, granularity]\n );\n\n // The Date the user edits when starting without a current value (today at\n // midnight, or the start of this month or year; the hook clamps to\n // min/max on commit).\n const makeBaseDate = useCallback((): Date => {\n const d = new Date();\n d.setHours(0, 0, 0, 0);\n return isDayGranularity ? d : startOfPeriod(d, granularity);\n }, [isDayGranularity, granularity]);\n\n const inputReadOnlyAttr = !!readOnly || !editable;\n const canOpen = !!popover && !disabled && !readOnly;\n\n // Blocking predicate for manual entry, matching the calendar's\n // disabled-cell logic (shouldDisableDate + unselectableDates by day, or\n // every day of the month or year blocked at those granularities).\n const isBlocked = useMemo(() => {\n if (!isDayGranularity) {\n const constraints = { min, max, shouldDisableDate, unselectableDates };\n return (d: Date) => isPeriodUnselectable(d, granularity, constraints);\n }\n if (!shouldDisableDate && !unselectableDates?.length) return undefined;\n return (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d));\n }, [\n isDayGranularity,\n granularity,\n min,\n max,\n shouldDisableDate,\n unselectableDates,\n ]);\n\n // Typing, and the re-parse on blur or Enter, that lands in the period the\n // value already holds commits nothing, so a `value` elsewhere in its month\n // or year changes only when the user picks or types a different period.\n const commitTyped = useCallback(\n (next: Date | null) => {\n if (\n next &&\n value &&\n !isDayGranularity &&\n startOfPeriod(next, granularity).getTime() ===\n startOfPeriod(value, granularity).getTime()\n ) {\n setText(formatDate(value, resolvedFormat, locale));\n return;\n }\n commitValue(next);\n },\n [\n value,\n isDayGranularity,\n granularity,\n resolvedFormat,\n locale,\n commitValue,\n ]\n );\n\n const { inputHandlers } = useSegmentedEntry({\n format: resolvedFormat,\n skipKinds: SKIPPED_SEGMENTS[granularity],\n value,\n commitValue: commitTyped,\n formatFn: formatDate,\n tryParse,\n text,\n setText,\n makeBaseDate,\n locale,\n min: periodMin,\n max: periodMax,\n isBlocked,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen,\n inputRef,\n containerRef,\n onFocus,\n onClick,\n onKeyDown,\n onBlur,\n });\n\n const handlePopoverClose = useCallback(() => setOpen(false), [setOpen]);\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (inputRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n },\n [ref]\n );\n\n // Native mobile path renders <input type=\"date\"> (type=\"month\" for a\n // month picker).\n if (useNative) {\n return (\n <input\n {...cleanRest}\n ref={combinedRef}\n type={isDayGranularity ? 'date' : 'month'}\n className={classNames(inputClass, bulmaHelperClasses, className)}\n value={value ? toIsoValue(value, granularity) : ''}\n onChange={e => {\n const parsed = e.target.value\n ? fromIsoValue(e.target.value, granularity)\n : null;\n commitValue(parsed);\n }}\n min={min ? toIsoValue(lowerBound, granularity) : undefined}\n max={max ? toIsoValue(max, granularity) : undefined}\n disabled={disabled}\n readOnly={readOnly}\n placeholder={placeholder}\n name={name}\n form={form}\n required={required}\n id={id}\n />\n );\n }\n\n const chooseLabel =\n granularity === 'month'\n ? t.chooseMonth\n : granularity === 'year'\n ? t.chooseYear\n : t.chooseDate;\n\n const calendar = (\n <Calendar\n // A new granularity starts the calendar over on its own view.\n key={granularity}\n granularity={granularity}\n value={value}\n focusedDate={focusedDate}\n onSelect={handleSelect}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n // The popover panel takes `popoverId`, so the calendar inside it\n // takes one of its own. Inline there is no panel, and the calendar\n // keeps the id it released with.\n id={inline ? popoverId : `${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n );\n\n if (inline) {\n return (\n <div\n {...cleanRest}\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n >\n {calendar}\n {name && (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n value={value ? toIsoValue(value, granularity) : ''}\n required={required}\n />\n )}\n </div>\n );\n }\n\n return (\n <div\n ref={containerRef}\n className={classNames(containerClass, bulmaHelperClasses, className)}\n {...cleanRest}\n >\n <input\n ref={combinedRef}\n type=\"text\"\n role=\"combobox\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n aria-controls={popoverId}\n autoComplete=\"off\"\n className={inputClass}\n value={text}\n placeholder={placeholder}\n disabled={disabled}\n readOnly={inputReadOnlyAttr}\n name={name}\n form={form}\n required={required}\n id={id}\n {...inputHandlers}\n />\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n onClick={() => {\n if (canOpen) setOpen(!open);\n }}\n disabled={!canOpen}\n aria-label={chooseLabel}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n isOpen={open}\n onClose={handlePopoverClose}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={chooseLabel}\n id={popoverId}\n restoreFocusRef={inputRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {calendar}\n </PickerPopover>\n )}\n </div>\n );\n }\n);\n\nDateInputBase.displayName = 'DateInputBase';\n\nexport default DateInputBase;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;AAiDA,MAAM,eAAe,GAAoC;AACvD,IAAA,GAAG,EAAE,mBAAmB;AACxB,IAAA,KAAK,EAAE,oBAAoB;AAC3B,IAAA,IAAI,EAAE,mBAAmB;CAC1B;AAED;AACA,MAAM,gBAAgB,GAGlB;AACF,IAAA,GAAG,EAAE,SAAS;IACd,KAAK,EAAE,CAAC,KAAK,CAAC;AACd,IAAA,I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Aa,IACZ,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,EAAE,SAAS,EACb,eAAe,EAAE,QAAQ,EACzB,oBAAoB,EAAE,qBAAqB,EAAA,QAAA,EAE1C,QAAQ,GACK,CACjB,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,aAAa,CAAC,WAAW,GAAG,eAAe;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangeInputBase.js","sources":["../../../src/form/DateRangeInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n DateRangeValue,\n DayOfWeek,\n PickerLabels,\n PickerPosition,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n DEFAULT_DATE_FORMAT,\n DateFormatOption,\n formatDate,\n fromIsoValue,\n parseDate,\n toIsoValue,\n} from './_pickerInternals/formatters';\nimport {\n canCloseRange,\n clampDate,\n floorMin,\n isSameDay,\n isWithin,\n startOfDay,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport { useControlLoading } from './controlLoading';\nimport { useAutoLabelledBy } from './useAutoLabelId';\nimport { Icon } from '../elements/Icon';\n\nexport type { DateRangeValue };\n\nconst EMPTY_RANGE: DateRangeValue = [null, null];\n\n/** A range's end as the form and the native inputs carry it. */\nconst isoDay = (d: Date | null): string => (d ? toIsoValue(d, 'day') : '');\n\n/** Today at local midnight, where typing into an empty end starts. */\nconst today = (): Date => startOfDay(new Date());\n\n/**\n * Props for the raw DateRangeInput base. Use the higher-level\n * `DateRangeInput` for Field/Control composition; `DateRangeInputBase` is the\n * two inputs and the popover only.\n */\nexport interface DateRangeInputBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'defaultValue' | 'onChange' | 'color' | 'placeholder' | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * Controlled range, start first. Either end may be `null`, and\n * `[null, null]` is empty.\n */\n value?: DateRangeValue;\n /** Initial range for uncontrolled usage. */\n defaultValue?: DateRangeValue;\n /**\n * Fired when the range changes, with the start first. Typing commits one\n * end at a time, so a range half typed arrives as `[start, null]`. The\n * calendar commits only a finished range: its first pick marks the start\n * inside the calendar and its second commits both ends in one call. The\n * range stays ordered, so the end is never before the start.\n */\n onChange?: (range: DateRangeValue) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Earliest selectable date, for either end. A `min` before year 1 is raised\n * to 1 January of year 1, where the range starts without one too.\n */\n min?: Date;\n /** Latest selectable date, for either end. */\n max?: Date;\n /** Disable both inputs and the launcher. */\n disabled?: boolean;\n /** Make both inputs read-only and keep the popover closed. */\n readOnly?: boolean;\n /** Placeholder text, shown in both inputs while they are empty. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options, used by both\n * inputs.\n * @defaultValue 'YYYY-MM-DD'\n */\n format?: DateFormatOption;\n /**\n * Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).\n * Enter and leaving an input call it only if the user changed its text.\n */\n parse?: (s: string) => Date | null;\n /** BCP-47 locale tag for day/month names and Intl formatting. */\n locale?: string;\n /**\n * Render the calendar inline, with no inputs and no popover. The hidden\n * form inputs still carry the range.\n */\n inline?: boolean;\n /**\n * Use two native `<input type=\"date\">`s on coarse-pointer, small-viewport\n * devices (`'auto'`), always (`true`) or never (`false`). The end input's\n * `min` follows the start, and a change goes through the same rules as\n * typing.\n */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in both inputs. `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar popover exists. `false` makes the field input-only. */\n popover?: boolean;\n /**\n * Open the popover when focus arrives in the field. Moving focus between\n * the two inputs, or back from the launcher, leaves it closed, and so does\n * the focus a closing popover hands back. A click on either input opens it.\n * With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /**\n * Close the popover once the range is picked. The first pick, which only\n * marks the start, never closes it.\n */\n closeOnSelect?: boolean;\n /** Popover anchor position relative to the field. */\n position?: PickerPosition;\n /** Render the popover into `document.body` via portal. */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the field, also carried by the calendar, where it\n * colors the range's ends and the band between them.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the field with rounded corners. */\n isRounded?: boolean;\n /**\n * Predicate to disable specific dates (e.g. weekends). A disabled day can\n * be neither end, typing rejects it, and a range can't include one unless\n * `allowDisabledInRange` is set.\n */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day. */\n unselectableDates?: Date[];\n /**\n * Let a range include days that `shouldDisableDate` or `unselectableDates`\n * disable, such as a stay over a night with no check-ins. Its ends still\n * can't be such days. Off, a pick in the calendar past a disabled day\n * starts a new range there, typing refuses an end past one, and a start\n * typed with one before the end clears the end. Finding one walks the days\n * between, so off, a span too long to walk is refused as well.\n */\n allowDisabledInRange?: boolean;\n /** Day the week starts on (0 = Sunday). */\n firstDayOfWeek?: DayOfWeek;\n /** Override the 7 day-name labels (in calendar order, post-rotation). */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months in the grid. */\n nearbyMonthDays?: boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /**\n * Optional translatable string overrides. `rangeStart` and `rangeEnd` name\n * the two inputs and the range's ends in the calendar, `rangePreviewEnd`\n * describes the day a pending range would end on, `rangeSeparator` sits\n * between the inputs, and `chooseDateRange` names the launcher and the\n * popover.\n */\n labels?: PickerLabels;\n /**\n * Form field name. Two hidden inputs submit the range as `YYYY-MM-DD`,\n * named `name[start]` and `name[end]`, in every mode. The visible inputs\n * carry no name.\n */\n name?: string;\n /** Name of the hidden input carrying the start, in place of `name[start]`. */\n startName?: string;\n /** Name of the hidden input carrying the end, in place of `name[end]`. */\n endName?: string;\n /** Form id the hidden inputs belong to. */\n form?: string;\n /**\n * Mark both visible inputs required, so a form won't submit with either\n * end empty. An `inline` calendar has no visible input, so it is not\n * checked there.\n */\n required?: boolean;\n /** Id of the start input. The end input takes `${id}-end`. */\n id?: string;\n}\n\n/**\n * Raw DateRangeInput: the two inputs and the popover calendar without\n * Field/Control wrapping. Use `DateRangeInput` for the convenience wrapper.\n * Composed in a labeled `Field`, its `role=\"group\"` root points\n * `aria-labelledby` at that `Field`'s label, `inline` too, as the wrapper's\n * does, and each input keeps its own name. An `aria-label` or\n * `aria-labelledby` you give it wins over the label, and an `aria-labelledby`\n * key counts even when undefined, since it is spread over the group's own.\n *\n * @function\n * @param {DateRangeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateRangeInputBase = forwardRef<\n HTMLInputElement,\n DateRangeInputBaseProps\n>((props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled,\n readOnly,\n placeholder,\n format,\n parse,\n locale,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = true,\n position = 'bottom-left',\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n allowDisabledInRange = false,\n firstDayOfWeek = 0,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n labels,\n name,\n startName,\n endName,\n form,\n required,\n id,\n className,\n onFocus,\n onFocusCapture,\n ...rest\n } = props;\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n\n const t = mergeLabels(labels);\n const resolvedFormat = format ?? DEFAULT_DATE_FORMAT;\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<DateRangeValue>(\n defaultValue ?? EMPTY_RANGE\n );\n const range = isControlled ? controlledValue : internalValue;\n const [start, end] = range;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const [focusedDate, setFocusedDate] = useState<Date>(() =>\n clampDate(start ?? end ?? new Date(), lowerBound, max)\n );\n // Re-clamp the focused day if the bounds change after mount, so the\n // calendar never shows a month outside them.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n\n const [open, setOpenState] = useState(false);\n const [startText, setStartText] = useState(() =>\n start ? formatDate(start, resolvedFormat, locale) : ''\n );\n const [endText, setEndText] = useState(() =>\n end ? formatDate(end, resolvedFormat, locale) : ''\n );\n // Each input shows its end of the range as it changes from outside.\n useEffect(() => {\n setStartText(start ? formatDate(start, resolvedFormat, locale) : '');\n }, [start, resolvedFormat, locale]);\n useEffect(() => {\n setEndText(end ? formatDate(end, resolvedFormat, locale) : '');\n }, [end, resolvedFormat, locale]);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const startRef = useRef<HTMLInputElement>(null);\n const endRef = useRef<HTMLInputElement>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n // Two inputs can't share a labeled Field's `for`, so inside one the group\n // points `aria-labelledby` at that Field's label, as `DateRangeInput`\n // does, in every mode. A name the caller gave the group wins, and so does\n // the `aria-labelledby` that wrapper always passes, so it decides there.\n const { ariaLabelledBy } = useAutoLabelledBy({\n label: undefined,\n rendersLabel: false,\n callerProps: rest,\n });\n\n const { shouldUseNative } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n const useNative = !inline && shouldUseNative;\n\n // The root borrows DateInput's container class, which places the launcher\n // and sizes a Control's icons around the field.\n const containerClass = usePrefixedClassNames(\n 'daterangeinput',\n 'dateinput-container'\n );\n const fieldClass = usePrefixedClassNames('input', 'daterangeinput-field', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n 'is-disabled': disabled,\n });\n const inputClass = usePrefixedClassNames('daterangeinput-input');\n const separatorClass = usePrefixedClassNames('daterangeinput-separator');\n const triggerClass = usePrefixedClassNames('dateinput-trigger');\n\n // What the latest request asked for, so a second request in the same event\n // sees it before React renders. The callbacks fire here rather than in a\n // state updater, which StrictMode calls twice.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) onOpen?.();\n else onClose?.();\n },\n [onOpen, onClose]\n );\n\n // Focus that moves inside the field, from one input to the other or from\n // the launcher, is not focus arriving, so it opens nothing. Set as the\n // focus is captured on the way in, and cleared once the input has handled\n // it, so a click that follows still opens the popover.\n const focusFromInsideRef = useRef(false);\n const handleFocusCapture = (e: React.FocusEvent<HTMLDivElement>) => {\n const from = e.relatedTarget as Node | null;\n focusFromInsideRef.current = !!from && e.currentTarget.contains(from);\n onFocusCapture?.(e);\n };\n const handleFocus = (e: React.FocusEvent<HTMLDivElement>) => {\n focusFromInsideRef.current = false;\n onFocus?.(e);\n };\n const requestOpen = useCallback(\n (next: boolean) => {\n if (next && focusFromInsideRef.current) return;\n setOpen(next);\n },\n [setOpen]\n );\n\n const commitRange = useCallback(\n (next: DateRangeValue) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n const constraints = useMemo(\n () => ({ shouldDisableDate, unselectableDates }),\n [shouldDisableDate, unselectableDates]\n );\n // A day the calendar disables: shouldDisableDate or unselectableDates.\n // Typing and the native inputs check the bounds alongside it.\n const isBlockedDay = useCallback(\n (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d)),\n [shouldDisableDate, unselectableDates]\n );\n // An end the range can take: it is not disabled, and it closes a range\n // from the start, which it can't when it comes first or, unless allowed,\n // reaches over a disabled day.\n const isBlockedEnd = useCallback(\n (d: Date) =>\n isBlockedDay(d) ||\n (!!start && !canCloseRange(start, d, constraints, allowDisabledInRange)),\n [isBlockedDay, start, constraints, allowDisabledInRange]\n );\n\n // A new start keeps the end only while the two still make a range, so a\n // start moved past the end, or over a disabled day before it, clears it.\n const commitStart = useCallback(\n (next: Date | null) => {\n const keepsEnd =\n !next ||\n !end ||\n canCloseRange(next, end, constraints, allowDisabledInRange);\n commitRange([next, keepsEnd ? end : null]);\n if (next) setFocusedDate(next);\n },\n [end, constraints, allowDisabledInRange, commitRange]\n );\n // Every digit typed into the start commits, so a start passes through\n // values on its way to the one being typed. The first digits of a year make\n // a start centuries back, which can't keep the end once a disabled day may\n // lie between. Such a value waits for the segment's next digit rather than\n // clearing an end the finished start may keep.\n const startCostsEnd = useCallback(\n (d: Date) =>\n !!end && !canCloseRange(d, end, constraints, allowDisabledInRange),\n [end, constraints, allowDisabledInRange]\n );\n const commitEnd = useCallback(\n (next: Date | null) => {\n commitRange([start, next]);\n if (next) setFocusedDate(next);\n },\n [start, commitRange]\n );\n\n const handleRangeSelect = useCallback(\n (from: Date, to: Date) => {\n commitRange([from, to]);\n setFocusedDate(to);\n if (closeOnSelect) setOpen(false);\n },\n [commitRange, closeOnSelect, setOpen]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseDate(trimmed, fmt ?? DEFAULT_DATE_FORMAT, locale);\n },\n [parse, format, locale]\n );\n\n // Typing into an empty end starts from the start, so only what differs\n // needs typing; an empty start starts from today.\n const makeEndBase = useCallback(\n () => (start ? startOfDay(start) : today()),\n [start]\n );\n\n // Where focus goes back as the popover closes: the input focused last,\n // which is the one that opened it unless the launcher did, or the start\n // input before either has had focus.\n const openerRef = useRef<HTMLInputElement | null>(null);\n const restoreFocusRef = useMemo(\n () => ({\n get current() {\n return openerRef.current ?? startRef.current;\n },\n }),\n []\n );\n\n const shared = {\n format: resolvedFormat,\n formatFn: formatDate,\n tryParse,\n locale,\n min: lowerBound,\n max,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen: requestOpen,\n };\n // Each input is its own picker field. Its blur counts focus leaving it,\n // even for the other input, so text typed into one is read as focus moves\n // to the other.\n const { inputHandlers: startHandlers } = useSegmentedEntry({\n ...shared,\n value: start,\n commitValue: commitStart,\n text: startText,\n setText: setStartText,\n makeBaseDate: today,\n isBlocked: isBlockedDay,\n isUnfinishedBlocked: startCostsEnd,\n inputRef: startRef,\n containerRef: startRef,\n onFocus: () => {\n openerRef.current = startRef.current;\n },\n });\n const { inputHandlers: endHandlers } = useSegmentedEntry({\n ...shared,\n value: end,\n commitValue: commitEnd,\n text: endText,\n setText: setEndText,\n makeBaseDate: makeEndBase,\n isBlocked: isBlockedEnd,\n inputRef: endRef,\n containerRef: endRef,\n onFocus: () => {\n openerRef.current = endRef.current;\n },\n });\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (startRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref]\n );\n\n const handlePopoverClose = useCallback(() => setOpen(false), [setOpen]);\n\n const startField = startName ?? (name ? `${name}[start]` : undefined);\n const endField = endName ?? (name ? `${name}[end]` : undefined);\n const hiddenInputs = (\n <>\n {startField && (\n <input\n type=\"hidden\"\n name={startField}\n form={form}\n value={isoDay(start)}\n />\n )}\n {endField && (\n <input type=\"hidden\" name={endField} form={form} value={isoDay(end)} />\n )}\n </>\n );\n\n const separator = (\n <span className={separatorClass} aria-hidden=\"true\">\n {t.rangeSeparator}\n </span>\n );\n\n // Native mobile path: two <input type=\"date\">s, held to the same rules as\n // typing. A change the rules refuse leaves the input showing the range.\n if (useNative) {\n const nativeChange =\n (commit: (d: Date | null) => void, isBlocked: (d: Date) => boolean) =>\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // An empty value is the end cleared. A date input gives nothing else\n // that doesn't read as a date.\n const parsed = fromIsoValue(e.target.value, 'day');\n if (!parsed) commit(null);\n else if (isWithin(parsed, lowerBound, max) && !isBlocked(parsed)) {\n commit(parsed);\n }\n };\n const minIso = min ? isoDay(lowerBound) : undefined;\n const maxIso = max ? isoDay(max) : undefined;\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={onFocus}\n onFocusCapture={onFocusCapture}\n >\n <div className={fieldClass}>\n <input\n ref={combinedRef}\n type=\"date\"\n id={id}\n aria-label={t.rangeStart}\n className={inputClass}\n value={isoDay(start)}\n onChange={nativeChange(commitStart, isBlockedDay)}\n min={minIso}\n max={maxIso}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n />\n {separator}\n <input\n ref={endRef}\n type=\"date\"\n id={id ? `${id}-end` : undefined}\n aria-label={t.rangeEnd}\n className={inputClass}\n value={isoDay(end)}\n onChange={nativeChange(commitEnd, isBlockedEnd)}\n min={start ? isoDay(start) : minIso}\n max={maxIso}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n />\n </div>\n {hiddenInputs}\n </div>\n );\n }\n\n const calendar = (\n <Calendar\n range={range}\n onRangeSelect={handleRangeSelect}\n allowDisabledInRange={allowDisabledInRange}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n // The popover panel takes `popoverId`, so the calendar inside it takes\n // one of its own. Inline there is no panel.\n id={inline ? popoverId : `${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n );\n\n if (inline) {\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={onFocus}\n onFocusCapture={onFocusCapture}\n >\n {calendar}\n {hiddenInputs}\n </div>\n );\n }\n\n const canOpen = !!popover && !disabled && !readOnly;\n const inputReadOnly = !!readOnly || !editable;\n\n // The field reads as one text box, so a press on it that misses both\n // inputs, on its padding, the gap or the separator, goes to the nearer\n // input and does what a press on that input does.\n const handleFieldMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n const startInput = startRef.current as HTMLInputElement;\n const endInput = endRef.current as HTMLInputElement;\n if (disabled || e.button !== 0) return;\n if (e.target === startInput || e.target === endInput) return;\n e.preventDefault();\n const middle =\n (startInput.getBoundingClientRect().right +\n endInput.getBoundingClientRect().left) /\n 2;\n (e.clientX < middle ? startInput : endInput).focus();\n if (openOnFocus && canOpen) requestOpen(true);\n };\n const comboboxProps = {\n type: 'text',\n role: 'combobox',\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': open,\n 'aria-controls': popoverId,\n autoComplete: 'off',\n className: inputClass,\n placeholder,\n disabled,\n readOnly: inputReadOnly,\n required,\n };\n\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={handleFocus}\n onFocusCapture={handleFocusCapture}\n >\n <div className={fieldClass} onMouseDown={handleFieldMouseDown}>\n <input\n {...comboboxProps}\n ref={combinedRef}\n id={id}\n aria-label={t.rangeStart}\n value={startText}\n {...startHandlers}\n />\n {separator}\n <input\n {...comboboxProps}\n ref={endRef}\n id={id ? `${id}-end` : undefined}\n aria-label={t.rangeEnd}\n value={endText}\n {...endHandlers}\n />\n </div>\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n // Disabled whenever the popover can't open, so a click can.\n onClick={() => setOpen(!open)}\n disabled={!canOpen}\n aria-label={t.chooseDateRange}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n isOpen={open}\n onClose={handlePopoverClose}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={t.chooseDateRange}\n id={popoverId}\n restoreFocusRef={restoreFocusRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {calendar}\n </PickerPopover>\n )}\n {hiddenInputs}\n </div>\n );\n});\n\nDateRangeInputBase.displayName = 'DateRangeInputBase';\n\nexport default DateRangeInputBase;\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,WAAW,GAAmB,CAAC,IAAI,EAAE,IAAI,CAAC;AAEhD;AACA,MAAM,MAAM,GAAG,CAAC,CAAc,MAAc,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AAE1E;AACA,MAAM,KAAK,GAAG,MAAY,UAAU,CAAC,IAAI,IAAI,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,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,IAAI,CAAC,EAC7B,QAAQ,EAAE,CAAC,OAAO,gBACN,CAAC,CAAC,eAAe,EAAA,eAAA,EACf,QAAQ,EAAA,eAAA,EACP,SAAS,EAAA,eAAA,EACT,IAAI,EACnB,QAAQ,EAAE,OAAO,GAAG,CAAC,GAAG,EAAE,YAE1BA,GAAA,CAAC,IAAI,EAAA,EAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,EAAA,CAAI,EAAA,CACpC,CACV,EACA,OAAO,KACNA,GAAA,CAAC,aAAa,IACZ,MAAM,EAAE,IAAI,EACZ,OAAO,EAAE,kBAAkB,EAC3B,SAAS,EAAE,YAAY,EACvB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,CAAC,CAAC,eAAe,EAC5B,EAAE,EAAE,SAAS,EACb,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,qBAAqB,EAAA,QAAA,EAE1C,QAAQ,EAAA,CACK,CACjB,EACA,YAAY,CAAA,EAAA,CACT;AAEV,CAAC;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;"}
1
+ {"version":3,"file":"DateRangeInputBase.js","sources":["../../../src/form/DateRangeInputBase.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n DateRangeValue,\n DayOfWeek,\n PickerLabels,\n PickerPosition,\n mergeLabels,\n} from './_pickerInternals/pickerTypes';\nimport {\n DEFAULT_DATE_FORMAT,\n DateFormatOption,\n formatDate,\n fromIsoValue,\n parseDate,\n toIsoValue,\n} from './_pickerInternals/formatters';\nimport {\n canCloseRange,\n clampDate,\n floorMin,\n isSameDay,\n isWithin,\n startOfDay,\n} from './_pickerInternals/dateUtils';\nimport { Calendar, CALENDAR_FOCUSED_CELL } from './_pickerInternals/Calendar';\nimport { PickerPopover } from './_pickerInternals/PickerPopover';\nimport { useNativeMobilePicker } from './_pickerInternals/useNativeMobilePicker';\nimport { useSegmentedEntry } from './_pickerInternals/useSegmentedEntry';\nimport { useControlLoading } from './controlLoading';\nimport { useAutoLabelledBy } from './useAutoLabelId';\nimport { Icon } from '../elements/Icon';\n\nexport type { DateRangeValue };\n\nconst EMPTY_RANGE: DateRangeValue = [null, null];\n\n/** A range's end as the form and the native inputs carry it. */\nconst isoDay = (d: Date | null): string => (d ? toIsoValue(d, 'day') : '');\n\n/** Today at local midnight, where typing into an empty end starts. */\nconst today = (): Date => startOfDay(new Date());\n\n/**\n * Props for the raw DateRangeInput base. Use the higher-level\n * `DateRangeInput` for Field/Control composition; `DateRangeInputBase` is the\n * two inputs and the popover only.\n */\nexport interface DateRangeInputBaseProps\n extends\n Omit<\n React.HTMLAttributes<HTMLDivElement>,\n 'defaultValue' | 'onChange' | 'color' | 'placeholder' | 'popover'\n >,\n Omit<BulmaClassesProps, 'color'> {\n /**\n * Controlled range, start first. Either end may be `null`, and\n * `[null, null]` is empty.\n */\n value?: DateRangeValue;\n /** Initial range for uncontrolled usage. */\n defaultValue?: DateRangeValue;\n /**\n * Fired when the range changes, with the start first. Typing commits one\n * end at a time, so a range half typed arrives as `[start, null]`. The\n * calendar commits only a finished range: its first pick marks the start\n * inside the calendar and its second commits both ends in one call. The\n * range stays ordered, so the end is never before the start.\n */\n onChange?: (range: DateRangeValue) => void;\n /** Fired when the popover opens. */\n onOpen?: () => void;\n /** Fired when the popover closes. */\n onClose?: () => void;\n /**\n * Earliest selectable date, for either end. A `min` before year 1 is raised\n * to 1 January of year 1, where the range starts without one too.\n */\n min?: Date;\n /** Latest selectable date, for either end. */\n max?: Date;\n /** Disable both inputs and the launcher. */\n disabled?: boolean;\n /** Make both inputs read-only and keep the popover closed. */\n readOnly?: boolean;\n /** Placeholder text, shown in both inputs while they are empty. */\n placeholder?: string;\n /**\n * Token format string or `Intl.DateTimeFormat` options, used by both\n * inputs.\n * @defaultValue 'YYYY-MM-DD'\n */\n format?: DateFormatOption;\n /**\n * Custom parser (use when `format` is `Intl.DateTimeFormatOptions`).\n * Enter and leaving an input call it only if the user changed its text.\n */\n parse?: (s: string) => Date | null;\n /** BCP-47 locale tag for day/month names and Intl formatting. */\n locale?: string;\n /**\n * Render the calendar inline, with no inputs and no popover. The hidden\n * form inputs still carry the range.\n */\n inline?: boolean;\n /**\n * Use two native `<input type=\"date\">`s on coarse-pointer, small-viewport\n * devices (`'auto'`), always (`true`) or never (`false`). The end input's\n * `min` follows the start, and a change goes through the same rules as\n * typing.\n */\n mobileNative?: boolean | 'auto';\n /** Allow segmented keyboard typing in both inputs. `false` makes the field picker-only. */\n editable?: boolean;\n /** Whether the calendar popover exists. `false` makes the field input-only. */\n popover?: boolean;\n /**\n * Open the popover when focus arrives in the field. Moving focus between\n * the two inputs, or back from the launcher, leaves it closed, and so does\n * the focus a closing popover hands back. A click on either input opens it.\n * With it off, the launcher or Alt+ArrowDown opens it.\n */\n openOnFocus?: boolean;\n /**\n * Close the popover once the range is picked. The first pick, which only\n * marks the start, never closes it.\n */\n closeOnSelect?: boolean;\n /** Popover anchor position relative to the field. */\n position?: PickerPosition;\n /**\n * Render the popover through a portal, into the `portalContainer` a\n * `ConfigProvider` sets, `document.body` by default.\n */\n appendToBody?: boolean;\n /**\n * Bulma color modifier for the field, also carried by the calendar, where it\n * colors the range's ends and the band between them.\n */\n color?: 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n /** Size variant. */\n size?: 'small' | 'medium' | 'large';\n /** Render the field with rounded corners. */\n isRounded?: boolean;\n /**\n * Predicate to disable specific dates (e.g. weekends). A disabled day can\n * be neither end, typing rejects it, and a range can't include one unless\n * `allowDisabledInRange` is set.\n */\n shouldDisableDate?: (d: Date) => boolean;\n /** Convenience array of disabled dates; merged with `shouldDisableDate`. Matched by calendar day. */\n unselectableDates?: Date[];\n /**\n * Let a range include days that `shouldDisableDate` or `unselectableDates`\n * disable, such as a stay over a night with no check-ins. Its ends still\n * can't be such days. Off, a pick in the calendar past a disabled day\n * starts a new range there, typing refuses an end past one, and a start\n * typed with one before the end clears the end. Finding one walks the days\n * between, so off, a span too long to walk is refused as well.\n */\n allowDisabledInRange?: boolean;\n /** Day the week starts on (0 = Sunday). */\n firstDayOfWeek?: DayOfWeek;\n /** Override the 7 day-name labels (in calendar order, post-rotation). */\n dayNames?: string[];\n /** Override the 12 month-name labels. */\n monthNames?: string[];\n /** Show dimmed dates from adjacent months in the grid. */\n nearbyMonthDays?: boolean;\n /** Decorative left icon glyph for the wrapping `Control` (shown by default). Set `''` to hide. */\n iconLeftName?: string;\n /**\n * Show a clickable launcher button on the right that toggles the popover.\n * Hidden by default while a `Control` it sits in shows its `isLoading`\n * spinner, which shares that right edge.\n * @defaultValue true\n */\n triggerIcon?: boolean;\n /** Glyph for the right launcher button. */\n triggerIconName?: string;\n /**\n * Optional translatable string overrides. `rangeStart` and `rangeEnd` name\n * the two inputs and the range's ends in the calendar, `rangePreviewEnd`\n * describes the day a pending range would end on, `rangeSeparator` sits\n * between the inputs, and `chooseDateRange` names the launcher and the\n * popover.\n */\n labels?: PickerLabels;\n /**\n * Form field name. Two hidden inputs submit the range as `YYYY-MM-DD`,\n * named `name[start]` and `name[end]`, in every mode. The visible inputs\n * carry no name.\n */\n name?: string;\n /** Name of the hidden input carrying the start, in place of `name[start]`. */\n startName?: string;\n /** Name of the hidden input carrying the end, in place of `name[end]`. */\n endName?: string;\n /** Form id the hidden inputs belong to. */\n form?: string;\n /**\n * Mark both visible inputs required, so a form won't submit with either\n * end empty. An `inline` calendar has no visible input, so it is not\n * checked there.\n */\n required?: boolean;\n /** Id of the start input. The end input takes `${id}-end`. */\n id?: string;\n}\n\n/**\n * Raw DateRangeInput: the two inputs and the popover calendar without\n * Field/Control wrapping. Use `DateRangeInput` for the convenience wrapper.\n * Composed in a labeled `Field`, its `role=\"group\"` root points\n * `aria-labelledby` at that `Field`'s label, `inline` too, as the wrapper's\n * does, and each input keeps its own name. An `aria-label` or\n * `aria-labelledby` you give it wins over the label, and an `aria-labelledby`\n * key counts even when undefined, since it is spread over the group's own.\n *\n * @function\n * @param {DateRangeInputBaseProps} props\n * @returns {JSX.Element}\n */\nexport const DateRangeInputBase = forwardRef<\n HTMLInputElement,\n DateRangeInputBaseProps\n>((props, ref) => {\n const {\n value: controlledValue,\n defaultValue,\n onChange,\n onOpen,\n onClose,\n min,\n max,\n disabled,\n readOnly,\n placeholder,\n format,\n parse,\n locale,\n inline = false,\n mobileNative = 'auto',\n editable = true,\n popover = true,\n openOnFocus = true,\n closeOnSelect = true,\n position = 'bottom-left',\n appendToBody = false,\n color,\n size,\n isRounded,\n shouldDisableDate,\n unselectableDates,\n allowDisabledInRange = false,\n firstDayOfWeek = 0,\n dayNames,\n monthNames,\n nearbyMonthDays = true,\n iconLeftName: _iconLeftName,\n triggerIcon: triggerIconProp,\n triggerIconName = 'chevron-down',\n labels,\n name,\n startName,\n endName,\n form,\n required,\n id,\n className,\n onFocus,\n onFocusCapture,\n ...rest\n } = props;\n // The launcher gives way to the loading spinner of a Control this sits in.\n const controlLoading = useControlLoading();\n const triggerIcon = triggerIconProp ?? !controlLoading;\n\n const t = mergeLabels(labels);\n const resolvedFormat = format ?? DEFAULT_DATE_FORMAT;\n\n const isControlled = controlledValue !== undefined;\n const [internalValue, setInternalValue] = useState<DateRangeValue>(\n defaultValue ?? EMPTY_RANGE\n );\n const range = isControlled ? controlledValue : internalValue;\n const [start, end] = range;\n\n // Nothing before year 1 is in range, as in HTML's date inputs.\n const lowerBound = useMemo(() => floorMin(min), [min]);\n\n const [focusedDate, setFocusedDate] = useState<Date>(() =>\n clampDate(start ?? end ?? new Date(), lowerBound, max)\n );\n // Re-clamp the focused day if the bounds change after mount, so the\n // calendar never shows a month outside them.\n useEffect(() => {\n setFocusedDate(prev => clampDate(prev, lowerBound, max));\n }, [lowerBound, max]);\n\n const [open, setOpenState] = useState(false);\n const [startText, setStartText] = useState(() =>\n start ? formatDate(start, resolvedFormat, locale) : ''\n );\n const [endText, setEndText] = useState(() =>\n end ? formatDate(end, resolvedFormat, locale) : ''\n );\n // Each input shows its end of the range as it changes from outside.\n useEffect(() => {\n setStartText(start ? formatDate(start, resolvedFormat, locale) : '');\n }, [start, resolvedFormat, locale]);\n useEffect(() => {\n setEndText(end ? formatDate(end, resolvedFormat, locale) : '');\n }, [end, resolvedFormat, locale]);\n\n const containerRef = useRef<HTMLDivElement>(null);\n const startRef = useRef<HTMLInputElement>(null);\n const endRef = useRef<HTMLInputElement>(null);\n const reactId = useId();\n const popoverId = id ? `${id}-popover` : `picker-${reactId}`;\n\n const { bulmaHelperClasses, rest: cleanRest } = useBulmaClasses(rest);\n // Two inputs can't share a labeled Field's `for`, so inside one the group\n // points `aria-labelledby` at that Field's label, as `DateRangeInput`\n // does, in every mode. A name the caller gave the group wins, and so does\n // the `aria-labelledby` that wrapper always passes, so it decides there.\n const { ariaLabelledBy } = useAutoLabelledBy({\n label: undefined,\n rendersLabel: false,\n callerProps: rest,\n });\n\n const { shouldUseNative } = useNativeMobilePicker({\n force: mobileNative === 'auto' ? undefined : mobileNative,\n });\n const useNative = !inline && shouldUseNative;\n\n // The root borrows DateInput's container class, which places the launcher\n // and sizes a Control's icons around the field.\n const containerClass = usePrefixedClassNames(\n 'daterangeinput',\n 'dateinput-container'\n );\n const fieldClass = usePrefixedClassNames('input', 'daterangeinput-field', {\n [`is-${color}`]: !!color,\n [`is-${size}`]: !!size,\n 'is-rounded': isRounded,\n 'is-disabled': disabled,\n });\n const inputClass = usePrefixedClassNames('daterangeinput-input');\n const separatorClass = usePrefixedClassNames('daterangeinput-separator');\n const triggerClass = usePrefixedClassNames('dateinput-trigger');\n\n // What the latest request asked for, so a second request in the same event\n // sees it before React renders. The callbacks fire here rather than in a\n // state updater, which StrictMode calls twice.\n const requestedOpenRef = useRef(false);\n const setOpen = useCallback(\n (next: boolean) => {\n if (requestedOpenRef.current === next) return;\n requestedOpenRef.current = next;\n setOpenState(next);\n if (next) onOpen?.();\n else onClose?.();\n },\n [onOpen, onClose]\n );\n\n // Focus that moves inside the field, from one input to the other or from\n // the launcher, is not focus arriving, so it opens nothing. Set as the\n // focus is captured on the way in, and cleared once the input has handled\n // it, so a click that follows still opens the popover.\n const focusFromInsideRef = useRef(false);\n const handleFocusCapture = (e: React.FocusEvent<HTMLDivElement>) => {\n const from = e.relatedTarget as Node | null;\n focusFromInsideRef.current = !!from && e.currentTarget.contains(from);\n onFocusCapture?.(e);\n };\n const handleFocus = (e: React.FocusEvent<HTMLDivElement>) => {\n focusFromInsideRef.current = false;\n onFocus?.(e);\n };\n const requestOpen = useCallback(\n (next: boolean) => {\n if (next && focusFromInsideRef.current) return;\n setOpen(next);\n },\n [setOpen]\n );\n\n const commitRange = useCallback(\n (next: DateRangeValue) => {\n if (!isControlled) setInternalValue(next);\n onChange?.(next);\n },\n [isControlled, onChange]\n );\n\n const constraints = useMemo(\n () => ({ shouldDisableDate, unselectableDates }),\n [shouldDisableDate, unselectableDates]\n );\n // A day the calendar disables: shouldDisableDate or unselectableDates.\n // Typing and the native inputs check the bounds alongside it.\n const isBlockedDay = useCallback(\n (d: Date) =>\n !!shouldDisableDate?.(d) ||\n !!unselectableDates?.some(u => isSameDay(u, d)),\n [shouldDisableDate, unselectableDates]\n );\n // An end the range can take: it is not disabled, and it closes a range\n // from the start, which it can't when it comes first or, unless allowed,\n // reaches over a disabled day.\n const isBlockedEnd = useCallback(\n (d: Date) =>\n isBlockedDay(d) ||\n (!!start && !canCloseRange(start, d, constraints, allowDisabledInRange)),\n [isBlockedDay, start, constraints, allowDisabledInRange]\n );\n\n // A new start keeps the end only while the two still make a range, so a\n // start moved past the end, or over a disabled day before it, clears it.\n const commitStart = useCallback(\n (next: Date | null) => {\n const keepsEnd =\n !next ||\n !end ||\n canCloseRange(next, end, constraints, allowDisabledInRange);\n commitRange([next, keepsEnd ? end : null]);\n if (next) setFocusedDate(next);\n },\n [end, constraints, allowDisabledInRange, commitRange]\n );\n // Every digit typed into the start commits, so a start passes through\n // values on its way to the one being typed. The first digits of a year make\n // a start centuries back, which can't keep the end once a disabled day may\n // lie between. Such a value waits for the segment's next digit rather than\n // clearing an end the finished start may keep.\n const startCostsEnd = useCallback(\n (d: Date) =>\n !!end && !canCloseRange(d, end, constraints, allowDisabledInRange),\n [end, constraints, allowDisabledInRange]\n );\n const commitEnd = useCallback(\n (next: Date | null) => {\n commitRange([start, next]);\n if (next) setFocusedDate(next);\n },\n [start, commitRange]\n );\n\n const handleRangeSelect = useCallback(\n (from: Date, to: Date) => {\n commitRange([from, to]);\n setFocusedDate(to);\n if (closeOnSelect) setOpen(false);\n },\n [commitRange, closeOnSelect, setOpen]\n );\n\n const tryParse = useCallback(\n (s: string): Date | null => {\n const trimmed = s.trim();\n if (!trimmed) return null;\n const fmt = typeof format === 'string' ? format : undefined;\n return parse\n ? parse(trimmed)\n : parseDate(trimmed, fmt ?? DEFAULT_DATE_FORMAT, locale);\n },\n [parse, format, locale]\n );\n\n // Typing into an empty end starts from the start, so only what differs\n // needs typing; an empty start starts from today.\n const makeEndBase = useCallback(\n () => (start ? startOfDay(start) : today()),\n [start]\n );\n\n // Where focus goes back as the popover closes: the input focused last,\n // which is the one that opened it unless the launcher did, or the start\n // input before either has had focus.\n const openerRef = useRef<HTMLInputElement | null>(null);\n const restoreFocusRef = useMemo(\n () => ({\n get current() {\n return openerRef.current ?? startRef.current;\n },\n }),\n []\n );\n\n const shared = {\n format: resolvedFormat,\n formatFn: formatDate,\n tryParse,\n locale,\n min: lowerBound,\n max,\n disabled,\n readOnly,\n editable,\n popover,\n openOnFocus,\n closeOnSelect,\n isOpen: open,\n setOpen: requestOpen,\n };\n // Each input is its own picker field. Its blur counts focus leaving it,\n // even for the other input, so text typed into one is read as focus moves\n // to the other.\n const { inputHandlers: startHandlers } = useSegmentedEntry({\n ...shared,\n value: start,\n commitValue: commitStart,\n text: startText,\n setText: setStartText,\n makeBaseDate: today,\n isBlocked: isBlockedDay,\n isUnfinishedBlocked: startCostsEnd,\n inputRef: startRef,\n containerRef: startRef,\n onFocus: () => {\n openerRef.current = startRef.current;\n },\n });\n const { inputHandlers: endHandlers } = useSegmentedEntry({\n ...shared,\n value: end,\n commitValue: commitEnd,\n text: endText,\n setText: setEndText,\n makeBaseDate: makeEndBase,\n isBlocked: isBlockedEnd,\n inputRef: endRef,\n containerRef: endRef,\n onFocus: () => {\n openerRef.current = endRef.current;\n },\n });\n\n const combinedRef = useCallback(\n (node: HTMLInputElement | null) => {\n (startRef as React.MutableRefObject<HTMLInputElement | null>).current =\n node;\n if (typeof ref === 'function') ref(node);\n else if (ref)\n (ref as React.MutableRefObject<HTMLInputElement | null>).current = node;\n },\n [ref]\n );\n\n const handlePopoverClose = useCallback(() => setOpen(false), [setOpen]);\n\n const startField = startName ?? (name ? `${name}[start]` : undefined);\n const endField = endName ?? (name ? `${name}[end]` : undefined);\n const hiddenInputs = (\n <>\n {startField && (\n <input\n type=\"hidden\"\n name={startField}\n form={form}\n value={isoDay(start)}\n />\n )}\n {endField && (\n <input type=\"hidden\" name={endField} form={form} value={isoDay(end)} />\n )}\n </>\n );\n\n const separator = (\n <span className={separatorClass} aria-hidden=\"true\">\n {t.rangeSeparator}\n </span>\n );\n\n // Native mobile path: two <input type=\"date\">s, held to the same rules as\n // typing. A change the rules refuse leaves the input showing the range.\n if (useNative) {\n const nativeChange =\n (commit: (d: Date | null) => void, isBlocked: (d: Date) => boolean) =>\n (e: React.ChangeEvent<HTMLInputElement>) => {\n // An empty value is the end cleared. A date input gives nothing else\n // that doesn't read as a date.\n const parsed = fromIsoValue(e.target.value, 'day');\n if (!parsed) commit(null);\n else if (isWithin(parsed, lowerBound, max) && !isBlocked(parsed)) {\n commit(parsed);\n }\n };\n const minIso = min ? isoDay(lowerBound) : undefined;\n const maxIso = max ? isoDay(max) : undefined;\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={onFocus}\n onFocusCapture={onFocusCapture}\n >\n <div className={fieldClass}>\n <input\n ref={combinedRef}\n type=\"date\"\n id={id}\n aria-label={t.rangeStart}\n className={inputClass}\n value={isoDay(start)}\n onChange={nativeChange(commitStart, isBlockedDay)}\n min={minIso}\n max={maxIso}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n />\n {separator}\n <input\n ref={endRef}\n type=\"date\"\n id={id ? `${id}-end` : undefined}\n aria-label={t.rangeEnd}\n className={inputClass}\n value={isoDay(end)}\n onChange={nativeChange(commitEnd, isBlockedEnd)}\n min={start ? isoDay(start) : minIso}\n max={maxIso}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n />\n </div>\n {hiddenInputs}\n </div>\n );\n }\n\n const calendar = (\n <Calendar\n range={range}\n onRangeSelect={handleRangeSelect}\n allowDisabledInRange={allowDisabledInRange}\n focusedDate={focusedDate}\n onFocusedDateChange={setFocusedDate}\n min={min}\n max={max}\n shouldDisableDate={shouldDisableDate}\n unselectableDates={unselectableDates}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n dayNames={dayNames}\n monthNames={monthNames}\n nearbyMonthDays={nearbyMonthDays}\n color={color}\n size={size}\n // The popover panel takes `popoverId`, so the calendar inside it takes\n // one of its own. Inline there is no panel.\n id={inline ? popoverId : `${popoverId}-cal`}\n autoFocusCell={open}\n labels={labels}\n />\n );\n\n if (inline) {\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={onFocus}\n onFocusCapture={onFocusCapture}\n >\n {calendar}\n {hiddenInputs}\n </div>\n );\n }\n\n const canOpen = !!popover && !disabled && !readOnly;\n const inputReadOnly = !!readOnly || !editable;\n\n // The field reads as one text box, so a press on it that misses both\n // inputs, on its padding, the gap or the separator, goes to the nearer\n // input and does what a press on that input does.\n const handleFieldMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {\n const startInput = startRef.current as HTMLInputElement;\n const endInput = endRef.current as HTMLInputElement;\n if (disabled || e.button !== 0) return;\n if (e.target === startInput || e.target === endInput) return;\n e.preventDefault();\n const middle =\n (startInput.getBoundingClientRect().right +\n endInput.getBoundingClientRect().left) /\n 2;\n (e.clientX < middle ? startInput : endInput).focus();\n if (openOnFocus && canOpen) requestOpen(true);\n };\n const comboboxProps = {\n type: 'text',\n role: 'combobox',\n 'aria-haspopup': 'dialog' as const,\n 'aria-expanded': open,\n 'aria-controls': popoverId,\n autoComplete: 'off',\n className: inputClass,\n placeholder,\n disabled,\n readOnly: inputReadOnly,\n required,\n };\n\n return (\n <div\n aria-labelledby={ariaLabelledBy}\n {...cleanRest}\n ref={containerRef}\n role=\"group\"\n className={classNames(containerClass, bulmaHelperClasses, className)}\n onFocus={handleFocus}\n onFocusCapture={handleFocusCapture}\n >\n <div className={fieldClass} onMouseDown={handleFieldMouseDown}>\n <input\n {...comboboxProps}\n ref={combinedRef}\n id={id}\n aria-label={t.rangeStart}\n value={startText}\n {...startHandlers}\n />\n {separator}\n <input\n {...comboboxProps}\n ref={endRef}\n id={id ? `${id}-end` : undefined}\n aria-label={t.rangeEnd}\n value={endText}\n {...endHandlers}\n />\n </div>\n {popover && triggerIcon && (\n <button\n type=\"button\"\n className={triggerClass}\n // Disabled whenever the popover can't open, so a click can.\n onClick={() => setOpen(!open)}\n disabled={!canOpen}\n aria-label={t.chooseDateRange}\n aria-haspopup=\"dialog\"\n aria-controls={popoverId}\n aria-expanded={open}\n tabIndex={canOpen ? 0 : -1}\n >\n <Icon name={triggerIconName} size={size} />\n </button>\n )}\n {popover && (\n <PickerPopover\n isOpen={open}\n onClose={handlePopoverClose}\n anchorRef={containerRef}\n position={position}\n appendToBody={appendToBody}\n ariaLabel={t.chooseDateRange}\n id={popoverId}\n restoreFocusRef={restoreFocusRef}\n initialFocusSelector={CALENDAR_FOCUSED_CELL}\n >\n {calendar}\n </PickerPopover>\n )}\n {hiddenInputs}\n </div>\n );\n});\n\nDateRangeInputBase.displayName = 'DateRangeInputBase';\n\nexport default DateRangeInputBase;\n"],"names":["_jsxs","_Fragment","_jsx"],"mappings":";;;;;;;;;;;;;;;;AA4CA,MAAM,WAAW,GAAmB,CAAC,IAAI,EAAE,IAAI,CAAC;AAEhD;AACA,MAAM,MAAM,GAAG,CAAC,CAAc,MAAc,CAAC,GAAG,UAAU,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AAE1E;AACA,MAAM,KAAK,GAAG,MAAY,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC;AAyKhD;;;;;;;;;;;;AAYG;AACI,MAAM,kBAAkB,GAAG,UAAU,CAG1C,CAAC,KAAK,EAAE,GAAG,KAAI;AACf,IAAA,MAAM,EACJ,KAAK,EAAE,eAAe,EACtB,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,OAAO,EACP,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,GAAG,KAAK,EACd,YAAY,GAAG,MAAM,EACrB,QAAQ,GAAG,IAAI,EACf,OAAO,GAAG,IAAI,EACd,WAAW,GAAG,IAAI,EAClB,aAAa,GAAG,IAAI,EACpB,QAAQ,GAAG,aAAa,EACxB,YAAY,GAAG,KAAK,EACpB,KAAK,EACL,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,GAAG,KAAK,EAC5B,cAAc,GAAG,CAAC,EAClB,QAAQ,EACR,UAAU,EACV,eAAe,GAAG,IAAI,EACtB,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,eAAe,GAAG,cAAc,EAChC,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,SAAS,EACT,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