@wordpress/components 28.6.0 → 28.8.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 +122 -0
- package/CONTRIBUTING.md +42 -19
- package/build/alignment-matrix-control/cell.js +4 -7
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/icon.js +31 -19
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +55 -51
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles.js +73 -0
- package/build/alignment-matrix-control/styles.js.map +1 -0
- package/build/alignment-matrix-control/types.js.map +1 -1
- package/build/angle-picker-control/angle-circle.js +9 -9
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/border-control/border-control/component.js +18 -13
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/box-control/all-input-control.js +1 -2
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/utils.js +1 -1
- package/build/box-control/utils.js.map +1 -1
- package/build/card/card/component.js +2 -2
- package/build/card/card/component.js.map +1 -1
- package/build/card/styles.js +18 -18
- package/build/card/styles.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +15 -9
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +15 -12
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/circular-option-picker/types.js.map +1 -1
- package/build/clipboard-button/index.js +6 -6
- package/build/clipboard-button/index.js.map +1 -1
- package/build/color-palette/utils.js +1 -2
- package/build/color-palette/utils.js.map +1 -1
- package/build/color-picker/color-copy-button.js +8 -8
- package/build/color-picker/color-copy-button.js.map +1 -1
- package/build/color-picker/hex-input.js +8 -8
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js +8 -8
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +8 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +3 -1
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/types.js.map +1 -1
- package/build/composite/context.js +1 -1
- package/build/composite/context.js.map +1 -1
- package/build/composite/group-label.js +33 -0
- package/build/composite/group-label.js.map +1 -0
- package/build/composite/group.js +33 -0
- package/build/composite/group.js.map +1 -0
- package/build/composite/hover.js +33 -0
- package/build/composite/hover.js.map +1 -0
- package/build/composite/index.js +63 -118
- package/build/composite/index.js.map +1 -1
- package/build/composite/item.js +33 -0
- package/build/composite/item.js.map +1 -0
- package/build/composite/legacy/index.js +59 -7
- package/build/composite/legacy/index.js.map +1 -1
- package/build/composite/row.js +33 -0
- package/build/composite/row.js.map +1 -0
- package/build/composite/typeahead.js +33 -0
- package/build/composite/typeahead.js.map +1 -0
- package/build/composite/types.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +8 -8
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-select-control-v2/styles.js +12 -14
- package/build/custom-select-control-v2/styles.js.map +1 -1
- package/build/date-time/date/index.js +1 -1
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/styles.js +37 -26
- package/build/date-time/date/styles.js.map +1 -1
- package/build/date-time/date/use-lilius/index.js +163 -0
- package/build/date-time/date/use-lilius/index.js.map +1 -0
- package/build/date-time/time/time-input/index.js +17 -19
- package/build/date-time/time/time-input/index.js.map +1 -1
- package/build/dimension-control/index.js +6 -1
- package/build/dimension-control/index.js.map +1 -1
- package/build/draggable/index.js +4 -4
- package/build/draggable/index.js.map +1 -1
- package/build/dropdown-menu-v2/checkbox-item.js +69 -0
- package/build/dropdown-menu-v2/checkbox-item.js.map +1 -0
- package/build/dropdown-menu-v2/context.js +17 -0
- package/build/dropdown-menu-v2/context.js.map +1 -0
- package/build/dropdown-menu-v2/group-label.js +40 -0
- package/build/dropdown-menu-v2/group-label.js.map +1 -0
- package/build/dropdown-menu-v2/group.js +29 -0
- package/build/dropdown-menu-v2/group.js.map +1 -0
- package/build/dropdown-menu-v2/index.js +58 -146
- package/build/dropdown-menu-v2/index.js.map +1 -1
- package/build/dropdown-menu-v2/item-help-text.js +27 -0
- package/build/dropdown-menu-v2/item-help-text.js.map +1 -0
- package/build/dropdown-menu-v2/item-label.js +27 -0
- package/build/dropdown-menu-v2/item-label.js.map +1 -0
- package/build/dropdown-menu-v2/item.js +53 -0
- package/build/dropdown-menu-v2/item.js.map +1 -0
- package/build/dropdown-menu-v2/radio-item.js +79 -0
- package/build/dropdown-menu-v2/radio-item.js.map +1 -0
- package/build/dropdown-menu-v2/separator.js +30 -0
- package/build/dropdown-menu-v2/separator.js.map +1 -0
- package/build/dropdown-menu-v2/styles.js +55 -79
- package/build/dropdown-menu-v2/styles.js.map +1 -1
- package/build/dropdown-menu-v2/types.js.map +1 -1
- package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js +27 -0
- package/build/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +1 -0
- package/build/focal-point-picker/styles/focal-point-style.js +7 -2
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/form-token-field/types.js.map +1 -1
- package/build/index.js +13 -0
- package/build/index.js.map +1 -1
- package/build/input-control/index.js +2 -2
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +5 -10
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-prefix-wrapper.js +3 -3
- package/build/input-control/input-prefix-wrapper.js.map +1 -1
- package/build/input-control/input-suffix-wrapper.js +2 -3
- package/build/input-control/input-suffix-wrapper.js.map +1 -1
- package/build/input-control/reducer/reducer.js +8 -8
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +75 -45
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/input-control/types.js.map +1 -1
- package/build/input-control/utils.js +3 -3
- package/build/input-control/utils.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/modal/index.js +32 -17
- package/build/modal/index.js.map +1 -1
- package/build/modal/types.js.map +1 -1
- package/build/modal/use-modal-exit-animation.js +75 -0
- package/build/modal/use-modal-exit-animation.js.map +1 -0
- package/build/navigation/index.js +4 -4
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/styles/navigation-styles.js +13 -13
- package/build/navigation/styles/navigation-styles.js.map +1 -1
- package/build/navigator/index.js +12 -13
- package/build/navigator/index.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +2 -2
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +2 -2
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +99 -67
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +5 -0
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/navigator/navigator-to-parent-button/component.js +2 -2
- package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
- package/build/navigator/types.js.map +1 -1
- package/build/navigator/use-navigator.js +1 -2
- package/build/navigator/use-navigator.js.map +1 -1
- package/build/palette-edit/index.js +2 -2
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js +1 -14
- package/build/private-apis.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +30 -30
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +12 -12
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/slot-fill/bubbles-virtually/fill.js +4 -4
- package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build/slot-fill/index.js +1 -0
- package/build/slot-fill/index.js.map +1 -1
- package/build/snackbar/index.js +4 -4
- package/build/snackbar/index.js.map +1 -1
- package/build/tabs/index.js +4 -4
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/styles.js +3 -3
- package/build/tabs/styles.js.map +1 -1
- package/build/tabs/tablist.js +5 -4
- package/build/tabs/tablist.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/utils.js +6 -6
- package/build/toggle-group-control/toggle-group-control/utils.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +6 -6
- package/build/tools-panel/tools-panel/hook.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 +10 -9
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/element-rect.js +73 -105
- package/build/utils/element-rect.js.map +1 -1
- package/build/utils/hooks/use-update-effect.js +4 -4
- package/build/utils/hooks/use-update-effect.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js +2 -5
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +31 -19
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +55 -50
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles.js +70 -0
- package/build-module/alignment-matrix-control/styles.js.map +1 -0
- package/build-module/alignment-matrix-control/types.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +9 -9
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/border-control/border-control/component.js +18 -13
- package/build-module/border-control/border-control/component.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/utils.js +1 -1
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/card/card/component.js +2 -2
- package/build-module/card/card/component.js.map +1 -1
- package/build-module/card/styles.js +18 -18
- package/build-module/card/styles.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +16 -10
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +16 -13
- 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/clipboard-button/index.js +6 -6
- package/build-module/clipboard-button/index.js.map +1 -1
- package/build-module/color-palette/utils.js +1 -2
- package/build-module/color-palette/utils.js.map +1 -1
- package/build-module/color-picker/color-copy-button.js +8 -8
- package/build-module/color-picker/color-copy-button.js.map +1 -1
- package/build-module/color-picker/hex-input.js +7 -8
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +7 -8
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +3 -1
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/types.js.map +1 -1
- package/build-module/composite/context.js +1 -1
- package/build-module/composite/context.js.map +1 -1
- package/build-module/composite/group-label.js +25 -0
- package/build-module/composite/group-label.js.map +1 -0
- package/build-module/composite/group.js +25 -0
- package/build-module/composite/group.js.map +1 -0
- package/build-module/composite/hover.js +25 -0
- package/build-module/composite/hover.js.map +1 -0
- package/build-module/composite/index.js +64 -118
- package/build-module/composite/index.js.map +1 -1
- package/build-module/composite/item.js +25 -0
- package/build-module/composite/item.js.map +1 -0
- package/build-module/composite/legacy/index.js +57 -8
- package/build-module/composite/legacy/index.js.map +1 -1
- package/build-module/composite/row.js +25 -0
- package/build-module/composite/row.js.map +1 -0
- package/build-module/composite/typeahead.js +25 -0
- package/build-module/composite/typeahead.js.map +1 -0
- package/build-module/composite/types.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +8 -8
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-select-control-v2/styles.js +12 -14
- package/build-module/custom-select-control-v2/styles.js.map +1 -1
- package/build-module/date-time/date/index.js +1 -2
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +33 -26
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/date-time/date/use-lilius/index.js +158 -0
- package/build-module/date-time/date/use-lilius/index.js.map +1 -0
- package/build-module/date-time/time/time-input/index.js +17 -19
- package/build-module/date-time/time/time-input/index.js.map +1 -1
- package/build-module/dimension-control/index.js +6 -1
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/draggable/index.js +4 -4
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/checkbox-item.js +62 -0
- package/build-module/dropdown-menu-v2/checkbox-item.js.map +1 -0
- package/build-module/dropdown-menu-v2/context.js +11 -0
- package/build-module/dropdown-menu-v2/context.js.map +1 -0
- package/build-module/dropdown-menu-v2/group-label.js +32 -0
- package/build-module/dropdown-menu-v2/group-label.js.map +1 -0
- package/build-module/dropdown-menu-v2/group.js +21 -0
- package/build-module/dropdown-menu-v2/group.js.map +1 -0
- package/build-module/dropdown-menu-v2/index.js +57 -144
- package/build-module/dropdown-menu-v2/index.js.map +1 -1
- package/build-module/dropdown-menu-v2/item-help-text.js +19 -0
- package/build-module/dropdown-menu-v2/item-help-text.js.map +1 -0
- package/build-module/dropdown-menu-v2/item-label.js +19 -0
- package/build-module/dropdown-menu-v2/item-label.js.map +1 -0
- package/build-module/dropdown-menu-v2/item.js +46 -0
- package/build-module/dropdown-menu-v2/item.js.map +1 -0
- package/build-module/dropdown-menu-v2/radio-item.js +72 -0
- package/build-module/dropdown-menu-v2/radio-item.js.map +1 -0
- package/build-module/dropdown-menu-v2/separator.js +22 -0
- package/build-module/dropdown-menu-v2/separator.js.map +1 -0
- package/build-module/dropdown-menu-v2/styles.js +55 -79
- package/build-module/dropdown-menu-v2/styles.js.map +1 -1
- package/build-module/dropdown-menu-v2/types.js.map +1 -1
- package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js +20 -0
- package/build-module/dropdown-menu-v2/use-temporary-focus-visible-fix.js.map +1 -0
- package/build-module/focal-point-picker/styles/focal-point-style.js +6 -2
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/form-token-field/types.js.map +1 -1
- package/build-module/index.js +3 -1
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/index.js +2 -2
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +6 -11
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-prefix-wrapper.js +4 -3
- package/build-module/input-control/input-prefix-wrapper.js.map +1 -1
- package/build-module/input-control/input-suffix-wrapper.js +3 -3
- package/build-module/input-control/input-suffix-wrapper.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +8 -8
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +74 -44
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/input-control/types.js.map +1 -1
- package/build-module/input-control/utils.js +3 -3
- package/build-module/input-control/utils.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/modal/index.js +34 -17
- package/build-module/modal/index.js.map +1 -1
- package/build-module/modal/types.js.map +1 -1
- package/build-module/modal/use-modal-exit-animation.js +68 -0
- package/build-module/modal/use-modal-exit-animation.js.map +1 -0
- package/build-module/navigation/index.js +4 -4
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/styles/navigation-styles.js +14 -14
- package/build-module/navigation/styles/navigation-styles.js.map +1 -1
- package/build-module/navigator/index.js +6 -6
- package/build-module/navigator/index.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +1 -1
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +1 -1
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +99 -67
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +4 -0
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/navigator/navigator-to-parent-button/component.js +1 -1
- 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/navigator/use-navigator.js +1 -2
- package/build-module/navigator/use-navigator.js.map +1 -1
- package/build-module/palette-edit/index.js +2 -2
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js +1 -14
- package/build-module/private-apis.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +31 -31
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +5 -5
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +13 -13
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/slot-fill/bubbles-virtually/fill.js +4 -4
- package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
- package/build-module/slot-fill/index.js +1 -0
- package/build-module/slot-fill/index.js.map +1 -1
- package/build-module/snackbar/index.js +4 -4
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/tabs/index.js +4 -4
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/styles.js +4 -4
- package/build-module/tabs/styles.js.map +1 -1
- package/build-module/tabs/tablist.js +5 -4
- package/build-module/tabs/tablist.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/utils.js +6 -6
- package/build-module/toggle-group-control/toggle-group-control/utils.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +6 -6
- package/build-module/tools-panel/tools-panel/hook.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 +10 -9
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/element-rect.js +74 -105
- package/build-module/utils/element-rect.js.map +1 -1
- package/build-module/utils/hooks/use-update-effect.js +4 -4
- package/build-module/utils/hooks/use-update-effect.js.map +1 -1
- package/build-style/style-rtl.css +60 -31
- package/build-style/style.css +60 -31
- package/build-types/alignment-matrix-control/cell.d.ts +1 -1
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/icon.d.ts +1 -1
- package/build-types/alignment-matrix-control/icon.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/index.d.ts +16 -6
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/stories/index.story.d.ts.map +1 -1
- package/build-types/alignment-matrix-control/{styles/alignment-matrix-control-styles.d.ts → styles.d.ts} +9 -10
- package/build-types/alignment-matrix-control/styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/types.d.ts +12 -1
- package/build-types/alignment-matrix-control/types.d.ts.map +1 -1
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/box-control/all-input-control.d.ts.map +1 -1
- package/build-types/box-control/stories/index.story.d.ts.map +1 -1
- package/build-types/box-control/utils.d.ts +1 -1
- package/build-types/box-control/utils.d.ts.map +1 -1
- package/build-types/button-group/stories/index.story.d.ts +2 -2
- package/build-types/button-group/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/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/types.d.ts +2 -2
- 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/color-copy-button.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.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 +4 -0
- package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
- package/build-types/combobox-control/types.d.ts +5 -0
- package/build-types/combobox-control/types.d.ts.map +1 -1
- package/build-types/composite/context.d.ts.map +1 -1
- package/build-types/composite/group-label.d.ts +3 -0
- package/build-types/composite/group-label.d.ts.map +1 -0
- package/build-types/composite/group.d.ts +3 -0
- package/build-types/composite/group.d.ts.map +1 -0
- package/build-types/composite/hover.d.ts +3 -0
- package/build-types/composite/hover.d.ts.map +1 -0
- package/build-types/composite/index.d.ts +63 -47
- package/build-types/composite/index.d.ts.map +1 -1
- package/build-types/composite/item.d.ts +3 -0
- package/build-types/composite/item.d.ts.map +1 -0
- package/build-types/composite/legacy/index.d.ts +23 -3
- package/build-types/composite/legacy/index.d.ts.map +1 -1
- package/build-types/composite/legacy/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/row.d.ts +3 -0
- package/build-types/composite/row.d.ts.map +1 -0
- package/build-types/composite/stories/index.story.d.ts +9 -8
- package/build-types/composite/stories/index.story.d.ts.map +1 -1
- package/build-types/composite/typeahead.d.ts +3 -0
- package/build-types/composite/typeahead.d.ts.map +1 -0
- package/build-types/composite/types.d.ts +12 -11
- package/build-types/composite/types.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/styles.d.ts.map +1 -1
- package/build-types/date-time/date/index.d.ts +0 -3
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
- package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
- package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
- package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
- package/build-types/date-time/time/time-input/index.d.ts.map +1 -1
- package/build-types/dimension-control/index.d.ts +1 -1
- package/build-types/dimension-control/index.d.ts.map +1 -1
- package/build-types/dimension-control/stories/index.story.d.ts +5 -0
- package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/checkbox-item.d.ts +3 -0
- package/build-types/dropdown-menu-v2/checkbox-item.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/context.d.ts +6 -0
- package/build-types/dropdown-menu-v2/context.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/group-label.d.ts +3 -0
- package/build-types/dropdown-menu-v2/group-label.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/group.d.ts +3 -0
- package/build-types/dropdown-menu-v2/group.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/index.d.ts +39 -18
- package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/item-help-text.d.ts +6 -0
- package/build-types/dropdown-menu-v2/item-help-text.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/item-label.d.ts +6 -0
- package/build-types/dropdown-menu-v2/item-label.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/item.d.ts +3 -0
- package/build-types/dropdown-menu-v2/item.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/radio-item.d.ts +3 -0
- package/build-types/dropdown-menu-v2/radio-item.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/separator.d.ts +3 -0
- package/build-types/dropdown-menu-v2/separator.d.ts.map +1 -0
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts +10 -10
- package/build-types/dropdown-menu-v2/stories/index.story.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/styles.d.ts +14 -6
- package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/types.d.ts +6 -0
- package/build-types/dropdown-menu-v2/types.d.ts.map +1 -1
- package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts +8 -0
- package/build-types/dropdown-menu-v2/use-temporary-focus-visible-fix.d.ts.map +1 -0
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +1 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/index.d.ts +4 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts +2 -2
- package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/input-suffix-wrapper.d.ts +2 -2
- package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/stories/index.story.d.ts +9 -0
- package/build-types/input-control/stories/index.story.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +15 -9
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +23 -6
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/stories/index.story.d.ts +3 -0
- package/build-types/modal/stories/index.story.d.ts.map +1 -1
- package/build-types/modal/types.d.ts +6 -10
- package/build-types/modal/types.d.ts.map +1 -1
- package/build-types/modal/use-modal-exit-animation.d.ts +9 -0
- package/build-types/modal/use-modal-exit-animation.d.ts.map +1 -0
- package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
- package/build-types/navigator/index.d.ts +6 -6
- package/build-types/navigator/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.story.d.ts +1 -1
- package/build-types/navigator/stories/index.story.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +3 -1
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/navigator/use-navigator.d.ts +1 -2
- package/build-types/navigator/use-navigator.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/slot-fill/index.d.ts +3 -0
- package/build-types/slot-fill/index.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts.map +1 -1
- package/build-types/tabs/styles.d.ts.map +1 -1
- package/build-types/tabs/tablist.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +3 -4
- package/build-types/utils/element-rect.d.ts +32 -74
- package/build-types/utils/element-rect.d.ts.map +1 -1
- package/package.json +19 -20
- package/src/alignment-matrix-control/README.md +1 -5
- package/src/alignment-matrix-control/cell.tsx +3 -9
- package/src/alignment-matrix-control/icon.tsx +48 -30
- package/src/alignment-matrix-control/index.tsx +60 -50
- package/src/alignment-matrix-control/stories/index.story.tsx +3 -12
- package/src/alignment-matrix-control/styles.ts +113 -0
- package/src/alignment-matrix-control/types.ts +12 -1
- package/src/angle-picker-control/angle-circle.tsx +11 -9
- package/src/border-control/border-control/component.tsx +23 -16
- package/src/box-control/README.md +7 -0
- package/src/box-control/all-input-control.tsx +2 -3
- package/src/box-control/utils.ts +1 -1
- package/src/button-group/stories/index.story.tsx +10 -15
- package/src/card/card/component.tsx +1 -1
- package/src/card/styles.ts +1 -1
- package/src/card/test/__snapshots__/index.tsx.snap +54 -54
- package/src/circular-option-picker/circular-option-picker-option.tsx +16 -19
- package/src/circular-option-picker/circular-option-picker.tsx +26 -12
- package/src/circular-option-picker/types.ts +2 -2
- package/src/clipboard-button/index.tsx +6 -6
- package/src/color-palette/test/utils.ts +21 -2
- package/src/color-palette/utils.ts +1 -3
- package/src/color-picker/color-copy-button.tsx +10 -8
- package/src/color-picker/hex-input.tsx +6 -10
- package/src/color-picker/input-with-slider.tsx +6 -10
- package/src/color-picker/styles.ts +1 -1
- package/src/combobox-control/README.md +7 -0
- package/src/combobox-control/index.tsx +2 -0
- package/src/combobox-control/test/index.tsx +40 -0
- package/src/combobox-control/types.ts +5 -0
- package/src/composite/README.md +5 -24
- package/src/composite/{context.ts → context.tsx} +1 -2
- package/src/composite/group-label.tsx +30 -0
- package/src/composite/group.tsx +30 -0
- package/src/composite/hover.tsx +30 -0
- package/src/composite/index.tsx +71 -166
- package/src/composite/item.tsx +30 -0
- package/src/composite/legacy/index.tsx +73 -11
- package/src/composite/legacy/stories/index.story.tsx +2 -1
- package/src/composite/legacy/test/index.tsx +57 -1
- package/src/composite/row.tsx +30 -0
- package/src/composite/stories/index.story.tsx +254 -365
- package/src/composite/typeahead.tsx +30 -0
- package/src/composite/types.ts +14 -16
- package/src/custom-gradient-picker/gradient-bar/control-points.tsx +10 -10
- package/src/custom-gradient-picker/style.scss +2 -21
- package/src/custom-select-control-v2/styles.ts +5 -4
- package/src/date-time/date/index.tsx +1 -1
- package/src/date-time/date/styles.ts +33 -13
- package/src/date-time/date/test/use-lilius.ts +417 -0
- package/src/date-time/date/use-lilius/index.ts +394 -0
- package/src/date-time/time/test/index.tsx +3 -6
- package/src/date-time/time/time-input/index.tsx +25 -25
- package/src/date-time/time/time-input/test/index.tsx +6 -7
- package/src/dimension-control/README.md +4 -0
- package/src/dimension-control/index.tsx +7 -1
- package/src/dimension-control/stories/index.story.tsx +7 -2
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +16 -16
- package/src/dimension-control/test/index.test.js +1 -0
- package/src/draggable/index.tsx +4 -4
- package/src/dropdown-menu-v2/README.md +73 -60
- package/src/dropdown-menu-v2/checkbox-item.tsx +63 -0
- package/src/dropdown-menu-v2/context.tsx +13 -0
- package/src/dropdown-menu-v2/group-label.tsx +37 -0
- package/src/dropdown-menu-v2/group.tsx +26 -0
- package/src/dropdown-menu-v2/index.tsx +57 -197
- package/src/dropdown-menu-v2/item-help-text.tsx +23 -0
- package/src/dropdown-menu-v2/item-label.tsx +23 -0
- package/src/dropdown-menu-v2/item.tsx +50 -0
- package/src/dropdown-menu-v2/radio-item.tsx +70 -0
- package/src/dropdown-menu-v2/separator.tsx +27 -0
- package/src/dropdown-menu-v2/stories/index.story.tsx +295 -262
- package/src/dropdown-menu-v2/styles.ts +103 -67
- package/src/dropdown-menu-v2/test/index.tsx +159 -132
- package/src/dropdown-menu-v2/types.ts +7 -0
- package/src/dropdown-menu-v2/use-temporary-focus-visible-fix.ts +22 -0
- package/src/focal-point-picker/styles/focal-point-style.ts +6 -1
- package/src/form-toggle/style.scss +2 -1
- package/src/form-token-field/style.scss +2 -3
- package/src/form-token-field/types.ts +1 -0
- package/src/index.ts +6 -1
- package/src/input-control/index.tsx +2 -2
- package/src/input-control/input-base.tsx +4 -14
- package/src/input-control/input-prefix-wrapper.tsx +8 -4
- package/src/input-control/input-suffix-wrapper.tsx +4 -6
- package/src/input-control/reducer/reducer.ts +13 -10
- package/src/input-control/stories/index.story.tsx +31 -12
- package/src/input-control/styles/input-control-styles.tsx +42 -11
- package/src/input-control/types.ts +23 -7
- package/src/input-control/utils.ts +3 -3
- package/src/item-group/styles.ts +3 -3
- package/src/item-group/test/__snapshots__/index.js.snap +3 -3
- package/src/modal/index.tsx +47 -24
- package/src/modal/stories/index.story.tsx +8 -14
- package/src/modal/style.scss +34 -11
- package/src/modal/types.ts +6 -18
- package/src/modal/use-modal-exit-animation.ts +99 -0
- package/src/navigation/index.tsx +4 -4
- package/src/navigation/styles/navigation-styles.tsx +3 -3
- package/src/navigator/index.ts +6 -6
- package/src/navigator/navigator-back-button/hook.ts +1 -1
- package/src/navigator/navigator-button/hook.ts +1 -1
- package/src/navigator/navigator-provider/README.md +2 -3
- package/src/navigator/navigator-provider/component.tsx +97 -82
- package/src/navigator/navigator-screen/component.tsx +7 -0
- package/src/navigator/navigator-to-parent-button/component.tsx +1 -1
- package/src/navigator/stories/index.story.tsx +82 -253
- package/src/navigator/test/index.tsx +8 -0
- package/src/navigator/types.ts +3 -1
- package/src/navigator/use-navigator.ts +1 -3
- package/src/palette-edit/index.tsx +2 -2
- package/src/popover/style.scss +3 -2
- package/src/private-apis.ts +1 -23
- package/src/range-control/styles/range-control-styles.ts +8 -7
- package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.ts +2 -2
- package/src/resizable-box/style.scss +3 -3
- package/src/select-control/README.md +2 -2
- package/src/select-control/styles/select-control-styles.ts +5 -5
- package/src/slot-fill/bubbles-virtually/fill.tsx +4 -4
- package/src/slot-fill/index.tsx +1 -0
- package/src/snackbar/index.tsx +4 -4
- package/src/snackbar/style.scss +1 -1
- package/src/tab-panel/style.scss +0 -1
- package/src/tabs/index.tsx +8 -4
- package/src/tabs/styles.ts +42 -14
- package/src/tabs/tablist.tsx +5 -4
- package/src/text-control/style.scss +3 -2
- package/src/toggle-group-control/toggle-group-control/utils.ts +7 -7
- package/src/tools-panel/tools-panel/hook.ts +6 -6
- package/src/tooltip/style.scss +1 -0
- package/src/unit-control/styles/unit-control-styles.ts +2 -1
- package/src/utils/config-values.js +10 -9
- package/src/utils/element-rect.ts +93 -130
- package/src/utils/hooks/use-update-effect.js +4 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +0 -66
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +0 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +0 -77
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +0 -1
- package/build/navigator/navigator-back-button/index.js +0 -14
- package/build/navigator/navigator-back-button/index.js.map +0 -1
- package/build/navigator/navigator-button/index.js +0 -14
- package/build/navigator/navigator-button/index.js.map +0 -1
- package/build/navigator/navigator-provider/index.js +0 -14
- package/build/navigator/navigator-provider/index.js.map +0 -1
- package/build/navigator/navigator-screen/index.js +0 -14
- package/build/navigator/navigator-screen/index.js.map +0 -1
- package/build/navigator/navigator-to-parent-button/index.js +0 -14
- package/build/navigator/navigator-to-parent-button/index.js.map +0 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +0 -63
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +0 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +0 -72
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +0 -1
- package/build-module/navigator/navigator-back-button/index.js +0 -2
- package/build-module/navigator/navigator-back-button/index.js.map +0 -1
- package/build-module/navigator/navigator-button/index.js +0 -2
- package/build-module/navigator/navigator-button/index.js.map +0 -1
- package/build-module/navigator/navigator-provider/index.js +0 -2
- package/build-module/navigator/navigator-provider/index.js.map +0 -1
- package/build-module/navigator/navigator-screen/index.js +0 -2
- package/build-module/navigator/navigator-screen/index.js.map +0 -1
- package/build-module/navigator/navigator-to-parent-button/index.js +0 -2
- package/build-module/navigator/navigator-to-parent-button/index.js.map +0 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +0 -18
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +0 -1
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +0 -1
- package/build-types/composite/stories/utils.d.ts +0 -29
- package/build-types/composite/stories/utils.d.ts.map +0 -1
- package/build-types/navigator/navigator-back-button/index.d.ts +0 -2
- package/build-types/navigator/navigator-back-button/index.d.ts.map +0 -1
- package/build-types/navigator/navigator-button/index.d.ts +0 -2
- package/build-types/navigator/navigator-button/index.d.ts.map +0 -1
- package/build-types/navigator/navigator-provider/index.d.ts +0 -2
- package/build-types/navigator/navigator-provider/index.d.ts.map +0 -1
- package/build-types/navigator/navigator-screen/index.d.ts +0 -2
- package/build-types/navigator/navigator-screen/index.d.ts.map +0 -1
- package/build-types/navigator/navigator-to-parent-button/index.d.ts +0 -2
- package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +0 -1
- package/src/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.ts +0 -77
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +0 -102
- package/src/composite/stories/utils.tsx +0 -76
- package/src/navigator/navigator-back-button/index.ts +0 -1
- package/src/navigator/navigator-button/index.ts +0 -1
- package/src/navigator/navigator-provider/index.ts +0 -1
- package/src/navigator/navigator-screen/index.ts +0 -1
- package/src/navigator/navigator-to-parent-button/index.ts +0 -1
package/src/modal/style.scss
CHANGED
|
@@ -8,9 +8,15 @@
|
|
|
8
8
|
background-color: rgba($black, 0.35);
|
|
9
9
|
z-index: z-index(".components-modal__screen-overlay");
|
|
10
10
|
display: flex;
|
|
11
|
-
// backdrop
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// This animates the appearance of the backdrop.
|
|
12
|
+
@include animation__fade-in();
|
|
13
|
+
|
|
14
|
+
&.is-animating-out {
|
|
15
|
+
// Note: it's important that the fade-out animation doesn't end after the
|
|
16
|
+
// modal frame's disappear animation, because the component will be removed
|
|
17
|
+
// from the DOM when that animation ends.
|
|
18
|
+
@include animation__fade-out($delay: 80ms);
|
|
19
|
+
}
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
// The modal window element.
|
|
@@ -26,10 +32,17 @@
|
|
|
26
32
|
// Have the content element fill the vertical space yet not overflow.
|
|
27
33
|
display: flex;
|
|
28
34
|
// Animate the modal frame/contents appearing on the page.
|
|
29
|
-
animation: components-modal__appear-animation
|
|
35
|
+
animation-name: components-modal__appear-animation;
|
|
36
|
+
animation-duration: var(--modal-frame-animation-duration);
|
|
30
37
|
animation-fill-mode: forwards;
|
|
38
|
+
animation-timing-function: cubic-bezier(0.29, 0, 0, 1);
|
|
31
39
|
@include reduce-motion("animation");
|
|
32
40
|
|
|
41
|
+
.components-modal__screen-overlay.is-animating-out & {
|
|
42
|
+
animation-name: components-modal__disappear-animation;
|
|
43
|
+
animation-timing-function: cubic-bezier(1, 0, 0.2, 1);
|
|
44
|
+
}
|
|
45
|
+
|
|
33
46
|
// Show a centered modal on bigger screens.
|
|
34
47
|
@include break-small() {
|
|
35
48
|
border-radius: $radius-large;
|
|
@@ -80,10 +93,25 @@
|
|
|
80
93
|
|
|
81
94
|
@keyframes components-modal__appear-animation {
|
|
82
95
|
from {
|
|
83
|
-
|
|
96
|
+
opacity: 0;
|
|
97
|
+
transform: scale(0.9);
|
|
84
98
|
}
|
|
85
99
|
to {
|
|
86
|
-
|
|
100
|
+
opacity: 1;
|
|
101
|
+
transform: scale(1);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Note: this animation is also used in the animationend JS event listener.
|
|
106
|
+
// Make sure that the animation name is kept in sync across the two files.
|
|
107
|
+
@keyframes components-modal__disappear-animation {
|
|
108
|
+
from {
|
|
109
|
+
opacity: 1;
|
|
110
|
+
transform: scale(1);
|
|
111
|
+
}
|
|
112
|
+
to {
|
|
113
|
+
opacity: 0;
|
|
114
|
+
transform: scale(0.9);
|
|
87
115
|
}
|
|
88
116
|
}
|
|
89
117
|
|
|
@@ -115,11 +143,6 @@
|
|
|
115
143
|
margin: 0;
|
|
116
144
|
}
|
|
117
145
|
|
|
118
|
-
.components-button {
|
|
119
|
-
position: relative;
|
|
120
|
-
left: $grid-unit-10;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
146
|
.components-modal__content.has-scrolled-content:not(.hide-header) & {
|
|
124
147
|
border-bottom-color: $gray-300;
|
|
125
148
|
}
|
package/src/modal/types.ts
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type {
|
|
5
|
-
AriaRole,
|
|
6
|
-
CSSProperties,
|
|
7
|
-
ReactNode,
|
|
8
|
-
KeyboardEventHandler,
|
|
9
|
-
KeyboardEvent,
|
|
10
|
-
SyntheticEvent,
|
|
11
|
-
} from 'react';
|
|
12
|
-
|
|
13
1
|
/**
|
|
14
2
|
* WordPress dependencies
|
|
15
3
|
*/
|
|
@@ -42,7 +30,7 @@ export type ModalProps = {
|
|
|
42
30
|
/**
|
|
43
31
|
* The children elements.
|
|
44
32
|
*/
|
|
45
|
-
children: ReactNode;
|
|
33
|
+
children: React.ReactNode;
|
|
46
34
|
/**
|
|
47
35
|
* If this property is added, it will an additional class name to the modal
|
|
48
36
|
* content `div`.
|
|
@@ -77,7 +65,7 @@ export type ModalProps = {
|
|
|
77
65
|
*
|
|
78
66
|
* @default null
|
|
79
67
|
*/
|
|
80
|
-
headerActions?: ReactNode;
|
|
68
|
+
headerActions?: React.ReactNode;
|
|
81
69
|
|
|
82
70
|
/**
|
|
83
71
|
* If this property is added, an icon will be added before the title.
|
|
@@ -108,12 +96,12 @@ export type ModalProps = {
|
|
|
108
96
|
/**
|
|
109
97
|
* Handle the key down on the modal frame `div`.
|
|
110
98
|
*/
|
|
111
|
-
onKeyDown?: KeyboardEventHandler< HTMLDivElement >;
|
|
99
|
+
onKeyDown?: React.KeyboardEventHandler< HTMLDivElement >;
|
|
112
100
|
/**
|
|
113
101
|
* This function is called to indicate that the modal should be closed.
|
|
114
102
|
*/
|
|
115
103
|
onRequestClose: (
|
|
116
|
-
event?: KeyboardEvent< HTMLDivElement > | SyntheticEvent
|
|
104
|
+
event?: React.KeyboardEvent< HTMLDivElement > | React.SyntheticEvent
|
|
117
105
|
) => void;
|
|
118
106
|
/**
|
|
119
107
|
* If this property is added, it will an additional class name to the modal
|
|
@@ -126,7 +114,7 @@ export type ModalProps = {
|
|
|
126
114
|
*
|
|
127
115
|
* @default 'dialog'
|
|
128
116
|
*/
|
|
129
|
-
role?: AriaRole;
|
|
117
|
+
role?: React.AriaRole;
|
|
130
118
|
/**
|
|
131
119
|
* If this property is added, it will determine whether the modal requests
|
|
132
120
|
* to close when a mouse click occurs outside of the modal content.
|
|
@@ -144,7 +132,7 @@ export type ModalProps = {
|
|
|
144
132
|
/**
|
|
145
133
|
* If this property is added, it will be added to the modal frame `div`.
|
|
146
134
|
*/
|
|
147
|
-
style?: CSSProperties;
|
|
135
|
+
style?: React.CSSProperties;
|
|
148
136
|
/**
|
|
149
137
|
* This property is used as the modal header's title.
|
|
150
138
|
*
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
5
|
+
import { useCallback, useRef, useState } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { CONFIG } from '../utils';
|
|
11
|
+
import warning from '@wordpress/warning';
|
|
12
|
+
|
|
13
|
+
// Animation duration (ms) extracted to JS in order to be used on a setTimeout.
|
|
14
|
+
const FRAME_ANIMATION_DURATION = CONFIG.transitionDuration;
|
|
15
|
+
const FRAME_ANIMATION_DURATION_NUMBER = Number.parseInt(
|
|
16
|
+
CONFIG.transitionDuration
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const EXIT_ANIMATION_NAME = 'components-modal__disappear-animation';
|
|
20
|
+
|
|
21
|
+
export function useModalExitAnimation() {
|
|
22
|
+
const frameRef = useRef< HTMLDivElement >();
|
|
23
|
+
const [ isAnimatingOut, setIsAnimatingOut ] = useState( false );
|
|
24
|
+
const isReducedMotion = useReducedMotion();
|
|
25
|
+
|
|
26
|
+
const closeModal = useCallback(
|
|
27
|
+
() =>
|
|
28
|
+
new Promise< void >( ( closeModalResolve ) => {
|
|
29
|
+
// Grab a "stable" reference of the frame element, since
|
|
30
|
+
// the value held by the react ref might change at runtime.
|
|
31
|
+
const frameEl = frameRef.current;
|
|
32
|
+
|
|
33
|
+
if ( isReducedMotion ) {
|
|
34
|
+
closeModalResolve();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if ( ! frameEl ) {
|
|
39
|
+
warning(
|
|
40
|
+
"wp.components.Modal: the Modal component can't be closed with an exit animation because of a missing reference to the modal frame element."
|
|
41
|
+
);
|
|
42
|
+
closeModalResolve();
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let handleAnimationEnd:
|
|
47
|
+
| undefined
|
|
48
|
+
| ( ( e: AnimationEvent ) => void );
|
|
49
|
+
|
|
50
|
+
const startAnimation = () =>
|
|
51
|
+
new Promise< void >( ( animationResolve ) => {
|
|
52
|
+
handleAnimationEnd = ( e: AnimationEvent ) => {
|
|
53
|
+
if ( e.animationName === EXIT_ANIMATION_NAME ) {
|
|
54
|
+
animationResolve();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
frameEl.addEventListener(
|
|
59
|
+
'animationend',
|
|
60
|
+
handleAnimationEnd
|
|
61
|
+
);
|
|
62
|
+
setIsAnimatingOut( true );
|
|
63
|
+
} );
|
|
64
|
+
const animationTimeout = () =>
|
|
65
|
+
new Promise< void >( ( timeoutResolve ) => {
|
|
66
|
+
setTimeout(
|
|
67
|
+
() => timeoutResolve(),
|
|
68
|
+
// Allow an extra 20% of the animation duration for the
|
|
69
|
+
// animationend event to fire, in case the animation frame is
|
|
70
|
+
// slightly delayes by some other events in the event loop.
|
|
71
|
+
FRAME_ANIMATION_DURATION_NUMBER * 1.2
|
|
72
|
+
);
|
|
73
|
+
} );
|
|
74
|
+
|
|
75
|
+
Promise.race( [ startAnimation(), animationTimeout() ] ).then(
|
|
76
|
+
() => {
|
|
77
|
+
if ( handleAnimationEnd ) {
|
|
78
|
+
frameEl.removeEventListener(
|
|
79
|
+
'animationend',
|
|
80
|
+
handleAnimationEnd
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
setIsAnimatingOut( false );
|
|
84
|
+
closeModalResolve();
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
} ),
|
|
88
|
+
[ isReducedMotion ]
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
overlayClassname: isAnimatingOut ? 'is-animating-out' : undefined,
|
|
93
|
+
frameRef,
|
|
94
|
+
frameStyle: {
|
|
95
|
+
'--modal-frame-animation-duration': `${ FRAME_ANIMATION_DURATION }`,
|
|
96
|
+
},
|
|
97
|
+
closeModal,
|
|
98
|
+
};
|
|
99
|
+
}
|
package/src/navigation/index.tsx
CHANGED
|
@@ -93,10 +93,10 @@ export function Navigation( {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
// Used to prevent the sliding animation on mount
|
|
96
|
-
const
|
|
96
|
+
const isMountedRef = useRef( false );
|
|
97
97
|
useEffect( () => {
|
|
98
|
-
if ( !
|
|
99
|
-
|
|
98
|
+
if ( ! isMountedRef.current ) {
|
|
99
|
+
isMountedRef.current = true;
|
|
100
100
|
}
|
|
101
101
|
}, [] );
|
|
102
102
|
|
|
@@ -130,7 +130,7 @@ export function Navigation( {
|
|
|
130
130
|
animateClassName
|
|
131
131
|
? clsx( {
|
|
132
132
|
[ animateClassName ]:
|
|
133
|
-
|
|
133
|
+
isMountedRef.current && slideOrigin,
|
|
134
134
|
} )
|
|
135
135
|
: undefined
|
|
136
136
|
}
|
|
@@ -15,7 +15,7 @@ import { COLORS } from '../../utils/colors-values';
|
|
|
15
15
|
import Button from '../../button';
|
|
16
16
|
import { Text } from '../../text';
|
|
17
17
|
import { Heading } from '../../heading';
|
|
18
|
-
import { rtl } from '../../utils';
|
|
18
|
+
import { rtl, CONFIG } from '../../utils';
|
|
19
19
|
import { space } from '../../utils/space';
|
|
20
20
|
|
|
21
21
|
export const NavigationUI = styled.div`
|
|
@@ -111,7 +111,7 @@ export const GroupTitleUI = styled( Heading )`
|
|
|
111
111
|
`;
|
|
112
112
|
|
|
113
113
|
export const ItemBaseUI = styled.li`
|
|
114
|
-
border-radius:
|
|
114
|
+
border-radius: ${ CONFIG.radiusSmall };
|
|
115
115
|
color: inherit;
|
|
116
116
|
margin-bottom: 0;
|
|
117
117
|
|
|
@@ -172,7 +172,7 @@ export const ItemBadgeUI = styled.span`
|
|
|
172
172
|
margin-right: ${ () => ( isRTL() ? space( 2 ) : '0' ) };
|
|
173
173
|
display: inline-flex;
|
|
174
174
|
padding: ${ space( 1 ) } ${ space( 3 ) };
|
|
175
|
-
border-radius:
|
|
175
|
+
border-radius: ${ CONFIG.radiusSmall };
|
|
176
176
|
|
|
177
177
|
@keyframes fade-in {
|
|
178
178
|
from {
|
package/src/navigator/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { NavigatorProvider } from './navigator-provider';
|
|
2
|
-
export { NavigatorScreen } from './navigator-screen';
|
|
3
|
-
export { NavigatorButton } from './navigator-button';
|
|
4
|
-
export { NavigatorBackButton } from './navigator-back-button';
|
|
5
|
-
export { NavigatorToParentButton } from './navigator-to-parent-button';
|
|
6
|
-
export {
|
|
1
|
+
export { NavigatorProvider } from './navigator-provider/component';
|
|
2
|
+
export { NavigatorScreen } from './navigator-screen/component';
|
|
3
|
+
export { NavigatorButton } from './navigator-button/component';
|
|
4
|
+
export { NavigatorBackButton } from './navigator-back-button/component';
|
|
5
|
+
export { NavigatorToParentButton } from './navigator-to-parent-button/component';
|
|
6
|
+
export { useNavigator } from './use-navigator';
|
|
@@ -9,7 +9,7 @@ import { useCallback } from '@wordpress/element';
|
|
|
9
9
|
import type { WordPressComponentProps } from '../../context';
|
|
10
10
|
import { useContextSystem } from '../../context';
|
|
11
11
|
import Button from '../../button';
|
|
12
|
-
import useNavigator from '../use-navigator';
|
|
12
|
+
import { useNavigator } from '../use-navigator';
|
|
13
13
|
import type { NavigatorBackButtonProps } from '../types';
|
|
14
14
|
|
|
15
15
|
export function useNavigatorBackButton(
|
|
@@ -10,7 +10,7 @@ import { escapeAttribute } from '@wordpress/escape-html';
|
|
|
10
10
|
import type { WordPressComponentProps } from '../../context';
|
|
11
11
|
import { useContextSystem } from '../../context';
|
|
12
12
|
import Button from '../../button';
|
|
13
|
-
import useNavigator from '../use-navigator';
|
|
13
|
+
import { useNavigator } from '../use-navigator';
|
|
14
14
|
import type { NavigatorButtonProps } from '../types';
|
|
15
15
|
|
|
16
16
|
const cssSelectorForAttribute = ( attrName: string, attrValue: string ) =>
|
|
@@ -72,7 +72,6 @@ The available options are:
|
|
|
72
72
|
- `focusTargetSelector`: `string`. An optional property used to specify the CSS selector used to restore focus on the matching element when navigating back;
|
|
73
73
|
- `isBack`: `boolean`. An optional property used to specify whether the navigation should be considered as backwards (thus enabling focus restoration when possible, and causing the animation to be backwards too);
|
|
74
74
|
- `skipFocus`: `boolean`. An optional property used to opt out of `Navigator`'s focus management, useful when the consumer of the component wants to manage focus themselves;
|
|
75
|
-
- `replace`: `boolean`. An optional property used to cause the new location to replace the current location in the stack.
|
|
76
75
|
|
|
77
76
|
### `goBack`: `( path: string, options: NavigateOptions ) => void`
|
|
78
77
|
|
|
@@ -87,8 +86,8 @@ The available options are the same as for the `goTo` method, except for the `isB
|
|
|
87
86
|
The `location` object represent the current location, and has a few properties:
|
|
88
87
|
|
|
89
88
|
- `path`: `string`. The path associated to the location.
|
|
90
|
-
- `isBack`: `boolean`. A flag that is `true` when the current location was reached by navigating backwards
|
|
91
|
-
- `isInitial`: `boolean`. A flag that is `true` only for the
|
|
89
|
+
- `isBack`: `boolean`. A flag that is `true` when the current location was reached by navigating backwards.
|
|
90
|
+
- `isInitial`: `boolean`. A flag that is `true` only for the initial location.
|
|
92
91
|
|
|
93
92
|
### `params`: `Record< string, string | string[] >`
|
|
94
93
|
|
|
@@ -8,6 +8,7 @@ import type { ForwardedRef } from 'react';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useMemo, useReducer } from '@wordpress/element';
|
|
10
10
|
import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
11
|
+
import warning from '@wordpress/warning';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -37,14 +38,21 @@ type RouterAction =
|
|
|
37
38
|
| { type: 'gotoparent'; options?: NavigateToParentOptions };
|
|
38
39
|
|
|
39
40
|
type RouterState = {
|
|
41
|
+
initialPath: string;
|
|
40
42
|
screens: Screen[];
|
|
41
|
-
|
|
43
|
+
currentLocation: NavigatorLocation;
|
|
42
44
|
matchedPath: MatchedPath;
|
|
45
|
+
focusSelectors: Map< string, string >;
|
|
43
46
|
};
|
|
44
47
|
|
|
45
|
-
const MAX_HISTORY_LENGTH = 50;
|
|
46
|
-
|
|
47
48
|
function addScreen( { screens }: RouterState, screen: Screen ) {
|
|
49
|
+
if ( screens.some( ( s ) => s.path === screen.path ) ) {
|
|
50
|
+
warning(
|
|
51
|
+
`Navigator: a screen with path ${ screen.path } already exists.
|
|
52
|
+
The screen with id ${ screen.id } will not be added.`
|
|
53
|
+
);
|
|
54
|
+
return screens;
|
|
55
|
+
}
|
|
48
56
|
return [ ...screens, screen ];
|
|
49
57
|
}
|
|
50
58
|
|
|
@@ -52,95 +60,83 @@ function removeScreen( { screens }: RouterState, screen: Screen ) {
|
|
|
52
60
|
return screens.filter( ( s ) => s.id !== screen.id );
|
|
53
61
|
}
|
|
54
62
|
|
|
55
|
-
function goBack( { locationHistory }: RouterState ) {
|
|
56
|
-
if ( locationHistory.length <= 1 ) {
|
|
57
|
-
return locationHistory;
|
|
58
|
-
}
|
|
59
|
-
return [
|
|
60
|
-
...locationHistory.slice( 0, -2 ),
|
|
61
|
-
{
|
|
62
|
-
...locationHistory[ locationHistory.length - 2 ],
|
|
63
|
-
isBack: true,
|
|
64
|
-
hasRestoredFocus: false,
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
63
|
function goTo(
|
|
70
64
|
state: RouterState,
|
|
71
65
|
path: string,
|
|
72
66
|
options: NavigateOptions = {}
|
|
73
67
|
) {
|
|
74
|
-
const {
|
|
68
|
+
const { focusSelectors } = state;
|
|
69
|
+
const currentLocation = { ...state.currentLocation, isInitial: false };
|
|
70
|
+
|
|
75
71
|
const {
|
|
76
|
-
|
|
72
|
+
// Default assignments
|
|
77
73
|
isBack = false,
|
|
78
74
|
skipFocus = false,
|
|
79
|
-
|
|
75
|
+
// Extract to avoid forwarding
|
|
76
|
+
replace,
|
|
77
|
+
focusTargetSelector,
|
|
78
|
+
// Rest
|
|
80
79
|
...restOptions
|
|
81
80
|
} = options;
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
locationHistory[ locationHistory.length - 1 ].path === path;
|
|
86
|
-
if ( isNavigatingToSamePath ) {
|
|
87
|
-
return locationHistory;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const isNavigatingToPreviousPath =
|
|
91
|
-
isBack &&
|
|
92
|
-
locationHistory.length > 1 &&
|
|
93
|
-
locationHistory[ locationHistory.length - 2 ].path === path;
|
|
94
|
-
|
|
95
|
-
if ( isNavigatingToPreviousPath ) {
|
|
96
|
-
return goBack( state );
|
|
82
|
+
if ( currentLocation.path === path ) {
|
|
83
|
+
return { currentLocation, focusSelectors };
|
|
97
84
|
}
|
|
98
85
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
skipFocus,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
if ( locationHistory.length === 0 ) {
|
|
108
|
-
return replace ? [] : [ newLocation ];
|
|
86
|
+
let focusSelectorsCopy: typeof focusSelectors | undefined;
|
|
87
|
+
function getFocusSelectorsCopy() {
|
|
88
|
+
focusSelectorsCopy =
|
|
89
|
+
focusSelectorsCopy ?? new Map( state.focusSelectors );
|
|
90
|
+
return focusSelectorsCopy;
|
|
109
91
|
}
|
|
110
92
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
newLocationHistory.push(
|
|
118
|
-
// Assign `focusTargetSelector` to the previous location in history
|
|
119
|
-
// (the one we just navigated from).
|
|
120
|
-
{
|
|
121
|
-
...locationHistory[ locationHistory.length - 1 ],
|
|
122
|
-
focusTargetSelector,
|
|
123
|
-
}
|
|
93
|
+
// Set a focus selector that will be used when navigating
|
|
94
|
+
// back to the current location.
|
|
95
|
+
if ( focusTargetSelector && currentLocation.path ) {
|
|
96
|
+
getFocusSelectorsCopy().set(
|
|
97
|
+
currentLocation.path,
|
|
98
|
+
focusTargetSelector
|
|
124
99
|
);
|
|
125
100
|
}
|
|
126
101
|
|
|
127
|
-
|
|
102
|
+
// Get the focus selector for the new location.
|
|
103
|
+
let currentFocusSelector;
|
|
104
|
+
if ( focusSelectors.get( path ) ) {
|
|
105
|
+
if ( isBack ) {
|
|
106
|
+
// Use the found focus selector only when navigating back.
|
|
107
|
+
currentFocusSelector = focusSelectors.get( path );
|
|
108
|
+
}
|
|
109
|
+
// Make a copy of the focusSelectors map to remove the focus selector
|
|
110
|
+
// only if necessary (ie. a focus selector was found).
|
|
111
|
+
getFocusSelectorsCopy().delete( path );
|
|
112
|
+
}
|
|
128
113
|
|
|
129
|
-
return
|
|
114
|
+
return {
|
|
115
|
+
currentLocation: {
|
|
116
|
+
...restOptions,
|
|
117
|
+
path,
|
|
118
|
+
isBack,
|
|
119
|
+
hasRestoredFocus: false,
|
|
120
|
+
focusTargetSelector: currentFocusSelector,
|
|
121
|
+
skipFocus,
|
|
122
|
+
},
|
|
123
|
+
focusSelectors: focusSelectorsCopy ?? focusSelectors,
|
|
124
|
+
};
|
|
130
125
|
}
|
|
131
126
|
|
|
132
127
|
function goToParent(
|
|
133
128
|
state: RouterState,
|
|
134
129
|
options: NavigateToParentOptions = {}
|
|
135
130
|
) {
|
|
136
|
-
const {
|
|
137
|
-
const
|
|
131
|
+
const { screens, focusSelectors } = state;
|
|
132
|
+
const currentLocation = { ...state.currentLocation, isInitial: false };
|
|
133
|
+
const currentPath = currentLocation.path;
|
|
138
134
|
if ( currentPath === undefined ) {
|
|
139
|
-
return
|
|
135
|
+
return { currentLocation, focusSelectors };
|
|
140
136
|
}
|
|
141
137
|
const parentPath = findParent( currentPath, screens );
|
|
142
138
|
if ( parentPath === undefined ) {
|
|
143
|
-
return
|
|
139
|
+
return { currentLocation, focusSelectors };
|
|
144
140
|
}
|
|
145
141
|
return goTo( state, parentPath, {
|
|
146
142
|
...options,
|
|
@@ -152,7 +148,13 @@ function routerReducer(
|
|
|
152
148
|
state: RouterState,
|
|
153
149
|
action: RouterAction
|
|
154
150
|
): RouterState {
|
|
155
|
-
let {
|
|
151
|
+
let {
|
|
152
|
+
screens,
|
|
153
|
+
currentLocation,
|
|
154
|
+
matchedPath,
|
|
155
|
+
focusSelectors,
|
|
156
|
+
...restState
|
|
157
|
+
} = state;
|
|
156
158
|
switch ( action.type ) {
|
|
157
159
|
case 'add':
|
|
158
160
|
screens = addScreen( state, action.screen );
|
|
@@ -161,26 +163,30 @@ function routerReducer(
|
|
|
161
163
|
screens = removeScreen( state, action.screen );
|
|
162
164
|
break;
|
|
163
165
|
case 'goto':
|
|
164
|
-
|
|
166
|
+
( { currentLocation, focusSelectors } = goTo(
|
|
167
|
+
state,
|
|
168
|
+
action.path,
|
|
169
|
+
action.options
|
|
170
|
+
) );
|
|
165
171
|
break;
|
|
166
172
|
case 'gotoparent':
|
|
167
|
-
|
|
173
|
+
( { currentLocation, focusSelectors } = goToParent(
|
|
174
|
+
state,
|
|
175
|
+
action.options
|
|
176
|
+
) );
|
|
168
177
|
break;
|
|
169
178
|
}
|
|
170
179
|
|
|
171
180
|
// Return early in case there is no change
|
|
172
181
|
if (
|
|
173
182
|
screens === state.screens &&
|
|
174
|
-
|
|
183
|
+
currentLocation === state.currentLocation
|
|
175
184
|
) {
|
|
176
185
|
return state;
|
|
177
186
|
}
|
|
178
187
|
|
|
179
188
|
// Compute the matchedPath
|
|
180
|
-
const currentPath =
|
|
181
|
-
locationHistory.length > 0
|
|
182
|
-
? locationHistory[ locationHistory.length - 1 ].path
|
|
183
|
-
: undefined;
|
|
189
|
+
const currentPath = currentLocation.path;
|
|
184
190
|
matchedPath =
|
|
185
191
|
currentPath !== undefined
|
|
186
192
|
? patternMatch( currentPath, screens )
|
|
@@ -197,23 +203,35 @@ function routerReducer(
|
|
|
197
203
|
matchedPath = state.matchedPath;
|
|
198
204
|
}
|
|
199
205
|
|
|
200
|
-
return {
|
|
206
|
+
return {
|
|
207
|
+
...restState,
|
|
208
|
+
screens,
|
|
209
|
+
currentLocation,
|
|
210
|
+
matchedPath,
|
|
211
|
+
focusSelectors,
|
|
212
|
+
};
|
|
201
213
|
}
|
|
202
214
|
|
|
203
215
|
function UnconnectedNavigatorProvider(
|
|
204
216
|
props: WordPressComponentProps< NavigatorProviderProps, 'div' >,
|
|
205
217
|
forwardedRef: ForwardedRef< any >
|
|
206
218
|
) {
|
|
207
|
-
const {
|
|
208
|
-
|
|
219
|
+
const {
|
|
220
|
+
initialPath: initialPathProp,
|
|
221
|
+
children,
|
|
222
|
+
className,
|
|
223
|
+
...otherProps
|
|
224
|
+
} = useContextSystem( props, 'NavigatorProvider' );
|
|
209
225
|
|
|
210
226
|
const [ routerState, dispatch ] = useReducer(
|
|
211
227
|
routerReducer,
|
|
212
|
-
|
|
228
|
+
initialPathProp,
|
|
213
229
|
( path ) => ( {
|
|
214
230
|
screens: [],
|
|
215
|
-
|
|
231
|
+
currentLocation: { path, isInitial: true },
|
|
216
232
|
matchedPath: undefined,
|
|
233
|
+
focusSelectors: new Map(),
|
|
234
|
+
initialPath: initialPathProp,
|
|
217
235
|
} )
|
|
218
236
|
);
|
|
219
237
|
|
|
@@ -242,19 +260,16 @@ function UnconnectedNavigatorProvider(
|
|
|
242
260
|
[]
|
|
243
261
|
);
|
|
244
262
|
|
|
245
|
-
const {
|
|
263
|
+
const { currentLocation, matchedPath } = routerState;
|
|
246
264
|
|
|
247
265
|
const navigatorContextValue: NavigatorContextType = useMemo(
|
|
248
266
|
() => ( {
|
|
249
|
-
location:
|
|
250
|
-
...locationHistory[ locationHistory.length - 1 ],
|
|
251
|
-
isInitial: locationHistory.length === 1,
|
|
252
|
-
},
|
|
267
|
+
location: currentLocation,
|
|
253
268
|
params: matchedPath?.params ?? {},
|
|
254
269
|
match: matchedPath?.id,
|
|
255
270
|
...methods,
|
|
256
271
|
} ),
|
|
257
|
-
[
|
|
272
|
+
[ currentLocation, matchedPath, methods ]
|
|
258
273
|
);
|
|
259
274
|
|
|
260
275
|
const cx = useCx();
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { useMergeRefs } from '@wordpress/compose';
|
|
18
18
|
import { isRTL as isRTLFn } from '@wordpress/i18n';
|
|
19
19
|
import { escapeAttribute } from '@wordpress/escape-html';
|
|
20
|
+
import warning from '@wordpress/warning';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -33,6 +34,12 @@ function UnconnectedNavigatorScreen(
|
|
|
33
34
|
props: WordPressComponentProps< NavigatorScreenProps, 'div', false >,
|
|
34
35
|
forwardedRef: ForwardedRef< any >
|
|
35
36
|
) {
|
|
37
|
+
if ( ! /^\//.test( props.path ) ) {
|
|
38
|
+
warning(
|
|
39
|
+
'wp.components.NavigatorScreen: the `path` should follow a URL-like scheme; it should start with and be separated by the `/` character.'
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
36
43
|
const screenId = useId();
|
|
37
44
|
const { children, className, path, ...otherProps } = useContextSystem(
|
|
38
45
|
props,
|
|
@@ -6,7 +6,7 @@ import deprecated from '@wordpress/deprecated';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { NavigatorBackButton } from '../navigator-back-button';
|
|
9
|
+
import { NavigatorBackButton } from '../navigator-back-button/component';
|
|
10
10
|
import type { WordPressComponentProps } from '../../context';
|
|
11
11
|
import { contextConnect } from '../../context';
|
|
12
12
|
import type { NavigatorBackButtonProps } from '../types';
|