@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
|
@@ -13,7 +13,7 @@ import { Grid } from '../../grid';
|
|
|
13
13
|
import { contextConnect, WordPressComponentProps } from '../../ui/context';
|
|
14
14
|
import type { ToolsPanelProps } from '../types';
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const UnconnectedToolsPanel = (
|
|
17
17
|
props: WordPressComponentProps< ToolsPanelProps, 'div' >,
|
|
18
18
|
forwardedRef: ForwardedRef< any >
|
|
19
19
|
) => {
|
|
@@ -23,6 +23,7 @@ const ToolsPanel = (
|
|
|
23
23
|
panelContext,
|
|
24
24
|
resetAllItems,
|
|
25
25
|
toggleItem,
|
|
26
|
+
headingLevel,
|
|
26
27
|
...toolsPanelProps
|
|
27
28
|
} = useToolsPanel( props );
|
|
28
29
|
|
|
@@ -33,6 +34,7 @@ const ToolsPanel = (
|
|
|
33
34
|
label={ label }
|
|
34
35
|
resetAll={ resetAllItems }
|
|
35
36
|
toggleItem={ toggleItem }
|
|
37
|
+
headingLevel={ headingLevel }
|
|
36
38
|
/>
|
|
37
39
|
{ children }
|
|
38
40
|
</ToolsPanelContext.Provider>
|
|
@@ -40,6 +42,58 @@ const ToolsPanel = (
|
|
|
40
42
|
);
|
|
41
43
|
};
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The `ToolsPanel` is a container component that displays its children preceded
|
|
47
|
+
* by a header. The header includes a dropdown menu which is automatically
|
|
48
|
+
* generated from the panel's inner `ToolsPanelItems`.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```jsx
|
|
52
|
+
* import { __ } from '@wordpress/i18n';
|
|
53
|
+
* import {
|
|
54
|
+
* __experimentalToolsPanel as ToolsPanel,
|
|
55
|
+
* __experimentalToolsPanelItem as ToolsPanelItem,
|
|
56
|
+
* __experimentalUnitControl as UnitControl
|
|
57
|
+
* } from '@wordpress/components';
|
|
58
|
+
*
|
|
59
|
+
* function Example() {
|
|
60
|
+
* const [ height, setHeight ] = useState();
|
|
61
|
+
* const [ width, setWidth ] = useState();
|
|
62
|
+
*
|
|
63
|
+
* const resetAll = () => {
|
|
64
|
+
* setHeight();
|
|
65
|
+
* setWidth();
|
|
66
|
+
* }
|
|
67
|
+
*
|
|
68
|
+
* return (
|
|
69
|
+
* <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>
|
|
70
|
+
* <ToolsPanelItem
|
|
71
|
+
* hasValue={ () => !! height }
|
|
72
|
+
* label={ __( 'Height' ) }
|
|
73
|
+
* onDeselect={ () => setHeight() }
|
|
74
|
+
* >
|
|
75
|
+
* <UnitControl
|
|
76
|
+
* label={ __( 'Height' ) }
|
|
77
|
+
* onChange={ setHeight }
|
|
78
|
+
* value={ height }
|
|
79
|
+
* />
|
|
80
|
+
* </ToolsPanelItem>
|
|
81
|
+
* <ToolsPanelItem
|
|
82
|
+
* hasValue={ () => !! width }
|
|
83
|
+
* label={ __( 'Width' ) }
|
|
84
|
+
* onDeselect={ () => setWidth() }
|
|
85
|
+
* >
|
|
86
|
+
* <UnitControl
|
|
87
|
+
* label={ __( 'Width' ) }
|
|
88
|
+
* onChange={ setWidth }
|
|
89
|
+
* value={ width }
|
|
90
|
+
* />
|
|
91
|
+
* </ToolsPanelItem>
|
|
92
|
+
* </ToolsPanel>
|
|
93
|
+
* );
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export const ToolsPanel = contextConnect( UnconnectedToolsPanel, 'ToolsPanel' );
|
|
44
98
|
|
|
45
|
-
export default
|
|
99
|
+
export default ToolsPanel;
|
|
@@ -56,10 +56,11 @@ export function useToolsPanel(
|
|
|
56
56
|
) {
|
|
57
57
|
const {
|
|
58
58
|
className,
|
|
59
|
+
headingLevel = 2,
|
|
59
60
|
resetAll,
|
|
60
61
|
panelId,
|
|
61
|
-
hasInnerWrapper,
|
|
62
|
-
shouldRenderPlaceholderItems,
|
|
62
|
+
hasInnerWrapper = false,
|
|
63
|
+
shouldRenderPlaceholderItems = false,
|
|
63
64
|
__experimentalFirstVisibleItemClass,
|
|
64
65
|
__experimentalLastVisibleItemClass,
|
|
65
66
|
...otherProps
|
|
@@ -306,6 +307,7 @@ export function useToolsPanel(
|
|
|
306
307
|
|
|
307
308
|
return {
|
|
308
309
|
...otherProps,
|
|
310
|
+
headingLevel,
|
|
309
311
|
panelContext,
|
|
310
312
|
resetAllItems,
|
|
311
313
|
toggleItem,
|
|
@@ -18,6 +18,13 @@ This component is generated automatically by its parent
|
|
|
18
18
|
|
|
19
19
|
## Props
|
|
20
20
|
|
|
21
|
+
### `headingLevel`: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'`
|
|
22
|
+
|
|
23
|
+
The heading level of the panel's header.
|
|
24
|
+
|
|
25
|
+
- Required: No
|
|
26
|
+
- Default: `2`
|
|
27
|
+
|
|
21
28
|
### `label`: `string`
|
|
22
29
|
|
|
23
30
|
Text to be displayed within the panel header. It is also passed along as the
|
|
@@ -156,6 +156,7 @@ const ToolsPanelHeader = (
|
|
|
156
156
|
dropdownMenuClassName,
|
|
157
157
|
hasMenuItems,
|
|
158
158
|
headingClassName,
|
|
159
|
+
headingLevel = 2,
|
|
159
160
|
label: labelText,
|
|
160
161
|
menuItems,
|
|
161
162
|
resetAll,
|
|
@@ -185,7 +186,7 @@ const ToolsPanelHeader = (
|
|
|
185
186
|
|
|
186
187
|
return (
|
|
187
188
|
<HStack { ...headerProps } ref={ forwardedRef }>
|
|
188
|
-
<Heading level={
|
|
189
|
+
<Heading level={ headingLevel } className={ headingClassName }>
|
|
189
190
|
{ labelText }
|
|
190
191
|
</Heading>
|
|
191
192
|
{ hasMenuItems && (
|
|
@@ -15,10 +15,11 @@ import type { ToolsPanelHeaderProps } from '../types';
|
|
|
15
15
|
export function useToolsPanelHeader(
|
|
16
16
|
props: WordPressComponentProps< ToolsPanelHeaderProps, 'h2' >
|
|
17
17
|
) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const {
|
|
19
|
+
className,
|
|
20
|
+
headingLevel = 2,
|
|
21
|
+
...otherProps
|
|
22
|
+
} = useContextSystem( props, 'ToolsPanelHeader' );
|
|
22
23
|
|
|
23
24
|
const cx = useCx();
|
|
24
25
|
const classes = useMemo( () => {
|
|
@@ -47,6 +48,7 @@ export function useToolsPanelHeader(
|
|
|
47
48
|
dropdownMenuClassName,
|
|
48
49
|
hasMenuItems,
|
|
49
50
|
headingClassName,
|
|
51
|
+
headingLevel,
|
|
50
52
|
menuItems,
|
|
51
53
|
className: classes,
|
|
52
54
|
};
|
|
@@ -31,7 +31,8 @@ This prop identifies the current item as being displayed by default. This means
|
|
|
31
31
|
it will show regardless of whether it has a value set or is toggled on in the
|
|
32
32
|
panel's menu.
|
|
33
33
|
|
|
34
|
-
- Required:
|
|
34
|
+
- Required: No
|
|
35
|
+
- Default: `false`
|
|
35
36
|
|
|
36
37
|
### `label`: `string`
|
|
37
38
|
|
|
@@ -58,18 +59,19 @@ A callback to take action when this item is selected in the `ToolsPanel` menu.
|
|
|
58
59
|
|
|
59
60
|
- Required: No
|
|
60
61
|
|
|
61
|
-
### `panelId`: `string`
|
|
62
|
+
### `panelId`: `string | null`
|
|
62
63
|
|
|
63
64
|
Panel items will ensure they are only registering with their intended panel by
|
|
64
|
-
comparing the `panelId` props set on both the item and the panel itself
|
|
65
|
+
comparing the `panelId` props set on both the item and the panel itself, or if the `panelId` is explicitly `null`. This
|
|
65
66
|
allows items to be injected from a shared source.
|
|
66
67
|
|
|
67
68
|
- Required: No
|
|
68
69
|
|
|
69
|
-
### `resetAllFilter`: `() =>
|
|
70
|
+
### `resetAllFilter`: `( attributes?: any ) => any`
|
|
70
71
|
|
|
71
72
|
A `ToolsPanel` will collect each item's `resetAllFilter` and pass an array of
|
|
72
73
|
these functions through to the panel's `resetAll` callback. They can then be
|
|
73
74
|
iterated over to perform additional tasks.
|
|
74
75
|
|
|
75
76
|
- Required: No
|
|
77
|
+
- Default: `() => {}`
|
|
@@ -13,7 +13,7 @@ import type { ToolsPanelItemProps } from '../types';
|
|
|
13
13
|
|
|
14
14
|
// This wraps controls to be conditionally displayed within a tools panel. It
|
|
15
15
|
// prevents props being applied to HTML elements that would make them invalid.
|
|
16
|
-
const
|
|
16
|
+
const UnconnectedToolsPanelItem = (
|
|
17
17
|
props: WordPressComponentProps< ToolsPanelItemProps, 'div' >,
|
|
18
18
|
forwardedRef: ForwardedRef< any >
|
|
19
19
|
) => {
|
|
@@ -37,9 +37,9 @@ const ToolsPanelItem = (
|
|
|
37
37
|
);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
export const ToolsPanelItem = contextConnect(
|
|
41
|
+
UnconnectedToolsPanelItem,
|
|
42
42
|
'ToolsPanelItem'
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
export default
|
|
45
|
+
export default ToolsPanelItem;
|
|
@@ -13,16 +13,18 @@ import { useContextSystem, WordPressComponentProps } from '../../ui/context';
|
|
|
13
13
|
import { useCx } from '../../utils/hooks/use-cx';
|
|
14
14
|
import type { ToolsPanelItemProps } from '../types';
|
|
15
15
|
|
|
16
|
+
const noop = () => {};
|
|
17
|
+
|
|
16
18
|
export function useToolsPanelItem(
|
|
17
19
|
props: WordPressComponentProps< ToolsPanelItemProps, 'div' >
|
|
18
20
|
) {
|
|
19
21
|
const {
|
|
20
22
|
className,
|
|
21
23
|
hasValue,
|
|
22
|
-
isShownByDefault,
|
|
24
|
+
isShownByDefault = false,
|
|
23
25
|
label,
|
|
24
26
|
panelId,
|
|
25
|
-
resetAllFilter,
|
|
27
|
+
resetAllFilter = noop,
|
|
26
28
|
onDeselect,
|
|
27
29
|
onSelect,
|
|
28
30
|
...otherProps
|
package/src/tools-panel/types.ts
CHANGED
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { HeadingSize } from '../heading/types';
|
|
10
|
+
|
|
11
|
+
type ResetAllFilter = ( attributes?: any ) => any;
|
|
7
12
|
type ResetAll = ( filters?: ResetAllFilter[] ) => void;
|
|
8
13
|
|
|
9
14
|
export type ToolsPanelProps = {
|
|
@@ -14,8 +19,16 @@ export type ToolsPanelProps = {
|
|
|
14
19
|
/**
|
|
15
20
|
* Flags that the items in this ToolsPanel will be contained within an inner
|
|
16
21
|
* wrapper element allowing the panel to lay them out accordingly.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
hasInnerWrapper?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The heading level of the panel's header.
|
|
28
|
+
*
|
|
29
|
+
* @default 2
|
|
17
30
|
*/
|
|
18
|
-
|
|
31
|
+
headingLevel?: HeadingSize;
|
|
19
32
|
/**
|
|
20
33
|
* Text to be displayed within the panel's header and as the `aria-label`
|
|
21
34
|
* for the panel's dropdown menu.
|
|
@@ -23,20 +36,24 @@ export type ToolsPanelProps = {
|
|
|
23
36
|
label: string;
|
|
24
37
|
/**
|
|
25
38
|
* If a `panelId` is set, it is passed through the `ToolsPanelContext` and
|
|
26
|
-
* used to restrict panel items.
|
|
27
|
-
*
|
|
39
|
+
* used to restrict panel items. When a `panelId` is set, items can only
|
|
40
|
+
* register themselves if the `panelId` is explicitly `null` or the item's
|
|
41
|
+
* `panelId` matches exactly.
|
|
28
42
|
*/
|
|
29
|
-
panelId
|
|
43
|
+
panelId?: string | null;
|
|
30
44
|
/**
|
|
31
|
-
* A function to call when the `Reset all` menu option is selected.
|
|
32
|
-
*
|
|
45
|
+
* A function to call when the `Reset all` menu option is selected. As an
|
|
46
|
+
* argument, it receives an array containing the `resetAllFilter` callbacks
|
|
47
|
+
* of all the valid registered `ToolsPanelItems`.
|
|
33
48
|
*/
|
|
34
49
|
resetAll: ResetAll;
|
|
35
50
|
/**
|
|
36
51
|
* Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render
|
|
37
52
|
* placeholder content instead of null when they are toggled off and hidden.
|
|
53
|
+
*
|
|
54
|
+
* @default false
|
|
38
55
|
*/
|
|
39
|
-
shouldRenderPlaceholderItems
|
|
56
|
+
shouldRenderPlaceholderItems?: boolean;
|
|
40
57
|
/**
|
|
41
58
|
* Experimental prop allowing for a custom CSS class to be applied to the
|
|
42
59
|
* first visible `ToolsPanelItem` within the `ToolsPanel`.
|
|
@@ -50,6 +67,12 @@ export type ToolsPanelProps = {
|
|
|
50
67
|
};
|
|
51
68
|
|
|
52
69
|
export type ToolsPanelHeaderProps = {
|
|
70
|
+
/**
|
|
71
|
+
* The heading level of the panel's header.
|
|
72
|
+
*
|
|
73
|
+
* @default 2
|
|
74
|
+
*/
|
|
75
|
+
headingLevel?: HeadingSize;
|
|
53
76
|
/**
|
|
54
77
|
* Text to be displayed within the panel header. It is also passed along as
|
|
55
78
|
* the `label` for the panel header's `DropdownMenu`.
|
|
@@ -79,8 +102,10 @@ export type ToolsPanelItem = {
|
|
|
79
102
|
* This prop identifies the current item as being displayed by default. This
|
|
80
103
|
* means it will show regardless of whether it has a value set or is toggled
|
|
81
104
|
* on in the panel's menu.
|
|
105
|
+
*
|
|
106
|
+
* @default false
|
|
82
107
|
*/
|
|
83
|
-
isShownByDefault
|
|
108
|
+
isShownByDefault?: boolean;
|
|
84
109
|
/**
|
|
85
110
|
* The supplied label is dual purpose. It is used as:
|
|
86
111
|
* 1. the human-readable label for the panel's dropdown menu
|
|
@@ -91,17 +116,20 @@ export type ToolsPanelItem = {
|
|
|
91
116
|
*/
|
|
92
117
|
label: string;
|
|
93
118
|
/**
|
|
94
|
-
* Panel items will ensure they are only registering with their intended
|
|
95
|
-
*
|
|
96
|
-
*
|
|
119
|
+
* Panel items will ensure they are only registering with their intended panel
|
|
120
|
+
* by comparing the `panelId` props set on both the item and the panel itself,
|
|
121
|
+
* or if the `panelId` is explicitly `null`. This allows items to be injected
|
|
122
|
+
* from a shared source.
|
|
97
123
|
*/
|
|
98
|
-
panelId
|
|
124
|
+
panelId?: string | null;
|
|
99
125
|
/**
|
|
100
126
|
* A `ToolsPanel` will collect each item's `resetAllFilter` and pass an
|
|
101
127
|
* array of these functions through to the panel's `resetAll` callback. They
|
|
102
128
|
* can then be iterated over to perform additional tasks.
|
|
129
|
+
*
|
|
130
|
+
* @default noop
|
|
103
131
|
*/
|
|
104
|
-
resetAllFilter
|
|
132
|
+
resetAllFilter?: ResetAllFilter;
|
|
105
133
|
};
|
|
106
134
|
|
|
107
135
|
export type ToolsPanelItemProps = ToolsPanelItem & {
|
|
@@ -128,7 +156,7 @@ export type ToolsPanelMenuItems = {
|
|
|
128
156
|
};
|
|
129
157
|
|
|
130
158
|
export type ToolsPanelContext = {
|
|
131
|
-
panelId?: string;
|
|
159
|
+
panelId?: string | null;
|
|
132
160
|
menuItems: ToolsPanelMenuItems;
|
|
133
161
|
hasMenuItems: boolean;
|
|
134
162
|
registerPanelItem: ( item: ToolsPanelItem ) => void;
|
package/src/tree-grid/README.md
CHANGED
|
@@ -10,7 +10,7 @@ This feature is still experimental. “Experimental” means this is an early im
|
|
|
10
10
|
|
|
11
11
|
## Development guidelines
|
|
12
12
|
|
|
13
|
-
`TreeGrid`, `TreeGridRow`, and `TreeGridCell` are components used to create a tree hierarchy. They're not visually styled components, but instead help with adding keyboard navigation and roving
|
|
13
|
+
`TreeGrid`, `TreeGridRow`, and `TreeGridCell` are components used to create a tree hierarchy. They're not visually styled components, but instead help with adding keyboard navigation and roving tabindex behaviors to tree grid structures.
|
|
14
14
|
|
|
15
15
|
A tree grid is a hierarchical 2 dimensional UI component, for example it could be used to implement a file system browser.
|
|
16
16
|
|
|
@@ -31,69 +31,36 @@ function TreeMenu() {
|
|
|
31
31
|
<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>
|
|
32
32
|
<TreeGridCell>
|
|
33
33
|
{ ( props ) => (
|
|
34
|
-
<Button onClick={ onSelect } { ...props }>
|
|
35
|
-
Select
|
|
36
|
-
</Button>
|
|
34
|
+
<Button onClick={ onSelect } { ...props }>Select</Button>
|
|
37
35
|
) }
|
|
38
36
|
</TreeGridCell>
|
|
39
37
|
<TreeGridCell>
|
|
40
38
|
{ ( props ) => (
|
|
41
|
-
<Button onClick={
|
|
42
|
-
Move Up
|
|
43
|
-
</Button>
|
|
44
|
-
) }
|
|
45
|
-
</TreeGridCell>
|
|
46
|
-
<TreeGridCell>
|
|
47
|
-
{ ( props ) => (
|
|
48
|
-
<Button onClick={ onMoveDown } { ...props }>
|
|
49
|
-
Move Down
|
|
50
|
-
</Button>
|
|
39
|
+
<Button onClick={ onMove } { ...props }>Move</Button>
|
|
51
40
|
) }
|
|
52
41
|
</TreeGridCell>
|
|
53
42
|
</TreeGridRow>
|
|
54
43
|
<TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>
|
|
55
44
|
<TreeGridCell>
|
|
56
45
|
{ ( props ) => (
|
|
57
|
-
<Button onClick={ onSelect } { ...props }>
|
|
58
|
-
Select
|
|
59
|
-
</Button>
|
|
60
|
-
) }
|
|
61
|
-
</TreeGridCell>
|
|
62
|
-
<TreeGridCell>
|
|
63
|
-
{ ( props ) => (
|
|
64
|
-
<Button onClick={ onMoveUp } { ...props }>
|
|
65
|
-
Move Up
|
|
66
|
-
</Button>
|
|
46
|
+
<Button onClick={ onSelect } { ...props }>Select</Button>
|
|
67
47
|
) }
|
|
68
48
|
</TreeGridCell>
|
|
69
49
|
<TreeGridCell>
|
|
70
50
|
{ ( props ) => (
|
|
71
|
-
<Button onClick={
|
|
72
|
-
Move Down
|
|
73
|
-
</Button>
|
|
51
|
+
<Button onClick={ onMove } { ...props }>Move</Button>
|
|
74
52
|
) }
|
|
75
53
|
</TreeGridCell>
|
|
76
54
|
</TreeGridRow>
|
|
77
55
|
<TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>
|
|
78
56
|
<TreeGridCell>
|
|
79
57
|
{ ( props ) => (
|
|
80
|
-
<Button onClick={ onSelect } { ...props }>
|
|
81
|
-
Select
|
|
82
|
-
</Button>
|
|
83
|
-
) }
|
|
84
|
-
</TreeGridCell>
|
|
85
|
-
<TreeGridCell>
|
|
86
|
-
{ ( props ) => (
|
|
87
|
-
<Button onClick={ onMoveUp } { ...props }>
|
|
88
|
-
Move Up
|
|
89
|
-
</Button>
|
|
58
|
+
<Button onClick={ onSelect } { ...props }>Select</Button>
|
|
90
59
|
) }
|
|
91
60
|
</TreeGridCell>
|
|
92
61
|
<TreeGridCell>
|
|
93
62
|
{ ( props ) => (
|
|
94
|
-
<Button onClick={
|
|
95
|
-
Move Down
|
|
96
|
-
</Button>
|
|
63
|
+
<Button onClick={ onMove } { ...props }>Move</Button>
|
|
97
64
|
) }
|
|
98
65
|
</TreeGridCell>
|
|
99
66
|
</TreeGridRow>
|
|
@@ -112,27 +79,24 @@ Aside from the documented callback functions, any props specified will be passed
|
|
|
112
79
|
|
|
113
80
|
`TreeGrid` should always have children.
|
|
114
81
|
|
|
115
|
-
###### onFocusRow( event:
|
|
82
|
+
###### `onFocusRow`: `( event: KeyboardEvent, startRow: HTMLElement, destinationRow: HTMLElement ) => void`
|
|
116
83
|
|
|
117
84
|
Callback that fires when focus is shifted from one row to another via the Up and Down keys. Callback is also fired on Home and End keys which move focus from the beginning row to the end row.
|
|
118
85
|
The callback is passed the event, the start row element that the focus was on originally, and
|
|
119
86
|
the destination row element after the focus has moved.
|
|
120
87
|
|
|
121
|
-
- Type: `Function`
|
|
122
88
|
- Required: No
|
|
123
89
|
|
|
124
|
-
###### onCollapseRow( row: HTMLElement )
|
|
90
|
+
###### `onCollapseRow`: `( row: HTMLElement ) => void`
|
|
125
91
|
|
|
126
92
|
A callback that passes in the row element to be collapsed.
|
|
127
93
|
|
|
128
|
-
- Type: `Function`
|
|
129
94
|
- Required: No
|
|
130
95
|
|
|
131
|
-
###### onExpandRow( row: HTMLElement )
|
|
96
|
+
###### `onExpandRow`: `( row: HTMLElement ) => void`
|
|
132
97
|
|
|
133
98
|
A callback that passes in the row element to be expanded.
|
|
134
99
|
|
|
135
|
-
- Type: `Function`
|
|
136
100
|
- Required: No
|
|
137
101
|
|
|
138
102
|
#### TreeGridRow
|
|
@@ -141,32 +105,28 @@ A callback that passes in the row element to be expanded.
|
|
|
141
105
|
|
|
142
106
|
Additional props other than those specified below will be passed to the `tr` element rendered by `TreeGridRow`, so for example, it is possible to also set a `className` on a row.
|
|
143
107
|
|
|
144
|
-
###### level
|
|
108
|
+
###### `level`: `number`
|
|
145
109
|
|
|
146
110
|
An integer value designating the level in the hierarchical tree structure. Counting starts at 1. A value of `1` indicates the root level of the structure.
|
|
147
111
|
|
|
148
|
-
- Type: `Number`
|
|
149
112
|
- Required: Yes
|
|
150
113
|
|
|
151
|
-
###### positionInSet
|
|
114
|
+
###### `positionInSet`: `number`
|
|
152
115
|
|
|
153
116
|
An integer value that represents the position in the set. A set is the count of elements at a specific level. Counting starts at 1.
|
|
154
117
|
|
|
155
|
-
- Type: `Number`
|
|
156
118
|
- Required: Yes
|
|
157
119
|
|
|
158
|
-
###### setSize
|
|
120
|
+
###### `setSize`: `number`
|
|
159
121
|
|
|
160
|
-
An integer value that represents the total number of items in the set
|
|
122
|
+
An integer value that represents the total number of items in the set, at this specific level of the hierarchy.
|
|
161
123
|
|
|
162
|
-
- Type: `Number`
|
|
163
124
|
- Required: Yes
|
|
164
125
|
|
|
165
|
-
###### isExpanded
|
|
126
|
+
###### `isExpanded`: `boolean`
|
|
166
127
|
|
|
167
128
|
An optional value that designates whether a row is expanded or collapsed. Currently this value only sets the correct aria-expanded property on a row, it has no other built-in behavior.
|
|
168
129
|
|
|
169
|
-
- Type: `Boolean`
|
|
170
130
|
- Required: No
|
|
171
131
|
|
|
172
132
|
### TreeGridCell
|
|
@@ -182,14 +142,14 @@ An optional value that designates whether a row is expanded or collapsed. Curren
|
|
|
182
142
|
```jsx
|
|
183
143
|
<TreeGridCell>
|
|
184
144
|
{ ( props ) => (
|
|
185
|
-
<Button onClick={
|
|
186
|
-
|
|
145
|
+
<Button onClick={ doSomething } { ...props }>
|
|
146
|
+
Do something
|
|
187
147
|
</Button>
|
|
188
148
|
) }
|
|
189
149
|
</TreeGridCell>
|
|
190
150
|
```
|
|
191
151
|
|
|
192
|
-
Props passed as an argument to the render prop must be passed to the child focusable component/element within the cell. If a component is used, it must correctly handle the `onFocus`, `tabIndex`, and `ref` props, passing these to the element it renders. These props are used to handle the roving
|
|
152
|
+
Props passed as an argument to the render prop must be passed to the child focusable component/element within the cell. If a component is used, it must correctly handle the `onFocus`, `tabIndex`, and `ref` props, passing these to the element it renders. These props are used to handle the roving tabindex functionality of the tree grid.
|
|
193
153
|
|
|
194
154
|
## Related components
|
|
195
155
|
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import TreeGridItem from './item';
|
|
10
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
11
|
+
import type { TreeGridCellProps } from './types';
|
|
12
|
+
|
|
13
|
+
function UnforwardedTreeGridCell(
|
|
14
|
+
{
|
|
15
|
+
children,
|
|
16
|
+
withoutGridItem = false,
|
|
17
|
+
...props
|
|
18
|
+
}: WordPressComponentProps< TreeGridCellProps, 'td', false >,
|
|
19
|
+
ref: React.ForwardedRef< any >
|
|
20
|
+
) {
|
|
21
|
+
return (
|
|
22
|
+
<td { ...props } role="gridcell">
|
|
23
|
+
{ withoutGridItem ? (
|
|
24
|
+
<>{ children }</>
|
|
25
|
+
) : (
|
|
26
|
+
<TreeGridItem ref={ ref }>{ children }</TreeGridItem>
|
|
27
|
+
) }
|
|
28
|
+
</td>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* `TreeGridCell` is used to create a tree hierarchy.
|
|
34
|
+
* It is not a visually styled component, but instead helps with adding
|
|
35
|
+
* keyboard navigation and roving tab index behaviors to tree grid structures.
|
|
36
|
+
*
|
|
37
|
+
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
|
|
38
|
+
*/
|
|
39
|
+
export const TreeGridCell = forwardRef( UnforwardedTreeGridCell );
|
|
40
|
+
|
|
41
|
+
export default TreeGridCell;
|