@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
|
@@ -9,24 +9,22 @@ import { UP, DOWN, LEFT, RIGHT, HOME, END } from '@wordpress/keycodes';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import RovingTabIndexContainer from './roving-tab-index';
|
|
12
|
+
import type { TreeGridProps } from './types';
|
|
13
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Return focusables in a row element, excluding those from other branches
|
|
15
17
|
* nested within the row.
|
|
16
18
|
*
|
|
17
|
-
* @param
|
|
19
|
+
* @param rowElement The DOM element representing the row.
|
|
18
20
|
*
|
|
19
|
-
* @return
|
|
21
|
+
* @return The array of focusables in the row.
|
|
20
22
|
*/
|
|
21
|
-
function getRowFocusables( rowElement ) {
|
|
23
|
+
function getRowFocusables( rowElement: HTMLElement ) {
|
|
22
24
|
const focusablesInRow = focus.focusable.find( rowElement, {
|
|
23
25
|
sequential: true,
|
|
24
26
|
} );
|
|
25
27
|
|
|
26
|
-
if ( ! focusablesInRow || ! focusablesInRow.length ) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
28
|
return focusablesInRow.filter( ( focusable ) => {
|
|
31
29
|
return focusable.closest( '[role="row"]' ) === rowElement;
|
|
32
30
|
} );
|
|
@@ -35,16 +33,8 @@ function getRowFocusables( rowElement ) {
|
|
|
35
33
|
/**
|
|
36
34
|
* Renders both a table and tbody element, used to create a tree hierarchy.
|
|
37
35
|
*
|
|
38
|
-
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
|
|
39
|
-
* @param {Object} props Component props.
|
|
40
|
-
* @param {WPElement} props.children Children to be rendered.
|
|
41
|
-
* @param {Function} props.onExpandRow Callback to fire when row is expanded.
|
|
42
|
-
* @param {Function} props.onCollapseRow Callback to fire when row is collapsed.
|
|
43
|
-
* @param {Function} props.onFocusRow Callback to fire when moving focus to a different row.
|
|
44
|
-
* @param {string} props.applicationAriaLabel Label to use for the application role.
|
|
45
|
-
* @param {Object} ref A ref to the underlying DOM table element.
|
|
46
36
|
*/
|
|
47
|
-
function
|
|
37
|
+
function UnforwardedTreeGrid(
|
|
48
38
|
{
|
|
49
39
|
children,
|
|
50
40
|
onExpandRow = () => {},
|
|
@@ -52,11 +42,12 @@ function TreeGrid(
|
|
|
52
42
|
onFocusRow = () => {},
|
|
53
43
|
applicationAriaLabel,
|
|
54
44
|
...props
|
|
55
|
-
},
|
|
56
|
-
ref
|
|
45
|
+
}: WordPressComponentProps< TreeGridProps, 'table', false >,
|
|
46
|
+
/** A ref to the underlying DOM table element. */
|
|
47
|
+
ref: React.ForwardedRef< HTMLTableElement >
|
|
57
48
|
) {
|
|
58
49
|
const onKeyDown = useCallback(
|
|
59
|
-
( event ) => {
|
|
50
|
+
( event: React.KeyboardEvent< HTMLTableElement > ) => {
|
|
60
51
|
const { keyCode, metaKey, ctrlKey, altKey } = event;
|
|
61
52
|
|
|
62
53
|
// The shift key is intentionally absent from the following list,
|
|
@@ -65,7 +56,9 @@ function TreeGrid(
|
|
|
65
56
|
|
|
66
57
|
if (
|
|
67
58
|
hasModifierKeyPressed ||
|
|
68
|
-
! [ UP, DOWN, LEFT, RIGHT, HOME, END ].includes(
|
|
59
|
+
! ( [ UP, DOWN, LEFT, RIGHT, HOME, END ] as number[] ).includes(
|
|
60
|
+
keyCode
|
|
61
|
+
)
|
|
69
62
|
) {
|
|
70
63
|
return;
|
|
71
64
|
}
|
|
@@ -75,21 +68,33 @@ function TreeGrid(
|
|
|
75
68
|
|
|
76
69
|
const { activeElement } = document;
|
|
77
70
|
const { currentTarget: treeGridElement } = event;
|
|
78
|
-
|
|
71
|
+
|
|
72
|
+
if (
|
|
73
|
+
! activeElement ||
|
|
74
|
+
! treeGridElement.contains( activeElement )
|
|
75
|
+
) {
|
|
79
76
|
return;
|
|
80
77
|
}
|
|
81
78
|
|
|
82
79
|
// Calculate the columnIndex of the active element.
|
|
83
|
-
const activeRow =
|
|
80
|
+
const activeRow =
|
|
81
|
+
activeElement.closest< HTMLElement >( '[role="row"]' );
|
|
82
|
+
|
|
83
|
+
if ( ! activeRow ) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
84
87
|
const focusablesInRow = getRowFocusables( activeRow );
|
|
85
|
-
const currentColumnIndex = focusablesInRow.indexOf(
|
|
88
|
+
const currentColumnIndex = focusablesInRow.indexOf(
|
|
89
|
+
activeElement as HTMLElement
|
|
90
|
+
);
|
|
86
91
|
const canExpandCollapse = 0 === currentColumnIndex;
|
|
87
92
|
const cannotFocusNextColumn =
|
|
88
93
|
canExpandCollapse &&
|
|
89
94
|
activeRow.getAttribute( 'aria-expanded' ) === 'false' &&
|
|
90
95
|
keyCode === RIGHT;
|
|
91
96
|
|
|
92
|
-
if ( [ LEFT, RIGHT ].includes( keyCode ) ) {
|
|
97
|
+
if ( ( [ LEFT, RIGHT ] as number[] ).includes( keyCode ) ) {
|
|
93
98
|
// Calculate to the next element.
|
|
94
99
|
let nextIndex;
|
|
95
100
|
if ( keyCode === LEFT ) {
|
|
@@ -116,22 +121,25 @@ function TreeGrid(
|
|
|
116
121
|
// If a row is focused, and it is collapsed, moves to the parent row (if there is one).
|
|
117
122
|
const level = Math.max(
|
|
118
123
|
parseInt(
|
|
119
|
-
activeRow?.getAttribute( 'aria-level' ) ?? 1,
|
|
124
|
+
activeRow?.getAttribute( 'aria-level' ) ?? '1',
|
|
120
125
|
10
|
|
121
126
|
) - 1,
|
|
122
127
|
1
|
|
123
128
|
);
|
|
124
129
|
const rows = Array.from(
|
|
125
|
-
treeGridElement.querySelectorAll
|
|
130
|
+
treeGridElement.querySelectorAll< HTMLElement >(
|
|
131
|
+
'[role="row"]'
|
|
132
|
+
)
|
|
126
133
|
);
|
|
127
134
|
let parentRow = activeRow;
|
|
128
135
|
const currentRowIndex = rows.indexOf( activeRow );
|
|
129
136
|
for ( let i = currentRowIndex; i >= 0; i-- ) {
|
|
137
|
+
const ariaLevel =
|
|
138
|
+
rows[ i ].getAttribute( 'aria-level' );
|
|
139
|
+
|
|
130
140
|
if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
10
|
|
134
|
-
) === level
|
|
141
|
+
ariaLevel !== null &&
|
|
142
|
+
parseInt( ariaLevel, 10 ) === level
|
|
135
143
|
) {
|
|
136
144
|
parentRow = rows[ i ];
|
|
137
145
|
break;
|
|
@@ -172,10 +180,12 @@ function TreeGrid(
|
|
|
172
180
|
// Prevent key use for anything else. This ensures Voiceover
|
|
173
181
|
// doesn't try to handle key navigation.
|
|
174
182
|
event.preventDefault();
|
|
175
|
-
} else if ( [ UP, DOWN ].includes( keyCode ) ) {
|
|
183
|
+
} else if ( ( [ UP, DOWN ] as number[] ).includes( keyCode ) ) {
|
|
176
184
|
// Calculate the rowIndex of the next row.
|
|
177
185
|
const rows = Array.from(
|
|
178
|
-
treeGridElement.querySelectorAll
|
|
186
|
+
treeGridElement.querySelectorAll< HTMLElement >(
|
|
187
|
+
'[role="row"]'
|
|
188
|
+
)
|
|
179
189
|
);
|
|
180
190
|
const currentRowIndex = rows.indexOf( activeRow );
|
|
181
191
|
let nextRowIndex;
|
|
@@ -226,10 +236,12 @@ function TreeGrid(
|
|
|
226
236
|
// Prevent key use for anything else. This ensures Voiceover
|
|
227
237
|
// doesn't try to handle key navigation.
|
|
228
238
|
event.preventDefault();
|
|
229
|
-
} else if ( [ HOME, END ].includes( keyCode ) ) {
|
|
239
|
+
} else if ( ( [ HOME, END ] as number[] ).includes( keyCode ) ) {
|
|
230
240
|
// Calculate the rowIndex of the next row.
|
|
231
241
|
const rows = Array.from(
|
|
232
|
-
treeGridElement.querySelectorAll
|
|
242
|
+
treeGridElement.querySelectorAll< HTMLElement >(
|
|
243
|
+
'[role="row"]'
|
|
244
|
+
)
|
|
233
245
|
);
|
|
234
246
|
const currentRowIndex = rows.indexOf( activeRow );
|
|
235
247
|
let nextRowIndex;
|
|
@@ -306,7 +318,71 @@ function TreeGrid(
|
|
|
306
318
|
/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
|
|
307
319
|
}
|
|
308
320
|
|
|
309
|
-
|
|
321
|
+
/**
|
|
322
|
+
* `TreeGrid` is used to create a tree hierarchy.
|
|
323
|
+
* It is not a visually styled component, but instead helps with adding
|
|
324
|
+
* keyboard navigation and roving tab index behaviors to tree grid structures.
|
|
325
|
+
*
|
|
326
|
+
* A tree grid is a hierarchical 2 dimensional UI component, for example it could be
|
|
327
|
+
* used to implement a file system browser.
|
|
328
|
+
*
|
|
329
|
+
* A tree grid allows the user to navigate using arrow keys.
|
|
330
|
+
* Up/down to navigate vertically across rows, and left/right to navigate horizontally
|
|
331
|
+
* between focusables in a row.
|
|
332
|
+
*
|
|
333
|
+
* The `TreeGrid` renders both a `table` and `tbody` element, and is intended to be used
|
|
334
|
+
* with `TreeGridRow` (`tr`) and `TreeGridCell` (`td`) to build out a grid.
|
|
335
|
+
*
|
|
336
|
+
* ```jsx
|
|
337
|
+
* function TreeMenu() {
|
|
338
|
+
* return (
|
|
339
|
+
* <TreeGrid>
|
|
340
|
+
* <TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 2 }>
|
|
341
|
+
* <TreeGridCell>
|
|
342
|
+
* { ( props ) => (
|
|
343
|
+
* <Button onClick={ onSelect } { ...props }>Select</Button>
|
|
344
|
+
* ) }
|
|
345
|
+
* </TreeGridCell>
|
|
346
|
+
* <TreeGridCell>
|
|
347
|
+
* { ( props ) => (
|
|
348
|
+
* <Button onClick={ onMove } { ...props }>Move</Button>
|
|
349
|
+
* ) }
|
|
350
|
+
* </TreeGridCell>
|
|
351
|
+
* </TreeGridRow>
|
|
352
|
+
* <TreeGridRow level={ 1 } positionInSet={ 2 } setSize={ 2 }>
|
|
353
|
+
* <TreeGridCell>
|
|
354
|
+
* { ( props ) => (
|
|
355
|
+
* <Button onClick={ onSelect } { ...props }>Select</Button>
|
|
356
|
+
* ) }
|
|
357
|
+
* </TreeGridCell>
|
|
358
|
+
* <TreeGridCell>
|
|
359
|
+
* { ( props ) => (
|
|
360
|
+
* <Button onClick={ onMove } { ...props }>Move</Button>
|
|
361
|
+
* ) }
|
|
362
|
+
* </TreeGridCell>
|
|
363
|
+
* </TreeGridRow>
|
|
364
|
+
* <TreeGridRow level={ 2 } positionInSet={ 1 } setSize={ 1 }>
|
|
365
|
+
* <TreeGridCell>
|
|
366
|
+
* { ( props ) => (
|
|
367
|
+
* <Button onClick={ onSelect } { ...props }>Select</Button>
|
|
368
|
+
* ) }
|
|
369
|
+
* </TreeGridCell>
|
|
370
|
+
* <TreeGridCell>
|
|
371
|
+
* { ( props ) => (
|
|
372
|
+
* <Button onClick={ onMove } { ...props }>Move</Button>
|
|
373
|
+
* ) }
|
|
374
|
+
* </TreeGridCell>
|
|
375
|
+
* </TreeGridRow>
|
|
376
|
+
* </TreeGrid>
|
|
377
|
+
* );
|
|
378
|
+
* }
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
|
|
382
|
+
*/
|
|
383
|
+
export const TreeGrid = forwardRef( UnforwardedTreeGrid );
|
|
384
|
+
|
|
385
|
+
export default TreeGrid;
|
|
310
386
|
export { default as TreeGridRow } from './row';
|
|
311
387
|
export { default as TreeGridCell } from './cell';
|
|
312
388
|
export { default as TreeGridItem } from './item';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import RovingTabIndexItem from './roving-tab-index-item';
|
|
10
|
+
import type { RovingTabIndexItemProps } from './types';
|
|
11
|
+
|
|
12
|
+
function UnforwardedTreeGridItem(
|
|
13
|
+
{ children, ...props }: RovingTabIndexItemProps,
|
|
14
|
+
ref: React.ForwardedRef< any >
|
|
15
|
+
) {
|
|
16
|
+
return (
|
|
17
|
+
<RovingTabIndexItem ref={ ref } { ...props }>
|
|
18
|
+
{ children }
|
|
19
|
+
</RovingTabIndexItem>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `TreeGridItem` is used to create a tree hierarchy.
|
|
25
|
+
* It is not a visually styled component, but instead helps with adding
|
|
26
|
+
* keyboard navigation and roving tab index behaviors to tree grid structures.
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
|
|
29
|
+
*/
|
|
30
|
+
export const TreeGridItem = forwardRef( UnforwardedTreeGridItem );
|
|
31
|
+
|
|
32
|
+
export default TreeGridItem;
|
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { createContext, useContext } from '@wordpress/element';
|
|
5
5
|
|
|
6
|
-
const RovingTabIndexContext = createContext
|
|
6
|
+
const RovingTabIndexContext = createContext<
|
|
7
|
+
| {
|
|
8
|
+
lastFocusedElement: HTMLElement | undefined;
|
|
9
|
+
setLastFocusedElement: React.Dispatch<
|
|
10
|
+
React.SetStateAction< HTMLElement | undefined >
|
|
11
|
+
>;
|
|
12
|
+
}
|
|
13
|
+
| undefined
|
|
14
|
+
>( undefined );
|
|
7
15
|
export const useRovingTabIndexContext = () =>
|
|
8
16
|
useContext( RovingTabIndexContext );
|
|
9
17
|
export const RovingTabIndexProvider = RovingTabIndexContext.Provider;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRef, forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useRovingTabIndexContext } from './roving-tab-index-context';
|
|
10
|
+
import type { RovingTabIndexItemProps } from './types';
|
|
11
|
+
|
|
12
|
+
export const RovingTabIndexItem = forwardRef(
|
|
13
|
+
function UnforwardedRovingTabIndexItem(
|
|
14
|
+
{ children, as: Component, ...props }: RovingTabIndexItemProps,
|
|
15
|
+
forwardedRef: React.ForwardedRef< any >
|
|
16
|
+
) {
|
|
17
|
+
const localRef = useRef< any >();
|
|
18
|
+
const ref = forwardedRef || localRef;
|
|
19
|
+
// @ts-expect-error - We actually want to throw an error if this is undefined.
|
|
20
|
+
const { lastFocusedElement, setLastFocusedElement } =
|
|
21
|
+
useRovingTabIndexContext();
|
|
22
|
+
let tabIndex;
|
|
23
|
+
|
|
24
|
+
if ( lastFocusedElement ) {
|
|
25
|
+
tabIndex =
|
|
26
|
+
lastFocusedElement ===
|
|
27
|
+
// TODO: The original implementation simply used `ref.current` here, assuming
|
|
28
|
+
// that a forwarded ref would always be an object, which is not necessarily true.
|
|
29
|
+
// This workaround maintains the original runtime behavior in a type-safe way,
|
|
30
|
+
// but should be revisited.
|
|
31
|
+
( 'current' in ref ? ref.current : undefined )
|
|
32
|
+
? 0
|
|
33
|
+
: -1;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const onFocus: React.FocusEventHandler< HTMLElement > = ( event ) =>
|
|
37
|
+
setLastFocusedElement?.( event.target );
|
|
38
|
+
const allProps = { ref, tabIndex, onFocus, ...props };
|
|
39
|
+
|
|
40
|
+
if ( typeof children === 'function' ) {
|
|
41
|
+
return children( allProps );
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if ( ! Component ) return null;
|
|
45
|
+
|
|
46
|
+
return <Component { ...allProps }>{ children }</Component>;
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export default RovingTabIndexItem;
|
|
@@ -12,12 +12,14 @@ import { RovingTabIndexProvider } from './roving-tab-index-context';
|
|
|
12
12
|
* Provider for adding roving tab index behaviors to tree grid structures.
|
|
13
13
|
*
|
|
14
14
|
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
|
|
15
|
-
*
|
|
16
|
-
* @param {Object} props Component props.
|
|
17
|
-
* @param {WPElement} props.children Children to be rendered
|
|
18
15
|
*/
|
|
19
|
-
export default function RovingTabIndex( {
|
|
20
|
-
|
|
16
|
+
export default function RovingTabIndex( {
|
|
17
|
+
children,
|
|
18
|
+
}: {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
} ) {
|
|
21
|
+
const [ lastFocusedElement, setLastFocusedElement ] =
|
|
22
|
+
useState< HTMLElement >();
|
|
21
23
|
|
|
22
24
|
// Use `useMemo` to avoid creation of a new object for the providerValue
|
|
23
25
|
// on every render. Only create a new object when the `lastFocusedElement`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { forwardRef } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { WordPressComponentProps } from '../ui/context';
|
|
10
|
+
import type { TreeGridRowProps } from './types';
|
|
11
|
+
|
|
12
|
+
function UnforwardedTreeGridRow(
|
|
13
|
+
{
|
|
14
|
+
children,
|
|
15
|
+
level,
|
|
16
|
+
positionInSet,
|
|
17
|
+
setSize,
|
|
18
|
+
isExpanded,
|
|
19
|
+
...props
|
|
20
|
+
}: WordPressComponentProps< TreeGridRowProps, 'tr', false >,
|
|
21
|
+
ref: React.ForwardedRef< HTMLTableRowElement >
|
|
22
|
+
) {
|
|
23
|
+
return (
|
|
24
|
+
<tr
|
|
25
|
+
{ ...props }
|
|
26
|
+
ref={ ref }
|
|
27
|
+
role="row"
|
|
28
|
+
aria-level={ level }
|
|
29
|
+
aria-posinset={ positionInSet }
|
|
30
|
+
aria-setsize={ setSize }
|
|
31
|
+
aria-expanded={ isExpanded }
|
|
32
|
+
>
|
|
33
|
+
{ children }
|
|
34
|
+
</tr>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* `TreeGridRow` is used to create a tree hierarchy.
|
|
40
|
+
* It is not a visually styled component, but instead helps with adding
|
|
41
|
+
* keyboard navigation and roving tab index behaviors to tree grid structures.
|
|
42
|
+
*
|
|
43
|
+
* @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
|
|
44
|
+
*/
|
|
45
|
+
export const TreeGridRow = forwardRef( UnforwardedTreeGridRow );
|
|
46
|
+
|
|
47
|
+
export default TreeGridRow;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Fragment } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import TreeGrid, { TreeGridRow, TreeGridCell } from '..';
|
|
15
|
+
import { Button } from '../../button';
|
|
16
|
+
import InputControl from '../../input-control';
|
|
17
|
+
|
|
18
|
+
const meta: ComponentMeta< typeof TreeGrid > = {
|
|
19
|
+
title: 'Components (Experimental)/TreeGrid',
|
|
20
|
+
component: TreeGrid,
|
|
21
|
+
subcomponents: { TreeGridRow, TreeGridCell },
|
|
22
|
+
argTypes: {
|
|
23
|
+
children: { control: { type: null } },
|
|
24
|
+
},
|
|
25
|
+
parameters: {
|
|
26
|
+
actions: { argTypesRegex: '^on.*' },
|
|
27
|
+
controls: { expanded: true },
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default meta;
|
|
31
|
+
|
|
32
|
+
const groceries = [
|
|
33
|
+
{
|
|
34
|
+
name: 'Fruit',
|
|
35
|
+
types: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Apple',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Orange',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Pear',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Vegetable',
|
|
49
|
+
types: [
|
|
50
|
+
{
|
|
51
|
+
name: 'Cucumber',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Parsnip',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Pumpkin',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const Descender = ( { level }: { level: number } ) => {
|
|
64
|
+
if ( level === 1 ) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const indentation = '\u00A0'.repeat( ( level - 1 ) * 4 );
|
|
68
|
+
|
|
69
|
+
return <span aria-hidden="true">{ indentation + '├ ' }</span>;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
type Item = {
|
|
73
|
+
name: string;
|
|
74
|
+
types?: Item[];
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const Rows = ( {
|
|
78
|
+
items = [],
|
|
79
|
+
level = 1,
|
|
80
|
+
}: {
|
|
81
|
+
items?: Item[];
|
|
82
|
+
level?: number;
|
|
83
|
+
} ) => {
|
|
84
|
+
return (
|
|
85
|
+
<>
|
|
86
|
+
{ items.map( ( item, index ) => {
|
|
87
|
+
const hasChildren = !! item.types && !! item.types.length;
|
|
88
|
+
return (
|
|
89
|
+
<Fragment key={ item.name }>
|
|
90
|
+
<TreeGridRow
|
|
91
|
+
positionInSet={ index + 1 }
|
|
92
|
+
setSize={ items.length }
|
|
93
|
+
level={ level }
|
|
94
|
+
isExpanded
|
|
95
|
+
>
|
|
96
|
+
<TreeGridCell>
|
|
97
|
+
{ ( props ) => (
|
|
98
|
+
<>
|
|
99
|
+
<Descender level={ level } />
|
|
100
|
+
<Button variant="primary" { ...props }>
|
|
101
|
+
{ item.name }
|
|
102
|
+
</Button>
|
|
103
|
+
</>
|
|
104
|
+
) }
|
|
105
|
+
</TreeGridCell>
|
|
106
|
+
<TreeGridCell>
|
|
107
|
+
{ ( props ) => (
|
|
108
|
+
<InputControl
|
|
109
|
+
label="Description"
|
|
110
|
+
hideLabelFromVision
|
|
111
|
+
placeholder="Description"
|
|
112
|
+
{ ...props }
|
|
113
|
+
/>
|
|
114
|
+
) }
|
|
115
|
+
</TreeGridCell>
|
|
116
|
+
<TreeGridCell>
|
|
117
|
+
{ ( props ) => (
|
|
118
|
+
<InputControl
|
|
119
|
+
label="Notes"
|
|
120
|
+
hideLabelFromVision
|
|
121
|
+
placeholder="Notes"
|
|
122
|
+
{ ...props }
|
|
123
|
+
/>
|
|
124
|
+
) }
|
|
125
|
+
</TreeGridCell>
|
|
126
|
+
</TreeGridRow>
|
|
127
|
+
{ hasChildren && (
|
|
128
|
+
<Rows items={ item.types } level={ level + 1 } />
|
|
129
|
+
) }
|
|
130
|
+
</Fragment>
|
|
131
|
+
);
|
|
132
|
+
} ) }
|
|
133
|
+
</>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const Template: ComponentStory< typeof TreeGrid > = ( args ) => (
|
|
138
|
+
<TreeGrid { ...args } />
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
export const Default = Template.bind( {} );
|
|
142
|
+
Default.args = {
|
|
143
|
+
children: <Rows items={ groceries } />,
|
|
144
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap}
RENAMED
|
File without changes
|
|
File without changes
|
|
@@ -11,12 +11,15 @@ import { forwardRef } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import TreeGrid from '
|
|
14
|
+
import TreeGrid from '..';
|
|
15
15
|
import TreeGridCell from '../cell';
|
|
16
16
|
|
|
17
|
-
const TestButton = forwardRef(
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const TestButton = forwardRef(
|
|
18
|
+
(
|
|
19
|
+
{ ...props }: React.ComponentPropsWithoutRef< 'button' >,
|
|
20
|
+
ref: React.ForwardedRef< HTMLButtonElement >
|
|
21
|
+
) => <button { ...props } ref={ ref }></button>
|
|
22
|
+
);
|
|
20
23
|
|
|
21
24
|
describe( 'TreeGridCell', () => {
|
|
22
25
|
it( 'requires TreeGrid to be declared as a parent component somewhere in the component hierarchy', () => {
|
|
@@ -12,13 +12,16 @@ import { forwardRef } from '@wordpress/element';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import TreeGrid from '
|
|
15
|
+
import TreeGrid from '..';
|
|
16
16
|
import TreeGridRow from '../row';
|
|
17
17
|
import TreeGridCell from '../cell';
|
|
18
18
|
|
|
19
|
-
const TestButton = forwardRef(
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
const TestButton = forwardRef(
|
|
20
|
+
(
|
|
21
|
+
{ ...props }: React.ComponentPropsWithoutRef< 'button' >,
|
|
22
|
+
ref: React.ForwardedRef< HTMLButtonElement >
|
|
23
|
+
) => <button { ...props } ref={ ref }></button>
|
|
24
|
+
);
|
|
22
25
|
|
|
23
26
|
describe( 'TreeGrid', () => {
|
|
24
27
|
const originalGetClientRects = window.Element.prototype.getClientRects;
|
|
@@ -35,6 +38,7 @@ describe( 'TreeGrid', () => {
|
|
|
35
38
|
] );
|
|
36
39
|
|
|
37
40
|
beforeAll( () => {
|
|
41
|
+
// @ts-expect-error - This is just a mock
|
|
38
42
|
window.Element.prototype.getClientRects =
|
|
39
43
|
jest.fn( mockedGetClientRects );
|
|
40
44
|
} );
|
|
@@ -162,7 +166,11 @@ describe( 'TreeGrid', () => {
|
|
|
162
166
|
} );
|
|
163
167
|
|
|
164
168
|
describe( 'onFocusRow', () => {
|
|
165
|
-
const TestTree = ( {
|
|
169
|
+
const TestTree = ( {
|
|
170
|
+
onFocusRow,
|
|
171
|
+
}: {
|
|
172
|
+
onFocusRow: React.ComponentProps< typeof TreeGrid >[ 'onFocusRow' ];
|
|
173
|
+
} ) => (
|
|
166
174
|
<TreeGrid onFocusRow={ onFocusRow }>
|
|
167
175
|
<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 3 }>
|
|
168
176
|
<TreeGridCell withoutGridItem>
|
|
@@ -14,9 +14,12 @@ import { forwardRef } from '@wordpress/element';
|
|
|
14
14
|
import RovingTabIndex from '../roving-tab-index';
|
|
15
15
|
import RovingTabIndexItem from '../roving-tab-index-item';
|
|
16
16
|
|
|
17
|
-
const TestButton = forwardRef(
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
const TestButton = forwardRef(
|
|
18
|
+
(
|
|
19
|
+
{ ...props }: React.ComponentPropsWithoutRef< 'button' >,
|
|
20
|
+
ref: React.ForwardedRef< HTMLButtonElement >
|
|
21
|
+
) => <button { ...props } ref={ ref }></button>
|
|
22
|
+
);
|
|
20
23
|
|
|
21
24
|
describe( 'RovingTabIndexItem', () => {
|
|
22
25
|
it( 'requires RovingTabIndex to be declared as a parent component somewhere in the component hierarchy', () => {
|
|
@@ -52,7 +55,7 @@ describe( 'RovingTabIndexItem', () => {
|
|
|
52
55
|
const { container } = render(
|
|
53
56
|
<RovingTabIndex>
|
|
54
57
|
<RovingTabIndexItem>
|
|
55
|
-
{ ( props ) => (
|
|
58
|
+
{ ( props: React.ComponentProps< typeof TestButton > ) => (
|
|
56
59
|
<TestButton className="my-button" { ...props }>
|
|
57
60
|
Click Me!
|
|
58
61
|
</TestButton>
|
|
File without changes
|
|
@@ -13,7 +13,7 @@ describe( 'TreeGridRow', () => {
|
|
|
13
13
|
const { container } = render(
|
|
14
14
|
<table>
|
|
15
15
|
<tbody>
|
|
16
|
-
<TreeGridRow level=
|
|
16
|
+
<TreeGridRow level={ 1 } positionInSet={ 1 } setSize={ 1 }>
|
|
17
17
|
<td>Test</td>
|
|
18
18
|
</TreeGridRow>
|
|
19
19
|
</tbody>
|
|
@@ -29,9 +29,9 @@ describe( 'TreeGridRow', () => {
|
|
|
29
29
|
<tbody>
|
|
30
30
|
<TreeGridRow
|
|
31
31
|
className="my-row"
|
|
32
|
-
level=
|
|
33
|
-
positionInSet=
|
|
34
|
-
setSize=
|
|
32
|
+
level={ 1 }
|
|
33
|
+
positionInSet={ 1 }
|
|
34
|
+
setSize={ 1 }
|
|
35
35
|
>
|
|
36
36
|
<td>Test</td>
|
|
37
37
|
</TreeGridRow>
|