@wordpress/components 32.2.1-next.v.202602111440.0 → 32.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -1
- package/CLAUDE.md +1 -0
- package/build/alignment-matrix-control/cell.cjs +2 -2
- package/build/alignment-matrix-control/cell.cjs.map +1 -1
- package/build/alignment-matrix-control/index.cjs +2 -2
- package/build/alignment-matrix-control/index.cjs.map +1 -1
- package/build/angle-picker-control/angle-circle.cjs +4 -4
- package/build/angle-picker-control/angle-circle.cjs.map +2 -2
- package/build/autocomplete/index.cjs +16 -8
- package/build/autocomplete/index.cjs.map +2 -2
- package/build/clipboard-button/index.cjs +1 -1
- package/build/clipboard-button/index.cjs.map +2 -2
- package/build/color-picker/color-copy-button.cjs +1 -1
- package/build/color-picker/color-copy-button.cjs.map +2 -2
- package/build/confirm-dialog/component.cjs +2 -2
- package/build/confirm-dialog/component.cjs.map +2 -2
- package/build/context/context-system-provider.cjs.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.cjs +2 -2
- package/build/custom-gradient-picker/gradient-bar/control-points.cjs.map +2 -2
- package/build/date-time/date/index.cjs +1 -1
- package/build/date-time/date/index.cjs.map +2 -2
- package/build/date-time/time/index.cjs +1 -1
- package/build/date-time/time/index.cjs.map +2 -2
- package/build/date-time/utils.cjs +9 -0
- package/build/date-time/utils.cjs.map +2 -2
- package/build/dropdown/index.cjs +1 -1
- package/build/dropdown/index.cjs.map +2 -2
- package/build/external-link/index.cjs +5 -1
- package/build/external-link/index.cjs.map +2 -2
- package/build/higher-order/with-spoken-messages/index.cjs.map +2 -2
- package/build/modal/index.cjs +2 -2
- package/build/modal/index.cjs.map +2 -2
- package/build/modal/use-modal-exit-animation.cjs +2 -2
- package/build/modal/use-modal-exit-animation.cjs.map +2 -2
- package/build/number-control/index.cjs +1 -1
- package/build/number-control/index.cjs.map +2 -2
- package/build/palette-edit/index.cjs +1 -1
- package/build/palette-edit/index.cjs.map +2 -2
- package/build/panel/body.cjs +1 -1
- package/build/panel/body.cjs.map +2 -2
- package/build/private-apis.cjs +0 -2
- package/build/private-apis.cjs.map +2 -2
- package/build/range-control/index.cjs +1 -1
- package/build/range-control/index.cjs.map +2 -2
- package/build/resizable-box/resize-tooltip/utils.cjs +1 -1
- package/build/resizable-box/resize-tooltip/utils.cjs.map +2 -2
- package/build/sandbox/index.cjs +126 -2
- package/build/sandbox/index.cjs.map +2 -2
- package/build/select-control/styles/select-control-styles.cjs +8 -8
- package/build/select-control/styles/select-control-styles.cjs.map +2 -2
- package/build/snackbar/list.cjs +4 -1
- package/build/snackbar/list.cjs.map +2 -2
- package/build/tabs/styles.cjs +5 -5
- package/build/tabs/styles.cjs.map +2 -2
- package/build/text/utils.cjs.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +8 -8
- package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +2 -2
- package/build/tree-grid/roving-tab-index-item.cjs +1 -1
- package/build/tree-grid/roving-tab-index-item.cjs.map +2 -2
- package/build/utils/element-rect.cjs +1 -1
- package/build/utils/element-rect.cjs.map +2 -2
- package/build/utils/hooks/use-update-effect.cjs.map +1 -1
- package/build/utils/rtl.cjs +2 -2
- package/build/utils/rtl.cjs.map +2 -2
- package/build/utils/use-responsive-value.cjs +1 -7
- package/build/utils/use-responsive-value.cjs.map +2 -2
- package/build/validated-form-controls/control-with-error.cjs +26 -3
- package/build/validated-form-controls/control-with-error.cjs.map +2 -2
- package/build/validated-form-controls/validity-indicator.cjs +2 -0
- package/build/validated-form-controls/validity-indicator.cjs.map +2 -2
- package/build-module/alignment-matrix-control/cell.mjs +2 -2
- package/build-module/alignment-matrix-control/cell.mjs.map +1 -1
- package/build-module/alignment-matrix-control/index.mjs +2 -2
- package/build-module/alignment-matrix-control/index.mjs.map +1 -1
- package/build-module/angle-picker-control/angle-circle.mjs +4 -4
- package/build-module/angle-picker-control/angle-circle.mjs.map +2 -2
- package/build-module/autocomplete/index.mjs +14 -7
- package/build-module/autocomplete/index.mjs.map +2 -2
- package/build-module/clipboard-button/index.mjs +1 -1
- package/build-module/clipboard-button/index.mjs.map +2 -2
- package/build-module/color-picker/color-copy-button.mjs +1 -1
- package/build-module/color-picker/color-copy-button.mjs.map +2 -2
- package/build-module/confirm-dialog/component.mjs +2 -2
- package/build-module/confirm-dialog/component.mjs.map +2 -2
- package/build-module/context/context-system-provider.mjs.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs +2 -2
- package/build-module/custom-gradient-picker/gradient-bar/control-points.mjs.map +2 -2
- package/build-module/date-time/date/index.mjs +1 -1
- package/build-module/date-time/date/index.mjs.map +2 -2
- package/build-module/date-time/time/index.mjs +2 -2
- package/build-module/date-time/time/index.mjs.map +2 -2
- package/build-module/date-time/utils.mjs +8 -0
- package/build-module/date-time/utils.mjs.map +2 -2
- package/build-module/dropdown/index.mjs +1 -1
- package/build-module/dropdown/index.mjs.map +2 -2
- package/build-module/external-link/index.mjs +5 -1
- package/build-module/external-link/index.mjs.map +2 -2
- package/build-module/higher-order/with-spoken-messages/index.mjs.map +2 -2
- package/build-module/modal/index.mjs +2 -2
- package/build-module/modal/index.mjs.map +2 -2
- package/build-module/modal/use-modal-exit-animation.mjs +2 -2
- package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
- package/build-module/number-control/index.mjs +1 -1
- package/build-module/number-control/index.mjs.map +2 -2
- package/build-module/palette-edit/index.mjs +1 -1
- package/build-module/palette-edit/index.mjs.map +2 -2
- package/build-module/panel/body.mjs +1 -1
- package/build-module/panel/body.mjs.map +2 -2
- package/build-module/private-apis.mjs +0 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/range-control/index.mjs +1 -1
- package/build-module/range-control/index.mjs.map +2 -2
- package/build-module/resizable-box/resize-tooltip/utils.mjs +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.mjs.map +2 -2
- package/build-module/sandbox/index.mjs +127 -3
- package/build-module/sandbox/index.mjs.map +2 -2
- package/build-module/select-control/styles/select-control-styles.mjs +8 -8
- package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
- package/build-module/snackbar/list.mjs +4 -1
- package/build-module/snackbar/list.mjs.map +2 -2
- package/build-module/tabs/styles.mjs +5 -5
- package/build-module/tabs/styles.mjs.map +2 -2
- package/build-module/text/utils.mjs.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +8 -8
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +2 -2
- package/build-module/tree-grid/roving-tab-index-item.mjs +1 -1
- package/build-module/tree-grid/roving-tab-index-item.mjs.map +2 -2
- package/build-module/utils/element-rect.mjs +1 -1
- package/build-module/utils/element-rect.mjs.map +2 -2
- package/build-module/utils/hooks/use-update-effect.mjs.map +1 -1
- package/build-module/utils/rtl.mjs +2 -2
- package/build-module/utils/rtl.mjs.map +2 -2
- package/build-module/utils/use-responsive-value.mjs +1 -7
- package/build-module/utils/use-responsive-value.mjs.map +2 -2
- package/build-module/validated-form-controls/control-with-error.mjs +27 -4
- package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
- package/build-module/validated-form-controls/validity-indicator.mjs +2 -0
- package/build-module/validated-form-controls/validity-indicator.mjs.map +2 -2
- package/build-style/style-rtl.css +8 -4
- package/build-style/style.css +8 -4
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts +1 -1
- package/build-types/angle-picker-control/stories/index.story.d.ts +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +25 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
- package/build-types/animate/index.d.ts +1 -1
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/animate/types.d.ts +1 -1
- package/build-types/animate/types.d.ts.map +1 -1
- package/build-types/autocomplete/get-autocomplete-match.d.ts +20 -0
- package/build-types/autocomplete/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/index.d.ts +10 -2
- package/build-types/autocomplete/index.d.ts.map +1 -1
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts +2 -0
- package/build-types/autocomplete/test/get-autocomplete-match.d.ts.map +1 -0
- package/build-types/autocomplete/types.d.ts +1 -1
- package/build-types/autocomplete/types.d.ts.map +1 -1
- package/build-types/badge/stories/e2e/index.story.d.ts +7 -0
- package/build-types/badge/stories/e2e/index.story.d.ts.map +1 -0
- package/build-types/base-control/index.d.ts +2 -2
- package/build-types/base-control/stories/index.story.d.ts +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +267 -0
- package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -0
- package/build-types/box-control/all-input-control.d.ts +4 -0
- package/build-types/box-control/all-input-control.d.ts.map +1 -0
- package/build-types/box-control/axial-input-controls.d.ts +4 -0
- package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
- package/build-types/box-control/input-controls.d.ts +4 -0
- package/build-types/box-control/input-controls.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-styles.d.ts +2 -2
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
- package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
- package/build-types/box-control/unit-control.d.ts +4 -0
- package/build-types/box-control/unit-control.d.ts.map +1 -0
- package/build-types/card/card/hook.d.ts +1 -1
- package/build-types/card/card-body/hook.d.ts +1 -1
- package/build-types/card/card-footer/hook.d.ts +1 -1
- package/build-types/card/card-header/hook.d.ts +1 -1
- package/build-types/card/card-media/hook.d.ts +1 -1
- package/build-types/color-palette/stories/index.story.d.ts +6 -5
- package/build-types/color-palette/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/styles.d.ts +1 -1
- package/build-types/context/context-connect.d.ts +2 -2
- package/build-types/context/context-connect.d.ts.map +1 -1
- package/build-types/context/context-system-provider.d.ts +2 -2
- package/build-types/context/context-system-provider.d.ts.map +1 -1
- package/build-types/context/wordpress-component.d.ts +3 -3
- package/build-types/context/wordpress-component.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +2 -2
- package/build-types/custom-gradient-picker/test/index.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/types.d.ts +1 -1
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -1
- package/build-types/custom-select-control/styles.d.ts +11 -0
- package/build-types/custom-select-control/styles.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/types.d.ts +4 -4
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +2 -2
- package/build-types/date-time/date-picker/index.d.ts +23 -0
- package/build-types/date-time/date-picker/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/styles.d.ts +45 -0
- package/build-types/date-time/date-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/index.d.ts +2 -0
- package/build-types/date-time/date-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date-picker/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date-picker/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time-picker/index.d.ts +27 -0
- package/build-types/date-time/time-picker/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/styles.d.ts +93 -0
- package/build-types/date-time/time-picker/styles.d.ts.map +1 -0
- package/build-types/date-time/time-picker/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts +4 -0
- package/build-types/date-time/time-picker/time-input/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts +2 -0
- package/build-types/date-time/time-picker/time-input/test/index.d.ts.map +1 -0
- package/build-types/date-time/time-picker/timezone.d.ts +7 -0
- package/build-types/date-time/time-picker/timezone.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +9 -0
- package/build-types/date-time/utils.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +28 -0
- package/build-types/dimension-control/index.d.ts.map +1 -0
- package/build-types/dimension-control/sizes.d.ts +26 -0
- package/build-types/dimension-control/sizes.d.ts.map +1 -0
- package/build-types/dimension-control/stories/index.story.d.ts +4 -0
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -0
- package/build-types/dimension-control/types.d.ts +47 -0
- package/build-types/dimension-control/types.d.ts.map +1 -0
- package/build-types/draggable/types.d.ts +1 -1
- package/build-types/draggable/types.d.ts.map +1 -1
- package/build-types/drop-zone/types.d.ts +1 -1
- package/build-types/drop-zone/types.d.ts.map +1 -1
- package/build-types/dropdown-menu/types.d.ts +1 -1
- package/build-types/dropdown-menu/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts +17 -0
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +11 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/styles.d.ts +42 -0
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts +2 -0
- package/build-types/dropdown-menu-v2/test/index.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/types.d.ts +252 -0
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -0
- package/build-types/elevation/hook.d.ts +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
- package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
- package/build-types/flex/flex/hook.d.ts +1 -1
- package/build-types/flex/flex-block/hook.d.ts +1 -1
- package/build-types/flex/flex-item/hook.d.ts +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/font-size-picker/stories/index.story.d.ts +8 -7
- package/build-types/font-size-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/font-size-picker/styles.d.ts +2 -2
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/gradient-picker/stories/index.story.d.ts +6 -5
- package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +1 -1
- package/build-types/heading/hook.d.ts +1 -1
- package/build-types/higher-order/navigate-regions/index.d.ts +1 -1
- package/build-types/higher-order/with-notices/types.d.ts +1 -1
- package/build-types/higher-order/with-notices/types.d.ts.map +1 -1
- package/build-types/higher-order/with-spoken-messages/index.d.ts +2 -3
- package/build-types/higher-order/with-spoken-messages/index.d.ts.map +1 -1
- package/build-types/icon/index.d.ts +2 -2
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
- package/build-types/item-group/item/hook.d.ts +1 -1
- package/build-types/item-group/item-group/hook.d.ts +1 -1
- package/build-types/menu/index.d.ts +2 -2
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/styles.d.ts +2 -2
- package/build-types/menu-item/index.d.ts +1 -1
- package/build-types/menu-item/stories/index.story.d.ts +4 -4
- package/build-types/menu-item/types.d.ts +1 -1
- package/build-types/menu-item/types.d.ts.map +1 -1
- package/build-types/mobile/inserter-button/sparkles.d.ts +3 -0
- package/build-types/mobile/inserter-button/sparkles.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +1 -1
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +1 -1
- package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
- package/build-types/navigation/types.d.ts +1 -1
- package/build-types/navigation/types.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-back-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-button/hook.d.ts +1 -1
- package/build-types/navigator/navigator-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-button/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/component.d.ts +38 -0
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -0
- package/build-types/navigator/navigator-provider/index.d.ts +2 -0
- package/build-types/navigator/navigator-provider/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-screen/index.d.ts +2 -0
- package/build-types/navigator/navigator-screen/index.d.ts.map +1 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
- package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
- package/build-types/palette-edit/styles.d.ts +1 -1
- package/build-types/palette-edit/types.d.ts +1 -1
- package/build-types/palette-edit/types.d.ts.map +1 -1
- package/build-types/panel/types.d.ts +2 -2
- package/build-types/panel/types.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/radio-group/radio/index.d.ts +7 -0
- package/build-types/radio-group/radio/index.d.ts.map +1 -0
- package/build-types/radio-group/radio-context/index.d.ts +6 -0
- package/build-types/radio-group/radio-context/index.d.ts.map +1 -0
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +2 -2
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/sandbox/index.d.ts +1 -1
- package/build-types/sandbox/index.d.ts.map +1 -1
- package/build-types/sandbox/types.d.ts +11 -0
- package/build-types/sandbox/types.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +1 -1
- package/build-types/search-control/types.d.ts +1 -1
- package/build-types/search-control/types.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +2 -2
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts +5 -0
- package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts +12 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-context.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts +4 -0
- package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -0
- package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
- package/build-types/slot-fill/types.d.ts +1 -1
- package/build-types/slot-fill/types.d.ts.map +1 -1
- package/build-types/slot-fill/use-slot.d.ts +9 -0
- package/build-types/slot-fill/use-slot.d.ts.map +1 -0
- package/build-types/snackbar/index.d.ts +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +1 -1
- package/build-types/style-provider/test/index.d.ts +2 -0
- package/build-types/style-provider/test/index.d.ts.map +1 -0
- package/build-types/surface/hook.d.ts +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +1 -1
- package/build-types/text/stories/index.story.d.ts +3 -3
- package/build-types/text/utils.d.ts +18 -18
- package/build-types/text/utils.d.ts.map +1 -1
- package/build-types/theme/stories/index.story.d.ts +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +1 -1
- package/build-types/tree-grid/types.d.ts +1 -1
- package/build-types/tree-grid/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +1 -1
- package/build-types/ui/context/constants.d.ts +8 -0
- package/build-types/ui/context/constants.d.ts.map +1 -0
- package/build-types/ui/context/context-connect.d.ts +40 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/context-system-provider.d.ts +7 -0
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts +2 -0
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts.map +1 -0
- package/build-types/ui/context/index.d.ts +5 -0
- package/build-types/ui/context/index.d.ts.map +1 -0
- package/build-types/ui/context/test/context-connect.d.ts +2 -0
- package/build-types/ui/context/test/context-connect.d.ts.map +1 -0
- package/build-types/ui/context/test/wordpress-component.d.ts +2 -0
- package/build-types/ui/context/test/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/context/use-context-system.d.ts +20 -0
- package/build-types/ui/context/use-context-system.d.ts.map +1 -0
- package/build-types/ui/context/utils.d.ts +26 -0
- package/build-types/ui/context/utils.d.ts.map +1 -0
- package/build-types/ui/context/wordpress-component.d.ts +32 -0
- package/build-types/ui/context/wordpress-component.d.ts.map +1 -0
- package/build-types/ui/shortcut/component.d.ts +12 -0
- package/build-types/ui/shortcut/component.d.ts.map +1 -0
- package/build-types/ui/shortcut/index.d.ts +3 -0
- package/build-types/ui/shortcut/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/component.d.ts +29 -0
- package/build-types/ui/tooltip/component.d.ts.map +1 -0
- package/build-types/ui/tooltip/content.d.ts +9 -0
- package/build-types/ui/tooltip/content.d.ts.map +1 -0
- package/build-types/ui/tooltip/context.d.ts +10 -0
- package/build-types/ui/tooltip/context.d.ts.map +1 -0
- package/build-types/ui/tooltip/index.d.ts +3 -0
- package/build-types/ui/tooltip/index.d.ts.map +1 -0
- package/build-types/ui/tooltip/styles.d.ts +12 -0
- package/build-types/ui/tooltip/styles.d.ts.map +1 -0
- package/build-types/ui/tooltip/types.d.ts +62 -0
- package/build-types/ui/tooltip/types.d.ts.map +1 -0
- package/build-types/ui/utils/colors.d.ts +17 -0
- package/build-types/ui/utils/colors.d.ts.map +1 -0
- package/build-types/ui/utils/font-size.d.ts +18 -0
- package/build-types/ui/utils/font-size.d.ts.map +1 -0
- package/build-types/ui/utils/get-valid-children.d.ts +13 -0
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -0
- package/build-types/ui/utils/index.d.ts +2 -0
- package/build-types/ui/utils/index.d.ts.map +1 -0
- package/build-types/ui/utils/space.d.ts +23 -0
- package/build-types/ui/utils/space.d.ts.map +1 -0
- package/build-types/ui/utils/types.d.ts +14 -0
- package/build-types/ui/utils/types.d.ts.map +1 -0
- package/build-types/ui/utils/use-responsive-value.d.ts +5 -0
- package/build-types/ui/utils/use-responsive-value.d.ts.map +1 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts +15 -0
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +1 -0
- package/build-types/utils/hooks/use-update-effect.d.ts +3 -3
- package/build-types/utils/hooks/use-update-effect.d.ts.map +1 -1
- package/build-types/utils/input/base.d.ts +3 -0
- package/build-types/utils/input/base.d.ts.map +1 -0
- package/build-types/utils/input/index.d.ts +2 -0
- package/build-types/utils/input/index.d.ts.map +1 -0
- package/build-types/utils/input/input-control.d.ts +2 -0
- package/build-types/utils/input/input-control.d.ts.map +1 -0
- package/build-types/utils/reduce-motion.d.ts +8 -0
- package/build-types/utils/reduce-motion.d.ts.map +1 -0
- package/build-types/utils/rtl.d.ts +4 -4
- package/build-types/utils/rtl.d.ts.map +1 -1
- package/build-types/utils/use-responsive-value.d.ts.map +1 -1
- package/build-types/utils/z-index.d.ts +3 -0
- package/build-types/utils/z-index.d.ts.map +1 -0
- package/build-types/v-stack/hook.d.ts +1 -1
- package/build-types/v-stack/stories/index.story.d.ts +1 -1
- package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
- package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
- package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
- package/build-types/validated-form-controls/test/checkbox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/checkbox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/combobox-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/custom-select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts +2 -0
- package/build-types/validated-form-controls/test/form-token-field.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/input-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/input-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/number-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/number-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/radio-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/range-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/range-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/select-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/select-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/text-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/text-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/textarea-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts +2 -0
- package/build-types/validated-form-controls/test/toggle-group-control.d.ts.map +1 -0
- package/build-types/validated-form-controls/validity-indicator.d.ts +2 -1
- package/build-types/validated-form-controls/validity-indicator.d.ts.map +1 -1
- package/build-types/view/types.d.ts +8 -0
- package/build-types/view/types.d.ts.map +1 -0
- package/package.json +24 -24
- package/src/alignment-matrix-control/test/index.tsx +1 -1
- package/src/angle-picker-control/angle-circle.tsx +6 -5
- package/src/animate/types.ts +1 -1
- package/src/autocomplete/autocompleter-ui.tsx +1 -1
- package/src/autocomplete/index.tsx +33 -8
- package/src/autocomplete/test/index.tsx +110 -1
- package/src/autocomplete/types.ts +1 -1
- package/src/button/style.scss +8 -5
- package/src/calendar/style.scss +4 -2
- package/src/clipboard-button/index.tsx +1 -1
- package/src/color-palette/stories/index.story.tsx +56 -48
- package/src/color-picker/color-copy-button.tsx +1 -3
- package/src/composite/stories/index.story.tsx +1 -1
- package/src/confirm-dialog/component.tsx +2 -2
- package/src/context/context-connect.ts +3 -3
- package/src/context/context-system-provider.js +4 -4
- package/src/context/wordpress-component.ts +3 -5
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +3 -2
- package/src/custom-gradient-picker/types.ts +1 -1
- package/src/custom-select-control-v2/custom-select.tsx +1 -1
- package/src/custom-select-control-v2/stories/index.story.tsx +3 -3
- package/src/custom-select-control-v2/test/index.tsx +3 -3
- package/src/custom-select-control-v2/types.ts +4 -4
- package/src/date-time/date/index.tsx +1 -1
- package/src/date-time/test/utils.test.ts +8 -11
- package/src/date-time/time/index.tsx +2 -12
- package/src/date-time/time/test/index.tsx +69 -0
- package/src/date-time/utils.ts +18 -0
- package/src/draggable/index.native.js +17 -17
- package/src/draggable/types.ts +1 -1
- package/src/drop-zone/types.ts +1 -1
- package/src/dropdown/index.tsx +1 -1
- package/src/dropdown-menu/types.ts +1 -1
- package/src/external-link/index.tsx +5 -1
- package/src/font-size-picker/stories/index.story.tsx +133 -125
- package/src/form-token-field/style.scss +1 -0
- package/src/gradient-picker/stories/index.story.tsx +48 -42
- package/src/h-stack/test/index.tsx +1 -1
- package/src/heading/hook.ts +2 -2
- package/src/higher-order/with-notices/test/index.tsx +2 -2
- package/src/higher-order/with-notices/types.ts +1 -1
- package/src/higher-order/with-spoken-messages/index.tsx +2 -4
- package/src/icon/index.tsx +2 -2
- package/src/keyboard-shortcuts/index.tsx +1 -1
- package/src/menu/stories/index.story.tsx +1 -1
- package/src/menu-item/types.ts +1 -1
- package/src/modal/index.tsx +4 -3
- package/src/modal/types.ts +1 -1
- package/src/modal/use-modal-exit-animation.ts +2 -2
- package/src/navigation/README.md +1 -1
- package/src/navigation/types.ts +1 -1
- package/src/number-control/index.tsx +1 -1
- package/src/palette-edit/index.tsx +2 -2
- package/src/palette-edit/types.ts +1 -1
- package/src/panel/README.md +1 -1
- package/src/panel/body.tsx +1 -1
- package/src/panel/types.ts +2 -2
- package/src/popover/stories/index.story.tsx +1 -1
- package/src/private-apis.ts +0 -2
- package/src/radio-control/test/index.tsx +5 -4
- package/src/range-control/index.tsx +1 -1
- package/src/range-control/types.ts +2 -2
- package/src/resizable-box/index.tsx +1 -1
- package/src/resizable-box/resize-tooltip/index.tsx +1 -1
- package/src/resizable-box/resize-tooltip/label.tsx +1 -1
- package/src/resizable-box/resize-tooltip/utils.ts +2 -2
- package/src/sandbox/index.tsx +190 -10
- package/src/sandbox/test/index.tsx +65 -24
- package/src/sandbox/types.ts +11 -0
- package/src/search-control/types.ts +1 -1
- package/src/select-control/styles/select-control-styles.ts +1 -0
- package/src/slot-fill/types.ts +1 -1
- package/src/snackbar/list.tsx +7 -2
- package/src/tabs/styles.ts +1 -0
- package/src/text/utils.ts +18 -18
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +18 -16
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +4 -6
- package/src/toggle-group-control/types.ts +1 -1
- package/src/tree-grid/roving-tab-index-item.tsx +1 -1
- package/src/tree-grid/types.ts +1 -1
- package/src/utils/element-rect.ts +1 -1
- package/src/utils/hooks/use-update-effect.js +2 -2
- package/src/utils/rtl.js +4 -4
- package/src/utils/use-responsive-value.ts +1 -5
- package/src/v-stack/test/index.tsx +1 -1
- package/src/validated-form-controls/components/stories/overview.story.tsx +2 -1
- package/src/validated-form-controls/control-with-error.tsx +44 -4
- package/src/validated-form-controls/test/checkbox-control.tsx +49 -0
- package/src/validated-form-controls/test/combobox-control.tsx +61 -0
- package/src/validated-form-controls/test/control-with-error.tsx +182 -1
- package/src/validated-form-controls/test/custom-select-control.tsx +60 -0
- package/src/validated-form-controls/test/form-token-field.tsx +52 -0
- package/src/validated-form-controls/test/input-control.tsx +42 -0
- package/src/validated-form-controls/test/number-control.tsx +44 -0
- package/src/validated-form-controls/test/radio-control.tsx +61 -0
- package/src/validated-form-controls/test/range-control.tsx +73 -0
- package/src/validated-form-controls/test/select-control.tsx +57 -0
- package/src/validated-form-controls/test/text-control.tsx +49 -0
- package/src/validated-form-controls/test/textarea-control.tsx +51 -0
- package/src/validated-form-controls/test/toggle-control.tsx +49 -0
- package/src/validated-form-controls/test/toggle-group-control.tsx +28 -0
- package/src/validated-form-controls/validity-indicator.tsx +3 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedCustomSelectControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedCustomSelectControl', () => {
|
|
6
|
+
const options = [
|
|
7
|
+
{ key: 'small', name: 'Small' },
|
|
8
|
+
{ key: 'large', name: 'Large' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
it( 'should preserve the built-in "Currently selected" description', async () => {
|
|
12
|
+
render(
|
|
13
|
+
<ValidatedCustomSelectControl
|
|
14
|
+
label="Font Size"
|
|
15
|
+
options={ options }
|
|
16
|
+
value={ options[ 0 ] }
|
|
17
|
+
onChange={ () => {} }
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
await waitFor( () => {
|
|
22
|
+
expect(
|
|
23
|
+
screen.getByRole( 'combobox', { name: 'Font Size' } )
|
|
24
|
+
).toHaveAccessibleDescription( 'Currently selected: Small' );
|
|
25
|
+
} );
|
|
26
|
+
} );
|
|
27
|
+
|
|
28
|
+
it( 'should preserve the built-in description when validation is active', async () => {
|
|
29
|
+
const user = userEvent.setup();
|
|
30
|
+
render(
|
|
31
|
+
<form onSubmit={ ( e ) => e.preventDefault() }>
|
|
32
|
+
<ValidatedCustomSelectControl
|
|
33
|
+
label="Font Size"
|
|
34
|
+
options={ options }
|
|
35
|
+
value={ options[ 0 ] }
|
|
36
|
+
onChange={ () => {} }
|
|
37
|
+
required
|
|
38
|
+
/>
|
|
39
|
+
<button type="submit">Submit</button>
|
|
40
|
+
</form>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const combobox = await waitFor( () => {
|
|
44
|
+
return screen.getByRole( 'combobox', {
|
|
45
|
+
name: /^Font Size/,
|
|
46
|
+
} );
|
|
47
|
+
} );
|
|
48
|
+
|
|
49
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
50
|
+
|
|
51
|
+
// The validation error targets the hidden delegate <select>, not
|
|
52
|
+
// the interactive combobox. The combobox's built-in description
|
|
53
|
+
// should be unaffected.
|
|
54
|
+
await waitFor( () => {
|
|
55
|
+
expect( combobox ).toHaveAccessibleDescription(
|
|
56
|
+
'Currently selected: Small'
|
|
57
|
+
);
|
|
58
|
+
} );
|
|
59
|
+
} );
|
|
60
|
+
} );
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedFormTokenField } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedFormTokenField', () => {
|
|
6
|
+
it( 'should preserve the built-in howto description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedFormTokenField
|
|
9
|
+
label="Tags"
|
|
10
|
+
value={ [] }
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(
|
|
16
|
+
screen.getByRole( 'combobox', { name: 'Tags' } )
|
|
17
|
+
).toHaveAccessibleDescription(
|
|
18
|
+
expect.stringContaining( 'Separate with commas or the Enter key.' )
|
|
19
|
+
);
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
it( 'should preserve the built-in howto description when validation is active', async () => {
|
|
23
|
+
const user = userEvent.setup();
|
|
24
|
+
render(
|
|
25
|
+
<form>
|
|
26
|
+
<ValidatedFormTokenField
|
|
27
|
+
label="Tags"
|
|
28
|
+
value={ [] }
|
|
29
|
+
onChange={ () => {} }
|
|
30
|
+
required
|
|
31
|
+
/>
|
|
32
|
+
<button type="submit">Submit</button>
|
|
33
|
+
</form>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const input = screen.getByRole( 'combobox', { name: /^Tags/ } );
|
|
37
|
+
|
|
38
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
39
|
+
|
|
40
|
+
// The validation error targets the hidden delegate input, not the
|
|
41
|
+
// interactive combobox. The combobox's built-in description should
|
|
42
|
+
// be unaffected.
|
|
43
|
+
await waitFor( () => {
|
|
44
|
+
expect(
|
|
45
|
+
screen.getByText( 'Constraints not satisfied' )
|
|
46
|
+
).toBeVisible();
|
|
47
|
+
} );
|
|
48
|
+
expect( input ).toHaveAccessibleDescription(
|
|
49
|
+
expect.stringContaining( 'Separate with commas or the Enter key.' )
|
|
50
|
+
);
|
|
51
|
+
} );
|
|
52
|
+
} );
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedInputControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedInputControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedInputControl label="URL" help="Enter a full URL." />
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
expect(
|
|
12
|
+
screen.getByRole( 'textbox', { name: 'URL' } )
|
|
13
|
+
).toHaveAccessibleDescription( 'Enter a full URL.' );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
17
|
+
const user = userEvent.setup();
|
|
18
|
+
render(
|
|
19
|
+
<form>
|
|
20
|
+
<ValidatedInputControl
|
|
21
|
+
label="URL"
|
|
22
|
+
help="Enter a full URL."
|
|
23
|
+
required
|
|
24
|
+
/>
|
|
25
|
+
<button type="submit">Submit</button>
|
|
26
|
+
</form>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const input = screen.getByRole( 'textbox', { name: /^URL/ } );
|
|
30
|
+
|
|
31
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
32
|
+
|
|
33
|
+
await waitFor( () => {
|
|
34
|
+
expect( input ).toHaveAccessibleDescription(
|
|
35
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
36
|
+
);
|
|
37
|
+
} );
|
|
38
|
+
expect( input ).toHaveAccessibleDescription(
|
|
39
|
+
expect.stringContaining( 'Enter a full URL.' )
|
|
40
|
+
);
|
|
41
|
+
} );
|
|
42
|
+
} );
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedNumberControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedNumberControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedNumberControl label="Quantity" help="Enter a quantity." />
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
expect(
|
|
12
|
+
screen.getByRole( 'spinbutton', { name: 'Quantity' } )
|
|
13
|
+
).toHaveAccessibleDescription( 'Enter a quantity.' );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
17
|
+
const user = userEvent.setup();
|
|
18
|
+
render(
|
|
19
|
+
<form>
|
|
20
|
+
<ValidatedNumberControl
|
|
21
|
+
label="Quantity"
|
|
22
|
+
help="Enter a quantity."
|
|
23
|
+
required
|
|
24
|
+
/>
|
|
25
|
+
<button type="submit">Submit</button>
|
|
26
|
+
</form>
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const input = screen.getByRole( 'spinbutton', {
|
|
30
|
+
name: /^Quantity/,
|
|
31
|
+
} );
|
|
32
|
+
|
|
33
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
34
|
+
|
|
35
|
+
await waitFor( () => {
|
|
36
|
+
expect( input ).toHaveAccessibleDescription(
|
|
37
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
38
|
+
);
|
|
39
|
+
} );
|
|
40
|
+
expect( input ).toHaveAccessibleDescription(
|
|
41
|
+
expect.stringContaining( 'Enter a quantity.' )
|
|
42
|
+
);
|
|
43
|
+
} );
|
|
44
|
+
} );
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedRadioControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedRadioControl', () => {
|
|
6
|
+
const options = [
|
|
7
|
+
{ label: 'Small', value: 'small' },
|
|
8
|
+
{ label: 'Medium', value: 'medium' },
|
|
9
|
+
{ label: 'Large', value: 'large' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
it( 'should preserve the help description on the radio group', () => {
|
|
13
|
+
render(
|
|
14
|
+
<ValidatedRadioControl
|
|
15
|
+
label="Size"
|
|
16
|
+
help="Choose a size."
|
|
17
|
+
options={ options }
|
|
18
|
+
onChange={ () => {} }
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(
|
|
23
|
+
screen.getByRole( 'group', { name: 'Size' } )
|
|
24
|
+
).toHaveAccessibleDescription( 'Choose a size.' );
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
it( 'should append the validation error to the first radio input', async () => {
|
|
28
|
+
const user = userEvent.setup();
|
|
29
|
+
render(
|
|
30
|
+
<form>
|
|
31
|
+
<ValidatedRadioControl
|
|
32
|
+
label="Size"
|
|
33
|
+
help="Choose a size."
|
|
34
|
+
options={ options }
|
|
35
|
+
onChange={ () => {} }
|
|
36
|
+
required
|
|
37
|
+
/>
|
|
38
|
+
<button type="submit">Submit</button>
|
|
39
|
+
</form>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
43
|
+
|
|
44
|
+
// The validation error targets the first radio input (the validity
|
|
45
|
+
// target), while the help description stays on the group.
|
|
46
|
+
const firstRadio = screen.getByRole( 'radio', {
|
|
47
|
+
name: 'Small',
|
|
48
|
+
} );
|
|
49
|
+
await waitFor( () => {
|
|
50
|
+
expect( firstRadio ).toHaveAccessibleDescription(
|
|
51
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
52
|
+
);
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
expect(
|
|
56
|
+
screen.getByRole( 'group', { name: /^Size/ } )
|
|
57
|
+
).toHaveAccessibleDescription(
|
|
58
|
+
expect.stringContaining( 'Choose a size.' )
|
|
59
|
+
);
|
|
60
|
+
} );
|
|
61
|
+
} );
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { useState, useRef } from '@wordpress/element';
|
|
4
|
+
import { ValidatedRangeControl } from '../components';
|
|
5
|
+
|
|
6
|
+
describe( 'ValidatedRangeControl', () => {
|
|
7
|
+
it( 'should preserve the help description', () => {
|
|
8
|
+
render(
|
|
9
|
+
<ValidatedRangeControl label="Opacity" help="Set the opacity." />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(
|
|
13
|
+
screen.getByRole( 'slider', { name: 'Opacity' } )
|
|
14
|
+
).toHaveAccessibleDescription( 'Set the opacity.' );
|
|
15
|
+
} );
|
|
16
|
+
|
|
17
|
+
// Range inputs always have a value, so `required` never fails constraint
|
|
18
|
+
// validation. Use `customValidity` to trigger the validation error.
|
|
19
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
20
|
+
const user = userEvent.setup();
|
|
21
|
+
|
|
22
|
+
function TestComponent() {
|
|
23
|
+
const [ customValidity, setCustomValidity ] =
|
|
24
|
+
useState<
|
|
25
|
+
React.ComponentProps<
|
|
26
|
+
typeof ValidatedRangeControl
|
|
27
|
+
>[ 'customValidity' ]
|
|
28
|
+
>( undefined );
|
|
29
|
+
const ref = useRef< HTMLInputElement >( null );
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<ValidatedRangeControl
|
|
34
|
+
ref={ ref }
|
|
35
|
+
label="Opacity"
|
|
36
|
+
help="Set the opacity."
|
|
37
|
+
customValidity={ customValidity }
|
|
38
|
+
/>
|
|
39
|
+
<button
|
|
40
|
+
type="button"
|
|
41
|
+
onClick={ () => {
|
|
42
|
+
setCustomValidity( {
|
|
43
|
+
type: 'invalid',
|
|
44
|
+
message: 'Value out of range.',
|
|
45
|
+
} );
|
|
46
|
+
requestAnimationFrame(
|
|
47
|
+
() => ref.current?.reportValidity()
|
|
48
|
+
);
|
|
49
|
+
} }
|
|
50
|
+
>
|
|
51
|
+
Validate
|
|
52
|
+
</button>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
render( <TestComponent /> );
|
|
58
|
+
|
|
59
|
+
const slider = screen.getByRole( 'slider', { name: 'Opacity' } );
|
|
60
|
+
expect( slider ).toHaveAccessibleDescription( 'Set the opacity.' );
|
|
61
|
+
|
|
62
|
+
await user.click( screen.getByRole( 'button', { name: 'Validate' } ) );
|
|
63
|
+
|
|
64
|
+
await waitFor( () => {
|
|
65
|
+
expect( slider ).toHaveAccessibleDescription(
|
|
66
|
+
expect.stringContaining( 'Value out of range.' )
|
|
67
|
+
);
|
|
68
|
+
} );
|
|
69
|
+
expect( slider ).toHaveAccessibleDescription(
|
|
70
|
+
expect.stringContaining( 'Set the opacity.' )
|
|
71
|
+
);
|
|
72
|
+
} );
|
|
73
|
+
} );
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedSelectControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedSelectControl', () => {
|
|
6
|
+
const options = [
|
|
7
|
+
{ label: 'Select a color...', value: '' },
|
|
8
|
+
{ label: 'Red', value: 'red' },
|
|
9
|
+
{ label: 'Blue', value: 'blue' },
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
it( 'should preserve the help description', () => {
|
|
13
|
+
render(
|
|
14
|
+
<ValidatedSelectControl
|
|
15
|
+
label="Color"
|
|
16
|
+
help="Pick a color."
|
|
17
|
+
options={ options }
|
|
18
|
+
onChange={ () => {} }
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
expect(
|
|
23
|
+
screen.getByRole( 'combobox', { name: 'Color' } )
|
|
24
|
+
).toHaveAccessibleDescription( 'Pick a color.' );
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
28
|
+
const user = userEvent.setup();
|
|
29
|
+
render(
|
|
30
|
+
<form>
|
|
31
|
+
<ValidatedSelectControl
|
|
32
|
+
label="Color"
|
|
33
|
+
help="Pick a color."
|
|
34
|
+
options={ options }
|
|
35
|
+
onChange={ () => {} }
|
|
36
|
+
required
|
|
37
|
+
/>
|
|
38
|
+
<button type="submit">Submit</button>
|
|
39
|
+
</form>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const select = screen.getByRole( 'combobox', {
|
|
43
|
+
name: /^Color/,
|
|
44
|
+
} );
|
|
45
|
+
|
|
46
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
47
|
+
|
|
48
|
+
await waitFor( () => {
|
|
49
|
+
expect( select ).toHaveAccessibleDescription(
|
|
50
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
51
|
+
);
|
|
52
|
+
} );
|
|
53
|
+
expect( select ).toHaveAccessibleDescription(
|
|
54
|
+
expect.stringContaining( 'Pick a color.' )
|
|
55
|
+
);
|
|
56
|
+
} );
|
|
57
|
+
} );
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedTextControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedTextControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedTextControl
|
|
9
|
+
label="Name"
|
|
10
|
+
help="Enter your full name."
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
value=""
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(
|
|
17
|
+
screen.getByRole( 'textbox', { name: 'Name' } )
|
|
18
|
+
).toHaveAccessibleDescription( 'Enter your full name.' );
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
22
|
+
const user = userEvent.setup();
|
|
23
|
+
render(
|
|
24
|
+
<form>
|
|
25
|
+
<ValidatedTextControl
|
|
26
|
+
label="Name"
|
|
27
|
+
help="Enter your full name."
|
|
28
|
+
onChange={ () => {} }
|
|
29
|
+
value=""
|
|
30
|
+
required
|
|
31
|
+
/>
|
|
32
|
+
<button type="submit">Submit</button>
|
|
33
|
+
</form>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const input = screen.getByRole( 'textbox', { name: /^Name/ } );
|
|
37
|
+
|
|
38
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
39
|
+
|
|
40
|
+
await waitFor( () => {
|
|
41
|
+
expect( input ).toHaveAccessibleDescription(
|
|
42
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
43
|
+
);
|
|
44
|
+
} );
|
|
45
|
+
expect( input ).toHaveAccessibleDescription(
|
|
46
|
+
expect.stringContaining( 'Enter your full name.' )
|
|
47
|
+
);
|
|
48
|
+
} );
|
|
49
|
+
} );
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedTextareaControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedTextareaControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedTextareaControl
|
|
9
|
+
label="Bio"
|
|
10
|
+
help="A short bio."
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
value=""
|
|
13
|
+
/>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
expect(
|
|
17
|
+
screen.getByRole( 'textbox', { name: 'Bio' } )
|
|
18
|
+
).toHaveAccessibleDescription( 'A short bio.' );
|
|
19
|
+
} );
|
|
20
|
+
|
|
21
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
22
|
+
const user = userEvent.setup();
|
|
23
|
+
render(
|
|
24
|
+
<form>
|
|
25
|
+
<ValidatedTextareaControl
|
|
26
|
+
label="Bio"
|
|
27
|
+
help="A short bio."
|
|
28
|
+
onChange={ () => {} }
|
|
29
|
+
value=""
|
|
30
|
+
required
|
|
31
|
+
/>
|
|
32
|
+
<button type="submit">Submit</button>
|
|
33
|
+
</form>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const textarea = screen.getByRole( 'textbox', {
|
|
37
|
+
name: /^Bio/,
|
|
38
|
+
} );
|
|
39
|
+
|
|
40
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
41
|
+
|
|
42
|
+
await waitFor( () => {
|
|
43
|
+
expect( textarea ).toHaveAccessibleDescription(
|
|
44
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
45
|
+
);
|
|
46
|
+
} );
|
|
47
|
+
expect( textarea ).toHaveAccessibleDescription(
|
|
48
|
+
expect.stringContaining( 'A short bio.' )
|
|
49
|
+
);
|
|
50
|
+
} );
|
|
51
|
+
} );
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
+
import userEvent from '@testing-library/user-event';
|
|
3
|
+
import { ValidatedToggleControl } from '../components';
|
|
4
|
+
|
|
5
|
+
describe( 'ValidatedToggleControl', () => {
|
|
6
|
+
it( 'should preserve the help description', () => {
|
|
7
|
+
render(
|
|
8
|
+
<ValidatedToggleControl
|
|
9
|
+
label="Dark mode"
|
|
10
|
+
help="Enable dark mode."
|
|
11
|
+
onChange={ () => {} }
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(
|
|
16
|
+
screen.getByRole( 'checkbox', { name: 'Dark mode' } )
|
|
17
|
+
).toHaveAccessibleDescription( 'Enable dark mode.' );
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
it( 'should append the validation error alongside the help description', async () => {
|
|
21
|
+
const user = userEvent.setup();
|
|
22
|
+
render(
|
|
23
|
+
<form>
|
|
24
|
+
<ValidatedToggleControl
|
|
25
|
+
label="Dark mode"
|
|
26
|
+
help="Enable dark mode."
|
|
27
|
+
onChange={ () => {} }
|
|
28
|
+
required
|
|
29
|
+
/>
|
|
30
|
+
<button type="submit">Submit</button>
|
|
31
|
+
</form>
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
const toggle = screen.getByRole( 'checkbox', {
|
|
35
|
+
name: /^Dark mode/,
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
await user.click( screen.getByRole( 'button', { name: 'Submit' } ) );
|
|
39
|
+
|
|
40
|
+
await waitFor( () => {
|
|
41
|
+
expect( toggle ).toHaveAccessibleDescription(
|
|
42
|
+
expect.stringContaining( 'Constraints not satisfied' )
|
|
43
|
+
);
|
|
44
|
+
} );
|
|
45
|
+
expect( toggle ).toHaveAccessibleDescription(
|
|
46
|
+
expect.stringContaining( 'Enable dark mode.' )
|
|
47
|
+
);
|
|
48
|
+
} );
|
|
49
|
+
} );
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { ValidatedToggleGroupControl } from '../components';
|
|
3
|
+
import { ToggleGroupControlOption } from '../../toggle-group-control';
|
|
4
|
+
|
|
5
|
+
// The `help` prop is rendered visually by BaseControl but is not
|
|
6
|
+
// programmatically associated with the toggle group via aria-describedby.
|
|
7
|
+
// Additionally, the validity target is a hidden delegate radio input, not the
|
|
8
|
+
// toggle group itself. These are pre-existing bugs, not caused by ControlWithError.
|
|
9
|
+
describe( 'ValidatedToggleGroupControl', () => {
|
|
10
|
+
// eslint-disable-next-line jest/no-disabled-tests
|
|
11
|
+
it.skip( 'should preserve the help description', () => {
|
|
12
|
+
render(
|
|
13
|
+
<ValidatedToggleGroupControl
|
|
14
|
+
label="Alignment"
|
|
15
|
+
help="Choose text alignment."
|
|
16
|
+
value="left"
|
|
17
|
+
onChange={ () => {} }
|
|
18
|
+
>
|
|
19
|
+
<ToggleGroupControlOption label="Left" value="left" />
|
|
20
|
+
<ToggleGroupControlOption label="Center" value="center" />
|
|
21
|
+
</ValidatedToggleGroupControl>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
expect(
|
|
25
|
+
screen.getByRole( 'radiogroup', { name: 'Alignment' } )
|
|
26
|
+
).toHaveAccessibleDescription( 'Choose text alignment.' );
|
|
27
|
+
} );
|
|
28
|
+
} );
|
|
@@ -15,9 +15,11 @@ import Icon from '../icon';
|
|
|
15
15
|
import Spinner from '../spinner';
|
|
16
16
|
|
|
17
17
|
export function ValidityIndicator( {
|
|
18
|
+
id,
|
|
18
19
|
type,
|
|
19
20
|
message,
|
|
20
21
|
}: {
|
|
22
|
+
id?: string;
|
|
21
23
|
type: 'validating' | 'valid' | 'invalid';
|
|
22
24
|
message?: string;
|
|
23
25
|
} ) {
|
|
@@ -27,6 +29,7 @@ export function ValidityIndicator( {
|
|
|
27
29
|
};
|
|
28
30
|
return (
|
|
29
31
|
<p
|
|
32
|
+
id={ id }
|
|
30
33
|
className={ clsx(
|
|
31
34
|
'components-validated-control__indicator',
|
|
32
35
|
`is-${ type }`
|