@allxsmith/bestax-bulma 5.27.7 → 5.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/esm/components/HoverCard.js +127 -0
- package/dist/esm/components/HoverCard.js.map +1 -0
- package/dist/esm/form/DateInput.js.map +1 -1
- package/dist/esm/form/DateInputBase.js +2 -3
- package/dist/esm/form/DateInputBase.js.map +1 -1
- package/dist/esm/form/DateTimeInput.js.map +1 -1
- package/dist/esm/form/DateTimeInputBase.js +2 -3
- package/dist/esm/form/DateTimeInputBase.js.map +1 -1
- package/dist/esm/form/Field.js +36 -5
- package/dist/esm/form/Field.js.map +1 -1
- package/dist/esm/form/File.js.map +1 -1
- package/dist/esm/form/FormContext.js +53 -9
- package/dist/esm/form/FormContext.js.map +1 -1
- package/dist/esm/form/Input.js.map +1 -1
- package/dist/esm/form/InputBase.js +6 -5
- package/dist/esm/form/InputBase.js.map +1 -1
- package/dist/esm/form/Numberinput.js.map +1 -1
- package/dist/esm/form/Select.js.map +1 -1
- package/dist/esm/form/SelectBase.js +7 -5
- package/dist/esm/form/SelectBase.js.map +1 -1
- package/dist/esm/form/Slider.js.map +1 -1
- package/dist/esm/form/Taginput.js.map +1 -1
- package/dist/esm/form/TextArea.js.map +1 -1
- package/dist/esm/form/TextAreaBase.js +6 -5
- package/dist/esm/form/TextAreaBase.js.map +1 -1
- package/dist/esm/form/TimeInput.js.map +1 -1
- package/dist/esm/form/TimeInputBase.js +2 -3
- package/dist/esm/form/TimeInputBase.js.map +1 -1
- package/dist/esm/form/useAutoLabelId.js +8 -3
- package/dist/esm/form/useAutoLabelId.js.map +1 -1
- package/dist/esm/helpers/Theme.js +87 -17
- package/dist/esm/helpers/Theme.js.map +1 -1
- package/dist/esm/helpers/devWarnings.js +8 -3
- package/dist/esm/helpers/devWarnings.js.map +1 -1
- package/dist/esm/helpers/useFlexboxClasses.js +1 -1
- package/dist/esm/helpers/useFocusTrap.js +2 -1
- package/dist/esm/helpers/useFocusTrap.js.map +1 -1
- package/dist/esm/helpers/useHoverOpen.js +390 -0
- package/dist/esm/helpers/useHoverOpen.js.map +1 -0
- package/dist/esm/helpers/useOtherClasses.js +1 -1
- package/dist/esm/helpers/useSpacingClasses.js +1 -1
- package/dist/esm/helpers/useTypographyClasses.js +1 -1
- package/dist/esm/helpers/useVisibilityClasses.js +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs +700 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/HoverCard.d.ts +136 -0
- package/dist/types/form/DateInput.d.ts +1 -1
- package/dist/types/form/DateTimeInput.d.ts +1 -1
- package/dist/types/form/Field.d.ts +2 -2
- package/dist/types/form/File.d.ts +1 -1
- package/dist/types/form/FormContext.d.ts +47 -8
- package/dist/types/form/Input.d.ts +1 -1
- package/dist/types/form/Numberinput.d.ts +1 -1
- package/dist/types/form/Select.d.ts +1 -1
- package/dist/types/form/Slider.d.ts +1 -1
- package/dist/types/form/Taginput.d.ts +1 -1
- package/dist/types/form/TextArea.d.ts +1 -1
- package/dist/types/form/TimeInput.d.ts +1 -1
- package/dist/types/form/useAutoLabelId.d.ts +4 -2
- package/dist/types/helpers/Theme.d.ts +15 -1
- package/dist/types/helpers/devWarnings.d.ts +8 -0
- package/dist/types/helpers/useFocusTrap.d.ts +9 -0
- package/dist/types/helpers/useHoverOpen.d.ts +98 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types-cjs/components/HoverCard.d.ts +136 -0
- package/dist/types-cjs/form/DateInput.d.ts +1 -1
- package/dist/types-cjs/form/DateTimeInput.d.ts +1 -1
- package/dist/types-cjs/form/Field.d.ts +2 -2
- package/dist/types-cjs/form/File.d.ts +1 -1
- package/dist/types-cjs/form/FormContext.d.ts +47 -8
- package/dist/types-cjs/form/Input.d.ts +1 -1
- package/dist/types-cjs/form/Numberinput.d.ts +1 -1
- package/dist/types-cjs/form/Select.d.ts +1 -1
- package/dist/types-cjs/form/Slider.d.ts +1 -1
- package/dist/types-cjs/form/Taginput.d.ts +1 -1
- package/dist/types-cjs/form/TextArea.d.ts +1 -1
- package/dist/types-cjs/form/TimeInput.d.ts +1 -1
- package/dist/types-cjs/form/useAutoLabelId.d.ts +4 -2
- package/dist/types-cjs/helpers/Theme.d.ts +15 -1
- package/dist/types-cjs/helpers/devWarnings.d.ts +8 -0
- package/dist/types-cjs/helpers/useFocusTrap.d.ts +9 -0
- package/dist/types-cjs/helpers/useHoverOpen.d.ts +98 -0
- package/dist/types-cjs/index.d.ts +1 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +18 -18
- package/src/scss/components/_hovercard.scss +118 -0
- package/src/scss/components/_index.scss +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Theme.js","sources":["../../../src/helpers/Theme.tsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useState,\n ReactNode,\n CSSProperties,\n} from 'react';\nimport classNames from './classNames';\nimport { useBulmaClasses, BulmaClassesProps } from './useBulmaClasses';\nimport { validGaps, validRadii, type BulmaGapStep } from './bulmaClassHelpers';\nimport { warnOnce } from './devWarnings';\nimport { useClassPrefix } from './Config';\n\n// --- FULL Bulma v1 CSS variable keys (auto-generated from CSSVAR_KEYS) ---\nconst bulmaCssVars = [\n // scheme\n '--bulma-scheme-h',\n '--bulma-scheme-s',\n '--bulma-scheme-main',\n '--bulma-scheme-main-bis',\n '--bulma-scheme-main-ter',\n '--bulma-scheme-invert',\n '--bulma-scheme-invert-bis',\n '--bulma-scheme-invert-ter',\n '--bulma-light-l',\n '--bulma-light-invert-l',\n '--bulma-dark-l',\n '--bulma-dark-invert-l',\n '--bulma-soft-l',\n '--bulma-bold-l',\n '--bulma-soft-invert-l',\n '--bulma-bold-invert-l',\n '--bulma-hover-background-l-delta',\n '--bulma-active-background-l-delta',\n '--bulma-hover-border-l-delta',\n '--bulma-active-border-l-delta',\n '--bulma-hover-color-l-delta',\n '--bulma-active-color-l-delta',\n '--bulma-hover-shadow-a-delta',\n '--bulma-active-shadow-a-delta',\n // colors\n '--bulma-primary-h',\n '--bulma-primary-s',\n '--bulma-primary-l',\n '--bulma-link-h',\n '--bulma-link-s',\n '--bulma-link-l',\n '--bulma-info-h',\n '--bulma-info-s',\n '--bulma-info-l',\n '--bulma-success-h',\n '--bulma-success-s',\n '--bulma-success-l',\n '--bulma-warning-h',\n '--bulma-warning-s',\n '--bulma-warning-l',\n '--bulma-danger-h',\n '--bulma-danger-s',\n '--bulma-danger-l',\n // shadow (the upstream token .box/.card/.dropdown/.panel derive their own\n // shadow variables from; overriding it from an ancestor is the route that\n // cascades, since those selectors re-declare their derived var on\n // themselves)\n '--bulma-shadow-h',\n '--bulma-shadow-s',\n '--bulma-shadow-l',\n '--bulma-shadow',\n // typography\n '--bulma-family-primary',\n '--bulma-family-secondary',\n '--bulma-family-code',\n '--bulma-size-small',\n '--bulma-size-normal',\n '--bulma-size-medium',\n '--bulma-size-large',\n '--bulma-weight-light',\n '--bulma-weight-normal',\n '--bulma-weight-medium',\n '--bulma-weight-semibold',\n '--bulma-weight-bold',\n '--bulma-weight-extrabold',\n // other\n '--bulma-block-spacing',\n '--bulma-duration',\n '--bulma-easing',\n '--bulma-radius-small',\n '--bulma-radius',\n '--bulma-radius-medium',\n '--bulma-radius-large',\n '--bulma-radius-rounded',\n '--bulma-speed',\n '--bulma-arrow-color',\n '--bulma-loading-color',\n '--bulma-burger-h',\n '--bulma-burger-s',\n '--bulma-burger-l',\n '--bulma-burger-border-radius',\n '--bulma-burger-gap',\n '--bulma-burger-item-height',\n '--bulma-burger-item-width',\n // generic\n '--bulma-body-background-color',\n '--bulma-body-size',\n '--bulma-body-min-width',\n '--bulma-body-rendering',\n '--bulma-body-family',\n '--bulma-body-overflow-x',\n '--bulma-body-overflow-y',\n '--bulma-body-color',\n '--bulma-body-font-size',\n '--bulma-body-weight',\n '--bulma-body-line-height',\n '--bulma-code-family',\n '--bulma-code-padding',\n '--bulma-code-weight',\n '--bulma-code-size',\n '--bulma-small-font-size',\n '--bulma-hr-background-color',\n '--bulma-hr-height',\n '--bulma-hr-margin',\n '--bulma-strong-color',\n '--bulma-strong-weight',\n '--bulma-pre-font-size',\n '--bulma-pre-padding',\n '--bulma-pre-code-font-size',\n // skeleton\n '--bulma-skeleton-background',\n '--bulma-skeleton-radius',\n '--bulma-skeleton-block-min-height',\n '--bulma-skeleton-lines-gap',\n '--bulma-skeleton-line-height',\n // breadcrumb\n '--bulma-breadcrumb-item-color',\n '--bulma-breadcrumb-item-hover-color',\n '--bulma-breadcrumb-item-active-color',\n '--bulma-breadcrumb-item-padding-vertical',\n '--bulma-breadcrumb-item-padding-horizontal',\n '--bulma-breadcrumb-item-separator-color',\n // card\n '--bulma-card-color',\n '--bulma-card-background-color',\n '--bulma-card-shadow',\n '--bulma-card-radius',\n '--bulma-card-header-background-color',\n '--bulma-card-header-color',\n '--bulma-card-header-padding',\n '--bulma-card-header-shadow',\n '--bulma-card-header-weight',\n '--bulma-card-content-background-color',\n '--bulma-card-content-padding',\n '--bulma-card-footer-background-color',\n '--bulma-card-footer-border-top',\n '--bulma-card-footer-padding',\n '--bulma-card-media-margin',\n // dropdown\n '--bulma-dropdown-menu-min-width',\n '--bulma-dropdown-content-background-color',\n '--bulma-dropdown-content-offset',\n '--bulma-dropdown-content-padding-bottom',\n '--bulma-dropdown-content-padding-top',\n '--bulma-dropdown-content-radius',\n '--bulma-dropdown-content-shadow',\n '--bulma-dropdown-content-z',\n '--bulma-dropdown-item-h',\n '--bulma-dropdown-item-s',\n '--bulma-dropdown-item-l',\n '--bulma-dropdown-item-background-l',\n '--bulma-dropdown-item-background-l-delta',\n '--bulma-dropdown-item-hover-background-l-delta',\n '--bulma-dropdown-item-active-background-l-delta',\n '--bulma-dropdown-item-color-l',\n '--bulma-dropdown-item-selected-h',\n '--bulma-dropdown-item-selected-s',\n '--bulma-dropdown-item-selected-l',\n '--bulma-dropdown-item-selected-background-l',\n '--bulma-dropdown-item-selected-color-l',\n '--bulma-dropdown-divider-background-color',\n // menu\n '--bulma-menu-item-h',\n '--bulma-menu-item-s',\n '--bulma-menu-item-l',\n '--bulma-menu-item-background-l',\n '--bulma-menu-item-background-l-delta',\n '--bulma-menu-item-hover-background-l-delta',\n '--bulma-menu-item-active-background-l-delta',\n '--bulma-menu-item-color-l',\n '--bulma-menu-item-radius',\n '--bulma-menu-item-selected-h',\n '--bulma-menu-item-selected-s',\n '--bulma-menu-item-selected-l',\n '--bulma-menu-item-selected-background-l',\n '--bulma-menu-item-selected-color-l',\n '--bulma-menu-list-border-left',\n '--bulma-menu-list-line-height',\n '--bulma-menu-list-link-padding',\n '--bulma-menu-nested-list-margin',\n '--bulma-menu-nested-list-padding-left',\n '--bulma-menu-label-color',\n '--bulma-menu-label-font-size',\n '--bulma-menu-label-letter-spacing',\n '--bulma-menu-label-spacing',\n // message\n '--bulma-message-h',\n '--bulma-message-s',\n '--bulma-message-background-l',\n '--bulma-message-border-l',\n '--bulma-message-border-l-delta',\n '--bulma-message-border-style',\n '--bulma-message-border-width',\n '--bulma-message-color-l',\n '--bulma-message-radius',\n '--bulma-message-header-weight',\n '--bulma-message-header-padding',\n '--bulma-message-header-radius',\n '--bulma-message-header-body-border-width',\n '--bulma-message-header-background-l',\n '--bulma-message-header-color-l',\n '--bulma-message-body-border-width',\n '--bulma-message-body-color',\n '--bulma-message-body-padding',\n '--bulma-message-body-radius',\n '--bulma-message-body-pre-code-background-color',\n // modal\n '--bulma-modal-z',\n '--bulma-modal-background-background-color',\n '--bulma-modal-content-width',\n '--bulma-modal-content-margin-mobile',\n '--bulma-modal-content-spacing-mobile',\n '--bulma-modal-content-spacing-tablet',\n '--bulma-modal-close-dimensions',\n '--bulma-modal-close-right',\n '--bulma-modal-close-top',\n '--bulma-modal-card-spacing',\n '--bulma-modal-card-head-background-color',\n '--bulma-modal-card-head-padding',\n '--bulma-modal-card-head-radius',\n '--bulma-modal-card-title-color',\n '--bulma-modal-card-title-line-height',\n '--bulma-modal-card-title-size',\n '--bulma-modal-card-foot-background-color',\n '--bulma-modal-card-foot-radius',\n '--bulma-modal-card-body-background-color',\n '--bulma-modal-card-body-padding',\n // navbar\n '--bulma-navbar-h',\n '--bulma-navbar-s',\n '--bulma-navbar-l',\n '--bulma-navbar-background-color',\n '--bulma-navbar-box-shadow-size',\n '--bulma-navbar-box-shadow-color',\n '--bulma-navbar-padding-vertical',\n '--bulma-navbar-padding-horizontal',\n '--bulma-navbar-z',\n '--bulma-navbar-fixed-z',\n '--bulma-navbar-item-background-a',\n '--bulma-navbar-item-background-l',\n '--bulma-navbar-item-background-l-delta',\n '--bulma-navbar-item-hover-background-l-delta',\n '--bulma-navbar-item-active-background-l-delta',\n '--bulma-navbar-item-color-l',\n '--bulma-navbar-item-selected-h',\n '--bulma-navbar-item-selected-s',\n '--bulma-navbar-item-selected-l',\n '--bulma-navbar-item-selected-background-l',\n '--bulma-navbar-item-selected-color-l',\n '--bulma-navbar-item-img-max-height',\n '--bulma-navbar-burger-color',\n '--bulma-navbar-tab-hover-background-color',\n '--bulma-navbar-tab-hover-border-bottom-color',\n '--bulma-navbar-tab-active-color',\n '--bulma-navbar-tab-active-background-color',\n '--bulma-navbar-tab-active-border-bottom-color',\n '--bulma-navbar-tab-active-border-bottom-style',\n '--bulma-navbar-tab-active-border-bottom-width',\n '--bulma-navbar-dropdown-background-color',\n '--bulma-navbar-dropdown-border-l',\n '--bulma-navbar-dropdown-border-color',\n '--bulma-navbar-dropdown-border-style',\n '--bulma-navbar-dropdown-border-width',\n '--bulma-navbar-dropdown-offset',\n '--bulma-navbar-dropdown-arrow',\n '--bulma-navbar-dropdown-radius',\n '--bulma-navbar-dropdown-z',\n '--bulma-navbar-dropdown-boxed-radius',\n '--bulma-navbar-dropdown-boxed-shadow',\n '--bulma-navbar-dropdown-item-h',\n '--bulma-navbar-dropdown-item-s',\n '--bulma-navbar-dropdown-item-l',\n '--bulma-navbar-dropdown-item-background-l',\n '--bulma-navbar-dropdown-item-color-l',\n '--bulma-navbar-divider-background-l',\n '--bulma-navbar-divider-height',\n '--bulma-navbar-bottom-box-shadow-size',\n // pagination\n '--bulma-pagination-margin',\n '--bulma-pagination-min-width',\n '--bulma-pagination-item-h',\n '--bulma-pagination-item-s',\n '--bulma-pagination-item-l',\n '--bulma-pagination-item-background-l-delta',\n '--bulma-pagination-item-hover-background-l-delta',\n '--bulma-pagination-item-active-background-l-delta',\n '--bulma-pagination-item-border-style',\n '--bulma-pagination-item-border-width',\n '--bulma-pagination-item-border-l',\n '--bulma-pagination-item-border-l-delta',\n '--bulma-pagination-item-hover-border-l-delta',\n '--bulma-pagination-item-active-border-l-delta',\n '--bulma-pagination-item-focus-border-l-delta',\n '--bulma-pagination-item-color-l',\n '--bulma-pagination-item-font-size',\n '--bulma-pagination-item-margin',\n '--bulma-pagination-item-padding-left',\n '--bulma-pagination-item-padding-right',\n '--bulma-pagination-item-outer-shadow-h',\n '--bulma-pagination-item-outer-shadow-s',\n '--bulma-pagination-item-outer-shadow-l',\n '--bulma-pagination-item-outer-shadow-a',\n '--bulma-pagination-nav-padding-left',\n '--bulma-pagination-nav-padding-right',\n '--bulma-pagination-disabled-color',\n '--bulma-pagination-disabled-background-color',\n '--bulma-pagination-disabled-border-color',\n '--bulma-pagination-current-color',\n '--bulma-pagination-current-background-color',\n '--bulma-pagination-current-border-color',\n '--bulma-pagination-ellipsis-color',\n '--bulma-pagination-shadow-inset',\n '--bulma-pagination-selected-item-h',\n '--bulma-pagination-selected-item-s',\n '--bulma-pagination-selected-item-l',\n '--bulma-pagination-selected-item-background-l',\n '--bulma-pagination-selected-item-border-l',\n '--bulma-pagination-selected-item-color-l',\n // panel\n '--bulma-panel-margin',\n '--bulma-panel-item-border',\n '--bulma-panel-radius',\n '--bulma-panel-shadow',\n '--bulma-panel-heading-line-height',\n '--bulma-panel-heading-padding',\n '--bulma-panel-heading-radius',\n '--bulma-panel-heading-size',\n '--bulma-panel-heading-weight',\n '--bulma-panel-tabs-font-size',\n '--bulma-panel-tab-border-bottom-color',\n '--bulma-panel-tab-border-bottom-style',\n '--bulma-panel-tab-border-bottom-width',\n '--bulma-panel-tab-active-color',\n '--bulma-panel-list-item-color',\n '--bulma-panel-list-item-hover-color',\n '--bulma-panel-block-color',\n '--bulma-panel-block-hover-background-color',\n '--bulma-panel-block-active-border-left-color',\n '--bulma-panel-block-active-color',\n '--bulma-panel-block-active-icon-color',\n '--bulma-panel-icon-color',\n // tabs\n '--bulma-tabs-border-bottom-color',\n '--bulma-tabs-border-bottom-style',\n '--bulma-tabs-border-bottom-width',\n '--bulma-tabs-link-color',\n '--bulma-tabs-link-hover-border-bottom-color',\n '--bulma-tabs-link-hover-color',\n '--bulma-tabs-link-active-border-bottom-color',\n '--bulma-tabs-link-active-color',\n '--bulma-tabs-link-padding',\n '--bulma-tabs-boxed-link-radius',\n '--bulma-tabs-boxed-link-hover-background-color',\n '--bulma-tabs-boxed-link-hover-border-bottom-color',\n '--bulma-tabs-boxed-link-active-background-color',\n '--bulma-tabs-boxed-link-active-border-color',\n '--bulma-tabs-boxed-link-active-border-bottom-color',\n '--bulma-tabs-toggle-link-border-color',\n '--bulma-tabs-toggle-link-border-style',\n '--bulma-tabs-toggle-link-border-width',\n '--bulma-tabs-toggle-link-hover-background-color',\n '--bulma-tabs-toggle-link-hover-border-color',\n '--bulma-tabs-toggle-link-radius',\n '--bulma-tabs-toggle-link-active-background-color',\n '--bulma-tabs-toggle-link-active-border-color',\n '--bulma-tabs-toggle-link-active-color',\n // box\n '--bulma-box-background-color',\n '--bulma-box-color',\n '--bulma-box-radius',\n '--bulma-box-shadow',\n '--bulma-box-padding',\n '--bulma-box-link-hover-shadow',\n '--bulma-box-link-active-shadow',\n // content\n '--bulma-content-heading-color',\n '--bulma-content-heading-weight',\n '--bulma-content-heading-line-height',\n '--bulma-content-block-margin-bottom',\n '--bulma-content-blockquote-background-color',\n '--bulma-content-blockquote-border-left',\n '--bulma-content-blockquote-padding',\n '--bulma-content-pre-padding',\n '--bulma-content-table-cell-border',\n '--bulma-content-table-cell-border-width',\n '--bulma-content-table-cell-padding',\n '--bulma-content-table-cell-heading-color',\n '--bulma-content-table-head-cell-border-width',\n '--bulma-content-table-head-cell-color',\n '--bulma-content-table-body-last-row-cell-border-bottom-width',\n '--bulma-content-table-foot-cell-border-width',\n '--bulma-content-table-foot-cell-color',\n // delete\n '--bulma-delete-dimensions',\n '--bulma-delete-background-l',\n '--bulma-delete-background-alpha',\n '--bulma-delete-color',\n // icon\n '--bulma-icon-dimensions',\n '--bulma-icon-dimensions-small',\n '--bulma-icon-dimensions-medium',\n '--bulma-icon-dimensions-large',\n '--bulma-icon-text-spacing',\n // notification\n '--bulma-notification-h',\n '--bulma-notification-s',\n '--bulma-notification-background-l',\n '--bulma-notification-color-l',\n '--bulma-notification-code-background-color',\n '--bulma-notification-radius',\n '--bulma-notification-padding',\n // progress\n '--bulma-progress-border-radius',\n '--bulma-progress-bar-background-color',\n '--bulma-progress-value-background-color',\n '--bulma-progress-indeterminate-duration',\n // table\n '--bulma-table-color',\n '--bulma-table-background-color',\n '--bulma-table-cell-border-color',\n '--bulma-table-cell-border-style',\n '--bulma-table-cell-border-width',\n '--bulma-table-cell-padding',\n '--bulma-table-cell-heading-color',\n '--bulma-table-cell-text-align',\n '--bulma-table-head-cell-border-width',\n '--bulma-table-head-cell-color',\n '--bulma-table-foot-cell-border-width',\n '--bulma-table-foot-cell-color',\n '--bulma-table-head-background-color',\n '--bulma-table-body-background-color',\n '--bulma-table-foot-background-color',\n '--bulma-table-row-hover-background-color',\n '--bulma-table-row-active-background-color',\n '--bulma-table-row-active-color',\n '--bulma-table-striped-row-even-background-color',\n '--bulma-table-striped-row-even-hover-background-color',\n // tag\n '--bulma-tag-h',\n '--bulma-tag-s',\n '--bulma-tag-background-l',\n '--bulma-tag-background-l-delta',\n '--bulma-tag-hover-background-l-delta',\n '--bulma-tag-active-background-l-delta',\n '--bulma-tag-color-l',\n '--bulma-tag-radius',\n '--bulma-tag-delete-margin',\n // title\n '--bulma-title-color',\n '--bulma-title-family',\n '--bulma-title-size',\n '--bulma-title-weight',\n '--bulma-title-line-height',\n '--bulma-title-strong-color',\n '--bulma-title-strong-weight',\n '--bulma-title-sub-size',\n '--bulma-title-sup-size',\n '--bulma-subtitle-color',\n '--bulma-subtitle-family',\n '--bulma-subtitle-size',\n '--bulma-subtitle-weight',\n '--bulma-subtitle-line-height',\n '--bulma-subtitle-strong-color',\n '--bulma-subtitle-strong-weight',\n // control\n '--bulma-control-radius',\n '--bulma-control-radius-small',\n '--bulma-control-border-width',\n '--bulma-control-height',\n '--bulma-control-line-height',\n '--bulma-control-padding-vertical',\n '--bulma-control-padding-horizontal',\n '--bulma-control-size',\n '--bulma-control-focus-shadow-l',\n // file\n '--bulma-file-radius',\n '--bulma-file-name-border-color',\n '--bulma-file-name-border-style',\n '--bulma-file-name-border-width',\n '--bulma-file-name-max-width',\n '--bulma-file-h',\n '--bulma-file-s',\n '--bulma-file-background-l',\n '--bulma-file-background-l-delta',\n '--bulma-file-hover-background-l-delta',\n '--bulma-file-active-background-l-delta',\n '--bulma-file-border-l',\n '--bulma-file-border-l-delta',\n '--bulma-file-hover-border-l-delta',\n '--bulma-file-active-border-l-delta',\n '--bulma-file-cta-color-l',\n '--bulma-file-name-color-l',\n '--bulma-file-color-l-delta',\n '--bulma-file-hover-color-l-delta',\n '--bulma-file-active-color-l-delta',\n // input\n '--bulma-input-h',\n '--bulma-input-s',\n '--bulma-input-l',\n '--bulma-input-border-style',\n '--bulma-input-border-l',\n '--bulma-input-border-l-delta',\n '--bulma-input-hover-border-l-delta',\n '--bulma-input-active-border-l-delta',\n '--bulma-input-focus-h',\n '--bulma-input-focus-s',\n '--bulma-input-focus-l',\n '--bulma-input-focus-shadow-size',\n '--bulma-input-focus-shadow-alpha',\n '--bulma-input-color-l',\n '--bulma-input-background-l',\n '--bulma-input-background-l-delta',\n '--bulma-input-height',\n '--bulma-input-shadow',\n '--bulma-input-placeholder-color',\n '--bulma-input-disabled-color',\n '--bulma-input-disabled-background-color',\n '--bulma-input-disabled-border-color',\n '--bulma-input-disabled-placeholder-color',\n '--bulma-input-arrow',\n '--bulma-input-icon-color',\n '--bulma-input-icon-hover-color',\n '--bulma-input-icon-focus-color',\n '--bulma-input-radius',\n // columns\n '--bulma-column-gap',\n // grid\n '--bulma-grid-gap',\n '--bulma-grid-column-count',\n '--bulma-grid-column-min',\n '--bulma-grid-cell-column-span',\n '--bulma-grid-cell-column-start',\n // footer\n '--bulma-footer-background-color',\n '--bulma-footer-color',\n '--bulma-footer-padding',\n // hero\n '--bulma-hero-body-padding',\n '--bulma-hero-body-padding-tablet',\n '--bulma-hero-body-padding-small',\n '--bulma-hero-body-padding-medium',\n '--bulma-hero-body-padding-large',\n // media\n '--bulma-media-border-color',\n '--bulma-media-border-size',\n '--bulma-media-spacing',\n '--bulma-media-spacing-large',\n '--bulma-media-content-spacing',\n '--bulma-media-level-1-spacing',\n '--bulma-media-level-1-content-spacing',\n '--bulma-media-level-2-spacing',\n // section\n '--bulma-section-padding',\n '--bulma-section-padding-desktop',\n '--bulma-section-padding-medium',\n '--bulma-section-padding-large',\n] as const;\n\n/** A single Bulma CSS variable key from the `bulmaCssVars` tuple. */\ntype BulmaVarKey = (typeof bulmaCssVars)[number];\n/** A partial record mapping Bulma CSS variable keys to string values. */\ntype BulmaVars = Partial<Record<BulmaVarKey, string>>;\n\n/**\n * Convert a Bulma CSS variable name to a camelCase prop name.\n * @param {string} varName - CSS variable name (e.g., '--bulma-primary-h').\n * @returns {string} The camelCase prop name (e.g., 'primaryH').\n */\nfunction cssVarToProp(varName: string): string {\n return varName\n .replace(/^--bulma-/, '')\n .split('-')\n .map((part, i) =>\n i === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)\n )\n .join('');\n}\n\n/**\n * Prop names `cssVarToProp` would mint that are already helper props:\n * `--bulma-shadow` becomes `shadow`, `--bulma-radius` becomes `radius` and\n * `--bulma-column-gap` becomes `columnGap`. They stay out of\n * `bulmaVarPropMap`, so on Theme each is the helper prop it is on every other\n * component, and every one of those variables is still reachable through\n * `bulmaVars`.\n *\n * `radius` was missed here once and set `--bulma-radius` while typed as the\n * helper (#694). It still writes that variable, so what it did then keeps\n * working; see `themeRadiusVar`. `columnGap` joined when the gap helpers\n * became shared helper props, and keeps its old variable route the same way;\n * see `themeColumnGapVar`.\n */\nconst helperPropNames: readonly string[] = ['shadow', 'radius', 'columnGap'];\n\n/**\n * Mapping of camelCase prop names to their Bulma CSS variable counterparts,\n * minus the `helperPropNames` above.\n */\nconst bulmaVarPropMap = Object.fromEntries(\n bulmaCssVars\n .map(cssVar => [cssVarToProp(cssVar), cssVar])\n .filter(([prop]) => !helperPropNames.includes(prop))\n) as Record<string, string>;\n\n/**\n * What each helper value of `radius` writes to `--bulma-radius` on a Theme,\n * alongside its class.\n *\n * Before #694, `radius=\"radiusless\"` wrote `--bulma-radius: radiusless`. That\n * is not a length, and a declaration reading an invalid variable falls back\n * to its property's initial value, which for a border radius is 0. So\n * everything inside the Theme that takes its radius from that variable lost\n * it, and under `isRoot` so did everything on the page that does. Writing a\n * real 0 keeps what\n * people see and makes it valid CSS. Keyed by the helper values, so adding\n * one means saying what it writes.\n *\n * The sizes write nothing and only add their class. Their classes read the\n * radius variables, so `normal` would point `--bulma-radius` at itself, which\n * is invalid and computes to 0, and `rounded` would turn every control inside\n * the Theme into a pill.\n */\nconst radiusHelperVars: Record<\n (typeof validRadii)[number],\n string | undefined\n> = {\n radiusless: '0',\n small: undefined,\n normal: undefined,\n large: undefined,\n rounded: undefined,\n};\n\n/**\n * What `radius` writes to `--bulma-radius` on a Theme, or `undefined` when it\n * writes nothing.\n *\n * A helper value writes its `radiusHelperVars` entry. Any other non-empty\n * string is written as given: before #694 every `radius` on Theme set the\n * variable whatever its type said, and a JavaScript caller passing a length\n * got the radius it asked for. That keeps working so nothing breaks, but the\n * type rejects it, so it warns in development and points at `bulmaVars`.\n *\n * Only a string writes anything, because only a string ever set the variable\n * to something usable: an empty value or zero was dropped, and a boolean or\n * any other bare number is not a length. The helper ignores those too, the\n * way it does on every other component.\n */\nconst themeRadiusVar = (radius: unknown): string | undefined => {\n if (typeof radius !== 'string' || radius === '') {\n return undefined;\n }\n if ((validRadii as readonly string[]).includes(radius)) {\n return radiusHelperVars[radius as keyof typeof radiusHelperVars];\n }\n warnOnce(\n 'Theme:radius-variable',\n `[bestax-bulma] <Theme radius=\"${radius}\">: setting --bulma-radius ` +\n 'through the radius prop is deprecated and will stop working in a ' +\n 'future major version. On Theme, as on every other component, radius ' +\n `is the border radius helper (\"${validRadii.join('\", \"')}\"). Set the variable with ` +\n `bulmaVars={{ '--bulma-radius': '${radius}' }} instead.`\n );\n return radius;\n};\n\n/**\n * What `columnGap` writes to `--bulma-column-gap` on a Theme, or `undefined`\n * when it writes nothing.\n *\n * Until the gap helpers were shared helper props, `columnGap` on Theme was\n * the camelCase prop Theme mints for `--bulma-column-gap`. It was never in\n * `ThemeProps`, so only untyped code reached it, but that code got the\n * columns gutter it asked for. It is the column gap helper now, as on every\n * other component, so a gap step goes to the helper and writes nothing here.\n * Any other non-empty string is still written as given, so a length such as\n * `'1rem'` keeps working, with a development warning pointing at `bulmaVars`.\n *\n * Only a string writes anything, for the reason `themeRadiusVar` gives: a\n * number or a boolean was never a usable length.\n */\nconst themeColumnGapVar = (columnGap: unknown): string | undefined => {\n if (typeof columnGap !== 'string' || columnGap === '') {\n return undefined;\n }\n if ((validGaps as readonly string[]).includes(columnGap)) {\n return undefined;\n }\n warnOnce(\n 'Theme:column-gap-variable',\n `[bestax-bulma] <Theme columnGap=\"${columnGap}\">: setting ` +\n '--bulma-column-gap through the columnGap prop is deprecated and will ' +\n 'stop working in a future major version. On Theme, as on every other ' +\n 'component, columnGap is the column gap helper ' +\n `(\"${validGaps.join('\", \"')}\"). Set the variable with ` +\n `bulmaVars={{ '--bulma-column-gap': '${columnGap}' }} instead.`\n );\n return columnGap;\n};\n\n/** The one `<style>` element every `isRoot` Theme writes into. */\nconst ROOT_STYLE_ID = 'bestax-bulma-theme-vars';\n\n/**\n * The `:root` rules of every mounted `isRoot` Theme that has any, keyed by the\n * Theme's render order.\n *\n * Root Themes share one `<style>` element, so each keeps its rules here and\n * the element is rebuilt from all of them whenever one mounts, changes or\n * unmounts. Before this each Theme overwrote the element with only its own\n * rules, and the first to unmount removed it for all of them (#736).\n *\n * The key is a number each Theme takes when it first renders. React renders a\n * parent before its children and an earlier sibling before a later one, so an\n * inner or later-mounted root Theme sorts later, comes later in the\n * stylesheet, and wins a variable two of them set, as an inner scoped Theme\n * does. Effects would give the wrong answer for nesting: React runs a child's\n * effects before its parent's. Only the relative order matters, so a number\n * skipped by StrictMode calling the initializer twice, or by a render React\n * throws away, is harmless. The key never changes, so an update keeps its\n * place and re-rendering one Theme never changes which one wins.\n */\nconst rootThemeRules = new Map<number, string>();\nlet nextRootOrder = 0;\n\n/**\n * Write every registered root Theme's rules into the shared element, creating\n * it when needed and removing it once no Theme has any rules left.\n */\nconst renderRootThemeRules = (): void => {\n let element = document.getElementById(ROOT_STYLE_ID);\n if (rootThemeRules.size === 0) {\n element?.remove();\n return;\n }\n if (!element) {\n element = document.createElement('style');\n element.id = ROOT_STYLE_ID;\n document.head.appendChild(element);\n }\n element.textContent = [...rootThemeRules]\n .sort(([a], [b]) => a - b)\n .map(([, rules]) => rules)\n .join('\\n');\n};\n\n/**\n * Record one Theme's `:root` rules, where an empty string means it has none,\n * and rebuild the shared element if that changed anything. A Theme with no\n * rules never touches the element, which is what it did before the registry\n * too.\n */\nconst setRootThemeRules = (order: number, rules: string): void => {\n if ((rootThemeRules.get(order) ?? '') === rules) {\n return;\n }\n if (rules) {\n rootThemeRules.set(order, rules);\n } else {\n rootThemeRules.delete(order);\n }\n renderRootThemeRules();\n};\n\n/**\n * Props for the Theme component.\n */\nexport interface ThemeProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor'\n> {\n /** The content the theme applies to. */\n children: ReactNode;\n /**\n * Additional CSS classes for the wrapper div. A root Theme (`isRoot`) has no\n * wrapper, so there this does nothing, and says so in development.\n */\n className?: string;\n /**\n * Inject the variables globally at `:root` instead of scoping them to a\n * wrapper div. Default: false.\n *\n * A root Theme renders its children with no wrapper, so `className` and the\n * helper props, such as `m` or `shadow`, have no element to land on. They\n * do nothing, and say so in development. `radius` and `columnGap` describe\n * what each does at the root.\n *\n * Several root Themes can be mounted at once, and each contributes its own\n * variables. Where two set the same one, the inner or later-mounted Theme\n * wins, as with nested scoped Themes, and unmounting a Theme removes only\n * what it contributed. The variables are written from an effect, so a\n * server render does not include them.\n */\n isRoot?: boolean;\n /**\n * Set Bulma's light/dark scheme by writing its theme attribute on the\n * document root (`<html>`). This is always global, even on a scoped Theme.\n * `'system'` removes the attribute so Bulma follows the OS\n * `prefers-color-scheme`. Omit to leave the current setting untouched.\n *\n * The attribute is `data-theme`. A stylesheet built with a class prefix\n * reads Bulma's prefixed form instead (`data-bestax-theme` for the\n * `bestax-prefixed` builds), so under a `ConfigProvider` `classPrefix`\n * Theme writes both, and `'system'` or unmounting clears or restores both.\n * If the prefix cannot form an attribute name, `'light'` and `'dark'`\n * write only `data-theme` and warn in development.\n */\n colorMode?: 'light' | 'dark' | 'system';\n /**\n * Bulma CSS variables to set, by name, such as\n * `{ '--bulma-primary-h': '210' }`. Only Bulma's own variables, the keys\n * the `BulmaVars` type allows, are applied, and an empty value is skipped.\n * Where a variable prop, such as `primaryH`, sets the same variable, the\n * prop wins.\n */\n bulmaVars?: BulmaVars;\n /**\n * Border radius helper, as on every other component: `radiusless` adds\n * `is-radiusless` to the wrapper div. On a Theme it also sets\n * `--bulma-radius` to 0, so what is inside the Theme loses its radius too.\n * Under `isRoot` there is no wrapper for the class, and the variable is\n * written at `:root`, which squares everything on the page that takes its\n * radius from it.\n *\n * The sizes (`small`, `normal`, `large`, `rounded`) add their\n * `has-radius-<value>` class to the wrapper div and set no variable, so\n * they round the wrapper and leave what is inside it alone. Under `isRoot`\n * there is no wrapper, so they do nothing, and say so in development.\n *\n * To change the radius of what is inside, set the variable through `bulmaVars`\n * (`bulmaVars={{ '--bulma-radius': '6px' }}`). This prop used to write the\n * variable for every value, so any other non-empty string still does, but\n * that route is deprecated and logs a warning in development. A number or\n * a boolean never produced a usable radius that way, and is now ignored as\n * it is on every other component.\n */\n radius?: (typeof validRadii)[number];\n /**\n * Column gap helper, as on every other component: a gap step adds\n * `is-column-gap-<step>` to the wrapper div, which spaces the wrapper's own\n * children when it is a flex or grid container. Under `isRoot` there is no\n * wrapper, so it does nothing, and says so in development.\n *\n * It does not set `--bulma-column-gap`, the variable `Columns` reads for\n * its gutters; set that through `bulmaVars`\n * (`bulmaVars={{ '--bulma-column-gap': '1rem' }}`). Before `columnGap` was\n * a helper prop, untyped JavaScript could pass it to Theme as that\n * variable. A string that is not a gap step (`'1rem'`) still sets it, but\n * that route is deprecated and logs a warning in development. A gap step\n * does not: `columnGap=\"0\"` used to zero the gutters inside the Theme, and\n * now adds `is-column-gap-0` to the wrapper instead.\n */\n columnGap?: BulmaGapStep;\n // Bulma scheme variables\n /** Base hue for the color scheme, 0 to 360. Sets `--bulma-scheme-h`. */\n schemeH?: string;\n /** Base saturation for the color scheme, as a percentage. Sets `--bulma-scheme-s`. */\n schemeS?: string;\n /** Lightness for light backgrounds. Sets `--bulma-light-l`. */\n lightL?: string;\n /** Inverted lightness for light backgrounds. Sets `--bulma-light-invert-l`. */\n lightInvertL?: string;\n /** Lightness for dark backgrounds. Sets `--bulma-dark-l`. */\n darkL?: string;\n /** Inverted lightness for dark backgrounds. Sets `--bulma-dark-invert-l`. */\n darkInvertL?: string;\n /** Lightness for soft colors. Sets `--bulma-soft-l`. */\n softL?: string;\n /** Lightness for bold colors. Sets `--bulma-bold-l`. */\n boldL?: string;\n /** Inverted lightness for soft colors. Sets `--bulma-soft-invert-l`. */\n softInvertL?: string;\n /** Inverted lightness for bold colors. Sets `--bulma-bold-invert-l`. */\n boldInvertL?: string;\n /** Lightness change of a background on hover. Sets `--bulma-hover-background-l-delta`. */\n hoverBackgroundLDelta?: string;\n /** Lightness change of a background when active. Sets `--bulma-active-background-l-delta`. */\n activeBackgroundLDelta?: string;\n /** Lightness change of a border on hover. Sets `--bulma-hover-border-l-delta`. */\n hoverBorderLDelta?: string;\n /** Lightness change of a border when active. Sets `--bulma-active-border-l-delta`. */\n activeBorderLDelta?: string;\n /** Lightness change of text color on hover. Sets `--bulma-hover-color-l-delta`. */\n hoverColorLDelta?: string;\n /** Lightness change of text color when active. Sets `--bulma-active-color-l-delta`. */\n activeColorLDelta?: string;\n /** Alpha change of a shadow on hover. Sets `--bulma-hover-shadow-a-delta`. */\n hoverShadowADelta?: string;\n /** Alpha change of a shadow when active. Sets `--bulma-active-shadow-a-delta`. */\n activeShadowADelta?: string;\n // Bulma color variables\n /** Primary color hue, 0 to 360. Sets `--bulma-primary-h`. */\n primaryH?: string;\n /** Primary color saturation, as a percentage. Sets `--bulma-primary-s`. */\n primaryS?: string;\n /** Primary color lightness, as a percentage. Sets `--bulma-primary-l`. */\n primaryL?: string;\n /** Link color hue, 0 to 360. Sets `--bulma-link-h`. */\n linkH?: string;\n /** Link color saturation, as a percentage. Sets `--bulma-link-s`. */\n linkS?: string;\n /** Link color lightness, as a percentage. Sets `--bulma-link-l`. */\n linkL?: string;\n /** Info color hue, 0 to 360. Sets `--bulma-info-h`. */\n infoH?: string;\n /** Info color saturation, as a percentage. Sets `--bulma-info-s`. */\n infoS?: string;\n /** Info color lightness, as a percentage. Sets `--bulma-info-l`. */\n infoL?: string;\n /** Success color hue, 0 to 360. Sets `--bulma-success-h`. */\n successH?: string;\n /** Success color saturation, as a percentage. Sets `--bulma-success-s`. */\n successS?: string;\n /** Success color lightness, as a percentage. Sets `--bulma-success-l`. */\n successL?: string;\n /** Warning color hue, 0 to 360. Sets `--bulma-warning-h`. */\n warningH?: string;\n /** Warning color saturation, as a percentage. Sets `--bulma-warning-s`. */\n warningS?: string;\n /** Warning color lightness, as a percentage. Sets `--bulma-warning-l`. */\n warningL?: string;\n /** Danger color hue, 0 to 360. Sets `--bulma-danger-h`. */\n dangerH?: string;\n /** Danger color saturation, as a percentage. Sets `--bulma-danger-s`. */\n dangerS?: string;\n /** Danger color lightness, as a percentage. Sets `--bulma-danger-l`. */\n dangerL?: string;\n // Add other commonly used ones as needed\n}\n\n/**\n * Theme component that injects Bulma CSS variables either globally or locally.\n *\n * When `isRoot` is true, variables are injected at `:root`. Otherwise, a wrapping\n * `<div>` scopes the variables to its children.\n *\n * @function\n * @param {ThemeProps} props - Props for the Theme component.\n * @returns {JSX.Element} The theme wrapper or fragment.\n *\n * @example\n * // Local theme scope\n * <Theme primaryH=\"171\" primaryS=\"100%\" primaryL=\"41%\">\n * <Button color=\"primary\">Themed</Button>\n * </Theme>\n */\nexport const Theme: React.FC<ThemeProps> = ({\n bulmaVars = {},\n children,\n className,\n isRoot = false,\n colorMode,\n radius,\n columnGap,\n ...restProps\n}) => {\n const radiusVar = themeRadiusVar(radius);\n const columnGapVar = themeColumnGapVar(columnGap);\n const radiusHelper = (validRadii as readonly unknown[]).includes(radius)\n ? radius\n : undefined;\n\n // A radius size only adds its class, and a root Theme renders no wrapper to\n // carry one, so on `isRoot` it does nothing at all. Say so, as the other\n // radius routes that do not do what they look like do.\n if (isRoot && radiusHelper && radiusHelperVars[radiusHelper] === undefined) {\n warnOnce(\n 'Theme:root-radius-size',\n `[bestax-bulma] <Theme isRoot radius=\"${radiusHelper}\">: a root Theme ` +\n `has no wrapper element for has-radius-${radiusHelper}, and the ` +\n 'radius sizes set no variable, so this does nothing. To round one ' +\n `element, put radius=\"${radiusHelper}\" on it. To change the radius ` +\n \"across the page, set bulmaVars={{ '--bulma-radius': '…' }} instead.\"\n );\n }\n\n // The same for a gap step in `columnGap`, which reads like the columns\n // gutter it once set and, at the root, has no element for its class.\n const columnGapStep =\n typeof columnGap === 'number' ? String(columnGap) : columnGap;\n if (\n isRoot &&\n columnGapStep !== undefined &&\n (validGaps as readonly unknown[]).includes(columnGapStep)\n ) {\n warnOnce(\n 'Theme:root-column-gap',\n `[bestax-bulma] <Theme isRoot columnGap=\"${columnGapStep}\">: a root ` +\n `Theme has no wrapper element for is-column-gap-${columnGapStep}, ` +\n 'and a gap step sets no variable, so this does nothing. To change ' +\n 'the columns gutter across the page, set ' +\n \"bulmaVars={{ '--bulma-column-gap': '…' }} instead.\"\n );\n }\n\n // Extract Bulma variable props from restProps\n const { bulmaVarProps, otherProps } = useMemo(() => {\n const varProps: Record<string, string | undefined> = {};\n const otherPropsObj: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(restProps)) {\n if (Object.prototype.hasOwnProperty.call(bulmaVarPropMap, key)) {\n varProps[key] = value as string;\n } else {\n otherPropsObj[key] = value;\n }\n }\n\n return { bulmaVarProps: varProps, otherProps: otherPropsObj };\n }, [restProps]);\n\n // Everything left in `otherProps` lands on the wrapper div, as a helper\n // class or an attribute, and so does `className`. A root Theme renders no\n // wrapper, so under `isRoot` all of it is dropped. `radius` and `columnGap`\n // are not in `otherProps`; the checks above cover them.\n if (isRoot) {\n const dropped = Object.entries(otherProps)\n .filter(\n ([, value]) => value !== undefined && value !== null && value !== false\n )\n .map(([key]) => key);\n if (className) {\n dropped.unshift('className');\n }\n if (dropped.length > 0) {\n warnOnce(\n 'Theme:root-dropped-props',\n `[bestax-bulma] <Theme isRoot>: a root Theme renders no wrapper ` +\n `element, so ${dropped.join(', ')} ` +\n `${dropped.length === 1 ? 'has' : 'have'} nothing to apply to. ` +\n 'Put helper props and classes on an element inside the Theme ' +\n 'instead.'\n );\n }\n }\n\n // Use Bulma classes for styling (only when not isRoot). Only a helper value\n // of `radius` reaches the helper; a legacy string went to the variable.\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n ...otherProps,\n radius: radiusHelper,\n columnGap,\n });\n\n // Merge bulmaVars and individual props, with props taking precedence\n const mergedVars: BulmaVars = useMemo(() => {\n const vars: BulmaVars = { ...bulmaVars };\n for (const [propName, cssVar] of Object.entries(bulmaVarPropMap)) {\n if (bulmaVarProps[propName] !== undefined) {\n vars[cssVar as BulmaVarKey] = bulmaVarProps[propName] as string;\n }\n }\n if (radiusVar !== undefined) {\n vars['--bulma-radius'] = radiusVar;\n }\n if (columnGapVar !== undefined) {\n vars['--bulma-column-gap'] = columnGapVar;\n }\n return vars;\n }, [bulmaVars, bulmaVarProps, radiusVar, columnGapVar]);\n\n // This Theme's place among root Themes; see `rootThemeRules`.\n const [rootOrder] = useState(() => nextRootOrder++);\n\n // The `:root` rules this Theme contributes, or '' when it contributes none.\n const rootRules = useMemo(() => {\n if (!isRoot) {\n return '';\n }\n const cssRules = Object.entries(mergedVars)\n .filter(\n ([key, value]) => bulmaCssVars.includes(key as BulmaVarKey) && value\n )\n .map(([key, value]) => `${key}: ${value};`)\n .join(' ');\n return cssRules ? `:root { ${cssRules} }` : '';\n }, [mergedVars, isRoot]);\n\n // Inject CSS variables globally at :root level, alongside any other root\n // Themes. Clearing `isRoot` or every variable passes '', which withdraws\n // this Theme's rules.\n useEffect(() => {\n setRootThemeRules(rootOrder, rootRules);\n }, [rootOrder, rootRules]);\n\n // Withdraw them on unmount. Kept apart from the effect above so a change\n // rewrites the shared element in place rather than removing and recreating\n // it between the cleanup and the next run.\n useEffect(() => () => setRootThemeRules(rootOrder, ''), [rootOrder]);\n\n // Bulma names its scheme attribute after the class prefix a stylesheet was\n // built with (`data-<prefix>theme`), so the prefixed builds read\n // `data-bestax-theme` and never `data-theme`.\n const classPrefix = useClassPrefix();\n\n // Toggle Bulma's light/dark scheme by writing the theme attribute on the\n // document root (<html>). This is always global, even on a scoped Theme.\n // Under a class prefix the prefixed attribute is written as well as\n // `data-theme`, so whichever build is loaded sees it; with no prefix only\n // `data-theme` is. `'system'` removes them so Bulma follows the OS\n // preference.\n useEffect(() => {\n if (colorMode === undefined) {\n return;\n }\n\n const root = document.documentElement;\n const names = classPrefix\n ? ['data-theme', `data-${classPrefix}theme`]\n : ['data-theme'];\n const previous = names.map(name => root.getAttribute(name));\n\n for (const name of names) {\n if (colorMode === 'system') {\n root.removeAttribute(name);\n continue;\n }\n try {\n root.setAttribute(name, colorMode);\n } catch {\n // A class prefix can hold characters an attribute name cannot.\n // `data-theme` is still written, as it was before the prefixed\n // attribute existed, but a sheet built with that prefix keeps its\n // scheme, so say so.\n warnOnce(\n 'Theme:color-mode-prefix',\n `[bestax-bulma] <Theme colorMode=\"${colorMode}\">: the class ` +\n `prefix \"${classPrefix}\" makes ${name} an invalid attribute ` +\n 'name, so only data-theme is written, and a stylesheet built ' +\n 'with that prefix keeps its scheme.'\n );\n }\n }\n\n // Restore the previous values when colorMode changes or the component unmounts.\n return () => {\n names.forEach((name, i) => {\n const value = previous[i];\n if (value === null) {\n root.removeAttribute(name);\n } else {\n root.setAttribute(name, value);\n }\n });\n };\n }, [colorMode, classPrefix]);\n\n // For local injection (when isRoot is false), prepare style object for CSS vars\n const style: CSSProperties = useMemo(() => {\n if (isRoot) {\n return {};\n }\n\n const styleObj: CSSProperties = {};\n for (const [key, value] of Object.entries(mergedVars)) {\n if (bulmaCssVars.includes(key as BulmaVarKey) && value) {\n (styleObj as Record<string, string>)[key] = value;\n }\n }\n return styleObj;\n }, [mergedVars, isRoot]);\n\n // Generate combined class names for the wrapper div\n const combinedClassName = useMemo(() => {\n if (isRoot) {\n return '';\n }\n return classNames(className, bulmaHelperClasses);\n }, [className, bulmaHelperClasses, isRoot]);\n\n return isRoot ? (\n <>{children}</>\n ) : (\n <div className={combinedClassName || undefined} style={style} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;;;AAaA;AACA,MAAM,YAAY,GAAG;;IAEnB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,yBAAyB;IACzB,yBAAyB;IACzB,uBAAuB;IACvB,2BAA2B;IAC3B,2BAA2B;IAC3B,iBAAiB;IACjB,wBAAwB;IACxB,gBAAgB;IAChB,uBAAuB;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,uBAAuB;IACvB,uBAAuB;IACvB,kCAAkC;IAClC,mCAAmC;IACnC,8BAA8B;IAC9B,+BAA+B;IAC/B,6BAA6B;IAC7B,8BAA8B;IAC9B,8BAA8B;IAC9B,+BAA+B;;IAE/B,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;;;;;IAKlB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,gBAAgB;;IAEhB,wBAAwB;IACxB,0BAA0B;IAC1B,qBAAqB;IACrB,oBAAoB;IACpB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,sBAAsB;IACtB,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,qBAAqB;IACrB,0BAA0B;;IAE1B,uBAAuB;IACvB,kBAAkB;IAClB,gBAAgB;IAChB,sBAAsB;IACtB,gBAAgB;IAChB,uBAAuB;IACvB,sBAAsB;IACtB,wBAAwB;IACxB,eAAe;IACf,qBAAqB;IACrB,uBAAuB;IACvB,kBAAkB;IAClB,kBAAkB;IAClB,kBAAkB;IAClB,8BAA8B;IAC9B,oBAAoB;IACpB,4BAA4B;IAC5B,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AAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,iBAAiB,IAAI,SAAS,EAAE,KAAK,EAAE,KAAK,EAAA,GAAM,IAAI,EAAA,QAAA,EACnE,QAAQ,EAAA,CACL,CACP;AACH;;"}
|
|
1
|
+
{"version":3,"file":"Theme.js","sources":["../../../src/helpers/Theme.tsx"],"sourcesContent":["import React, {\n useEffect,\n useMemo,\n useState,\n ReactNode,\n CSSProperties,\n} from 'react';\nimport classNames from './classNames';\nimport { useBulmaClasses, BulmaClassesProps } from './useBulmaClasses';\nimport { validGaps, validRadii, type BulmaGapStep } from './bulmaClassHelpers';\nimport { isDev, warnOnce } from './devWarnings';\nimport { useClassPrefix } from './Config';\n\n// --- Bulma v1 CSS variables Theme sets (originally generated from\n// CSSVAR_KEYS), in two lists by where Bulma declares them ---\n\n/**\n * Variables a value set on an ancestor reaches. Bulma declares them on\n * `:root` (or a theme scope), or on no component in its plain state, so the\n * value Theme writes on its wrapper or at `:root` is the one the components\n * under it use.\n */\nconst bulmaGlobalVars = [\n // scheme\n '--bulma-scheme-h',\n '--bulma-scheme-s',\n '--bulma-scheme-main',\n '--bulma-scheme-main-bis',\n '--bulma-scheme-main-ter',\n '--bulma-scheme-invert',\n '--bulma-scheme-invert-bis',\n '--bulma-scheme-invert-ter',\n '--bulma-light-l',\n '--bulma-light-invert-l',\n '--bulma-dark-l',\n '--bulma-dark-invert-l',\n '--bulma-soft-l',\n '--bulma-bold-l',\n '--bulma-soft-invert-l',\n '--bulma-bold-invert-l',\n '--bulma-hover-background-l-delta',\n '--bulma-active-background-l-delta',\n '--bulma-hover-border-l-delta',\n '--bulma-active-border-l-delta',\n '--bulma-hover-color-l-delta',\n '--bulma-active-color-l-delta',\n '--bulma-hover-shadow-a-delta',\n '--bulma-active-shadow-a-delta',\n // colors\n '--bulma-primary-h',\n '--bulma-primary-s',\n '--bulma-primary-l',\n '--bulma-link-h',\n '--bulma-link-s',\n '--bulma-link-l',\n '--bulma-info-h',\n '--bulma-info-s',\n '--bulma-info-l',\n '--bulma-success-h',\n '--bulma-success-s',\n '--bulma-success-l',\n '--bulma-warning-h',\n '--bulma-warning-s',\n '--bulma-warning-l',\n '--bulma-danger-h',\n '--bulma-danger-s',\n '--bulma-danger-l',\n // shadow (the upstream token .box/.card/.dropdown/.panel derive their own\n // shadow variables from; overriding it from an ancestor is the route that\n // cascades, since those selectors re-declare their derived var on\n // themselves)\n '--bulma-shadow-h',\n '--bulma-shadow-s',\n '--bulma-shadow-l',\n '--bulma-shadow',\n // typography\n '--bulma-family-primary',\n '--bulma-family-secondary',\n '--bulma-family-code',\n '--bulma-size-small',\n '--bulma-size-normal',\n '--bulma-size-medium',\n '--bulma-size-large',\n '--bulma-weight-light',\n '--bulma-weight-normal',\n '--bulma-weight-medium',\n '--bulma-weight-semibold',\n '--bulma-weight-bold',\n '--bulma-weight-extrabold',\n // other\n '--bulma-block-spacing',\n '--bulma-duration',\n '--bulma-easing',\n '--bulma-radius-small',\n '--bulma-radius',\n '--bulma-radius-medium',\n '--bulma-radius-large',\n '--bulma-radius-rounded',\n '--bulma-speed',\n '--bulma-arrow-color',\n '--bulma-loading-color',\n '--bulma-burger-h',\n '--bulma-burger-s',\n '--bulma-burger-l',\n '--bulma-burger-border-radius',\n '--bulma-burger-gap',\n '--bulma-burger-item-height',\n '--bulma-burger-item-width',\n // generic\n '--bulma-body-background-color',\n '--bulma-body-size',\n '--bulma-body-min-width',\n '--bulma-body-rendering',\n '--bulma-body-family',\n '--bulma-body-overflow-x',\n '--bulma-body-overflow-y',\n '--bulma-body-color',\n '--bulma-body-font-size',\n '--bulma-body-weight',\n '--bulma-body-line-height',\n '--bulma-code-family',\n '--bulma-code-padding',\n '--bulma-code-weight',\n '--bulma-code-size',\n '--bulma-small-font-size',\n '--bulma-hr-background-color',\n '--bulma-hr-height',\n '--bulma-hr-margin',\n '--bulma-strong-color',\n '--bulma-strong-weight',\n '--bulma-pre-font-size',\n '--bulma-pre-padding',\n '--bulma-pre-code-font-size',\n // skeleton\n '--bulma-skeleton-background',\n '--bulma-skeleton-radius',\n '--bulma-skeleton-block-min-height',\n '--bulma-skeleton-lines-gap',\n '--bulma-skeleton-line-height',\n // control\n '--bulma-control-radius',\n '--bulma-control-radius-small',\n '--bulma-control-border-width',\n '--bulma-control-height',\n '--bulma-control-line-height',\n '--bulma-control-padding-vertical',\n '--bulma-control-padding-horizontal',\n '--bulma-control-size',\n '--bulma-control-focus-shadow-l',\n // columns\n '--bulma-column-gap',\n // grid\n '--bulma-grid-cell-column-start',\n] as const;\n\n/**\n * Variables Bulma declares on the component's own element, such as\n * `--bulma-card-radius` on `.card`. An element that declares a variable uses\n * its own value whatever its ancestors set, so a value Theme writes for one\n * of these, on its wrapper or at `:root`, never reaches the component.\n *\n * They stay in `BulmaVars`, and so stay valid `bulmaVars` keys and variable\n * props, because taking a key out would be a breaking change. Setting one\n * warns in development instead; see `warnComponentVars`.\n *\n * `scripts/css-var-scopes.test.mjs` holds this split to Bulma's compiled\n * stylesheet in both directions, so a Bulma upgrade that moves a variable\n * fails there.\n */\nconst bulmaComponentVars = [\n // breadcrumb\n '--bulma-breadcrumb-item-color',\n '--bulma-breadcrumb-item-hover-color',\n '--bulma-breadcrumb-item-active-color',\n '--bulma-breadcrumb-item-padding-vertical',\n '--bulma-breadcrumb-item-padding-horizontal',\n '--bulma-breadcrumb-item-separator-color',\n // card\n '--bulma-card-color',\n '--bulma-card-background-color',\n '--bulma-card-shadow',\n '--bulma-card-radius',\n '--bulma-card-header-background-color',\n '--bulma-card-header-color',\n '--bulma-card-header-padding',\n '--bulma-card-header-shadow',\n '--bulma-card-header-weight',\n '--bulma-card-content-background-color',\n '--bulma-card-content-padding',\n '--bulma-card-footer-background-color',\n '--bulma-card-footer-border-top',\n '--bulma-card-footer-padding',\n '--bulma-card-media-margin',\n // dropdown\n '--bulma-dropdown-menu-min-width',\n '--bulma-dropdown-content-background-color',\n '--bulma-dropdown-content-offset',\n '--bulma-dropdown-content-padding-bottom',\n '--bulma-dropdown-content-padding-top',\n '--bulma-dropdown-content-radius',\n '--bulma-dropdown-content-shadow',\n '--bulma-dropdown-content-z',\n '--bulma-dropdown-item-h',\n '--bulma-dropdown-item-s',\n '--bulma-dropdown-item-l',\n '--bulma-dropdown-item-background-l',\n '--bulma-dropdown-item-background-l-delta',\n '--bulma-dropdown-item-hover-background-l-delta',\n '--bulma-dropdown-item-active-background-l-delta',\n '--bulma-dropdown-item-color-l',\n '--bulma-dropdown-item-selected-h',\n '--bulma-dropdown-item-selected-s',\n '--bulma-dropdown-item-selected-l',\n '--bulma-dropdown-item-selected-background-l',\n '--bulma-dropdown-item-selected-color-l',\n '--bulma-dropdown-divider-background-color',\n // menu\n '--bulma-menu-item-h',\n '--bulma-menu-item-s',\n '--bulma-menu-item-l',\n '--bulma-menu-item-background-l',\n '--bulma-menu-item-background-l-delta',\n '--bulma-menu-item-hover-background-l-delta',\n '--bulma-menu-item-active-background-l-delta',\n '--bulma-menu-item-color-l',\n '--bulma-menu-item-radius',\n '--bulma-menu-item-selected-h',\n '--bulma-menu-item-selected-s',\n '--bulma-menu-item-selected-l',\n '--bulma-menu-item-selected-background-l',\n '--bulma-menu-item-selected-color-l',\n '--bulma-menu-list-border-left',\n '--bulma-menu-list-line-height',\n '--bulma-menu-list-link-padding',\n '--bulma-menu-nested-list-margin',\n '--bulma-menu-nested-list-padding-left',\n '--bulma-menu-label-color',\n '--bulma-menu-label-font-size',\n '--bulma-menu-label-letter-spacing',\n '--bulma-menu-label-spacing',\n // message\n '--bulma-message-h',\n '--bulma-message-s',\n '--bulma-message-background-l',\n '--bulma-message-border-l',\n '--bulma-message-border-l-delta',\n '--bulma-message-border-style',\n '--bulma-message-border-width',\n '--bulma-message-color-l',\n '--bulma-message-radius',\n '--bulma-message-header-weight',\n '--bulma-message-header-padding',\n '--bulma-message-header-radius',\n '--bulma-message-header-body-border-width',\n '--bulma-message-header-background-l',\n '--bulma-message-header-color-l',\n '--bulma-message-body-border-width',\n '--bulma-message-body-color',\n '--bulma-message-body-padding',\n '--bulma-message-body-radius',\n '--bulma-message-body-pre-code-background-color',\n // modal\n '--bulma-modal-z',\n '--bulma-modal-background-background-color',\n '--bulma-modal-content-width',\n '--bulma-modal-content-margin-mobile',\n '--bulma-modal-content-spacing-mobile',\n '--bulma-modal-content-spacing-tablet',\n '--bulma-modal-close-dimensions',\n '--bulma-modal-close-right',\n '--bulma-modal-close-top',\n '--bulma-modal-card-spacing',\n '--bulma-modal-card-head-background-color',\n '--bulma-modal-card-head-padding',\n '--bulma-modal-card-head-radius',\n '--bulma-modal-card-title-color',\n '--bulma-modal-card-title-line-height',\n '--bulma-modal-card-title-size',\n '--bulma-modal-card-foot-background-color',\n '--bulma-modal-card-foot-radius',\n '--bulma-modal-card-body-background-color',\n '--bulma-modal-card-body-padding',\n // navbar\n '--bulma-navbar-h',\n '--bulma-navbar-s',\n '--bulma-navbar-l',\n '--bulma-navbar-background-color',\n '--bulma-navbar-box-shadow-size',\n '--bulma-navbar-box-shadow-color',\n '--bulma-navbar-padding-vertical',\n '--bulma-navbar-padding-horizontal',\n '--bulma-navbar-z',\n '--bulma-navbar-fixed-z',\n '--bulma-navbar-item-background-a',\n '--bulma-navbar-item-background-l',\n '--bulma-navbar-item-background-l-delta',\n '--bulma-navbar-item-hover-background-l-delta',\n '--bulma-navbar-item-active-background-l-delta',\n '--bulma-navbar-item-color-l',\n '--bulma-navbar-item-selected-h',\n '--bulma-navbar-item-selected-s',\n '--bulma-navbar-item-selected-l',\n '--bulma-navbar-item-selected-background-l',\n '--bulma-navbar-item-selected-color-l',\n '--bulma-navbar-item-img-max-height',\n '--bulma-navbar-burger-color',\n '--bulma-navbar-tab-hover-background-color',\n '--bulma-navbar-tab-hover-border-bottom-color',\n '--bulma-navbar-tab-active-color',\n '--bulma-navbar-tab-active-background-color',\n '--bulma-navbar-tab-active-border-bottom-color',\n '--bulma-navbar-tab-active-border-bottom-style',\n '--bulma-navbar-tab-active-border-bottom-width',\n '--bulma-navbar-dropdown-background-color',\n '--bulma-navbar-dropdown-border-l',\n '--bulma-navbar-dropdown-border-color',\n '--bulma-navbar-dropdown-border-style',\n '--bulma-navbar-dropdown-border-width',\n '--bulma-navbar-dropdown-offset',\n '--bulma-navbar-dropdown-arrow',\n '--bulma-navbar-dropdown-radius',\n '--bulma-navbar-dropdown-z',\n '--bulma-navbar-dropdown-boxed-radius',\n '--bulma-navbar-dropdown-boxed-shadow',\n '--bulma-navbar-dropdown-item-h',\n '--bulma-navbar-dropdown-item-s',\n '--bulma-navbar-dropdown-item-l',\n '--bulma-navbar-dropdown-item-background-l',\n '--bulma-navbar-dropdown-item-color-l',\n '--bulma-navbar-divider-background-l',\n '--bulma-navbar-divider-height',\n '--bulma-navbar-bottom-box-shadow-size',\n // pagination\n '--bulma-pagination-margin',\n '--bulma-pagination-min-width',\n '--bulma-pagination-item-h',\n '--bulma-pagination-item-s',\n '--bulma-pagination-item-l',\n '--bulma-pagination-item-background-l-delta',\n '--bulma-pagination-item-hover-background-l-delta',\n '--bulma-pagination-item-active-background-l-delta',\n '--bulma-pagination-item-border-style',\n '--bulma-pagination-item-border-width',\n '--bulma-pagination-item-border-l',\n '--bulma-pagination-item-border-l-delta',\n '--bulma-pagination-item-hover-border-l-delta',\n '--bulma-pagination-item-active-border-l-delta',\n '--bulma-pagination-item-focus-border-l-delta',\n '--bulma-pagination-item-color-l',\n '--bulma-pagination-item-font-size',\n '--bulma-pagination-item-margin',\n '--bulma-pagination-item-padding-left',\n '--bulma-pagination-item-padding-right',\n '--bulma-pagination-item-outer-shadow-h',\n '--bulma-pagination-item-outer-shadow-s',\n '--bulma-pagination-item-outer-shadow-l',\n '--bulma-pagination-item-outer-shadow-a',\n '--bulma-pagination-nav-padding-left',\n '--bulma-pagination-nav-padding-right',\n '--bulma-pagination-disabled-color',\n '--bulma-pagination-disabled-background-color',\n '--bulma-pagination-disabled-border-color',\n '--bulma-pagination-current-color',\n '--bulma-pagination-current-background-color',\n '--bulma-pagination-current-border-color',\n '--bulma-pagination-ellipsis-color',\n '--bulma-pagination-shadow-inset',\n '--bulma-pagination-selected-item-h',\n '--bulma-pagination-selected-item-s',\n '--bulma-pagination-selected-item-l',\n '--bulma-pagination-selected-item-background-l',\n '--bulma-pagination-selected-item-border-l',\n '--bulma-pagination-selected-item-color-l',\n // panel\n '--bulma-panel-margin',\n '--bulma-panel-item-border',\n '--bulma-panel-radius',\n '--bulma-panel-shadow',\n '--bulma-panel-heading-line-height',\n '--bulma-panel-heading-padding',\n '--bulma-panel-heading-radius',\n '--bulma-panel-heading-size',\n '--bulma-panel-heading-weight',\n '--bulma-panel-tabs-font-size',\n '--bulma-panel-tab-border-bottom-color',\n '--bulma-panel-tab-border-bottom-style',\n '--bulma-panel-tab-border-bottom-width',\n '--bulma-panel-tab-active-color',\n '--bulma-panel-list-item-color',\n '--bulma-panel-list-item-hover-color',\n '--bulma-panel-block-color',\n '--bulma-panel-block-hover-background-color',\n '--bulma-panel-block-active-border-left-color',\n '--bulma-panel-block-active-color',\n '--bulma-panel-block-active-icon-color',\n '--bulma-panel-icon-color',\n // tabs\n '--bulma-tabs-border-bottom-color',\n '--bulma-tabs-border-bottom-style',\n '--bulma-tabs-border-bottom-width',\n '--bulma-tabs-link-color',\n '--bulma-tabs-link-hover-border-bottom-color',\n '--bulma-tabs-link-hover-color',\n '--bulma-tabs-link-active-border-bottom-color',\n '--bulma-tabs-link-active-color',\n '--bulma-tabs-link-padding',\n '--bulma-tabs-boxed-link-radius',\n '--bulma-tabs-boxed-link-hover-background-color',\n '--bulma-tabs-boxed-link-hover-border-bottom-color',\n '--bulma-tabs-boxed-link-active-background-color',\n '--bulma-tabs-boxed-link-active-border-color',\n '--bulma-tabs-boxed-link-active-border-bottom-color',\n '--bulma-tabs-toggle-link-border-color',\n '--bulma-tabs-toggle-link-border-style',\n '--bulma-tabs-toggle-link-border-width',\n '--bulma-tabs-toggle-link-hover-background-color',\n '--bulma-tabs-toggle-link-hover-border-color',\n '--bulma-tabs-toggle-link-radius',\n '--bulma-tabs-toggle-link-active-background-color',\n '--bulma-tabs-toggle-link-active-border-color',\n '--bulma-tabs-toggle-link-active-color',\n // box\n '--bulma-box-background-color',\n '--bulma-box-color',\n '--bulma-box-radius',\n '--bulma-box-shadow',\n '--bulma-box-padding',\n '--bulma-box-link-hover-shadow',\n '--bulma-box-link-active-shadow',\n // content\n '--bulma-content-heading-color',\n '--bulma-content-heading-weight',\n '--bulma-content-heading-line-height',\n '--bulma-content-block-margin-bottom',\n '--bulma-content-blockquote-background-color',\n '--bulma-content-blockquote-border-left',\n '--bulma-content-blockquote-padding',\n '--bulma-content-pre-padding',\n '--bulma-content-table-cell-border',\n '--bulma-content-table-cell-border-width',\n '--bulma-content-table-cell-padding',\n '--bulma-content-table-cell-heading-color',\n '--bulma-content-table-head-cell-border-width',\n '--bulma-content-table-head-cell-color',\n '--bulma-content-table-body-last-row-cell-border-bottom-width',\n '--bulma-content-table-foot-cell-border-width',\n '--bulma-content-table-foot-cell-color',\n // delete\n '--bulma-delete-dimensions',\n '--bulma-delete-background-l',\n '--bulma-delete-background-alpha',\n '--bulma-delete-color',\n // icon\n '--bulma-icon-dimensions',\n '--bulma-icon-dimensions-small',\n '--bulma-icon-dimensions-medium',\n '--bulma-icon-dimensions-large',\n '--bulma-icon-text-spacing',\n // notification\n '--bulma-notification-h',\n '--bulma-notification-s',\n '--bulma-notification-background-l',\n '--bulma-notification-color-l',\n '--bulma-notification-code-background-color',\n '--bulma-notification-radius',\n '--bulma-notification-padding',\n // progress\n '--bulma-progress-border-radius',\n '--bulma-progress-bar-background-color',\n '--bulma-progress-value-background-color',\n '--bulma-progress-indeterminate-duration',\n // table\n '--bulma-table-color',\n '--bulma-table-background-color',\n '--bulma-table-cell-border-color',\n '--bulma-table-cell-border-style',\n '--bulma-table-cell-border-width',\n '--bulma-table-cell-padding',\n '--bulma-table-cell-heading-color',\n '--bulma-table-cell-text-align',\n '--bulma-table-head-cell-border-width',\n '--bulma-table-head-cell-color',\n '--bulma-table-foot-cell-border-width',\n '--bulma-table-foot-cell-color',\n '--bulma-table-head-background-color',\n '--bulma-table-body-background-color',\n '--bulma-table-foot-background-color',\n '--bulma-table-row-hover-background-color',\n '--bulma-table-row-active-background-color',\n '--bulma-table-row-active-color',\n '--bulma-table-striped-row-even-background-color',\n '--bulma-table-striped-row-even-hover-background-color',\n // tag\n '--bulma-tag-h',\n '--bulma-tag-s',\n '--bulma-tag-background-l',\n '--bulma-tag-background-l-delta',\n '--bulma-tag-hover-background-l-delta',\n '--bulma-tag-active-background-l-delta',\n '--bulma-tag-color-l',\n '--bulma-tag-radius',\n '--bulma-tag-delete-margin',\n // title\n '--bulma-title-color',\n '--bulma-title-family',\n '--bulma-title-size',\n '--bulma-title-weight',\n '--bulma-title-line-height',\n '--bulma-title-strong-color',\n '--bulma-title-strong-weight',\n '--bulma-title-sub-size',\n '--bulma-title-sup-size',\n '--bulma-subtitle-color',\n '--bulma-subtitle-family',\n '--bulma-subtitle-size',\n '--bulma-subtitle-weight',\n '--bulma-subtitle-line-height',\n '--bulma-subtitle-strong-color',\n '--bulma-subtitle-strong-weight',\n // file\n '--bulma-file-radius',\n '--bulma-file-name-border-color',\n '--bulma-file-name-border-style',\n '--bulma-file-name-border-width',\n '--bulma-file-name-max-width',\n '--bulma-file-h',\n '--bulma-file-s',\n '--bulma-file-background-l',\n '--bulma-file-background-l-delta',\n '--bulma-file-hover-background-l-delta',\n '--bulma-file-active-background-l-delta',\n '--bulma-file-border-l',\n '--bulma-file-border-l-delta',\n '--bulma-file-hover-border-l-delta',\n '--bulma-file-active-border-l-delta',\n '--bulma-file-cta-color-l',\n '--bulma-file-name-color-l',\n '--bulma-file-color-l-delta',\n '--bulma-file-hover-color-l-delta',\n '--bulma-file-active-color-l-delta',\n // input\n '--bulma-input-h',\n '--bulma-input-s',\n '--bulma-input-l',\n '--bulma-input-border-style',\n '--bulma-input-border-l',\n '--bulma-input-border-l-delta',\n '--bulma-input-hover-border-l-delta',\n '--bulma-input-active-border-l-delta',\n '--bulma-input-focus-h',\n '--bulma-input-focus-s',\n '--bulma-input-focus-l',\n '--bulma-input-focus-shadow-size',\n '--bulma-input-focus-shadow-alpha',\n '--bulma-input-color-l',\n '--bulma-input-background-l',\n '--bulma-input-background-l-delta',\n '--bulma-input-height',\n '--bulma-input-shadow',\n '--bulma-input-placeholder-color',\n '--bulma-input-disabled-color',\n '--bulma-input-disabled-background-color',\n '--bulma-input-disabled-border-color',\n '--bulma-input-disabled-placeholder-color',\n '--bulma-input-arrow',\n '--bulma-input-icon-color',\n '--bulma-input-icon-hover-color',\n '--bulma-input-icon-focus-color',\n '--bulma-input-radius',\n // grid\n '--bulma-grid-gap',\n '--bulma-grid-column-count',\n '--bulma-grid-column-min',\n '--bulma-grid-cell-column-span',\n // footer\n '--bulma-footer-background-color',\n '--bulma-footer-color',\n '--bulma-footer-padding',\n // hero\n '--bulma-hero-body-padding',\n '--bulma-hero-body-padding-tablet',\n '--bulma-hero-body-padding-small',\n '--bulma-hero-body-padding-medium',\n '--bulma-hero-body-padding-large',\n // media\n '--bulma-media-border-color',\n '--bulma-media-border-size',\n '--bulma-media-spacing',\n '--bulma-media-spacing-large',\n '--bulma-media-content-spacing',\n '--bulma-media-level-1-spacing',\n '--bulma-media-level-1-content-spacing',\n '--bulma-media-level-2-spacing',\n // section\n '--bulma-section-padding',\n '--bulma-section-padding-desktop',\n '--bulma-section-padding-medium',\n '--bulma-section-padding-large',\n] as const;\n\n/** Every Bulma CSS variable Theme accepts: the two lists above. */\nconst bulmaCssVars = [...bulmaGlobalVars, ...bulmaComponentVars] as const;\n\n/** A single Bulma CSS variable key from the `bulmaCssVars` tuple. */\ntype BulmaVarKey = (typeof bulmaCssVars)[number];\n/** A partial record mapping Bulma CSS variable keys to string values. */\ntype BulmaVars = Partial<Record<BulmaVarKey, string>>;\n\n/**\n * Convert a Bulma CSS variable name to a camelCase prop name.\n * @param {string} varName - CSS variable name (e.g., '--bulma-primary-h').\n * @returns {string} The camelCase prop name (e.g., 'primaryH').\n */\nfunction cssVarToProp(varName: string): string {\n return varName\n .replace(/^--bulma-/, '')\n .split('-')\n .map((part, i) =>\n i === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)\n )\n .join('');\n}\n\n/**\n * Prop names `cssVarToProp` would mint that are already helper props:\n * `--bulma-shadow` becomes `shadow`, `--bulma-radius` becomes `radius` and\n * `--bulma-column-gap` becomes `columnGap`. They stay out of\n * `bulmaVarPropMap`, so on Theme each is the helper prop it is on every other\n * component, and every one of those variables is still reachable through\n * `bulmaVars`.\n *\n * `radius` was missed here once and set `--bulma-radius` while typed as the\n * helper (#694). It still writes that variable, so what it did then keeps\n * working; see `themeRadiusVar`. `columnGap` joined when the gap helpers\n * became shared helper props, and keeps its old variable route the same way;\n * see `themeColumnGapVar`.\n */\nconst helperPropNames: readonly string[] = ['shadow', 'radius', 'columnGap'];\n\n/**\n * Mapping of camelCase prop names to their Bulma CSS variable counterparts,\n * minus the `helperPropNames` above.\n */\nconst bulmaVarPropMap = Object.fromEntries(\n bulmaCssVars\n .map(cssVar => [cssVarToProp(cssVar), cssVar])\n .filter(([prop]) => !helperPropNames.includes(prop))\n) as Record<string, string>;\n\n/**\n * What each helper value of `radius` writes to `--bulma-radius` on a Theme,\n * alongside its class.\n *\n * Before #694, `radius=\"radiusless\"` wrote `--bulma-radius: radiusless`. That\n * is not a length, and a declaration reading an invalid variable falls back\n * to its property's initial value, which for a border radius is 0. So\n * everything inside the Theme that takes its radius from that variable lost\n * it, and under `isRoot` so did everything on the page that does. Writing a\n * real 0 keeps what\n * people see and makes it valid CSS. Keyed by the helper values, so adding\n * one means saying what it writes.\n *\n * The sizes write nothing and only add their class. Their classes read the\n * radius variables, so `normal` would point `--bulma-radius` at itself, which\n * is invalid and computes to 0, and `rounded` would turn every control inside\n * the Theme into a pill.\n */\nconst radiusHelperVars: Record<\n (typeof validRadii)[number],\n string | undefined\n> = {\n radiusless: '0',\n small: undefined,\n normal: undefined,\n large: undefined,\n rounded: undefined,\n};\n\n/**\n * What `radius` writes to `--bulma-radius` on a Theme, or `undefined` when it\n * writes nothing.\n *\n * A helper value writes its `radiusHelperVars` entry. Any other non-empty\n * string is written as given: before #694 every `radius` on Theme set the\n * variable whatever its type said, and a JavaScript caller passing a length\n * got the radius it asked for. That keeps working so nothing breaks, but the\n * type rejects it, so it warns in development and points at `bulmaVars`.\n *\n * Only a string writes anything, because only a string ever set the variable\n * to something usable: an empty value or zero was dropped, and a boolean or\n * any other bare number is not a length. The helper ignores those too, the\n * way it does on every other component.\n */\nconst themeRadiusVar = (radius: unknown): string | undefined => {\n if (typeof radius !== 'string' || radius === '') {\n return undefined;\n }\n if ((validRadii as readonly string[]).includes(radius)) {\n return radiusHelperVars[radius as keyof typeof radiusHelperVars];\n }\n warnOnce(\n 'Theme:radius-variable',\n `[bestax-bulma] <Theme radius=\"${radius}\">: setting --bulma-radius ` +\n 'through the radius prop is deprecated and will stop working in a ' +\n 'future major version. On Theme, as on every other component, radius ' +\n `is the border radius helper (\"${validRadii.join('\", \"')}\"). Set the variable with ` +\n `bulmaVars={{ '--bulma-radius': '${radius}' }} instead.`\n );\n return radius;\n};\n\n/**\n * What `columnGap` writes to `--bulma-column-gap` on a Theme, or `undefined`\n * when it writes nothing.\n *\n * Until the gap helpers were shared helper props, `columnGap` on Theme was\n * the camelCase prop Theme mints for `--bulma-column-gap`. It was never in\n * `ThemeProps`, so only untyped code reached it, but that code got the\n * columns gutter it asked for. It is the column gap helper now, as on every\n * other component, so a gap step goes to the helper and writes nothing here.\n * Any other non-empty string is still written as given, so a length such as\n * `'1rem'` keeps working, with a development warning pointing at `bulmaVars`.\n *\n * Only a string writes anything, for the reason `themeRadiusVar` gives: a\n * number or a boolean was never a usable length.\n */\nconst themeColumnGapVar = (columnGap: unknown): string | undefined => {\n if (typeof columnGap !== 'string' || columnGap === '') {\n return undefined;\n }\n if ((validGaps as readonly string[]).includes(columnGap)) {\n return undefined;\n }\n warnOnce(\n 'Theme:column-gap-variable',\n `[bestax-bulma] <Theme columnGap=\"${columnGap}\">: setting ` +\n '--bulma-column-gap through the columnGap prop is deprecated and will ' +\n 'stop working in a future major version. On Theme, as on every other ' +\n 'component, columnGap is the column gap helper ' +\n `(\"${validGaps.join('\", \"')}\"). Set the variable with ` +\n `bulmaVars={{ '--bulma-column-gap': '${columnGap}' }} instead.`\n );\n return columnGap;\n};\n\n/**\n * `bulmaComponentVars` as a lookup, built by `warnComponentVars` the first\n * time it is needed.\n */\nlet componentVarKeys: ReadonlySet<string> | undefined;\n\n/**\n * Warn in development when a Theme is given variables Bulma declares on the\n * component itself (`bulmaComponentVars`), whether through `bulmaVars` or a\n * variable prop such as `cardRadius`. Theme writes them where they can never\n * win, so nothing changes on the page, and saying so is the only way to find\n * out short of reading Bulma's stylesheet.\n *\n * Keyed by the set of variables, so a Theme that keeps passing the same ones\n * warns once, and a different set warns again. An empty value writes nothing,\n * so it is not reported.\n *\n * All of this is development-only, so it returns before doing anything in\n * production, and it builds its lookup on the first development call rather\n * than when the module loads.\n */\nconst warnComponentVars = (vars: BulmaVars): void => {\n if (!isDev()) {\n return;\n }\n const keys = (componentVarKeys ??= new Set<string>(bulmaComponentVars));\n const inert = Object.entries(vars)\n .filter(([key, value]) => value && keys.has(key))\n .map(([key]) => key)\n .sort();\n if (inert.length === 0) {\n return;\n }\n const one = inert.length === 1;\n warnOnce(\n `Theme:component-vars:${inert.join(',')}`,\n `[bestax-bulma] <Theme>: Bulma declares ${inert.join(', ')} on the ` +\n `component itself, so a value set on Theme never reaches ` +\n `${one ? 'it' : 'them'}. Set ${one ? 'it' : 'them'} on that ` +\n 'component instead, with className or style, or through Sass.'\n );\n};\n\n/** The one `<style>` element every `isRoot` Theme writes into. */\nconst ROOT_STYLE_ID = 'bestax-bulma-theme-vars';\n\n/**\n * The `:root` rules of every mounted `isRoot` Theme that has any, keyed by the\n * Theme's render order.\n *\n * Root Themes share one `<style>` element, so each keeps its rules here and\n * the element is rebuilt from all of them whenever one mounts, changes or\n * unmounts. Before this each Theme overwrote the element with only its own\n * rules, and the first to unmount removed it for all of them (#736).\n *\n * The key is a number each Theme takes when it first renders. React renders a\n * parent before its children and an earlier sibling before a later one, so an\n * inner or later-mounted root Theme sorts later, comes later in the\n * stylesheet, and wins a variable two of them set, as an inner scoped Theme\n * does. Effects would give the wrong answer for nesting: React runs a child's\n * effects before its parent's. Only the relative order matters, so a number\n * skipped by StrictMode calling the initializer twice, or by a render React\n * throws away, is harmless. The key never changes, so an update keeps its\n * place and re-rendering one Theme never changes which one wins.\n */\nconst rootThemeRules = new Map<number, string>();\nlet nextRootOrder = 0;\n\n/**\n * Write every registered root Theme's rules into the shared element, creating\n * it when needed and removing it once no Theme has any rules left.\n */\nconst renderRootThemeRules = (): void => {\n let element = document.getElementById(ROOT_STYLE_ID);\n if (rootThemeRules.size === 0) {\n element?.remove();\n return;\n }\n if (!element) {\n element = document.createElement('style');\n element.id = ROOT_STYLE_ID;\n document.head.appendChild(element);\n }\n element.textContent = [...rootThemeRules]\n .sort(([a], [b]) => a - b)\n .map(([, rules]) => rules)\n .join('\\n');\n};\n\n/**\n * Record one Theme's `:root` rules, where an empty string means it has none,\n * and rebuild the shared element if that changed anything. A Theme with no\n * rules never touches the element, which is what it did before the registry\n * too.\n */\nconst setRootThemeRules = (order: number, rules: string): void => {\n if ((rootThemeRules.get(order) ?? '') === rules) {\n return;\n }\n if (rules) {\n rootThemeRules.set(order, rules);\n } else {\n rootThemeRules.delete(order);\n }\n renderRootThemeRules();\n};\n\n/**\n * Props for the Theme component.\n */\nexport interface ThemeProps extends Omit<\n BulmaClassesProps,\n 'color' | 'backgroundColor'\n> {\n /** The content the theme applies to. */\n children: ReactNode;\n /**\n * Additional CSS classes for the wrapper div. A root Theme (`isRoot`) has no\n * wrapper, so there this does nothing, and says so in development.\n */\n className?: string;\n /**\n * Inject the variables globally at `:root` instead of scoping them to a\n * wrapper div. Default: false.\n *\n * A root Theme renders its children with no wrapper, so `className` and the\n * helper props, such as `m` or `shadow`, have no element to land on. They\n * do nothing, and say so in development. `radius` and `columnGap` describe\n * what each does at the root.\n *\n * Several root Themes can be mounted at once, and each contributes its own\n * variables. Where two set the same one, the inner or later-mounted Theme\n * wins, as with nested scoped Themes, and unmounting a Theme removes only\n * what it contributed. The variables are written from an effect, so a\n * server render does not include them.\n */\n isRoot?: boolean;\n /**\n * Set Bulma's light/dark scheme by writing its theme attribute on the\n * document root (`<html>`). This is always global, even on a scoped Theme.\n * `'system'` removes the attribute so Bulma follows the OS\n * `prefers-color-scheme`. Omit to leave the current setting untouched.\n *\n * The attribute is `data-theme`. A stylesheet built with a class prefix\n * reads Bulma's prefixed form instead (`data-bestax-theme` for the\n * `bestax-prefixed` builds), so under a `ConfigProvider` `classPrefix`\n * Theme writes both, and `'system'` or unmounting clears or restores both.\n * If the prefix cannot form an attribute name, `'light'` and `'dark'`\n * write only `data-theme` and warn in development.\n */\n colorMode?: 'light' | 'dark' | 'system';\n /**\n * Bulma CSS variables to set, by name, such as\n * `{ '--bulma-primary-h': '210' }`. Only Bulma's own variables, the keys\n * the `BulmaVars` type allows, are applied, and an empty value is skipped.\n * Where a variable prop, such as `primaryH`, sets the same variable, the\n * prop wins.\n *\n * Theme writes them on its wrapper, or at `:root` under `isRoot`, so only a\n * variable that inherits from there changes anything. Bulma declares many\n * component variables, such as `--bulma-card-radius` or\n * `--bulma-delete-dimensions`, on the component's own element, and that\n * declaration beats any value set further up. Those keys are accepted but\n * do nothing here, and warn in development. Set them on the component\n * itself, with `className` or `style`, or through Sass. Each component's\n * API page says where Bulma declares its variables.\n *\n * Some global variables Bulma also declares again on one component, which\n * keeps its own value while everything else takes the Theme's. Those do not\n * warn, because the value still reaches the rest of the page.\n */\n bulmaVars?: BulmaVars;\n /**\n * Border radius helper, as on every other component: `radiusless` adds\n * `is-radiusless` to the wrapper div. On a Theme it also sets\n * `--bulma-radius` to 0, so what is inside the Theme loses its radius too.\n * Under `isRoot` there is no wrapper for the class, and the variable is\n * written at `:root`, which squares everything on the page that takes its\n * radius from it.\n *\n * The sizes (`small`, `normal`, `large`, `rounded`) add their\n * `has-radius-<value>` class to the wrapper div and set no variable, so\n * they round the wrapper and leave what is inside it alone. Under `isRoot`\n * there is no wrapper, so they do nothing, and say so in development.\n *\n * To change the radius of what is inside, set the variable through `bulmaVars`\n * (`bulmaVars={{ '--bulma-radius': '6px' }}`). This prop used to write the\n * variable for every value, so any other non-empty string still does, but\n * that route is deprecated and logs a warning in development. A number or\n * a boolean never produced a usable radius that way, and is now ignored as\n * it is on every other component.\n */\n radius?: (typeof validRadii)[number];\n /**\n * Column gap helper, as on every other component: a gap step adds\n * `is-column-gap-<step>` to the wrapper div, which spaces the wrapper's own\n * children when it is a flex or grid container. Under `isRoot` there is no\n * wrapper, so it does nothing, and says so in development.\n *\n * It does not set `--bulma-column-gap`, the variable `Columns` reads for\n * its gutters; set that through `bulmaVars`\n * (`bulmaVars={{ '--bulma-column-gap': '1rem' }}`). Before `columnGap` was\n * a helper prop, untyped JavaScript could pass it to Theme as that\n * variable. A string that is not a gap step (`'1rem'`) still sets it, but\n * that route is deprecated and logs a warning in development. A gap step\n * does not: `columnGap=\"0\"` used to zero the gutters inside the Theme, and\n * now adds `is-column-gap-0` to the wrapper instead.\n */\n columnGap?: BulmaGapStep;\n // Bulma scheme variables\n /** Base hue for the color scheme, 0 to 360. Sets `--bulma-scheme-h`. */\n schemeH?: string;\n /** Base saturation for the color scheme, as a percentage. Sets `--bulma-scheme-s`. */\n schemeS?: string;\n /** Lightness for light backgrounds. Sets `--bulma-light-l`. */\n lightL?: string;\n /** Inverted lightness for light backgrounds. Sets `--bulma-light-invert-l`. */\n lightInvertL?: string;\n /** Lightness for dark backgrounds. Sets `--bulma-dark-l`. */\n darkL?: string;\n /** Inverted lightness for dark backgrounds. Sets `--bulma-dark-invert-l`. */\n darkInvertL?: string;\n /** Lightness for soft colors. Sets `--bulma-soft-l`. */\n softL?: string;\n /** Lightness for bold colors. Sets `--bulma-bold-l`. */\n boldL?: string;\n /** Inverted lightness for soft colors. Sets `--bulma-soft-invert-l`. */\n softInvertL?: string;\n /** Inverted lightness for bold colors. Sets `--bulma-bold-invert-l`. */\n boldInvertL?: string;\n /** Lightness change of a background on hover. Sets `--bulma-hover-background-l-delta`. */\n hoverBackgroundLDelta?: string;\n /** Lightness change of a background when active. Sets `--bulma-active-background-l-delta`. */\n activeBackgroundLDelta?: string;\n /** Lightness change of a border on hover. Sets `--bulma-hover-border-l-delta`. */\n hoverBorderLDelta?: string;\n /** Lightness change of a border when active. Sets `--bulma-active-border-l-delta`. */\n activeBorderLDelta?: string;\n /** Lightness change of text color on hover. Sets `--bulma-hover-color-l-delta`. */\n hoverColorLDelta?: string;\n /** Lightness change of text color when active. Sets `--bulma-active-color-l-delta`. */\n activeColorLDelta?: string;\n /** Alpha change of a shadow on hover. Sets `--bulma-hover-shadow-a-delta`. */\n hoverShadowADelta?: string;\n /** Alpha change of a shadow when active. Sets `--bulma-active-shadow-a-delta`. */\n activeShadowADelta?: string;\n // Bulma color variables\n /** Primary color hue, 0 to 360. Sets `--bulma-primary-h`. */\n primaryH?: string;\n /** Primary color saturation, as a percentage. Sets `--bulma-primary-s`. */\n primaryS?: string;\n /** Primary color lightness, as a percentage. Sets `--bulma-primary-l`. */\n primaryL?: string;\n /** Link color hue, 0 to 360. Sets `--bulma-link-h`. */\n linkH?: string;\n /** Link color saturation, as a percentage. Sets `--bulma-link-s`. */\n linkS?: string;\n /** Link color lightness, as a percentage. Sets `--bulma-link-l`. */\n linkL?: string;\n /** Info color hue, 0 to 360. Sets `--bulma-info-h`. */\n infoH?: string;\n /** Info color saturation, as a percentage. Sets `--bulma-info-s`. */\n infoS?: string;\n /** Info color lightness, as a percentage. Sets `--bulma-info-l`. */\n infoL?: string;\n /** Success color hue, 0 to 360. Sets `--bulma-success-h`. */\n successH?: string;\n /** Success color saturation, as a percentage. Sets `--bulma-success-s`. */\n successS?: string;\n /** Success color lightness, as a percentage. Sets `--bulma-success-l`. */\n successL?: string;\n /** Warning color hue, 0 to 360. Sets `--bulma-warning-h`. */\n warningH?: string;\n /** Warning color saturation, as a percentage. Sets `--bulma-warning-s`. */\n warningS?: string;\n /** Warning color lightness, as a percentage. Sets `--bulma-warning-l`. */\n warningL?: string;\n /** Danger color hue, 0 to 360. Sets `--bulma-danger-h`. */\n dangerH?: string;\n /** Danger color saturation, as a percentage. Sets `--bulma-danger-s`. */\n dangerS?: string;\n /** Danger color lightness, as a percentage. Sets `--bulma-danger-l`. */\n dangerL?: string;\n // Add other commonly used ones as needed\n}\n\n/**\n * Theme component that injects Bulma CSS variables either globally or locally.\n *\n * When `isRoot` is true, variables are injected at `:root`. Otherwise, a wrapping\n * `<div>` scopes the variables to its children.\n *\n * @function\n * @param {ThemeProps} props - Props for the Theme component.\n * @returns {JSX.Element} The theme wrapper or fragment.\n *\n * @example\n * // Local theme scope\n * <Theme primaryH=\"171\" primaryS=\"100%\" primaryL=\"41%\">\n * <Button color=\"primary\">Themed</Button>\n * </Theme>\n */\nexport const Theme: React.FC<ThemeProps> = ({\n bulmaVars = {},\n children,\n className,\n isRoot = false,\n colorMode,\n radius,\n columnGap,\n ...restProps\n}) => {\n const radiusVar = themeRadiusVar(radius);\n const columnGapVar = themeColumnGapVar(columnGap);\n const radiusHelper = (validRadii as readonly unknown[]).includes(radius)\n ? radius\n : undefined;\n\n // A radius size only adds its class, and a root Theme renders no wrapper to\n // carry one, so on `isRoot` it does nothing at all. Say so, as the other\n // radius routes that do not do what they look like do.\n if (isRoot && radiusHelper && radiusHelperVars[radiusHelper] === undefined) {\n warnOnce(\n 'Theme:root-radius-size',\n `[bestax-bulma] <Theme isRoot radius=\"${radiusHelper}\">: a root Theme ` +\n `has no wrapper element for has-radius-${radiusHelper}, and the ` +\n 'radius sizes set no variable, so this does nothing. To round one ' +\n `element, put radius=\"${radiusHelper}\" on it. To change the radius ` +\n \"across the page, set bulmaVars={{ '--bulma-radius': '…' }} instead.\"\n );\n }\n\n // The same for a gap step in `columnGap`, which reads like the columns\n // gutter it once set and, at the root, has no element for its class.\n const columnGapStep =\n typeof columnGap === 'number' ? String(columnGap) : columnGap;\n if (\n isRoot &&\n columnGapStep !== undefined &&\n (validGaps as readonly unknown[]).includes(columnGapStep)\n ) {\n warnOnce(\n 'Theme:root-column-gap',\n `[bestax-bulma] <Theme isRoot columnGap=\"${columnGapStep}\">: a root ` +\n `Theme has no wrapper element for is-column-gap-${columnGapStep}, ` +\n 'and a gap step sets no variable, so this does nothing. To change ' +\n 'the columns gutter across the page, set ' +\n \"bulmaVars={{ '--bulma-column-gap': '…' }} instead.\"\n );\n }\n\n // Extract Bulma variable props from restProps\n const { bulmaVarProps, otherProps } = useMemo(() => {\n const varProps: Record<string, string | undefined> = {};\n const otherPropsObj: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(restProps)) {\n if (Object.prototype.hasOwnProperty.call(bulmaVarPropMap, key)) {\n varProps[key] = value as string;\n } else {\n otherPropsObj[key] = value;\n }\n }\n\n return { bulmaVarProps: varProps, otherProps: otherPropsObj };\n }, [restProps]);\n\n // Everything left in `otherProps` lands on the wrapper div, as a helper\n // class or an attribute, and so does `className`. A root Theme renders no\n // wrapper, so under `isRoot` all of it is dropped. `radius` and `columnGap`\n // are not in `otherProps`; the checks above cover them.\n if (isRoot) {\n const dropped = Object.entries(otherProps)\n .filter(\n ([, value]) => value !== undefined && value !== null && value !== false\n )\n .map(([key]) => key);\n if (className) {\n dropped.unshift('className');\n }\n if (dropped.length > 0) {\n warnOnce(\n 'Theme:root-dropped-props',\n `[bestax-bulma] <Theme isRoot>: a root Theme renders no wrapper ` +\n `element, so ${dropped.join(', ')} ` +\n `${dropped.length === 1 ? 'has' : 'have'} nothing to apply to. ` +\n 'Put helper props and classes on an element inside the Theme ' +\n 'instead.'\n );\n }\n }\n\n // Use Bulma classes for styling (only when not isRoot). Only a helper value\n // of `radius` reaches the helper; a legacy string went to the variable.\n const { bulmaHelperClasses, rest } = useBulmaClasses({\n ...otherProps,\n radius: radiusHelper,\n columnGap,\n });\n\n // Merge bulmaVars and individual props, with props taking precedence\n const mergedVars: BulmaVars = useMemo(() => {\n const vars: BulmaVars = { ...bulmaVars };\n for (const [propName, cssVar] of Object.entries(bulmaVarPropMap)) {\n if (bulmaVarProps[propName] !== undefined) {\n vars[cssVar as BulmaVarKey] = bulmaVarProps[propName] as string;\n }\n }\n if (radiusVar !== undefined) {\n vars['--bulma-radius'] = radiusVar;\n }\n if (columnGapVar !== undefined) {\n vars['--bulma-column-gap'] = columnGapVar;\n }\n return vars;\n }, [bulmaVars, bulmaVarProps, radiusVar, columnGapVar]);\n\n // From an effect rather than the render body, so rendering does none of\n // this work, and a server render none at all. In production it returns\n // at its development check before looking at the variables.\n useEffect(() => {\n warnComponentVars(mergedVars);\n }, [mergedVars]);\n\n // This Theme's place among root Themes; see `rootThemeRules`.\n const [rootOrder] = useState(() => nextRootOrder++);\n\n // The `:root` rules this Theme contributes, or '' when it contributes none.\n const rootRules = useMemo(() => {\n if (!isRoot) {\n return '';\n }\n const cssRules = Object.entries(mergedVars)\n .filter(\n ([key, value]) => bulmaCssVars.includes(key as BulmaVarKey) && value\n )\n .map(([key, value]) => `${key}: ${value};`)\n .join(' ');\n return cssRules ? `:root { ${cssRules} }` : '';\n }, [mergedVars, isRoot]);\n\n // Inject CSS variables globally at :root level, alongside any other root\n // Themes. Clearing `isRoot` or every variable passes '', which withdraws\n // this Theme's rules.\n useEffect(() => {\n setRootThemeRules(rootOrder, rootRules);\n }, [rootOrder, rootRules]);\n\n // Withdraw them on unmount. Kept apart from the effect above so a change\n // rewrites the shared element in place rather than removing and recreating\n // it between the cleanup and the next run.\n useEffect(() => () => setRootThemeRules(rootOrder, ''), [rootOrder]);\n\n // Bulma names its scheme attribute after the class prefix a stylesheet was\n // built with (`data-<prefix>theme`), so the prefixed builds read\n // `data-bestax-theme` and never `data-theme`.\n const classPrefix = useClassPrefix();\n\n // Toggle Bulma's light/dark scheme by writing the theme attribute on the\n // document root (<html>). This is always global, even on a scoped Theme.\n // Under a class prefix the prefixed attribute is written as well as\n // `data-theme`, so whichever build is loaded sees it; with no prefix only\n // `data-theme` is. `'system'` removes them so Bulma follows the OS\n // preference.\n useEffect(() => {\n if (colorMode === undefined) {\n return;\n }\n\n const root = document.documentElement;\n const names = classPrefix\n ? ['data-theme', `data-${classPrefix}theme`]\n : ['data-theme'];\n const previous = names.map(name => root.getAttribute(name));\n\n for (const name of names) {\n if (colorMode === 'system') {\n root.removeAttribute(name);\n continue;\n }\n try {\n root.setAttribute(name, colorMode);\n } catch {\n // A class prefix can hold characters an attribute name cannot.\n // `data-theme` is still written, as it was before the prefixed\n // attribute existed, but a sheet built with that prefix keeps its\n // scheme, so say so.\n warnOnce(\n 'Theme:color-mode-prefix',\n `[bestax-bulma] <Theme colorMode=\"${colorMode}\">: the class ` +\n `prefix \"${classPrefix}\" makes ${name} an invalid attribute ` +\n 'name, so only data-theme is written, and a stylesheet built ' +\n 'with that prefix keeps its scheme.'\n );\n }\n }\n\n // Restore the previous values when colorMode changes or the component unmounts.\n return () => {\n names.forEach((name, i) => {\n const value = previous[i];\n if (value === null) {\n root.removeAttribute(name);\n } else {\n root.setAttribute(name, value);\n }\n });\n };\n }, [colorMode, classPrefix]);\n\n // For local injection (when isRoot is false), prepare style object for CSS vars\n const style: CSSProperties = useMemo(() => {\n if (isRoot) {\n return {};\n }\n\n const styleObj: CSSProperties = {};\n for (const [key, value] of Object.entries(mergedVars)) {\n if (bulmaCssVars.includes(key as BulmaVarKey) && value) {\n (styleObj as Record<string, string>)[key] = value;\n }\n }\n return styleObj;\n }, [mergedVars, isRoot]);\n\n // Generate combined class names for the wrapper div\n const combinedClassName = useMemo(() => {\n if (isRoot) {\n return '';\n }\n return classNames(className, bulmaHelperClasses);\n }, [className, bulmaHelperClasses, isRoot]);\n\n return isRoot ? (\n <>{children}</>\n ) : (\n <div className={combinedClassName || undefined} style={style} {...rest}>\n {children}\n </div>\n );\n};\n"],"names":["_jsx","_Fragment"],"mappings":";;;;;;;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,EAAE,KAAK,EAAA,GAAM,IAAI,EAAA,QAAA,EACnE,QAAQ,EAAA,CACL,CACP;AACH;;"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
/* @allxsmith/bestax-bulma — AI agents: see AGENTS.md in the package root, or https://bestax.io/llms.txt */
|
|
2
2
|
// INTERNAL: deliberately not exported from src/index.ts.
|
|
3
3
|
const warnedKeys = new Set();
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Whether this is a development build. Fail closed: with no bundler and no
|
|
6
|
+
* Node (raw CDN ESM), reading `process` throws and this is false, so
|
|
7
|
+
* production can never warn by accident. Exported for a caller whose
|
|
8
|
+
* development-only check costs something before it reaches `warnOnce`, so it
|
|
9
|
+
* can skip that work in production too.
|
|
10
|
+
*/
|
|
6
11
|
const isDev = () => {
|
|
7
12
|
try {
|
|
8
13
|
return process.env.NODE_ENV !== 'production';
|
|
@@ -23,5 +28,5 @@ const warnOnce = (key, message) => {
|
|
|
23
28
|
console.warn(message);
|
|
24
29
|
};
|
|
25
30
|
|
|
26
|
-
export { warnOnce };
|
|
31
|
+
export { isDev, warnOnce };
|
|
27
32
|
//# sourceMappingURL=devWarnings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devWarnings.js","sources":["../../../src/helpers/devWarnings.ts"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts.\n\nconst warnedKeys = new Set<string>();\n\n/** Test-only: re-arm the warn-once registry. */\nexport const resetDevWarnings = (): void => {\n warnedKeys.clear();\n};\n\n// Local declaration because the library tsconfig has no Node types. The\n// reference must stay a bare `process.env.NODE_ENV` so bundlers can replace\n// it statically.\ndeclare const process: { env: { NODE_ENV?: string } };\n\n
|
|
1
|
+
{"version":3,"file":"devWarnings.js","sources":["../../../src/helpers/devWarnings.ts"],"sourcesContent":["// INTERNAL: deliberately not exported from src/index.ts.\n\nconst warnedKeys = new Set<string>();\n\n/** Test-only: re-arm the warn-once registry. */\nexport const resetDevWarnings = (): void => {\n warnedKeys.clear();\n};\n\n// Local declaration because the library tsconfig has no Node types. The\n// reference must stay a bare `process.env.NODE_ENV` so bundlers can replace\n// it statically.\ndeclare const process: { env: { NODE_ENV?: string } };\n\n/**\n * Whether this is a development build. Fail closed: with no bundler and no\n * Node (raw CDN ESM), reading `process` throws and this is false, so\n * production can never warn by accident. Exported for a caller whose\n * development-only check costs something before it reaches `warnOnce`, so it\n * can skip that work in production too.\n */\nexport const isDev = (): boolean => {\n try {\n return process.env.NODE_ENV !== 'production';\n } catch {\n return false;\n }\n};\n\n/**\n * Logs a console warning in development, once per `key` for the life of the\n * page. Safe to call during render: a re-render, or a second instance hitting\n * the same case, finds the key already recorded and stays quiet.\n */\nexport const warnOnce = (key: string, message: string): void => {\n if (!isDev() || warnedKeys.has(key)) return;\n warnedKeys.add(key);\n console.warn(message);\n};\n"],"names":[],"mappings":";AAAA;AAEA,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU;AAYpC;;;;;;AAMG;AACI,MAAM,KAAK,GAAG,MAAc;AACjC,IAAA,IAAI;AACF,QAAA,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAC9C;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;AAEA;;;;AAIG;MACU,QAAQ,GAAG,CAAC,GAAW,EAAE,OAAe,KAAU;IAC7D,IAAI,CAAC,KAAK,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE;AACrC,IAAA,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC;AACnB,IAAA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;AACvB;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { classNames } from './classNames.js';
|
|
4
4
|
import { useConfig } from './Config.js';
|
|
5
|
-
import { validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink
|
|
5
|
+
import { createBulmaClassHelpers, validFlexDirections, validFlexWraps, validJustifyContents, validAlignContents, validAlignItems, validAlignSelfs, validFlexGrowShrink } from './bulmaClassHelpers.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A hook that generates Bulma flexbox helper classes. Flex container helpers
|
|
@@ -36,6 +36,7 @@ const isDetailsSummary = (el) => el.parentElement?.localName === 'details' &&
|
|
|
36
36
|
* can read `-1` for an editable region or an `<embed>` that Tab still visits,
|
|
37
37
|
* and `0` for a `<video>` without controls that it doesn't. So a valid
|
|
38
38
|
* `tabindex` attribute decides, and otherwise the element's kind does.
|
|
39
|
+
* Internal like `firstTabStop`: `src/index.ts` names what it takes from here.
|
|
39
40
|
*/
|
|
40
41
|
function isTabbableKind(el) {
|
|
41
42
|
const tabindex = el.getAttribute('tabindex');
|
|
@@ -466,5 +467,5 @@ function useFocusTrap(containerRef, options = {}) {
|
|
|
466
467
|
});
|
|
467
468
|
}
|
|
468
469
|
|
|
469
|
-
export { firstTabStop, useFocusTrap };
|
|
470
|
+
export { firstTabStop, isTabbableKind, useFocusTrap };
|
|
470
471
|
//# sourceMappingURL=useFocusTrap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusTrap.js","sources":["../../../src/helpers/useFocusTrap.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\nimport { useIsHydrated } from './useIsHydrated';\nimport { getDeepestActiveElement } from './shadowDom';\n\n/**\n * Whether `el` is editable while its parent is not, which makes it an editing\n * host: the one tab stop an editable region gets. `contenteditable=\"false\"`\n * turns editing off, and a missing or unknown value inherits the parent's.\n */\nfunction isEditingHost(el: Element): boolean {\n const editable = (node: Element): boolean | null => {\n const value = node.getAttribute('contenteditable')?.toLowerCase();\n if (value === undefined) return null;\n if (value === '' || value === 'true' || value === 'plaintext-only') {\n return true;\n }\n return value === 'false' ? false : null;\n };\n if (editable(el) !== true) return false;\n for (let node = el.parentElement; node; node = node.parentElement) {\n const state = editable(node);\n if (state !== null) return !state;\n }\n return true;\n}\n\n/** Whether `el` is the summary of its `<details>`: the first one, not a stray. */\nconst isDetailsSummary = (el: Element): boolean =>\n el.parentElement?.localName === 'details' &&\n Array.from(el.parentElement.children).find(\n child => child.localName === 'summary'\n ) === el;\n\n/**\n * Whether the browser puts `el` in the tab order, before anything that hides\n * or disables it. The `tabIndex` property can't answer this on its own: it\n * can read `-1` for an editable region or an `<embed>` that Tab still visits,\n * and `0` for a `<video>` without controls that it doesn't. So a valid\n * `tabindex` attribute decides, and otherwise the element's kind does.\n */\nfunction isTabbableKind(el: Element): boolean {\n const tabindex = el.getAttribute('tabindex');\n if (tabindex !== null && /^\\s*[+-]?\\d/.test(tabindex)) {\n return (el as HTMLElement).tabIndex >= 0;\n }\n switch (el.localName) {\n case 'a':\n case 'area':\n return el.hasAttribute('href');\n case 'input':\n return (el as HTMLInputElement).type !== 'hidden';\n case 'button':\n case 'select':\n case 'textarea':\n case 'iframe':\n case 'embed':\n case 'object':\n return true;\n case 'audio':\n case 'video':\n return el.hasAttribute('controls');\n case 'summary':\n return isDetailsSummary(el);\n default:\n return isEditingHost(el);\n }\n}\n\n/**\n * The node's parent in the flattened tree, the one the browser renders and\n * tabs through: the slot it is assigned to, else its parent, else the host of\n * the shadow root it tops, and nothing above the document. A closed shadow\n * root hides its slots (`assignedSlot` reads `null` under one), so a child of\n * its host goes straight to the host, whether a slot takes it or not.\n */\nconst flatParent = (node: Node): Node | null =>\n (node as Element).assignedSlot ??\n node.parentElement ??\n (node.parentNode as ShadowRoot | null)?.host ??\n null;\n\n/**\n * The element's children in the flattened tree, in the order they render: a\n * host's shadow root content, a slot's assigned elements (or its fallback\n * content when nothing is assigned), anything else's own children. A host\n * whose shadow root is closed has no root to read, so its own children stand\n * in, including any that no slot takes and that aren't rendered.\n */\nfunction flatChildren(el: Element): Element[] {\n if (el.shadowRoot) return Array.from(el.shadowRoot.children);\n if (el.localName === 'slot') {\n const assigned = (el as HTMLSlotElement).assignedNodes();\n if (assigned.length > 0) {\n return assigned.filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n );\n }\n }\n return Array.from(el.children);\n}\n\nconst isShown = (el: Element): boolean =>\n !el.hasAttribute('inert') && getComputedStyle(el).display !== 'none';\n\nconst isVisible = (el: Element): boolean => {\n const { visibility } = getComputedStyle(el);\n return visibility !== 'hidden' && visibility !== 'collapse';\n};\n\n/**\n * Whether nothing from `el` up to `top` hides it: `inert`, `display: none`\n * (not inherited, so each element is checked) or a closed `<details>` it\n * isn't the summary of. `top` itself isn't checked, and `null` walks to the\n * top of the page.\n */\nfunction isShownUpTo(el: Element, top: Node | null): boolean {\n let below: Element | null = null;\n for (\n let node: Element | null = el;\n node && node !== top;\n node = flatParent(node) as Element | null\n ) {\n if (!isShown(node)) return false;\n if (\n below &&\n node.localName === 'details' &&\n !node.hasAttribute('open') &&\n !isDetailsSummary(below)\n ) {\n return false;\n }\n below = node;\n }\n return true;\n}\n\n/**\n * The images that use the image map `area` belongs to. An image names its\n * map with `usemap=\"#…\"`, matching the map's `name` or `id`.\n */\nfunction imagesUsingMapOf(area: Element): Element[] {\n const map = area.closest('map');\n if (!map) return [];\n const names = [map.getAttribute('name'), map.id].filter(name => name);\n return Array.from(\n (area.getRootNode() as ParentNode).querySelectorAll('img[usemap]')\n ).filter(img => {\n const ref = img.getAttribute('usemap') as string;\n return ref.startsWith('#') && names.includes(ref.slice(1));\n });\n}\n\n/**\n * Whether an image map area is shown. An area has no box of its own: the\n * HTML rendering rules give it `display: none`, though a browser may not\n * report that. So it counts where an image using its map is shown, as long\n * as nothing makes it inert.\n */\nfunction isAreaShown(area: Element, container: Element): boolean {\n for (\n let node: Element | null = area;\n node && node !== container;\n node = flatParent(node) as Element | null\n ) {\n if (node.hasAttribute('inert')) return false;\n }\n return imagesUsingMapOf(area).some(\n img => isShownUpTo(img, null) && isVisible(img)\n );\n}\n\n/**\n * Whether Tab can land on `el`, one of the kinds it visits. A disabled control\n * (including one inside a disabled `<fieldset>`), an inert subtree and\n * anything not rendered are skipped. `visibility` is inherited, so the\n * element's own computed value covers its ancestors.\n */\nfunction isRenderedAndEnabled(el: Element, container: Element): boolean {\n if (el.matches(':disabled')) return false;\n if (el.localName === 'area') return isAreaShown(el, container);\n return isShownUpTo(el, container) && isVisible(el);\n}\n\n/** A radio button with a name, which shares one tab stop with its group. */\nconst isGroupedRadio = (el: Element): el is HTMLInputElement =>\n el.localName === 'input' &&\n (el as HTMLInputElement).type === 'radio' &&\n (el as HTMLInputElement).name !== '';\n\n/** Whether two radio buttons are in one group: same name, form owner and tree. */\nconst sameGroup = (a: HTMLInputElement, b: Element): b is HTMLInputElement =>\n isGroupedRadio(b) &&\n b.name === a.name &&\n b.form === a.form &&\n b.getRootNode() === a.getRootNode();\n\n/**\n * The checked button of `radio`'s group. The group isn't bounded by the trap,\n * so this looks through the radio's whole tree.\n */\nconst checkedInGroup = (radio: HTMLInputElement): Element | undefined =>\n Array.from(\n (radio.getRootNode() as ParentNode).querySelectorAll('input:checked')\n ).find(el => sameGroup(radio, el));\n\n/** The flattened-tree ancestors of `node` below the container, outermost first, then `node`. */\nfunction flatChain(node: Node, container: Node): Node[] {\n const chain: Node[] = [];\n for (let n: Node | null = node; n && n !== container; n = flatParent(n)) {\n chain.unshift(n);\n }\n return chain;\n}\n\n/**\n * Whether `node` is inside the container in the flattened tree: in it, in a\n * shadow root it holds, or slotted into it. A child of a closed-root host\n * counts as inside wherever the host is, as its slot can't be seen.\n */\nfunction inside(container: Node, node: Node): boolean {\n for (let n: Node | null = node; n; n = flatParent(n)) {\n if (n === container) return true;\n }\n return false;\n}\n\n/**\n * `true` when Tab reaches `b` after `a`, which is their order in the\n * flattened tree: a shadow host comes before its shadow root's content, and\n * slotted content comes where its slot is. A closed root's slots can't be\n * seen, so its host's children keep their place in the light DOM. Two\n * flattened-tree siblings are always in one DOM tree, so their document\n * position decides between them.\n */\nfunction follows(container: Element, a: Node, b: Node): boolean {\n const chainA = flatChain(a, container);\n const chainB = flatChain(b, container);\n for (let i = 0; i < Math.max(chainA.length, chainB.length); i++) {\n const [x, y] = [chainA[i], chainB[i]];\n if (x === y) continue;\n if (!x) return true;\n if (!y) return false;\n return Boolean(\n x.compareDocumentPosition(y) & Node.DOCUMENT_POSITION_FOLLOWING\n );\n }\n return false;\n}\n\n/**\n * Every element of a tabbable kind under `el` in the flattened tree, depth\n * first, which is the order Tab visits them. Under a host whose shadow root\n * is closed, that takes in the host's own children instead, rendered or not.\n */\nfunction collectCandidates(\n el: Element,\n out: HTMLElement[] = []\n): HTMLElement[] {\n for (const child of flatChildren(el)) {\n if (isTabbableKind(child)) out.push(child as HTMLElement);\n collectCandidates(child, out);\n }\n return out;\n}\n\ninterface TabStops {\n first: HTMLElement;\n last: HTMLElement;\n /** The stop that stands for `node`: its group's stop for a radio button. */\n stopFor(node: Element): Element;\n}\n\n/**\n * The first and last tab stops inside `container`, or `null` when there are\n * none. Only the ends matter for wrapping, so the style checks run from each\n * end until they find a stop rather than over every candidate.\n *\n * A radio group is one stop, the way the browser treats it: its checked\n * button, or its first when none is checked. Counting every button would make\n * the group's last one an end, and Tab from the checked one would leave. The\n * group goes by name, form owner and tree, not by the trap, so a checked\n * button outside the container that Tab can land on leaves the group no stop\n * inside. One that Tab can't land on leaves the group as if none were checked.\n */\nfunction findTabStops(container: HTMLElement): TabStops | null {\n const candidates = collectCandidates(container);\n const checked = new Map<Element, boolean>();\n const usable = (el: Element): boolean => {\n let ok = checked.get(el);\n if (ok === undefined) {\n ok = isRenderedAndEnabled(el, container);\n checked.set(el, ok);\n }\n return ok;\n };\n // Resolved once per group, filed under each of its buttons, since finding\n // the checked one scans the radio's whole tree.\n const groupStops = new Map<Element, HTMLElement | undefined>();\n const groupStop = (radio: HTMLInputElement): HTMLElement | undefined => {\n if (groupStops.has(radio)) return groupStops.get(radio);\n const group = candidates.filter(el => sameGroup(radio, el));\n const on = checkedInGroup(radio);\n const stop =\n on && isTabbableKind(on) && usable(on)\n ? group.find(el => el === on)\n : group.find(usable);\n for (const el of [radio, ...group]) groupStops.set(el, stop);\n return stop;\n };\n const isStop = (el: HTMLElement): boolean =>\n usable(el) && (!isGroupedRadio(el) || groupStop(el) === el);\n\n const first = candidates.find(isStop);\n if (!first) return null;\n let last = first;\n for (let i = candidates.length - 1; candidates[i] !== first; i--) {\n if (isStop(candidates[i])) {\n last = candidates[i];\n break;\n }\n }\n return {\n first,\n last,\n stopFor: node => (isGroupedRadio(node) && groupStop(node)) || node,\n };\n}\n\n/**\n * The first tab stop inside `container`, found the way the trap finds it, or\n * `null` when there is none. For a component that moves focus into a panel\n * without trapping it there. `src/index.ts` names its exports from this\n * module, so this one stays internal.\n */\nexport function firstTabStop(container: HTMLElement): HTMLElement | null {\n return findTabStops(container)?.first ?? null;\n}\n\n/**\n * The element that has focus in the container's own document (an iframe's,\n * when it renders into one), inside open shadow roots too. Focus inside a\n * closed one reads as its host, which the comparisons above place like any\n * other element. Browsers fall back to <body> when nothing has\n * focus. jsdom, where consumers run their tests, reports nothing once focus\n * was inside a shadow root that was removed, so this falls back for it.\n */\nconst focusedElement = (doc: Document): Element =>\n getDeepestActiveElement(doc) ?? doc.body;\n\n/**\n * Options for `useFocusTrap`.\n */\nexport interface UseFocusTrapOptions {\n /**\n * Whether the trap is on. Turning it on moves focus into the container;\n * turning it off (or unmounting) releases Tab and restores focus.\n * @defaultValue true\n */\n active?: boolean;\n /**\n * The element inside the container to focus when the trap turns on. It has\n * to be one that can take focus, so a heading needs `tabIndex={-1}`. When\n * focusing it doesn't put focus inside the container (the ref is empty, or\n * its element is outside, disabled, hidden or can't take focus), focus goes\n * to the first tab stop inside the container, and to the container itself\n * when there is none.\n */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /**\n * Where focus goes when the trap turns off. `true` returns it to the element\n * that had focus when the trap turned on; a ref sends it to that element\n * instead; `false` leaves it alone. Focus is only moved while the trap still\n * holds it, so a click that already put focus somewhere else outside the\n * container keeps it there.\n *\n * `true` reads focus after the container's content has mounted, so content\n * that focuses itself as it mounts (an `autoFocus` input) hides the element\n * that opened it. And some browsers don't focus a button when it is\n * clicked. For a panel opened from a button, pass the button's ref.\n * @defaultValue true\n */\n restoreFocus?: boolean | RefObject<HTMLElement | null>;\n}\n\n/**\n * Keeps keyboard focus inside a container while it is active: focus moves in\n * when the trap turns on, Tab and Shift+Tab wrap between the first and last\n * tab stops, and focus goes back where it came from when the trap turns off.\n *\n * Tab stops are what the browser's Tab visits, in document order: links,\n * form controls, frames, media with controls, a `<details>` summary, editable\n * regions, anything with `tabIndex={0}`, and the content of open shadow\n * roots. Hidden, disabled, inert and `tabIndex={-1}` elements are skipped,\n * and a radio group counts once. Give the container `tabIndex={-1}` so it can\n * hold focus itself when nothing inside can. The trap listens on the\n * container, so a trap nested inside another handles Tab first and the outer\n * one stands aside.\n *\n * The trap is about Tab. If a Tab it let through still takes focus out (a\n * browser can leave out a stop the page has, such as links when its settings\n * say to), it sends focus back to the other end. A pointer or a script moving\n * focus out is left alone, because pulling focus back from a click is modal\n * behaviour, and a modal also has to block the page behind it, which `Modal`\n * does. Content the container renders through a portal lives elsewhere in\n * the DOM, so it is outside the trap: render nested overlays inside the\n * container, or give them a trap of their own. To trap content a `Portal`\n * renders, pass a ref to the element inside the `Portal` as `containerRef`.\n *\n * The trap looks at `containerRef` again each time the component calling it\n * renders. A container that mounts after the trap turns on, such as a panel\n * waiting for a `Portal` target held in state, has it attach once that\n * component renders with the container in the DOM. When the container leaves\n * or is replaced, the trap lets go of it as it would turning off, handing\n * focus back, and attaches to the next one.\n * A child that mounts the container in a render of its own (from its own\n * state, or as a `Suspense` boundary resolves) goes unseen until the\n * component calling the hook renders again. The trap waits for hydration, so\n * that component renders again when the page hydrates, and portaled content,\n * which first appears then, is found.\n *\n * @function useFocusTrap\n * @param containerRef - Ref to the element focus stays inside.\n * @param options - When the trap is on, and where focus starts and ends.\n *\n * @example\n * const panelRef = useRef<HTMLDivElement>(null);\n * useFocusTrap(panelRef, { active: isOpen });\n * return isOpen ? (\n * <div ref={panelRef} role=\"dialog\" aria-label=\"Filters\" tabIndex={-1}>\n * …\n * </div>\n * ) : null;\n */\nexport function useFocusTrap(\n containerRef: RefObject<HTMLElement | null>,\n options: UseFocusTrapOptions = {}\n): void {\n const { active = true, initialFocusRef, restoreFocus = true } = options;\n // Portaled content has no server-rendered counterpart, so a portaled\n // container only exists from the commit after hydration.\n const hydrated = useIsHydrated();\n // The container the trap is attached to, or `null` while it has none.\n const heldRef = useRef<HTMLElement | null>(null);\n // Bumped to run the trap again when the container in the ref changes.\n const [refChanges, setRefChanges] = useState(0);\n\n useEffect(() => {\n heldRef.current = null;\n if (!active || !hydrated) return undefined;\n const container = containerRef.current;\n if (!container) return undefined;\n heldRef.current = container;\n const doc = container.ownerDocument;\n\n const opener = focusedElement(doc) as HTMLElement;\n\n // `initialFocusRef` counts only when focusing it puts focus inside. Focus\n // put outside would stay out, as Tab there never reaches the container's\n // listener, and focusing something that can't take focus (a heading\n // without `tabIndex`, a disabled control) leaves focus where it was.\n const initial = initialFocusRef?.current;\n const inTrap = initial && inside(container, initial) ? initial : null;\n inTrap?.focus();\n if (!inTrap || !inside(container, focusedElement(doc))) {\n (findTabStops(container)?.first ?? container).focus();\n }\n\n // Where focus goes if a Tab the trap let the browser handle takes it out,\n // held until that Tab has finished moving focus.\n let wrapTo: HTMLElement | null = null;\n let wrapTimer: ReturnType<typeof setTimeout> | undefined;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n // A trap nested inside this one has already wrapped focus.\n if (e.key !== 'Tab' || e.defaultPrevented) return;\n const stops = findTabStops(container);\n if (!stops) {\n e.preventDefault();\n container.focus();\n return;\n }\n const current = stops.stopFor(focusedElement(doc));\n // Wrap whenever the browser has no stop left in that direction inside\n // the container. Comparing positions rather than testing `=== first`\n // also covers focus resting on the container or on an element outside\n // the tab order, which the browser would otherwise walk straight out of.\n if (\n e.shiftKey\n ? !follows(container, stops.first, current)\n : !follows(container, current, stops.last)\n ) {\n e.preventDefault();\n (e.shiftKey ? stops.last : stops.first).focus();\n return;\n }\n wrapTo = e.shiftKey ? stops.last : stops.first;\n clearTimeout(wrapTimer);\n wrapTimer = setTimeout(() => {\n wrapTo = null;\n });\n };\n\n // The browser moves focus as soon as the keydown is over, so focus that\n // lands outside while `wrapTo` is set got there by that Tab.\n const handleFocusIn = (e: FocusEvent) => {\n if (!wrapTo || inside(container, e.composedPath()[0] as Node)) return;\n const target = wrapTo;\n wrapTo = null;\n target.focus();\n };\n\n container.addEventListener('keydown', handleKeyDown);\n doc.addEventListener('focusin', handleFocusIn, true);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n doc.removeEventListener('focusin', handleFocusIn, true);\n clearTimeout(wrapTimer);\n let target = restoreFocus ? opener : null;\n // `null` is an object too, and a caller without types can pass it.\n if (restoreFocus && typeof restoreFocus === 'object') {\n // Read now rather than when the trap turned on: a trigger that\n // re-mounted in between has a new node.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n target = restoreFocus.current;\n }\n // Hand focus back only while the trap still holds it: inside the\n // container, or dropped to <body> because the container left the page.\n const now = focusedElement(doc);\n if (target && (now === doc.body || inside(container, now))) {\n target.focus();\n }\n };\n }, [\n active,\n hydrated,\n containerRef,\n initialFocusRef,\n restoreFocus,\n refChanges,\n ]);\n\n // Nothing says when a ref is set, so after every render, a ref that no\n // longer matches what the trap holds (a container that mounted, left or was\n // replaced) runs it again. Effects run in order, so whenever the effect\n // above ran in this commit, it read the ref just before this does, and a\n // mismatch means the ref changed in a render it didn't run for. The render\n // a bump asks for runs it, so the two match and the trap settles. An empty\n // ref matches a trap holding nothing, so a container that never mounts\n // costs no render.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- after every render on purpose\n useEffect(() => {\n if (active && hydrated && containerRef.current !== heldRef.current) {\n setRefChanges(n => n + 1);\n }\n });\n}\n"],"names":[],"mappings":";;;;;AAKA;;;;AAIG;AACH,SAAS,aAAa,CAAC,EAAW,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H,IAAA,CAAC,EAAE;QACD,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,eAAe;QACf,YAAY;QACZ,UAAU;AACX,KAAA,CAAC;;;;;;;;;;IAWF,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,MAAM,IAAI,QAAQ,IAAI,YAAY,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE;YAClE,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B;AACF,IAAA,CAAC,CAAC;AACJ;;"}
|
|
1
|
+
{"version":3,"file":"useFocusTrap.js","sources":["../../../src/helpers/useFocusTrap.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport type { RefObject } from 'react';\nimport { useIsHydrated } from './useIsHydrated';\nimport { getDeepestActiveElement } from './shadowDom';\n\n/**\n * Whether `el` is editable while its parent is not, which makes it an editing\n * host: the one tab stop an editable region gets. `contenteditable=\"false\"`\n * turns editing off, and a missing or unknown value inherits the parent's.\n */\nfunction isEditingHost(el: Element): boolean {\n const editable = (node: Element): boolean | null => {\n const value = node.getAttribute('contenteditable')?.toLowerCase();\n if (value === undefined) return null;\n if (value === '' || value === 'true' || value === 'plaintext-only') {\n return true;\n }\n return value === 'false' ? false : null;\n };\n if (editable(el) !== true) return false;\n for (let node = el.parentElement; node; node = node.parentElement) {\n const state = editable(node);\n if (state !== null) return !state;\n }\n return true;\n}\n\n/** Whether `el` is the summary of its `<details>`: the first one, not a stray. */\nconst isDetailsSummary = (el: Element): boolean =>\n el.parentElement?.localName === 'details' &&\n Array.from(el.parentElement.children).find(\n child => child.localName === 'summary'\n ) === el;\n\n/**\n * Whether the browser puts `el` in the tab order, before anything that hides\n * or disables it. The `tabIndex` property can't answer this on its own: it\n * can read `-1` for an editable region or an `<embed>` that Tab still visits,\n * and `0` for a `<video>` without controls that it doesn't. So a valid\n * `tabindex` attribute decides, and otherwise the element's kind does.\n * Internal like `firstTabStop`: `src/index.ts` names what it takes from here.\n */\nexport function isTabbableKind(el: Element): boolean {\n const tabindex = el.getAttribute('tabindex');\n if (tabindex !== null && /^\\s*[+-]?\\d/.test(tabindex)) {\n return (el as HTMLElement).tabIndex >= 0;\n }\n switch (el.localName) {\n case 'a':\n case 'area':\n return el.hasAttribute('href');\n case 'input':\n return (el as HTMLInputElement).type !== 'hidden';\n case 'button':\n case 'select':\n case 'textarea':\n case 'iframe':\n case 'embed':\n case 'object':\n return true;\n case 'audio':\n case 'video':\n return el.hasAttribute('controls');\n case 'summary':\n return isDetailsSummary(el);\n default:\n return isEditingHost(el);\n }\n}\n\n/**\n * The node's parent in the flattened tree, the one the browser renders and\n * tabs through: the slot it is assigned to, else its parent, else the host of\n * the shadow root it tops, and nothing above the document. A closed shadow\n * root hides its slots (`assignedSlot` reads `null` under one), so a child of\n * its host goes straight to the host, whether a slot takes it or not.\n */\nconst flatParent = (node: Node): Node | null =>\n (node as Element).assignedSlot ??\n node.parentElement ??\n (node.parentNode as ShadowRoot | null)?.host ??\n null;\n\n/**\n * The element's children in the flattened tree, in the order they render: a\n * host's shadow root content, a slot's assigned elements (or its fallback\n * content when nothing is assigned), anything else's own children. A host\n * whose shadow root is closed has no root to read, so its own children stand\n * in, including any that no slot takes and that aren't rendered.\n */\nfunction flatChildren(el: Element): Element[] {\n if (el.shadowRoot) return Array.from(el.shadowRoot.children);\n if (el.localName === 'slot') {\n const assigned = (el as HTMLSlotElement).assignedNodes();\n if (assigned.length > 0) {\n return assigned.filter(\n (node): node is Element => node.nodeType === Node.ELEMENT_NODE\n );\n }\n }\n return Array.from(el.children);\n}\n\nconst isShown = (el: Element): boolean =>\n !el.hasAttribute('inert') && getComputedStyle(el).display !== 'none';\n\nconst isVisible = (el: Element): boolean => {\n const { visibility } = getComputedStyle(el);\n return visibility !== 'hidden' && visibility !== 'collapse';\n};\n\n/**\n * Whether nothing from `el` up to `top` hides it: `inert`, `display: none`\n * (not inherited, so each element is checked) or a closed `<details>` it\n * isn't the summary of. `top` itself isn't checked, and `null` walks to the\n * top of the page.\n */\nfunction isShownUpTo(el: Element, top: Node | null): boolean {\n let below: Element | null = null;\n for (\n let node: Element | null = el;\n node && node !== top;\n node = flatParent(node) as Element | null\n ) {\n if (!isShown(node)) return false;\n if (\n below &&\n node.localName === 'details' &&\n !node.hasAttribute('open') &&\n !isDetailsSummary(below)\n ) {\n return false;\n }\n below = node;\n }\n return true;\n}\n\n/**\n * The images that use the image map `area` belongs to. An image names its\n * map with `usemap=\"#…\"`, matching the map's `name` or `id`.\n */\nfunction imagesUsingMapOf(area: Element): Element[] {\n const map = area.closest('map');\n if (!map) return [];\n const names = [map.getAttribute('name'), map.id].filter(name => name);\n return Array.from(\n (area.getRootNode() as ParentNode).querySelectorAll('img[usemap]')\n ).filter(img => {\n const ref = img.getAttribute('usemap') as string;\n return ref.startsWith('#') && names.includes(ref.slice(1));\n });\n}\n\n/**\n * Whether an image map area is shown. An area has no box of its own: the\n * HTML rendering rules give it `display: none`, though a browser may not\n * report that. So it counts where an image using its map is shown, as long\n * as nothing makes it inert.\n */\nfunction isAreaShown(area: Element, container: Element): boolean {\n for (\n let node: Element | null = area;\n node && node !== container;\n node = flatParent(node) as Element | null\n ) {\n if (node.hasAttribute('inert')) return false;\n }\n return imagesUsingMapOf(area).some(\n img => isShownUpTo(img, null) && isVisible(img)\n );\n}\n\n/**\n * Whether Tab can land on `el`, one of the kinds it visits. A disabled control\n * (including one inside a disabled `<fieldset>`), an inert subtree and\n * anything not rendered are skipped. `visibility` is inherited, so the\n * element's own computed value covers its ancestors.\n */\nfunction isRenderedAndEnabled(el: Element, container: Element): boolean {\n if (el.matches(':disabled')) return false;\n if (el.localName === 'area') return isAreaShown(el, container);\n return isShownUpTo(el, container) && isVisible(el);\n}\n\n/** A radio button with a name, which shares one tab stop with its group. */\nconst isGroupedRadio = (el: Element): el is HTMLInputElement =>\n el.localName === 'input' &&\n (el as HTMLInputElement).type === 'radio' &&\n (el as HTMLInputElement).name !== '';\n\n/** Whether two radio buttons are in one group: same name, form owner and tree. */\nconst sameGroup = (a: HTMLInputElement, b: Element): b is HTMLInputElement =>\n isGroupedRadio(b) &&\n b.name === a.name &&\n b.form === a.form &&\n b.getRootNode() === a.getRootNode();\n\n/**\n * The checked button of `radio`'s group. The group isn't bounded by the trap,\n * so this looks through the radio's whole tree.\n */\nconst checkedInGroup = (radio: HTMLInputElement): Element | undefined =>\n Array.from(\n (radio.getRootNode() as ParentNode).querySelectorAll('input:checked')\n ).find(el => sameGroup(radio, el));\n\n/** The flattened-tree ancestors of `node` below the container, outermost first, then `node`. */\nfunction flatChain(node: Node, container: Node): Node[] {\n const chain: Node[] = [];\n for (let n: Node | null = node; n && n !== container; n = flatParent(n)) {\n chain.unshift(n);\n }\n return chain;\n}\n\n/**\n * Whether `node` is inside the container in the flattened tree: in it, in a\n * shadow root it holds, or slotted into it. A child of a closed-root host\n * counts as inside wherever the host is, as its slot can't be seen.\n */\nfunction inside(container: Node, node: Node): boolean {\n for (let n: Node | null = node; n; n = flatParent(n)) {\n if (n === container) return true;\n }\n return false;\n}\n\n/**\n * `true` when Tab reaches `b` after `a`, which is their order in the\n * flattened tree: a shadow host comes before its shadow root's content, and\n * slotted content comes where its slot is. A closed root's slots can't be\n * seen, so its host's children keep their place in the light DOM. Two\n * flattened-tree siblings are always in one DOM tree, so their document\n * position decides between them.\n */\nfunction follows(container: Element, a: Node, b: Node): boolean {\n const chainA = flatChain(a, container);\n const chainB = flatChain(b, container);\n for (let i = 0; i < Math.max(chainA.length, chainB.length); i++) {\n const [x, y] = [chainA[i], chainB[i]];\n if (x === y) continue;\n if (!x) return true;\n if (!y) return false;\n return Boolean(\n x.compareDocumentPosition(y) & Node.DOCUMENT_POSITION_FOLLOWING\n );\n }\n return false;\n}\n\n/**\n * Every element of a tabbable kind under `el` in the flattened tree, depth\n * first, which is the order Tab visits them. Under a host whose shadow root\n * is closed, that takes in the host's own children instead, rendered or not.\n */\nfunction collectCandidates(\n el: Element,\n out: HTMLElement[] = []\n): HTMLElement[] {\n for (const child of flatChildren(el)) {\n if (isTabbableKind(child)) out.push(child as HTMLElement);\n collectCandidates(child, out);\n }\n return out;\n}\n\ninterface TabStops {\n first: HTMLElement;\n last: HTMLElement;\n /** The stop that stands for `node`: its group's stop for a radio button. */\n stopFor(node: Element): Element;\n}\n\n/**\n * The first and last tab stops inside `container`, or `null` when there are\n * none. Only the ends matter for wrapping, so the style checks run from each\n * end until they find a stop rather than over every candidate.\n *\n * A radio group is one stop, the way the browser treats it: its checked\n * button, or its first when none is checked. Counting every button would make\n * the group's last one an end, and Tab from the checked one would leave. The\n * group goes by name, form owner and tree, not by the trap, so a checked\n * button outside the container that Tab can land on leaves the group no stop\n * inside. One that Tab can't land on leaves the group as if none were checked.\n */\nfunction findTabStops(container: HTMLElement): TabStops | null {\n const candidates = collectCandidates(container);\n const checked = new Map<Element, boolean>();\n const usable = (el: Element): boolean => {\n let ok = checked.get(el);\n if (ok === undefined) {\n ok = isRenderedAndEnabled(el, container);\n checked.set(el, ok);\n }\n return ok;\n };\n // Resolved once per group, filed under each of its buttons, since finding\n // the checked one scans the radio's whole tree.\n const groupStops = new Map<Element, HTMLElement | undefined>();\n const groupStop = (radio: HTMLInputElement): HTMLElement | undefined => {\n if (groupStops.has(radio)) return groupStops.get(radio);\n const group = candidates.filter(el => sameGroup(radio, el));\n const on = checkedInGroup(radio);\n const stop =\n on && isTabbableKind(on) && usable(on)\n ? group.find(el => el === on)\n : group.find(usable);\n for (const el of [radio, ...group]) groupStops.set(el, stop);\n return stop;\n };\n const isStop = (el: HTMLElement): boolean =>\n usable(el) && (!isGroupedRadio(el) || groupStop(el) === el);\n\n const first = candidates.find(isStop);\n if (!first) return null;\n let last = first;\n for (let i = candidates.length - 1; candidates[i] !== first; i--) {\n if (isStop(candidates[i])) {\n last = candidates[i];\n break;\n }\n }\n return {\n first,\n last,\n stopFor: node => (isGroupedRadio(node) && groupStop(node)) || node,\n };\n}\n\n/**\n * The first tab stop inside `container`, found the way the trap finds it, or\n * `null` when there is none. For a component that moves focus into a panel\n * without trapping it there. `src/index.ts` names its exports from this\n * module, so this one stays internal.\n */\nexport function firstTabStop(container: HTMLElement): HTMLElement | null {\n return findTabStops(container)?.first ?? null;\n}\n\n/**\n * The element that has focus in the container's own document (an iframe's,\n * when it renders into one), inside open shadow roots too. Focus inside a\n * closed one reads as its host, which the comparisons above place like any\n * other element. Browsers fall back to <body> when nothing has\n * focus. jsdom, where consumers run their tests, reports nothing once focus\n * was inside a shadow root that was removed, so this falls back for it.\n */\nconst focusedElement = (doc: Document): Element =>\n getDeepestActiveElement(doc) ?? doc.body;\n\n/**\n * Options for `useFocusTrap`.\n */\nexport interface UseFocusTrapOptions {\n /**\n * Whether the trap is on. Turning it on moves focus into the container;\n * turning it off (or unmounting) releases Tab and restores focus.\n * @defaultValue true\n */\n active?: boolean;\n /**\n * The element inside the container to focus when the trap turns on. It has\n * to be one that can take focus, so a heading needs `tabIndex={-1}`. When\n * focusing it doesn't put focus inside the container (the ref is empty, or\n * its element is outside, disabled, hidden or can't take focus), focus goes\n * to the first tab stop inside the container, and to the container itself\n * when there is none.\n */\n initialFocusRef?: RefObject<HTMLElement | null>;\n /**\n * Where focus goes when the trap turns off. `true` returns it to the element\n * that had focus when the trap turned on; a ref sends it to that element\n * instead; `false` leaves it alone. Focus is only moved while the trap still\n * holds it, so a click that already put focus somewhere else outside the\n * container keeps it there.\n *\n * `true` reads focus after the container's content has mounted, so content\n * that focuses itself as it mounts (an `autoFocus` input) hides the element\n * that opened it. And some browsers don't focus a button when it is\n * clicked. For a panel opened from a button, pass the button's ref.\n * @defaultValue true\n */\n restoreFocus?: boolean | RefObject<HTMLElement | null>;\n}\n\n/**\n * Keeps keyboard focus inside a container while it is active: focus moves in\n * when the trap turns on, Tab and Shift+Tab wrap between the first and last\n * tab stops, and focus goes back where it came from when the trap turns off.\n *\n * Tab stops are what the browser's Tab visits, in document order: links,\n * form controls, frames, media with controls, a `<details>` summary, editable\n * regions, anything with `tabIndex={0}`, and the content of open shadow\n * roots. Hidden, disabled, inert and `tabIndex={-1}` elements are skipped,\n * and a radio group counts once. Give the container `tabIndex={-1}` so it can\n * hold focus itself when nothing inside can. The trap listens on the\n * container, so a trap nested inside another handles Tab first and the outer\n * one stands aside.\n *\n * The trap is about Tab. If a Tab it let through still takes focus out (a\n * browser can leave out a stop the page has, such as links when its settings\n * say to), it sends focus back to the other end. A pointer or a script moving\n * focus out is left alone, because pulling focus back from a click is modal\n * behaviour, and a modal also has to block the page behind it, which `Modal`\n * does. Content the container renders through a portal lives elsewhere in\n * the DOM, so it is outside the trap: render nested overlays inside the\n * container, or give them a trap of their own. To trap content a `Portal`\n * renders, pass a ref to the element inside the `Portal` as `containerRef`.\n *\n * The trap looks at `containerRef` again each time the component calling it\n * renders. A container that mounts after the trap turns on, such as a panel\n * waiting for a `Portal` target held in state, has it attach once that\n * component renders with the container in the DOM. When the container leaves\n * or is replaced, the trap lets go of it as it would turning off, handing\n * focus back, and attaches to the next one.\n * A child that mounts the container in a render of its own (from its own\n * state, or as a `Suspense` boundary resolves) goes unseen until the\n * component calling the hook renders again. The trap waits for hydration, so\n * that component renders again when the page hydrates, and portaled content,\n * which first appears then, is found.\n *\n * @function useFocusTrap\n * @param containerRef - Ref to the element focus stays inside.\n * @param options - When the trap is on, and where focus starts and ends.\n *\n * @example\n * const panelRef = useRef<HTMLDivElement>(null);\n * useFocusTrap(panelRef, { active: isOpen });\n * return isOpen ? (\n * <div ref={panelRef} role=\"dialog\" aria-label=\"Filters\" tabIndex={-1}>\n * …\n * </div>\n * ) : null;\n */\nexport function useFocusTrap(\n containerRef: RefObject<HTMLElement | null>,\n options: UseFocusTrapOptions = {}\n): void {\n const { active = true, initialFocusRef, restoreFocus = true } = options;\n // Portaled content has no server-rendered counterpart, so a portaled\n // container only exists from the commit after hydration.\n const hydrated = useIsHydrated();\n // The container the trap is attached to, or `null` while it has none.\n const heldRef = useRef<HTMLElement | null>(null);\n // Bumped to run the trap again when the container in the ref changes.\n const [refChanges, setRefChanges] = useState(0);\n\n useEffect(() => {\n heldRef.current = null;\n if (!active || !hydrated) return undefined;\n const container = containerRef.current;\n if (!container) return undefined;\n heldRef.current = container;\n const doc = container.ownerDocument;\n\n const opener = focusedElement(doc) as HTMLElement;\n\n // `initialFocusRef` counts only when focusing it puts focus inside. Focus\n // put outside would stay out, as Tab there never reaches the container's\n // listener, and focusing something that can't take focus (a heading\n // without `tabIndex`, a disabled control) leaves focus where it was.\n const initial = initialFocusRef?.current;\n const inTrap = initial && inside(container, initial) ? initial : null;\n inTrap?.focus();\n if (!inTrap || !inside(container, focusedElement(doc))) {\n (findTabStops(container)?.first ?? container).focus();\n }\n\n // Where focus goes if a Tab the trap let the browser handle takes it out,\n // held until that Tab has finished moving focus.\n let wrapTo: HTMLElement | null = null;\n let wrapTimer: ReturnType<typeof setTimeout> | undefined;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n // A trap nested inside this one has already wrapped focus.\n if (e.key !== 'Tab' || e.defaultPrevented) return;\n const stops = findTabStops(container);\n if (!stops) {\n e.preventDefault();\n container.focus();\n return;\n }\n const current = stops.stopFor(focusedElement(doc));\n // Wrap whenever the browser has no stop left in that direction inside\n // the container. Comparing positions rather than testing `=== first`\n // also covers focus resting on the container or on an element outside\n // the tab order, which the browser would otherwise walk straight out of.\n if (\n e.shiftKey\n ? !follows(container, stops.first, current)\n : !follows(container, current, stops.last)\n ) {\n e.preventDefault();\n (e.shiftKey ? stops.last : stops.first).focus();\n return;\n }\n wrapTo = e.shiftKey ? stops.last : stops.first;\n clearTimeout(wrapTimer);\n wrapTimer = setTimeout(() => {\n wrapTo = null;\n });\n };\n\n // The browser moves focus as soon as the keydown is over, so focus that\n // lands outside while `wrapTo` is set got there by that Tab.\n const handleFocusIn = (e: FocusEvent) => {\n if (!wrapTo || inside(container, e.composedPath()[0] as Node)) return;\n const target = wrapTo;\n wrapTo = null;\n target.focus();\n };\n\n container.addEventListener('keydown', handleKeyDown);\n doc.addEventListener('focusin', handleFocusIn, true);\n return () => {\n container.removeEventListener('keydown', handleKeyDown);\n doc.removeEventListener('focusin', handleFocusIn, true);\n clearTimeout(wrapTimer);\n let target = restoreFocus ? opener : null;\n // `null` is an object too, and a caller without types can pass it.\n if (restoreFocus && typeof restoreFocus === 'object') {\n // Read now rather than when the trap turned on: a trigger that\n // re-mounted in between has a new node.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n target = restoreFocus.current;\n }\n // Hand focus back only while the trap still holds it: inside the\n // container, or dropped to <body> because the container left the page.\n const now = focusedElement(doc);\n if (target && (now === doc.body || inside(container, now))) {\n target.focus();\n }\n };\n }, [\n active,\n hydrated,\n containerRef,\n initialFocusRef,\n restoreFocus,\n refChanges,\n ]);\n\n // Nothing says when a ref is set, so after every render, a ref that no\n // longer matches what the trap holds (a container that mounted, left or was\n // replaced) runs it again. Effects run in order, so whenever the effect\n // above ran in this commit, it read the ref just before this does, and a\n // mismatch means the ref changed in a render it didn't run for. The render\n // a bump asks for runs it, so the two match and the trap settles. An empty\n // ref matches a trap holding nothing, so a container that never mounts\n // costs no render.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- after every render on purpose\n useEffect(() => {\n if (active && hydrated && containerRef.current !== heldRef.current) {\n setRefChanges(n => n + 1);\n }\n });\n}\n"],"names":[],"mappings":";;;;;AAKA;;;;AAIG;AACH,SAAS,aAAa,CAAC,EAAW,EAAA;AAChC,IAAA,MAAM,QAAQ,GAAG,CAAC,IAAa,KAAoB;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,EAAE,WAAW,EAAE;QACjE,IAAI,KAAK,KAAK,SAAS;AAAE,YAAA,OAAO,IAAI;AACpC,QAAA,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,gBAAgB,EAAE;AAClE,YAAA,OAAO,IAAI;QACb;QACA,OAAO,KAAK,KAAK,OAAO,GAAG,KAAK,GAAG,IAAI;AACzC,IAAA,CAAC;AACD,IAAA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