@wordpress/components 23.3.5 → 23.5.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 +35 -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/angle-picker-control/types.js.map +1 -0
- package/build/autocomplete/autocompleter-ui.js +41 -17
- package/build/autocomplete/autocompleter-ui.js.map +1 -1
- package/build/autocomplete/autocompleter-ui.native.js +1 -0
- package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build/autocomplete/index.js +31 -33
- package/build/autocomplete/index.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/circular-option-picker/index.js +63 -14
- package/build/circular-option-picker/index.js.map +1 -1
- package/build/circular-option-picker/types.js +6 -0
- package/build/circular-option-picker/types.js.map +1 -0
- 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/higher-order/with-constrained-tabbing/index.js +9 -0
- package/build/higher-order/with-constrained-tabbing/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/mobile/global-styles-context/utils.native.js +2 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- 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/context.js +2 -0
- package/build/tools-panel/context.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 +22 -14
- 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 +18 -4
- 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/context-system-provider.js +8 -4
- package/build/ui/context/context-system-provider.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/autocomplete/autocompleter-ui.js +40 -19
- package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
- package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
- package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
- package/build-module/autocomplete/index.js +30 -32
- package/build-module/autocomplete/index.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-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/circular-option-picker/index.js +59 -16
- package/build-module/circular-option-picker/index.js.map +1 -1
- package/build-module/circular-option-picker/types.js +2 -0
- 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/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/higher-order/with-constrained-tabbing/index.js +9 -0
- package/build-module/higher-order/with-constrained-tabbing/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-module/menu-items-choice/types.js.map +1 -0
- package/build-module/mobile/global-styles-context/utils.native.js +2 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- 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/context.js +2 -0
- package/build-module/tools-panel/context.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 +22 -14
- 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 +19 -4
- 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/context-system-provider.js +7 -4
- package/build-module/ui/context/context-system-provider.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/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/circular-option-picker/index.d.ts +56 -7
- package/build-types/circular-option-picker/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.d.ts +14 -0
- package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
- package/build-types/circular-option-picker/types.d.ts +49 -0
- package/build-types/circular-option-picker/types.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/h-stack/stories/e2e/index.d.ts +9 -0
- package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
- package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
- 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/tab-panel/stories/index.d.ts +1 -0
- package/build-types/tab-panel/stories/index.d.ts.map +1 -1
- 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/context.d.ts.map +1 -1
- 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/test/index.d.ts +2 -0
- package/build-types/tools-panel/test/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 +5 -2
- 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 +3 -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 +49 -20
- 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/context-system-provider.d.ts.map +1 -1
- 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/build-types/v-stack/stories/e2e/index.d.ts +9 -0
- package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
- package/package.json +21 -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.js +72 -34
- package/src/autocomplete/autocompleter-ui.native.js +1 -0
- package/src/autocomplete/index.js +36 -36
- 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/circular-option-picker/README.md +141 -0
- package/src/circular-option-picker/{index.js → index.tsx} +74 -14
- package/src/circular-option-picker/stories/index.tsx +134 -0
- package/src/circular-option-picker/types.ts +69 -0
- package/src/color-palette/README.md +7 -0
- package/src/color-palette/index.tsx +6 -1
- package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -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/h-stack/stories/e2e/index.tsx +36 -0
- package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
- 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/mobile/global-styles-context/utils.native.js +1 -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/{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/utils.ts +14 -14
- package/src/snackbar/index.tsx +2 -2
- package/src/tab-panel/stories/index.tsx +41 -0
- package/src/tab-panel/test/index.tsx +794 -262
- package/src/toolbar/stories/{index.js → index.tsx} +39 -26
- 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/context.ts +2 -0
- package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
- package/src/tools-panel/test/{index.js → index.tsx} +177 -67
- 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 +34 -13
- 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 +22 -4
- package/src/tools-panel/types.ts +51 -20
- 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__/index.tsx.snap +3 -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/{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/context-system-provider.js +7 -4
- 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/src/v-stack/stories/e2e/index.tsx +36 -0
- 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/higher-order/with-constrained-tabbing/index.js +0 -22
- 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
- package/src/tree-grid/test/__snapshots__/index.js.snap +0 -3
- /package/build/{base-field → angle-picker-control}/types.js +0 -0
- /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/base-field → build-module/box-control}/types.js.map +0 -0
- /package/build-module/{resizable-box/styles/resizable-box.styles.js.map → circular-option-picker/types.js.map} +0 -0
- /package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/combobox-control/types.js.map} +0 -0
- /package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -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/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
- /package/src/toolbar/test/{index.js → index.tsx} +0 -0
- /package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.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/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.ToolbarContainer = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -28,7 +28,7 @@ var _toolbarContext = _interopRequireDefault(require("../toolbar-context"));
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
function
|
|
31
|
+
function UnforwardedToolbarContainer(_ref, ref) {
|
|
32
32
|
let {
|
|
33
33
|
label,
|
|
34
34
|
...props
|
|
@@ -51,7 +51,8 @@ function ToolbarContainer(_ref, ref) {
|
|
|
51
51
|
);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
const ToolbarContainer = (0, _element.forwardRef)(UnforwardedToolbarContainer);
|
|
55
|
+
exports.ToolbarContainer = ToolbarContainer;
|
|
56
|
+
var _default = ToolbarContainer;
|
|
56
57
|
exports.default = _default;
|
|
57
58
|
//# sourceMappingURL=toolbar-container.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar/toolbar-container.
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar/toolbar-container.tsx"],"names":["UnforwardedToolbarContainer","ref","label","props","toolbarState","loop","baseId","id","rtl","ToolbarContainer"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAOA;;AAKA;;AAfA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AAKA,SAASA,2BAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,KAAF;AAAS,OAAGC;AAAZ,GAEC;AACD;AACA;AACA;AACA,QAAMC,YAAY,GAAG,8BAAiB;AACrCC,IAAAA,IAAI,EAAE,IAD+B;AAErCC,IAAAA,MAAM,EAAEH,KAAK,CAACI,EAFuB;AAGrCC,IAAAA,GAAG,EAAE;AAHgC,GAAjB,CAArB;AAMA,SACC;AACA,gCAAC,uBAAD,CAAgB,QAAhB;AAAyB,MAAA,KAAK,EAAGJ;AAAjC,OACC,4BAAC,gBAAD;AACC,MAAA,GAAG,EAAGH,GADP;AAEC,oBAAaC;AAFd,OAGME,YAHN,EAIMD,KAJN,EADD;AAFD;AAWA;;AAEM,MAAMM,gBAAgB,GAAG,yBAAYT,2BAAZ,CAAzB;;eACQS,gB","sourcesContent":["/**\n * External dependencies\n */\nimport { useToolbarState, Toolbar } from 'reakit/Toolbar';\nimport type { ForwardedRef } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { isRTL } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ToolbarContext from '../toolbar-context';\nimport type { ToolbarProps } from './types';\nimport type { WordPressComponentProps } from '../../ui/context';\n\nfunction UnforwardedToolbarContainer(\n\t{ label, ...props }: WordPressComponentProps< ToolbarProps, 'div', false >,\n\tref: ForwardedRef< any >\n) {\n\t// https://reakit.io/docs/basic-concepts/#state-hooks\n\t// Passing baseId for server side rendering (which includes snapshots)\n\t// If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids\n\tconst toolbarState = useToolbarState( {\n\t\tloop: true,\n\t\tbaseId: props.id,\n\t\trtl: isRTL(),\n\t} );\n\n\treturn (\n\t\t// This will provide state for `ToolbarButton`'s\n\t\t<ToolbarContext.Provider value={ toolbarState }>\n\t\t\t<Toolbar\n\t\t\t\tref={ ref }\n\t\t\t\taria-label={ label }\n\t\t\t\t{ ...toolbarState }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t</ToolbarContext.Provider>\n\t);\n}\n\nexport const ToolbarContainer = forwardRef( UnforwardedToolbarContainer );\nexport default ToolbarContainer;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-button/index.js"],"names":["ToolbarButton","ref","containerClassName","className","extraProps","children","title","isActive","isDisabled","props","accessibleToolbarState","ToolbarContext","icon","shortcut","subscript","event","stopPropagation","onClick","toolbarItemProps"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-button/index.js"],"names":["ToolbarButton","ref","containerClassName","className","extraProps","children","title","isActive","isDisabled","props","accessibleToolbarState","ToolbarContext","icon","shortcut","subscript","event","stopPropagation","onClick","toolbarItemProps"],"mappings":";;;;;;;;;AASA;;;;AAJA;;AAQA;;AACA;;AACA;;AACA;;AAhBA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AAMA,SAASA,aAAT,OA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,QANH,CAPF,CADD;AAmBA;;eAEc,yBAAYL,aAAZ,C","sourcesContent":["// @ts-nocheck\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useContext, forwardRef } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport Button from '../../button';\nimport ToolbarItem from '../toolbar-item';\nimport ToolbarContext from '../toolbar-context';\nimport ToolbarButtonContainer from './toolbar-button-container';\n\nfunction ToolbarButton(\n\t{\n\t\tcontainerClassName,\n\t\tclassName,\n\t\textraProps,\n\t\tchildren,\n\t\ttitle,\n\t\tisActive,\n\t\tisDisabled,\n\t\t...props\n\t},\n\tref\n) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ! accessibleToolbarState ) {\n\t\treturn (\n\t\t\t<ToolbarButtonContainer className={ containerClassName }>\n\t\t\t\t<Button\n\t\t\t\t\tref={ ref }\n\t\t\t\t\ticon={ props.icon }\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tshortcut={ props.shortcut }\n\t\t\t\t\tdata-subscript={ props.subscript }\n\t\t\t\t\tonClick={ ( event ) => {\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tif ( props.onClick ) {\n\t\t\t\t\t\t\tprops.onClick( event );\n\t\t\t\t\t\t}\n\t\t\t\t\t} }\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-toolbar__control',\n\t\t\t\t\t\tclassName\n\t\t\t\t\t) }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\tdata-toolbar-item\n\t\t\t\t\t{ ...extraProps }\n\t\t\t\t\t{ ...props }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t</ToolbarButtonContainer>\n\t\t);\n\t}\n\n\t// ToobarItem will pass all props to the render prop child, which will pass\n\t// all props to Button. This means that ToolbarButton has the same API as\n\t// Button.\n\treturn (\n\t\t<ToolbarItem\n\t\t\tclassName={ classnames( 'components-toolbar-button', className ) }\n\t\t\t{ ...extraProps }\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ ( toolbarItemProps ) => (\n\t\t\t\t<Button\n\t\t\t\t\tlabel={ title }\n\t\t\t\t\tisPressed={ isActive }\n\t\t\t\t\tdisabled={ isDisabled }\n\t\t\t\t\t{ ...toolbarItemProps }\n\t\t\t\t>\n\t\t\t\t\t{ children }\n\t\t\t\t</Button>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\nexport default forwardRef( ToolbarButton );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-button/toolbar-button-container.js"],"names":["ToolbarButtonContainer","props","className","children"],"mappings":";;;;;;;;;AAAA,MAAMA,sBAAsB,GAAKC,KAAF,IAC9B;AAAK,EAAA,SAAS,EAAGA,KAAK,CAACC;AAAvB,GAAqCD,KAAK,CAACE,QAA3C,CADD;;eAGeH,sB","sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-button/toolbar-button-container.js"],"names":["ToolbarButtonContainer","props","className","children"],"mappings":";;;;;;;;;AAAA;AAEA,MAAMA,sBAAsB,GAAKC,KAAF,IAC9B;AAAK,EAAA,SAAS,EAAGA,KAAK,CAACC;AAAvB,GAAqCD,KAAK,CAACE,QAA3C,CADD;;eAGeH,sB","sourcesContent":["// @ts-nocheck\n\nconst ToolbarButtonContainer = ( props ) => (\n\t<div className={ props.className }>{ props.children }</div>\n);\nexport default ToolbarButtonContainer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-context/index.js"],"names":["ToolbarContext"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-context/index.js"],"names":["ToolbarContext"],"mappings":";;;;;;;AAKA;;AALA;;AAEA;AACA;AACA;AAGA,MAAMA,cAAc,GAAG,6BAAvB;eAEeA,c","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nconst ToolbarContext = createContext();\n\nexport default ToolbarContext;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-dropdown-menu/index.js"],"names":["ToolbarDropdownMenu","props","ref","accessibleToolbarState","ToolbarContext","toggleProps","toolbarItemProps","variant","popoverProps"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-dropdown-menu/index.js"],"names":["ToolbarDropdownMenu","props","ref","accessibleToolbarState","ToolbarContext","toggleProps","toolbarItemProps","variant","popoverProps"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AACA;;AAZA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAKA,SAASA,mBAAT,CAA8BC,KAA9B,EAAqCC,GAArC,EAA2C;AAC1C,QAAMC,sBAAsB,GAAG,yBAAYC,uBAAZ,CAA/B;;AAEA,MAAK,CAAED,sBAAP,EAAgC;AAC/B,WAAO,4BAAC,qBAAD,EAAmBF,KAAnB,CAAP;AACA,GALyC,CAO1C;AACA;AACA;;;AACA,SACC,4BAAC,oBAAD;AAAa,IAAA,GAAG,EAAGC;AAAnB,KAA8BD,KAAK,CAACI,WAApC,GACKC,gBAAF,IACD,4BAAC,qBAAD,6BACML,KADN;AAEC,IAAA,YAAY,EAAG;AACdM,MAAAA,OAAO,EAAE,SADK;AAEd,SAAGN,KAAK,CAACO;AAFK,KAFhB;AAMC,IAAA,WAAW,EAAGF;AANf,KAFF,CADD;AAcA;;eAEc,yBAAYN,mBAAZ,C","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarItem from '../toolbar-item';\nimport ToolbarContext from '../toolbar-context';\nimport DropdownMenu from '../../dropdown-menu';\n\nfunction ToolbarDropdownMenu( props, ref ) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ! accessibleToolbarState ) {\n\t\treturn <DropdownMenu { ...props } />;\n\t}\n\n\t// ToobarItem will pass all props to the render prop child, which will pass\n\t// all props to the toggle of DropdownMenu. This means that ToolbarDropdownMenu\n\t// has the same API as DropdownMenu.\n\treturn (\n\t\t<ToolbarItem ref={ ref } { ...props.toggleProps }>\n\t\t\t{ ( toolbarItemProps ) => (\n\t\t\t\t<DropdownMenu\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tpopoverProps={ {\n\t\t\t\t\t\tvariant: 'toolbar',\n\t\t\t\t\t\t...props.popoverProps,\n\t\t\t\t\t} }\n\t\t\t\t\ttoggleProps={ toolbarItemProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</ToolbarItem>\n\t);\n}\n\nexport default forwardRef( ToolbarDropdownMenu );\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/index.js"],"names":["ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","ToolbarContext","length","finalClassName","controlSets","Array","isArray","flatMap","controlSet","indexOfSet","map","control","indexOfControl","join"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/index.js"],"names":["ToolbarGroup","controls","children","className","isCollapsed","title","props","accessibleToolbarState","ToolbarContext","length","finalClassName","controlSets","Array","isArray","flatMap","controlSet","indexOfSet","map","control","indexOfControl","join"],"mappings":";;;;;;;;;AAUA;;;;AALA;;AAUA;;AACA;;AACA;;AACA;;AAlBA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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b,IAAkBG,cAAc,KAAK,CAArC,GACG,kBADH,GAEG;AALL,KAOMD,OAPN,EADD,CADC,CADH,EAcGhB,QAdH,CADD;AAkBA;;eAEcF,Y","sourcesContent":["// @ts-nocheck\n\n/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ToolbarButton from '../toolbar-button';\nimport ToolbarGroupContainer from './toolbar-group-container';\nimport ToolbarGroupCollapsed from './toolbar-group-collapsed';\nimport ToolbarContext from '../toolbar-context';\n\n/**\n * Renders a collapsible group of controls\n *\n * The `controls` prop accepts an array of sets. A set is an array of controls.\n * Controls have the following shape:\n *\n * ```\n * {\n * icon: string,\n * title: string,\n * subscript: string,\n * onClick: Function,\n * isActive: boolean,\n * isDisabled: boolean\n * }\n * ```\n *\n * For convenience it is also possible to pass only an array of controls. It is\n * then assumed this is the only set.\n *\n * Either `controls` or `children` is required, otherwise this components\n * renders nothing.\n *\n * @param {Object} props Component props.\n * @param {Array} [props.controls] The controls to render in this toolbar.\n * @param {WPElement} [props.children] Any other things to render inside the toolbar besides the controls.\n * @param {string} [props.className] Class to set on the container div.\n * @param {boolean} [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.\n * @param {string} [props.title] ARIA label for dropdown menu if is collapsed.\n */\nfunction ToolbarGroup( {\n\tcontrols = [],\n\tchildren,\n\tclassName,\n\tisCollapsed,\n\ttitle,\n\t...props\n} ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( ( ! controls || ! controls.length ) && ! children ) {\n\t\treturn null;\n\t}\n\n\tconst finalClassName = classnames(\n\t\t// Unfortunately, there's legacy code referencing to `.components-toolbar`\n\t\t// So we can't get rid of it\n\t\taccessibleToolbarState\n\t\t\t? 'components-toolbar-group'\n\t\t\t: 'components-toolbar',\n\t\tclassName\n\t);\n\n\t// Normalize controls to nested array of objects (sets of controls)\n\tlet controlSets = controls;\n\tif ( ! Array.isArray( controlSets[ 0 ] ) ) {\n\t\tcontrolSets = [ controlSets ];\n\t}\n\n\tif ( isCollapsed ) {\n\t\treturn (\n\t\t\t<ToolbarGroupCollapsed\n\t\t\t\tlabel={ title }\n\t\t\t\tcontrols={ controlSets }\n\t\t\t\tclassName={ finalClassName }\n\t\t\t\tchildren={ children }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<ToolbarGroupContainer className={ finalClassName } { ...props }>\n\t\t\t{ controlSets?.flatMap( ( controlSet, indexOfSet ) =>\n\t\t\t\tcontrolSet.map( ( control, indexOfControl ) => (\n\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\tkey={ [ indexOfSet, indexOfControl ].join() }\n\t\t\t\t\t\tcontainerClassName={\n\t\t\t\t\t\t\tindexOfSet > 0 && indexOfControl === 0\n\t\t\t\t\t\t\t\t? 'has-left-divider'\n\t\t\t\t\t\t\t\t: null\n\t\t\t\t\t\t}\n\t\t\t\t\t\t{ ...control }\n\t\t\t\t\t/>\n\t\t\t\t) )\n\t\t\t) }\n\t\t\t{ children }\n\t\t</ToolbarGroupContainer>\n\t);\n}\n\nexport default ToolbarGroup;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/toolbar-group-collapsed.js"],"names":["ToolbarGroupCollapsed","controls","toggleProps","props","accessibleToolbarState","ToolbarContext","renderDropdownMenu","internalToggleProps"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/toolbar-group-collapsed.js"],"names":["ToolbarGroupCollapsed","controls","toggleProps","props","accessibleToolbarState","ToolbarContext","renderDropdownMenu","internalToggleProps"],"mappings":";;;;;;;;;AAKA;;;;AAKA;;AACA;;AACA;;AAZA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AAKA,SAASA,qBAAT,OAA2E;AAAA,MAA3C;AAAEC,IAAAA,QAAQ,GAAG,EAAb;AAAiBC,IAAAA,WAAjB;AAA8B,OAAGC;AAAjC,GAA2C;AAC1E;AACA;AACA,QAAMC,sBAAsB,GAAG,yBAAYC,uBAAZ,CAA/B;;AAEA,QAAMC,kBAAkB,GAAKC,mBAAF,IAC1B,4BAAC,qBAAD;AACC,IAAA,QAAQ,EAAGN,QADZ;AAEC,IAAA,WAAW,EAAG,EACb,GAAGM,mBADU;AAEb,2BAAqB;AAFR;AAFf,KAMMJ,KANN,EADD;;AAWA,MAAKC,sBAAL,EAA8B;AAC7B,WACC,4BAAC,oBAAD,EAAkBF,WAAlB,EAAkCI,kBAAlC,CADD;AAGA;;AAED,SAAOA,kBAAkB,CAAEJ,WAAF,CAAzB;AACA;;eAEcF,qB","sourcesContent":["// @ts-nocheck\n\n/**\n * WordPress dependencies\n */\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DropdownMenu from '../../dropdown-menu';\nimport ToolbarContext from '../toolbar-context';\nimport ToolbarItem from '../toolbar-item';\n\nfunction ToolbarGroupCollapsed( { controls = [], toggleProps, ...props } ) {\n\t// It'll contain state if `ToolbarGroup` is being used within\n\t// `<Toolbar label=\"label\" />`\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tconst renderDropdownMenu = ( internalToggleProps ) => (\n\t\t<DropdownMenu\n\t\t\tcontrols={ controls }\n\t\t\ttoggleProps={ {\n\t\t\t\t...internalToggleProps,\n\t\t\t\t'data-toolbar-item': true,\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t/>\n\t);\n\n\tif ( accessibleToolbarState ) {\n\t\treturn (\n\t\t\t<ToolbarItem { ...toggleProps }>{ renderDropdownMenu }</ToolbarItem>\n\t\t);\n\t}\n\n\treturn renderDropdownMenu( toggleProps );\n}\n\nexport default ToolbarGroupCollapsed;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/toolbar-group-container.js"],"names":["ToolbarGroupContainer","className","children","props"],"mappings":";;;;;;;;;;;;;AAAA,MAAMA,qBAAqB,GAAG;AAAA,MAAE;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuB,OAAGC;AAA1B,GAAF;AAAA,SAC7B;AAAK,IAAA,SAAS,EAAGF;AAAjB,KAAkCE,KAAlC,GACGD,QADH,CAD6B;AAAA,CAA9B;;eAKeF,qB","sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-group/toolbar-group-container.js"],"names":["ToolbarGroupContainer","className","children","props"],"mappings":";;;;;;;;;;;;;AAAA;AAEA,MAAMA,qBAAqB,GAAG;AAAA,MAAE;AAAEC,IAAAA,SAAF;AAAaC,IAAAA,QAAb;AAAuB,OAAGC;AAA1B,GAAF;AAAA,SAC7B;AAAK,IAAA,SAAS,EAAGF;AAAjB,KAAkCE,KAAlC,GACGD,QADH,CAD6B;AAAA,CAA9B;;eAKeF,qB","sourcesContent":["// @ts-nocheck\n\nconst ToolbarGroupContainer = ( { className, children, ...props } ) => (\n\t<div className={ className } { ...props }>\n\t\t{ children }\n\t</div>\n);\nexport default ToolbarGroupContainer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-item/index.js"],"names":["ToolbarItem","ref","children","as","Component","props","accessibleToolbarState","ToolbarContext","allProps"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/toolbar/toolbar-item/index.js"],"names":["ToolbarItem","ref","children","as","Component","props","accessibleToolbarState","ToolbarContext","allProps"],"mappings":";;;;;;;;;AAUA;;;;AALA;;AAMA;;AAKA;;AAhBA;;AAEA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AAGA,SAASA,WAAT,OAA6DC,GAA7D,EAAmE;AAAA,MAA7C;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAE,EAAEC,SAAhB;AAA2B,OAAGC;AAA9B,GAA6C;AAClE,QAAMC,sBAAsB,GAAG,yBAAYC,uBAAZ,CAA/B;;AAEA,MAAK,OAAOL,QAAP,KAAoB,UAApB,IAAkC,CAAEE,SAAzC,EAAqD;AACpD,mHACC,yIACC,2EAFF;AAIA,WAAO,IAAP;AACA;;AAED,QAAMI,QAAQ,GAAG,EAAE,GAAGH,KAAL;AAAYJ,IAAAA,GAAZ;AAAiB,yBAAqB;AAAtC,GAAjB;;AAEA,MAAK,CAAEK,sBAAP,EAAgC;AAC/B,QAAKF,SAAL,EAAiB;AAChB,aAAO,4BAAC,SAAD,EAAgBI,QAAhB,EAA6BN,QAA7B,CAAP;AACA;;AACD,WAAOA,QAAQ,CAAEM,QAAF,CAAf;AACA;;AAED,SACC,4BAAC,oBAAD,6BACMF,sBADN,EAEME,QAFN;AAGC,IAAA,EAAE,EAAGJ;AAHN,MAKGF,QALH,CADD;AASA;;eAEc,yBAAYF,WAAZ,C","sourcesContent":["// @ts-nocheck\n\n/**\n * External dependencies\n */\nimport { ToolbarItem as BaseToolbarItem } from 'reakit/Toolbar';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useContext } from '@wordpress/element';\nimport warning from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport ToolbarContext from '../toolbar-context';\n\nfunction ToolbarItem( { children, as: Component, ...props }, ref ) {\n\tconst accessibleToolbarState = useContext( ToolbarContext );\n\n\tif ( typeof children !== 'function' && ! Component ) {\n\t\twarning(\n\t\t\t'`ToolbarItem` is a generic headless component. You must pass either a `children` prop as a function or an `as` prop as a component. ' +\n\t\t\t\t'See https://developer.wordpress.org/block-editor/components/toolbar-item/'\n\t\t);\n\t\treturn null;\n\t}\n\n\tconst allProps = { ...props, ref, 'data-toolbar-item': true };\n\n\tif ( ! accessibleToolbarState ) {\n\t\tif ( Component ) {\n\t\t\treturn <Component { ...allProps }>{ children }</Component>;\n\t\t}\n\t\treturn children( allProps );\n\t}\n\n\treturn (\n\t\t<BaseToolbarItem\n\t\t\t{ ...accessibleToolbarState }\n\t\t\t{ ...allProps }\n\t\t\tas={ Component }\n\t\t>\n\t\t\t{ children }\n\t\t</BaseToolbarItem>\n\t);\n}\n\nexport default forwardRef( ToolbarItem );\n"]}
|
|
@@ -23,6 +23,8 @@ const ToolsPanelContext = (0, _element.createContext)({
|
|
|
23
23
|
registerPanelItem: noop,
|
|
24
24
|
deregisterPanelItem: noop,
|
|
25
25
|
flagItemCustomization: noop,
|
|
26
|
+
registerResetAllFilter: noop,
|
|
27
|
+
deregisterResetAllFilter: noop,
|
|
26
28
|
areAllOptionalControlsHidden: true
|
|
27
29
|
});
|
|
28
30
|
exports.ToolsPanelContext = ToolsPanelContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/tools-panel/context.ts"],"names":["noop","undefined","ToolsPanelContext","menuItems","default","optional","hasMenuItems","isResetting","shouldRenderPlaceholderItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","areAllOptionalControlsHidden","useToolsPanelContext"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAQA,MAAMA,IAAI,GAAG,MAAMC,SAAnB;;AAEO,MAAMC,iBAAiB,GAAG,4BAAwC;AACxEC,EAAAA,SAAS,EAAE;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAD6D;AAExEC,EAAAA,YAAY,EAAE,KAF0D;AAGxEC,EAAAA,WAAW,EAAE,KAH2D;AAIxEC,EAAAA,4BAA4B,EAAE,KAJ0C;AAKxEC,EAAAA,iBAAiB,EAAET,IALqD;AAMxEU,EAAAA,mBAAmB,EAAEV,IANmD;AAOxEW,EAAAA,qBAAqB,EAAEX,IAPiD;AAQxEY,EAAAA,4BAA4B,EAAE;
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/tools-panel/context.ts"],"names":["noop","undefined","ToolsPanelContext","menuItems","default","optional","hasMenuItems","isResetting","shouldRenderPlaceholderItems","registerPanelItem","deregisterPanelItem","flagItemCustomization","registerResetAllFilter","deregisterResetAllFilter","areAllOptionalControlsHidden","useToolsPanelContext"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAQA,MAAMA,IAAI,GAAG,MAAMC,SAAnB;;AAEO,MAAMC,iBAAiB,GAAG,4BAAwC;AACxEC,EAAAA,SAAS,EAAE;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAD6D;AAExEC,EAAAA,YAAY,EAAE,KAF0D;AAGxEC,EAAAA,WAAW,EAAE,KAH2D;AAIxEC,EAAAA,4BAA4B,EAAE,KAJ0C;AAKxEC,EAAAA,iBAAiB,EAAET,IALqD;AAMxEU,EAAAA,mBAAmB,EAAEV,IANmD;AAOxEW,EAAAA,qBAAqB,EAAEX,IAPiD;AAQxEY,EAAAA,sBAAsB,EAAEZ,IARgD;AASxEa,EAAAA,wBAAwB,EAAEb,IAT8C;AAUxEc,EAAAA,4BAA4B,EAAE;AAV0C,CAAxC,CAA1B;;;AAaA,MAAMC,oBAAoB,GAAG,MACnC,yBAAqCb,iBAArC,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { ToolsPanelContext as ToolsPanelContextType } from './types';\n\nconst noop = () => undefined;\n\nexport const ToolsPanelContext = createContext< ToolsPanelContextType >( {\n\tmenuItems: { default: {}, optional: {} },\n\thasMenuItems: false,\n\tisResetting: false,\n\tshouldRenderPlaceholderItems: false,\n\tregisterPanelItem: noop,\n\tderegisterPanelItem: noop,\n\tflagItemCustomization: noop,\n\tregisterResetAllFilter: noop,\n\tderegisterResetAllFilter: noop,\n\tareAllOptionalControlsHidden: true,\n} );\n\nexport const useToolsPanelContext = () =>\n\tuseContext< ToolsPanelContextType >( ToolsPanelContext );\n"]}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = void 0;
|
|
8
|
+
exports.default = exports.ToolsPanel = void 0;
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
@@ -28,13 +28,14 @@ var _context2 = require("../../ui/context");
|
|
|
28
28
|
/**
|
|
29
29
|
* Internal dependencies
|
|
30
30
|
*/
|
|
31
|
-
const
|
|
31
|
+
const UnconnectedToolsPanel = (props, forwardedRef) => {
|
|
32
32
|
const {
|
|
33
33
|
children,
|
|
34
34
|
label,
|
|
35
35
|
panelContext,
|
|
36
36
|
resetAllItems,
|
|
37
37
|
toggleItem,
|
|
38
|
+
headingLevel,
|
|
38
39
|
...toolsPanelProps
|
|
39
40
|
} = (0, _hook.useToolsPanel)(props);
|
|
40
41
|
return (0, _element.createElement)(_grid.Grid, (0, _extends2.default)({}, toolsPanelProps, {
|
|
@@ -45,11 +46,66 @@ const ToolsPanel = (props, forwardedRef) => {
|
|
|
45
46
|
}, (0, _element.createElement)(_toolsPanelHeader.default, {
|
|
46
47
|
label: label,
|
|
47
48
|
resetAll: resetAllItems,
|
|
48
|
-
toggleItem: toggleItem
|
|
49
|
+
toggleItem: toggleItem,
|
|
50
|
+
headingLevel: headingLevel
|
|
49
51
|
}), children));
|
|
50
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* The `ToolsPanel` is a container component that displays its children preceded
|
|
55
|
+
* by a header. The header includes a dropdown menu which is automatically
|
|
56
|
+
* generated from the panel's inner `ToolsPanelItems`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```jsx
|
|
60
|
+
* import { __ } from '@wordpress/i18n';
|
|
61
|
+
* import {
|
|
62
|
+
* __experimentalToolsPanel as ToolsPanel,
|
|
63
|
+
* __experimentalToolsPanelItem as ToolsPanelItem,
|
|
64
|
+
* __experimentalUnitControl as UnitControl
|
|
65
|
+
* } from '@wordpress/components';
|
|
66
|
+
*
|
|
67
|
+
* function Example() {
|
|
68
|
+
* const [ height, setHeight ] = useState();
|
|
69
|
+
* const [ width, setWidth ] = useState();
|
|
70
|
+
*
|
|
71
|
+
* const resetAll = () => {
|
|
72
|
+
* setHeight();
|
|
73
|
+
* setWidth();
|
|
74
|
+
* }
|
|
75
|
+
*
|
|
76
|
+
* return (
|
|
77
|
+
* <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>
|
|
78
|
+
* <ToolsPanelItem
|
|
79
|
+
* hasValue={ () => !! height }
|
|
80
|
+
* label={ __( 'Height' ) }
|
|
81
|
+
* onDeselect={ () => setHeight() }
|
|
82
|
+
* >
|
|
83
|
+
* <UnitControl
|
|
84
|
+
* label={ __( 'Height' ) }
|
|
85
|
+
* onChange={ setHeight }
|
|
86
|
+
* value={ height }
|
|
87
|
+
* />
|
|
88
|
+
* </ToolsPanelItem>
|
|
89
|
+
* <ToolsPanelItem
|
|
90
|
+
* hasValue={ () => !! width }
|
|
91
|
+
* label={ __( 'Width' ) }
|
|
92
|
+
* onDeselect={ () => setWidth() }
|
|
93
|
+
* >
|
|
94
|
+
* <UnitControl
|
|
95
|
+
* label={ __( 'Width' ) }
|
|
96
|
+
* onChange={ setWidth }
|
|
97
|
+
* value={ width }
|
|
98
|
+
* />
|
|
99
|
+
* </ToolsPanelItem>
|
|
100
|
+
* </ToolsPanel>
|
|
101
|
+
* );
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
|
|
51
106
|
|
|
52
|
-
const
|
|
53
|
-
|
|
107
|
+
const ToolsPanel = (0, _context2.contextConnect)(UnconnectedToolsPanel, 'ToolsPanel');
|
|
108
|
+
exports.ToolsPanel = ToolsPanel;
|
|
109
|
+
var _default = ToolsPanel;
|
|
54
110
|
exports.default = _default;
|
|
55
111
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/component.tsx"],"names":["UnconnectedToolsPanel","props","forwardedRef","children","label","panelContext","resetAllItems","toggleItem","headingLevel","toolsPanelProps","ToolsPanel"],"mappings":";;;;;;;;;;;;;AAQA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;AAQA,MAAMA,qBAAqB,GAAG,CAC7BC,KAD6B,EAE7BC,YAF6B,KAGzB;AACJ,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,KAFK;AAGLC,IAAAA,YAHK;AAILC,IAAAA,aAJK;AAKLC,IAAAA,UALK;AAMLC,IAAAA,YANK;AAOL,OAAGC;AAPE,MAQF,yBAAeR,KAAf,CARJ;AAUA,SACC,4BAAC,UAAD,6BAAWQ,eAAX;AAA6B,IAAA,OAAO,EAAG,CAAvC;AAA2C,IAAA,GAAG,EAAGP;AAAjD,MACC,4BAAC,0BAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGG;AAApC,KACC,4BAAC,yBAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,QAAQ,EAAGE,aAFZ;AAGC,IAAA,UAAU,EAAGC,UAHd;AAIC,IAAA,YAAY,EAAGC;AAJhB,IADD,EAOGL,QAPH,CADD,CADD;AAaA,CA3BD;AA6BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMO,UAAU,GAAG,8BAAgBV,qBAAhB,EAAuC,YAAvC,CAAnB;;eAEQU,U","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\n\n/**\n * Internal dependencies\n */\nimport ToolsPanelHeader from '../tools-panel-header';\nimport { ToolsPanelContext } from '../context';\nimport { useToolsPanel } from './hook';\nimport { Grid } from '../../grid';\nimport { contextConnect, WordPressComponentProps } from '../../ui/context';\nimport type { ToolsPanelProps } from '../types';\n\nconst UnconnectedToolsPanel = (\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >,\n\tforwardedRef: ForwardedRef< any >\n) => {\n\tconst {\n\t\tchildren,\n\t\tlabel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\theadingLevel,\n\t\t...toolsPanelProps\n\t} = useToolsPanel( props );\n\n\treturn (\n\t\t<Grid { ...toolsPanelProps } columns={ 2 } ref={ forwardedRef }>\n\t\t\t<ToolsPanelContext.Provider value={ panelContext }>\n\t\t\t\t<ToolsPanelHeader\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tresetAll={ resetAllItems }\n\t\t\t\t\ttoggleItem={ toggleItem }\n\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</ToolsPanelContext.Provider>\n\t\t</Grid>\n\t);\n};\n\n/**\n * The `ToolsPanel` is a container component that displays its children preceded\n * by a header. The header includes a dropdown menu which is automatically\n * generated from the panel's inner `ToolsPanelItems`.\n *\n * @example\n * ```jsx\n * import { __ } from '@wordpress/i18n';\n * import {\n * __experimentalToolsPanel as ToolsPanel,\n * __experimentalToolsPanelItem as ToolsPanelItem,\n * __experimentalUnitControl as UnitControl\n * } from '@wordpress/components';\n *\n * function Example() {\n * const [ height, setHeight ] = useState();\n * const [ width, setWidth ] = useState();\n *\n * const resetAll = () => {\n * setHeight();\n * setWidth();\n * }\n *\n * return (\n * <ToolsPanel label={ __( 'Dimensions' ) } resetAll={ resetAll }>\n * <ToolsPanelItem\n * hasValue={ () => !! height }\n * label={ __( 'Height' ) }\n * onDeselect={ () => setHeight() }\n * >\n * <UnitControl\n * label={ __( 'Height' ) }\n * onChange={ setHeight }\n * value={ height }\n * />\n * </ToolsPanelItem>\n * <ToolsPanelItem\n * hasValue={ () => !! width }\n * label={ __( 'Width' ) }\n * onDeselect={ () => setWidth() }\n * >\n * <UnitControl\n * label={ __( 'Width' ) }\n * onChange={ setWidth }\n * value={ width }\n * />\n * </ToolsPanelItem>\n * </ToolsPanel>\n * );\n * }\n * ```\n */\nexport const ToolsPanel = contextConnect( UnconnectedToolsPanel, 'ToolsPanel' );\n\nexport default ToolsPanel;\n"]}
|
|
@@ -60,10 +60,11 @@ const isMenuItemTypeEmpty = obj => obj && Object.keys(obj).length === 0;
|
|
|
60
60
|
function useToolsPanel(props) {
|
|
61
61
|
const {
|
|
62
62
|
className,
|
|
63
|
+
headingLevel = 2,
|
|
63
64
|
resetAll,
|
|
64
65
|
panelId,
|
|
65
|
-
hasInnerWrapper,
|
|
66
|
-
shouldRenderPlaceholderItems,
|
|
66
|
+
hasInnerWrapper = false,
|
|
67
|
+
shouldRenderPlaceholderItems = false,
|
|
67
68
|
__experimentalFirstVisibleItemClass,
|
|
68
69
|
__experimentalLastVisibleItemClass,
|
|
69
70
|
...otherProps
|
|
@@ -81,6 +82,7 @@ function useToolsPanel(props) {
|
|
|
81
82
|
}, [wasResetting]); // Allow panel items to register themselves.
|
|
82
83
|
|
|
83
84
|
const [panelItems, setPanelItems] = (0, _element.useState)([]);
|
|
85
|
+
const [resetAllFilters, setResetAllFilters] = (0, _element.useState)([]);
|
|
84
86
|
const registerPanelItem = (0, _element.useCallback)(item => {
|
|
85
87
|
setPanelItems(items => {
|
|
86
88
|
const newItems = [...items]; // If an item with this label has already been registered, remove it
|
|
@@ -113,7 +115,17 @@ function useToolsPanel(props) {
|
|
|
113
115
|
|
|
114
116
|
return newItems;
|
|
115
117
|
});
|
|
116
|
-
}, [setPanelItems]);
|
|
118
|
+
}, [setPanelItems]);
|
|
119
|
+
const registerResetAllFilter = (0, _element.useCallback)(newFilter => {
|
|
120
|
+
setResetAllFilters(filters => {
|
|
121
|
+
return [...filters, newFilter];
|
|
122
|
+
});
|
|
123
|
+
}, [setResetAllFilters]);
|
|
124
|
+
const deregisterResetAllFilter = (0, _element.useCallback)(filterToRemove => {
|
|
125
|
+
setResetAllFilters(filters => {
|
|
126
|
+
return filters.filter(filter => filter !== filterToRemove);
|
|
127
|
+
});
|
|
128
|
+
}, [setResetAllFilters]); // Manage and share display state of menu items representing child controls.
|
|
117
129
|
|
|
118
130
|
const [menuItems, setMenuItems] = (0, _element.useState)({
|
|
119
131
|
default: {},
|
|
@@ -185,15 +197,8 @@ function useToolsPanel(props) {
|
|
|
185
197
|
|
|
186
198
|
const resetAllItems = (0, _element.useCallback)(() => {
|
|
187
199
|
if (typeof resetAll === 'function') {
|
|
188
|
-
isResetting.current = true;
|
|
189
|
-
|
|
190
|
-
const filters = [];
|
|
191
|
-
panelItems.forEach(item => {
|
|
192
|
-
if (item.resetAllFilter) {
|
|
193
|
-
filters.push(item.resetAllFilter);
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
resetAll(filters);
|
|
200
|
+
isResetting.current = true;
|
|
201
|
+
resetAll(resetAllFilters);
|
|
197
202
|
} // Turn off display of all non-default items.
|
|
198
203
|
|
|
199
204
|
|
|
@@ -202,7 +207,7 @@ function useToolsPanel(props) {
|
|
|
202
207
|
shouldReset: true
|
|
203
208
|
});
|
|
204
209
|
setMenuItems(resetMenuItems);
|
|
205
|
-
}, [panelItems, resetAll, setMenuItems]); // Assist ItemGroup styling when there are potentially hidden placeholder
|
|
210
|
+
}, [panelItems, resetAllFilters, resetAll, setMenuItems]); // Assist ItemGroup styling when there are potentially hidden placeholder
|
|
206
211
|
// items by identifying first & last items that are toggled on for display.
|
|
207
212
|
|
|
208
213
|
const getFirstVisibleItemLabel = items => {
|
|
@@ -216,6 +221,7 @@ function useToolsPanel(props) {
|
|
|
216
221
|
const panelContext = (0, _element.useMemo)(() => ({
|
|
217
222
|
areAllOptionalControlsHidden,
|
|
218
223
|
deregisterPanelItem,
|
|
224
|
+
deregisterResetAllFilter,
|
|
219
225
|
firstDisplayedItem,
|
|
220
226
|
flagItemCustomization,
|
|
221
227
|
hasMenuItems: !!panelItems.length,
|
|
@@ -224,11 +230,13 @@ function useToolsPanel(props) {
|
|
|
224
230
|
menuItems,
|
|
225
231
|
panelId,
|
|
226
232
|
registerPanelItem,
|
|
233
|
+
registerResetAllFilter,
|
|
227
234
|
shouldRenderPlaceholderItems,
|
|
228
235
|
__experimentalFirstVisibleItemClass,
|
|
229
236
|
__experimentalLastVisibleItemClass
|
|
230
|
-
}), [areAllOptionalControlsHidden, deregisterPanelItem, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, panelItems, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
|
|
237
|
+
}), [areAllOptionalControlsHidden, deregisterPanelItem, deregisterResetAllFilter, firstDisplayedItem, flagItemCustomization, lastDisplayedItem, menuItems, panelId, panelItems, registerResetAllFilter, registerPanelItem, shouldRenderPlaceholderItems, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass]);
|
|
231
238
|
return { ...otherProps,
|
|
239
|
+
headingLevel,
|
|
232
240
|
panelContext,
|
|
233
241
|
resetAllItems,
|
|
234
242
|
toggleItem,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","isMenuItemTypeEmpty","obj","Object","keys","length","useToolsPanel","props","className","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","styles","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","resetAllItems","filters","resetAllFilter","push","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"mappings":";;;;;;;AAGA;;AAWA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAYA,MAAMA,eAAe,GAAG,CAAxB;;AAEA,MAAMC,iBAAiB,GAAG,QAIQ;AAAA,MAJN;AAC3BC,IAAAA,UAD2B;AAE3BC,IAAAA,WAF2B;AAG3BC,IAAAA;AAH2B,GAIM;AACjC,QAAMC,SAA8B,GAAG;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAAvC;AAEAL,EAAAA,UAAU,CAACM,OAAX,CAAoB,SAA6C;AAAA;;AAAA,QAA3C;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,gBAAZ;AAA8BC,MAAAA;AAA9B,KAA2C;AAChE,UAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAH,GAAe,UAA7C,CADgE,CAGhE;AACA;AACA;;AACA,UAAMG,iBAAiB,GAAGT,gBAAH,aAAGA,gBAAH,gDAAGA,gBAAgB,CAAIQ,KAAJ,CAAnB,0DAAG,sBAA+BD,KAA/B,CAA1B;AACA,UAAMG,KAAK,GAAGD,iBAAiB,GAAGA,iBAAH,GAAuBJ,QAAQ,EAA9D;AAEAJ,IAAAA,SAAS,CAAEO,KAAF,CAAT,CAAoBD,KAApB,IAA8BR,WAAW,GAAG,KAAH,GAAWW,KAApD;AACA,GAVD;AAYA,SAAOT,SAAP;AACA,CApBD;;AAsBA,MAAMU,mBAAmB,GACxBC,G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Content":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper,\n\t\tshouldRenderPlaceholderItems,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\n\t\t\t// Collect available reset filters from panel items.\n\t\t\tconst filters: Array< () => void > = [];\n\t\t\tpanelItems.forEach( ( item ) => {\n\t\t\t\tif ( item.resetAllFilter ) {\n\t\t\t\t\tfilters.push( item.resetAllFilter );\n\t\t\t\t}\n\t\t\t} );\n\n\t\t\tresetAll( filters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAll, setMenuItems ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/components/src/tools-panel/tools-panel/hook.ts"],"names":["DEFAULT_COLUMNS","generateMenuItems","panelItems","shouldReset","currentMenuItems","menuItems","default","optional","forEach","hasValue","isShownByDefault","label","group","existingItemValue","value","isMenuItemTypeEmpty","obj","Object","keys","length","useToolsPanel","props","className","headingLevel","resetAll","panelId","hasInnerWrapper","shouldRenderPlaceholderItems","__experimentalFirstVisibleItemClass","__experimentalLastVisibleItemClass","otherProps","isResetting","wasResetting","current","setPanelItems","resetAllFilters","setResetAllFilters","registerPanelItem","item","items","newItems","existingIndex","findIndex","oldItem","splice","deregisterPanelItem","index","registerResetAllFilter","newFilter","filters","deregisterResetAllFilter","filterToRemove","filter","setMenuItems","prevState","flagItemCustomization","newState","areAllOptionalControlsHidden","setAreAllOptionalControlsHidden","allControlsHidden","entries","some","isSelected","cx","classes","wrapperStyle","styles","ToolsPanelWithInnerWrapper","emptyStyle","ToolsPanelHiddenInnerWrapper","ToolsPanel","toggleItem","currentItem","find","menuGroup","newMenuItems","resetAllItems","resetMenuItems","getFirstVisibleItemLabel","optionalItems","firstItem","firstDisplayedItem","lastDisplayedItem","reverse","panelContext","hasMenuItems"],"mappings":";;;;;;;AAGA;;AAWA;;AACA;;AACA;;;;;;AAhBA;AACA;AACA;;AASA;AACA;AACA;AAaA,MAAMA,eAAe,GAAG,CAAxB;;AAEA,MAAMC,iBAAiB,GAAG,QAIQ;AAAA,MAJN;AAC3BC,IAAAA,UAD2B;AAE3BC,IAAAA,WAF2B;AAG3BC,IAAAA;AAH2B,GAIM;AACjC,QAAMC,SAA8B,GAAG;AAAEC,IAAAA,OAAO,EAAE,EAAX;AAAeC,IAAAA,QAAQ,EAAE;AAAzB,GAAvC;AAEAL,EAAAA,UAAU,CAACM,OAAX,CAAoB,SAA6C;AAAA;;AAAA,QAA3C;AAAEC,MAAAA,QAAF;AAAYC,MAAAA,gBAAZ;AAA8BC,MAAAA;AAA9B,KAA2C;AAChE,UAAMC,KAAK,GAAGF,gBAAgB,GAAG,SAAH,GAAe,UAA7C,CAD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E,UAAL,EAAkBiF,OAAlB,EADiD,CAAlD;AAIA,QAAMC,YAAY,GAAG,sBACpB,OAAQ;AACP3B,IAAAA,4BADO;AAEPZ,IAAAA,mBAFO;AAGPK,IAAAA,wBAHO;AAIP+B,IAAAA,kBAJO;AAKP1B,IAAAA,qBALO;AAMP8B,IAAAA,YAAY,EAAE,CAAC,CAAEnF,UAAU,CAACiB,MANrB;AAOPY,IAAAA,WAAW,EAAEA,WAAW,CAACE,OAPlB;AAQPiD,IAAAA,iBARO;AASP7E,IAAAA,SATO;AAUPoB,IAAAA,OAVO;AAWPY,IAAAA,iBAXO;AAYPU,IAAAA,sBAZO;AAaPpB,IAAAA,4BAbO;AAcPC,IAAAA,mCAdO;AAePC,IAAAA;AAfO,GAAR,CADoB,EAkBpB,CACC4B,4BADD,EAECZ,mBAFD,EAGCK,wBAHD,EAIC+B,kBAJD,EAKC1B,qBALD,EAMC2B,iBAND,EAOC7E,SAPD,EAQCoB,OARD,EASCvB,UATD,EAUC6C,sBAVD,EAWCV,iBAXD,EAYCV,4BAZD,EAaCC,mCAbD,EAcCC,kCAdD,CAlBoB,CAArB;AAoCA,SAAO,EACN,GAAGC,UADG;AAENP,IAAAA,YAFM;AAGN6D,IAAAA,YAHM;AAINR,IAAAA,aAJM;AAKNL,IAAAA,UALM;AAMNjD,IAAAA,SAAS,EAAE0C;AANL,GAAP;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport * as styles from '../styles';\nimport { useContextSystem, WordPressComponentProps } from '../../ui/context';\nimport { useCx } from '../../utils/hooks/use-cx';\nimport type {\n\tToolsPanelItem,\n\tToolsPanelMenuItemKey,\n\tToolsPanelMenuItems,\n\tToolsPanelMenuItemsConfig,\n\tToolsPanelProps,\n\tResetAllFilter,\n} from '../types';\n\nconst DEFAULT_COLUMNS = 2;\n\nconst generateMenuItems = ( {\n\tpanelItems,\n\tshouldReset,\n\tcurrentMenuItems,\n}: ToolsPanelMenuItemsConfig ) => {\n\tconst menuItems: ToolsPanelMenuItems = { default: {}, optional: {} };\n\n\tpanelItems.forEach( ( { hasValue, isShownByDefault, label } ) => {\n\t\tconst group = isShownByDefault ? 'default' : 'optional';\n\n\t\t// If a menu item for this label has already been flagged as customized\n\t\t// (for default controls), or toggled on (for optional controls), do not\n\t\t// overwrite its value as those controls would lose that state.\n\t\tconst existingItemValue = currentMenuItems?.[ group ]?.[ label ];\n\t\tconst value = existingItemValue ? existingItemValue : hasValue();\n\n\t\tmenuItems[ group ][ label ] = shouldReset ? false : value;\n\t} );\n\n\treturn menuItems;\n};\n\nconst isMenuItemTypeEmpty = (\n\tobj?: ToolsPanelMenuItems[ ToolsPanelMenuItemKey ]\n) => obj && Object.keys( obj ).length === 0;\n\nexport function useToolsPanel(\n\tprops: WordPressComponentProps< ToolsPanelProps, 'div' >\n) {\n\tconst {\n\t\tclassName,\n\t\theadingLevel = 2,\n\t\tresetAll,\n\t\tpanelId,\n\t\thasInnerWrapper = false,\n\t\tshouldRenderPlaceholderItems = false,\n\t\t__experimentalFirstVisibleItemClass,\n\t\t__experimentalLastVisibleItemClass,\n\t\t...otherProps\n\t} = useContextSystem( props, 'ToolsPanel' );\n\n\tconst isResetting = useRef( false );\n\tconst wasResetting = isResetting.current;\n\n\t// `isResetting` is cleared via this hook to effectively batch together\n\t// the resetAll task. Without this, the flag is cleared after the first\n\t// control updates and forces a rerender with subsequent controls then\n\t// believing they need to reset, unfortunately using stale data.\n\tuseEffect( () => {\n\t\tif ( wasResetting ) {\n\t\t\tisResetting.current = false;\n\t\t}\n\t}, [ wasResetting ] );\n\n\t// Allow panel items to register themselves.\n\tconst [ panelItems, setPanelItems ] = useState< ToolsPanelItem[] >( [] );\n\tconst [ resetAllFilters, setResetAllFilters ] = useState<\n\t\tResetAllFilter[]\n\t>( [] );\n\n\tconst registerPanelItem = useCallback(\n\t\t( item: ToolsPanelItem ) => {\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\t// If an item with this label has already been registered, remove it\n\t\t\t\t// first. This can happen when an item is moved between the default\n\t\t\t\t// and optional groups.\n\t\t\t\tconst existingIndex = newItems.findIndex(\n\t\t\t\t\t( oldItem ) => oldItem.label === item.label\n\t\t\t\t);\n\t\t\t\tif ( existingIndex !== -1 ) {\n\t\t\t\t\tnewItems.splice( existingIndex, 1 );\n\t\t\t\t}\n\t\t\t\treturn [ ...newItems, item ];\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\t// Panels need to deregister on unmount to avoid orphans in menu state.\n\t// This is an issue when panel items are being injected via SlotFills.\n\tconst deregisterPanelItem = useCallback(\n\t\t( label: string ) => {\n\t\t\t// When switching selections between components injecting matching\n\t\t\t// controls, e.g. both panels have a \"padding\" control, the\n\t\t\t// deregistration of the first panel doesn't occur until after the\n\t\t\t// registration of the next.\n\t\t\tsetPanelItems( ( items ) => {\n\t\t\t\tconst newItems = [ ...items ];\n\t\t\t\tconst index = newItems.findIndex(\n\t\t\t\t\t( item ) => item.label === label\n\t\t\t\t);\n\t\t\t\tif ( index !== -1 ) {\n\t\t\t\t\tnewItems.splice( index, 1 );\n\t\t\t\t}\n\t\t\t\treturn newItems;\n\t\t\t} );\n\t\t},\n\t\t[ setPanelItems ]\n\t);\n\n\tconst registerResetAllFilter = useCallback(\n\t\t( newFilter: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn [ ...filters, newFilter ];\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\tconst deregisterResetAllFilter = useCallback(\n\t\t( filterToRemove: ResetAllFilter ) => {\n\t\t\tsetResetAllFilters( ( filters ) => {\n\t\t\t\treturn filters.filter(\n\t\t\t\t\t( filter ) => filter !== filterToRemove\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t[ setResetAllFilters ]\n\t);\n\n\t// Manage and share display state of menu items representing child controls.\n\tconst [ menuItems, setMenuItems ] = useState< ToolsPanelMenuItems >( {\n\t\tdefault: {},\n\t\toptional: {},\n\t} );\n\n\t// Setup menuItems state as panel items register themselves.\n\tuseEffect( () => {\n\t\tsetMenuItems( ( prevState ) => {\n\t\t\tconst items = generateMenuItems( {\n\t\t\t\tpanelItems,\n\t\t\t\tshouldReset: false,\n\t\t\t\tcurrentMenuItems: prevState,\n\t\t\t} );\n\t\t\treturn items;\n\t\t} );\n\t}, [ panelItems, setMenuItems ] );\n\n\t// Force a menu item to be checked.\n\t// This is intended for use with default panel items. They are displayed\n\t// separately to optional items and have different display states,\n\t// we need to update that when their value is customized.\n\tconst flagItemCustomization = useCallback(\n\t\t( label: string, group: ToolsPanelMenuItemKey = 'default' ) => {\n\t\t\tsetMenuItems( ( items ) => {\n\t\t\t\tconst newState = {\n\t\t\t\t\t...items,\n\t\t\t\t\t[ group ]: {\n\t\t\t\t\t\t...items[ group ],\n\t\t\t\t\t\t[ label ]: true,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn newState;\n\t\t\t} );\n\t\t},\n\t\t[ setMenuItems ]\n\t);\n\n\t// Whether all optional menu items are hidden or not must be tracked\n\t// in order to later determine if the panel display is empty and handle\n\t// conditional display of a plus icon to indicate the presence of further\n\t// menu items.\n\tconst [ areAllOptionalControlsHidden, setAreAllOptionalControlsHidden ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\t! isMenuItemTypeEmpty( menuItems?.optional )\n\t\t) {\n\t\t\tconst allControlsHidden = ! Object.entries(\n\t\t\t\tmenuItems.optional\n\t\t\t).some( ( [ , isSelected ] ) => isSelected );\n\t\t\tsetAreAllOptionalControlsHidden( allControlsHidden );\n\t\t}\n\t}, [ menuItems, setAreAllOptionalControlsHidden ] );\n\n\tconst cx = useCx();\n\tconst classes = useMemo( () => {\n\t\tconst wrapperStyle =\n\t\t\thasInnerWrapper &&\n\t\t\tstyles.ToolsPanelWithInnerWrapper( DEFAULT_COLUMNS );\n\t\tconst emptyStyle =\n\t\t\tisMenuItemTypeEmpty( menuItems?.default ) &&\n\t\t\tareAllOptionalControlsHidden &&\n\t\t\tstyles.ToolsPanelHiddenInnerWrapper;\n\n\t\treturn cx(\n\t\t\tstyles.ToolsPanel( DEFAULT_COLUMNS ),\n\t\t\twrapperStyle,\n\t\t\temptyStyle,\n\t\t\tclassName\n\t\t);\n\t}, [\n\t\tareAllOptionalControlsHidden,\n\t\tclassName,\n\t\tcx,\n\t\thasInnerWrapper,\n\t\tmenuItems,\n\t] );\n\n\t// Toggle the checked state of a menu item which is then used to determine\n\t// display of the item within the panel.\n\tconst toggleItem = useCallback(\n\t\t( label: string ) => {\n\t\t\tconst currentItem = panelItems.find(\n\t\t\t\t( item ) => item.label === label\n\t\t\t);\n\n\t\t\tif ( ! currentItem ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst menuGroup = currentItem.isShownByDefault\n\t\t\t\t? 'default'\n\t\t\t\t: 'optional';\n\n\t\t\tconst newMenuItems = {\n\t\t\t\t...menuItems,\n\t\t\t\t[ menuGroup ]: {\n\t\t\t\t\t...menuItems[ menuGroup ],\n\t\t\t\t\t[ label ]: ! menuItems[ menuGroup ][ label ],\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tsetMenuItems( newMenuItems );\n\t\t},\n\t\t[ menuItems, panelItems, setMenuItems ]\n\t);\n\n\t// Resets display of children and executes resetAll callback if available.\n\tconst resetAllItems = useCallback( () => {\n\t\tif ( typeof resetAll === 'function' ) {\n\t\t\tisResetting.current = true;\n\t\t\tresetAll( resetAllFilters );\n\t\t}\n\n\t\t// Turn off display of all non-default items.\n\t\tconst resetMenuItems = generateMenuItems( {\n\t\t\tpanelItems,\n\t\t\tshouldReset: true,\n\t\t} );\n\t\tsetMenuItems( resetMenuItems );\n\t}, [ panelItems, resetAllFilters, resetAll, setMenuItems ] );\n\n\t// Assist ItemGroup styling when there are potentially hidden placeholder\n\t// items by identifying first & last items that are toggled on for display.\n\tconst getFirstVisibleItemLabel = ( items: ToolsPanelItem[] ) => {\n\t\tconst optionalItems = menuItems.optional || {};\n\t\tconst firstItem = items.find(\n\t\t\t( item ) => item.isShownByDefault || !! optionalItems[ item.label ]\n\t\t);\n\n\t\treturn firstItem?.label;\n\t};\n\n\tconst firstDisplayedItem = getFirstVisibleItemLabel( panelItems );\n\tconst lastDisplayedItem = getFirstVisibleItemLabel(\n\t\t[ ...panelItems ].reverse()\n\t);\n\n\tconst panelContext = useMemo(\n\t\t() => ( {\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\thasMenuItems: !! panelItems.length,\n\t\t\tisResetting: isResetting.current,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tregisterPanelItem,\n\t\t\tregisterResetAllFilter,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t} ),\n\t\t[\n\t\t\tareAllOptionalControlsHidden,\n\t\t\tderegisterPanelItem,\n\t\t\tderegisterResetAllFilter,\n\t\t\tfirstDisplayedItem,\n\t\t\tflagItemCustomization,\n\t\t\tlastDisplayedItem,\n\t\t\tmenuItems,\n\t\t\tpanelId,\n\t\t\tpanelItems,\n\t\t\tregisterResetAllFilter,\n\t\t\tregisterPanelItem,\n\t\t\tshouldRenderPlaceholderItems,\n\t\t\t__experimentalFirstVisibleItemClass,\n\t\t\t__experimentalLastVisibleItemClass,\n\t\t]\n\t);\n\n\treturn {\n\t\t...otherProps,\n\t\theadingLevel,\n\t\tpanelContext,\n\t\tresetAllItems,\n\t\ttoggleItem,\n\t\tclassName: classes,\n\t};\n}\n"]}
|
|
@@ -134,6 +134,7 @@ const ToolsPanelHeader = (props, forwardedRef) => {
|
|
|
134
134
|
dropdownMenuClassName,
|
|
135
135
|
hasMenuItems,
|
|
136
136
|
headingClassName,
|
|
137
|
+
headingLevel = 2,
|
|
137
138
|
label: labelText,
|
|
138
139
|
menuItems,
|
|
139
140
|
resetAll,
|
|
@@ -158,7 +159,7 @@ const ToolsPanelHeader = (props, forwardedRef) => {
|
|
|
158
159
|
return (0, _element.createElement)(_hStack.HStack, (0, _extends2.default)({}, headerProps, {
|
|
159
160
|
ref: forwardedRef
|
|
160
161
|
}), (0, _element.createElement)(_heading.Heading, {
|
|
161
|
-
level:
|
|
162
|
+
level: headingLevel,
|
|
162
163
|
className: headingClassName
|
|
163
164
|
}, labelText), hasMenuItems && (0, _element.createElement)(_dropdownMenu.default, {
|
|
164
165
|
icon: dropDownMenuIcon,
|