@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
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
4
5
|
import classnames from 'classnames';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
8
9
|
*/
|
|
9
10
|
import deprecated from '@wordpress/deprecated';
|
|
11
|
+
import { forwardRef } from '@wordpress/element';
|
|
10
12
|
import { __ } from '@wordpress/i18n';
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -21,14 +23,22 @@ import { Text } from '../text';
|
|
|
21
23
|
import { Spacer } from '../spacer';
|
|
22
24
|
import { COLORS } from '../utils/colors-values';
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
27
|
+
import type { AnglePickerControlProps } from './types';
|
|
28
|
+
|
|
29
|
+
function UnforwardedAnglePickerControl(
|
|
30
|
+
props: WordPressComponentProps< AnglePickerControlProps, 'div' >,
|
|
31
|
+
ref: ForwardedRef< any >
|
|
32
|
+
) {
|
|
33
|
+
const {
|
|
34
|
+
__nextHasNoMarginBottom = false,
|
|
35
|
+
className,
|
|
36
|
+
label = __( 'Angle' ),
|
|
37
|
+
onChange,
|
|
38
|
+
value,
|
|
39
|
+
...restProps
|
|
40
|
+
} = props;
|
|
41
|
+
|
|
32
42
|
if ( ! __nextHasNoMarginBottom ) {
|
|
33
43
|
deprecated(
|
|
34
44
|
'Bottom margin styles for wp.components.AnglePickerControl',
|
|
@@ -40,9 +50,15 @@ export default function AnglePickerControl( {
|
|
|
40
50
|
);
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
const handleOnNumberChange = ( unprocessedValue ) => {
|
|
53
|
+
const handleOnNumberChange = ( unprocessedValue: string | undefined ) => {
|
|
54
|
+
if ( onChange === undefined ) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
44
58
|
const inputValue =
|
|
45
|
-
unprocessedValue !==
|
|
59
|
+
unprocessedValue !== undefined && unprocessedValue !== ''
|
|
60
|
+
? parseInt( unprocessedValue, 10 )
|
|
61
|
+
: 0;
|
|
46
62
|
onChange( inputValue );
|
|
47
63
|
};
|
|
48
64
|
|
|
@@ -50,6 +66,8 @@ export default function AnglePickerControl( {
|
|
|
50
66
|
|
|
51
67
|
return (
|
|
52
68
|
<Root
|
|
69
|
+
{ ...restProps }
|
|
70
|
+
ref={ ref }
|
|
53
71
|
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
54
72
|
className={ classes }
|
|
55
73
|
gap={ 4 }
|
|
@@ -94,3 +112,29 @@ export default function AnglePickerControl( {
|
|
|
94
112
|
</Root>
|
|
95
113
|
);
|
|
96
114
|
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* `AnglePickerControl` is a React component to render a UI that allows users to
|
|
118
|
+
* pick an angle. Users can choose an angle in a visual UI with the mouse by
|
|
119
|
+
* dragging an angle indicator inside a circle or by directly inserting the
|
|
120
|
+
* desired angle in a text field.
|
|
121
|
+
*
|
|
122
|
+
* ```jsx
|
|
123
|
+
* import { useState } from '@wordpress/element';
|
|
124
|
+
* import { AnglePickerControl } from '@wordpress/components';
|
|
125
|
+
*
|
|
126
|
+
* function Example() {
|
|
127
|
+
* const [ angle, setAngle ] = useState( 0 );
|
|
128
|
+
* return (
|
|
129
|
+
* <AnglePickerControl
|
|
130
|
+
* value={ angle }
|
|
131
|
+
* onChange={ setAngle }
|
|
132
|
+
* __nextHasNoMarginBottom
|
|
133
|
+
* </>
|
|
134
|
+
* );
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
export const AnglePickerControl = forwardRef( UnforwardedAnglePickerControl );
|
|
139
|
+
|
|
140
|
+
export default AnglePickerControl;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { AnglePickerControl } from '..';
|
|
15
|
+
|
|
16
|
+
const meta: ComponentMeta< typeof AnglePickerControl > = {
|
|
17
|
+
title: 'Components/AnglePickerControl',
|
|
18
|
+
component: AnglePickerControl,
|
|
19
|
+
argTypes: {
|
|
20
|
+
as: { control: { type: null } },
|
|
21
|
+
value: { control: { type: null } },
|
|
22
|
+
},
|
|
23
|
+
parameters: {
|
|
24
|
+
actions: { argTypesRegex: '^on.*' },
|
|
25
|
+
controls: {
|
|
26
|
+
expanded: true,
|
|
27
|
+
},
|
|
28
|
+
docs: { source: { state: 'open' } },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default meta;
|
|
33
|
+
|
|
34
|
+
const AnglePickerWithState: ComponentStory< typeof AnglePickerControl > = ( {
|
|
35
|
+
onChange,
|
|
36
|
+
...args
|
|
37
|
+
} ) => {
|
|
38
|
+
const [ angle, setAngle ] = useState< number >( 0 );
|
|
39
|
+
|
|
40
|
+
const handleChange = ( newValue: number ) => {
|
|
41
|
+
setAngle( newValue );
|
|
42
|
+
onChange( newValue );
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<AnglePickerControl
|
|
47
|
+
{ ...args }
|
|
48
|
+
value={ angle }
|
|
49
|
+
onChange={ handleChange }
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const Default = AnglePickerWithState.bind( {} );
|
|
55
|
+
Default.args = {
|
|
56
|
+
__nextHasNoMarginBottom: true,
|
|
57
|
+
};
|
|
@@ -12,10 +12,14 @@ import { COLORS } from '../../utils';
|
|
|
12
12
|
import { space } from '../../ui/utils/space';
|
|
13
13
|
import CONFIG from '../../utils/config-values';
|
|
14
14
|
|
|
15
|
+
import type { AnglePickerControlProps } from '../types';
|
|
16
|
+
|
|
15
17
|
const CIRCLE_SIZE = 32;
|
|
16
18
|
const INNER_CIRCLE_SIZE = 3;
|
|
17
19
|
|
|
18
|
-
const deprecatedBottomMargin = ( {
|
|
20
|
+
const deprecatedBottomMargin = ( {
|
|
21
|
+
__nextHasNoMarginBottom,
|
|
22
|
+
}: Pick< AnglePickerControlProps, '__nextHasNoMarginBottom' > ) => {
|
|
19
23
|
return ! __nextHasNoMarginBottom
|
|
20
24
|
? css`
|
|
21
25
|
margin-bottom: ${ space( 2 ) };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type AnglePickerControlProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Start opting into the new margin-free styles that will become the default
|
|
4
|
+
* in a future version.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
__nextHasNoMarginBottom?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Label to use for the angle picker.
|
|
11
|
+
*
|
|
12
|
+
* @default __( 'Angle' )
|
|
13
|
+
*/
|
|
14
|
+
label?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A function that receives the new value of the input.
|
|
17
|
+
*/
|
|
18
|
+
onChange: ( value: number ) => void;
|
|
19
|
+
/**
|
|
20
|
+
* The current value of the input. The value represents an angle in degrees
|
|
21
|
+
* and should be a value between 0 and 360.
|
|
22
|
+
*/
|
|
23
|
+
value: number | string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type AngleCircleProps = Pick<
|
|
27
|
+
AnglePickerControlProps,
|
|
28
|
+
'value' | 'onChange'
|
|
29
|
+
>;
|
|
@@ -14,7 +14,7 @@ import type { BaseControlProps } from './types';
|
|
|
14
14
|
*
|
|
15
15
|
* Namely, it takes care of generating a unique `id`, properly associating it with the `label` and `help` elements.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
17
|
+
* @param props
|
|
18
18
|
*/
|
|
19
19
|
export function useBaseControlProps(
|
|
20
20
|
props: Omit< BaseControlProps, 'children' >
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
|
-
import { act } from 'react-test-renderer';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
|
-
import { BorderBoxControl } from '
|
|
12
|
-
|
|
13
|
-
jest.useFakeTimers();
|
|
10
|
+
import { BorderBoxControl } from '..';
|
|
14
11
|
|
|
15
12
|
const colors = [
|
|
16
13
|
{ name: 'Gray', color: '#f6f7f7' },
|
|
@@ -98,7 +95,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
98
95
|
|
|
99
96
|
const widthInput = screen.getByRole( 'spinbutton', {
|
|
100
97
|
name: 'Border width',
|
|
101
|
-
} );
|
|
98
|
+
} ) as HTMLInputElement;
|
|
102
99
|
|
|
103
100
|
expect( widthInput.value ).toBe( '1' );
|
|
104
101
|
} );
|
|
@@ -110,23 +107,37 @@ describe( 'BorderBoxControl', () => {
|
|
|
110
107
|
|
|
111
108
|
const widthInput = screen.getByRole( 'spinbutton', {
|
|
112
109
|
name: 'Border width',
|
|
113
|
-
} );
|
|
110
|
+
} ) as HTMLInputElement;
|
|
114
111
|
|
|
115
112
|
expect( widthInput.value ).toBe( '1' );
|
|
116
113
|
} );
|
|
117
114
|
|
|
118
115
|
it( 'should render placeholder and omit unit select when border values are mixed', async () => {
|
|
119
|
-
const user = userEvent.setup(
|
|
120
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
121
|
-
} );
|
|
116
|
+
const user = userEvent.setup();
|
|
122
117
|
|
|
123
118
|
render( <BorderBoxControl { ...props } value={ mixedBorders } /> );
|
|
124
119
|
|
|
120
|
+
// There are 4 inputs when in unlinked mode (top/right/bottom/left)
|
|
121
|
+
expect(
|
|
122
|
+
screen.getAllByRole( 'spinbutton', {
|
|
123
|
+
name: 'Border width',
|
|
124
|
+
} )
|
|
125
|
+
).toHaveLength( 4 );
|
|
126
|
+
|
|
125
127
|
// First render of control with mixed values should show split view.
|
|
126
128
|
await user.click(
|
|
127
129
|
screen.getByRole( 'button', { name: 'Link sides' } )
|
|
128
130
|
);
|
|
129
131
|
|
|
132
|
+
// In linked mode, there is only one input
|
|
133
|
+
await waitFor( () =>
|
|
134
|
+
expect(
|
|
135
|
+
screen.getByRole( 'spinbutton', {
|
|
136
|
+
name: 'Border width',
|
|
137
|
+
} )
|
|
138
|
+
).toBeVisible()
|
|
139
|
+
);
|
|
140
|
+
|
|
130
141
|
const widthInput = screen.getByRole( 'spinbutton', {
|
|
131
142
|
name: 'Border width',
|
|
132
143
|
} );
|
|
@@ -139,9 +150,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
139
150
|
} );
|
|
140
151
|
|
|
141
152
|
it( 'should render shared border width and unit select when switching to linked view', async () => {
|
|
142
|
-
const user = userEvent.setup(
|
|
143
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
144
|
-
} );
|
|
153
|
+
const user = userEvent.setup();
|
|
145
154
|
|
|
146
155
|
// Render control with mixed border values but consistent widths.
|
|
147
156
|
render(
|
|
@@ -171,7 +180,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
171
180
|
|
|
172
181
|
const linkedInput = screen.getByRole( 'spinbutton', {
|
|
173
182
|
name: 'Border width',
|
|
174
|
-
} );
|
|
183
|
+
} ) as HTMLInputElement;
|
|
175
184
|
const unitSelect = screen.getByRole( 'combobox', {
|
|
176
185
|
name: 'Select unit',
|
|
177
186
|
} );
|
|
@@ -181,31 +190,30 @@ describe( 'BorderBoxControl', () => {
|
|
|
181
190
|
} );
|
|
182
191
|
|
|
183
192
|
it( 'should omit style options when requested', async () => {
|
|
184
|
-
const user = userEvent.setup(
|
|
185
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
186
|
-
} );
|
|
193
|
+
const user = userEvent.setup();
|
|
187
194
|
|
|
188
195
|
render( <BorderBoxControl { ...props } enableStyle={ false } /> );
|
|
189
196
|
|
|
190
197
|
const colorButton = screen.getByLabelText( colorPickerRegex );
|
|
191
198
|
await user.click( colorButton );
|
|
192
|
-
await act( () => Promise.resolve() );
|
|
193
199
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
name: 'Dotted',
|
|
203
|
-
} );
|
|
200
|
+
// Wait for the custom color picker in the dropdown to appear
|
|
201
|
+
await waitFor( () =>
|
|
202
|
+
expect(
|
|
203
|
+
screen.getByRole( 'button', {
|
|
204
|
+
name: 'Custom color picker.',
|
|
205
|
+
} )
|
|
206
|
+
).toBeVisible()
|
|
207
|
+
);
|
|
204
208
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
expect(
|
|
208
|
-
expect(
|
|
209
|
+
// Make sure that none of the border style buttons (and the section
|
|
210
|
+
// title) are rendered to screen.
|
|
211
|
+
expect( screen.queryByText( 'Style' ) ).not.toBeInTheDocument();
|
|
212
|
+
expect(
|
|
213
|
+
screen.queryByRole( 'button', {
|
|
214
|
+
name: /(Solid)|(Dashed)|(Dotted)/,
|
|
215
|
+
} )
|
|
216
|
+
).not.toBeInTheDocument();
|
|
209
217
|
} );
|
|
210
218
|
} );
|
|
211
219
|
|
|
@@ -237,7 +245,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
237
245
|
|
|
238
246
|
const widthInputs = screen.getAllByRole( 'spinbutton', {
|
|
239
247
|
name: 'Border width',
|
|
240
|
-
} );
|
|
248
|
+
} ) as HTMLInputElement[];
|
|
241
249
|
|
|
242
250
|
expect( widthInputs[ 0 ].value ).toBe( '1' ); // Top.
|
|
243
251
|
expect( widthInputs[ 1 ].value ).toBe( '0.75' ); // Left.
|
|
@@ -246,9 +254,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
246
254
|
} );
|
|
247
255
|
|
|
248
256
|
it( 'should render split view correctly when starting with flat border', async () => {
|
|
249
|
-
const user = userEvent.setup(
|
|
250
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
251
|
-
} );
|
|
257
|
+
const user = userEvent.setup();
|
|
252
258
|
|
|
253
259
|
render(
|
|
254
260
|
<BorderBoxControl { ...props } value={ defaultBorders } />
|
|
@@ -260,60 +266,44 @@ describe( 'BorderBoxControl', () => {
|
|
|
260
266
|
|
|
261
267
|
const widthInputs = screen.getAllByRole( 'spinbutton', {
|
|
262
268
|
name: 'Border width',
|
|
263
|
-
} );
|
|
269
|
+
} ) as HTMLInputElement[];
|
|
264
270
|
expect( widthInputs[ 0 ].value ).toBe( '1' ); // Top.
|
|
265
271
|
expect( widthInputs[ 1 ].value ).toBe( '1' ); // Left.
|
|
266
272
|
expect( widthInputs[ 2 ].value ).toBe( '1' ); // Right.
|
|
267
273
|
expect( widthInputs[ 3 ].value ).toBe( '1' ); // Bottom.
|
|
268
274
|
} );
|
|
269
275
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
273
|
-
} );
|
|
276
|
+
// We're expecting to have 4 color buttons by default.
|
|
277
|
+
const colorButtonIndexes = [ ...Array( 4 ).keys() ];
|
|
274
278
|
|
|
275
|
-
|
|
279
|
+
it.each( colorButtonIndexes )(
|
|
280
|
+
'should omit style options when color button %s is pressed',
|
|
281
|
+
async ( colorButtonIndex ) => {
|
|
282
|
+
const user = userEvent.setup();
|
|
276
283
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const colorButtons = screen.getAllByLabelText( colorPickerRegex );
|
|
282
|
-
|
|
283
|
-
function assertStyleOptionsMissing() {
|
|
284
|
-
const styleLabel = screen.queryByText( 'Style' );
|
|
285
|
-
const solidButton = screen.queryByRole( 'button', {
|
|
286
|
-
name: 'Solid',
|
|
287
|
-
} );
|
|
288
|
-
const dashedButton = screen.queryByRole( 'button', {
|
|
289
|
-
name: 'Dashed',
|
|
290
|
-
} );
|
|
291
|
-
const dottedButton = screen.queryByRole( 'button', {
|
|
292
|
-
name: 'Dotted',
|
|
293
|
-
} );
|
|
294
|
-
|
|
295
|
-
expect( styleLabel ).not.toBeInTheDocument();
|
|
296
|
-
expect( solidButton ).not.toBeInTheDocument();
|
|
297
|
-
expect( dashedButton ).not.toBeInTheDocument();
|
|
298
|
-
expect( dottedButton ).not.toBeInTheDocument();
|
|
299
|
-
}
|
|
284
|
+
render(
|
|
285
|
+
<BorderBoxControl { ...props } enableStyle={ false } />
|
|
286
|
+
);
|
|
300
287
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
288
|
+
await user.click(
|
|
289
|
+
screen.getByRole( 'button', { name: 'Unlink sides' } )
|
|
290
|
+
);
|
|
304
291
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
await user.click( colorButtons[ 1 ] );
|
|
292
|
+
const colorButtons =
|
|
293
|
+
screen.getAllByLabelText( colorPickerRegex );
|
|
308
294
|
|
|
309
|
-
|
|
310
|
-
assertStyleOptionsMissing();
|
|
311
|
-
await user.click( colorButtons[ 2 ] );
|
|
295
|
+
await user.click( colorButtons[ colorButtonIndex ] );
|
|
312
296
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
297
|
+
// Make sure that none of the border style buttons (and the section
|
|
298
|
+
// title) are rendered to screen.
|
|
299
|
+
expect( screen.queryByText( 'Style' ) ).not.toBeInTheDocument();
|
|
300
|
+
expect(
|
|
301
|
+
screen.queryByRole( 'button', {
|
|
302
|
+
name: /(Solid)|(Dashed)|(Dotted)/,
|
|
303
|
+
} )
|
|
304
|
+
).not.toBeInTheDocument();
|
|
305
|
+
}
|
|
306
|
+
);
|
|
317
307
|
} );
|
|
318
308
|
|
|
319
309
|
describe( 'onChange handling', () => {
|
|
@@ -324,9 +314,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
324
314
|
|
|
325
315
|
describe( 'Linked value change handling', () => {
|
|
326
316
|
it( 'should set undefined when new border is empty', async () => {
|
|
327
|
-
const user = userEvent.setup(
|
|
328
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
329
|
-
} );
|
|
317
|
+
const user = userEvent.setup();
|
|
330
318
|
|
|
331
319
|
render(
|
|
332
320
|
<BorderBoxControl { ...props } value={ { width: '1px' } } />
|
|
@@ -340,9 +328,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
340
328
|
} );
|
|
341
329
|
|
|
342
330
|
it( 'should update with complete flat border', async () => {
|
|
343
|
-
const user = userEvent.setup(
|
|
344
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
345
|
-
} );
|
|
331
|
+
const user = userEvent.setup();
|
|
346
332
|
|
|
347
333
|
render(
|
|
348
334
|
<BorderBoxControl { ...props } value={ defaultBorder } />
|
|
@@ -361,9 +347,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
361
347
|
} );
|
|
362
348
|
|
|
363
349
|
it( 'should maintain mixed values if not explicitly set via linked control', async () => {
|
|
364
|
-
const user = userEvent.setup(
|
|
365
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
366
|
-
} );
|
|
350
|
+
const user = userEvent.setup();
|
|
367
351
|
|
|
368
352
|
render(
|
|
369
353
|
<BorderBoxControl
|
|
@@ -396,9 +380,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
396
380
|
} );
|
|
397
381
|
|
|
398
382
|
it( 'should update with consistent split borders', async () => {
|
|
399
|
-
const user = userEvent.setup(
|
|
400
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
401
|
-
} );
|
|
383
|
+
const user = userEvent.setup();
|
|
402
384
|
|
|
403
385
|
render(
|
|
404
386
|
<BorderBoxControl { ...props } value={ defaultBorders } />
|
|
@@ -417,9 +399,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
417
399
|
} );
|
|
418
400
|
|
|
419
401
|
it( 'should set undefined borders when change results in empty borders', async () => {
|
|
420
|
-
const user = userEvent.setup(
|
|
421
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
422
|
-
} );
|
|
402
|
+
const user = userEvent.setup();
|
|
423
403
|
|
|
424
404
|
render(
|
|
425
405
|
<BorderBoxControl
|
|
@@ -441,9 +421,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
441
421
|
} );
|
|
442
422
|
|
|
443
423
|
it( 'should set flat border when change results in consistent split borders', async () => {
|
|
444
|
-
const user = userEvent.setup(
|
|
445
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
446
|
-
} );
|
|
424
|
+
const user = userEvent.setup();
|
|
447
425
|
|
|
448
426
|
render(
|
|
449
427
|
<BorderBoxControl
|
|
@@ -476,9 +454,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
476
454
|
|
|
477
455
|
describe( 'Split value change handling', () => {
|
|
478
456
|
it( 'should set split borders when the updated borders are mixed', async () => {
|
|
479
|
-
const user = userEvent.setup(
|
|
480
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
481
|
-
} );
|
|
457
|
+
const user = userEvent.setup();
|
|
482
458
|
|
|
483
459
|
const borders = {
|
|
484
460
|
top: { ...defaultBorder, width: '1px' },
|
|
@@ -502,9 +478,7 @@ describe( 'BorderBoxControl', () => {
|
|
|
502
478
|
} );
|
|
503
479
|
|
|
504
480
|
it( 'should set flat border when updated borders are consistent', async () => {
|
|
505
|
-
const user = userEvent.setup(
|
|
506
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
507
|
-
} );
|
|
481
|
+
const user = userEvent.setup();
|
|
508
482
|
|
|
509
483
|
const borders = {
|
|
510
484
|
top: { ...defaultBorder, width: '4px' },
|
|
@@ -47,11 +47,15 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
47
47
|
describe( 'isEmptyBorder', () => {
|
|
48
48
|
it( 'should determine a undefined, null, and {} to be empty', () => {
|
|
49
49
|
expect( isEmptyBorder( undefined ) ).toBe( true );
|
|
50
|
+
// Checking for extra resilience, even if not a valid type.
|
|
51
|
+
// @ts-expect-error
|
|
50
52
|
expect( isEmptyBorder( null ) ).toBe( true );
|
|
51
53
|
expect( isEmptyBorder( {} ) ).toBe( true );
|
|
52
54
|
} );
|
|
53
55
|
|
|
54
56
|
it( 'should determine object missing all border props to be empty', () => {
|
|
57
|
+
// Checking for extra resilience, even if not a valid type.
|
|
58
|
+
// @ts-expect-error
|
|
55
59
|
expect( isEmptyBorder( nonBorder ) ).toBe( true );
|
|
56
60
|
} );
|
|
57
61
|
|
|
@@ -110,11 +114,15 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
110
114
|
describe( 'isCompleteBorder', () => {
|
|
111
115
|
it( 'should determine a undefined, null, and {} to be incomplete', () => {
|
|
112
116
|
expect( isCompleteBorder( undefined ) ).toBe( false );
|
|
117
|
+
// Checking for extra resilience, even if not a valid type.
|
|
118
|
+
// @ts-expect-error
|
|
113
119
|
expect( isCompleteBorder( null ) ).toBe( false );
|
|
114
120
|
expect( isCompleteBorder( {} ) ).toBe( false );
|
|
115
121
|
} );
|
|
116
122
|
|
|
117
123
|
it( 'should determine objects missing border props to be incomplete', () => {
|
|
124
|
+
// Checking for extra resilience, even if not a valid type.
|
|
125
|
+
// @ts-expect-error
|
|
118
126
|
expect( isCompleteBorder( nonBorder ) ).toBe( false );
|
|
119
127
|
expect( isCompleteBorder( partialBorder ) ).toBe( false );
|
|
120
128
|
expect( isCompleteBorder( partialWithExtraProp ) ).toBe( false );
|
|
@@ -149,6 +157,8 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
149
157
|
it( 'should determine undefined, non-border or empty object as not being mixed', () => {
|
|
150
158
|
expect( hasMixedBorders( undefined ) ).toBe( false );
|
|
151
159
|
expect( hasMixedBorders( {} ) ).toBe( false );
|
|
160
|
+
// Checking for extra resilience, even if not a valid type.
|
|
161
|
+
// @ts-expect-error
|
|
152
162
|
expect( hasMixedBorders( nonBorder ) ).toBe( false );
|
|
153
163
|
} );
|
|
154
164
|
|
|
@@ -168,11 +178,15 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
168
178
|
describe( 'getSplitBorders', () => {
|
|
169
179
|
it( 'should return undefined when no border provided', () => {
|
|
170
180
|
expect( getSplitBorders( undefined ) ).toEqual( undefined );
|
|
181
|
+
// Checking for extra resilience, even if not a valid type.
|
|
182
|
+
// @ts-expect-error
|
|
171
183
|
expect( getSplitBorders( null ) ).toEqual( undefined );
|
|
172
184
|
} );
|
|
173
185
|
|
|
174
186
|
it( 'should return undefined when supplied border is empty', () => {
|
|
175
187
|
expect( getSplitBorders( {} ) ).toEqual( undefined );
|
|
188
|
+
// Checking for extra resilience, even if not a valid type.
|
|
189
|
+
// @ts-expect-error
|
|
176
190
|
expect( getSplitBorders( nonBorder ) ).toEqual( undefined );
|
|
177
191
|
} );
|
|
178
192
|
|
|
@@ -193,6 +207,8 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
193
207
|
} );
|
|
194
208
|
|
|
195
209
|
it( 'should only return differences for border related properties', () => {
|
|
210
|
+
// Checking for extra resilience, even if not a valid type.
|
|
211
|
+
// @ts-expect-error
|
|
196
212
|
const diff = getBorderDiff( nonBorder, { caffeine: 'coffee' } );
|
|
197
213
|
expect( diff ).toEqual( {} );
|
|
198
214
|
} );
|
|
@@ -201,6 +217,8 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
201
217
|
const diff = getBorderDiff( completeBorder, {
|
|
202
218
|
...completeBorder,
|
|
203
219
|
color: '#21759b',
|
|
220
|
+
// Checking for extra resilience, even if not a valid type.
|
|
221
|
+
// @ts-expect-error
|
|
204
222
|
caffeine: 'cola',
|
|
205
223
|
} );
|
|
206
224
|
expect( diff ).toEqual( { color: '#21759b' } );
|
|
@@ -298,6 +316,8 @@ describe( 'BorderBoxControl Utils', () => {
|
|
|
298
316
|
it( 'should return undefined when no border provided', () => {
|
|
299
317
|
expect( getShorthandBorderStyle( undefined ) ).toEqual( undefined );
|
|
300
318
|
expect( getShorthandBorderStyle( {} ) ).toEqual( undefined );
|
|
319
|
+
// Checking for extra resilience, even if not a valid type.
|
|
320
|
+
// @ts-expect-error
|
|
301
321
|
expect( getShorthandBorderStyle( nonBorder ) ).toEqual( undefined );
|
|
302
322
|
} );
|
|
303
323
|
|
|
@@ -171,7 +171,7 @@ export const getMostCommonUnit = (
|
|
|
171
171
|
* Finds the mode value out of the array passed favouring the first value
|
|
172
172
|
* as a tiebreaker.
|
|
173
173
|
*
|
|
174
|
-
* @param
|
|
174
|
+
* @param values Values to determine the mode from.
|
|
175
175
|
*
|
|
176
176
|
* @return The mode value.
|
|
177
177
|
*/
|