@wordpress/components 23.3.2 → 23.4.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/CHANGELOG.md +20 -5
- package/build/alignment-matrix-control/utils.js +4 -4
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +37 -29
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +44 -9
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/{base-field → angle-picker-control}/types.js +0 -0
- package/build/angle-picker-control/types.js.map +1 -0
- package/build/autocomplete/autocompleter-ui.native.js +1 -0
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/base-control/hooks.js +1 -1
- package/build/base-control/hooks.js.map +1 -1
- package/build/border-box-control/utils.js +1 -1
- package/build/border-box-control/utils.js.map +1 -1
- package/build/box-control/all-input-control.js +2 -2
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/axial-input-controls.js +1 -1
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/icon.js.map +1 -1
- package/build/box-control/index.js +32 -3
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/input-controls.js +5 -5
- package/build/box-control/input-controls.js.map +1 -1
- package/build/box-control/linked-button.js.map +1 -1
- package/build/box-control/styles/box-control-icon-styles.js +28 -28
- package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
- package/build/box-control/styles/box-control-styles.js +23 -23
- package/build/box-control/styles/box-control-styles.js.map +1 -1
- package/build/box-control/styles/box-control-visualizer-styles.js +19 -19
- package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build/box-control/types.js +6 -0
- package/build/box-control/types.js.map +1 -0
- package/build/box-control/unit-control.js.map +1 -1
- package/build/box-control/utils.js +23 -23
- package/build/box-control/utils.js.map +1 -1
- package/build/color-palette/index.js +8 -3
- package/build/color-palette/index.js.map +1 -1
- package/build/combobox-control/index.js +68 -12
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/styles.js +2 -2
- package/build/combobox-control/styles.js.map +1 -1
- package/build/combobox-control/types.js +6 -0
- package/build/combobox-control/types.js.map +1 -0
- package/build/custom-gradient-picker/index.js +0 -1
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/date-time/time/index.js +1 -1
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/utils.js +1 -1
- package/build/date-time/utils.js.map +1 -1
- package/build/draggable/index.js +2 -2
- package/build/draggable/index.js.map +1 -1
- package/build/focal-point-picker/utils.js +3 -3
- package/build/focal-point-picker/utils.js.map +1 -1
- package/build/font-size-picker/utils.js +2 -2
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/gradient-picker/index.js +9 -4
- package/build/gradient-picker/index.js.map +1 -1
- package/build/input-control/reducer/reducer.js +5 -5
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/utils.js +1 -1
- package/build/input-control/utils.js.map +1 -1
- package/build/menu-items-choice/index.js +40 -3
- package/build/menu-items-choice/index.js.map +1 -1
- package/build/menu-items-choice/types.js +6 -0
- package/build/menu-items-choice/types.js.map +1 -0
- package/build/modal/index.js +41 -3
- package/build/modal/index.js.map +1 -1
- package/build/palette-edit/index.js +4 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/panel/header.js +9 -0
- package/build/panel/header.js.map +1 -1
- package/build/panel/index.js +21 -3
- package/build/panel/index.js.map +1 -1
- package/build/panel/row.js +10 -4
- package/build/panel/row.js.map +1 -1
- package/build/panel/types.js +6 -0
- package/build/panel/types.js.map +1 -0
- package/build/popover/index.js +15 -3
- package/build/popover/index.js.map +1 -1
- package/build/popover/overlay-middlewares.js +46 -0
- package/build/popover/overlay-middlewares.js.map +1 -0
- package/build/popover/utils.js +45 -6
- package/build/popover/utils.js.map +1 -1
- package/build/query-controls/terms.js +1 -1
- package/build/query-controls/terms.js.map +1 -1
- package/build/range-control/utils.js +4 -4
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +14 -14
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/snackbar/index.js +2 -2
- package/build/snackbar/index.js.map +1 -1
- package/build/toolbar/toolbar/index.js +25 -14
- package/build/toolbar/toolbar/index.js.map +1 -1
- package/build/toolbar/toolbar/toolbar-container.js +5 -4
- package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build/toolbar/toolbar/types.js +6 -0
- package/build/toolbar/toolbar/types.js.map +1 -0
- package/build/toolbar/toolbar-button/index.js +2 -0
- package/build/toolbar/toolbar-button/index.js.map +1 -1
- package/build/toolbar/toolbar-button/toolbar-button-container.js +1 -0
- package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
- package/build/toolbar/toolbar-context/index.js +2 -0
- package/build/toolbar/toolbar-context/index.js.map +1 -1
- package/build/toolbar/toolbar-dropdown-menu/index.js +2 -0
- package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build/toolbar/toolbar-group/index.js +2 -0
- package/build/toolbar/toolbar-group/index.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
- package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build/toolbar/toolbar-group/toolbar-group-container.js +1 -0
- package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build/toolbar/toolbar-item/index.js +2 -0
- package/build/toolbar/toolbar-item/index.js.map +1 -1
- package/build/tools-panel/tools-panel/component.js +61 -5
- package/build/tools-panel/tools-panel/component.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +4 -2
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-header/component.js +2 -1
- package/build/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build/tools-panel/tools-panel-header/hook.js +2 -0
- package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build/tools-panel/tools-panel-item/component.js +5 -4
- package/build/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +4 -2
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/tree-grid/cell.js +15 -4
- package/build/tree-grid/cell.js.map +1 -1
- package/build/tree-grid/index.js +81 -19
- package/build/tree-grid/index.js.map +1 -1
- package/build/tree-grid/item.js +14 -3
- package/build/tree-grid/item.js.map +1 -1
- package/build/tree-grid/roving-tab-index-context.js +1 -1
- package/build/tree-grid/roving-tab-index-context.js.map +1 -1
- package/build/tree-grid/roving-tab-index-item.js +13 -6
- package/build/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build/tree-grid/roving-tab-index.js +0 -3
- package/build/tree-grid/roving-tab-index.js.map +1 -1
- package/build/tree-grid/row.js +20 -18
- package/build/tree-grid/row.js.map +1 -1
- package/build/tree-grid/types.js +6 -0
- package/build/tree-grid/types.js.map +1 -0
- package/build/ui/context/context-connect.js +7 -7
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/ui/context/get-styled-class-name-from-key.js +1 -1
- package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
- package/build/ui/utils/get-valid-children.js +1 -1
- package/build/ui/utils/get-valid-children.js.map +1 -1
- package/build/ui/utils/space.js +1 -1
- package/build/ui/utils/space.js.map +1 -1
- package/build/unit-control/index.js +2 -2
- package/build/unit-control/index.js.map +1 -1
- package/build/unit-control/utils.js +20 -20
- package/build/unit-control/utils.js.map +1 -1
- package/build/utils/events.js +4 -4
- package/build/utils/events.js.map +1 -1
- package/build/utils/hooks/use-controlled-state.js +2 -2
- package/build/utils/hooks/use-controlled-state.js.map +1 -1
- package/build/utils/hooks/use-controlled-value.js +4 -4
- package/build/utils/hooks/use-controlled-value.js.map +1 -1
- package/build/utils/hooks/use-latest-ref.js +1 -1
- package/build/utils/hooks/use-latest-ref.js.map +1 -1
- package/build/utils/unit-values.js +3 -3
- package/build/utils/unit-values.js.map +1 -1
- package/build-module/alignment-matrix-control/utils.js +4 -4
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +37 -29
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +42 -8
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/{base-field → angle-picker-control}/types.js +0 -0
- package/build-module/{base-field → angle-picker-control}/types.js.map +0 -0
- package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/base-control/hooks.js +1 -1
- package/build-module/base-control/hooks.js.map +1 -1
- package/build-module/border-box-control/utils.js +1 -1
- package/build-module/border-box-control/utils.js.map +1 -1
- package/build-module/box-control/all-input-control.js +2 -2
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +1 -1
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/icon.js.map +1 -1
- package/build-module/box-control/index.js +31 -3
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/input-controls.js +5 -5
- package/build-module/box-control/input-controls.js.map +1 -1
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/box-control/styles/box-control-icon-styles.js +28 -28
- package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-styles.js +23 -23
- package/build-module/box-control/styles/box-control-styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-visualizer-styles.js +19 -19
- package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build-module/box-control/types.js +2 -0
- package/{build/base-field → build-module/box-control}/types.js.map +0 -0
- package/build-module/box-control/unit-control.js.map +1 -1
- package/build-module/box-control/utils.js +23 -23
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/color-palette/index.js +8 -3
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/combobox-control/index.js +68 -12
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/styles.js +2 -2
- package/build-module/combobox-control/styles.js.map +1 -1
- package/build-module/combobox-control/types.js +2 -0
- package/build-module/{resizable-box/styles/resizable-box.styles.js.map → combobox-control/types.js.map} +0 -0
- package/build-module/custom-gradient-picker/index.js +0 -1
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/date-time/time/index.js +1 -1
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/utils.js +1 -1
- package/build-module/date-time/utils.js.map +1 -1
- package/build-module/draggable/index.js +2 -2
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/focal-point-picker/utils.js +3 -3
- package/build-module/focal-point-picker/utils.js.map +1 -1
- package/build-module/font-size-picker/utils.js +2 -2
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/gradient-picker/index.js +9 -4
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +5 -5
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/utils.js +1 -1
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/menu-items-choice/index.js +40 -4
- package/build-module/menu-items-choice/index.js.map +1 -1
- package/build-module/menu-items-choice/types.js +2 -0
- package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/menu-items-choice/types.js.map} +0 -0
- package/build-module/modal/index.js +41 -4
- package/build-module/modal/index.js.map +1 -1
- package/build-module/palette-edit/index.js +4 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/panel/header.js +9 -0
- package/build-module/panel/header.js.map +1 -1
- package/build-module/panel/index.js +20 -2
- package/build-module/panel/index.js.map +1 -1
- package/build-module/panel/row.js +9 -3
- package/build-module/panel/row.js.map +1 -1
- package/build-module/panel/types.js +2 -0
- package/build-module/panel/types.js.map +1 -0
- package/build-module/popover/index.js +14 -4
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/overlay-middlewares.js +38 -0
- package/build-module/popover/overlay-middlewares.js.map +1 -0
- package/build-module/popover/utils.js +41 -5
- package/build-module/popover/utils.js.map +1 -1
- package/build-module/query-controls/terms.js +1 -1
- package/build-module/query-controls/terms.js.map +1 -1
- package/build-module/range-control/utils.js +4 -4
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +14 -14
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/snackbar/index.js +2 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/index.js +25 -13
- package/build-module/toolbar/toolbar/index.js.map +1 -1
- package/build-module/toolbar/toolbar/toolbar-container.js +4 -3
- package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
- package/build-module/toolbar/toolbar/types.js +2 -0
- package/build-module/toolbar/toolbar/types.js.map +1 -0
- package/build-module/toolbar/toolbar-button/index.js +1 -0
- package/build-module/toolbar/toolbar-button/index.js.map +1 -1
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js +1 -0
- package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
- package/build-module/toolbar/toolbar-context/index.js +2 -0
- package/build-module/toolbar/toolbar-context/index.js.map +1 -1
- package/build-module/toolbar/toolbar-dropdown-menu/index.js +1 -0
- package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/index.js +1 -0
- package/build-module/toolbar/toolbar-group/index.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +1 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js +1 -0
- package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
- package/build-module/toolbar/toolbar-item/index.js +1 -0
- package/build-module/toolbar/toolbar-item/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/component.js +59 -4
- package/build-module/tools-panel/tools-panel/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +4 -2
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/component.js +2 -1
- package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-header/hook.js +2 -0
- package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/component.js +3 -3
- package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +5 -2
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/tree-grid/cell.js +16 -4
- package/build-module/tree-grid/cell.js.map +1 -1
- package/build-module/tree-grid/index.js +81 -21
- package/build-module/tree-grid/index.js.map +1 -1
- package/build-module/tree-grid/item.js +14 -2
- package/build-module/tree-grid/item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-context.js +1 -1
- package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index-item.js +11 -4
- package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
- package/build-module/tree-grid/roving-tab-index.js +0 -3
- package/build-module/tree-grid/roving-tab-index.js.map +1 -1
- package/build-module/tree-grid/row.js +22 -17
- package/build-module/tree-grid/row.js.map +1 -1
- package/build-module/tree-grid/types.js +2 -0
- package/build-module/tree-grid/types.js.map +1 -0
- package/build-module/ui/context/context-connect.js +7 -7
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
- package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
- package/build-module/ui/utils/get-valid-children.js +1 -1
- package/build-module/ui/utils/get-valid-children.js.map +1 -1
- package/build-module/ui/utils/space.js +1 -1
- package/build-module/ui/utils/space.js.map +1 -1
- package/build-module/unit-control/index.js +2 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/unit-control/utils.js +20 -20
- package/build-module/unit-control/utils.js.map +1 -1
- package/build-module/utils/events.js +4 -4
- package/build-module/utils/events.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-state.js +2 -2
- package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-value.js +4 -4
- package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
- package/build-module/utils/hooks/use-latest-ref.js +1 -1
- package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
- package/build-module/utils/unit-values.js +3 -3
- package/build-module/utils/unit-values.js.map +1 -1
- package/build-style/style-rtl.css +5 -0
- package/build-style/style.css +5 -0
- package/build-types/alignment-matrix-control/utils.d.ts +4 -4
- package/build-types/angle-picker-control/angle-circle.d.ts +6 -0
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -0
- package/build-types/angle-picker-control/index.d.ts +29 -0
- package/build-types/angle-picker-control/index.d.ts.map +1 -0
- package/build-types/angle-picker-control/stories/index.d.ts +15 -0
- package/build-types/angle-picker-control/stories/index.d.ts.map +1 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +20 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
- package/build-types/angle-picker-control/types.d.ts +26 -0
- package/build-types/angle-picker-control/types.d.ts.map +1 -0
- package/build-types/base-control/hooks.d.ts +1 -1
- package/build-types/border-box-control/border-box-control/component.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-split-controls/component.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/stories/index.d.ts +1 -1
- package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -0
- package/build-types/border-box-control/test/index.d.ts.map +1 -0
- package/build-types/border-box-control/test/utils.d.ts +2 -0
- package/build-types/border-box-control/test/utils.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/icon.d.ts +8 -0
- package/build-types/box-control/icon.d.ts.map +1 -0
- package/build-types/box-control/index.d.ts +31 -0
- package/build-types/box-control/index.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/linked-button.d.ts +9 -0
- package/build-types/box-control/linked-button.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-icon-styles.d.ts +42 -0
- package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -0
- package/build-types/box-control/styles/box-control-styles.d.ts +42 -0
- package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -0
- 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/test/index.d.ts +2 -0
- package/build-types/box-control/test/index.d.ts.map +1 -0
- package/build-types/box-control/types.d.ts +99 -0
- package/build-types/box-control/types.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/box-control/utils.d.ts +84 -0
- package/build-types/box-control/utils.d.ts.map +1 -0
- package/build-types/color-palette/index.d.ts +3 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +6 -2
- package/build-types/color-palette/stories/index.d.ts.map +1 -1
- package/build-types/color-palette/types.d.ts +8 -0
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts +51 -0
- package/build-types/combobox-control/index.d.ts.map +1 -0
- package/build-types/combobox-control/stories/index.d.ts +18 -0
- package/build-types/combobox-control/stories/index.d.ts.map +1 -0
- package/build-types/combobox-control/styles.d.ts +8 -0
- package/build-types/combobox-control/styles.d.ts.map +1 -0
- package/build-types/combobox-control/test/index.d.ts +2 -0
- package/build-types/combobox-control/test/index.d.ts.map +1 -0
- package/build-types/combobox-control/types.d.ts +62 -0
- package/build-types/combobox-control/types.d.ts.map +1 -0
- package/build-types/date-time/utils.d.ts +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
- package/build-types/focal-point-picker/utils.d.ts +3 -3
- package/build-types/font-size-picker/utils.d.ts +2 -2
- package/build-types/input-control/reducer/reducer.d.ts +3 -3
- package/build-types/input-control/utils.d.ts +1 -1
- package/build-types/menu-items-choice/index.d.ts +38 -0
- package/build-types/menu-items-choice/index.d.ts.map +1 -0
- package/build-types/menu-items-choice/stories/index.d.ts +12 -0
- package/build-types/menu-items-choice/stories/index.d.ts.map +1 -0
- package/build-types/menu-items-choice/types.d.ts +53 -0
- package/build-types/menu-items-choice/types.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +2 -0
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/panel/header.d.ts +13 -0
- package/build-types/panel/header.d.ts.map +1 -0
- package/build-types/panel/index.d.ts +21 -0
- package/build-types/panel/index.d.ts.map +1 -0
- package/build-types/panel/row.d.ts +12 -0
- package/build-types/panel/row.d.ts.map +1 -0
- package/build-types/panel/test/header.d.ts +2 -0
- package/build-types/panel/test/header.d.ts.map +1 -0
- package/build-types/panel/test/index.d.ts +2 -0
- package/build-types/{base-field → panel}/test/index.d.ts.map +1 -1
- package/build-types/panel/test/row.d.ts +2 -0
- package/build-types/panel/test/row.d.ts.map +1 -0
- package/build-types/panel/types.d.ts +38 -0
- package/build-types/panel/types.d.ts.map +1 -0
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/overlay-middlewares.d.ts +9 -0
- package/build-types/popover/overlay-middlewares.d.ts.map +1 -0
- package/build-types/popover/stories/index.d.ts.map +1 -1
- package/build-types/popover/types.d.ts +3 -2
- package/build-types/popover/types.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +12 -4
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/query-controls/terms.d.ts +1 -1
- package/build-types/range-control/utils.d.ts +4 -4
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +5 -4
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +6 -6
- package/build-types/toolbar/index.d.ts +7 -0
- package/build-types/toolbar/index.d.ts.map +1 -0
- package/build-types/toolbar/stories/index.d.ts +14 -0
- package/build-types/toolbar/stories/index.d.ts.map +1 -0
- package/build-types/toolbar/test/index.d.ts +2 -0
- package/build-types/toolbar/test/index.d.ts.map +1 -0
- package/build-types/toolbar/test/toolbar-group.d.ts +2 -0
- package/build-types/toolbar/test/toolbar-group.d.ts.map +1 -0
- package/build-types/toolbar/toolbar/index.d.ts +25 -0
- package/build-types/toolbar/toolbar/index.d.ts.map +1 -0
- package/build-types/toolbar/toolbar/toolbar-container.d.ts +5 -0
- package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -0
- package/build-types/toolbar/toolbar/types.d.ts +15 -0
- package/build-types/toolbar/toolbar/types.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-button/index.d.ts +12 -0
- package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +3 -0
- package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-context/index.d.ts +3 -0
- package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -0
- package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-group/index.d.ts +39 -0
- package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +7 -0
- package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -0
- package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -0
- package/build-types/toolbar/toolbar-item/index.d.ts +7 -0
- package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -0
- package/build-types/tools-panel/stories/index.d.ts +17 -0
- package/build-types/tools-panel/stories/index.d.ts.map +1 -0
- package/build-types/tools-panel/tools-panel/component.d.ts +54 -2
- package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/component.d.ts +2 -2
- package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +42 -15
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/tree-grid/cell.d.ts +13 -0
- package/build-types/tree-grid/cell.d.ts.map +1 -0
- package/build-types/tree-grid/index.d.ts +70 -0
- package/build-types/tree-grid/index.d.ts.map +1 -0
- package/build-types/tree-grid/item.d.ts +12 -0
- package/build-types/tree-grid/item.d.ts.map +1 -0
- package/build-types/tree-grid/roving-tab-index-context.d.ts +10 -0
- package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -0
- package/build-types/tree-grid/roving-tab-index-item.d.ts +5 -0
- package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -0
- package/build-types/tree-grid/roving-tab-index.d.ts +10 -0
- package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -0
- package/build-types/tree-grid/row.d.ts +12 -0
- package/build-types/tree-grid/row.d.ts.map +1 -0
- package/build-types/tree-grid/stories/index.d.ts +13 -0
- package/build-types/tree-grid/stories/index.d.ts.map +1 -0
- package/build-types/tree-grid/test/cell.d.ts +2 -0
- package/build-types/tree-grid/test/cell.d.ts.map +1 -0
- package/build-types/tree-grid/test/index.d.ts +2 -0
- package/build-types/tree-grid/test/index.d.ts.map +1 -0
- package/build-types/tree-grid/test/roving-tab-index-item.d.ts +2 -0
- package/build-types/tree-grid/test/roving-tab-index-item.d.ts.map +1 -0
- package/build-types/tree-grid/test/roving-tab-index.d.ts +2 -0
- package/build-types/tree-grid/test/roving-tab-index.d.ts.map +1 -0
- package/build-types/tree-grid/test/row.d.ts +2 -0
- package/build-types/tree-grid/test/row.d.ts.map +1 -0
- package/build-types/tree-grid/types.d.ts +109 -0
- package/build-types/tree-grid/types.d.ts.map +1 -0
- package/build-types/ui/context/context-connect.d.ts +7 -7
- package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -1
- package/build-types/ui/utils/get-valid-children.d.ts +1 -1
- package/build-types/ui/utils/space.d.ts +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/utils.d.ts +20 -20
- package/build-types/utils/events.d.ts +2 -2
- package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
- package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
- package/build-types/utils/hooks/use-controlled-value.d.ts +4 -4
- package/build-types/utils/hooks/use-latest-ref.d.ts +1 -1
- package/build-types/utils/unit-values.d.ts +3 -3
- package/package.json +19 -19
- package/src/alignment-matrix-control/utils.tsx +4 -4
- package/src/angle-picker-control/README.md +17 -14
- package/src/angle-picker-control/{angle-circle.js → angle-circle.tsx} +44 -12
- package/src/angle-picker-control/{index.js → index.tsx} +54 -10
- package/src/angle-picker-control/stories/index.tsx +57 -0
- package/src/angle-picker-control/styles/{angle-picker-control-styles.js → angle-picker-control-styles.tsx} +5 -1
- package/src/angle-picker-control/types.ts +29 -0
- package/src/autocomplete/autocompleter-ui.native.js +1 -0
- package/src/base-control/hooks.ts +1 -1
- package/src/border-box-control/test/{index.js → index.tsx} +76 -102
- package/src/border-box-control/test/{utils.js → utils.ts} +20 -0
- package/src/border-box-control/utils.ts +1 -1
- package/src/box-control/README.md +17 -26
- package/src/box-control/{all-input-control.js → all-input-control.tsx} +10 -6
- package/src/box-control/{axial-input-controls.js → axial-input-controls.tsx} +29 -24
- package/src/box-control/{icon.js → icon.tsx} +9 -4
- package/src/box-control/{index.js → index.tsx} +43 -8
- package/src/box-control/{input-controls.js → input-controls.tsx} +26 -16
- package/src/box-control/{linked-button.js → linked-button.tsx} +4 -1
- package/src/box-control/styles/{box-control-icon-styles.js → box-control-icon-styles.ts} +1 -1
- package/src/box-control/styles/{box-control-styles.js → box-control-styles.ts} +10 -2
- package/src/box-control/styles/{box-control-visualizer-styles.js → box-control-visualizer-styles.ts} +6 -2
- package/src/box-control/test/{index.js → index.tsx} +12 -9
- package/src/box-control/types.ts +121 -0
- package/src/box-control/{unit-control.js → unit-control.tsx} +9 -2
- package/src/box-control/{utils.js → utils.ts} +47 -38
- package/src/button/test/index.tsx +38 -30
- package/src/color-palette/README.md +7 -0
- package/src/color-palette/index.tsx +6 -1
- package/src/color-palette/types.ts +8 -0
- package/src/combobox-control/README.md +8 -15
- package/src/combobox-control/{index.js → index.tsx} +91 -19
- package/src/combobox-control/stories/index.tsx +114 -0
- package/src/combobox-control/styles.ts +4 -1
- package/src/combobox-control/test/{index.js → index.tsx} +9 -7
- package/src/combobox-control/types.ts +69 -0
- package/src/custom-gradient-picker/index.js +0 -1
- package/src/custom-select-control/stories/index.js +1 -1
- package/src/date-time/time/index.tsx +1 -1
- package/src/date-time/utils.ts +1 -1
- package/src/draggable/index.tsx +2 -2
- package/src/dropdown-menu/test/index.js +3 -11
- package/src/focal-point-picker/utils.ts +3 -3
- package/src/font-size-picker/utils.ts +2 -2
- package/src/gradient-picker/README.md +8 -0
- package/src/gradient-picker/index.js +6 -1
- package/src/input-control/reducer/reducer.ts +5 -5
- package/src/input-control/utils.ts +1 -1
- package/src/menu-items-choice/index.tsx +83 -0
- package/src/menu-items-choice/stories/index.tsx +79 -0
- package/src/menu-items-choice/types.ts +54 -0
- package/src/modal/index.tsx +45 -1
- package/src/modal/style.scss +8 -0
- package/src/modal/types.ts +2 -0
- package/src/palette-edit/index.js +4 -1
- package/src/panel/README.md +2 -2
- package/src/panel/header.tsx +20 -0
- package/src/panel/index.tsx +48 -0
- package/src/panel/row.tsx +37 -0
- package/src/panel/stories/index.js +22 -0
- package/src/panel/test/__snapshots__/{header.js.snap → header.tsx.snap} +0 -0
- package/src/panel/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/panel/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
- package/src/panel/test/{header.js → header.tsx} +1 -1
- package/src/panel/test/{index.js → index.tsx} +6 -4
- package/src/panel/test/{row.js → row.tsx} +4 -2
- package/src/panel/types.ts +38 -0
- package/src/popover/README.md +4 -1
- package/src/popover/index.tsx +17 -1
- package/src/popover/overlay-middlewares.tsx +29 -0
- package/src/popover/stories/index.tsx +7 -1
- package/src/popover/test/index.tsx +29 -21
- package/src/popover/types.ts +4 -2
- package/src/popover/utils.ts +39 -3
- package/src/query-controls/terms.ts +1 -1
- package/src/range-control/utils.ts +4 -4
- package/src/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
- package/src/resizable-box/resize-tooltip/utils.ts +14 -14
- package/src/snackbar/index.tsx +2 -2
- package/src/toolbar/stories/{index.js → index.tsx} +39 -26
- package/src/toolbar/test/{index.js → index.tsx} +0 -0
- package/src/toolbar/test/{toolbar-group.js → toolbar-group.tsx} +2 -2
- package/src/toolbar/toolbar/README.md +7 -2
- package/src/toolbar/toolbar/{index.js → index.tsx} +33 -12
- package/src/toolbar/toolbar/{toolbar-container.js → toolbar-container.tsx} +9 -2
- package/src/toolbar/toolbar/types.ts +15 -0
- package/src/toolbar/toolbar-button/index.js +2 -0
- package/src/toolbar/toolbar-button/toolbar-button-container.js +2 -0
- package/src/toolbar/toolbar-context/index.js +2 -0
- package/src/toolbar/toolbar-dropdown-menu/index.js +2 -0
- package/src/toolbar/toolbar-group/index.js +2 -0
- package/src/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
- package/src/toolbar/toolbar-group/toolbar-group-container.js +2 -0
- package/src/toolbar/toolbar-item/index.js +2 -0
- package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
- package/src/tools-panel/test/index.js +6 -6
- package/src/tools-panel/tools-panel/README.md +12 -4
- package/src/tools-panel/tools-panel/component.tsx +57 -3
- package/src/tools-panel/tools-panel/hook.ts +4 -2
- package/src/tools-panel/tools-panel-header/README.md +7 -0
- package/src/tools-panel/tools-panel-header/component.tsx +2 -1
- package/src/tools-panel/tools-panel-header/hook.ts +6 -4
- package/src/tools-panel/tools-panel-item/README.md +6 -4
- package/src/tools-panel/tools-panel-item/component.tsx +4 -4
- package/src/tools-panel/tools-panel-item/hook.ts +4 -2
- package/src/tools-panel/types.ts +43 -15
- package/src/tree-grid/README.md +18 -58
- package/src/tree-grid/cell.tsx +41 -0
- package/src/tree-grid/{index.js → index.tsx} +111 -35
- package/src/tree-grid/item.tsx +32 -0
- package/src/tree-grid/{roving-tab-index-context.js → roving-tab-index-context.ts} +9 -1
- package/src/tree-grid/roving-tab-index-item.tsx +50 -0
- package/src/tree-grid/{roving-tab-index.js → roving-tab-index.tsx} +7 -5
- package/src/tree-grid/row.tsx +47 -0
- package/src/tree-grid/stories/index.tsx +144 -0
- package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.tsx.snap} +0 -0
- package/src/tree-grid/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.js.snap → roving-tab-index-item.tsx.snap} +0 -0
- package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap} +0 -0
- package/src/tree-grid/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
- package/src/tree-grid/test/{cell.js → cell.tsx} +7 -4
- package/src/tree-grid/test/{index.js → index.tsx} +13 -5
- package/src/tree-grid/test/{roving-tab-index-item.js → roving-tab-index-item.tsx} +7 -4
- package/src/tree-grid/test/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
- package/src/tree-grid/test/{row.js → row.tsx} +4 -4
- package/src/tree-grid/types.ts +116 -0
- package/src/ui/context/context-connect.ts +7 -7
- package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
- package/src/ui/utils/get-valid-children.ts +1 -1
- package/src/ui/utils/space.ts +1 -1
- package/src/unit-control/index.tsx +2 -2
- package/src/unit-control/utils.ts +20 -20
- package/src/utils/events.ts +4 -4
- package/src/utils/hooks/use-controlled-state.js +2 -2
- package/src/utils/hooks/use-controlled-value.ts +4 -4
- package/src/utils/hooks/use-latest-ref.ts +1 -1
- package/src/utils/unit-values.ts +3 -3
- package/tsconfig.json +1 -7
- package/tsconfig.tsbuildinfo +1 -1
- package/build/base-field/hook.js +0 -54
- package/build/base-field/hook.js.map +0 -1
- package/build/base-field/index.js +0 -14
- package/build/base-field/index.js.map +0 -1
- package/build/base-field/styles.js +0 -33
- package/build/base-field/styles.js.map +0 -1
- package/build/resizable-box/styles/resizable-box.styles.js +0 -2
- package/build-module/base-field/hook.js +0 -37
- package/build-module/base-field/hook.js.map +0 -1
- package/build-module/base-field/index.js +0 -2
- package/build-module/base-field/index.js.map +0 -1
- package/build-module/base-field/styles.js +0 -18
- package/build-module/base-field/styles.js.map +0 -1
- package/build-module/resizable-box/styles/resizable-box.styles.js +0 -2
- package/build-types/base-field/hook.d.ts +0 -270
- package/build-types/base-field/hook.d.ts.map +0 -1
- package/build-types/base-field/index.d.ts +0 -2
- package/build-types/base-field/index.d.ts.map +0 -1
- package/build-types/base-field/styles.d.ts +0 -6
- package/build-types/base-field/styles.d.ts.map +0 -1
- package/build-types/base-field/types.d.ts +0 -29
- package/build-types/base-field/types.d.ts.map +0 -1
- package/build-types/resizable-box/styles/resizable-box.styles.d.ts +0 -1
- package/build-types/resizable-box/styles/resizable-box.styles.d.ts.map +0 -1
- package/src/angle-picker-control/stories/index.js +0 -29
- package/src/base-field/README.md +0 -66
- package/src/base-field/hook.ts +0 -51
- package/src/base-field/index.ts +0 -1
- package/src/base-field/styles.ts +0 -86
- package/src/base-field/test/__snapshots__/index.tsx.snap +0 -141
- package/src/base-field/test/index.tsx +0 -84
- package/src/base-field/types.ts +0 -29
- package/src/combobox-control/stories/index.js +0 -339
- package/src/menu-items-choice/index.js +0 -43
- package/src/panel/header.js +0 -10
- package/src/panel/index.js +0 -26
- package/src/panel/row.js +0 -20
- package/src/resizable-box/styles/resizable-box.styles.js +0 -0
- package/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +0 -246
- package/src/tree-grid/cell.js +0 -24
- package/src/tree-grid/item.js +0 -20
- package/src/tree-grid/roving-tab-index-item.js +0 -33
- package/src/tree-grid/row.js +0 -31
- package/src/tree-grid/stories/index.js +0 -106
|
@@ -30,25 +30,83 @@ import { FlexBlock, FlexItem } from '../flex';
|
|
|
30
30
|
import withFocusOutside from '../higher-order/with-focus-outside';
|
|
31
31
|
import { useControlledValue } from '../utils/hooks';
|
|
32
32
|
import { normalizeTextString } from '../utils/strings';
|
|
33
|
+
import type { ComboboxControlOption, ComboboxControlProps } from './types';
|
|
34
|
+
import type { TokenInputProps } from '../form-token-field/types';
|
|
33
35
|
|
|
34
36
|
const noop = () => {};
|
|
35
37
|
|
|
36
38
|
const DetectOutside = withFocusOutside(
|
|
37
39
|
class extends Component {
|
|
40
|
+
// @ts-expect-error - TODO: Should be resolved when `withFocusOutside` is refactored to TypeScript
|
|
38
41
|
handleFocusOutside( event ) {
|
|
42
|
+
// @ts-expect-error - TODO: Should be resolved when `withFocusOutside` is refactored to TypeScript
|
|
39
43
|
this.props.onFocusOutside( event );
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
render() {
|
|
47
|
+
// @ts-expect-error - TODO: Should be resolved when `withFocusOutside` is refactored to TypeScript
|
|
43
48
|
return this.props.children;
|
|
44
49
|
}
|
|
45
50
|
}
|
|
46
51
|
);
|
|
47
52
|
|
|
53
|
+
const getIndexOfMatchingSuggestion = (
|
|
54
|
+
selectedSuggestion: ComboboxControlOption | null,
|
|
55
|
+
matchingSuggestions: ComboboxControlOption[]
|
|
56
|
+
) =>
|
|
57
|
+
selectedSuggestion === null
|
|
58
|
+
? -1
|
|
59
|
+
: matchingSuggestions.indexOf( selectedSuggestion );
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* `ComboboxControl` is an enhanced version of a [`SelectControl`](../select-control/README.md) with the addition of
|
|
63
|
+
* being able to search for options using a search input.
|
|
64
|
+
*
|
|
65
|
+
* ```jsx
|
|
66
|
+
* import { ComboboxControl } from '@wordpress/components';
|
|
67
|
+
* import { useState } from '@wordpress/element';
|
|
68
|
+
*
|
|
69
|
+
* const options = [
|
|
70
|
+
* {
|
|
71
|
+
* value: 'small',
|
|
72
|
+
* label: 'Small',
|
|
73
|
+
* },
|
|
74
|
+
* {
|
|
75
|
+
* value: 'normal',
|
|
76
|
+
* label: 'Normal',
|
|
77
|
+
* },
|
|
78
|
+
* {
|
|
79
|
+
* value: 'large',
|
|
80
|
+
* label: 'Large',
|
|
81
|
+
* },
|
|
82
|
+
* ];
|
|
83
|
+
*
|
|
84
|
+
* function MyComboboxControl() {
|
|
85
|
+
* const [ fontSize, setFontSize ] = useState();
|
|
86
|
+
* const [ filteredOptions, setFilteredOptions ] = useState( options );
|
|
87
|
+
* return (
|
|
88
|
+
* <ComboboxControl
|
|
89
|
+
* label="Font Size"
|
|
90
|
+
* value={ fontSize }
|
|
91
|
+
* onChange={ setFontSize }
|
|
92
|
+
* options={ filteredOptions }
|
|
93
|
+
* onFilterValueChange={ ( inputValue ) =>
|
|
94
|
+
* setFilteredOptions(
|
|
95
|
+
* options.filter( ( option ) =>
|
|
96
|
+
* option.label
|
|
97
|
+
* .toLowerCase()
|
|
98
|
+
* .startsWith( inputValue.toLowerCase() )
|
|
99
|
+
* )
|
|
100
|
+
* )
|
|
101
|
+
* }
|
|
102
|
+
* />
|
|
103
|
+
* );
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
48
107
|
function ComboboxControl( {
|
|
49
|
-
/** Start opting into the new margin-free styles that will become the default in a future version. */
|
|
50
108
|
__nextHasNoMarginBottom = false,
|
|
51
|
-
__next36pxDefaultSize,
|
|
109
|
+
__next36pxDefaultSize = false,
|
|
52
110
|
value: valueProp,
|
|
53
111
|
label,
|
|
54
112
|
options,
|
|
@@ -62,7 +120,7 @@ function ComboboxControl( {
|
|
|
62
120
|
selected: __( 'Item selected.' ),
|
|
63
121
|
},
|
|
64
122
|
__experimentalRenderItem,
|
|
65
|
-
} ) {
|
|
123
|
+
}: ComboboxControlProps ) {
|
|
66
124
|
const [ value, setValue ] = useControlledValue( {
|
|
67
125
|
value: valueProp,
|
|
68
126
|
onChange: onChangeProp,
|
|
@@ -80,11 +138,11 @@ function ComboboxControl( {
|
|
|
80
138
|
const [ isExpanded, setIsExpanded ] = useState( false );
|
|
81
139
|
const [ inputHasFocus, setInputHasFocus ] = useState( false );
|
|
82
140
|
const [ inputValue, setInputValue ] = useState( '' );
|
|
83
|
-
const inputContainer = useRef();
|
|
141
|
+
const inputContainer = useRef< HTMLInputElement >( null );
|
|
84
142
|
|
|
85
143
|
const matchingSuggestions = useMemo( () => {
|
|
86
|
-
const startsWithMatch = [];
|
|
87
|
-
const containsMatch = [];
|
|
144
|
+
const startsWithMatch: ComboboxControlOption[] = [];
|
|
145
|
+
const containsMatch: ComboboxControlOption[] = [];
|
|
88
146
|
const match = normalizeTextString( inputValue );
|
|
89
147
|
options.forEach( ( option ) => {
|
|
90
148
|
const index = normalizeTextString( option.label ).indexOf( match );
|
|
@@ -98,7 +156,9 @@ function ComboboxControl( {
|
|
|
98
156
|
return startsWithMatch.concat( containsMatch );
|
|
99
157
|
}, [ inputValue, options ] );
|
|
100
158
|
|
|
101
|
-
const onSuggestionSelected = (
|
|
159
|
+
const onSuggestionSelected = (
|
|
160
|
+
newSelectedSuggestion: ComboboxControlOption
|
|
161
|
+
) => {
|
|
102
162
|
setValue( newSelectedSuggestion.value );
|
|
103
163
|
speak( messages.selected, 'assertive' );
|
|
104
164
|
setSelectedSuggestion( newSelectedSuggestion );
|
|
@@ -107,7 +167,10 @@ function ComboboxControl( {
|
|
|
107
167
|
};
|
|
108
168
|
|
|
109
169
|
const handleArrowNavigation = ( offset = 1 ) => {
|
|
110
|
-
const index =
|
|
170
|
+
const index = getIndexOfMatchingSuggestion(
|
|
171
|
+
selectedSuggestion,
|
|
172
|
+
matchingSuggestions
|
|
173
|
+
);
|
|
111
174
|
let nextIndex = index + offset;
|
|
112
175
|
if ( nextIndex < 0 ) {
|
|
113
176
|
nextIndex = matchingSuggestions.length - 1;
|
|
@@ -118,7 +181,9 @@ function ComboboxControl( {
|
|
|
118
181
|
setIsExpanded( true );
|
|
119
182
|
};
|
|
120
183
|
|
|
121
|
-
const onKeyDown
|
|
184
|
+
const onKeyDown: React.KeyboardEventHandler< HTMLDivElement > = (
|
|
185
|
+
event
|
|
186
|
+
) => {
|
|
122
187
|
let preventDefault = false;
|
|
123
188
|
|
|
124
189
|
if (
|
|
@@ -177,7 +242,7 @@ function ComboboxControl( {
|
|
|
177
242
|
setIsExpanded( false );
|
|
178
243
|
};
|
|
179
244
|
|
|
180
|
-
const onInputChange = ( event ) => {
|
|
245
|
+
const onInputChange: TokenInputProps[ 'onChange' ] = ( event ) => {
|
|
181
246
|
const text = event.value;
|
|
182
247
|
setInputValue( text );
|
|
183
248
|
onFilterValueChange( text );
|
|
@@ -188,14 +253,17 @@ function ComboboxControl( {
|
|
|
188
253
|
|
|
189
254
|
const handleOnReset = () => {
|
|
190
255
|
setValue( null );
|
|
191
|
-
inputContainer.current
|
|
256
|
+
inputContainer.current?.focus();
|
|
192
257
|
};
|
|
193
258
|
|
|
194
259
|
// Update current selections when the filter input changes.
|
|
195
260
|
useEffect( () => {
|
|
196
261
|
const hasMatchingSuggestions = matchingSuggestions.length > 0;
|
|
197
262
|
const hasSelectedMatchingSuggestions =
|
|
198
|
-
|
|
263
|
+
getIndexOfMatchingSuggestion(
|
|
264
|
+
selectedSuggestion,
|
|
265
|
+
matchingSuggestions
|
|
266
|
+
) > 0;
|
|
199
267
|
|
|
200
268
|
if ( hasMatchingSuggestions && ! hasSelectedMatchingSuggestions ) {
|
|
201
269
|
// If the current selection isn't present in the list of suggestions, then automatically select the first item from the list of suggestions.
|
|
@@ -235,7 +303,6 @@ function ComboboxControl( {
|
|
|
235
303
|
className,
|
|
236
304
|
'components-combobox-control'
|
|
237
305
|
) }
|
|
238
|
-
tabIndex="-1"
|
|
239
306
|
label={ label }
|
|
240
307
|
id={ `components-form-token-input-${ instanceId }` }
|
|
241
308
|
hideLabelFromVision={ hideLabelFromVision }
|
|
@@ -243,7 +310,7 @@ function ComboboxControl( {
|
|
|
243
310
|
>
|
|
244
311
|
<div
|
|
245
312
|
className="components-combobox-control__suggestions-container"
|
|
246
|
-
tabIndex=
|
|
313
|
+
tabIndex={ -1 }
|
|
247
314
|
onKeyDown={ onKeyDown }
|
|
248
315
|
>
|
|
249
316
|
<InputWrapperFlex
|
|
@@ -258,8 +325,9 @@ function ComboboxControl( {
|
|
|
258
325
|
onFocus={ onFocus }
|
|
259
326
|
onBlur={ onBlur }
|
|
260
327
|
isExpanded={ isExpanded }
|
|
261
|
-
selectedSuggestionIndex={
|
|
262
|
-
selectedSuggestion
|
|
328
|
+
selectedSuggestionIndex={ getIndexOfMatchingSuggestion(
|
|
329
|
+
selectedSuggestion,
|
|
330
|
+
matchingSuggestions
|
|
263
331
|
) }
|
|
264
332
|
onChange={ onInputChange }
|
|
265
333
|
/>
|
|
@@ -279,13 +347,17 @@ function ComboboxControl( {
|
|
|
279
347
|
{ isExpanded && (
|
|
280
348
|
<SuggestionsList
|
|
281
349
|
instanceId={ instanceId }
|
|
282
|
-
|
|
350
|
+
// The empty string for `value` here is not actually used, but is
|
|
351
|
+
// just a quick way to satisfy the TypeScript requirements of SuggestionsList.
|
|
352
|
+
// See: https://github.com/WordPress/gutenberg/pull/47581/files#r1091089330
|
|
353
|
+
match={ { label: inputValue, value: '' } }
|
|
283
354
|
displayTransform={ ( suggestion ) =>
|
|
284
355
|
suggestion.label
|
|
285
356
|
}
|
|
286
357
|
suggestions={ matchingSuggestions }
|
|
287
|
-
selectedIndex={
|
|
288
|
-
selectedSuggestion
|
|
358
|
+
selectedIndex={ getIndexOfMatchingSuggestion(
|
|
359
|
+
selectedSuggestion,
|
|
360
|
+
matchingSuggestions
|
|
289
361
|
) }
|
|
290
362
|
onHover={ setSelectedSuggestion }
|
|
291
363
|
onSelect={ onSuggestionSelected }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import ComboboxControl from '..';
|
|
15
|
+
import type { ComboboxControlProps } from '../types';
|
|
16
|
+
|
|
17
|
+
const countries = [
|
|
18
|
+
{ name: 'Afghanistan', code: 'AF' },
|
|
19
|
+
{ name: 'Åland Islands', code: 'AX' },
|
|
20
|
+
{ name: 'Albania', code: 'AL' },
|
|
21
|
+
{ name: 'Algeria', code: 'DZ' },
|
|
22
|
+
{ name: 'American Samoa', code: 'AS' },
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const meta: ComponentMeta< typeof ComboboxControl > = {
|
|
26
|
+
title: 'Components/ComboboxControl',
|
|
27
|
+
component: ComboboxControl,
|
|
28
|
+
argTypes: {
|
|
29
|
+
value: { control: { type: null } },
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
actions: { argTypesRegex: '^on.*' },
|
|
33
|
+
controls: { expanded: true },
|
|
34
|
+
docs: { source: { state: 'open' } },
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
const mapCountryOption = ( country: typeof countries[ number ] ) => ( {
|
|
40
|
+
value: country.code,
|
|
41
|
+
label: country.name,
|
|
42
|
+
} );
|
|
43
|
+
|
|
44
|
+
const countryOptions = countries.map( mapCountryOption );
|
|
45
|
+
|
|
46
|
+
const Template: ComponentStory< typeof ComboboxControl > = ( {
|
|
47
|
+
onChange,
|
|
48
|
+
...args
|
|
49
|
+
} ) => {
|
|
50
|
+
const [ value, setValue ] =
|
|
51
|
+
useState< ComboboxControlProps[ 'value' ] >( null );
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<ComboboxControl
|
|
56
|
+
{ ...args }
|
|
57
|
+
value={ value }
|
|
58
|
+
onChange={ ( ...changeArgs ) => {
|
|
59
|
+
setValue( ...changeArgs );
|
|
60
|
+
onChange?.( ...changeArgs );
|
|
61
|
+
} }
|
|
62
|
+
/>
|
|
63
|
+
</>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
export const Default = Template.bind( {} );
|
|
67
|
+
Default.args = {
|
|
68
|
+
__next36pxDefaultSize: false,
|
|
69
|
+
allowReset: false,
|
|
70
|
+
label: 'Select a country',
|
|
71
|
+
options: countryOptions,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The rendered output of each suggestion can be customized by passing a
|
|
76
|
+
* render function to the `__experimentalRenderItem` prop. (This is still an experimental feature
|
|
77
|
+
* and is subject to change.)
|
|
78
|
+
*/
|
|
79
|
+
export const WithCustomRenderItem = Template.bind( {} );
|
|
80
|
+
WithCustomRenderItem.args = {
|
|
81
|
+
...Default.args,
|
|
82
|
+
label: 'Select an author',
|
|
83
|
+
options: [
|
|
84
|
+
{
|
|
85
|
+
value: 'parsley',
|
|
86
|
+
label: 'Parsley Montana',
|
|
87
|
+
age: 48,
|
|
88
|
+
country: 'Germany',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
value: 'cabbage',
|
|
92
|
+
label: 'Cabbage New York',
|
|
93
|
+
age: 44,
|
|
94
|
+
country: 'France',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
value: 'jake',
|
|
98
|
+
label: 'Jake Weary',
|
|
99
|
+
age: 41,
|
|
100
|
+
country: 'United Kingdom',
|
|
101
|
+
},
|
|
102
|
+
],
|
|
103
|
+
__experimentalRenderItem: ( { item } ) => {
|
|
104
|
+
const { label, age, country } = item;
|
|
105
|
+
return (
|
|
106
|
+
<div>
|
|
107
|
+
<div style={ { marginBottom: '0.2rem' } }>{ label }</div>
|
|
108
|
+
<small>
|
|
109
|
+
Age: { age }, Country: { country }
|
|
110
|
+
</small>
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
},
|
|
114
|
+
};
|
|
@@ -9,8 +9,11 @@ import { css } from '@emotion/react';
|
|
|
9
9
|
*/
|
|
10
10
|
import { Flex } from '../flex';
|
|
11
11
|
import { space } from '../ui/utils/space';
|
|
12
|
+
import type { ComboboxControlProps } from './types';
|
|
12
13
|
|
|
13
|
-
const deprecatedDefaultSize = ( {
|
|
14
|
+
const deprecatedDefaultSize = ( {
|
|
15
|
+
__next36pxDefaultSize,
|
|
16
|
+
}: Pick< ComboboxControlProps, '__next36pxDefaultSize' > ) =>
|
|
14
17
|
! __next36pxDefaultSize &&
|
|
15
18
|
css`
|
|
16
19
|
height: 28px; // 30px - 2px vertical borders on parent container
|
|
@@ -12,7 +12,8 @@ import { useState } from '@wordpress/element';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import ComboboxControl from '
|
|
15
|
+
import ComboboxControl from '..';
|
|
16
|
+
import type { ComboboxControlOption, ComboboxControlProps } from '../types';
|
|
16
17
|
|
|
17
18
|
const timezones = [
|
|
18
19
|
{ label: 'Greenwich Mean Time', value: 'GMT' },
|
|
@@ -49,20 +50,21 @@ const timezones = [
|
|
|
49
50
|
];
|
|
50
51
|
|
|
51
52
|
const defaultLabelText = 'Select a timezone';
|
|
52
|
-
const getLabel = ( labelText ) => screen.getByText( labelText );
|
|
53
|
-
const getInput = ( name ) => screen.getByRole( 'combobox', { name } );
|
|
54
|
-
const getOption = ( name ) => screen.getByRole( 'option', { name } );
|
|
53
|
+
const getLabel = ( labelText: string ) => screen.getByText( labelText );
|
|
54
|
+
const getInput = ( name: string ) => screen.getByRole( 'combobox', { name } );
|
|
55
|
+
const getOption = ( name: string ) => screen.getByRole( 'option', { name } );
|
|
55
56
|
const getAllOptions = () => screen.getAllByRole( 'option' );
|
|
56
|
-
const getOptionSearchString = ( option ) =>
|
|
57
|
+
const getOptionSearchString = ( option: ComboboxControlOption ) =>
|
|
58
|
+
option.label.substring( 0, 11 );
|
|
57
59
|
const setupUser = () => userEvent.setup();
|
|
58
60
|
|
|
59
61
|
const ControlledComboboxControl = ( {
|
|
60
62
|
value: valueProp,
|
|
61
63
|
onChange,
|
|
62
64
|
...props
|
|
63
|
-
} ) => {
|
|
65
|
+
}: ComboboxControlProps ) => {
|
|
64
66
|
const [ value, setValue ] = useState( valueProp );
|
|
65
|
-
const handleOnChange = ( newValue ) => {
|
|
67
|
+
const handleOnChange: ComboboxControlProps[ 'onChange' ] = ( newValue ) => {
|
|
66
68
|
setValue( newValue );
|
|
67
69
|
onChange?.( newValue );
|
|
68
70
|
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { BaseControlProps } from '../base-control/types';
|
|
5
|
+
|
|
6
|
+
export type ComboboxControlOption = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
[ key: string ]: any;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type ComboboxControlProps = Pick<
|
|
13
|
+
BaseControlProps,
|
|
14
|
+
| '__nextHasNoMarginBottom'
|
|
15
|
+
| 'className'
|
|
16
|
+
| 'label'
|
|
17
|
+
| 'hideLabelFromVision'
|
|
18
|
+
| 'help'
|
|
19
|
+
> & {
|
|
20
|
+
/**
|
|
21
|
+
* Custom renderer invoked for each option in the suggestion list.
|
|
22
|
+
* The render prop receives as its argument an object containing, under the `item` key,
|
|
23
|
+
* the single option's data (directly from the array of data passed to the `options` prop).
|
|
24
|
+
*/
|
|
25
|
+
__experimentalRenderItem?: ( args: {
|
|
26
|
+
item: ComboboxControlOption;
|
|
27
|
+
} ) => React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Start opting into the larger default height that will become the default size in a future version.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
__next36pxDefaultSize?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Show a reset button to clear the input.
|
|
36
|
+
*
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
allowReset?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Customizable UI messages.
|
|
42
|
+
*/
|
|
43
|
+
messages?: {
|
|
44
|
+
/**
|
|
45
|
+
* The message to announce to screen readers when a suggestion is selected.
|
|
46
|
+
*
|
|
47
|
+
* @default `__( 'Item selected.' )`
|
|
48
|
+
*/
|
|
49
|
+
selected: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Function called with the selected value changes.
|
|
53
|
+
*/
|
|
54
|
+
onChange?: ( value: ComboboxControlProps[ 'value' ] ) => void;
|
|
55
|
+
/**
|
|
56
|
+
* Function called when the control's search input value changes. The argument contains the next input value.
|
|
57
|
+
*
|
|
58
|
+
* @default noop
|
|
59
|
+
*/
|
|
60
|
+
onFilterValueChange?: ( value: string ) => void;
|
|
61
|
+
/**
|
|
62
|
+
* The options that can be chosen from.
|
|
63
|
+
*/
|
|
64
|
+
options: ComboboxControlOption[];
|
|
65
|
+
/**
|
|
66
|
+
* The current value of the control.
|
|
67
|
+
*/
|
|
68
|
+
value?: string | null;
|
|
69
|
+
};
|
|
@@ -10,9 +10,9 @@ export default {
|
|
|
10
10
|
__next36pxDefaultSize: { control: { type: 'boolean' } },
|
|
11
11
|
__experimentalShowSelectedHint: { control: { type: 'boolean' } },
|
|
12
12
|
size: {
|
|
13
|
+
options: [ 'small', 'default', '__unstable-large' ],
|
|
13
14
|
control: {
|
|
14
15
|
type: 'radio',
|
|
15
|
-
options: [ 'small', 'default', '__unstable-large' ],
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -51,7 +51,7 @@ function from12hTo24h( hours: number, isPm: boolean ) {
|
|
|
51
51
|
* given width. For example, the hours and minutes inputs are padded to 2 so
|
|
52
52
|
* that '4' appears as '04'.
|
|
53
53
|
*
|
|
54
|
-
* @param
|
|
54
|
+
* @param pad How many digits the value should be.
|
|
55
55
|
*/
|
|
56
56
|
function buildPadInputStateReducer( pad: number ) {
|
|
57
57
|
return ( state: InputState, action: InputAction ) => {
|
package/src/date-time/utils.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { toDate } from 'date-fns';
|
|
|
7
7
|
* Like date-fn's toDate, but tries to guess the format when a string is
|
|
8
8
|
* given.
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
10
|
+
* @param input Value to turn into a date.
|
|
11
11
|
*/
|
|
12
12
|
export function inputToDate( input: Date | string | number ): Date {
|
|
13
13
|
if ( typeof input === 'string' ) {
|
package/src/draggable/index.tsx
CHANGED
|
@@ -75,7 +75,7 @@ export function Draggable( {
|
|
|
75
75
|
/**
|
|
76
76
|
* Removes the element clone, resets cursor, and removes drag listener.
|
|
77
77
|
*
|
|
78
|
-
* @param
|
|
78
|
+
* @param event The non-custom DragEvent.
|
|
79
79
|
*/
|
|
80
80
|
function end( event: DragEvent ) {
|
|
81
81
|
event.preventDefault();
|
|
@@ -94,7 +94,7 @@ export function Draggable( {
|
|
|
94
94
|
* - Sets transfer data.
|
|
95
95
|
* - Adds dragover listener.
|
|
96
96
|
*
|
|
97
|
-
* @param
|
|
97
|
+
* @param event The non-custom DragEvent.
|
|
98
98
|
*/
|
|
99
99
|
function start( event: DragEvent ) {
|
|
100
100
|
const { ownerDocument } = event.target as HTMLElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { render, screen, waitFor, within } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -63,10 +63,6 @@ describe( 'DropdownMenu', () => {
|
|
|
63
63
|
|
|
64
64
|
await user.keyboard( '[ArrowDown]' );
|
|
65
65
|
|
|
66
|
-
// Wait for the `floating-ui` effects in `Dropdown`/`Popover` to finish running
|
|
67
|
-
// See also: https://floating-ui.com/docs/react-dom#testing
|
|
68
|
-
await act( () => Promise.resolve() );
|
|
69
|
-
|
|
70
66
|
const menu = screen.getByRole( 'menu' );
|
|
71
67
|
|
|
72
68
|
// we need to wait because showing the dropdown is animated
|
|
@@ -86,15 +82,11 @@ describe( 'DropdownMenu', () => {
|
|
|
86
82
|
/>
|
|
87
83
|
);
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
// Move focus on the toggle button
|
|
86
|
+
await user.tab();
|
|
91
87
|
|
|
92
88
|
await user.keyboard( '[ArrowDown]' );
|
|
93
89
|
|
|
94
|
-
// Wait for the `floating-ui` effects in `Dropdown`/`Popover` to finish running
|
|
95
|
-
// See also: https://floating-ui.com/docs/react-dom#testing
|
|
96
|
-
await act( () => Promise.resolve() );
|
|
97
|
-
|
|
98
90
|
const menu = screen.getByRole( 'menu' );
|
|
99
91
|
|
|
100
92
|
// we need to wait because showing the dropdown is animated
|
|
@@ -19,7 +19,7 @@ const VIDEO_EXTENSIONS = [
|
|
|
19
19
|
/**
|
|
20
20
|
* Gets the extension of a file name.
|
|
21
21
|
*
|
|
22
|
-
* @param
|
|
22
|
+
* @param filename The file name.
|
|
23
23
|
* @return The extension of the file name.
|
|
24
24
|
*/
|
|
25
25
|
export function getExtension( filename = '' ): string {
|
|
@@ -30,7 +30,7 @@ export function getExtension( filename = '' ): string {
|
|
|
30
30
|
/**
|
|
31
31
|
* Checks if a file is a video.
|
|
32
32
|
*
|
|
33
|
-
* @param
|
|
33
|
+
* @param filename The file name.
|
|
34
34
|
* @return Whether the file is a video.
|
|
35
35
|
*/
|
|
36
36
|
export function isVideoType( filename: string = '' ): boolean {
|
|
@@ -44,7 +44,7 @@ export function isVideoType( filename: string = '' ): boolean {
|
|
|
44
44
|
/**
|
|
45
45
|
* Transforms a fraction value to a percentage value.
|
|
46
46
|
*
|
|
47
|
-
* @param
|
|
47
|
+
* @param fraction The fraction value.
|
|
48
48
|
* @return A percentage value.
|
|
49
49
|
*/
|
|
50
50
|
export function fractionToPercentage( fraction: number ): number {
|
|
@@ -13,7 +13,7 @@ import { parseQuantityAndUnitFromRawValue } from '../unit-control';
|
|
|
13
13
|
* Some themes use css vars for their font sizes, so until we
|
|
14
14
|
* have the way of calculating them don't display them.
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
16
|
+
* @param value The value that is checked.
|
|
17
17
|
* @return Whether the value is a simple css value.
|
|
18
18
|
*/
|
|
19
19
|
export function isSimpleCssValue(
|
|
@@ -27,7 +27,7 @@ export function isSimpleCssValue(
|
|
|
27
27
|
* If all of the given font sizes have the same unit (e.g. 'px'), return that
|
|
28
28
|
* unit. Otherwise return null.
|
|
29
29
|
*
|
|
30
|
-
* @param
|
|
30
|
+
* @param fontSizes List of font sizes.
|
|
31
31
|
* @return The common unit, or null.
|
|
32
32
|
*/
|
|
33
33
|
export function getCommonSizeUnit( fontSizes: FontSize[] ) {
|
|
@@ -101,3 +101,11 @@ Start opting into the new margin-free styles that will become the default in a f
|
|
|
101
101
|
- Type: `Boolean`
|
|
102
102
|
- Required: No
|
|
103
103
|
- Default: `false`
|
|
104
|
+
|
|
105
|
+
### headingLevel
|
|
106
|
+
|
|
107
|
+
The heading level.
|
|
108
|
+
|
|
109
|
+
- Type: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'`
|
|
110
|
+
- Required: No
|
|
111
|
+
- Default: `2`
|
|
@@ -77,13 +77,16 @@ function MultipleOrigin( {
|
|
|
77
77
|
onChange,
|
|
78
78
|
value,
|
|
79
79
|
actions,
|
|
80
|
+
headingLevel,
|
|
80
81
|
} ) {
|
|
81
82
|
return (
|
|
82
83
|
<VStack spacing={ 3 } className={ className }>
|
|
83
84
|
{ gradients.map( ( { name, gradients: gradientSet }, index ) => {
|
|
84
85
|
return (
|
|
85
86
|
<VStack spacing={ 2 } key={ index }>
|
|
86
|
-
<ColorHeading
|
|
87
|
+
<ColorHeading level={ headingLevel }>
|
|
88
|
+
{ name }
|
|
89
|
+
</ColorHeading>
|
|
87
90
|
<SingleOrigin
|
|
88
91
|
clearGradient={ clearGradient }
|
|
89
92
|
gradients={ gradientSet }
|
|
@@ -112,6 +115,7 @@ export default function GradientPicker( {
|
|
|
112
115
|
clearable = true,
|
|
113
116
|
disableCustomGradients = false,
|
|
114
117
|
__experimentalIsRenderedInSidebar,
|
|
118
|
+
headingLevel = 2,
|
|
115
119
|
} ) {
|
|
116
120
|
const clearGradient = useCallback(
|
|
117
121
|
() => onChange( undefined ),
|
|
@@ -168,6 +172,7 @@ export default function GradientPicker( {
|
|
|
168
172
|
</CircularOptionPicker.ButtonAction>
|
|
169
173
|
)
|
|
170
174
|
}
|
|
175
|
+
headingLevel={ headingLevel }
|
|
171
176
|
/>
|
|
172
177
|
) }
|
|
173
178
|
</VStack>
|
|
@@ -23,7 +23,7 @@ import type { InputChangeCallback } from '../types';
|
|
|
23
23
|
/**
|
|
24
24
|
* Prepares initialState for the reducer.
|
|
25
25
|
*
|
|
26
|
-
* @param
|
|
26
|
+
* @param initialState The initial state.
|
|
27
27
|
* @return Prepared initialState for the reducer
|
|
28
28
|
*/
|
|
29
29
|
function mergeInitialState(
|
|
@@ -45,7 +45,7 @@ function mergeInitialState(
|
|
|
45
45
|
* exception for CONTROL actions is because they represent controlled updates
|
|
46
46
|
* from props and no case has yet presented for their specialization.
|
|
47
47
|
*
|
|
48
|
-
* @param
|
|
48
|
+
* @param composedStateReducers A reducer to specialize state changes.
|
|
49
49
|
* @return The reducer.
|
|
50
50
|
*/
|
|
51
51
|
function inputControlStateReducer(
|
|
@@ -140,9 +140,9 @@ function inputControlStateReducer(
|
|
|
140
140
|
* This technique uses the "stateReducer" design pattern:
|
|
141
141
|
* https://kentcdodds.com/blog/the-state-reducer-pattern/
|
|
142
142
|
*
|
|
143
|
-
* @param
|
|
144
|
-
* @param
|
|
145
|
-
* @param
|
|
143
|
+
* @param stateReducer An external state reducer.
|
|
144
|
+
* @param initialState The initial state for the reducer.
|
|
145
|
+
* @param onChangeHandler A handler for the onChange event.
|
|
146
146
|
* @return State, dispatch, and a collection of actions.
|
|
147
147
|
*/
|
|
148
148
|
export function useInputControlStateReducer(
|
|
@@ -21,7 +21,7 @@ import type { InputChangeCallback } from './types';
|
|
|
21
21
|
/**
|
|
22
22
|
* Gets a CSS cursor value based on a drag direction.
|
|
23
23
|
*
|
|
24
|
-
* @param
|
|
24
|
+
* @param dragDirection The drag direction.
|
|
25
25
|
* @return The CSS cursor value.
|
|
26
26
|
*/
|
|
27
27
|
export function getDragCursor( dragDirection: string ): string {
|