@allxsmith/bestax-bulma 5.37.0 → 5.38.1

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 (90) hide show
  1. package/dist/bestax.css +1 -1
  2. package/dist/bestax.css.map +1 -1
  3. package/dist/esm/components/Card.js +2 -2
  4. package/dist/esm/components/Carousel.js +14 -6
  5. package/dist/esm/components/Carousel.js.map +1 -1
  6. package/dist/esm/components/Dropdown.js +7 -2
  7. package/dist/esm/components/Dropdown.js.map +1 -1
  8. package/dist/esm/components/Loading.js +7 -1
  9. package/dist/esm/components/Loading.js.map +1 -1
  10. package/dist/esm/components/Panel.js +34 -4
  11. package/dist/esm/components/Panel.js.map +1 -1
  12. package/dist/esm/components/Popover.js +7 -2
  13. package/dist/esm/components/Popover.js.map +1 -1
  14. package/dist/esm/components/Sidebar.js +46 -17
  15. package/dist/esm/components/Sidebar.js.map +1 -1
  16. package/dist/esm/elements/Button.js.map +1 -1
  17. package/dist/esm/elements/ToggleButton.js.map +1 -1
  18. package/dist/esm/form/Autocomplete.js +28 -18
  19. package/dist/esm/form/Autocomplete.js.map +1 -1
  20. package/dist/esm/form/Combobox.js +592 -0
  21. package/dist/esm/form/Combobox.js.map +1 -0
  22. package/dist/esm/form/Field.js +3 -3
  23. package/dist/esm/form/Field.js.map +1 -1
  24. package/dist/esm/form/_pickerInternals/PickerPopover.js +10 -5
  25. package/dist/esm/form/_pickerInternals/PickerPopover.js.map +1 -1
  26. package/dist/esm/form/useAutoLabelId.js.map +1 -1
  27. package/dist/esm/helpers/Theme.js.map +1 -1
  28. package/dist/esm/helpers/useAnchoredPosition.js +35 -6
  29. package/dist/esm/helpers/useAnchoredPosition.js.map +1 -1
  30. package/dist/esm/helpers/useComboboxEngine.js +331 -0
  31. package/dist/esm/helpers/useComboboxEngine.js.map +1 -0
  32. package/dist/esm/helpers/useFocusTrap.js +87 -49
  33. package/dist/esm/helpers/useFocusTrap.js.map +1 -1
  34. package/dist/esm/helpers/useInertSiblings.js +106 -0
  35. package/dist/esm/helpers/useInertSiblings.js.map +1 -0
  36. package/dist/esm/helpers/useTreeView.js +2 -2
  37. package/dist/esm/layout/Container.js +2 -2
  38. package/dist/esm/layout/Container.js.map +1 -1
  39. package/dist/esm/layout/Hero.js +6 -6
  40. package/dist/esm/layout/Hero.js.map +1 -1
  41. package/dist/extras.css +1 -1
  42. package/dist/extras.css.map +1 -1
  43. package/dist/index.cjs +1504 -351
  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/Loading.d.ts +16 -2
  48. package/dist/types/components/Panel.d.ts +45 -5
  49. package/dist/types/components/Sidebar.d.ts +17 -2
  50. package/dist/types/elements/Button.d.ts +2 -1
  51. package/dist/types/elements/ToggleButton.d.ts +3 -2
  52. package/dist/types/form/Combobox.d.ts +416 -0
  53. package/dist/types/form/Field.d.ts +5 -5
  54. package/dist/types/form/useAutoLabelId.d.ts +3 -2
  55. package/dist/types/helpers/Theme.d.ts +6 -0
  56. package/dist/types/helpers/useAnchoredPosition.d.ts +25 -2
  57. package/dist/types/helpers/useComboboxEngine.d.ts +111 -0
  58. package/dist/types/helpers/useFocusTrap.d.ts +15 -2
  59. package/dist/types/helpers/useInertSiblings.d.ts +30 -0
  60. package/dist/types/index.d.ts +1 -0
  61. package/dist/types/layout/Container.d.ts +9 -1
  62. package/dist/types/layout/Hero.d.ts +27 -2
  63. package/dist/types-cjs/components/Loading.d.ts +16 -2
  64. package/dist/types-cjs/components/Panel.d.ts +45 -5
  65. package/dist/types-cjs/components/Sidebar.d.ts +17 -2
  66. package/dist/types-cjs/elements/Button.d.ts +2 -1
  67. package/dist/types-cjs/elements/ToggleButton.d.ts +3 -2
  68. package/dist/types-cjs/form/Combobox.d.ts +416 -0
  69. package/dist/types-cjs/form/Field.d.ts +5 -5
  70. package/dist/types-cjs/form/useAutoLabelId.d.ts +3 -2
  71. package/dist/types-cjs/helpers/Theme.d.ts +6 -0
  72. package/dist/types-cjs/helpers/useAnchoredPosition.d.ts +25 -2
  73. package/dist/types-cjs/helpers/useComboboxEngine.d.ts +111 -0
  74. package/dist/types-cjs/helpers/useFocusTrap.d.ts +15 -2
  75. package/dist/types-cjs/helpers/useInertSiblings.d.ts +30 -0
  76. package/dist/types-cjs/index.d.ts +1 -0
  77. package/dist/types-cjs/layout/Container.d.ts +9 -1
  78. package/dist/types-cjs/layout/Hero.d.ts +27 -2
  79. package/dist/versions/bestax-no-dark-mode.css +1 -1
  80. package/dist/versions/bestax-no-dark-mode.css.map +1 -1
  81. package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
  82. package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
  83. package/dist/versions/bestax-no-helpers.css +1 -1
  84. package/dist/versions/bestax-no-helpers.css.map +1 -1
  85. package/dist/versions/bestax-prefixed.css +1 -1
  86. package/dist/versions/bestax-prefixed.css.map +1 -1
  87. package/package.json +1 -1
  88. package/src/scss/elements/_loader.scss +79 -0
  89. package/src/scss/form/_combobox.scss +323 -0
  90. package/src/scss/form/_index.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Carousel.js","sources":["../../../src/components/Carousel.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useState,\n useRef,\n useEffect,\n useCallback,\n Children,\n isValidElement,\n cloneElement,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useClassPrefix } from '../helpers/Config';\nimport { getActiveElementInTree } from '../helpers/shadowDom';\nimport { Icon } from '../elements/Icon';\nimport { Button } from '../elements/Button';\n\n/**\n * Props for the CarouselItem component.\n */\nexport interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether this item is active (set automatically). */\n active?: boolean;\n}\n\n/**\n * Individual carousel item/slide.\n *\n * @function\n * @param {CarouselItemProps} props - Props for the CarouselItem component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the carousel item element.\n * @returns {JSX.Element} The rendered carousel item.\n */\nexport const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(\n ({ active, className, children, ...props }, ref) => {\n const itemClasses = classNames(\n usePrefixedClassNames('carousel-item', { 'is-active': active }),\n className\n );\n\n return (\n <div ref={ref} className={itemClasses} {...props}>\n {children}\n </div>\n );\n }\n);\n\nCarouselItem.displayName = 'CarouselItem';\n\ntype IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';\n\n/**\n * Default SVG icon for the previous arrow button.\n *\n * @function\n * @returns {JSX.Element} The rendered SVG chevron-left icon.\n */\nconst DefaultPrevIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n);\n\n/**\n * Default SVG icon for the next arrow button.\n *\n * @function\n * @returns {JSX.Element} The rendered SVG chevron-right icon.\n */\nconst DefaultNextIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\n/**\n * Props for the Carousel component.\n * @extraProp {string} [className] - Additional CSS classes.\n * @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the carousel element.\n */\nexport interface CarouselProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'>,\n BulmaClassesProps {\n /**\n * Current active slide index (controlled).\n * @defaultValue 0\n */\n value?: number;\n /** Enable auto-play. */\n autoplay?: boolean;\n /** Auto-play interval in milliseconds. Default: 5000. */\n interval?: number;\n /** Pause auto-play on hover. Default: true. */\n pauseOnHover?: boolean;\n /** Loop back to first slide after last. Default: true. */\n repeat?: boolean;\n /** Enable drag/swipe navigation. Default: true. */\n hasDrag?: boolean;\n /**\n * Show navigation arrows. Default: true. They render `type=\"button\"`, so a\n * carousel inside a form is not submitted by moving between slides.\n */\n arrow?: boolean;\n /** Only show arrows on hover. */\n arrowHover?: boolean;\n /**\n * Show slide indicators. Default: true. They render `type=\"button\"`, so a\n * carousel inside a form is not submitted by picking a slide.\n */\n indicator?: boolean;\n /** Position indicators inside carousel. */\n indicatorInside?: boolean;\n /** Indicator position. Default: 'bottom'. */\n indicatorPosition?: 'bottom' | 'top';\n /** Indicator style. Default: 'dots'. */\n indicatorStyle?: 'circles' | 'dots' | 'lines' | 'bars';\n /** Icon name for the previous arrow button. */\n iconPrev?: string;\n /** Icon name for the next arrow button. */\n iconNext?: string;\n /** Icon library to use. */\n iconLibrary?: IconLibrary;\n /** Icon style variant (e.g., 'solid', 'outlined'). */\n iconVariant?: string;\n /** Icon size modifier. */\n iconSize?: 'small' | 'medium' | 'large';\n /** Additional icon modifiers. */\n iconFeatures?: string | string[];\n /** Show semi-transparent background on arrow buttons. Set to `false` for icon-only arrows. */\n arrowBackground?: boolean;\n /** Color theme for navigation arrows. */\n arrowColor?: 'light' | 'dark';\n /** Accessible label for the carousel region. Default: 'Image carousel'. */\n ariaLabel?: string;\n /** Callback when slide changes. */\n onChange?: (value: number) => void;\n /** CarouselItem children. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Carousel` component provides an image/content slider with navigation arrows and indicators.\n *\n * @function\n * @param {CarouselProps} props - Props for the Carousel component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the carousel element.\n * @returns {JSX.Element} The rendered carousel component.\n *\n * @example\n * // Basic carousel\n * <Carousel>\n * <CarouselItem>Slide 1</CarouselItem>\n * <CarouselItem>Slide 2</CarouselItem>\n * <CarouselItem>Slide 3</CarouselItem>\n * </Carousel>\n *\n * @example\n * // Auto-playing carousel\n * <Carousel autoplay interval={3000}>\n * <CarouselItem>\n * <img src=\"image1.jpg\" alt=\"Slide 1\" />\n * </CarouselItem>\n * <CarouselItem>\n * <img src=\"image2.jpg\" alt=\"Slide 2\" />\n * </CarouselItem>\n * </Carousel>\n */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(\n (\n {\n value: controlledValue,\n autoplay = false,\n interval = 5000,\n pauseOnHover = true,\n repeat = true,\n hasDrag = true,\n arrow = true,\n arrowHover = false,\n indicator = true,\n indicatorInside = false,\n indicatorPosition = 'bottom',\n indicatorStyle = 'dots',\n iconPrev,\n iconNext,\n iconLibrary,\n iconVariant,\n iconSize,\n iconFeatures,\n arrowBackground = true,\n arrowColor,\n ariaLabel = 'Image carousel',\n onChange,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const carouselRef = useRef<HTMLDivElement>(null);\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [internalValue, setInternalValue] = useState(0);\n const [isPaused, setIsPaused] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n const [dragStart, setDragStart] = useState(0);\n const [dragOffset, setDragOffset] = useState(0);\n const [isWrapping, setIsWrapping] = useState(false);\n const [displayIndex, setDisplayIndex] = useState(0);\n const [skipTransition, setSkipTransition] = useState(false);\n\n // Get valid children\n const items = Children.toArray(children).filter(isValidElement);\n const itemCount = items.length;\n\n // Use controlled or internal value\n const activeIndex =\n controlledValue !== undefined ? controlledValue : internalValue;\n\n // Sync displayIndex when controlled value changes externally. Intentional\n // external-prop sync that must not run mid-wrap animation; covered by tests\n // and certified in-browser.\n useEffect(() => {\n if (controlledValue !== undefined && !isWrapping) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing to controlled prop\n setDisplayIndex(controlledValue);\n }\n }, [controlledValue, isWrapping]);\n\n // Update active index\n const setActiveIndex = useCallback(\n (index: number, syncDisplay = true) => {\n let newIndex = index;\n\n if (repeat) {\n if (index < 0) {\n newIndex = itemCount - 1;\n } else if (index >= itemCount) {\n newIndex = 0;\n }\n } else {\n newIndex = Math.max(0, Math.min(index, itemCount - 1));\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newIndex);\n }\n if (syncDisplay) {\n setDisplayIndex(newIndex);\n }\n onChange?.(newIndex);\n },\n [controlledValue, itemCount, repeat, onChange]\n );\n\n // Navigation handlers\n const goToPrev = useCallback(() => {\n if (activeIndex === 0 && repeat && itemCount > 1) {\n // Animate to clone of last slide (position -1)\n setDisplayIndex(-1);\n setIsWrapping(true);\n } else {\n setActiveIndex(activeIndex - 1);\n }\n }, [activeIndex, repeat, itemCount, setActiveIndex]);\n\n const goToNext = useCallback(() => {\n if (activeIndex === itemCount - 1 && repeat && itemCount > 1) {\n // Animate to clone of first slide (position itemCount)\n setDisplayIndex(itemCount);\n setIsWrapping(true);\n } else {\n setActiveIndex(activeIndex + 1);\n }\n }, [activeIndex, itemCount, repeat, setActiveIndex]);\n\n const goToSlide = useCallback(\n (index: number) => {\n setIsWrapping(false);\n setActiveIndex(index);\n },\n [setActiveIndex]\n );\n\n // Auto-play\n useEffect(() => {\n if (!autoplay || isPaused || itemCount <= 1) return undefined;\n\n const timer = setInterval(() => {\n goToNext();\n }, interval);\n\n return () => clearInterval(timer);\n }, [autoplay, isPaused, interval, goToNext, itemCount]);\n\n // Pause on hover\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(true);\n }\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(false);\n }\n }, [pauseOnHover]);\n\n // Drag handlers\n const handleDragStart = useCallback(\n (clientX: number) => {\n if (!hasDrag) return;\n setIsDragging(true);\n setDragStart(clientX);\n setDragOffset(0);\n },\n [hasDrag]\n );\n\n const handleDragMove = useCallback(\n (clientX: number) => {\n if (!isDragging) return;\n setDragOffset(clientX - dragStart);\n },\n [isDragging, dragStart]\n );\n\n const handleDragEnd = useCallback(() => {\n if (!isDragging) return;\n setIsDragging(false);\n\n const threshold = 50;\n if (dragOffset < -threshold) {\n goToNext();\n } else if (dragOffset > threshold) {\n goToPrev();\n }\n\n setDragOffset(0);\n }, [isDragging, dragOffset, goToNext, goToPrev]);\n\n // Mouse events\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault();\n handleDragStart(e.clientX);\n },\n [handleDragStart]\n );\n\n const handleMouseMove = useCallback(\n (e: React.MouseEvent) => {\n handleDragMove(e.clientX);\n },\n [handleDragMove]\n );\n\n const handleMouseUp = useCallback(() => {\n handleDragEnd();\n }, [handleDragEnd]);\n\n // Touch events\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n handleDragStart(e.touches[0].clientX);\n },\n [handleDragStart]\n );\n\n const handleTouchMove = useCallback(\n (e: React.TouchEvent) => {\n handleDragMove(e.touches[0].clientX);\n },\n [handleDragMove]\n );\n\n const handleTouchEnd = useCallback(() => {\n handleDragEnd();\n }, [handleDragEnd]);\n\n // Keyboard navigation\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n const node = carouselRef.current;\n if (!node?.contains(getActiveElementInTree(node))) return;\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n goToPrev();\n break;\n case 'ArrowRight':\n e.preventDefault();\n goToNext();\n break;\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [goToPrev, goToNext]);\n\n // Handle wrap-around transition end\n const handleTransitionEnd = useCallback(() => {\n if (isWrapping) {\n // Skip transition for the instant snap\n setSkipTransition(true);\n setIsWrapping(false);\n\n if (displayIndex === itemCount) {\n // Was at clone of first slide, snap to real first slide\n setActiveIndex(0, false);\n setDisplayIndex(0);\n } else if (displayIndex === -1) {\n // Was at clone of last slide, snap to real last slide\n setActiveIndex(itemCount - 1, false);\n setDisplayIndex(itemCount - 1);\n }\n\n // Re-enable transition after the snap\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setSkipTransition(false);\n });\n });\n }\n }, [isWrapping, displayIndex, itemCount, setActiveIndex]);\n\n // Combined ref\n const combinedRef = useCallback(\n (node: HTMLDivElement | null) => {\n (carouselRef as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches by\n // running it instead of calling the ref with `null`; React 18 discards the\n // return value entirely. Returning it from here would be a React-19-only\n // contract, so we hold the cleanup and run it ourselves on detach — the\n // same shape as `Dropdown`, `Modal`, `Dialog`, `Sidebar` and `Toast`.\n // The form controls that merge a forwarded ref still discard the cleanup\n // and detach with `ref(null)`, so this is not yet library-wide — grep\n // `typeof ref === 'function'` for the current split.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n // Can navigate\n const canGoPrev = repeat || activeIndex > 0;\n const canGoNext = repeat || activeIndex < itemCount - 1;\n\n // Generate classes\n const carouselClasses = usePrefixedClassNames('carousel', {\n 'is-overlay': indicatorInside,\n 'has-arrow-hover': arrowHover,\n [`is-indicator-${indicatorStyle}`]: indicatorStyle !== 'dots',\n [`is-arrow-${arrowColor}`]: !!arrowColor,\n });\n const classPrefix = useClassPrefix();\n const carouselContainerClass = usePrefixedClassNames('carousel-container');\n const carouselSlidesClass = usePrefixedClassNames('carousel-slides');\n const carouselArrowPrevClass = usePrefixedClassNames(\n 'carousel-arrow',\n 'is-prev',\n { 'is-transparent': !arrowBackground }\n );\n const carouselArrowNextClass = usePrefixedClassNames(\n 'carousel-arrow',\n 'is-next',\n { 'is-transparent': !arrowBackground }\n );\n const carouselIndicatorClass = usePrefixedClassNames('carousel-indicator', {\n 'is-inside': indicatorInside,\n 'is-top': indicatorPosition === 'top',\n });\n\n const combinedClasses = classNames(\n carouselClasses,\n bulmaHelperClasses,\n className\n );\n\n // Render slides with active state (includes clones for infinite loop)\n const renderSlides = () => {\n const slides = items.map((item, index) => {\n if (isValidElement<CarouselItemProps>(item)) {\n return cloneElement(item, {\n key: index,\n active: index === activeIndex,\n });\n }\n return item;\n });\n\n // Add clones for seamless infinite loop when repeat is enabled\n if (repeat && itemCount > 1) {\n const lastItem = items[itemCount - 1];\n const firstItem = items[0];\n\n const lastClone = isValidElement<CarouselItemProps>(lastItem)\n ? cloneElement(lastItem as React.ReactElement<CarouselItemProps>, {\n key: 'clone-last',\n active: false,\n })\n : null;\n\n const firstClone = isValidElement<CarouselItemProps>(firstItem)\n ? cloneElement(firstItem as React.ReactElement<CarouselItemProps>, {\n key: 'clone-first',\n active: false,\n })\n : null;\n\n return [lastClone, ...slides, firstClone];\n }\n\n return slides;\n };\n\n return (\n <div\n ref={combinedRef}\n className={combinedClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel}\n {...rest}\n >\n <div\n ref={containerRef}\n className={carouselContainerClass}\n onMouseDown={hasDrag ? handleMouseDown : undefined}\n onMouseMove={hasDrag && isDragging ? handleMouseMove : undefined}\n onMouseUp={hasDrag ? handleMouseUp : undefined}\n onMouseLeave={hasDrag ? handleMouseUp : undefined}\n onTouchStart={hasDrag ? handleTouchStart : undefined}\n onTouchMove={hasDrag ? handleTouchMove : undefined}\n onTouchEnd={hasDrag ? handleTouchEnd : undefined}\n style={{\n transform: isDragging ? `translateX(${dragOffset}px)` : undefined,\n cursor: hasDrag ? (isDragging ? 'grabbing' : 'grab') : undefined,\n }}\n >\n <div\n className={carouselSlidesClass}\n style={{\n // When repeat is enabled, account for the prepended clone (+1 offset)\n transform: `translateX(-${(repeat && itemCount > 1 ? displayIndex + 1 : displayIndex) * 100}%)`,\n // Disable transition during drag or instant snap after wrap-around\n transition:\n isDragging || skipTransition\n ? 'none'\n : 'transform 0.3s ease-in-out',\n }}\n onTransitionEnd={handleTransitionEnd}\n >\n {renderSlides()}\n </div>\n {arrow && itemCount > 1 && (\n <>\n <Button\n type=\"button\"\n className={carouselArrowPrevClass}\n onClick={goToPrev}\n isDisabled={!canGoPrev}\n aria-label=\"Previous slide\"\n >\n {iconPrev ? (\n <Icon\n name={iconPrev}\n library={iconLibrary}\n variant={iconVariant}\n size={iconSize}\n features={iconFeatures}\n />\n ) : (\n <DefaultPrevIcon />\n )}\n </Button>\n <Button\n type=\"button\"\n className={carouselArrowNextClass}\n onClick={goToNext}\n isDisabled={!canGoNext}\n aria-label=\"Next slide\"\n >\n {iconNext ? (\n <Icon\n name={iconNext}\n library={iconLibrary}\n variant={iconVariant}\n size={iconSize}\n features={iconFeatures}\n />\n ) : (\n <DefaultNextIcon />\n )}\n </Button>\n </>\n )}\n </div>\n\n {indicator && itemCount > 1 && (\n <div className={carouselIndicatorClass} role=\"tablist\">\n {items.map((_, index) => (\n <Button\n key={index}\n type=\"button\"\n className={prefixedClassNames(classPrefix, 'indicator-item', {\n 'is-active': index === activeIndex,\n })}\n onClick={() => goToSlide(index)}\n role=\"tab\"\n aria-selected={index === activeIndex}\n aria-label={`Go to slide ${index + 1}`}\n />\n ))}\n </div>\n )}\n </div>\n );\n }\n);\n\nCarousel.displayName = 'Carousel';\n\nexport default Carousel;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AA6BA;;;;;;;AAOG;MACU,YAAY,GAAG,UAAU,CACpC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACjD,IAAA,MAAM,WAAW,GAAG,UAAU,CAC5B,qBAAqB,CAAC,eAAe,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EAC/D,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,KA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AAE,CAAC,SAAS,gBACX,YAAY,EAAA,QAAA,EAEtB,QAAQ,IACPA,GAAA,CAAC,IAAI,EAAA,EACH,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,YAAY,GACtB,KAEFA,IAAC,eAAe,EAAA,EAAA,CAAG,CACpB,EAAA,CACM,CAAA,EAAA,CACR,CACJ,CAAA,EAAA,CACG,EAEL,SAAS,IAAI,SAAS,GAAG,CAAC,KACzBA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,sBAAsB,EAAE,IAAI,EAAC,SAAS,EAAA,QAAA,EACnD,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,MAClBA,GAAA,CAAC,MAAM,EAAA,EAEL,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,kBAAkB,CAAC,WAAW,EAAE,gBAAgB,EAAE;wBAC3D,WAAW,EAAE,KAAK,KAAK,WAAW;AACnC,qBAAA,CAAC,EACF,OAAO,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,EAC/B,IAAI,EAAC,KAAK,EAAA,eAAA,EACK,KAAK,KAAK,WAAW,EAAA,YAAA,EACxB,CAAA,YAAA,EAAe,KAAK,GAAG,CAAC,CAAA,CAAE,EAAA,EARjC,KAAK,CASV,CACH,CAAC,EAAA,CACE,CACP,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
1
+ {"version":3,"file":"Carousel.js","sources":["../../../src/components/Carousel.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useState,\n useRef,\n useEffect,\n useCallback,\n Children,\n isValidElement,\n cloneElement,\n} from 'react';\nimport {\n classNames,\n prefixedClassNames,\n usePrefixedClassNames,\n} from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useClassPrefix } from '../helpers/Config';\nimport { getActiveElementInTree } from '../helpers/shadowDom';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { Icon } from '../elements/Icon';\nimport { Button } from '../elements/Button';\n\n/**\n * Props for the CarouselItem component.\n */\nexport interface CarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Whether this item is active (set automatically). */\n active?: boolean;\n}\n\n/**\n * Individual carousel item/slide.\n *\n * @function\n * @param {CarouselItemProps} props - Props for the CarouselItem component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the carousel item element.\n * @returns {JSX.Element} The rendered carousel item.\n */\nexport const CarouselItem = forwardRef<HTMLDivElement, CarouselItemProps>(\n ({ active, className, children, ...props }, ref) => {\n const itemClasses = classNames(\n usePrefixedClassNames('carousel-item', { 'is-active': active }),\n className\n );\n\n return (\n <div ref={ref} className={itemClasses} {...props}>\n {children}\n </div>\n );\n }\n);\n\nCarouselItem.displayName = 'CarouselItem';\n\ntype IconLibrary = 'fa' | 'mdi' | 'ion' | 'material-icons' | 'material-symbols';\n\n/**\n * Default SVG icon for the previous arrow button.\n *\n * @function\n * @returns {JSX.Element} The rendered SVG chevron-left icon.\n */\nconst DefaultPrevIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n);\n\n/**\n * Default SVG icon for the next arrow button.\n *\n * @function\n * @returns {JSX.Element} The rendered SVG chevron-right icon.\n */\nconst DefaultNextIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\n/**\n * Props for the Carousel component.\n * @extraProp {string} [className] - Additional CSS classes.\n * @extraProp {React.Ref<HTMLElement>} [ref] - Ref forwarded to the carousel element.\n */\nexport interface CarouselProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'color'>,\n BulmaClassesProps {\n /**\n * Current active slide index (controlled).\n * @defaultValue 0\n */\n value?: number;\n /** Enable auto-play. */\n autoplay?: boolean;\n /** Auto-play interval in milliseconds. Default: 5000. */\n interval?: number;\n /** Pause auto-play on hover. Default: true. */\n pauseOnHover?: boolean;\n /** Loop back to first slide after last. Default: true. */\n repeat?: boolean;\n /** Enable drag/swipe navigation. Default: true. */\n hasDrag?: boolean;\n /**\n * Show navigation arrows. Default: true. They render `type=\"button\"`, so a\n * carousel inside a form is not submitted by moving between slides.\n */\n arrow?: boolean;\n /** Only show arrows on hover. */\n arrowHover?: boolean;\n /**\n * Show slide indicators. Default: true. They render `type=\"button\"`, so a\n * carousel inside a form is not submitted by picking a slide.\n */\n indicator?: boolean;\n /** Position indicators inside carousel. */\n indicatorInside?: boolean;\n /** Indicator position. Default: 'bottom'. */\n indicatorPosition?: 'bottom' | 'top';\n /** Indicator style. Default: 'dots'. */\n indicatorStyle?: 'circles' | 'dots' | 'lines' | 'bars';\n /** Icon name for the previous arrow button. */\n iconPrev?: string;\n /** Icon name for the next arrow button. */\n iconNext?: string;\n /** Icon library to use. */\n iconLibrary?: IconLibrary;\n /** Icon style variant (e.g., 'solid', 'outlined'). */\n iconVariant?: string;\n /** Icon size modifier. */\n iconSize?: 'small' | 'medium' | 'large';\n /** Additional icon modifiers. */\n iconFeatures?: string | string[];\n /** Show semi-transparent background on arrow buttons. Set to `false` for icon-only arrows. */\n arrowBackground?: boolean;\n /** Color theme for navigation arrows. */\n arrowColor?: 'light' | 'dark';\n /** Accessible label for the carousel region. Default: 'Image carousel'. */\n ariaLabel?: string;\n /** Callback when slide changes. */\n onChange?: (value: number) => void;\n /** CarouselItem children. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Carousel` component provides an image/content slider with navigation arrows and indicators.\n *\n * @function\n * @param {CarouselProps} props - Props for the Carousel component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the carousel element.\n * @returns {JSX.Element} The rendered carousel component.\n *\n * @example\n * // Basic carousel\n * <Carousel>\n * <CarouselItem>Slide 1</CarouselItem>\n * <CarouselItem>Slide 2</CarouselItem>\n * <CarouselItem>Slide 3</CarouselItem>\n * </Carousel>\n *\n * @example\n * // Auto-playing carousel\n * <Carousel autoplay interval={3000}>\n * <CarouselItem>\n * <img src=\"image1.jpg\" alt=\"Slide 1\" />\n * </CarouselItem>\n * <CarouselItem>\n * <img src=\"image2.jpg\" alt=\"Slide 2\" />\n * </CarouselItem>\n * </Carousel>\n */\nexport const Carousel = forwardRef<HTMLDivElement, CarouselProps>(\n (\n {\n value: controlledValue,\n autoplay = false,\n interval = 5000,\n pauseOnHover = true,\n repeat = true,\n hasDrag = true,\n arrow = true,\n arrowHover = false,\n indicator = true,\n indicatorInside = false,\n indicatorPosition = 'bottom',\n indicatorStyle = 'dots',\n iconPrev,\n iconNext,\n iconLibrary,\n iconVariant,\n iconSize,\n iconFeatures,\n arrowBackground = true,\n arrowColor,\n ariaLabel = 'Image carousel',\n onChange,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n const carouselRef = useRef<HTMLDivElement>(null);\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [internalValue, setInternalValue] = useState(0);\n const [isPaused, setIsPaused] = useState(false);\n const [isDragging, setIsDragging] = useState(false);\n const [dragStart, setDragStart] = useState(0);\n const [dragOffset, setDragOffset] = useState(0);\n const [isWrapping, setIsWrapping] = useState(false);\n const [displayIndex, setDisplayIndex] = useState(0);\n const [skipTransition, setSkipTransition] = useState(false);\n\n // Get valid children\n const items = Children.toArray(children).filter(isValidElement);\n const itemCount = items.length;\n\n // Use controlled or internal value\n const activeIndex =\n controlledValue !== undefined ? controlledValue : internalValue;\n\n // Sync displayIndex when controlled value changes externally. Intentional\n // external-prop sync that must not run mid-wrap animation; covered by tests\n // and certified in-browser.\n useEffect(() => {\n if (controlledValue !== undefined && !isWrapping) {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing to controlled prop\n setDisplayIndex(controlledValue);\n }\n }, [controlledValue, isWrapping]);\n\n // Update active index\n const setActiveIndex = useCallback(\n (index: number, syncDisplay = true) => {\n let newIndex = index;\n\n if (repeat) {\n if (index < 0) {\n newIndex = itemCount - 1;\n } else if (index >= itemCount) {\n newIndex = 0;\n }\n } else {\n newIndex = Math.max(0, Math.min(index, itemCount - 1));\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newIndex);\n }\n if (syncDisplay) {\n setDisplayIndex(newIndex);\n }\n onChange?.(newIndex);\n },\n [controlledValue, itemCount, repeat, onChange]\n );\n\n // Navigation handlers\n const goToPrev = useCallback(() => {\n if (activeIndex === 0 && repeat && itemCount > 1) {\n // Animate to clone of last slide (position -1)\n setDisplayIndex(-1);\n setIsWrapping(true);\n } else {\n setActiveIndex(activeIndex - 1);\n }\n }, [activeIndex, repeat, itemCount, setActiveIndex]);\n\n const goToNext = useCallback(() => {\n if (activeIndex === itemCount - 1 && repeat && itemCount > 1) {\n // Animate to clone of first slide (position itemCount)\n setDisplayIndex(itemCount);\n setIsWrapping(true);\n } else {\n setActiveIndex(activeIndex + 1);\n }\n }, [activeIndex, itemCount, repeat, setActiveIndex]);\n\n const goToSlide = useCallback(\n (index: number) => {\n setIsWrapping(false);\n setActiveIndex(index);\n },\n [setActiveIndex]\n );\n\n // Read when the timer fires or an arrow key arrives, so neither the\n // timer nor the key listener starts over while `onChange` changes\n // identity, as an inline one does on every render of the parent.\n const goToPrevRef = useLatestRef(goToPrev);\n const goToNextRef = useLatestRef(goToNext);\n\n // Auto-play. Each slide gets the whole interval, so a slide change,\n // autoplay's own or the user's, starts the timer over. A render that\n // leaves the slide where it is doesn't.\n useEffect(() => {\n if (!autoplay || isPaused || itemCount <= 1) return undefined;\n\n const timer = setInterval(() => {\n goToNextRef.current();\n }, interval);\n\n return () => clearInterval(timer);\n }, [autoplay, isPaused, interval, itemCount, activeIndex, goToNextRef]);\n\n // Pause on hover\n const handleMouseEnter = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(true);\n }\n }, [pauseOnHover]);\n\n const handleMouseLeave = useCallback(() => {\n if (pauseOnHover) {\n setIsPaused(false);\n }\n }, [pauseOnHover]);\n\n // Drag handlers\n const handleDragStart = useCallback(\n (clientX: number) => {\n if (!hasDrag) return;\n setIsDragging(true);\n setDragStart(clientX);\n setDragOffset(0);\n },\n [hasDrag]\n );\n\n const handleDragMove = useCallback(\n (clientX: number) => {\n if (!isDragging) return;\n setDragOffset(clientX - dragStart);\n },\n [isDragging, dragStart]\n );\n\n const handleDragEnd = useCallback(() => {\n if (!isDragging) return;\n setIsDragging(false);\n\n const threshold = 50;\n if (dragOffset < -threshold) {\n goToNext();\n } else if (dragOffset > threshold) {\n goToPrev();\n }\n\n setDragOffset(0);\n }, [isDragging, dragOffset, goToNext, goToPrev]);\n\n // Mouse events\n const handleMouseDown = useCallback(\n (e: React.MouseEvent) => {\n e.preventDefault();\n handleDragStart(e.clientX);\n },\n [handleDragStart]\n );\n\n const handleMouseMove = useCallback(\n (e: React.MouseEvent) => {\n handleDragMove(e.clientX);\n },\n [handleDragMove]\n );\n\n const handleMouseUp = useCallback(() => {\n handleDragEnd();\n }, [handleDragEnd]);\n\n // Touch events\n const handleTouchStart = useCallback(\n (e: React.TouchEvent) => {\n handleDragStart(e.touches[0].clientX);\n },\n [handleDragStart]\n );\n\n const handleTouchMove = useCallback(\n (e: React.TouchEvent) => {\n handleDragMove(e.touches[0].clientX);\n },\n [handleDragMove]\n );\n\n const handleTouchEnd = useCallback(() => {\n handleDragEnd();\n }, [handleDragEnd]);\n\n // Keyboard navigation\n useEffect(() => {\n const handleKeyDown = (e: KeyboardEvent) => {\n const node = carouselRef.current;\n if (!node?.contains(getActiveElementInTree(node))) return;\n\n switch (e.key) {\n case 'ArrowLeft':\n e.preventDefault();\n goToPrevRef.current();\n break;\n case 'ArrowRight':\n e.preventDefault();\n goToNextRef.current();\n break;\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => document.removeEventListener('keydown', handleKeyDown);\n }, [goToPrevRef, goToNextRef]);\n\n // Handle wrap-around transition end\n const handleTransitionEnd = useCallback(() => {\n if (isWrapping) {\n // Skip transition for the instant snap\n setSkipTransition(true);\n setIsWrapping(false);\n\n if (displayIndex === itemCount) {\n // Was at clone of first slide, snap to real first slide\n setActiveIndex(0, false);\n setDisplayIndex(0);\n } else if (displayIndex === -1) {\n // Was at clone of last slide, snap to real last slide\n setActiveIndex(itemCount - 1, false);\n setDisplayIndex(itemCount - 1);\n }\n\n // Re-enable transition after the snap\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n setSkipTransition(false);\n });\n });\n }\n }, [isWrapping, displayIndex, itemCount, setActiveIndex]);\n\n // Combined ref\n const combinedRef = useCallback(\n (node: HTMLDivElement | null) => {\n (carouselRef as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches by\n // running it instead of calling the ref with `null`; React 18 discards the\n // return value entirely. Returning it from here would be a React-19-only\n // contract, so we hold the cleanup and run it ourselves on detach — the\n // same shape as `Dropdown`, `Modal`, `Dialog`, `Sidebar` and `Toast`.\n // The form controls that merge a forwarded ref still discard the cleanup\n // and detach with `ref(null)`, so this is not yet library-wide — grep\n // `typeof ref === 'function'` for the current split.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n // Can navigate\n const canGoPrev = repeat || activeIndex > 0;\n const canGoNext = repeat || activeIndex < itemCount - 1;\n\n // Generate classes\n const carouselClasses = usePrefixedClassNames('carousel', {\n 'is-overlay': indicatorInside,\n 'has-arrow-hover': arrowHover,\n [`is-indicator-${indicatorStyle}`]: indicatorStyle !== 'dots',\n [`is-arrow-${arrowColor}`]: !!arrowColor,\n });\n const classPrefix = useClassPrefix();\n const carouselContainerClass = usePrefixedClassNames('carousel-container');\n const carouselSlidesClass = usePrefixedClassNames('carousel-slides');\n const carouselArrowPrevClass = usePrefixedClassNames(\n 'carousel-arrow',\n 'is-prev',\n { 'is-transparent': !arrowBackground }\n );\n const carouselArrowNextClass = usePrefixedClassNames(\n 'carousel-arrow',\n 'is-next',\n { 'is-transparent': !arrowBackground }\n );\n const carouselIndicatorClass = usePrefixedClassNames('carousel-indicator', {\n 'is-inside': indicatorInside,\n 'is-top': indicatorPosition === 'top',\n });\n\n const combinedClasses = classNames(\n carouselClasses,\n bulmaHelperClasses,\n className\n );\n\n // Render slides with active state (includes clones for infinite loop)\n const renderSlides = () => {\n const slides = items.map((item, index) => {\n if (isValidElement<CarouselItemProps>(item)) {\n return cloneElement(item, {\n key: index,\n active: index === activeIndex,\n });\n }\n return item;\n });\n\n // Add clones for seamless infinite loop when repeat is enabled\n if (repeat && itemCount > 1) {\n const lastItem = items[itemCount - 1];\n const firstItem = items[0];\n\n const lastClone = isValidElement<CarouselItemProps>(lastItem)\n ? cloneElement(lastItem as React.ReactElement<CarouselItemProps>, {\n key: 'clone-last',\n active: false,\n })\n : null;\n\n const firstClone = isValidElement<CarouselItemProps>(firstItem)\n ? cloneElement(firstItem as React.ReactElement<CarouselItemProps>, {\n key: 'clone-first',\n active: false,\n })\n : null;\n\n return [lastClone, ...slides, firstClone];\n }\n\n return slides;\n };\n\n return (\n <div\n ref={combinedRef}\n className={combinedClasses}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"region\"\n aria-roledescription=\"carousel\"\n aria-label={ariaLabel}\n {...rest}\n >\n <div\n ref={containerRef}\n className={carouselContainerClass}\n onMouseDown={hasDrag ? handleMouseDown : undefined}\n onMouseMove={hasDrag && isDragging ? handleMouseMove : undefined}\n onMouseUp={hasDrag ? handleMouseUp : undefined}\n onMouseLeave={hasDrag ? handleMouseUp : undefined}\n onTouchStart={hasDrag ? handleTouchStart : undefined}\n onTouchMove={hasDrag ? handleTouchMove : undefined}\n onTouchEnd={hasDrag ? handleTouchEnd : undefined}\n style={{\n transform: isDragging ? `translateX(${dragOffset}px)` : undefined,\n cursor: hasDrag ? (isDragging ? 'grabbing' : 'grab') : undefined,\n }}\n >\n <div\n className={carouselSlidesClass}\n style={{\n // When repeat is enabled, account for the prepended clone (+1 offset)\n transform: `translateX(-${(repeat && itemCount > 1 ? displayIndex + 1 : displayIndex) * 100}%)`,\n // Disable transition during drag or instant snap after wrap-around\n transition:\n isDragging || skipTransition\n ? 'none'\n : 'transform 0.3s ease-in-out',\n }}\n onTransitionEnd={handleTransitionEnd}\n >\n {renderSlides()}\n </div>\n {arrow && itemCount > 1 && (\n <>\n <Button\n type=\"button\"\n className={carouselArrowPrevClass}\n onClick={goToPrev}\n isDisabled={!canGoPrev}\n aria-label=\"Previous slide\"\n >\n {iconPrev ? (\n <Icon\n name={iconPrev}\n library={iconLibrary}\n variant={iconVariant}\n size={iconSize}\n features={iconFeatures}\n />\n ) : (\n <DefaultPrevIcon />\n )}\n </Button>\n <Button\n type=\"button\"\n className={carouselArrowNextClass}\n onClick={goToNext}\n isDisabled={!canGoNext}\n aria-label=\"Next slide\"\n >\n {iconNext ? (\n <Icon\n name={iconNext}\n library={iconLibrary}\n variant={iconVariant}\n size={iconSize}\n features={iconFeatures}\n />\n ) : (\n <DefaultNextIcon />\n )}\n </Button>\n </>\n )}\n </div>\n\n {indicator && itemCount > 1 && (\n <div className={carouselIndicatorClass} role=\"tablist\">\n {items.map((_, index) => (\n <Button\n key={index}\n type=\"button\"\n className={prefixedClassNames(classPrefix, 'indicator-item', {\n 'is-active': index === activeIndex,\n })}\n onClick={() => goToSlide(index)}\n role=\"tab\"\n aria-selected={index === activeIndex}\n aria-label={`Go to slide ${index + 1}`}\n />\n ))}\n </div>\n )}\n </div>\n );\n }\n);\n\nCarousel.displayName = 'Carousel';\n\nexport default Carousel;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;AA8BA;;;;;;;AAOG;MACU,YAAY,GAAG,UAAU,CACpC,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAI;AACjD,IAAA,MAAM,WAAW,GAAG,UAAU,CAC5B,qBAAqB,CAAC,eAAe,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,EAC/D,SAAS,CACV;AAED,IAAA,QACEA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,WAAW,KAAM,KAAK,EAAA,QAAA,EAC7C,QAAQ,EAAA,CACL;AAEV,CAAC;AAGH,YAAY,CAAC,WAAW,GAAG,cAAc;AAIzC;;;;;AAKG;AACH,MAAM,eAAe,GAAG,OACtBA,GAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EAAA,QAAA,EAEfA,GAAA,CAAA,UAAA,EAAA,EAAU,MAAM,EAAC,iBAAiB,EAAA,CAAG,EAAA,CACjC,CACP;AAED;;;;;AAKG;AACH,MAAM,eAAe,GAAG,OACtBA,GAAA,CAAA,KAAA,EAAA,EACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,GAAG,EAAA,QAAA,EAEfA,GAAA,CAAA,UAAA,EAAA,EAAU,MAAM,EAAC,gBAAgB,EAAA,CAAG,E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C,WAAW,EAAE,gBAAgB,EAAE;wBAC3D,WAAW,EAAE,KAAK,KAAK,WAAW;AACnC,qBAAA,CAAC,EACF,OAAO,EAAE,MAAM,SAAS,CAAC,KAAK,CAAC,EAC/B,IAAI,EAAC,KAAK,EAAA,eAAA,EACK,KAAK,KAAK,WAAW,EAAA,YAAA,EACxB,CAAA,YAAA,EAAe,KAAK,GAAG,CAAC,CAAA,CAAE,EAAA,EARjC,KAAK,CASV,CACH,CAAC,EAAA,CACE,CACP,CAAA,EAAA,CACG;AAEV,CAAC;AAGH,QAAQ,CAAC,WAAW,GAAG,UAAU;;"}
@@ -8,6 +8,7 @@ import { isEventInside, getActiveElementInTree } from '../helpers/shadowDom.js';
8
8
  import { omitAttrs, ANCHOR_ONLY_ATTRS } from '../helpers/anchorAttrs.js';
9
9
  import { buttonType } from '../helpers/buttonType.js';
10
10
  import { useMenuKeys, enabledMenuItems } from '../helpers/useMenuKeys.js';
11
+ import { useLatestRef } from '../helpers/useLatestRef.js';
11
12
 
12
13
  /**
13
14
  * Checks if code is running in a browser environment.
@@ -98,6 +99,10 @@ const DropdownComponent = forwardRef(function DropdownComponent({ label, childre
98
99
  if (typeof activeProp === 'boolean')
99
100
  setActive(activeProp);
100
101
  }, [activeProp]);
102
+ // Read when a click lands outside, so the listener stays put while
103
+ // `onActiveChange` changes identity, as an inline one does on every
104
+ // render of the parent.
105
+ const onActiveChangeRef = useLatestRef(onActiveChange);
101
106
  // SSR-safe outside click
102
107
  useEffect(() => {
103
108
  if (!active)
@@ -107,12 +112,12 @@ const DropdownComponent = forwardRef(function DropdownComponent({ label, childre
107
112
  const handleClick = (e) => {
108
113
  if (!isEventInside(e, dropdownRef.current)) {
109
114
  setActive(false);
110
- onActiveChange?.(false);
115
+ onActiveChangeRef.current?.(false);
111
116
  }
112
117
  };
113
118
  document.addEventListener('mousedown', handleClick);
114
119
  return () => document.removeEventListener('mousedown', handleClick);
115
- }, [active, onActiveChange]);
120
+ }, [active, onActiveChangeRef]);
116
121
  const handleToggle = () => {
117
122
  /* istanbul ignore next: guard is enforced by button[disabled] at the DOM level */
118
123
  if (disabled)
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useState,\n useRef,\n useEffect,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { getActiveElementInTree, isEventInside } from '../helpers/shadowDom';\nimport type { ConstrainedPolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport {\n type AnchorOnlyAttributes,\n ANCHOR_ONLY_ATTRS,\n omitAttrs,\n} from '../helpers/anchorAttrs';\nimport { buttonType } from '../helpers/buttonType';\nimport { enabledMenuItems, useMenuKeys } from '../helpers/useMenuKeys';\n\n/**\n * Checks if code is running in a browser environment.\n * @deprecated Dropdown's internal SSR guard, exported by accident; it will\n * be removed in the next major. Check `typeof window !== 'undefined' &&\n * typeof document !== 'undefined'` instead.\n * @param win - Window object.\n * @param doc - Document object.\n * @returns {boolean} True if in browser, false otherwise.\n */\nexport const isBrowser = (win?: typeof window, doc?: typeof document) =>\n typeof win !== 'undefined' && typeof doc !== 'undefined';\n\n/**\n * Props for the Dropdown component.\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root dropdown element.\n */\nexport interface DropdownProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, keyof BulmaClassesProps>,\n BulmaClassesProps {\n /** The dropdown button/trigger content. */\n label: React.ReactNode;\n /** Dropdown menu items and dividers. */\n children: React.ReactNode;\n /** Additional CSS classes for root. */\n className?: string;\n /** Additional CSS classes for the dropdown menu. */\n menuClassName?: string;\n /** Whether the dropdown is open (controlled). */\n active?: boolean;\n /** Dropdown menu opens upward. */\n up?: boolean;\n /** Menu is right-aligned. */\n right?: boolean;\n /** Open on hover instead of click. */\n hoverable?: boolean;\n /** Disables the dropdown trigger. */\n disabled?: boolean;\n /** Callback when dropdown active state changes. */\n onActiveChange?: (active: boolean) => void;\n /** Close dropdown when a menu item is clicked, or activated with Enter or Space. */\n closeOnClick?: boolean;\n /** Root element ID (for aria-controls, etc). */\n id?: string;\n}\n\n/**\n * The `Dropdown` component provides Bulma's versatile dropdown menu for your Bulma React UI.\n *\n * Down, Enter and Space on the trigger open the menu on its first enabled\n * item, and Up opens it on its last. On the trigger of a menu that's already\n * open, Down and Up move focus to its first and last item. In the menu, the\n * arrow keys, Home and End move between the items, and Enter and Space run\n * the focused one the way a click does. Typing a letter moves to the next\n * item whose text starts with it, skipping disabled ones, and letters typed\n * in quick succession add up to one search. Typing searches once focus is in\n * the menu, so a letter typed on the trigger does nothing. Escape closes the\n * menu and focuses the trigger, and Tab closes it and lets focus move on.\n * Anything focusable in the menu that isn't an item, such as a field, keeps\n * its own keys apart from Escape and Tab, though an Escape it calls\n * `preventDefault()` on in its own `onKeyDown` stays its own and leaves the\n * menu open. For a panel built around fields, use `Popover`.\n *\n * @function\n * @param {DropdownProps} props - Props for the Dropdown component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root dropdown element.\n * @returns {JSX.Element} The rendered dropdown.\n * @see {@link https://bulma.io/documentation/components/dropdown/ | Bulma Dropdown documentation}\n */\nconst DropdownComponent = forwardRef<HTMLDivElement, DropdownProps>(\n function DropdownComponent(\n {\n label,\n children,\n className,\n menuClassName,\n active: activeProp,\n up,\n right,\n hoverable,\n disabled,\n onActiveChange,\n closeOnClick = true,\n id,\n ...props\n },\n ref\n ) {\n const [active, setActive] = useState<boolean>(!!activeProp);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const menuKeys = useMenuKeys();\n const pendingFocusRef = useRef<'first' | 'last' | null>(null);\n\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n (dropdownRef as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches\n // by running it instead of calling the ref with `null`; React 18\n // discards the return value entirely. Returning it from here would be\n // a React-19-only contract, so instead we hold the cleanup and run it\n // ourselves on detach — a consumer's cleanup ref then behaves the same\n // on both majors of the CI matrix.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('dropdown', {\n 'is-active': active,\n 'is-up': up,\n 'is-right': right,\n 'is-hoverable': hoverable,\n 'is-disabled': disabled,\n });\n\n const buttonClass = usePrefixedClassNames('button');\n\n // Controlled mode support: mirror the controlled `active` prop into local\n // state. This is an intentional external-prop sync (controlled/uncontrolled\n // hybrid); behavior is covered by tests and certified in-browser.\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing to controlled prop\n if (typeof activeProp === 'boolean') setActive(activeProp);\n }, [activeProp]);\n\n // SSR-safe outside click\n useEffect(() => {\n if (!active) return;\n\n if (!isBrowser(window, document)) return;\n\n const handleClick = (e: MouseEvent) => {\n if (!isEventInside(e, dropdownRef.current)) {\n setActive(false);\n onActiveChange?.(false);\n }\n };\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [active, onActiveChange]);\n\n const handleToggle = () => {\n /* istanbul ignore next: guard is enforced by button[disabled] at the DOM level */\n if (disabled) return;\n\n const newActive = !active;\n setActive(newActive);\n onActiveChange?.(newActive);\n };\n\n const handleMenuClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (closeOnClick) {\n setActive(false);\n onActiveChange?.(false);\n // Closing hides the item that has focus, and the browser drops focus\n // to the page when that happens. Hand it back to the trigger, as\n // Escape does. An item that moved focus somewhere else keeps it there.\n // The menu around this content is what a click between items focuses.\n const menu = e.currentTarget.parentElement as HTMLElement;\n if (menu.contains(getActiveElementInTree(e.currentTarget))) {\n triggerRef.current?.focus();\n }\n }\n };\n\n const focusEdgeItem = (edge: 'first' | 'last') => {\n const items = enabledMenuItems(menuRef.current as HTMLElement);\n items[edge === 'first' ? 0 : items.length - 1]?.focus();\n };\n\n // Once the menu shows, forget a search typed just before it last closed,\n // and focus the pending item. The item is unfocusable while\n // `display: none` applies, so this must wait for the `is-active` class to\n // actually land in the DOM.\n useEffect(() => {\n if (!active) return;\n menuKeys.reset();\n if (!pendingFocusRef.current) return;\n focusEdgeItem(pendingFocusRef.current);\n pendingFocusRef.current = null;\n }, [active, menuKeys]);\n\n const handleTriggerKeyDown = (\n e: React.KeyboardEvent<HTMLButtonElement>\n ) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n pendingFocusRef.current = 'first';\n if (!active) {\n setActive(true);\n onActiveChange?.(true);\n } else {\n focusEdgeItem('first');\n pendingFocusRef.current = null;\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n pendingFocusRef.current = 'last';\n if (!active) {\n setActive(true);\n onActiveChange?.(true);\n } else {\n focusEdgeItem('last');\n pendingFocusRef.current = null;\n }\n break;\n case 'Enter':\n case ' ':\n e.preventDefault();\n // A held key sends a keydown per auto-repeat. Running an item hands\n // focus back here, so without this a held Enter would reopen the\n // menu and run whichever item it focused next.\n if (e.repeat) break;\n if (!active) {\n pendingFocusRef.current = 'first';\n setActive(true);\n onActiveChange?.(true);\n } else {\n setActive(false);\n onActiveChange?.(false);\n }\n break;\n case 'Escape':\n if (active) {\n e.preventDefault();\n setActive(false);\n onActiveChange?.(false);\n }\n break;\n default:\n break;\n }\n };\n\n const handleMenuKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // Closing is Dropdown's: Escape and Tab close the menu from anywhere in\n // it, a field included, and an empty or all-disabled menu too. Moving\n // between the items, running them and typeahead are the hook's, which\n // acts only while focus is on the menu or one of its items. An Escape\n // something in the menu already used, such as a field's own list\n // closing on it, leaves the menu open for the next one.\n if (e.key === 'Escape') {\n if (e.defaultPrevented) return;\n e.preventDefault();\n setActive(false);\n onActiveChange?.(false);\n triggerRef.current?.focus();\n return;\n }\n if (e.key === 'Tab') {\n setActive(false);\n onActiveChange?.(false);\n return;\n }\n\n menuKeys.onKeyDown(e);\n };\n\n const dropdownClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div\n className={dropdownClasses}\n ref={setRefs}\n id={id}\n data-testid=\"dropdown-root\"\n {...rest}\n >\n <div className={usePrefixedClassNames('dropdown-trigger')}>\n <button\n ref={triggerRef}\n className={buttonClass}\n aria-haspopup=\"true\"\n aria-controls={id ? `${id}-menu` : undefined}\n aria-expanded={active}\n onClick={handleToggle}\n onKeyDown={handleTriggerKeyDown}\n disabled={disabled}\n type=\"button\"\n >\n <span>{label}</span>\n <span\n className={usePrefixedClassNames('icon', 'is-small')}\n aria-hidden=\"true\"\n >\n <i className=\"fas fa-angle-down\" />\n </span>\n </button>\n </div>\n <div\n className={classNames(\n usePrefixedClassNames('dropdown-menu'),\n menuClassName\n )}\n id={id ? `${id}-menu` : undefined}\n ref={menuRef}\n role=\"menu\"\n data-testid=\"dropdown-menu\"\n onKeyDown={handleMenuKeyDown}\n // The menu, not its content, takes focus from a click between items,\n // so the menu owns nothing focusable but its items.\n tabIndex={-1}\n >\n <div\n className={usePrefixedClassNames('dropdown-content')}\n onClick={handleMenuClick}\n >\n {children}\n </div>\n </div>\n </div>\n );\n }\n);\n\n/**\n * The elements a dropdown item may render as. Bulma's dropdown markup names\n * these three and no others, so `as` is a closed set rather than an open\n * `React.ElementType`.\n */\nexport type DropdownItemElement = 'a' | 'div' | 'button';\n\n/**\n * The DropdownItem component's own props.\n */\nexport interface DropdownItemOwnProps extends BulmaClassesProps {\n /** Whether the item is active. */\n active?: boolean;\n /** Additional CSS classes. */\n className?: string;\n /** Marks the item as disabled; disabled items are skipped during keyboard navigation. Use with `as=\"button\"` for a native disabled control, or pair with `aria-disabled` on a link. */\n disabled?: boolean;\n /** Item content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the DropdownItem component. Everything the item does not own\n * follows `as`: `href`, `target` and `rel` under the default `'a'`, `type` and\n * `form` under `'button'`, and the shared HTML attributes under any of them.\n *\n * Pinning these to `React.HTMLAttributes<HTMLElement>` instead — which is what\n * this type did before — rejected `href` on an anchor and `type` on a button,\n * both of which have always worked at runtime. Same defect as #641, in the\n * narrower shape a constrained `as` takes.\n *\n * **Name the tag you mean.** The type parameter defaults to the whole union, not\n * to the rendered element, so bare `DropdownItemProps` keeps accepting\n * `{ as: 'div' }` the way it always has. The cost is that it is not\n * distributive: `Omit` over a union keeps only the shared keys, so the bare\n * alias carries no `href` even though the component takes one under `as=\"a\"`.\n * Write `DropdownItemProps<'a'>` for the anchor's props. That is the #667 alias\n * limitation Button carries, labelled next-major because closing it is\n * source-breaking, and pinned for this component in\n * `__typetests__/polymorphic.tsx`; the component itself is unaffected.\n */\nexport type DropdownItemProps<\n T extends DropdownItemElement = DropdownItemElement,\n> = DropdownItemOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof DropdownItemOwnProps | 'as'> & {\n /**\n * The element type to render.\n *\n * `'button'` renders `type=\"button\"` unless you pass `type=\"submit\"` or `type=\"reset\"`, so\n * an item inside a form does not submit it.\n */\n as?: T;\n };\n\n/**\n * The anchor's attributes, minus the one a `<button>` legitimately takes.\n *\n * `type` stays: `as=\"button\"` is a supported form and `type=\"submit\"` is valid\n * there, so stripping it would remove a working attribute. A `<div>` takes no\n * `type`, so it gets the whole `ANCHOR_ONLY_ATTRS` set instead. The set is\n * chosen by the rendered tag because that is where the reason lives (#692).\n *\n * Neither set withholds `rel`, which `Level.Item` does: React declares `rel` on\n * `HTMLAttributes` for every element, so withholding it would diverge from\n * React's own typing, the call #641 recorded for `Navbar.Link`. Level\n * withholds it anyway, because it always has.\n */\nconst STRIP_FROM_BUTTON: Readonly<\n Record<Exclude<keyof AnchorOnlyAttributes, 'type'>, true>\n> = (() => {\n const { type: _type, ...rest } = ANCHOR_ONLY_ATTRS;\n return rest;\n})();\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `DropdownItemProps<T>` above — the body cannot see through `T`.\n */\ntype DropdownItemImplProps = DropdownItemOwnProps & {\n as?: DropdownItemElement;\n};\n\n/**\n * Bulma Dropdown item.\n *\n * @function\n * @param {DropdownItemProps} props - Props for the DropdownItem component.\n * @returns {JSX.Element} The rendered dropdown item.\n */\nexport const DropdownItem = ((itemProps: DropdownItemProps) => {\n const {\n children,\n active,\n className,\n as: Component = 'a',\n ...props\n } = itemProps as DropdownItemImplProps;\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n // The anchor's attributes reach an anchor and nothing else — `<div href>` and\n // `<button target>` are invalid HTML. The same rule Menu applies, for the same\n // reason: the type now derives these from `as`, and deriving them must not\n // quietly widen where they land. The type stops a direct caller; this stops a\n // plain-JS one, a loose `{...props}` spread, and the genericity a wrapping HOC\n // erases.\n //\n // The whole link set, not `href` alone: they all arrive together under\n // `as=\"a\"`. Menu strips `href` only, because its `as` is open and a flat set\n // would delete attributes legal on the element a caller named.\n //\n // `bestax-migrate` tracks the same question from the other side, per attribute\n // per element (`LINK_ATTR_ELEMENTS`) rather than as one set — so the two lists\n // are not interchangeable and neither derives from the other.\n //\n // Menu's condition also admits a custom component and a custom element, which\n // own their prop contracts. Here the set follows the tag: an `<a>` keeps all\n // of them, a `<button>` keeps `type`, and any other `as` keeps none of them.\n const forwarded =\n Component === 'a'\n ? rest\n : Component === 'button'\n ? omitAttrs(rest, STRIP_FROM_BUTTON)\n : omitAttrs(rest, ANCHOR_ONLY_ATTRS);\n return (\n <Component\n className={classNames(\n usePrefixedClassNames('dropdown-item', {\n 'is-active': active,\n }),\n bulmaHelperClasses,\n className\n )}\n data-testid=\"dropdown-item\"\n {...forwarded}\n // After `forwarded` for the same reason as `role` and `type` below: a\n // spread carrying `tabIndex: undefined` would otherwise erase the\n // default. The item keeps its menu role and its place in the arrow-key\n // order, but a `<div>` or an anchor without an `href` cannot take focus\n // without a tabindex, so the arrow keys stall on it.\n tabIndex={(forwarded as { tabIndex?: number }).tabIndex ?? 0}\n // After `forwarded` for the same reason as `type` below: a spread\n // carrying `role: undefined` would otherwise erase the default, and an\n // item with no role drops out of the menu and its arrow-key order.\n role={(forwarded as { role?: React.AriaRole }).role ?? 'menuitem'}\n // A menu item inside a form must not submit it. `<button>` defaults to\n // type=\"submit\", and a filter or sort menu sitting in a form is ordinary.\n // Dropdown's own trigger sets it, and `Avatar` and `Menu.Item` default it\n // the same way. A caller's `submit` or `reset` still wins, and anything\n // else becomes `button`, since HTML reads a value it does not define for\n // a button as submit too; `buttonType` says more.\n //\n // After `forwarded`, reading through it rather than before it: React\n // treats `type={undefined}` as \"remove the attribute\", and a spread\n // carrying an absent key is how that arrives. Spreading the default first\n // let such a spread erase it and restore the submit behaviour, so the\n // guard only held for callers who passed nothing.\n {...(Component === 'button'\n ? { type: buttonType((forwarded as { type?: unknown }).type) }\n : {})}\n >\n {children}\n </Component>\n );\n}) as ConstrainedPolymorphicComponentWithoutRef<\n DropdownItemOwnProps,\n DropdownItemElement,\n 'a'\n>;\n\n/**\n * Bulma Dropdown divider.\n *\n * @function\n * @returns {JSX.Element} The rendered divider element.\n */\nexport const DropdownDivider: React.FC = () => (\n <hr className={usePrefixedClassNames('dropdown-divider')} />\n);\n\n/** Bulma Dropdown component with Item and Divider sub-components. */\nexport const Dropdown = withSubComponents(\n DropdownComponent,\n {\n Item: DropdownItem,\n Div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AAmB3D,IAAA,MAAM,SAAS,GACb,SAAS,KAAK;AACZ,UAAE;UACA,SAAS,KAAK;AACd,cAAE,SAAS,CAAC,IAAI,EAAE,iBAAiB;AACnC,cAAE,SAAS,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAC1C,QACEA,GAAA,CAAC,SAAS,EAAA,EACR,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,eAAe,EAAE;AACrC,YAAA,WAAW,EAAE,MAAM;SACpB,CAAC,EACF,kBAAkB,EAClB,SAAS,CACV,EAAA,aAAA,EACW,eAAe,KACvB,SAAS;;;;;;AAMb,QAAA,QAAQ,EAAG,SAAmC,CAAC,QAAQ,IAAI,CAAC;;;;QAI5D,IAAI,EAAG,SAAuC,CAAC,IAAI,IAAI,UAAU,EAAA,IAa5D,SAAS,KAAK;cACf,EAAE,IAAI,EAAE,UAAU,CAAE,SAAgC,CAAC,IAAI,CAAC;AAC5D,cAAE,EAAE,CAAC,YAEN,QAAQ,EAAA,CACC;AAEhB,CAAC;AAMD;;;;;AAKG;AACI,MAAM,eAAe,GAAa,OACvCA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,EAAA,CAAI;AAG9D;AACO,MAAM,QAAQ,GAAG,iBAAiB,CACvC,iBAAiB,EACjB;AACE,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,OAAO,EAAE,eAAe;CACzB,EACD,UAAU;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../src/components/Dropdown.tsx"],"sourcesContent":["import React, {\n forwardRef,\n useCallback,\n useState,\n useRef,\n useEffect,\n} from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { getActiveElementInTree, isEventInside } from '../helpers/shadowDom';\nimport type { ConstrainedPolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport {\n type AnchorOnlyAttributes,\n ANCHOR_ONLY_ATTRS,\n omitAttrs,\n} from '../helpers/anchorAttrs';\nimport { buttonType } from '../helpers/buttonType';\nimport { enabledMenuItems, useMenuKeys } from '../helpers/useMenuKeys';\nimport { useLatestRef } from '../helpers/useLatestRef';\n\n/**\n * Checks if code is running in a browser environment.\n * @deprecated Dropdown's internal SSR guard, exported by accident; it will\n * be removed in the next major. Check `typeof window !== 'undefined' &&\n * typeof document !== 'undefined'` instead.\n * @param win - Window object.\n * @param doc - Document object.\n * @returns {boolean} True if in browser, false otherwise.\n */\nexport const isBrowser = (win?: typeof window, doc?: typeof document) =>\n typeof win !== 'undefined' && typeof doc !== 'undefined';\n\n/**\n * Props for the Dropdown component.\n * @extraProp {React.Ref<HTMLDivElement>} [ref] - Ref forwarded to the root dropdown element.\n */\nexport interface DropdownProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, keyof BulmaClassesProps>,\n BulmaClassesProps {\n /** The dropdown button/trigger content. */\n label: React.ReactNode;\n /** Dropdown menu items and dividers. */\n children: React.ReactNode;\n /** Additional CSS classes for root. */\n className?: string;\n /** Additional CSS classes for the dropdown menu. */\n menuClassName?: string;\n /** Whether the dropdown is open (controlled). */\n active?: boolean;\n /** Dropdown menu opens upward. */\n up?: boolean;\n /** Menu is right-aligned. */\n right?: boolean;\n /** Open on hover instead of click. */\n hoverable?: boolean;\n /** Disables the dropdown trigger. */\n disabled?: boolean;\n /** Callback when dropdown active state changes. */\n onActiveChange?: (active: boolean) => void;\n /** Close dropdown when a menu item is clicked, or activated with Enter or Space. */\n closeOnClick?: boolean;\n /** Root element ID (for aria-controls, etc). */\n id?: string;\n}\n\n/**\n * The `Dropdown` component provides Bulma's versatile dropdown menu for your Bulma React UI.\n *\n * Down, Enter and Space on the trigger open the menu on its first enabled\n * item, and Up opens it on its last. On the trigger of a menu that's already\n * open, Down and Up move focus to its first and last item. In the menu, the\n * arrow keys, Home and End move between the items, and Enter and Space run\n * the focused one the way a click does. Typing a letter moves to the next\n * item whose text starts with it, skipping disabled ones, and letters typed\n * in quick succession add up to one search. Typing searches once focus is in\n * the menu, so a letter typed on the trigger does nothing. Escape closes the\n * menu and focuses the trigger, and Tab closes it and lets focus move on.\n * Anything focusable in the menu that isn't an item, such as a field, keeps\n * its own keys apart from Escape and Tab, though an Escape it calls\n * `preventDefault()` on in its own `onKeyDown` stays its own and leaves the\n * menu open. For a panel built around fields, use `Popover`.\n *\n * @function\n * @param {DropdownProps} props - Props for the Dropdown component.\n * @param {React.Ref<HTMLDivElement>} ref - Forwarded ref to the root dropdown element.\n * @returns {JSX.Element} The rendered dropdown.\n * @see {@link https://bulma.io/documentation/components/dropdown/ | Bulma Dropdown documentation}\n */\nconst DropdownComponent = forwardRef<HTMLDivElement, DropdownProps>(\n function DropdownComponent(\n {\n label,\n children,\n className,\n menuClassName,\n active: activeProp,\n up,\n right,\n hoverable,\n disabled,\n onActiveChange,\n closeOnClick = true,\n id,\n ...props\n },\n ref\n ) {\n const [active, setActive] = useState<boolean>(!!activeProp);\n const dropdownRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const menuKeys = useMenuKeys();\n const pendingFocusRef = useRef<'first' | 'last' | null>(null);\n\n // Cleanup returned by a consumer's callback ref on attach, held until detach.\n const consumerCleanupRef = useRef<(() => void) | null>(null);\n\n const setRefs = useCallback(\n (node: HTMLDivElement | null) => {\n (dropdownRef as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n if (typeof ref === 'function') {\n // React 19 lets a callback ref return a cleanup function and detaches\n // by running it instead of calling the ref with `null`; React 18\n // discards the return value entirely. Returning it from here would be\n // a React-19-only contract, so instead we hold the cleanup and run it\n // ourselves on detach — a consumer's cleanup ref then behaves the same\n // on both majors of the CI matrix.\n if (node === null) {\n const consumerCleanup = consumerCleanupRef.current;\n consumerCleanupRef.current = null;\n if (consumerCleanup) {\n consumerCleanup();\n } else {\n ref(null);\n }\n return;\n }\n const cleanup: unknown = ref(node);\n consumerCleanupRef.current =\n typeof cleanup === 'function' ? (cleanup as () => void) : null;\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current = node;\n }\n },\n [ref]\n );\n\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('dropdown', {\n 'is-active': active,\n 'is-up': up,\n 'is-right': right,\n 'is-hoverable': hoverable,\n 'is-disabled': disabled,\n });\n\n const buttonClass = usePrefixedClassNames('button');\n\n // Controlled mode support: mirror the controlled `active` prop into local\n // state. This is an intentional external-prop sync (controlled/uncontrolled\n // hybrid); behavior is covered by tests and certified in-browser.\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect -- syncing to controlled prop\n if (typeof activeProp === 'boolean') setActive(activeProp);\n }, [activeProp]);\n\n // Read when a click lands outside, so the listener stays put while\n // `onActiveChange` changes identity, as an inline one does on every\n // render of the parent.\n const onActiveChangeRef = useLatestRef(onActiveChange);\n\n // SSR-safe outside click\n useEffect(() => {\n if (!active) return;\n\n if (!isBrowser(window, document)) return;\n\n const handleClick = (e: MouseEvent) => {\n if (!isEventInside(e, dropdownRef.current)) {\n setActive(false);\n onActiveChangeRef.current?.(false);\n }\n };\n document.addEventListener('mousedown', handleClick);\n return () => document.removeEventListener('mousedown', handleClick);\n }, [active, onActiveChangeRef]);\n\n const handleToggle = () => {\n /* istanbul ignore next: guard is enforced by button[disabled] at the DOM level */\n if (disabled) return;\n\n const newActive = !active;\n setActive(newActive);\n onActiveChange?.(newActive);\n };\n\n const handleMenuClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (closeOnClick) {\n setActive(false);\n onActiveChange?.(false);\n // Closing hides the item that has focus, and the browser drops focus\n // to the page when that happens. Hand it back to the trigger, as\n // Escape does. An item that moved focus somewhere else keeps it there.\n // The menu around this content is what a click between items focuses.\n const menu = e.currentTarget.parentElement as HTMLElement;\n if (menu.contains(getActiveElementInTree(e.currentTarget))) {\n triggerRef.current?.focus();\n }\n }\n };\n\n const focusEdgeItem = (edge: 'first' | 'last') => {\n const items = enabledMenuItems(menuRef.current as HTMLElement);\n items[edge === 'first' ? 0 : items.length - 1]?.focus();\n };\n\n // Once the menu shows, forget a search typed just before it last closed,\n // and focus the pending item. The item is unfocusable while\n // `display: none` applies, so this must wait for the `is-active` class to\n // actually land in the DOM.\n useEffect(() => {\n if (!active) return;\n menuKeys.reset();\n if (!pendingFocusRef.current) return;\n focusEdgeItem(pendingFocusRef.current);\n pendingFocusRef.current = null;\n }, [active, menuKeys]);\n\n const handleTriggerKeyDown = (\n e: React.KeyboardEvent<HTMLButtonElement>\n ) => {\n if (disabled) return;\n switch (e.key) {\n case 'ArrowDown':\n e.preventDefault();\n pendingFocusRef.current = 'first';\n if (!active) {\n setActive(true);\n onActiveChange?.(true);\n } else {\n focusEdgeItem('first');\n pendingFocusRef.current = null;\n }\n break;\n case 'ArrowUp':\n e.preventDefault();\n pendingFocusRef.current = 'last';\n if (!active) {\n setActive(true);\n onActiveChange?.(true);\n } else {\n focusEdgeItem('last');\n pendingFocusRef.current = null;\n }\n break;\n case 'Enter':\n case ' ':\n e.preventDefault();\n // A held key sends a keydown per auto-repeat. Running an item hands\n // focus back here, so without this a held Enter would reopen the\n // menu and run whichever item it focused next.\n if (e.repeat) break;\n if (!active) {\n pendingFocusRef.current = 'first';\n setActive(true);\n onActiveChange?.(true);\n } else {\n setActive(false);\n onActiveChange?.(false);\n }\n break;\n case 'Escape':\n if (active) {\n e.preventDefault();\n setActive(false);\n onActiveChange?.(false);\n }\n break;\n default:\n break;\n }\n };\n\n const handleMenuKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n // Closing is Dropdown's: Escape and Tab close the menu from anywhere in\n // it, a field included, and an empty or all-disabled menu too. Moving\n // between the items, running them and typeahead are the hook's, which\n // acts only while focus is on the menu or one of its items. An Escape\n // something in the menu already used, such as a field's own list\n // closing on it, leaves the menu open for the next one.\n if (e.key === 'Escape') {\n if (e.defaultPrevented) return;\n e.preventDefault();\n setActive(false);\n onActiveChange?.(false);\n triggerRef.current?.focus();\n return;\n }\n if (e.key === 'Tab') {\n setActive(false);\n onActiveChange?.(false);\n return;\n }\n\n menuKeys.onKeyDown(e);\n };\n\n const dropdownClasses = classNames(\n bulmaClasses,\n bulmaHelperClasses,\n className\n );\n\n return (\n <div\n className={dropdownClasses}\n ref={setRefs}\n id={id}\n data-testid=\"dropdown-root\"\n {...rest}\n >\n <div className={usePrefixedClassNames('dropdown-trigger')}>\n <button\n ref={triggerRef}\n className={buttonClass}\n aria-haspopup=\"true\"\n aria-controls={id ? `${id}-menu` : undefined}\n aria-expanded={active}\n onClick={handleToggle}\n onKeyDown={handleTriggerKeyDown}\n disabled={disabled}\n type=\"button\"\n >\n <span>{label}</span>\n <span\n className={usePrefixedClassNames('icon', 'is-small')}\n aria-hidden=\"true\"\n >\n <i className=\"fas fa-angle-down\" />\n </span>\n </button>\n </div>\n <div\n className={classNames(\n usePrefixedClassNames('dropdown-menu'),\n menuClassName\n )}\n id={id ? `${id}-menu` : undefined}\n ref={menuRef}\n role=\"menu\"\n data-testid=\"dropdown-menu\"\n onKeyDown={handleMenuKeyDown}\n // The menu, not its content, takes focus from a click between items,\n // so the menu owns nothing focusable but its items.\n tabIndex={-1}\n >\n <div\n className={usePrefixedClassNames('dropdown-content')}\n onClick={handleMenuClick}\n >\n {children}\n </div>\n </div>\n </div>\n );\n }\n);\n\n/**\n * The elements a dropdown item may render as. Bulma's dropdown markup names\n * these three and no others, so `as` is a closed set rather than an open\n * `React.ElementType`.\n */\nexport type DropdownItemElement = 'a' | 'div' | 'button';\n\n/**\n * The DropdownItem component's own props.\n */\nexport interface DropdownItemOwnProps extends BulmaClassesProps {\n /** Whether the item is active. */\n active?: boolean;\n /** Additional CSS classes. */\n className?: string;\n /** Marks the item as disabled; disabled items are skipped during keyboard navigation. Use with `as=\"button\"` for a native disabled control, or pair with `aria-disabled` on a link. */\n disabled?: boolean;\n /** Item content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the DropdownItem component. Everything the item does not own\n * follows `as`: `href`, `target` and `rel` under the default `'a'`, `type` and\n * `form` under `'button'`, and the shared HTML attributes under any of them.\n *\n * Pinning these to `React.HTMLAttributes<HTMLElement>` instead — which is what\n * this type did before — rejected `href` on an anchor and `type` on a button,\n * both of which have always worked at runtime. Same defect as #641, in the\n * narrower shape a constrained `as` takes.\n *\n * **Name the tag you mean.** The type parameter defaults to the whole union, not\n * to the rendered element, so bare `DropdownItemProps` keeps accepting\n * `{ as: 'div' }` the way it always has. The cost is that it is not\n * distributive: `Omit` over a union keeps only the shared keys, so the bare\n * alias carries no `href` even though the component takes one under `as=\"a\"`.\n * Write `DropdownItemProps<'a'>` for the anchor's props. That is the #667 alias\n * limitation Button carries, labelled next-major because closing it is\n * source-breaking, and pinned for this component in\n * `__typetests__/polymorphic.tsx`; the component itself is unaffected.\n */\nexport type DropdownItemProps<\n T extends DropdownItemElement = DropdownItemElement,\n> = DropdownItemOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof DropdownItemOwnProps | 'as'> & {\n /**\n * The element type to render.\n *\n * `'button'` renders `type=\"button\"` unless you pass `type=\"submit\"` or `type=\"reset\"`, so\n * an item inside a form does not submit it.\n */\n as?: T;\n };\n\n/**\n * The anchor's attributes, minus the one a `<button>` legitimately takes.\n *\n * `type` stays: `as=\"button\"` is a supported form and `type=\"submit\"` is valid\n * there, so stripping it would remove a working attribute. A `<div>` takes no\n * `type`, so it gets the whole `ANCHOR_ONLY_ATTRS` set instead. The set is\n * chosen by the rendered tag because that is where the reason lives (#692).\n *\n * Neither set withholds `rel`, which `Level.Item` does: React declares `rel` on\n * `HTMLAttributes` for every element, so withholding it would diverge from\n * React's own typing, the call #641 recorded for `Navbar.Link`. Level\n * withholds it anyway, because it always has.\n */\nconst STRIP_FROM_BUTTON: Readonly<\n Record<Exclude<keyof AnchorOnlyAttributes, 'type'>, true>\n> = (() => {\n const { type: _type, ...rest } = ANCHOR_ONLY_ATTRS;\n return rest;\n})();\n\n/**\n * The shape the implementation destructures. The public contract is the generic\n * `DropdownItemProps<T>` above — the body cannot see through `T`.\n */\ntype DropdownItemImplProps = DropdownItemOwnProps & {\n as?: DropdownItemElement;\n};\n\n/**\n * Bulma Dropdown item.\n *\n * @function\n * @param {DropdownItemProps} props - Props for the DropdownItem component.\n * @returns {JSX.Element} The rendered dropdown item.\n */\nexport const DropdownItem = ((itemProps: DropdownItemProps) => {\n const {\n children,\n active,\n className,\n as: Component = 'a',\n ...props\n } = itemProps as DropdownItemImplProps;\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n // The anchor's attributes reach an anchor and nothing else — `<div href>` and\n // `<button target>` are invalid HTML. The same rule Menu applies, for the same\n // reason: the type now derives these from `as`, and deriving them must not\n // quietly widen where they land. The type stops a direct caller; this stops a\n // plain-JS one, a loose `{...props}` spread, and the genericity a wrapping HOC\n // erases.\n //\n // The whole link set, not `href` alone: they all arrive together under\n // `as=\"a\"`. Menu strips `href` only, because its `as` is open and a flat set\n // would delete attributes legal on the element a caller named.\n //\n // `bestax-migrate` tracks the same question from the other side, per attribute\n // per element (`LINK_ATTR_ELEMENTS`) rather than as one set — so the two lists\n // are not interchangeable and neither derives from the other.\n //\n // Menu's condition also admits a custom component and a custom element, which\n // own their prop contracts. Here the set follows the tag: an `<a>` keeps all\n // of them, a `<button>` keeps `type`, and any other `as` keeps none of them.\n const forwarded =\n Component === 'a'\n ? rest\n : Component === 'button'\n ? omitAttrs(rest, STRIP_FROM_BUTTON)\n : omitAttrs(rest, ANCHOR_ONLY_ATTRS);\n return (\n <Component\n className={classNames(\n usePrefixedClassNames('dropdown-item', {\n 'is-active': active,\n }),\n bulmaHelperClasses,\n className\n )}\n data-testid=\"dropdown-item\"\n {...forwarded}\n // After `forwarded` for the same reason as `role` and `type` below: a\n // spread carrying `tabIndex: undefined` would otherwise erase the\n // default. The item keeps its menu role and its place in the arrow-key\n // order, but a `<div>` or an anchor without an `href` cannot take focus\n // without a tabindex, so the arrow keys stall on it.\n tabIndex={(forwarded as { tabIndex?: number }).tabIndex ?? 0}\n // After `forwarded` for the same reason as `type` below: a spread\n // carrying `role: undefined` would otherwise erase the default, and an\n // item with no role drops out of the menu and its arrow-key order.\n role={(forwarded as { role?: React.AriaRole }).role ?? 'menuitem'}\n // A menu item inside a form must not submit it. `<button>` defaults to\n // type=\"submit\", and a filter or sort menu sitting in a form is ordinary.\n // Dropdown's own trigger sets it, and `Avatar` and `Menu.Item` default it\n // the same way. A caller's `submit` or `reset` still wins, and anything\n // else becomes `button`, since HTML reads a value it does not define for\n // a button as submit too; `buttonType` says more.\n //\n // After `forwarded`, reading through it rather than before it: React\n // treats `type={undefined}` as \"remove the attribute\", and a spread\n // carrying an absent key is how that arrives. Spreading the default first\n // let such a spread erase it and restore the submit behaviour, so the\n // guard only held for callers who passed nothing.\n {...(Component === 'button'\n ? { type: buttonType((forwarded as { type?: unknown }).type) }\n : {})}\n >\n {children}\n </Component>\n );\n}) as ConstrainedPolymorphicComponentWithoutRef<\n DropdownItemOwnProps,\n DropdownItemElement,\n 'a'\n>;\n\n/**\n * Bulma Dropdown divider.\n *\n * @function\n * @returns {JSX.Element} The rendered divider element.\n */\nexport const DropdownDivider: React.FC = () => (\n <hr className={usePrefixedClassNames('dropdown-divider')} />\n);\n\n/** Bulma Dropdown component with Item and Divider sub-components. */\nexport const Dropdown = withSubComponents(\n DropdownComponent,\n {\n Item: DropdownItem,\n Divider: DropdownDivider,\n },\n 'Dropdown'\n);\n\nexport default Dropdown;\n"],"names":["isBrowser","_jsxs","_jsx"],"mappings":";;;;;;;;;;;;AAqBA;;;;;;;;AAQG;MACUA,WAAS,GAAG,CAAC,GAAmB,EAAE,GAAqB,KAClE,OAAO,GAAG,KAAK,WAAW,IAAI,OAAO,GAAG,KAAK;AAoC/C;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,MAAM,iBAAiB,GA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,EACR,SAAS,EAAE,UAAU,CACnB,qBAAqB,CAAC,eAAe,EAAE;AACrC,YAAA,WAAW,EAAE,MAAM;SACpB,CAAC,EACF,kBAAkB,EAClB,SAAS,CACV,EAAA,aAAA,EACW,eAAe,KACvB,SAAS;;;;;;AAMb,QAAA,QAAQ,EAAG,SAAmC,CAAC,QAAQ,IAAI,CAAC;;;;QAI5D,IAAI,EAAG,SAAuC,CAAC,IAAI,IAAI,UAAU,EAAA,IAa5D,SAAS,KAAK;cACf,EAAE,IAAI,EAAE,UAAU,CAAE,SAAgC,CAAC,IAAI,CAAC;AAC5D,cAAE,EAAE,CAAC,YAEN,QAAQ,EAAA,CACC;AAEhB,CAAC;AAMD;;;;;AAKG;AACI,MAAM,eAAe,GAAa,OACvCA,GAAA,CAAA,IAAA,EAAA,EAAI,SAAS,EAAE,qBAAqB,CAAC,kBAAkB,CAAC,EAAA,CAAI;AAG9D;AACO,MAAM,QAAQ,GAAG,iBAAiB,CACvC,iBAAiB,EACjB;AACE,IAAA,IAAI,EAAE,YAAY;AAClB,IAAA,OAAO,EAAE,eAAe;CACzB,EACD,UAAU;;"}
@@ -6,6 +6,7 @@ import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
6
6
  import { useScrollLock } from '../helpers/scrollLock.js';
7
7
  import { useLatestRef } from '../helpers/useLatestRef.js';
8
8
  import { useOverlayStack } from '../helpers/overlayStack.js';
9
+ import { useInertSiblings } from '../helpers/useInertSiblings.js';
9
10
 
10
11
  /**
11
12
  * The `Loading` component provides a loading overlay with a spinner animation.
@@ -72,6 +73,11 @@ const Loading = ({ active = false, isFullPage = false, size, color, canCancel =
72
73
  // container covers only that, so it stays out and waits, as a Toast does,
73
74
  // until no overlay is open.
74
75
  const isTopmost = useOverlayStack(active && isFullPage);
76
+ // What the overlay covers ignores the mouse already, and is made inert so
77
+ // Tab and screen readers skip it too: the container's other children, or
78
+ // with `isFullPage` the rest of the page.
79
+ const loadingRef = React.useRef(null);
80
+ useInertSiblings(loadingRef, active, isFullPage);
75
81
  // Handle escape key. On `window`, as in `Modal`, so a popup on the page has
76
82
  // had the key first, and an Escape it closed on doesn't cancel as well. One
77
83
  // that cancels is marked used, so nothing under it acts on it too.
@@ -94,7 +100,7 @@ const Loading = ({ active = false, isFullPage = false, size, color, canCancel =
94
100
  if (!active) {
95
101
  return null;
96
102
  }
97
- return (jsxs("div", { className: combinedClasses, role: "alert", "aria-busy": "true", "aria-label": "Loading", ...rest, children: [jsx("div", { className: combinedOverlayClasses, onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { className: loadingContentClass, children: [indicator ? (jsx("span", { className: loadingIconCustomClass, children: indicator })) : (jsx("span", { className: combinedIconClasses })), children && jsx("div", { className: loadingTextClass, children: children }), canCancel && (jsx("button", { type: "button", className: loadingCancelClass, onClick: onCancel, "aria-label": "Cancel loading", children: "Cancel" }))] })] }));
103
+ return (jsxs("div", { className: combinedClasses, role: "alert", "aria-busy": "true", "aria-label": "Loading", ...rest, ref: loadingRef, children: [jsx("div", { className: combinedOverlayClasses, onClick: handleOverlayClick, "aria-hidden": "true" }), jsxs("div", { className: loadingContentClass, children: [indicator ? (jsx("span", { className: loadingIconCustomClass, children: indicator })) : (jsx("span", { className: combinedIconClasses })), children && jsx("div", { className: loadingTextClass, children: children }), canCancel && (jsx("button", { type: "button", className: loadingCancelClass, onClick: onCancel, "aria-label": "Cancel loading", children: "Cancel" }))] })] }));
98
104
  };
99
105
 
100
106
  export { Loading };
@@ -1 +1 @@
1
- {"version":3,"file":"Loading.js","sources":["../../../src/components/Loading.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useScrollLock } from '../helpers/scrollLock';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\n\n/**\n * Overlay opacity levels for the Loading background.\n */\nexport type LoadingOverlay = 'light' | 'dark' | 'opaque';\n\n/**\n * Color variants for the Loading spinner.\n */\nexport type LoadingColor =\n 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Props for the Loading component.\n * @extraProp {React.ReactNode} [children] - Content to display below the spinner.\n * @extraProp {string} [className] - Additional CSS classes.\n */\nexport interface LoadingProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {\n /** Whether the loading overlay is visible. */\n active?: boolean;\n /**\n * Cover the entire viewport. A full-page loading also takes its turn with\n * Modal and Sidebar for Escape: while it's the topmost open overlay, the\n * Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or\n * not the loading can be cancelled.\n */\n isFullPage?: boolean;\n /** Size of the loading spinner. */\n size?: 'small' | 'medium' | 'large';\n /** Color variant for the spinner. Default is light grey. */\n color?: LoadingColor;\n /**\n * Show a cancel button and allow closing, by a click on the overlay or by\n * Escape. With `isFullPage`, the loading is an overlay like Modal and\n * Sidebar: only the topmost open overlay answers Escape, so a full-page\n * loading shown over a Modal cancels first, and the Modal closes on the\n * next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or\n * full-page Loading is open. Either way it marks the Escape it cancels on as\n * used with `preventDefault()`. An Escape a popup on the page closed on, by\n * calling `preventDefault()`, doesn't cancel.\n */\n canCancel?: boolean;\n /** Callback when cancel is triggered. */\n onCancel?: () => void;\n /** Additional classes for the overlay. */\n overlayClassName?: string;\n /** Additional classes for the spinner icon. */\n iconClassName?: string;\n /** Custom loading indicator element. */\n indicator?: React.ReactNode;\n /** Style of the loading overlay. */\n overlay?: LoadingOverlay;\n}\n\n/**\n * The `Loading` component provides a loading overlay with a spinner animation.\n *\n * @function\n * @param {LoadingProps} props - Props for the Loading component.\n * @returns {JSX.Element | null} The rendered loading overlay or null if not active.\n *\n * @example\n * // Full page loading\n * <Loading active isFullPage />\n *\n * @example\n * // Container loading with message\n * <div style={{ position: 'relative', height: '200px' }}>\n * <Loading active>Loading data...</Loading>\n * </div>\n *\n * @example\n * // With color variant\n * <Loading active color=\"primary\" />\n *\n * @example\n * // With cancel functionality\n * <Loading\n * active={isLoading}\n * canCancel\n * onCancel={() => setIsLoading(false)}\n * />\n */\nexport const Loading: React.FC<LoadingProps> = ({\n active = false,\n isFullPage = false,\n size,\n color,\n canCancel = false,\n onCancel,\n children,\n className,\n overlayClassName,\n iconClassName,\n indicator,\n overlay,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const loadingClasses = usePrefixedClassNames('loading', {\n 'is-active': active,\n 'is-full-page': isFullPage,\n 'is-cancelable': canCancel,\n [`is-${overlay}`]: !!overlay,\n [`is-${color}`]: !!color,\n });\n\n const iconClasses = usePrefixedClassNames('loading-icon', {\n [`is-${size}`]: size,\n });\n\n // Combine classes\n const combinedClasses = classNames(\n loadingClasses,\n bulmaHelperClasses,\n className\n );\n const combinedOverlayClasses = classNames(\n usePrefixedClassNames('loading-overlay'),\n overlayClassName\n );\n const combinedIconClasses = classNames(iconClasses, iconClassName);\n const loadingContentClass = usePrefixedClassNames('loading-content');\n const loadingIconCustomClass = usePrefixedClassNames('loading-icon-custom');\n const loadingTextClass = usePrefixedClassNames('loading-text');\n const loadingCancelClass = usePrefixedClassNames('loading-cancel');\n\n // Handle cancel click\n const handleOverlayClick = () => {\n if (canCancel && onCancel) {\n onCancel();\n }\n };\n\n // Read when Escape arrives, so the key listener stays put while `onCancel`\n // changes identity, as an inline one does on every render of the parent.\n const onCancelRef = useLatestRef(onCancel);\n const hasOnCancel = Boolean(onCancel);\n\n // A full-page loading covers everything under it, so it joins the stack of\n // open overlays and takes Escape from them while it's on top. One inside a\n // container covers only that, so it stays out and waits, as a Toast does,\n // until no overlay is open.\n const isTopmost = useOverlayStack(active && isFullPage);\n\n // Handle escape key. On `window`, as in `Modal`, so a popup on the page has\n // had the key first, and an Escape it closed on doesn't cancel as well. One\n // that cancels is marked used, so nothing under it acts on it too.\n React.useEffect(() => {\n if (!active || !canCancel || !hasOnCancel) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' || e.defaultPrevented || !isTopmost()) return;\n e.preventDefault();\n onCancelRef.current?.();\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [active, canCancel, hasOnCancel, onCancelRef, isTopmost]);\n\n // Prevent body scroll when full page loading is active. Ref-counted through\n // the shared helper so an overlapping Modal/Dialog/Sidebar doesn't have its\n // lock cleared when this one releases.\n useScrollLock(isFullPage && active);\n\n if (!active) {\n return null;\n }\n\n return (\n <div\n className={combinedClasses}\n role=\"alert\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n {...rest}\n >\n <div\n className={combinedOverlayClasses}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n <div className={loadingContentClass}>\n {indicator ? (\n <span className={loadingIconCustomClass}>{indicator}</span>\n ) : (\n <span className={combinedIconClasses} />\n )}\n {children && <div className={loadingTextClass}>{children}</div>}\n {canCancel && (\n <button\n type=\"button\"\n className={loadingCancelClass}\n onClick={onCancel}\n aria-label=\"Cancel loading\"\n >\n Cancel\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AA+DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,OAAO,GAA2B,CAAC,EAC9C,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;;AAG3D,IAAA,MAAM,cAAc,GAAG,qBAA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AAS,KACRA,gBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,QAAQ,gBACN,gBAAgB,EAAA,QAAA,EAAA,QAAA,EAAA,CAGpB,CACV,CAAA,EAAA,CACG,CAAA,EAAA,CACF;AAEV;;"}
1
+ {"version":3,"file":"Loading.js","sources":["../../../src/components/Loading.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport { useScrollLock } from '../helpers/scrollLock';\nimport { useLatestRef } from '../helpers/useLatestRef';\nimport { useOverlayStack } from '../helpers/overlayStack';\nimport { useInertSiblings } from '../helpers/useInertSiblings';\n\n/**\n * Overlay opacity levels for the Loading background.\n */\nexport type LoadingOverlay = 'light' | 'dark' | 'opaque';\n\n/**\n * Color variants for the Loading spinner.\n */\nexport type LoadingColor =\n 'primary' | 'link' | 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * Props for the Loading component.\n * @extraProp {React.ReactNode} [children] - Content to display below the spinner.\n * @extraProp {string} [className] - Additional CSS classes.\n */\nexport interface LoadingProps\n extends\n Omit<React.HTMLAttributes<HTMLDivElement>, 'color'>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor' | 'size' | 'overlay'> {\n /**\n * Whether the loading overlay is visible. While it is, what it covers is\n * inert, out of reach of Tab, Enter, Space and screen readers as well as\n * the mouse: the other children of the element it's rendered in, so render\n * it directly inside the element it covers, or with `isFullPage` the rest\n * of the page. Its own content, the cancel button included, stays\n * reachable. Only what's there when it turns on is made inert, and an\n * element that was inert already is left as it was. A control under it\n * that had focus loses it, and gets it back when the loading goes away,\n * unless focus has moved on in the meantime. Show one at a time over the\n * same content: two that cover each other, such as two in one container\n * or two full-page ones, make each other inert, cancel buttons and all.\n */\n active?: boolean;\n /**\n * Cover the entire viewport. While it's active, the rest of the page is\n * inert, as it is under a modal, rather than only the element it's\n * rendered in. A full-page loading also takes its turn with\n * Modal and Sidebar for Escape: while it's the topmost open overlay, the\n * Modal or Sidebar under it doesn't answer Escape or hold Tab, whether or\n * not the loading can be cancelled.\n */\n isFullPage?: boolean;\n /** Size of the loading spinner. */\n size?: 'small' | 'medium' | 'large';\n /** Color variant for the spinner. Default is light grey. */\n color?: LoadingColor;\n /**\n * Show a cancel button and allow closing, by a click on the overlay or by\n * Escape. With `isFullPage`, the loading is an overlay like Modal and\n * Sidebar: only the topmost open overlay answers Escape, so a full-page\n * loading shown over a Modal cancels first, and the Modal closes on the\n * next Escape. Without it, Escape cancels once no Modal, Dialog, Sidebar or\n * full-page Loading is open. Either way it marks the Escape it cancels on as\n * used with `preventDefault()`. An Escape a popup on the page closed on, by\n * calling `preventDefault()`, doesn't cancel.\n */\n canCancel?: boolean;\n /** Callback when cancel is triggered. */\n onCancel?: () => void;\n /** Additional classes for the overlay. */\n overlayClassName?: string;\n /** Additional classes for the spinner icon. */\n iconClassName?: string;\n /** Custom loading indicator element. */\n indicator?: React.ReactNode;\n /** Style of the loading overlay. */\n overlay?: LoadingOverlay;\n}\n\n/**\n * The `Loading` component provides a loading overlay with a spinner animation.\n *\n * @function\n * @param {LoadingProps} props - Props for the Loading component.\n * @returns {JSX.Element | null} The rendered loading overlay or null if not active.\n *\n * @example\n * // Full page loading\n * <Loading active isFullPage />\n *\n * @example\n * // Container loading with message\n * <div style={{ position: 'relative', height: '200px' }}>\n * <Loading active>Loading data...</Loading>\n * </div>\n *\n * @example\n * // With color variant\n * <Loading active color=\"primary\" />\n *\n * @example\n * // With cancel functionality\n * <Loading\n * active={isLoading}\n * canCancel\n * onCancel={() => setIsLoading(false)}\n * />\n */\nexport const Loading: React.FC<LoadingProps> = ({\n active = false,\n isFullPage = false,\n size,\n color,\n canCancel = false,\n onCancel,\n children,\n className,\n overlayClassName,\n iconClassName,\n indicator,\n overlay,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses(props);\n\n // Generate Bulma classes with prefix\n const loadingClasses = usePrefixedClassNames('loading', {\n 'is-active': active,\n 'is-full-page': isFullPage,\n 'is-cancelable': canCancel,\n [`is-${overlay}`]: !!overlay,\n [`is-${color}`]: !!color,\n });\n\n const iconClasses = usePrefixedClassNames('loading-icon', {\n [`is-${size}`]: size,\n });\n\n // Combine classes\n const combinedClasses = classNames(\n loadingClasses,\n bulmaHelperClasses,\n className\n );\n const combinedOverlayClasses = classNames(\n usePrefixedClassNames('loading-overlay'),\n overlayClassName\n );\n const combinedIconClasses = classNames(iconClasses, iconClassName);\n const loadingContentClass = usePrefixedClassNames('loading-content');\n const loadingIconCustomClass = usePrefixedClassNames('loading-icon-custom');\n const loadingTextClass = usePrefixedClassNames('loading-text');\n const loadingCancelClass = usePrefixedClassNames('loading-cancel');\n\n // Handle cancel click\n const handleOverlayClick = () => {\n if (canCancel && onCancel) {\n onCancel();\n }\n };\n\n // Read when Escape arrives, so the key listener stays put while `onCancel`\n // changes identity, as an inline one does on every render of the parent.\n const onCancelRef = useLatestRef(onCancel);\n const hasOnCancel = Boolean(onCancel);\n\n // A full-page loading covers everything under it, so it joins the stack of\n // open overlays and takes Escape from them while it's on top. One inside a\n // container covers only that, so it stays out and waits, as a Toast does,\n // until no overlay is open.\n const isTopmost = useOverlayStack(active && isFullPage);\n\n // What the overlay covers ignores the mouse already, and is made inert so\n // Tab and screen readers skip it too: the container's other children, or\n // with `isFullPage` the rest of the page.\n const loadingRef = React.useRef<HTMLDivElement>(null);\n useInertSiblings(loadingRef, active, isFullPage);\n\n // Handle escape key. On `window`, as in `Modal`, so a popup on the page has\n // had the key first, and an Escape it closed on doesn't cancel as well. One\n // that cancels is marked used, so nothing under it acts on it too.\n React.useEffect(() => {\n if (!active || !canCancel || !hasOnCancel) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Escape' || e.defaultPrevented || !isTopmost()) return;\n e.preventDefault();\n onCancelRef.current?.();\n };\n\n window.addEventListener('keydown', handleKeyDown);\n return () => window.removeEventListener('keydown', handleKeyDown);\n }, [active, canCancel, hasOnCancel, onCancelRef, isTopmost]);\n\n // Prevent body scroll when full page loading is active. Ref-counted through\n // the shared helper so an overlapping Modal/Dialog/Sidebar doesn't have its\n // lock cleared when this one releases.\n useScrollLock(isFullPage && active);\n\n if (!active) {\n return null;\n }\n\n return (\n <div\n className={combinedClasses}\n role=\"alert\"\n aria-busy=\"true\"\n aria-label=\"Loading\"\n {...rest}\n ref={loadingRef}\n >\n <div\n className={combinedOverlayClasses}\n onClick={handleOverlayClick}\n aria-hidden=\"true\"\n />\n <div className={loadingContentClass}>\n {indicator ? (\n <span className={loadingIconCustomClass}>{indicator}</span>\n ) : (\n <span className={combinedIconClasses} />\n )}\n {children && <div className={loadingTextClass}>{children}</div>}\n {canCancel && (\n <button\n type=\"button\"\n className={loadingCancelClass}\n onClick={onCancel}\n aria-label=\"Cancel loading\"\n >\n Cancel\n </button>\n )}\n </div>\n </div>\n );\n};\n\nexport default Loading;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;;AA8EA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACI,MAAM,OAAO,GAA2B,CAAC,EAC9C,MAAM,GAAG,KAAK,EACd,UAAU,GAAG,KAAK,EAClB,IAAI,EACJ,KAAK,EACL,SAAS,GAAG,KAAK,EACjB,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,OAAO,EACP,GAAG,KAAK,EACT,KAAI;IACH,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC;;AAG3D,IAAA,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,EAAE;AACtD,QAAA,WAAW,EAAE,MAAM;AACnB,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,eAAe,EAAE,SAAS;AAC1B,QAAA,CAAC,MAAM,OAAO,CAAA,CAAE,GAAG,CAAC,CAAC,OAAO;AAC5B,QAAA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,EACb,SAAS,EAAE,kBAAkB,EAC7B,OAAO,EAAE,QAAQ,EAAA,YAAA,EACN,gBAAgB,uBAGpB,CACV,CAAA,EAAA,CACG,CAAA,EAAA,CACF;AAEV;;"}
@@ -3,8 +3,25 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { classNames, usePrefixedClassNames } from '../helpers/classNames.js';
4
4
  import { withSubComponents } from '../helpers/withSubComponents.js';
5
5
  import { useBulmaClasses } from '../helpers/useBulmaClasses.js';
6
+ import { ANCHOR_ONLY_ATTRS, omitAttrs } from '../helpers/anchorAttrs.js';
6
7
  import { Icon } from '../elements/Icon.js';
7
8
 
9
+ /**
10
+ * The set withheld from a non-label `Panel.Block`, keyed so it stops compiling
11
+ * until a label attribute React adds is named here.
12
+ */
13
+ const STRIP_FROM_NON_LABEL = {
14
+ form: true,
15
+ htmlFor: true,
16
+ };
17
+ /**
18
+ * The set withheld from a non-anchor `Panel.Block`: the derived anchor-only
19
+ * attributes plus `rel`, which React declares on every element, withheld the
20
+ * way `Level.Item` and `Card.FooterItem` withhold it.
21
+ */
22
+ const STRIP_FROM_NON_ANCHOR$1 = { ...ANCHOR_ONLY_ATTRS, rel: true };
23
+ /** A `<div>` block takes neither set. */
24
+ const STRIP_FROM_DIV = { ...STRIP_FROM_NON_ANCHOR$1, ...STRIP_FROM_NON_LABEL };
8
25
  /**
9
26
  * The `Panel` component implements Bulma's versatile panel block for React.
10
27
  *
@@ -13,7 +30,7 @@ import { Icon } from '../elements/Icon.js';
13
30
  * @returns {JSX.Element} The rendered panel.
14
31
  * @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}
15
32
  */
16
- const PanelComponent = ({ color, className, children, ...props }) => {
33
+ const PanelComponent = ({ as: Tag = 'nav', color, className, children, ...props }) => {
17
34
  const { bulmaHelperClasses, rest } = useBulmaClasses({
18
35
  color,
19
36
  ...props,
@@ -23,7 +40,7 @@ const PanelComponent = ({ color, className, children, ...props }) => {
23
40
  [`is-${color}`]: color,
24
41
  });
25
42
  const panelClasses = classNames(bulmaClasses, bulmaHelperClasses, className);
26
- return (jsx("nav", { className: panelClasses, ...rest, children: children }));
43
+ return (jsx(Tag, { className: panelClasses, ...rest, children: children }));
27
44
  };
28
45
  /**
29
46
  * Main heading (renders as `<p class="panel-heading">`)
@@ -42,13 +59,26 @@ const PanelHeading = ({ className, children, ...props }) => (jsx("p", { classNam
42
59
  */
43
60
  const PanelTabs = ({ className, children, ...props }) => (jsx("p", { className: classNames(usePrefixedClassNames('panel-tabs'), className), ...props, children: children }));
44
61
  /**
45
- * Individual panel block (renders as `<a class="panel-block">`)
62
+ * Individual panel block (renders as `<a class="panel-block">` unless `as` says otherwise)
46
63
  *
47
64
  * @function
48
65
  * @param {PanelBlockProps} props - Props for the PanelBlock component.
49
66
  * @returns {JSX.Element} The rendered panel block.
50
67
  */
51
- const PanelBlock = ({ className, active, children, ...props }) => (jsx("a", { className: classNames(usePrefixedClassNames('panel-block', { 'is-active': active }), className), ...props, children: children }));
68
+ const PanelBlock = ((blockProps) => {
69
+ const { as: Tag = 'a', className, active, children, ...props } = blockProps;
70
+ const blockClasses = classNames(usePrefixedClassNames('panel-block', { 'is-active': active }), className);
71
+ // The anchor's own attributes reach an `<a>` and nothing else, and the
72
+ // label's a `<label>`; the sets above say which those are. The type already
73
+ // keeps them off the other tags, so this is for a plain-JS caller, a loose
74
+ // `{...props}` spread, and the genericity a wrapping HOC erases.
75
+ const forwarded = Tag === 'a'
76
+ ? omitAttrs(props, STRIP_FROM_NON_LABEL)
77
+ : Tag === 'label'
78
+ ? omitAttrs(props, STRIP_FROM_NON_ANCHOR$1)
79
+ : omitAttrs(props, STRIP_FROM_DIV);
80
+ return (jsx(Tag, { className: blockClasses, ...forwarded, children: children }));
81
+ });
52
82
  /**
53
83
  * Icon wrapper with panel styling (renders as `<span class="panel-icon">`, containing an
54
84
  * `<i/>` when a `name` is given, or the custom node passed as `children`).
@@ -1 +1 @@
1
- {"version":3,"file":"Panel.js","sources":["../../../src/components/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n Icon,\n IconChildrenProps,\n IconDeprecatedProps,\n IconNameProps,\n} from '../elements/Icon';\n\n/**\n * Props for the Panel component.\n */\nexport interface PanelProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /** Bulma color modifier for the panel. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Additional CSS classes. */\n className?: string;\n /** Panel content (usually includes subcomponents). */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelHeading component.\n */\nexport interface PanelHeadingProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Heading content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelTabs component.\n */\nexport interface PanelTabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Tabs content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelBlock component.\n */\nexport interface PanelBlockProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Whether the block is active. */\n active?: boolean;\n /** Block content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelIcon component.\n * Extends IconProps but uses 'panel-icon' as the container class.\n */\nexport type PanelIconProps =\n | Omit<IconNameProps, 'containerClassName'>\n | Omit<IconChildrenProps, 'containerClassName'>\n // `PanelIcon` spreads straight into `<Icon>`, so every member of `IconProps`\n // reaches it. Enumerating them by hand is what left the deprecated `icon`\n // path compiling on `Icon` and failing here, with an error naming `children`.\n | Omit<IconDeprecatedProps, 'containerClassName'>;\n\n/**\n * Props for the PanelInputBlock component.\n */\nexport interface PanelInputBlockProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Input value. */\n value?: string;\n /** Input change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Input placeholder. */\n placeholder?: string;\n /** Icon class for left icon (default 'fas fa-search'). */\n iconClassName?: string;\n}\n\n/**\n * Props for the PanelCheckboxBlock component.\n */\nexport interface PanelCheckboxBlockProps extends Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n 'onChange'\n> {\n /** Whether the checkbox is checked. */\n checked?: boolean;\n /** Checkbox change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Label/content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelButtonBlock component.\n */\nexport interface PanelButtonBlockProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Panel` component implements Bulma's versatile panel block for React.\n *\n * @function\n * @param {PanelProps} props - Props for the Panel component.\n * @returns {JSX.Element} The rendered panel.\n * @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}\n */\nconst PanelComponent: React.FC<PanelProps> = ({\n color,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color,\n ...props,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('panel', {\n [`is-${color}`]: color,\n });\n\n const panelClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <nav className={panelClasses} {...rest}>\n {children}\n </nav>\n );\n};\n\n/**\n * Main heading (renders as `<p class=\"panel-heading\">`)\n *\n * @function\n * @param {PanelHeadingProps} props - Props for the PanelHeading component.\n * @returns {JSX.Element} The rendered panel heading.\n */\nexport const PanelHeading: React.FC<PanelHeadingProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-heading'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Panel tabs (renders as `<p class=\"panel-tabs\">`)\n *\n * @function\n * @param {PanelTabsProps} props - Props for the PanelTabs component.\n * @returns {JSX.Element} The rendered panel tabs.\n */\nexport const PanelTabs: React.FC<PanelTabsProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-tabs'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Individual panel block (renders as `<a class=\"panel-block\">`)\n *\n * @function\n * @param {PanelBlockProps} props - Props for the PanelBlock component.\n * @returns {JSX.Element} The rendered panel block.\n */\nexport const PanelBlock: React.FC<PanelBlockProps> = ({\n className,\n active,\n children,\n ...props\n}) => (\n <a\n className={classNames(\n usePrefixedClassNames('panel-block', { 'is-active': active }),\n className\n )}\n {...props}\n >\n {children}\n </a>\n);\n\n/**\n * Icon wrapper with panel styling (renders as `<span class=\"panel-icon\">`, containing an\n * `<i/>` when a `name` is given, or the custom node passed as `children`).\n * Accepts all Icon props (`name`, `variant`, `features`, etc.), or `children` for a custom node.\n *\n * @function\n * @param {PanelIconProps} props - Props for the PanelIcon component.\n * @returns {JSX.Element} The rendered panel icon.\n */\nexport const PanelIcon: React.FC<PanelIconProps> = ({\n className,\n ...props\n}) => (\n <Icon\n containerClassName={classNames(\n usePrefixedClassNames('panel-icon'),\n className\n )}\n {...props}\n />\n);\n\n/**\n * Search input with icon (renders as `<div class=\"panel-block\">`)\n *\n * @function\n * @param {PanelInputBlockProps} props - Props for the PanelInputBlock component.\n * @returns {JSX.Element} The rendered panel input block.\n */\nexport const PanelInputBlock: React.FC<PanelInputBlockProps> = ({\n value,\n onChange,\n placeholder,\n iconClassName = 'fas fa-search',\n ...props\n}) => {\n const inputClass = usePrefixedClassNames('input');\n\n return (\n <div className={usePrefixedClassNames('panel-block')} {...props}>\n <p className={usePrefixedClassNames('control', 'has-icons-left')}>\n <input\n className={inputClass}\n type=\"text\"\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n />\n <span className={usePrefixedClassNames('icon', 'is-left')}>\n <i className={iconClassName} aria-hidden=\"true\"></i>\n </span>\n </p>\n </div>\n );\n};\n\n/**\n * Checkbox block (renders as `<label class=\"panel-block\">`)\n *\n * @function\n * @param {PanelCheckboxBlockProps} props - Props for the PanelCheckboxBlock component.\n * @returns {JSX.Element} The rendered panel checkbox block.\n */\nexport const PanelCheckboxBlock: React.FC<PanelCheckboxBlockProps> = ({\n checked,\n onChange,\n children,\n ...props\n}) => (\n <label className={usePrefixedClassNames('panel-block')} {...props}>\n <input type=\"checkbox\" checked={checked} onChange={onChange} />\n {children}\n </label>\n);\n\n/**\n * Call-to-action button (renders as `<div class=\"panel-block\"><button /></div>`)\n *\n * @function\n * @param {PanelButtonBlockProps} props - Props for the PanelButtonBlock component.\n * @returns {JSX.Element} The rendered panel button block.\n */\nexport const PanelButtonBlock: React.FC<PanelButtonBlockProps> = ({\n children,\n className,\n ...props\n}) => (\n <div className={usePrefixedClassNames('panel-block')}>\n <button\n className={classNames(\n usePrefixedClassNames(\n 'button',\n 'is-link',\n 'is-outlined',\n 'is-fullwidth'\n ),\n className\n )}\n {...props}\n >\n {children}\n </button>\n </div>\n);\n\nexport const Panel = withSubComponents(\n PanelComponent,\n {\n Heading: PanelHeading,\n Tabs: PanelTabs,\n Block: PanelBlock,\n Icon: PanelIcon,\n InputBlock: PanelInputBlock,\n CheckboxBlock: PanelCheckboxBlock,\n ButtonBlock: PanelButtonBlock,\n },\n 'Panel'\n);\n\nexport default Panel;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;AAqHA;;;;;;;AAOG;AACH,MAAM,cAAc,GAAyB,CAAC,EAC5C,KAAK,EACL,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK;AACL,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;;AAGF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,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CAAC,EAChE,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,MACCA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,qBAAqB,CAAC,aAAa,CAAC,EAAA,QAAA,EAClDA,gBACE,SAAS,EAAE,UAAU,CACnB,qBAAqB,CACnB,QAAQ,EACR,SAAS,EACT,aAAa,EACb,cAAc,CACf,EACD,SAAS,CACV,EAAA,GACG,KAAK,YAER,QAAQ,EAAA,CACF,EAAA,CACL;AAGD,MAAM,KAAK,GAAG,iBAAiB,CACpC,cAAc,EACd;AACE,IAAA,OAAO,EAAE,YAAY;AACrB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,KAAK,EAAE,UAAU;AACjB,IAAA,IAAI,EAAE,SAAS;AACf,IAAA,UAAU,EAAE,eAAe;AAC3B,IAAA,aAAa,EAAE,kBAAkB;AACjC,IAAA,WAAW,EAAE,gBAAgB;CAC9B,EACD,OAAO;;"}
1
+ {"version":3,"file":"Panel.js","sources":["../../../src/components/Panel.tsx"],"sourcesContent":["import React from 'react';\nimport { classNames, usePrefixedClassNames } from '../helpers/classNames';\nimport { withSubComponents } from '../helpers/withSubComponents';\nimport { useBulmaClasses, BulmaClassesProps } from '../helpers/useBulmaClasses';\nimport {\n ANCHOR_ONLY_ATTRS,\n type AnchorOnlyAttributes,\n omitAttrs,\n} from '../helpers/anchorAttrs';\nimport type { ConstrainedPolymorphicComponentWithoutRef } from '../helpers/polymorphic';\nimport {\n Icon,\n IconChildrenProps,\n IconDeprecatedProps,\n IconNameProps,\n} from '../elements/Icon';\n\n/**\n * Props for the Panel component.\n */\nexport interface PanelProps\n extends\n React.HTMLAttributes<HTMLElement>,\n Omit<BulmaClassesProps, 'color' | 'backgroundColor'> {\n /**\n * HTML element to render (default: `nav`). A `nav` is a `navigation`\n * landmark, which suits a panel of links; a panel that is not navigation\n * takes another tag. Bulma's own colored panels use `article`. A `section`\n * is a `region` landmark only once it has an accessible name, such as\n * `aria-labelledby` pointing at the `id` of its `Panel.Heading`.\n */\n as?: 'nav' | 'article' | 'section' | 'aside' | 'div';\n /** Bulma color modifier for the panel. */\n color?:\n | 'primary'\n | 'link'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'black'\n | 'dark'\n | 'light'\n | 'white';\n /** Additional CSS classes. */\n className?: string;\n /** Panel content (usually includes subcomponents). */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelHeading component.\n */\nexport interface PanelHeadingProps extends React.HTMLAttributes<HTMLParagraphElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Heading content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelTabs component.\n */\nexport interface PanelTabsProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Additional CSS classes. */\n className?: string;\n /** Tabs content. */\n children?: React.ReactNode;\n}\n\n/**\n * What `<label>` adds over the attributes every element has (`htmlFor` and\n * `form`), subtracted from React's types the way `AnchorOnlyAttributes` is, so\n * it grows when React's does.\n */\ntype LabelOnlyAttributes = Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n keyof React.HTMLAttributes<HTMLLabelElement>\n>;\n\n/**\n * The set withheld from a non-label `Panel.Block`, keyed so it stops compiling\n * until a label attribute React adds is named here.\n */\nconst STRIP_FROM_NON_LABEL: Readonly<Record<keyof LabelOnlyAttributes, true>> =\n {\n form: true,\n htmlFor: true,\n };\n\n/**\n * The set withheld from a non-anchor `Panel.Block`: the derived anchor-only\n * attributes plus `rel`, which React declares on every element, withheld the\n * way `Level.Item` and `Card.FooterItem` withhold it.\n */\nconst STRIP_FROM_NON_ANCHOR: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel', true>\n> = { ...ANCHOR_ONLY_ATTRS, rel: true };\n\n/** A `<div>` block takes neither set. */\nconst STRIP_FROM_DIV: Readonly<\n Record<keyof AnchorOnlyAttributes | 'rel' | keyof LabelOnlyAttributes, true>\n> = { ...STRIP_FROM_NON_ANCHOR, ...STRIP_FROM_NON_LABEL };\n\n/**\n * The elements a panel block may render as: the tags Bulma's panel markup\n * puts `.panel-block` on.\n */\nexport type PanelBlockElement = 'a' | 'div' | 'label';\n\n/**\n * The PanelBlock component's own props.\n */\nexport interface PanelBlockOwnProps {\n /** Additional CSS classes. */\n className?: string;\n /** Whether the block is active. */\n active?: boolean;\n /** Block content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelBlock component. Everything the block does not own\n * follows `as`: the anchor's attributes and an `HTMLAnchorElement`\n * `currentTarget` under the default `'a'`, `htmlFor` under `'label'`, and the\n * shared HTML attributes under any of them.\n *\n * The type parameter defaults to `'a'`, the element a block renders with no\n * `as`, rather than to the whole union the way `DropdownItemProps` does. Before\n * `as` existed this type was the anchor's attributes, so bare\n * `PanelBlockProps` stays exactly that, `href` and anchor-typed handlers\n * included. Write `PanelBlockProps<'div'>` or `PanelBlockProps<'label'>` for\n * the others.\n */\nexport type PanelBlockProps<T extends PanelBlockElement = 'a'> =\n PanelBlockOwnProps &\n Omit<React.ComponentPropsWithoutRef<T>, keyof PanelBlockOwnProps | 'as'> & {\n /**\n * HTML element to render (default: `a`). Bulma styles a `label` block\n * as clickable, like an `a`, and a `div` block as static content, such\n * as a table. The props follow the tag, so the anchor attributes\n * (`href`, `target`, `download` and the rest) are typed only on an `a`\n * and `htmlFor` only on a `label`; at runtime the block also drops them,\n * and `rel`, on the other tags. `Panel.CheckboxBlock`,\n * `Panel.InputBlock` and `Panel.ButtonBlock` render the usual `label`\n * and `div` blocks with their contents.\n */\n as?: T;\n };\n\n/**\n * The shape the implementation destructures. The public contract is the\n * generic `PanelBlockProps<T>` above, which the body cannot see through.\n */\ntype PanelBlockImplProps = PanelBlockOwnProps & {\n as?: PanelBlockElement;\n};\n\n/**\n * Props for the PanelIcon component.\n * Extends IconProps but uses 'panel-icon' as the container class.\n */\nexport type PanelIconProps =\n | Omit<IconNameProps, 'containerClassName'>\n | Omit<IconChildrenProps, 'containerClassName'>\n // `PanelIcon` spreads straight into `<Icon>`, so every member of `IconProps`\n // reaches it. Enumerating them by hand is what left the deprecated `icon`\n // path compiling on `Icon` and failing here, with an error naming `children`.\n | Omit<IconDeprecatedProps, 'containerClassName'>;\n\n/**\n * Props for the PanelInputBlock component.\n */\nexport interface PanelInputBlockProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Input value. */\n value?: string;\n /** Input change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Input placeholder. */\n placeholder?: string;\n /** Icon class for left icon (default 'fas fa-search'). */\n iconClassName?: string;\n}\n\n/**\n * Props for the PanelCheckboxBlock component.\n */\nexport interface PanelCheckboxBlockProps extends Omit<\n React.LabelHTMLAttributes<HTMLLabelElement>,\n 'onChange'\n> {\n /** Whether the checkbox is checked. */\n checked?: boolean;\n /** Checkbox change handler. */\n onChange?: React.ChangeEventHandler<HTMLInputElement>;\n /** Label/content. */\n children?: React.ReactNode;\n}\n\n/**\n * Props for the PanelButtonBlock component.\n */\nexport interface PanelButtonBlockProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button content. */\n children?: React.ReactNode;\n}\n\n/**\n * The `Panel` component implements Bulma's versatile panel block for React.\n *\n * @function\n * @param {PanelProps} props - Props for the Panel component.\n * @returns {JSX.Element} The rendered panel.\n * @see {@link https://bulma.io/documentation/components/panel/ | Bulma Panel documentation}\n */\nconst PanelComponent: React.FC<PanelProps> = ({\n as: Tag = 'nav',\n color,\n className,\n children,\n ...props\n}) => {\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n color,\n ...props,\n });\n\n // Generate Bulma classes with prefix\n const bulmaClasses = usePrefixedClassNames('panel', {\n [`is-${color}`]: color,\n });\n\n const panelClasses = classNames(bulmaClasses, bulmaHelperClasses, className);\n\n return (\n <Tag className={panelClasses} {...rest}>\n {children}\n </Tag>\n );\n};\n\n/**\n * Main heading (renders as `<p class=\"panel-heading\">`)\n *\n * @function\n * @param {PanelHeadingProps} props - Props for the PanelHeading component.\n * @returns {JSX.Element} The rendered panel heading.\n */\nexport const PanelHeading: React.FC<PanelHeadingProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-heading'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Panel tabs (renders as `<p class=\"panel-tabs\">`)\n *\n * @function\n * @param {PanelTabsProps} props - Props for the PanelTabs component.\n * @returns {JSX.Element} The rendered panel tabs.\n */\nexport const PanelTabs: React.FC<PanelTabsProps> = ({\n className,\n children,\n ...props\n}) => (\n <p\n className={classNames(usePrefixedClassNames('panel-tabs'), className)}\n {...props}\n >\n {children}\n </p>\n);\n\n/**\n * Individual panel block (renders as `<a class=\"panel-block\">` unless `as` says otherwise)\n *\n * @function\n * @param {PanelBlockProps} props - Props for the PanelBlock component.\n * @returns {JSX.Element} The rendered panel block.\n */\nexport const PanelBlock = ((blockProps: PanelBlockProps) => {\n const {\n as: Tag = 'a',\n className,\n active,\n children,\n ...props\n } = blockProps as PanelBlockImplProps;\n const blockClasses = classNames(\n usePrefixedClassNames('panel-block', { 'is-active': active }),\n className\n );\n // The anchor's own attributes reach an `<a>` and nothing else, and the\n // label's a `<label>`; the sets above say which those are. The type already\n // keeps them off the other tags, so this is for a plain-JS caller, a loose\n // `{...props}` spread, and the genericity a wrapping HOC erases.\n const forwarded =\n Tag === 'a'\n ? omitAttrs(props, STRIP_FROM_NON_LABEL)\n : Tag === 'label'\n ? omitAttrs(props, STRIP_FROM_NON_ANCHOR)\n : omitAttrs(props, STRIP_FROM_DIV);\n return (\n <Tag className={blockClasses} {...forwarded}>\n {children}\n </Tag>\n );\n}) as ConstrainedPolymorphicComponentWithoutRef<\n PanelBlockOwnProps,\n PanelBlockElement,\n 'a'\n>;\n\n/**\n * Icon wrapper with panel styling (renders as `<span class=\"panel-icon\">`, containing an\n * `<i/>` when a `name` is given, or the custom node passed as `children`).\n * Accepts all Icon props (`name`, `variant`, `features`, etc.), or `children` for a custom node.\n *\n * @function\n * @param {PanelIconProps} props - Props for the PanelIcon component.\n * @returns {JSX.Element} The rendered panel icon.\n */\nexport const PanelIcon: React.FC<PanelIconProps> = ({\n className,\n ...props\n}) => (\n <Icon\n containerClassName={classNames(\n usePrefixedClassNames('panel-icon'),\n className\n )}\n {...props}\n />\n);\n\n/**\n * Search input with icon (renders as `<div class=\"panel-block\">`)\n *\n * @function\n * @param {PanelInputBlockProps} props - Props for the PanelInputBlock component.\n * @returns {JSX.Element} The rendered panel input block.\n */\nexport const PanelInputBlock: React.FC<PanelInputBlockProps> = ({\n value,\n onChange,\n placeholder,\n iconClassName = 'fas fa-search',\n ...props\n}) => {\n const inputClass = usePrefixedClassNames('input');\n\n return (\n <div className={usePrefixedClassNames('panel-block')} {...props}>\n <p className={usePrefixedClassNames('control', 'has-icons-left')}>\n <input\n className={inputClass}\n type=\"text\"\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n />\n <span className={usePrefixedClassNames('icon', 'is-left')}>\n <i className={iconClassName} aria-hidden=\"true\"></i>\n </span>\n </p>\n </div>\n );\n};\n\n/**\n * Checkbox block (renders as `<label class=\"panel-block\">`)\n *\n * @function\n * @param {PanelCheckboxBlockProps} props - Props for the PanelCheckboxBlock component.\n * @returns {JSX.Element} The rendered panel checkbox block.\n */\nexport const PanelCheckboxBlock: React.FC<PanelCheckboxBlockProps> = ({\n checked,\n onChange,\n children,\n ...props\n}) => (\n <label className={usePrefixedClassNames('panel-block')} {...props}>\n <input type=\"checkbox\" checked={checked} onChange={onChange} />\n {children}\n </label>\n);\n\n/**\n * Call-to-action button (renders as `<div class=\"panel-block\"><button /></div>`)\n *\n * @function\n * @param {PanelButtonBlockProps} props - Props for the PanelButtonBlock component.\n * @returns {JSX.Element} The rendered panel button block.\n */\nexport const PanelButtonBlock: React.FC<PanelButtonBlockProps> = ({\n children,\n className,\n ...props\n}) => (\n <div className={usePrefixedClassNames('panel-block')}>\n <button\n className={classNames(\n usePrefixedClassNames(\n 'button',\n 'is-link',\n 'is-outlined',\n 'is-fullwidth'\n ),\n className\n )}\n {...props}\n >\n {children}\n </button>\n </div>\n);\n\nexport const Panel = withSubComponents(\n PanelComponent,\n {\n Heading: PanelHeading,\n Tabs: PanelTabs,\n Block: PanelBlock,\n Icon: PanelIcon,\n InputBlock: PanelInputBlock,\n CheckboxBlock: PanelCheckboxBlock,\n ButtonBlock: PanelButtonBlock,\n },\n 'Panel'\n);\n\nexport default Panel;\n"],"names":["STRIP_FROM_NON_ANCHOR","_jsx","_jsxs"],"mappings":";;;;;;;;AAgFA;;;AAGG;AACH,MAAM,oBAAoB,GACxB;AACE,IAAA,IAAI,EAAE,IAAI;AACV,IAAA,OAAO,EAAE,IAAI;CACd;AAEH;;;;AAIG;AACH,MAAMA,uBAAqB,GAEvB,EAAE,GAAG,iBAAiB,EAAE,GAAG,EAAE,IAAI,EAAE;AAEvC;AACA,MAAM,cAAc,GAEhB,EAAE,GAAGA,uBAAqB,EAAE,GAAG,oBAAoB,EAAE;AA0GzD;;;;;;;AAOG;AACH,MAAM,cAAc,GAAyB,CAAC,EAC5C,EAAE,EAAE,GAAG,GAAG,KAAK,EACf,KAAK,EACL,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,KAAI;AACH,IAAA,MAAM,EAAE,kBAAkB,EAAE,IAAI,EAAE,GAAG,eAAe,CAAC;QACnD,KAAK;AACL,QAAA,GAAG,KAAK;AACT,KAAA,CAAC;;AAGF,IAAA,MAAM,YAAY,GAAG,qBAAqB,CAAC,OAAO,EAAE;AAClD,QAAA,CAAC,CAAA,GAAA,EAAM,KAAK,CAAA,CAAE,GAAG,KAAK;AACvB,KAAA,CAAC;IAEF,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,kBAAkB,EAAE,SAAS,CAAC;AAE5E,IAAA,QACEC,GAAA,CAAC,GAAG,EAAA,EAAC,SAAS,EAAE,YAAY,EAAA,GAAM,IAAI,EAAA,QAAA,EACnC,QAAQ,EAAA,CACL;AAEV,CAAC;AAED;;;;;;AAMG;AACI,MAAM,YAAY,GAAgC,CAAC,EAC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