@wordpress/components 19.14.0 → 19.15.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 +51 -12
- package/build/autocomplete/get-default-use-items.js +5 -1
- package/build/autocomplete/get-default-use-items.js.map +1 -1
- package/build/autocomplete/index.js +5 -1
- package/build/autocomplete/index.js.map +1 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/box-control/index.js +1 -1
- package/build/box-control/index.js.map +1 -1
- package/build/color-picker/hex-input.js +5 -4
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/index.native.js +35 -34
- package/build/color-picker/index.native.js.map +1 -1
- package/build/color-picker/input-with-slider.js +3 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +31 -43
- package/build/color-picker/styles.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js +22 -31
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/combobox-control/index.js +14 -6
- package/build/combobox-control/index.js.map +1 -1
- package/build/combobox-control/styles.js +39 -0
- package/build/combobox-control/styles.js.map +1 -0
- package/build/dropdown-menu/index.js +5 -5
- package/build/dropdown-menu/index.js.map +1 -1
- package/build/dropdown-menu/index.native.js +5 -5
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/elevation/hook.js +5 -5
- package/build/elevation/hook.js.map +1 -1
- package/build/external-link/index.js +1 -3
- package/build/external-link/index.js.map +1 -1
- package/build/focal-point-picker/grid.js +2 -7
- package/build/focal-point-picker/grid.js.map +1 -1
- package/build/focal-point-picker/index.native.js +8 -8
- package/build/focal-point-picker/index.native.js.map +1 -1
- package/build/focal-point-picker/tooltip/index.native.js +11 -12
- package/build/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build/form-token-field/index.js +22 -7
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/styles.js +40 -0
- package/build/form-token-field/styles.js.map +1 -0
- package/build/form-token-field/suggestions-list.js +2 -7
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/grid/component.js +7 -8
- package/build/grid/component.js.map +1 -1
- package/build/grid/hook.js +1 -5
- package/build/grid/hook.js.map +1 -1
- package/build/grid/index.js.map +1 -1
- package/build/grid/utils.js +4 -7
- package/build/grid/utils.js.map +1 -1
- package/build/h-stack/component.js +5 -9
- package/build/h-stack/component.js.map +1 -1
- package/build/h-stack/hook.js +8 -10
- package/build/h-stack/hook.js.map +1 -1
- package/build/h-stack/index.js.map +1 -1
- package/build/h-stack/utils.js +7 -18
- package/build/h-stack/utils.js.map +1 -1
- package/build/icon/index.js.map +1 -1
- package/build/menu-item/index.js +1 -3
- package/build/menu-item/index.js.map +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js +1 -1
- package/build/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -2
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/modal/index.js +17 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigation/index.js +4 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/item/base.js +3 -0
- package/build/navigation/item/base.js.map +1 -1
- package/build/popover/index.js +4 -4
- package/build/popover/index.js.map +1 -1
- package/build/range-control/index.js +54 -40
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/input-range.js +5 -7
- package/build/range-control/input-range.js.map +1 -1
- package/build/range-control/mark.js +5 -7
- package/build/range-control/mark.js.map +1 -1
- package/build/range-control/rail.js +10 -16
- package/build/range-control/rail.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +62 -62
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/range-control/tooltip.js +5 -7
- package/build/range-control/tooltip.js.map +1 -1
- package/build/range-control/types.js +6 -0
- package/build/range-control/types.js.map +1 -0
- package/build/range-control/utils.js +22 -29
- package/build/range-control/utils.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js +2 -7
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/scrollable/component.js +7 -8
- package/build/scrollable/component.js.map +1 -1
- package/build/scrollable/hook.js +0 -8
- package/build/scrollable/hook.js.map +1 -1
- package/build/scrollable/index.js.map +1 -1
- package/build/scrollable/styles.js +7 -7
- package/build/scrollable/styles.js.map +1 -1
- package/build/shortcut/index.js +2 -8
- package/build/shortcut/index.js.map +1 -1
- package/build/slot-fill/index.native.js +6 -8
- package/build/slot-fill/index.native.js.map +1 -1
- package/build/slot-fill/provider.js +4 -8
- package/build/slot-fill/provider.js.map +1 -1
- package/build/slot-fill/slot.js +4 -8
- package/build/slot-fill/slot.js.map +1 -1
- package/build/spacer/component.js.map +1 -1
- package/build/spacer/hook.js +2 -2
- package/build/spacer/hook.js.map +1 -1
- package/build/spacer/index.js.map +1 -1
- package/build/text-highlight/index.js +22 -5
- package/build/text-highlight/index.js.map +1 -1
- package/build/text-highlight/types.js +6 -0
- package/build/text-highlight/types.js.map +1 -0
- package/build/tip/index.js +5 -11
- package/build/tip/index.js.map +1 -1
- package/build/tip/types.js +6 -0
- package/build/tip/types.js.map +1 -0
- package/build/toolbar-group/index.js +3 -3
- package/build/toolbar-group/index.js.map +1 -1
- package/build/tree-select/index.js +2 -2
- package/build/tree-select/index.js.map +1 -1
- package/build/ui/utils/get-valid-children.js.map +1 -1
- package/build/visually-hidden/component.js +12 -13
- package/build/visually-hidden/component.js.map +1 -1
- package/build/visually-hidden/index.js.map +1 -1
- package/build/visually-hidden/styles.js +3 -1
- package/build/visually-hidden/styles.js.map +1 -1
- package/build/visually-hidden/types.js +6 -0
- package/build/visually-hidden/types.js.map +1 -0
- package/build-module/autocomplete/get-default-use-items.js +3 -2
- package/build-module/autocomplete/get-default-use-items.js.map +1 -1
- package/build-module/autocomplete/index.js +3 -2
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/box-control/index.js +1 -1
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/color-picker/hex-input.js +4 -3
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/index.native.js +36 -35
- package/build-module/color-picker/index.native.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +3 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +23 -40
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js +22 -31
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/combobox-control/index.js +14 -7
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/combobox-control/styles.js +27 -0
- package/build-module/combobox-control/styles.js.map +1 -0
- package/build-module/dropdown-menu/index.js +5 -4
- package/build-module/dropdown-menu/index.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js +5 -4
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/elevation/hook.js +5 -5
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/external-link/index.js +1 -2
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/focal-point-picker/grid.js +2 -6
- package/build-module/focal-point-picker/grid.js.map +1 -1
- package/build-module/focal-point-picker/index.native.js +8 -8
- package/build-module/focal-point-picker/index.native.js.map +1 -1
- package/build-module/focal-point-picker/tooltip/index.native.js +11 -12
- package/build-module/focal-point-picker/tooltip/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js +20 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/styles.js +28 -0
- package/build-module/form-token-field/styles.js.map +1 -0
- package/build-module/form-token-field/suggestions-list.js +2 -7
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/grid/component.js +7 -8
- package/build-module/grid/component.js.map +1 -1
- package/build-module/grid/hook.js +1 -5
- package/build-module/grid/hook.js.map +1 -1
- package/build-module/grid/index.js.map +1 -1
- package/build-module/grid/utils.js +3 -8
- package/build-module/grid/utils.js.map +1 -1
- package/build-module/h-stack/component.js +3 -7
- package/build-module/h-stack/component.js.map +1 -1
- package/build-module/h-stack/hook.js +10 -12
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/h-stack/index.js.map +1 -1
- package/build-module/h-stack/utils.js +7 -19
- package/build-module/h-stack/utils.js.map +1 -1
- package/build-module/icon/index.js.map +1 -1
- package/build-module/menu-item/index.js +1 -2
- package/build-module/menu-item/index.js.map +1 -1
- package/build-module/mobile/focal-point-settings-panel/index.native.js +2 -2
- package/build-module/mobile/focal-point-settings-panel/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +3 -2
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/modal/index.js +19 -5
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigation/index.js +4 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/item/base.js +3 -0
- package/build-module/navigation/item/base.js.map +1 -1
- package/build-module/popover/index.js +4 -4
- package/build-module/popover/index.js.map +1 -1
- package/build-module/range-control/index.js +54 -40
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/input-range.js +5 -6
- package/build-module/range-control/input-range.js.map +1 -1
- package/build-module/range-control/mark.js +5 -6
- package/build-module/range-control/mark.js.map +1 -1
- package/build-module/range-control/rail.js +10 -15
- package/build-module/range-control/rail.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +62 -64
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/range-control/tooltip.js +5 -6
- package/build-module/range-control/tooltip.js.map +1 -1
- package/build-module/range-control/types.js +2 -0
- package/build-module/range-control/types.js.map +1 -0
- package/build-module/range-control/utils.js +22 -29
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js +2 -6
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/scrollable/component.js +7 -8
- package/build-module/scrollable/component.js.map +1 -1
- package/build-module/scrollable/hook.js +0 -8
- package/build-module/scrollable/hook.js.map +1 -1
- package/build-module/scrollable/index.js.map +1 -1
- package/build-module/scrollable/styles.js +7 -7
- package/build-module/scrollable/styles.js.map +1 -1
- package/build-module/shortcut/index.js +2 -7
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/slot-fill/index.native.js +6 -7
- package/build-module/slot-fill/index.native.js.map +1 -1
- package/build-module/slot-fill/provider.js +4 -7
- package/build-module/slot-fill/provider.js.map +1 -1
- package/build-module/slot-fill/slot.js +4 -7
- package/build-module/slot-fill/slot.js.map +1 -1
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/spacer/hook.js +2 -2
- package/build-module/spacer/hook.js.map +1 -1
- package/build-module/spacer/index.js.map +1 -1
- package/build-module/text-highlight/index.js +23 -6
- package/build-module/text-highlight/index.js.map +1 -1
- package/build-module/text-highlight/types.js +2 -0
- package/build-module/text-highlight/types.js.map +1 -0
- package/build-module/tip/index.js +6 -10
- package/build-module/tip/index.js.map +1 -1
- package/build-module/tip/types.js +2 -0
- package/build-module/tip/types.js.map +1 -0
- package/build-module/toolbar-group/index.js +3 -2
- package/build-module/toolbar-group/index.js.map +1 -1
- package/build-module/tree-select/index.js +3 -3
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/ui/utils/get-valid-children.js.map +1 -1
- package/build-module/visually-hidden/component.js +12 -13
- package/build-module/visually-hidden/component.js.map +1 -1
- package/build-module/visually-hidden/index.js.map +1 -1
- package/build-module/visually-hidden/styles.js +3 -1
- package/build-module/visually-hidden/styles.js.map +1 -1
- package/build-module/visually-hidden/types.js +2 -0
- package/build-module/visually-hidden/types.js.map +1 -0
- package/build-style/style-rtl.css +13 -19
- package/build-style/style.css +13 -19
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.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 +30 -31
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/dropdown-menu/index.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +14 -0
- package/build-types/form-token-field/styles.d.ts.map +1 -0
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +7 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/grid/component.d.ts +3 -3
- package/build-types/grid/component.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +5 -2
- package/build-types/grid/hook.d.ts.map +1 -1
- package/build-types/grid/index.d.ts +2 -2
- package/build-types/grid/index.d.ts.map +1 -1
- package/build-types/grid/stories/index.d.ts +9 -0
- package/build-types/grid/stories/index.d.ts.map +1 -0
- package/build-types/grid/test/grid.d.ts +2 -0
- package/build-types/grid/test/grid.d.ts.map +1 -0
- package/build-types/grid/types.d.ts +16 -15
- package/build-types/grid/types.d.ts.map +1 -1
- package/build-types/grid/utils.d.ts +50 -69
- package/build-types/grid/utils.d.ts.map +1 -1
- package/build-types/h-stack/component.d.ts +3 -2
- package/build-types/h-stack/component.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +5 -3
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/h-stack/index.d.ts +2 -2
- package/build-types/h-stack/index.d.ts.map +1 -1
- package/build-types/h-stack/stories/index.d.ts +9 -0
- package/build-types/h-stack/stories/index.d.ts.map +1 -0
- package/build-types/h-stack/test/index.d.ts +2 -0
- package/build-types/h-stack/test/index.d.ts.map +1 -0
- package/build-types/h-stack/utils.d.ts +8 -4
- package/build-types/h-stack/utils.d.ts.map +1 -1
- package/build-types/icon/index.d.ts +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/menu-item/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +54 -29
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/input-range.d.ts +7 -10
- package/build-types/range-control/input-range.d.ts.map +1 -1
- package/build-types/range-control/mark.d.ts +4 -7
- package/build-types/range-control/mark.d.ts.map +1 -1
- package/build-types/range-control/rail.d.ts +4 -9
- package/build-types/range-control/rail.d.ts.map +1 -1
- package/build-types/range-control/stories/index.d.ts +48 -0
- package/build-types/range-control/stories/index.d.ts.map +1 -0
- package/build-types/range-control/styles/range-control-styles.d.ts +32 -40
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/test/index.d.ts +2 -0
- package/build-types/range-control/test/index.d.ts.map +1 -0
- package/build-types/range-control/tooltip.d.ts +4 -11
- package/build-types/range-control/tooltip.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +302 -0
- package/build-types/range-control/types.d.ts.map +1 -0
- package/build-types/range-control/utils.d.ts +15 -33
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/scrollable/component.d.ts +3 -3
- package/build-types/scrollable/component.d.ts.map +1 -1
- package/build-types/scrollable/hook.d.ts +5 -2
- package/build-types/scrollable/hook.d.ts.map +1 -1
- package/build-types/scrollable/index.d.ts +2 -2
- package/build-types/scrollable/index.d.ts.map +1 -1
- package/build-types/scrollable/stories/index.d.ts +9 -0
- package/build-types/scrollable/stories/index.d.ts.map +1 -0
- package/build-types/scrollable/styles.d.ts +7 -7
- package/build-types/scrollable/styles.d.ts.map +1 -1
- package/build-types/scrollable/test/index.d.ts +2 -0
- package/build-types/scrollable/test/index.d.ts.map +1 -0
- package/build-types/scrollable/types.d.ts +9 -6
- package/build-types/scrollable/types.d.ts.map +1 -1
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/slot-fill/provider.d.ts.map +1 -1
- package/build-types/slot-fill/slot.d.ts.map +1 -1
- package/build-types/spacer/component.d.ts +2 -2
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/spacer/hook.d.ts +2 -2
- package/build-types/spacer/hook.d.ts.map +1 -1
- package/build-types/spacer/index.d.ts +1 -1
- package/build-types/spacer/index.d.ts.map +1 -1
- package/build-types/spacer/test/index.d.ts +2 -0
- package/build-types/spacer/test/index.d.ts.map +1 -0
- package/build-types/spacer/types.d.ts +41 -29
- package/build-types/spacer/types.d.ts.map +1 -1
- package/build-types/text-highlight/index.d.ts +23 -0
- package/build-types/text-highlight/index.d.ts.map +1 -0
- package/build-types/text-highlight/stories/index.d.ts +12 -0
- package/build-types/text-highlight/stories/index.d.ts.map +1 -0
- package/build-types/text-highlight/test/index.d.ts +2 -0
- package/build-types/text-highlight/test/index.d.ts.map +1 -0
- package/build-types/text-highlight/types.d.ts +17 -0
- package/build-types/text-highlight/types.d.ts.map +1 -0
- package/build-types/tip/index.d.ts +5 -14
- package/build-types/tip/index.d.ts.map +1 -1
- package/build-types/tip/stories/index.d.ts +12 -0
- package/build-types/tip/stories/index.d.ts.map +1 -0
- package/build-types/tip/types.d.ts +11 -0
- package/build-types/tip/types.d.ts.map +1 -0
- package/build-types/ui/form-group/form-group.d.ts +1 -1
- package/build-types/ui/form-group/types.d.ts +1 -1
- package/build-types/ui/form-group/types.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +3 -3
- package/build-types/ui/utils/get-valid-children.d.ts +2 -2
- package/build-types/ui/utils/get-valid-children.d.ts.map +1 -1
- package/build-types/visually-hidden/component.d.ts +8 -10
- package/build-types/visually-hidden/component.d.ts.map +1 -1
- package/build-types/visually-hidden/index.d.ts +1 -1
- package/build-types/visually-hidden/index.d.ts.map +1 -1
- package/build-types/visually-hidden/stories/index.d.ts +14 -0
- package/build-types/visually-hidden/stories/index.d.ts.map +1 -0
- package/build-types/visually-hidden/styles.d.ts +5 -2
- package/build-types/visually-hidden/styles.d.ts.map +1 -1
- package/build-types/visually-hidden/test/index.d.ts +2 -0
- package/build-types/visually-hidden/test/index.d.ts.map +1 -0
- package/build-types/visually-hidden/types.d.ts +11 -0
- package/build-types/visually-hidden/types.d.ts.map +1 -0
- package/package.json +17 -17
- package/src/autocomplete/get-default-use-items.js +3 -2
- package/src/autocomplete/index.js +3 -2
- package/src/border-control/border-control/hook.ts +1 -1
- package/src/box-control/index.js +1 -1
- package/src/button/README.md +1 -1
- package/src/color-picker/hex-input.tsx +3 -2
- package/src/color-picker/index.native.js +20 -27
- package/src/color-picker/input-with-slider.tsx +2 -0
- package/src/color-picker/styles.ts +0 -5
- package/src/color-picker/use-deprecated-props.ts +24 -43
- package/src/combobox-control/index.js +15 -7
- package/src/combobox-control/stories/index.js +3 -2
- package/src/combobox-control/style.scss +1 -1
- package/src/combobox-control/styles.ts +27 -0
- package/src/dropdown-menu/index.js +3 -4
- package/src/dropdown-menu/index.native.js +3 -5
- package/src/elevation/hook.js +3 -3
- package/src/external-link/index.tsx +10 -4
- package/src/focal-point-picker/grid.js +2 -5
- package/src/focal-point-picker/index.native.js +8 -8
- package/src/focal-point-picker/tooltip/index.native.js +10 -11
- package/src/form-token-field/index.tsx +45 -24
- package/src/form-token-field/style.scss +2 -7
- package/src/form-token-field/styles.ts +32 -0
- package/src/form-token-field/suggestions-list.tsx +2 -4
- package/src/form-token-field/types.ts +7 -0
- package/src/grid/README.md +33 -19
- package/src/grid/{component.js → component.tsx} +13 -9
- package/src/grid/{hook.js → hook.ts} +5 -5
- package/src/grid/{index.js → index.ts} +0 -0
- package/src/grid/stories/index.tsx +72 -0
- package/src/grid/test/{grid.js → grid.tsx} +4 -4
- package/src/grid/types.ts +16 -17
- package/src/grid/{utils.js → utils.ts} +9 -7
- package/src/guide/style.scss +1 -0
- package/src/h-stack/{component.js → component.tsx} +8 -8
- package/src/h-stack/{hook.js → hook.tsx} +21 -16
- package/src/h-stack/{index.js → index.ts} +0 -0
- package/src/h-stack/stories/index.tsx +92 -0
- package/src/h-stack/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/h-stack/test/{index.js → index.tsx} +0 -0
- package/src/h-stack/{utils.js → utils.ts} +14 -14
- package/src/higher-order/navigate-regions/README.md +4 -1
- package/src/icon/index.tsx +1 -1
- package/src/menu-item/index.js +1 -2
- package/src/mobile/focal-point-settings-panel/index.native.js +2 -2
- package/src/mobile/image/index.native.js +3 -2
- package/src/modal/index.js +21 -2
- package/src/modal/stories/index.js +17 -1
- package/src/modal/style.scss +9 -18
- package/src/navigation/index.js +3 -0
- package/src/navigation/item/base.js +2 -1
- package/src/popover/README.md +2 -2
- package/src/popover/index.js +7 -4
- package/src/range-control/README.md +107 -79
- package/src/range-control/{index.js → index.tsx} +78 -48
- package/src/range-control/{input-range.js → input-range.tsx} +11 -7
- package/src/range-control/{mark.js → mark.tsx} +15 -9
- package/src/range-control/{rail.js → rail.tsx} +40 -23
- package/src/range-control/stories/index.tsx +244 -0
- package/src/range-control/styles/{range-control-styles.js → range-control-styles.ts} +28 -24
- package/src/range-control/test/index.tsx +311 -0
- package/src/range-control/{tooltip.js → tooltip.tsx} +19 -14
- package/src/range-control/types.ts +326 -0
- package/src/range-control/utils.ts +132 -0
- package/src/resizable-box/resize-tooltip/utils.ts +2 -3
- package/src/scrollable/README.md +14 -8
- package/src/scrollable/{component.js → component.tsx} +13 -10
- package/src/scrollable/{hook.js → hook.ts} +5 -7
- package/src/scrollable/{index.js → index.ts} +0 -0
- package/src/scrollable/stories/{index.js → index.tsx} +29 -34
- package/src/scrollable/{styles.js → styles.ts} +0 -0
- package/src/scrollable/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
- package/src/scrollable/test/index.tsx +34 -0
- package/src/scrollable/types.ts +10 -5
- package/src/select-control/test/select-control.tsx +22 -15
- package/src/shortcut/index.js +2 -7
- package/src/slot-fill/index.native.js +2 -7
- package/src/slot-fill/provider.js +3 -7
- package/src/slot-fill/slot.js +21 -24
- package/src/spacer/README.md +43 -37
- package/src/spacer/component.tsx +2 -2
- package/src/spacer/hook.ts +4 -2
- package/src/spacer/index.ts +1 -1
- package/src/spacer/test/__snapshots__/{index.js.snap → index.tsx.snap} +1 -0
- package/src/spacer/test/index.tsx +149 -0
- package/src/spacer/types.ts +41 -29
- package/src/tab-panel/README.md +1 -1
- package/src/text-highlight/README.md +6 -6
- package/src/text-highlight/index.tsx +49 -0
- package/src/text-highlight/stories/index.tsx +33 -0
- package/src/text-highlight/test/index.tsx +93 -0
- package/src/text-highlight/types.ts +16 -0
- package/src/tip/index.tsx +22 -0
- package/src/tip/stories/index.tsx +33 -0
- package/src/tip/types.ts +11 -0
- package/src/toolbar-group/index.js +1 -2
- package/src/tree-select/index.tsx +3 -3
- package/src/ui/form-group/types.ts +1 -1
- package/src/ui/utils/get-valid-children.ts +4 -2
- package/src/visually-hidden/{component.js → component.tsx} +23 -15
- package/src/visually-hidden/{index.js → index.ts} +0 -0
- package/src/visually-hidden/stories/index.tsx +66 -0
- package/src/visually-hidden/{styles.js → styles.ts} +6 -2
- package/src/visually-hidden/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
- package/src/visually-hidden/test/index.tsx +17 -0
- package/src/visually-hidden/types.ts +11 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/grid/stories/index.js +0 -49
- package/src/h-stack/stories/index.js +0 -22
- package/src/range-control/stories/index.js +0 -180
- package/src/range-control/test/index.js +0 -320
- package/src/range-control/utils.js +0 -131
- package/src/scrollable/test/index.js +0 -31
- package/src/spacer/test/index.js +0 -146
- package/src/text-highlight/index.js +0 -28
- package/src/text-highlight/stories/index.js +0 -28
- package/src/text-highlight/test/index.js +0 -120
- package/src/tip/index.js +0 -24
- package/src/tip/stories/index.js +0 -26
- package/src/visually-hidden/stories/index.js +0 -42
- package/src/visually-hidden/test/index.js +0 -19
package/src/grid/types.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { CSSProperties } from 'react';
|
|
4
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { ResponsiveCSSValue } from '../ui/utils/types';
|
|
7
10
|
|
|
8
11
|
type GridAlignment =
|
|
9
12
|
| 'bottom'
|
|
@@ -18,11 +21,7 @@ type GridAlignment =
|
|
|
18
21
|
| 'topLeft'
|
|
19
22
|
| 'topRight';
|
|
20
23
|
|
|
21
|
-
type
|
|
22
|
-
|
|
23
|
-
type GridRows = ResponsiveCSSValue< number >;
|
|
24
|
-
|
|
25
|
-
export type Props = {
|
|
24
|
+
export type GridProps = {
|
|
26
25
|
/**
|
|
27
26
|
* Adjusts the block alignment of children.
|
|
28
27
|
*/
|
|
@@ -31,26 +30,30 @@ export type Props = {
|
|
|
31
30
|
* Adjusts the horizontal and vertical alignment of children.
|
|
32
31
|
*/
|
|
33
32
|
alignment?: GridAlignment;
|
|
33
|
+
/**
|
|
34
|
+
* The children elements.
|
|
35
|
+
*/
|
|
36
|
+
children: ReactNode;
|
|
34
37
|
/**
|
|
35
38
|
* Adjusts the number of columns of the `Grid`.
|
|
36
39
|
*
|
|
37
40
|
* @default 2
|
|
38
41
|
*/
|
|
39
|
-
columns?:
|
|
42
|
+
columns?: ResponsiveCSSValue< number >;
|
|
40
43
|
/**
|
|
41
44
|
* Adjusts the `grid-column-gap`.
|
|
42
45
|
*/
|
|
43
46
|
columnGap?: CSSProperties[ 'gridColumnGap' ];
|
|
44
|
-
/**
|
|
45
|
-
* Changes the CSS display from `grid` to `inline-grid`.
|
|
46
|
-
*/
|
|
47
|
-
isInline?: boolean;
|
|
48
47
|
/**
|
|
49
48
|
* Gap between each child.
|
|
50
49
|
*
|
|
51
50
|
* @default 3
|
|
52
51
|
*/
|
|
53
52
|
gap?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Changes the CSS display from `grid` to `inline-grid`.
|
|
55
|
+
*/
|
|
56
|
+
isInline?: boolean;
|
|
54
57
|
/**
|
|
55
58
|
* Adjusts the inline alignment of children.
|
|
56
59
|
*/
|
|
@@ -62,7 +65,7 @@ export type Props = {
|
|
|
62
65
|
/**
|
|
63
66
|
* Adjusts the number of rows of the `Grid`.
|
|
64
67
|
*/
|
|
65
|
-
rows?:
|
|
68
|
+
rows?: ResponsiveCSSValue< number >;
|
|
66
69
|
/**
|
|
67
70
|
* Adjusts the CSS grid `template-columns`.
|
|
68
71
|
*/
|
|
@@ -71,8 +74,4 @@ export type Props = {
|
|
|
71
74
|
* Adjusts the CSS grid `template-rows`.
|
|
72
75
|
*/
|
|
73
76
|
templateRows?: CSSProperties[ 'gridTemplateRows' ];
|
|
74
|
-
/**
|
|
75
|
-
* The children elements.
|
|
76
|
-
*/
|
|
77
|
-
children: React.ReactNode;
|
|
78
77
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
5
|
+
|
|
1
6
|
const ALIGNMENTS = {
|
|
2
7
|
bottom: { alignItems: 'flex-end', justifyContent: 'center' },
|
|
3
8
|
bottomLeft: { alignItems: 'flex-start', justifyContent: 'flex-end' },
|
|
@@ -12,14 +17,11 @@ const ALIGNMENTS = {
|
|
|
12
17
|
topRight: { alignItems: 'flex-start', justifyContent: 'flex-end' },
|
|
13
18
|
};
|
|
14
19
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export function getAlignmentProps( alignment ) {
|
|
20
|
+
export function getAlignmentProps( alignment?: keyof typeof ALIGNMENTS ): {
|
|
21
|
+
alignItems?: CSSProperties[ 'alignItems' ];
|
|
22
|
+
justifyContent?: CSSProperties[ 'justifyContent' ];
|
|
23
|
+
} {
|
|
21
24
|
const alignmentProps = alignment ? ALIGNMENTS[ alignment ] : {};
|
|
22
25
|
|
|
23
26
|
return alignmentProps;
|
|
24
27
|
}
|
|
25
|
-
/* eslint-enable jsdoc/valid-types */
|
package/src/guide/style.scss
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { contextConnect } from '../ui/context';
|
|
4
|
+
import { contextConnect, WordPressComponentProps } from '../ui/context';
|
|
5
5
|
import { View } from '../view';
|
|
6
6
|
import { useHStack } from './hook';
|
|
7
|
+
import type { Props } from './types';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function HStack( props, forwardedRef ) {
|
|
9
|
+
function UnconnectedHStack(
|
|
10
|
+
props: WordPressComponentProps< Props, 'div' >,
|
|
11
|
+
forwardedRef: React.ForwardedRef< any >
|
|
12
|
+
) {
|
|
13
13
|
const hStackProps = useHStack( props );
|
|
14
14
|
|
|
15
15
|
return <View { ...hStackProps } ref={ forwardedRef } />;
|
|
@@ -38,6 +38,6 @@ function HStack( props, forwardedRef ) {
|
|
|
38
38
|
* }
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
|
-
const
|
|
41
|
+
export const HStack = contextConnect( UnconnectedHStack, 'HStack' );
|
|
42
42
|
|
|
43
|
-
export default
|
|
43
|
+
export default HStack;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ReactElement } from 'react';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
hasConnectNamespace,
|
|
11
|
+
useContextSystem,
|
|
12
|
+
WordPressComponentProps,
|
|
13
|
+
} from '../ui/context';
|
|
5
14
|
import { FlexItem, useFlex } from '../flex';
|
|
6
15
|
import { getAlignmentProps } from './utils';
|
|
7
16
|
import { getValidChildren } from '../ui/utils/get-valid-children';
|
|
17
|
+
import type { Props } from './types';
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
*
|
|
11
|
-
* @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
|
|
12
|
-
*/
|
|
13
|
-
export function useHStack( props ) {
|
|
19
|
+
export function useHStack( props: WordPressComponentProps< Props, 'div' > ) {
|
|
14
20
|
const {
|
|
15
21
|
alignment = 'edge',
|
|
16
22
|
children,
|
|
@@ -22,19 +28,18 @@ export function useHStack( props ) {
|
|
|
22
28
|
const align = getAlignmentProps( alignment, direction );
|
|
23
29
|
|
|
24
30
|
const validChildren = getValidChildren( children );
|
|
25
|
-
const clonedChildren = validChildren.map(
|
|
26
|
-
|
|
27
|
-
( /** @type {import('react').ReactElement} */ child, index ) => {
|
|
28
|
-
const _key = child.key || `hstack-${ index }`;
|
|
29
|
-
const _isSpacer = hasConnectNamespace( child, [ 'Spacer' ] );
|
|
31
|
+
const clonedChildren = validChildren.map( ( child, index ) => {
|
|
32
|
+
const _isSpacer = hasConnectNamespace( child, [ 'Spacer' ] );
|
|
30
33
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
+
if ( _isSpacer ) {
|
|
35
|
+
const childElement = child as ReactElement;
|
|
36
|
+
const _key = childElement.key || `hstack-${ index }`;
|
|
34
37
|
|
|
35
|
-
return
|
|
38
|
+
return <FlexItem isBlock key={ _key } { ...childElement.props } />;
|
|
36
39
|
}
|
|
37
|
-
|
|
40
|
+
|
|
41
|
+
return child;
|
|
42
|
+
} );
|
|
38
43
|
|
|
39
44
|
const propsForFlex = {
|
|
40
45
|
children: clonedChildren,
|
|
File without changes
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
5
|
+
/**
|
|
6
|
+
* Internal dependencies
|
|
7
|
+
*/
|
|
8
|
+
import { View } from '../../view';
|
|
9
|
+
import { HStack } from '..';
|
|
10
|
+
|
|
11
|
+
const ALIGNMENTS = {
|
|
12
|
+
top: 'top',
|
|
13
|
+
topLeft: 'topLeft',
|
|
14
|
+
topRight: 'topRight',
|
|
15
|
+
left: 'left',
|
|
16
|
+
center: 'center',
|
|
17
|
+
right: 'right',
|
|
18
|
+
bottom: 'bottom',
|
|
19
|
+
bottomLeft: 'bottomLeft',
|
|
20
|
+
bottomRight: 'bottomRight',
|
|
21
|
+
edge: 'edge',
|
|
22
|
+
stretch: 'stretch',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const DIRECTIONS = {
|
|
26
|
+
row: 'row',
|
|
27
|
+
column: 'column',
|
|
28
|
+
responsive: [ 'column', 'row' ],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const JUSTIFICATIONS = {
|
|
32
|
+
'space-around': 'space-around',
|
|
33
|
+
'space-between': 'space-between',
|
|
34
|
+
'space-evenly': 'space-evenly',
|
|
35
|
+
stretch: 'stretch',
|
|
36
|
+
center: 'center',
|
|
37
|
+
end: 'end',
|
|
38
|
+
'flex-end': 'flex-end',
|
|
39
|
+
'flex-start': 'flex-start',
|
|
40
|
+
start: 'start',
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const meta: ComponentMeta< typeof HStack > = {
|
|
44
|
+
component: HStack,
|
|
45
|
+
title: 'Components (Experimental)/HStack',
|
|
46
|
+
argTypes: {
|
|
47
|
+
as: {
|
|
48
|
+
control: { type: null },
|
|
49
|
+
},
|
|
50
|
+
children: {
|
|
51
|
+
control: { type: null },
|
|
52
|
+
},
|
|
53
|
+
alignment: {
|
|
54
|
+
control: { type: 'select' },
|
|
55
|
+
options: Object.keys( ALIGNMENTS ),
|
|
56
|
+
mapping: ALIGNMENTS,
|
|
57
|
+
},
|
|
58
|
+
direction: {
|
|
59
|
+
control: { type: 'select' },
|
|
60
|
+
options: Object.keys( DIRECTIONS ),
|
|
61
|
+
mapping: DIRECTIONS,
|
|
62
|
+
},
|
|
63
|
+
justify: {
|
|
64
|
+
control: { type: 'select' },
|
|
65
|
+
options: Object.keys( JUSTIFICATIONS ),
|
|
66
|
+
mapping: JUSTIFICATIONS,
|
|
67
|
+
},
|
|
68
|
+
spacing: {
|
|
69
|
+
control: { type: 'text' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
parameters: {
|
|
73
|
+
controls: { expanded: true },
|
|
74
|
+
docs: { source: { state: 'open' } },
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
export default meta;
|
|
78
|
+
|
|
79
|
+
const Template: ComponentStory< typeof HStack > = ( args ) => (
|
|
80
|
+
<HStack { ...args } style={ { background: '#eee', minHeight: '3rem' } }>
|
|
81
|
+
{ [ 'One', 'Two', 'Three', 'Four', 'Five' ].map( ( text ) => (
|
|
82
|
+
<View key={ text } style={ { background: '#b9f9ff' } }>
|
|
83
|
+
{ text }
|
|
84
|
+
</View>
|
|
85
|
+
) ) }
|
|
86
|
+
</HStack>
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const Default: ComponentStory< typeof HStack > = Template.bind( {} );
|
|
90
|
+
Default.args = {
|
|
91
|
+
spacing: '3',
|
|
92
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
1
5
|
/**
|
|
2
6
|
* Internal dependencies
|
|
3
7
|
*/
|
|
8
|
+
import type { FlexDirection } from '../flex/types';
|
|
9
|
+
import type { HStackAlignment, AlignmentProps, Alignments } from './types';
|
|
4
10
|
import { isValueDefined } from '../utils/values';
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
const ALIGNMENTS = {
|
|
12
|
+
const H_ALIGNMENTS: Alignments = {
|
|
8
13
|
bottom: { align: 'flex-end', justify: 'center' },
|
|
9
14
|
bottomLeft: { align: 'flex-start', justify: 'flex-end' },
|
|
10
15
|
bottomRight: { align: 'flex-end', justify: 'flex-end' },
|
|
@@ -18,8 +23,7 @@ const ALIGNMENTS = {
|
|
|
18
23
|
topRight: { align: 'flex-start', justify: 'flex-end' },
|
|
19
24
|
};
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
const V_ALIGNMENTS = {
|
|
26
|
+
const V_ALIGNMENTS: Alignments = {
|
|
23
27
|
bottom: { justify: 'flex-end', align: 'center' },
|
|
24
28
|
bottomLeft: { justify: 'flex-start', align: 'flex-end' },
|
|
25
29
|
bottomRight: { justify: 'flex-end', align: 'flex-end' },
|
|
@@ -33,23 +37,19 @@ const V_ALIGNMENTS = {
|
|
|
33
37
|
topRight: { justify: 'flex-start', align: 'flex-end' },
|
|
34
38
|
};
|
|
35
39
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* @return {import('./types').AlignmentProps} Alignment props.
|
|
41
|
-
*/
|
|
42
|
-
/* eslint-enable jsdoc/valid-types */
|
|
43
|
-
export function getAlignmentProps( alignment, direction = 'row' ) {
|
|
40
|
+
export function getAlignmentProps(
|
|
41
|
+
alignment: HStackAlignment | CSSProperties[ 'alignItems' ],
|
|
42
|
+
direction: FlexDirection = 'row'
|
|
43
|
+
): AlignmentProps {
|
|
44
44
|
if ( ! isValueDefined( alignment ) ) {
|
|
45
45
|
return {};
|
|
46
46
|
}
|
|
47
47
|
const isVertical = direction === 'column';
|
|
48
|
-
const props = isVertical ? V_ALIGNMENTS :
|
|
48
|
+
const props = isVertical ? V_ALIGNMENTS : H_ALIGNMENTS;
|
|
49
49
|
|
|
50
50
|
const alignmentProps =
|
|
51
51
|
alignment in props
|
|
52
|
-
? props[
|
|
52
|
+
? props[ alignment as keyof typeof props ]
|
|
53
53
|
: { align: alignment };
|
|
54
54
|
|
|
55
55
|
return alignmentProps;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# navigateRegions
|
|
2
2
|
|
|
3
|
-
`navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html) adding keyboard navigation to switch between the different DOM elements marked as "regions" (role="region"). These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility, these elements must be properly labelled to briefly describe the purpose of the content in the region. For more details, see "
|
|
3
|
+
`navigateRegions` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html) adding keyboard navigation to switch between the different DOM elements marked as "regions" (role="region"). These regions should be focusable (By adding a tabIndex attribute for example). For better accessibility, these elements must be properly labelled to briefly describe the purpose of the content in the region. For more details, see "Landmark Roles" in the [WAI-ARIA specification](https://www.w3.org/TR/wai-aria/) and "Landmark Regions" in the [ARIA Authoring Practices Guide](https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/).
|
|
4
4
|
|
|
5
5
|
## Example:
|
|
6
6
|
|
|
@@ -21,3 +21,6 @@ const MyComponentWithNavigateRegions = navigateRegions( () => (
|
|
|
21
21
|
</div>
|
|
22
22
|
) );
|
|
23
23
|
```
|
|
24
|
+
|
|
25
|
+
## Notes:
|
|
26
|
+
It's important to note that an ARIA `role="region"` is an ARIA landmark role. It should be reserved for sections of content sufficiently important to have it listed in a summary of the page. Only use this ARIA role for the main sections of a page. All perceivable content should reside in a semantically meaningful landmark in order that content is not missed by the user.
|
package/src/icon/index.tsx
CHANGED
|
@@ -20,7 +20,7 @@ import { SVG } from '@wordpress/primitives';
|
|
|
20
20
|
import Dashicon from '../dashicon';
|
|
21
21
|
import type { IconKey as DashiconIconKey } from '../dashicon/types';
|
|
22
22
|
|
|
23
|
-
type IconType< P > = DashiconIconKey | ComponentType< P > | JSX.Element;
|
|
23
|
+
export type IconType< P > = DashiconIconKey | ComponentType< P > | JSX.Element;
|
|
24
24
|
|
|
25
25
|
interface BaseProps< P > {
|
|
26
26
|
/**
|
package/src/menu-item/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
5
|
import classnames from 'classnames';
|
|
6
|
-
import { isString } from 'lodash';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* WordPress dependencies
|
|
@@ -41,7 +40,7 @@ export function MenuItem( props, ref ) {
|
|
|
41
40
|
);
|
|
42
41
|
}
|
|
43
42
|
|
|
44
|
-
if ( icon &&
|
|
43
|
+
if ( icon && typeof icon !== 'string' ) {
|
|
45
44
|
icon = cloneElement( icon, {
|
|
46
45
|
className: classnames( 'components-menu-items__item-icon', {
|
|
47
46
|
'has-icon-right': iconPosition === 'right',
|
|
@@ -8,7 +8,7 @@ import { useRoute, useNavigation } from '@react-navigation/native';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { memo, useContext, useState } from '@wordpress/element';
|
|
11
|
+
import { memo, useContext, useState, useCallback } from '@wordpress/element';
|
|
12
12
|
import { BottomSheetContext, FocalPointPicker } from '@wordpress/components';
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -56,7 +56,7 @@ const FocalPointSettingsPanelMemo = memo(
|
|
|
56
56
|
</NavBar>
|
|
57
57
|
<FocalPointPicker
|
|
58
58
|
focalPoint={ draftFocalPoint }
|
|
59
|
-
onChange={ setPosition }
|
|
59
|
+
onChange={ useCallback( setPosition, [] ) }
|
|
60
60
|
shouldEnableBottomSheetScroll={
|
|
61
61
|
shouldEnableBottomSheetScroll
|
|
62
62
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Image, Text, View } from 'react-native';
|
|
5
|
+
import FastImage from 'react-native-fast-image';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -210,7 +211,7 @@ const ImageComponent = ( {
|
|
|
210
211
|
</View>
|
|
211
212
|
) : (
|
|
212
213
|
<View style={ focalPoint && styles.focalPointContent }>
|
|
213
|
-
<
|
|
214
|
+
<FastImage
|
|
214
215
|
{ ...( ! resizeMode && {
|
|
215
216
|
aspectRatio: imageData?.aspectRatio,
|
|
216
217
|
} ) }
|
|
@@ -219,7 +220,7 @@ const ImageComponent = ( {
|
|
|
219
220
|
{ ...( ! focalPoint && {
|
|
220
221
|
resizeMethod: 'scale',
|
|
221
222
|
} ) }
|
|
222
|
-
resizeMode={ resizeMode }
|
|
223
|
+
resizeMode={ FastImage.resizeMode[ resizeMode ] }
|
|
223
224
|
/>
|
|
224
225
|
</View>
|
|
225
226
|
) }
|
package/src/modal/index.js
CHANGED
|
@@ -10,8 +10,10 @@ import classnames from 'classnames';
|
|
|
10
10
|
*/
|
|
11
11
|
import {
|
|
12
12
|
createPortal,
|
|
13
|
+
useCallback,
|
|
13
14
|
useEffect,
|
|
14
15
|
useRef,
|
|
16
|
+
useState,
|
|
15
17
|
forwardRef,
|
|
16
18
|
} from '@wordpress/element';
|
|
17
19
|
import {
|
|
@@ -24,7 +26,7 @@ import {
|
|
|
24
26
|
} from '@wordpress/compose';
|
|
25
27
|
import { ESCAPE } from '@wordpress/keycodes';
|
|
26
28
|
import { __ } from '@wordpress/i18n';
|
|
27
|
-
import {
|
|
29
|
+
import { close } from '@wordpress/icons';
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Internal dependencies
|
|
@@ -73,6 +75,8 @@ function Modal( props, forwardedRef ) {
|
|
|
73
75
|
const focusReturnRef = useFocusReturn();
|
|
74
76
|
const focusOutsideProps = useFocusOutside( onRequestClose );
|
|
75
77
|
|
|
78
|
+
const [ hasScrolledContent, setHasScrolledContent ] = useState( false );
|
|
79
|
+
|
|
76
80
|
useEffect( () => {
|
|
77
81
|
openModalCount++;
|
|
78
82
|
|
|
@@ -104,6 +108,19 @@ function Modal( props, forwardedRef ) {
|
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
110
|
|
|
111
|
+
const onContentContainerScroll = useCallback(
|
|
112
|
+
( e ) => {
|
|
113
|
+
const scrollY = e?.target?.scrollTop ?? -1;
|
|
114
|
+
|
|
115
|
+
if ( ! hasScrolledContent && scrollY > 0 ) {
|
|
116
|
+
setHasScrolledContent( true );
|
|
117
|
+
} else if ( hasScrolledContent && scrollY <= 0 ) {
|
|
118
|
+
setHasScrolledContent( false );
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
[ hasScrolledContent ]
|
|
122
|
+
);
|
|
123
|
+
|
|
107
124
|
return createPortal(
|
|
108
125
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
109
126
|
<div
|
|
@@ -142,8 +159,10 @@ function Modal( props, forwardedRef ) {
|
|
|
142
159
|
<div
|
|
143
160
|
className={ classnames( 'components-modal__content', {
|
|
144
161
|
'hide-header': __experimentalHideHeader,
|
|
162
|
+
'has-scrolled-content': hasScrolledContent,
|
|
145
163
|
} ) }
|
|
146
164
|
role="document"
|
|
165
|
+
onScroll={ onContentContainerScroll }
|
|
147
166
|
>
|
|
148
167
|
{ ! __experimentalHideHeader && (
|
|
149
168
|
<div className="components-modal__header">
|
|
@@ -168,7 +187,7 @@ function Modal( props, forwardedRef ) {
|
|
|
168
187
|
{ isDismissible && (
|
|
169
188
|
<Button
|
|
170
189
|
onClick={ onRequestClose }
|
|
171
|
-
icon={
|
|
190
|
+
icon={ close }
|
|
172
191
|
label={
|
|
173
192
|
closeButtonLabel ||
|
|
174
193
|
__( 'Close dialog' )
|
|
@@ -35,7 +35,23 @@ const ModalExample = ( props ) => {
|
|
|
35
35
|
Open Modal
|
|
36
36
|
</Button>
|
|
37
37
|
{ isOpen && (
|
|
38
|
-
<Modal
|
|
38
|
+
<Modal
|
|
39
|
+
{ ...props }
|
|
40
|
+
onRequestClose={ closeModal }
|
|
41
|
+
style={ { maxWidth: '600px' } }
|
|
42
|
+
>
|
|
43
|
+
<p>
|
|
44
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
|
|
45
|
+
sed do eiusmod tempor incididunt ut labore et magna
|
|
46
|
+
aliqua. Ut enim ad minim veniam, quis nostrud
|
|
47
|
+
exercitation ullamco laboris nisi ut aliquip ex ea ea
|
|
48
|
+
commodo consequat. Duis aute irure dolor in
|
|
49
|
+
reprehenderit in voluptate velit esse cillum dolore eu
|
|
50
|
+
fugiat nulla pariatur. Excepteur sint occaecat cupidatat
|
|
51
|
+
non proident, sunt in culpa qui officia deserunt mollit
|
|
52
|
+
anim id est laborum.
|
|
53
|
+
</p>
|
|
54
|
+
|
|
39
55
|
<Button variant="secondary" onClick={ closeModal }>
|
|
40
56
|
Close Modal
|
|
41
57
|
</Button>
|
package/src/modal/style.scss
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
background-color: rgba($black, 0.35);
|
|
9
9
|
z-index: z-index(".components-modal__screen-overlay");
|
|
10
10
|
display: flex;
|
|
11
|
+
backdrop-filter: blur($grid-unit);
|
|
11
12
|
|
|
12
13
|
// This animates the appearance of the white background.
|
|
13
14
|
@include edit-post__fade-in-animation();
|
|
@@ -63,13 +64,13 @@
|
|
|
63
64
|
// modal screen).
|
|
64
65
|
.components-modal__header {
|
|
65
66
|
box-sizing: border-box;
|
|
66
|
-
border-bottom: $border-width solid
|
|
67
|
+
border-bottom: $border-width solid transparent;
|
|
67
68
|
padding: 0 $grid-unit-40;
|
|
68
69
|
display: flex;
|
|
69
70
|
flex-direction: row;
|
|
70
71
|
justify-content: space-between;
|
|
71
72
|
align-items: center;
|
|
72
|
-
height: $header-height;
|
|
73
|
+
height: $header-height + $grid-unit-20;
|
|
73
74
|
width: 100%;
|
|
74
75
|
z-index: z-index(".components-modal__header");
|
|
75
76
|
position: absolute;
|
|
@@ -77,7 +78,7 @@
|
|
|
77
78
|
left: 0;
|
|
78
79
|
|
|
79
80
|
.components-modal__header-heading {
|
|
80
|
-
font-size:
|
|
81
|
+
font-size: 1.2rem;
|
|
81
82
|
font-weight: 600;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -90,6 +91,10 @@
|
|
|
90
91
|
position: relative;
|
|
91
92
|
left: $grid-unit-10;
|
|
92
93
|
}
|
|
94
|
+
|
|
95
|
+
.components-modal__content.has-scrolled-content:not(.hide-header) & {
|
|
96
|
+
border-bottom-color: $gray-300;
|
|
97
|
+
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
100
|
.components-modal__header-heading-container {
|
|
@@ -113,26 +118,12 @@
|
|
|
113
118
|
// Modal contents.
|
|
114
119
|
.components-modal__content {
|
|
115
120
|
flex: 1;
|
|
116
|
-
margin-top: $header-height;
|
|
121
|
+
margin-top: $header-height + $grid-unit-20;
|
|
117
122
|
padding: 0 $grid-unit-40 $grid-unit-30;
|
|
118
123
|
overflow: auto;
|
|
119
124
|
|
|
120
|
-
// Emulate margin-bottom for the header. Uses a pseudo-element since the
|
|
121
|
-
// absolutely positioned header’s margins wouldn’t effect siblings and
|
|
122
|
-
// padding-top on the content element would effect positioning of any
|
|
123
|
-
// sticky elements within.
|
|
124
|
-
&::before {
|
|
125
|
-
content: "";
|
|
126
|
-
display: block;
|
|
127
|
-
margin-bottom: $grid-unit-30;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
125
|
&.hide-header {
|
|
131
126
|
margin-top: 0;
|
|
132
127
|
padding-top: $grid-unit-30;
|
|
133
|
-
|
|
134
|
-
&::before {
|
|
135
|
-
content: none;
|
|
136
|
-
}
|
|
137
128
|
}
|
|
138
129
|
}
|
package/src/navigation/index.js
CHANGED
|
@@ -54,6 +54,9 @@ export default function Navigation( {
|
|
|
54
54
|
if ( activeMenu !== menu ) {
|
|
55
55
|
setActiveMenu( activeMenu );
|
|
56
56
|
}
|
|
57
|
+
// Ignore exhaustive-deps here, as it would require either a larger refactor or some questionable workarounds.
|
|
58
|
+
// See https://github.com/WordPress/gutenberg/pull/41612 for context.
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
60
|
}, [ activeMenu ] );
|
|
58
61
|
|
|
59
62
|
const context = {
|
|
@@ -18,7 +18,8 @@ import { ItemBaseUI } from '../styles/navigation-styles';
|
|
|
18
18
|
let uniqueId = 0;
|
|
19
19
|
|
|
20
20
|
export default function NavigationItemBase( props ) {
|
|
21
|
-
|
|
21
|
+
// Also avoid to pass the `title` and `href` props to the ItemBaseUI styled component.
|
|
22
|
+
const { children, className, title, href, ...restProps } = props;
|
|
22
23
|
|
|
23
24
|
const [ itemId ] = useState( `item-${ ++uniqueId }` );
|
|
24
25
|
|
package/src/popover/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Set this prop to `false` to disable focus changing entirely. This should only be
|
|
|
61
61
|
|
|
62
62
|
### placement
|
|
63
63
|
|
|
64
|
-
The direction in which the popover should open relative to its parent node or anchor node.
|
|
64
|
+
The direction in which the popover should open relative to its parent node or anchor node.
|
|
65
65
|
|
|
66
66
|
The available base placements are 'top', 'right', 'bottom', 'left'.
|
|
67
67
|
|
|
@@ -137,7 +137,7 @@ A callback function which is used to override the anchor value computation algor
|
|
|
137
137
|
|
|
138
138
|
If you need the `DOMRect` object i.e., the position of popover to be calculated on every time, the popover re-renders, then use `getAnchorRect`.
|
|
139
139
|
|
|
140
|
-
`getAnchorRect` callback function receives a reference to the popover anchor element as a function parameter and it should return a `DOMRect` object.
|
|
140
|
+
`getAnchorRect` callback function receives a reference to the popover anchor element as a function parameter and it should return a `DOMRect` object. Noting that `getAnchorRect` can be called with `null`.
|
|
141
141
|
|
|
142
142
|
- Type: `Function`
|
|
143
143
|
- Required: No
|