@wordpress/components 28.5.0 → 28.6.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 +82 -0
- package/CONTRIBUTING.md +155 -64
- package/build/alignment-matrix-control/cell.js +2 -2
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/index.js +6 -5
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -17
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/base-control/index.js +54 -41
- package/build/base-control/index.js.map +1 -1
- package/build/base-control/types.js.map +1 -1
- package/build/border-control/styles.js +13 -13
- package/build/border-control/styles.js.map +1 -1
- package/build/checkbox-control/index.js +1 -0
- package/build/checkbox-control/index.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +4 -4
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +3 -3
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/circular-option-picker/types.js.map +1 -1
- package/build/color-palette/utils.js +17 -5
- package/build/color-palette/utils.js.map +1 -1
- package/build/color-picker/input-with-slider.js +1 -0
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/combobox-control/index.js +1 -0
- package/build/combobox-control/index.js.map +1 -1
- package/build/composite/context.js +19 -0
- package/build/composite/context.js.map +1 -0
- package/build/composite/index.js +287 -9
- package/build/composite/index.js.map +1 -1
- package/build/composite/legacy/index.js +10 -8
- package/build/composite/legacy/index.js.map +1 -1
- package/build/composite/types.js +6 -0
- package/build/composite/types.js.map +1 -0
- package/build/custom-select-control/types.js.map +1 -1
- package/build/custom-select-control-v2/custom-select.js +3 -2
- package/build/custom-select-control-v2/custom-select.js.map +1 -1
- package/build/date-time/time/index.js +11 -3
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/types.js.map +1 -1
- package/build/dimension-control/index.js +25 -8
- package/build/dimension-control/index.js.map +1 -1
- package/build/dimension-control/types.js.map +1 -1
- package/build/dropdown-menu-v2/index.js +3 -2
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/styles.js +23 -21
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/focal-point-picker/controls.js +1 -3
- package/build/focal-point-picker/controls.js.map +1 -1
- package/build/focal-point-picker/index.js +1 -2
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/types.js.map +1 -1
- package/build/form-file-upload/types.js.map +1 -1
- package/build/index.js +5 -5
- package/build/index.js.map +1 -1
- package/build/item-group/styles.js +11 -11
- package/build/item-group/styles.js.map +1 -1
- package/build/mobile/utils/alignments.native.js +1 -1
- package/build/mobile/utils/alignments.native.js.map +1 -1
- package/build/navigator/navigator-back-button/component.js +1 -1
- package/build/navigator/navigator-back-button/component.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +3 -9
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +17 -9
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-to-parent-button/component.js +13 -40
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/navigator/types.js.map +1 -1
- package/build/palette-edit/styles.js +11 -11
- package/build/palette-edit/styles.js.map +1 -1
- package/build/popover/index.js +6 -1
- package/build/popover/index.js.map +1 -1
- package/build/private-apis.js +6 -6
- package/build/private-apis.js.map +1 -1
- package/build/progress-bar/styles.js +5 -5
- package/build/progress-bar/styles.js.map +1 -1
- package/build/query-controls/index.js +5 -6
- package/build/query-controls/index.js.map +1 -1
- package/build/query-controls/types.js.map +1 -1
- package/build/radio-control/index.js +20 -19
- package/build/radio-control/index.js.map +1 -1
- package/build/radio-group/radio.js +3 -2
- package/build/radio-group/radio.js.map +1 -1
- package/build/range-control/index.js +32 -9
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +29 -29
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/search-control/index.js +5 -4
- package/build/search-control/index.js.map +1 -1
- package/build/select-control/index.js +1 -0
- package/build/select-control/index.js.map +1 -1
- package/build/tab-panel/index.js +3 -2
- package/build/tab-panel/index.js.map +1 -1
- package/build/tabs/index.js +3 -2
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/tablist.js +6 -4
- package/build/tabs/tablist.js.map +1 -1
- package/build/tabs/tabpanel.js +6 -1
- package/build/tabs/tabpanel.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/text-control/index.js +1 -0
- package/build/text-control/index.js.map +1 -1
- package/build/textarea-control/index.js +1 -0
- package/build/textarea-control/index.js.map +1 -1
- package/build/textarea-control/styles/textarea-control-styles.js +8 -2
- package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build/toggle-control/index.js +9 -1
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js +3 -2
- package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tools-panel/styles.js +13 -13
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tooltip/index.js +3 -2
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js +19 -6
- package/build/tree-select/index.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +7 -7
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/config-values.js +4 -3
- package/build/utils/config-values.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +2 -2
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +4 -3
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -18
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/base-control/index.js +54 -42
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/types.js.map +1 -1
- package/build-module/border-control/styles.js +13 -13
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/checkbox-control/index.js +1 -0
- package/build-module/checkbox-control/index.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +4 -4
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/circular-option-picker/types.js.map +1 -1
- package/build-module/color-palette/utils.js +17 -5
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +1 -0
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/combobox-control/index.js +1 -0
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/composite/context.js +12 -0
- package/build-module/composite/context.js.map +1 -0
- package/build-module/composite/index.js +284 -6
- package/build-module/composite/index.js.map +1 -1
- package/build-module/composite/legacy/index.js +10 -6
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/composite/types.js +2 -0
- package/build-module/composite/types.js.map +1 -0
- package/build-module/custom-select-control/types.js.map +1 -1
- package/build-module/custom-select-control-v2/custom-select.js +2 -1
- package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
- package/build-module/date-time/time/index.js +11 -3
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/types.js.map +1 -1
- package/build-module/dimension-control/index.js +25 -8
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/dimension-control/types.js.map +1 -1
- package/build-module/dropdown-menu-v2/index.js +2 -1
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/styles.js +23 -21
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/focal-point-picker/controls.js +1 -3
- package/build-module/focal-point-picker/controls.js.map +1 -1
- package/build-module/focal-point-picker/index.js +1 -2
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/types.js.map +1 -1
- package/build-module/form-file-upload/types.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/item-group/styles.js +11 -11
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/mobile/utils/alignments.native.js +1 -1
- package/build-module/mobile/utils/alignments.native.js.map +1 -1
- package/build-module/navigator/navigator-back-button/component.js +1 -1
- package/build-module/navigator/navigator-back-button/component.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +3 -9
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +17 -9
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-to-parent-button/component.js +12 -41
- package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build-module/navigator/types.js.map +1 -1
- package/build-module/palette-edit/styles.js +11 -11
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/popover/index.js +6 -1
- package/build-module/popover/index.js.map +1 -1
- package/build-module/private-apis.js +6 -6
- package/build-module/private-apis.js.map +1 -1
- package/build-module/progress-bar/styles.js +5 -5
- package/build-module/progress-bar/styles.js.map +1 -1
- package/build-module/query-controls/index.js +5 -6
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/query-controls/types.js.map +1 -1
- package/build-module/radio-control/index.js +20 -19
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/radio-group/radio.js +2 -1
- package/build-module/radio-group/radio.js.map +1 -1
- package/build-module/range-control/index.js +32 -9
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +29 -29
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/search-control/index.js +5 -4
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/select-control/index.js +1 -0
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -1
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tabs/index.js +2 -1
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/tablist.js +5 -3
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/tabs/tabpanel.js +6 -2
- package/build-module/tabs/tabpanel.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/text-control/index.js +1 -0
- package/build-module/text-control/index.js.map +1 -1
- package/build-module/textarea-control/index.js +1 -0
- package/build-module/textarea-control/index.js.map +1 -1
- package/build-module/textarea-control/styles/textarea-control-styles.js +9 -2
- package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
- package/build-module/toggle-control/index.js +9 -1
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +2 -1
- package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +1 -0
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +13 -13
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tooltip/index.js +2 -1
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js +19 -6
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +7 -7
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/config-values.js +4 -3
- package/build-module/utils/config-values.js.map +1 -1
- package/build-style/style-rtl.css +19 -9
- package/build-style/style.css +19 -9
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/base-control/hooks.d.ts +1 -0
- package/build-types/base-control/hooks.d.ts.map +1 -1
- package/build-types/base-control/index.d.ts +44 -0
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/types.d.ts +7 -0
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/checkbox-control/index.d.ts.map +1 -1
- package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +2 -3
- package/build-types/circular-option-picker/types.d.ts.map +1 -1
- package/build-types/color-palette/utils.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/combobox-control/index.d.ts.map +1 -1
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/context.d.ts +7 -0
- package/build-types/composite/context.d.ts.map +1 -0
- package/build-types/composite/index.d.ts +181 -1
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/composite/legacy/index.d.ts +7 -2
- package/build-types/composite/legacy/index.d.ts.map +1 -1
- package/build-types/composite/legacy/stories/utils.d.ts +19 -0
- package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
- package/build-types/composite/stories/index.story.d.ts +13 -0
- package/build-types/composite/stories/index.story.d.ts.map +1 -0
- package/build-types/composite/stories/utils.d.ts +29 -0
- package/build-types/composite/stories/utils.d.ts.map +1 -0
- package/build-types/composite/types.d.ts +288 -0
- package/build-types/composite/types.d.ts.map +1 -0
- package/build-types/custom-select-control/types.d.ts +3 -3
- package/build-types/custom-select-control/types.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/types.d.ts +7 -1
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -0
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +8 -1
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/dimension-control/types.d.ts +2 -7
- package/build-types/dimension-control/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/focal-point-picker/controls.d.ts +1 -1
- package/build-types/focal-point-picker/controls.d.ts.map +1 -1
- package/build-types/focal-point-picker/index.d.ts +1 -1
- package/build-types/focal-point-picker/index.d.ts.map +1 -1
- package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/focal-point-picker/types.d.ts +2 -2
- package/build-types/focal-point-picker/types.d.ts.map +1 -1
- package/build-types/form-file-upload/types.d.ts +6 -0
- package/build-types/form-file-upload/types.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -0
- package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +45 -9
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/query-controls/index.d.ts +1 -1
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/query-controls/types.d.ts +2 -1
- package/build-types/query-controls/types.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/radio-group/radio.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/stories/index.story.d.ts.map +1 -1
- package/build-types/search-control/index.d.ts.map +1 -1
- package/build-types/search-control/stories/index.story.d.ts.map +1 -1
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/stories/index.story.d.ts +4 -2
- package/build-types/select-control/stories/index.story.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/tabs/tabpanel.d.ts +0 -3
- package/build-types/tabs/tabpanel.d.ts.map +1 -1
- package/build-types/text-control/index.d.ts.map +1 -1
- package/build-types/text-control/stories/index.story.d.ts.map +1 -1
- package/build-types/textarea-control/index.d.ts.map +1 -1
- package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts.map +1 -1
- package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +4 -3
- package/package.json +20 -20
- package/src/alignment-matrix-control/cell.tsx +3 -3
- package/src/alignment-matrix-control/index.tsx +5 -4
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +2 -2
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +2 -2
- package/src/base-control/README.md +5 -2
- package/src/base-control/index.tsx +61 -41
- package/src/base-control/types.ts +7 -0
- package/src/border-box-control/border-box-control/README.md +7 -0
- package/src/border-control/border-control/README.md +7 -0
- package/src/border-control/styles.ts +1 -1
- package/src/button/README.md +7 -0
- package/src/button/style.scss +2 -2
- package/src/button-group/style.scss +2 -2
- package/src/checkbox-control/index.tsx +1 -0
- package/src/checkbox-control/stories/index.story.tsx +1 -0
- package/src/checkbox-control/test/index.tsx +8 -1
- package/src/circular-option-picker/circular-option-picker-option.tsx +8 -6
- package/src/circular-option-picker/circular-option-picker.tsx +1 -1
- package/src/circular-option-picker/style.scss +3 -3
- package/src/circular-option-picker/types.ts +2 -3
- package/src/color-indicator/style.scss +1 -1
- package/src/color-palette/style.scss +2 -2
- package/src/color-palette/utils.ts +23 -10
- package/src/color-picker/input-with-slider.tsx +1 -0
- package/src/combobox-control/README.md +8 -0
- package/src/combobox-control/index.tsx +1 -0
- package/src/combobox-control/stories/index.story.tsx +3 -4
- package/src/combobox-control/test/index.tsx +5 -1
- package/src/composite/README.md +325 -0
- package/src/composite/context.ts +14 -0
- package/src/composite/index.tsx +341 -0
- package/src/composite/legacy/index.tsx +15 -14
- package/src/composite/legacy/stories/utils.tsx +19 -0
- package/src/composite/stories/index.story.tsx +466 -0
- package/src/composite/{current/stories → stories}/utils.tsx +22 -7
- package/src/composite/types.ts +298 -0
- package/src/custom-gradient-picker/style.scss +2 -2
- package/src/custom-select-control/README.md +7 -0
- package/src/custom-select-control/test/index.tsx +125 -0
- package/src/custom-select-control/types.ts +3 -3
- package/src/custom-select-control-v2/custom-select.tsx +2 -1
- package/src/date-time/time/index.tsx +26 -12
- package/src/date-time/types.ts +11 -1
- package/src/dimension-control/README.md +17 -0
- package/src/dimension-control/index.tsx +26 -9
- package/src/dimension-control/stories/index.story.tsx +1 -0
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +0 -16
- package/src/dimension-control/test/index.test.js +5 -1
- package/src/dimension-control/types.ts +5 -7
- package/src/drop-zone/style.scss +1 -1
- package/src/dropdown-menu-v2/index.tsx +5 -3
- package/src/dropdown-menu-v2/styles.ts +17 -15
- package/src/focal-point-picker/README.md +9 -1
- package/src/focal-point-picker/controls.tsx +1 -3
- package/src/focal-point-picker/index.tsx +1 -2
- package/src/focal-point-picker/stories/index.story.tsx +3 -0
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
- package/src/focal-point-picker/test/index.tsx +5 -1
- package/src/focal-point-picker/types.ts +2 -2
- package/src/font-size-picker/README.md +7 -0
- package/src/form-file-upload/README.md +8 -0
- package/src/form-file-upload/types.ts +6 -0
- package/src/form-token-field/README.md +1 -0
- package/src/guide/style.scss +0 -1
- package/src/index.ts +1 -1
- package/src/input-control/README.md +8 -0
- package/src/item-group/styles.ts +1 -1
- package/src/mobile/utils/alignments.native.js +1 -0
- package/src/modal/style.scss +3 -3
- package/src/navigator/navigator-back-button/component.tsx +1 -1
- package/src/navigator/navigator-back-button/hook.ts +6 -10
- package/src/navigator/navigator-provider/README.md +38 -36
- package/src/navigator/navigator-provider/component.tsx +13 -7
- package/src/navigator/navigator-screen/README.md +13 -1
- package/src/navigator/navigator-to-parent-button/README.md +2 -0
- package/src/navigator/navigator-to-parent-button/component.tsx +14 -43
- package/src/navigator/test/index.tsx +136 -6
- package/src/navigator/types.ts +45 -10
- package/src/number-control/README.md +8 -0
- package/src/palette-edit/styles.ts +5 -5
- package/src/placeholder/style.scss +4 -1
- package/src/popover/index.tsx +9 -3
- package/src/popover/style.scss +2 -2
- package/src/popover/test/index.tsx +34 -0
- package/src/private-apis.ts +6 -12
- package/src/progress-bar/styles.ts +2 -2
- package/src/query-controls/README.md +7 -0
- package/src/query-controls/index.tsx +5 -6
- package/src/query-controls/types.ts +2 -1
- package/src/radio-control/index.tsx +28 -20
- package/src/radio-control/style.scss +13 -2
- package/src/radio-control/test/index.tsx +43 -40
- package/src/radio-group/radio.tsx +2 -1
- package/src/range-control/README.md +7 -0
- package/src/range-control/index.tsx +39 -9
- package/src/range-control/stories/index.story.tsx +7 -0
- package/src/range-control/styles/range-control-styles.ts +2 -2
- package/src/range-control/test/index.tsx +54 -14
- package/src/search-control/index.tsx +7 -4
- package/src/search-control/stories/index.story.tsx +1 -0
- package/src/search-control/test/index.tsx +1 -0
- package/src/select-control/README.md +8 -0
- package/src/select-control/index.tsx +1 -0
- package/src/select-control/stories/index.story.tsx +8 -5
- package/src/select-control/test/select-control.tsx +12 -6
- package/src/snackbar/style.scss +2 -2
- package/src/tab-panel/index.tsx +4 -1
- package/src/tab-panel/style.scss +1 -1
- package/src/tabs/index.tsx +2 -1
- package/src/tabs/tablist.tsx +6 -4
- package/src/tabs/tabpanel.tsx +6 -2
- package/src/text/styles.ts +1 -1
- package/src/text-control/README.md +8 -0
- package/src/text-control/index.tsx +1 -0
- package/src/text-control/stories/index.story.tsx +3 -1
- package/src/text-control/test/text-control.tsx +5 -1
- package/src/textarea-control/index.tsx +1 -0
- package/src/textarea-control/stories/index.story.tsx +2 -0
- package/src/textarea-control/styles/textarea-control-styles.ts +75 -2
- package/src/toggle-control/index.tsx +9 -0
- package/src/toggle-control/stories/index.story.tsx +1 -0
- package/src/toggle-control/test/index.tsx +7 -1
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +8 -24
- package/src/toggle-group-control/test/index.tsx +5 -1
- package/src/toggle-group-control/toggle-group-control/README.md +7 -0
- package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +2 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +1 -0
- package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +2 -2
- package/src/toolbar/toolbar/style.scss +2 -2
- package/src/tools-panel/styles.ts +1 -1
- package/src/tooltip/index.tsx +2 -1
- package/src/tooltip/style.scss +1 -1
- package/src/tree-select/index.tsx +16 -5
- package/src/tree-select/stories/index.story.tsx +1 -0
- package/src/unit-control/README.md +7 -0
- package/src/unit-control/styles/unit-control-styles.ts +1 -1
- package/src/utils/config-values.js +4 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/composite/current/index.js +0 -43
- package/build/composite/current/index.js.map +0 -1
- package/build/composite/v2.js +0 -17
- package/build/composite/v2.js.map +0 -1
- package/build/utils/input/base.js +0 -20
- package/build/utils/input/base.js.map +0 -1
- package/build/utils/input/index.js +0 -17
- package/build/utils/input/index.js.map +0 -1
- package/build/utils/input/input-control.js +0 -21
- package/build/utils/input/input-control.js.map +0 -1
- package/build-module/composite/current/index.js +0 -12
- package/build-module/composite/current/index.js.map +0 -1
- package/build-module/composite/v2.js +0 -5
- package/build-module/composite/v2.js.map +0 -1
- package/build-module/utils/input/base.js +0 -13
- package/build-module/utils/input/base.js.map +0 -1
- package/build-module/utils/input/index.js +0 -2
- package/build-module/utils/input/index.js.map +0 -1
- package/build-module/utils/input/input-control.js +0 -14
- package/build-module/utils/input/input-control.js.map +0 -1
- package/build-types/composite/current/index.d.ts +0 -12
- package/build-types/composite/current/index.d.ts.map +0 -1
- package/build-types/composite/current/stories/index.story.d.ts +0 -13
- package/build-types/composite/current/stories/index.story.d.ts.map +0 -1
- package/build-types/composite/current/stories/utils.d.ts +0 -14
- package/build-types/composite/current/stories/utils.d.ts.map +0 -1
- package/build-types/composite/v2.d.ts +0 -2
- package/build-types/composite/v2.d.ts.map +0 -1
- package/build-types/utils/input/base.d.ts +0 -3
- package/build-types/utils/input/base.d.ts.map +0 -1
- package/build-types/utils/input/index.d.ts +0 -2
- package/build-types/utils/input/index.d.ts.map +0 -1
- package/build-types/utils/input/input-control.d.ts +0 -2
- package/build-types/utils/input/input-control.d.ts.map +0 -1
- package/src/composite/current/index.ts +0 -20
- package/src/composite/current/stories/index.story.tsx +0 -86
- package/src/composite/index.ts +0 -7
- package/src/composite/v2.ts +0 -4
- package/src/utils/input/base.js +0 -30
- package/src/utils/input/index.js +0 -1
- package/src/utils/input/input-control.js +0 -63
|
@@ -27,12 +27,12 @@ import type {
|
|
|
27
27
|
Screen,
|
|
28
28
|
NavigateToParentOptions,
|
|
29
29
|
} from '../types';
|
|
30
|
+
import deprecated from '@wordpress/deprecated';
|
|
30
31
|
|
|
31
32
|
type MatchedPath = ReturnType< typeof patternMatch >;
|
|
32
33
|
|
|
33
34
|
type RouterAction =
|
|
34
35
|
| { type: 'add' | 'remove'; screen: Screen }
|
|
35
|
-
| { type: 'goback' }
|
|
36
36
|
| { type: 'goto'; path: string; options?: NavigateOptions }
|
|
37
37
|
| { type: 'gotoparent'; options?: NavigateToParentOptions };
|
|
38
38
|
|
|
@@ -160,9 +160,6 @@ function routerReducer(
|
|
|
160
160
|
case 'remove':
|
|
161
161
|
screens = removeScreen( state, action.screen );
|
|
162
162
|
break;
|
|
163
|
-
case 'goback':
|
|
164
|
-
locationHistory = goBack( state );
|
|
165
|
-
break;
|
|
166
163
|
case 'goto':
|
|
167
164
|
locationHistory = goTo( state, action.path, action.options );
|
|
168
165
|
break;
|
|
@@ -223,11 +220,20 @@ function UnconnectedNavigatorProvider(
|
|
|
223
220
|
// The methods are constant forever, create stable references to them.
|
|
224
221
|
const methods = useMemo(
|
|
225
222
|
() => ( {
|
|
226
|
-
|
|
223
|
+
// Note: calling goBack calls `goToParent` internally, as it was established
|
|
224
|
+
// that `goBack` should behave like `goToParent`, and `goToParent` should
|
|
225
|
+
// be marked as deprecated.
|
|
226
|
+
goBack: ( options: NavigateToParentOptions | undefined ) =>
|
|
227
|
+
dispatch( { type: 'gotoparent', options } ),
|
|
227
228
|
goTo: ( path: string, options?: NavigateOptions ) =>
|
|
228
229
|
dispatch( { type: 'goto', path, options } ),
|
|
229
|
-
goToParent: ( options: NavigateToParentOptions | undefined ) =>
|
|
230
|
-
|
|
230
|
+
goToParent: ( options: NavigateToParentOptions | undefined ) => {
|
|
231
|
+
deprecated( `wp.components.useNavigator().goToParent`, {
|
|
232
|
+
since: '6.7',
|
|
233
|
+
alternative: 'wp.components.useNavigator().goBack',
|
|
234
|
+
} );
|
|
235
|
+
dispatch( { type: 'gotoparent', options } );
|
|
236
|
+
},
|
|
231
237
|
addScreen: ( screen: Screen ) =>
|
|
232
238
|
dispatch( { type: 'add', screen } ),
|
|
233
239
|
removeScreen: ( screen: Screen ) =>
|
|
@@ -16,6 +16,18 @@ The component accepts the following props:
|
|
|
16
16
|
|
|
17
17
|
### `path`: `string`
|
|
18
18
|
|
|
19
|
-
The screen
|
|
19
|
+
The screen"s path, matched against the current path stored in the navigator.
|
|
20
|
+
|
|
21
|
+
`Navigator` assumes that screens are organized hierarchically according to their `path`, which should follow a URL-like scheme where each path segment starts with and is separated by the `/` character.
|
|
22
|
+
|
|
23
|
+
`Navigator` will treat "back" navigations as going to the parent screen — it is therefore responsibility of the consumer of the component to create the correct screen hierarchy.
|
|
24
|
+
|
|
25
|
+
For example:
|
|
26
|
+
|
|
27
|
+
- `/` is the root of all paths. There should always be a screen with `path="/"`.
|
|
28
|
+
- `/parent/child` is a child of `/parent`.
|
|
29
|
+
- `/parent/child/grand-child` is a child of `/parent/child`.
|
|
30
|
+
- `/parent/:param` is a child of `/parent` as well.
|
|
31
|
+
- if the current screen has a `path` with value `/parent/child/grand-child`, when going "back" `Navigator` will try to recursively navigate the path hierarchy until a matching screen (or the root `/`) is found.
|
|
20
32
|
|
|
21
33
|
- Required: Yes
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
|
+
This component is deprecated. Please use the [`NavigatorBackButton`](/packages/components/src/navigator/navigator-back-button/README.md) component instead.
|
|
8
|
+
|
|
7
9
|
The `NavigatorToParentButton` component can be used to navigate to a screen and should be used in combination with the [`NavigatorProvider`](/packages/components/src/navigator/navigator-provider/README.md), the [`NavigatorScreen`](/packages/components/src/navigator/navigator-screen/README.md) and the [`NavigatorButton`](/packages/components/src/navigator/navigator-button/README.md) components (or the `useNavigator` hook).
|
|
8
10
|
|
|
9
11
|
## Usage
|
|
@@ -1,62 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
4
|
+
import deprecated from '@wordpress/deprecated';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { NavigatorBackButton } from '../navigator-back-button';
|
|
9
10
|
import type { WordPressComponentProps } from '../../context';
|
|
10
11
|
import { contextConnect } from '../../context';
|
|
11
|
-
import {
|
|
12
|
-
import { useNavigatorBackButton } from '../navigator-back-button/hook';
|
|
13
|
-
import type { NavigatorToParentButtonProps } from '../types';
|
|
12
|
+
import type { NavigatorBackButtonProps } from '../types';
|
|
14
13
|
|
|
15
14
|
function UnconnectedNavigatorToParentButton(
|
|
16
|
-
props: WordPressComponentProps<
|
|
17
|
-
forwardedRef: ForwardedRef< any >
|
|
15
|
+
props: WordPressComponentProps< NavigatorBackButtonProps, 'button' >,
|
|
16
|
+
forwardedRef: React.ForwardedRef< any >
|
|
18
17
|
) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
deprecated( 'wp.components.NavigatorToParentButton', {
|
|
19
|
+
since: '6.7',
|
|
20
|
+
alternative: 'wp.components.NavigatorBackButton',
|
|
22
21
|
} );
|
|
23
22
|
|
|
24
|
-
return <
|
|
23
|
+
return <NavigatorBackButton ref={ forwardedRef } { ...props } />;
|
|
25
24
|
}
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator`
|
|
31
|
-
* hook).
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```jsx
|
|
35
|
-
* import {
|
|
36
|
-
* __experimentalNavigatorProvider as NavigatorProvider,
|
|
37
|
-
* __experimentalNavigatorScreen as NavigatorScreen,
|
|
38
|
-
* __experimentalNavigatorButton as NavigatorButton,
|
|
39
|
-
* __experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
40
|
-
* } from '@wordpress/components';
|
|
41
|
-
*
|
|
42
|
-
* const MyNavigation = () => (
|
|
43
|
-
* <NavigatorProvider initialPath="/">
|
|
44
|
-
* <NavigatorScreen path="/">
|
|
45
|
-
* <p>This is the home screen.</p>
|
|
46
|
-
* <NavigatorButton path="/child">
|
|
47
|
-
* Navigate to child screen.
|
|
48
|
-
* </NavigatorButton>
|
|
49
|
-
* </NavigatorScreen>
|
|
26
|
+
/**
|
|
27
|
+
* _Note: this component is deprecated. Please use the `NavigatorBackButton`
|
|
28
|
+
* component instead._
|
|
50
29
|
*
|
|
51
|
-
*
|
|
52
|
-
* <p>This is the child screen.</p>
|
|
53
|
-
* <NavigatorToParentButton>
|
|
54
|
-
* Go to parent
|
|
55
|
-
* </NavigatorToParentButton>
|
|
56
|
-
* </NavigatorScreen>
|
|
57
|
-
* </NavigatorProvider>
|
|
58
|
-
* );
|
|
59
|
-
* ```
|
|
30
|
+
* @deprecated
|
|
60
31
|
*/
|
|
61
32
|
export const NavigatorToParentButton = contextConnect(
|
|
62
33
|
UnconnectedNavigatorToParentButton,
|
|
@@ -25,8 +25,8 @@ import {
|
|
|
25
25
|
import type { NavigateOptions } from '../types';
|
|
26
26
|
|
|
27
27
|
const INVALID_HTML_ATTRIBUTE = {
|
|
28
|
-
raw: ' "\'><=invalid_path',
|
|
29
|
-
escaped: " "'><=invalid_path",
|
|
28
|
+
raw: '/ "\'><=invalid_path',
|
|
29
|
+
escaped: "/ "'><=invalid_path",
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
const PATHS = {
|
|
@@ -165,6 +165,27 @@ function CustomNavigatorToParentButton( {
|
|
|
165
165
|
);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
function CustomNavigatorToParentButtonAlternative( {
|
|
169
|
+
onClick,
|
|
170
|
+
children,
|
|
171
|
+
}: {
|
|
172
|
+
children: React.ReactNode;
|
|
173
|
+
onClick?: CustomTestOnClickHandler;
|
|
174
|
+
} ) {
|
|
175
|
+
const { goToParent } = useNavigator();
|
|
176
|
+
return (
|
|
177
|
+
<button
|
|
178
|
+
onClick={ () => {
|
|
179
|
+
goToParent();
|
|
180
|
+
// Used to spy on the values passed to `navigator.goBack`.
|
|
181
|
+
onClick?.( { type: 'goToParent' } );
|
|
182
|
+
} }
|
|
183
|
+
>
|
|
184
|
+
{ children }
|
|
185
|
+
</button>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
168
189
|
const ProductScreen = ( {
|
|
169
190
|
onBackButtonClick,
|
|
170
191
|
}: {
|
|
@@ -344,20 +365,20 @@ const MyHierarchicalNavigation = ( {
|
|
|
344
365
|
>
|
|
345
366
|
{ BUTTON_TEXT.toNestedScreen }
|
|
346
367
|
</CustomNavigatorButton>
|
|
347
|
-
<
|
|
368
|
+
<CustomNavigatorBackButton
|
|
348
369
|
onClick={ onNavigatorButtonClick }
|
|
349
370
|
>
|
|
350
371
|
{ BUTTON_TEXT.back }
|
|
351
|
-
</
|
|
372
|
+
</CustomNavigatorBackButton>
|
|
352
373
|
</NavigatorScreen>
|
|
353
374
|
|
|
354
375
|
<NavigatorScreen path={ PATHS.NESTED }>
|
|
355
376
|
<p>{ SCREEN_TEXT.nested }</p>
|
|
356
|
-
<
|
|
377
|
+
<CustomNavigatorBackButton
|
|
357
378
|
onClick={ onNavigatorButtonClick }
|
|
358
379
|
>
|
|
359
380
|
{ BUTTON_TEXT.back }
|
|
360
|
-
</
|
|
381
|
+
</CustomNavigatorBackButton>
|
|
361
382
|
<CustomNavigatorGoToBackButton
|
|
362
383
|
path={ PATHS.CHILD }
|
|
363
384
|
onClick={ onNavigatorButtonClick }
|
|
@@ -376,6 +397,66 @@ const MyHierarchicalNavigation = ( {
|
|
|
376
397
|
);
|
|
377
398
|
};
|
|
378
399
|
|
|
400
|
+
const MyDeprecatedNavigation = ( {
|
|
401
|
+
initialPath = PATHS.HOME,
|
|
402
|
+
onNavigatorButtonClick,
|
|
403
|
+
}: {
|
|
404
|
+
initialPath?: string;
|
|
405
|
+
onNavigatorButtonClick?: CustomTestOnClickHandler;
|
|
406
|
+
} ) => {
|
|
407
|
+
return (
|
|
408
|
+
<>
|
|
409
|
+
<NavigatorProvider initialPath={ initialPath }>
|
|
410
|
+
<NavigatorScreen path={ PATHS.HOME }>
|
|
411
|
+
<p>{ SCREEN_TEXT.home }</p>
|
|
412
|
+
{ /*
|
|
413
|
+
* A button useful to test focus restoration. This button is the first
|
|
414
|
+
* tabbable item in the screen, but should not receive focus when
|
|
415
|
+
* navigating to screen as a result of a backwards navigation.
|
|
416
|
+
*/ }
|
|
417
|
+
<button>First tabbable home screen button</button>
|
|
418
|
+
<CustomNavigatorButton
|
|
419
|
+
path={ PATHS.CHILD }
|
|
420
|
+
onClick={ onNavigatorButtonClick }
|
|
421
|
+
>
|
|
422
|
+
{ BUTTON_TEXT.toChildScreen }
|
|
423
|
+
</CustomNavigatorButton>
|
|
424
|
+
</NavigatorScreen>
|
|
425
|
+
|
|
426
|
+
<NavigatorScreen path={ PATHS.CHILD }>
|
|
427
|
+
<p>{ SCREEN_TEXT.child }</p>
|
|
428
|
+
{ /*
|
|
429
|
+
* A button useful to test focus restoration. This button is the first
|
|
430
|
+
* tabbable item in the screen, but should not receive focus when
|
|
431
|
+
* navigating to screen as a result of a backwards navigation.
|
|
432
|
+
*/ }
|
|
433
|
+
<button>First tabbable child screen button</button>
|
|
434
|
+
<CustomNavigatorButton
|
|
435
|
+
path={ PATHS.NESTED }
|
|
436
|
+
onClick={ onNavigatorButtonClick }
|
|
437
|
+
>
|
|
438
|
+
{ BUTTON_TEXT.toNestedScreen }
|
|
439
|
+
</CustomNavigatorButton>
|
|
440
|
+
<CustomNavigatorToParentButton
|
|
441
|
+
onClick={ onNavigatorButtonClick }
|
|
442
|
+
>
|
|
443
|
+
{ BUTTON_TEXT.back }
|
|
444
|
+
</CustomNavigatorToParentButton>
|
|
445
|
+
</NavigatorScreen>
|
|
446
|
+
|
|
447
|
+
<NavigatorScreen path={ PATHS.NESTED }>
|
|
448
|
+
<p>{ SCREEN_TEXT.nested }</p>
|
|
449
|
+
<CustomNavigatorToParentButtonAlternative
|
|
450
|
+
onClick={ onNavigatorButtonClick }
|
|
451
|
+
>
|
|
452
|
+
{ BUTTON_TEXT.back }
|
|
453
|
+
</CustomNavigatorToParentButtonAlternative>
|
|
454
|
+
</NavigatorScreen>
|
|
455
|
+
</NavigatorProvider>
|
|
456
|
+
</>
|
|
457
|
+
);
|
|
458
|
+
};
|
|
459
|
+
|
|
379
460
|
const getScreen = ( screenKey: keyof typeof SCREEN_TEXT ) =>
|
|
380
461
|
screen.getByText( SCREEN_TEXT[ screenKey ] );
|
|
381
462
|
const queryScreen = ( screenKey: keyof typeof SCREEN_TEXT ) =>
|
|
@@ -769,4 +850,53 @@ describe( 'Navigator', () => {
|
|
|
769
850
|
).toHaveFocus();
|
|
770
851
|
} );
|
|
771
852
|
} );
|
|
853
|
+
|
|
854
|
+
describe( 'deprecated APIs', () => {
|
|
855
|
+
it( 'should log a deprecation notice when using the NavigatorToParentButton component', async () => {
|
|
856
|
+
const user = userEvent.setup();
|
|
857
|
+
|
|
858
|
+
render( <MyDeprecatedNavigation initialPath={ PATHS.CHILD } /> );
|
|
859
|
+
|
|
860
|
+
expect( getScreen( 'child' ) ).toBeInTheDocument();
|
|
861
|
+
|
|
862
|
+
// Navigate back to home screen.
|
|
863
|
+
// The first tabbable element receives focus, since focus restoration
|
|
864
|
+
// it not possible (there was no forward navigation).
|
|
865
|
+
await user.click( getNavigationButton( 'back' ) );
|
|
866
|
+
expect( getScreen( 'home' ) ).toBeInTheDocument();
|
|
867
|
+
expect(
|
|
868
|
+
screen.getByRole( 'button', {
|
|
869
|
+
name: 'First tabbable home screen button',
|
|
870
|
+
} )
|
|
871
|
+
).toHaveFocus();
|
|
872
|
+
|
|
873
|
+
// Rendering `NavigatorToParentButton` logs a deprecation notice
|
|
874
|
+
expect( console ).toHaveWarnedWith(
|
|
875
|
+
'wp.components.NavigatorToParentButton is deprecated since version 6.7. Please use wp.components.NavigatorBackButton instead.'
|
|
876
|
+
);
|
|
877
|
+
} );
|
|
878
|
+
|
|
879
|
+
it( 'should log a deprecation notice when using the useNavigator().goToParent() function', async () => {
|
|
880
|
+
const user = userEvent.setup();
|
|
881
|
+
|
|
882
|
+
render( <MyDeprecatedNavigation initialPath={ PATHS.NESTED } /> );
|
|
883
|
+
|
|
884
|
+
expect( getScreen( 'nested' ) ).toBeInTheDocument();
|
|
885
|
+
|
|
886
|
+
// Navigate back to child screen using the back button.
|
|
887
|
+
// The first tabbable element receives focus, since focus restoration
|
|
888
|
+
// it not possible (there was no forward navigation).
|
|
889
|
+
await user.click( getNavigationButton( 'back' ) );
|
|
890
|
+
expect( getScreen( 'child' ) ).toBeInTheDocument();
|
|
891
|
+
expect(
|
|
892
|
+
screen.getByRole( 'button', {
|
|
893
|
+
name: 'First tabbable child screen button',
|
|
894
|
+
} )
|
|
895
|
+
).toHaveFocus();
|
|
896
|
+
|
|
897
|
+
expect( console ).toHaveWarnedWith(
|
|
898
|
+
'wp.components.useNavigator().goToParent is deprecated since version 6.7. Please use wp.components.useNavigator().goBack instead.'
|
|
899
|
+
);
|
|
900
|
+
} );
|
|
901
|
+
} );
|
|
772
902
|
} );
|
package/src/navigator/types.ts
CHANGED
|
@@ -11,26 +11,70 @@ import type { ButtonAsButtonProps } from '../button/types';
|
|
|
11
11
|
export type MatchParams = Record< string, string | string[] >;
|
|
12
12
|
|
|
13
13
|
export type NavigateOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* Specify the CSS selector used to restore focus on an given element when
|
|
16
|
+
* navigating back. When not provided, the component will attempt to restore
|
|
17
|
+
* focus on the element that originated the forward navigation.
|
|
18
|
+
*/
|
|
14
19
|
focusTargetSelector?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the navigation is a backwards navigation. This enables focus
|
|
22
|
+
* restoration (when possible), and causes the animation to be backwards.
|
|
23
|
+
*/
|
|
15
24
|
isBack?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Opt out of focus management. Useful when the consumer of the component
|
|
27
|
+
* wants to manage focus themselves.
|
|
28
|
+
*/
|
|
16
29
|
skipFocus?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the navigation should replace the current location in the stack.
|
|
32
|
+
*/
|
|
17
33
|
replace?: boolean;
|
|
18
34
|
};
|
|
19
35
|
|
|
20
36
|
export type NavigateToParentOptions = Omit< NavigateOptions, 'isBack' >;
|
|
21
37
|
|
|
22
38
|
export type NavigatorLocation = NavigateOptions & {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the current location is the initial one (ie. first in the stack).
|
|
41
|
+
*/
|
|
23
42
|
isInitial?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The path associated to the location.
|
|
45
|
+
*/
|
|
24
46
|
path?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Whether focus was already restored for this location (in case of
|
|
49
|
+
* backwards navigation).
|
|
50
|
+
*/
|
|
25
51
|
hasRestoredFocus?: boolean;
|
|
26
52
|
};
|
|
27
53
|
|
|
28
54
|
// Returned by the `useNavigator` hook.
|
|
29
55
|
export type Navigator = {
|
|
56
|
+
/**
|
|
57
|
+
* The current location.
|
|
58
|
+
*/
|
|
30
59
|
location: NavigatorLocation;
|
|
60
|
+
/**
|
|
61
|
+
* Params associated with the current location
|
|
62
|
+
*/
|
|
31
63
|
params: MatchParams;
|
|
64
|
+
/**
|
|
65
|
+
* Navigate to a new location.
|
|
66
|
+
*/
|
|
32
67
|
goTo: ( path: string, options?: NavigateOptions ) => void;
|
|
33
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Go back to the parent location (ie. "/some/path" will navigate back
|
|
70
|
+
* to "/some")
|
|
71
|
+
*/
|
|
72
|
+
goBack: ( options?: NavigateToParentOptions ) => void;
|
|
73
|
+
/**
|
|
74
|
+
* _Note: This function is deprecated. Please use `goBack` instead._
|
|
75
|
+
* @deprecated
|
|
76
|
+
* @ignore
|
|
77
|
+
*/
|
|
34
78
|
goToParent: ( options?: NavigateToParentOptions ) => void;
|
|
35
79
|
};
|
|
36
80
|
|
|
@@ -64,15 +108,6 @@ export type NavigatorScreenProps = {
|
|
|
64
108
|
|
|
65
109
|
export type NavigatorBackButtonProps = ButtonAsButtonProps;
|
|
66
110
|
|
|
67
|
-
export type NavigatorBackButtonHookProps = NavigatorBackButtonProps & {
|
|
68
|
-
/**
|
|
69
|
-
* Whether we should navigate to the parent screen.
|
|
70
|
-
*
|
|
71
|
-
* @default 'false'
|
|
72
|
-
*/
|
|
73
|
-
goToParent?: boolean;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
111
|
export type NavigatorToParentButtonProps = NavigatorBackButtonProps;
|
|
77
112
|
|
|
78
113
|
export type NavigatorButtonProps = NavigatorBackButtonProps & {
|
|
@@ -139,3 +139,11 @@ Amount by which the `value` is changed when incrementing/decrementing. It is als
|
|
|
139
139
|
- Type: `Number | "any"`
|
|
140
140
|
- Required: No
|
|
141
141
|
- Default: `1`
|
|
142
|
+
|
|
143
|
+
### __next40pxDefaultSize
|
|
144
|
+
|
|
145
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
146
|
+
|
|
147
|
+
- Type: `Boolean`
|
|
148
|
+
- Required: No
|
|
149
|
+
- Default: `false`
|
|
@@ -31,7 +31,7 @@ export const IndicatorStyled = styled( ColorIndicator )`
|
|
|
31
31
|
export const NameInputControl = styled( InputControl )`
|
|
32
32
|
${ InputControlContainer } {
|
|
33
33
|
background: ${ COLORS.gray[ 100 ] };
|
|
34
|
-
border-radius: ${ CONFIG.
|
|
34
|
+
border-radius: ${ CONFIG.radiusXSmall };
|
|
35
35
|
${ Input }${ Input }${ Input }${ Input } {
|
|
36
36
|
height: ${ space( 8 ) };
|
|
37
37
|
}
|
|
@@ -85,8 +85,8 @@ export const PaletteItem = styled( View )`
|
|
|
85
85
|
outline-offset: 0;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
border-top-left-radius: ${ CONFIG.
|
|
89
|
-
border-top-right-radius: ${ CONFIG.
|
|
88
|
+
border-top-left-radius: ${ CONFIG.radiusSmall };
|
|
89
|
+
border-top-right-radius: ${ CONFIG.radiusSmall };
|
|
90
90
|
|
|
91
91
|
& + & {
|
|
92
92
|
border-top-left-radius: 0;
|
|
@@ -94,8 +94,8 @@ export const PaletteItem = styled( View )`
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
&:last-child {
|
|
97
|
-
border-bottom-left-radius: ${ CONFIG.
|
|
98
|
-
border-bottom-right-radius: ${ CONFIG.
|
|
97
|
+
border-bottom-left-radius: ${ CONFIG.radiusSmall };
|
|
98
|
+
border-bottom-right-radius: ${ CONFIG.radiusSmall };
|
|
99
99
|
border-bottom-color: ${ CONFIG.surfaceBorderColor };
|
|
100
100
|
}
|
|
101
101
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
// Block UI appearance.
|
|
22
|
-
border-radius: $radius-block
|
|
22
|
+
border-radius: $radius-small; // Match the block toolbar material radius.
|
|
23
23
|
background-color: $white;
|
|
24
24
|
box-shadow: inset 0 0 0 $border-width $gray-900;
|
|
25
25
|
outline: 1px solid transparent; // Shown for Windows 10 High Contrast mode.
|
|
@@ -144,6 +144,9 @@
|
|
|
144
144
|
display: flex;
|
|
145
145
|
box-shadow: none;
|
|
146
146
|
|
|
147
|
+
// In the unselected state, radius should match Global Styles > Image > Radius.
|
|
148
|
+
border-radius: 0;
|
|
149
|
+
|
|
147
150
|
// Blur the background so layered dashed placeholders are still visually separate.
|
|
148
151
|
// Make the background transparent to not interfere with the background overlay in placeholder-style() pseudo element
|
|
149
152
|
backdrop-filter: blur(100px);
|
package/src/popover/index.tsx
CHANGED
|
@@ -113,8 +113,9 @@ const UnforwardedPopover = (
|
|
|
113
113
|
WordPressComponentProps< PopoverProps, 'div', false >,
|
|
114
114
|
// To avoid overlaps between the standard HTML attributes and the props
|
|
115
115
|
// expected by `framer-motion`, omit all framer motion props from popover
|
|
116
|
-
// props (except for `animate` and `children
|
|
117
|
-
|
|
116
|
+
// props (except for `animate` and `children` which are re-defined in
|
|
117
|
+
// `PopoverProps`, and `style` which is merged safely).
|
|
118
|
+
keyof Omit< MotionProps, 'animate' | 'children' | 'style' >
|
|
118
119
|
>,
|
|
119
120
|
forwardedRef: ForwardedRef< any >
|
|
120
121
|
) => {
|
|
@@ -139,6 +140,7 @@ const UnforwardedPopover = (
|
|
|
139
140
|
shift = false,
|
|
140
141
|
inline = false,
|
|
141
142
|
variant,
|
|
143
|
+
style: contentStyle,
|
|
142
144
|
|
|
143
145
|
// Deprecated props
|
|
144
146
|
__unstableForcePosition,
|
|
@@ -370,6 +372,7 @@ const UnforwardedPopover = (
|
|
|
370
372
|
const animationProps: HTMLMotionProps< 'div' > = shouldAnimate
|
|
371
373
|
? {
|
|
372
374
|
style: {
|
|
375
|
+
...contentStyle,
|
|
373
376
|
...motionInlineStyles,
|
|
374
377
|
...style,
|
|
375
378
|
},
|
|
@@ -378,7 +381,10 @@ const UnforwardedPopover = (
|
|
|
378
381
|
}
|
|
379
382
|
: {
|
|
380
383
|
animate: false,
|
|
381
|
-
style
|
|
384
|
+
style: {
|
|
385
|
+
...contentStyle,
|
|
386
|
+
...style,
|
|
387
|
+
},
|
|
382
388
|
};
|
|
383
389
|
|
|
384
390
|
// When Floating UI has finished positioning and Framer Motion has finished animating
|
package/src/popover/style.scss
CHANGED
|
@@ -22,8 +22,8 @@ $shadow-popover-border-top-only-alternate: 0 #{-$border-width} 0 $gray-900;
|
|
|
22
22
|
|
|
23
23
|
.components-popover__content {
|
|
24
24
|
background: $white;
|
|
25
|
-
box-shadow: $shadow-popover-border-default, $
|
|
26
|
-
border-radius: $radius-
|
|
25
|
+
box-shadow: $shadow-popover-border-default, $elevation-x-small;
|
|
26
|
+
border-radius: $radius-medium;
|
|
27
27
|
box-sizing: border-box;
|
|
28
28
|
width: min-content;
|
|
29
29
|
|
|
@@ -179,6 +179,40 @@ describe( 'Popover', () => {
|
|
|
179
179
|
} );
|
|
180
180
|
} );
|
|
181
181
|
|
|
182
|
+
describe( 'style', () => {
|
|
183
|
+
it( 'outputs inline styles added through the style prop in addition to built-in popover positioning styles', async () => {
|
|
184
|
+
render(
|
|
185
|
+
<Popover
|
|
186
|
+
style={ { zIndex: 0 } }
|
|
187
|
+
data-testid="popover-element"
|
|
188
|
+
>
|
|
189
|
+
Hello
|
|
190
|
+
</Popover>
|
|
191
|
+
);
|
|
192
|
+
const popover = screen.getByTestId( 'popover-element' );
|
|
193
|
+
|
|
194
|
+
await waitFor( () => expect( popover ).toBeVisible() );
|
|
195
|
+
expect( popover ).toHaveStyle(
|
|
196
|
+
'position: absolute; top: 0px; left: 0px; z-index: 0;'
|
|
197
|
+
);
|
|
198
|
+
} );
|
|
199
|
+
|
|
200
|
+
it( 'is not possible to override built-in popover positioning styles via the style prop', async () => {
|
|
201
|
+
render(
|
|
202
|
+
<Popover
|
|
203
|
+
style={ { position: 'static' } }
|
|
204
|
+
data-testid="popover-element"
|
|
205
|
+
>
|
|
206
|
+
Hello
|
|
207
|
+
</Popover>
|
|
208
|
+
);
|
|
209
|
+
const popover = screen.getByTestId( 'popover-element' );
|
|
210
|
+
|
|
211
|
+
await waitFor( () => expect( popover ).toBeVisible() );
|
|
212
|
+
expect( popover ).not.toHaveStyle( 'position: static;' );
|
|
213
|
+
} );
|
|
214
|
+
} );
|
|
215
|
+
|
|
182
216
|
describe( 'focus behavior', () => {
|
|
183
217
|
it( 'should focus the popover container when opened', async () => {
|
|
184
218
|
render(
|
package/src/private-apis.ts
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
Composite as CompositeV2,
|
|
6
|
-
CompositeGroup as CompositeGroupV2,
|
|
7
|
-
CompositeItem as CompositeItemV2,
|
|
8
|
-
CompositeRow as CompositeRowV2,
|
|
9
|
-
useCompositeStore as useCompositeStoreV2,
|
|
10
|
-
} from './composite/v2';
|
|
4
|
+
import { Composite, useCompositeStore } from './composite';
|
|
11
5
|
import { positionToPlacement as __experimentalPopoverLegacyPositionToPlacement } from './popover/utils';
|
|
12
6
|
import { createPrivateSlotFill } from './slot-fill';
|
|
13
7
|
import {
|
|
@@ -28,11 +22,11 @@ import { lock } from './lock-unlock';
|
|
|
28
22
|
|
|
29
23
|
export const privateApis = {};
|
|
30
24
|
lock( privateApis, {
|
|
31
|
-
CompositeV2,
|
|
32
|
-
CompositeGroupV2,
|
|
33
|
-
CompositeItemV2,
|
|
34
|
-
CompositeRowV2,
|
|
35
|
-
useCompositeStoreV2,
|
|
25
|
+
CompositeV2: Composite,
|
|
26
|
+
CompositeGroupV2: Composite.Group,
|
|
27
|
+
CompositeItemV2: Composite.Item,
|
|
28
|
+
CompositeRowV2: Composite.Row,
|
|
29
|
+
useCompositeStoreV2: useCompositeStore,
|
|
36
30
|
__experimentalPopoverLegacyPositionToPlacement,
|
|
37
31
|
createPrivateSlotFill,
|
|
38
32
|
ComponentsContext,
|
|
@@ -40,7 +40,7 @@ export const Track = styled.div`
|
|
|
40
40
|
${ COLORS.theme.foreground },
|
|
41
41
|
transparent 90%
|
|
42
42
|
);
|
|
43
|
-
border-radius: ${ CONFIG.
|
|
43
|
+
border-radius: ${ CONFIG.radiusFull };
|
|
44
44
|
|
|
45
45
|
// Windows high contrast mode.
|
|
46
46
|
outline: 2px solid transparent;
|
|
@@ -58,7 +58,7 @@ export const Indicator = styled.div< {
|
|
|
58
58
|
position: absolute;
|
|
59
59
|
top: 0;
|
|
60
60
|
height: 100%;
|
|
61
|
-
border-radius: ${ CONFIG.
|
|
61
|
+
border-radius: ${ CONFIG.radiusFull };
|
|
62
62
|
/* Text color at 90% opacity */
|
|
63
63
|
background-color: color-mix(
|
|
64
64
|
in srgb,
|
|
@@ -240,3 +240,10 @@ The selected category for the `categoriesList` prop.
|
|
|
240
240
|
|
|
241
241
|
- Required: No
|
|
242
242
|
- Platform: Web
|
|
243
|
+
|
|
244
|
+
#### `__next40pxDefaultSize`: `boolean`
|
|
245
|
+
|
|
246
|
+
Start opting into the larger default height that will become the default size in a future version.
|
|
247
|
+
|
|
248
|
+
- Required: No
|
|
249
|
+
- Default: `false`
|