@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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { flatMap, isEmpty } from 'lodash';
|
|
6
5
|
import { Platform } from 'react-native';
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -53,13 +52,13 @@ function DropdownMenu( {
|
|
|
53
52
|
popoverProps,
|
|
54
53
|
toggleProps,
|
|
55
54
|
} ) {
|
|
56
|
-
if (
|
|
55
|
+
if ( ! controls?.length && ! isFunction( children ) ) {
|
|
57
56
|
return null;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
59
|
// Normalize controls to nested array of objects (sets of controls)
|
|
61
60
|
let controlSets;
|
|
62
|
-
if (
|
|
61
|
+
if ( controls?.length ) {
|
|
63
62
|
controlSets = controls;
|
|
64
63
|
if ( ! Array.isArray( controlSets[ 0 ] ) ) {
|
|
65
64
|
controlSets = [ controlSets ];
|
|
@@ -131,8 +130,7 @@ function DropdownMenu( {
|
|
|
131
130
|
title={ label }
|
|
132
131
|
style={ { paddingLeft: 0, paddingRight: 0 } }
|
|
133
132
|
>
|
|
134
|
-
{ flatMap(
|
|
135
|
-
controlSets,
|
|
133
|
+
{ controlSets?.flatMap(
|
|
136
134
|
( controlSet, indexOfSet ) =>
|
|
137
135
|
controlSet.map(
|
|
138
136
|
( control, indexOfControl ) => (
|
package/src/elevation/hook.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import classnames from 'classnames';
|
|
5
|
-
import { compact, uniq } from 'lodash';
|
|
6
5
|
import type { ForwardedRef } from 'react';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -28,9 +27,16 @@ function UnforwardedExternalLink(
|
|
|
28
27
|
ref: ForwardedRef< HTMLAnchorElement >
|
|
29
28
|
) {
|
|
30
29
|
const { href, children, className, rel = '', ...additionalProps } = props;
|
|
31
|
-
const optimizedRel =
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
const optimizedRel = [
|
|
31
|
+
...new Set(
|
|
32
|
+
[
|
|
33
|
+
...rel.split( ' ' ),
|
|
34
|
+
'external',
|
|
35
|
+
'noreferrer',
|
|
36
|
+
'noopener',
|
|
37
|
+
].filter( Boolean )
|
|
38
|
+
),
|
|
39
|
+
].join( ' ' );
|
|
34
40
|
const classes = classnames( 'components-external-link', className );
|
|
35
41
|
return (
|
|
36
42
|
/* eslint-disable react/jsx-no-target-blank */
|
|
@@ -13,9 +13,6 @@ import {
|
|
|
13
13
|
} from './styles/focal-point-picker-style';
|
|
14
14
|
import { useUpdateEffect } from '../utils/hooks';
|
|
15
15
|
|
|
16
|
-
const { clearTimeout, setTimeout } =
|
|
17
|
-
typeof window !== 'undefined' ? window : {};
|
|
18
|
-
|
|
19
16
|
export default function FocalPointPickerGrid( {
|
|
20
17
|
bounds = {},
|
|
21
18
|
value,
|
|
@@ -52,11 +49,11 @@ function useRevealAnimation( value ) {
|
|
|
52
49
|
|
|
53
50
|
useUpdateEffect( () => {
|
|
54
51
|
setIsActive( true );
|
|
55
|
-
const timeout = setTimeout( () => {
|
|
52
|
+
const timeout = window.setTimeout( () => {
|
|
56
53
|
setIsActive( false );
|
|
57
54
|
}, 600 );
|
|
58
55
|
|
|
59
|
-
return () => clearTimeout( timeout );
|
|
56
|
+
return () => window.clearTimeout( timeout );
|
|
60
57
|
}, [ value ] );
|
|
61
58
|
|
|
62
59
|
return {
|
|
@@ -40,8 +40,8 @@ function FocalPointPicker( props ) {
|
|
|
40
40
|
const [ videoNaturalSize, setVideoNaturalSize ] = useState( null );
|
|
41
41
|
const [ tooltipVisible, setTooltipVisible ] = useState( false );
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const locationPageOffsetX = useRef();
|
|
44
|
+
const locationPageOffsetY = useRef();
|
|
45
45
|
const videoRef = useRef( null );
|
|
46
46
|
|
|
47
47
|
useEffect( () => {
|
|
@@ -67,7 +67,7 @@ function FocalPointPicker( props ) {
|
|
|
67
67
|
y: focalPoint.y * containerSize.height,
|
|
68
68
|
} );
|
|
69
69
|
}
|
|
70
|
-
}, [ focalPoint, containerSize ] );
|
|
70
|
+
}, [ focalPoint, containerSize, pan ] );
|
|
71
71
|
|
|
72
72
|
// Pan responder to manage drag handle interactivity.
|
|
73
73
|
const panResponder = useMemo(
|
|
@@ -86,8 +86,8 @@ function FocalPointPicker( props ) {
|
|
|
86
86
|
pageX,
|
|
87
87
|
pageY,
|
|
88
88
|
} = event.nativeEvent;
|
|
89
|
-
locationPageOffsetX = pageX - x;
|
|
90
|
-
locationPageOffsetY = pageY - y;
|
|
89
|
+
locationPageOffsetX.current = pageX - x;
|
|
90
|
+
locationPageOffsetY.current = pageY - y;
|
|
91
91
|
pan.setValue( { x, y } ); // Set cursor to tap location.
|
|
92
92
|
pan.extractOffset(); // Set offset to current value.
|
|
93
93
|
},
|
|
@@ -106,8 +106,8 @@ function FocalPointPicker( props ) {
|
|
|
106
106
|
// Specifically, dragging the handle outside the bounds of the image
|
|
107
107
|
// results in inaccurate locationX and locationY coordinates to be
|
|
108
108
|
// reported. https://github.com/facebook/react-native/issues/15290#issuecomment-435494944
|
|
109
|
-
const x = pageX - locationPageOffsetX;
|
|
110
|
-
const y = pageY - locationPageOffsetY;
|
|
109
|
+
const x = pageX - locationPageOffsetX.current;
|
|
110
|
+
const y = pageY - locationPageOffsetY.current;
|
|
111
111
|
onChange( {
|
|
112
112
|
x: clamp( x / containerSize?.width, 0, 1 ).toFixed( 2 ),
|
|
113
113
|
y: clamp( y / containerSize?.height, 0, 1 ).toFixed(
|
|
@@ -120,7 +120,7 @@ function FocalPointPicker( props ) {
|
|
|
120
120
|
setSliderKey( ( prevState ) => prevState + 1 );
|
|
121
121
|
},
|
|
122
122
|
} ),
|
|
123
|
-
[ containerSize ]
|
|
123
|
+
[ containerSize, pan, onChange, shouldEnableBottomSheetScroll ]
|
|
124
124
|
);
|
|
125
125
|
|
|
126
126
|
const mediaBackground = usePreferredColorSchemeStyle(
|
|
@@ -66,18 +66,17 @@ function Label( { align, text, xOffset, yOffset } ) {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
useEffect( () => {
|
|
69
|
+
const startAnimation = () => {
|
|
70
|
+
Animated.timing( animationValue, {
|
|
71
|
+
toValue: visible ? 1 : 0,
|
|
72
|
+
duration: visible ? 300 : 150,
|
|
73
|
+
useNativeDriver: true,
|
|
74
|
+
delay: visible ? 500 : 0,
|
|
75
|
+
easing: Easing.out( Easing.quad ),
|
|
76
|
+
} ).start();
|
|
77
|
+
};
|
|
69
78
|
startAnimation();
|
|
70
|
-
}, [ visible ] );
|
|
71
|
-
|
|
72
|
-
const startAnimation = () => {
|
|
73
|
-
Animated.timing( animationValue, {
|
|
74
|
-
toValue: visible ? 1 : 0,
|
|
75
|
-
duration: visible ? 300 : 150,
|
|
76
|
-
useNativeDriver: true,
|
|
77
|
-
delay: visible ? 500 : 0,
|
|
78
|
-
easing: Easing.out( Easing.quad ),
|
|
79
|
-
} ).start();
|
|
80
|
-
};
|
|
79
|
+
}, [ animationValue, visible ] );
|
|
81
80
|
|
|
82
81
|
// Transforms rely upon onLayout to enable custom offsets additions.
|
|
83
82
|
let tooltipTransforms;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { last, clone, uniq, map, difference,
|
|
4
|
+
import { last, clone, uniq, map, difference, some } from 'lodash';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
import type { KeyboardEvent, MouseEvent, TouchEvent } from 'react';
|
|
7
7
|
|
|
@@ -30,8 +30,12 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
|
30
30
|
*/
|
|
31
31
|
import Token from './token';
|
|
32
32
|
import TokenInput from './token-input';
|
|
33
|
+
import { TokensAndInputWrapperFlex } from './styles';
|
|
33
34
|
import SuggestionsList from './suggestions-list';
|
|
34
35
|
import type { FormTokenFieldProps, TokenItem } from './types';
|
|
36
|
+
import { FlexItem } from '../flex';
|
|
37
|
+
|
|
38
|
+
const identity = ( value: string ) => value;
|
|
35
39
|
|
|
36
40
|
/**
|
|
37
41
|
* A `FormTokenField` is a field similar to the tags and categories fields in the interim editor chrome,
|
|
@@ -71,6 +75,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
71
75
|
__experimentalExpandOnFocus = false,
|
|
72
76
|
__experimentalValidateInput = () => true,
|
|
73
77
|
__experimentalShowHowTo = true,
|
|
78
|
+
__next36pxDefaultSize = false,
|
|
74
79
|
} = props;
|
|
75
80
|
|
|
76
81
|
const instanceId = useInstanceId( FormTokenField );
|
|
@@ -566,28 +571,35 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
566
571
|
const termsCount = tokens.length;
|
|
567
572
|
|
|
568
573
|
return (
|
|
569
|
-
<
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
isBorderless
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
574
|
+
<FlexItem key={ 'token-' + _value }>
|
|
575
|
+
<Token
|
|
576
|
+
value={ _value }
|
|
577
|
+
status={ status }
|
|
578
|
+
title={
|
|
579
|
+
typeof token !== 'string' ? token.title : undefined
|
|
580
|
+
}
|
|
581
|
+
displayTransform={ displayTransform }
|
|
582
|
+
onClickRemove={ onTokenClickRemove }
|
|
583
|
+
isBorderless={
|
|
584
|
+
( typeof token !== 'string' && token.isBorderless ) ||
|
|
585
|
+
isBorderless
|
|
586
|
+
}
|
|
587
|
+
onMouseEnter={
|
|
588
|
+
typeof token !== 'string'
|
|
589
|
+
? token.onMouseEnter
|
|
590
|
+
: undefined
|
|
591
|
+
}
|
|
592
|
+
onMouseLeave={
|
|
593
|
+
typeof token !== 'string'
|
|
594
|
+
? token.onMouseLeave
|
|
595
|
+
: undefined
|
|
596
|
+
}
|
|
597
|
+
disabled={ 'error' !== status && disabled }
|
|
598
|
+
messages={ messages }
|
|
599
|
+
termsCount={ termsCount }
|
|
600
|
+
termPosition={ termPosition }
|
|
601
|
+
/>
|
|
602
|
+
</FlexItem>
|
|
591
603
|
);
|
|
592
604
|
}
|
|
593
605
|
|
|
@@ -660,7 +672,16 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
660
672
|
onMouseDown={ onContainerTouched }
|
|
661
673
|
onTouchStart={ onContainerTouched }
|
|
662
674
|
>
|
|
663
|
-
|
|
675
|
+
<TokensAndInputWrapperFlex
|
|
676
|
+
justify="flex-start"
|
|
677
|
+
align="center"
|
|
678
|
+
gap={ 1 }
|
|
679
|
+
wrap={ true }
|
|
680
|
+
__next36pxDefaultSize={ __next36pxDefaultSize }
|
|
681
|
+
hasTokens={ !! value.length }
|
|
682
|
+
>
|
|
683
|
+
{ renderTokensAndInput() }
|
|
684
|
+
</TokensAndInputWrapperFlex>
|
|
664
685
|
{ isExpanded && (
|
|
665
686
|
<SuggestionsList
|
|
666
687
|
instanceId={ instanceId }
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
.components-form-token-field__input-container {
|
|
2
2
|
@include input-control();
|
|
3
|
-
display: flex;
|
|
4
|
-
flex-wrap: wrap;
|
|
5
|
-
align-items: center;
|
|
6
3
|
width: 100%;
|
|
7
4
|
margin: 0 0 $grid-unit-10 0;
|
|
8
|
-
padding:
|
|
5
|
+
padding: 0;
|
|
9
6
|
cursor: text;
|
|
10
7
|
|
|
11
|
-
|
|
12
8
|
&.is-disabled {
|
|
13
9
|
background: $gray-300;
|
|
14
10
|
border-color: $gray-300;
|
|
@@ -67,7 +63,6 @@
|
|
|
67
63
|
.components-form-token-field__token {
|
|
68
64
|
font-size: $default-font-size;
|
|
69
65
|
display: flex;
|
|
70
|
-
margin: 2px 4px 2px 0;
|
|
71
66
|
color: $gray-900;
|
|
72
67
|
max-width: 100%;
|
|
73
68
|
|
|
@@ -180,7 +175,7 @@
|
|
|
180
175
|
@include reduce-motion("transition");
|
|
181
176
|
list-style: none;
|
|
182
177
|
border-top: $border-width solid $gray-700;
|
|
183
|
-
margin:
|
|
178
|
+
margin: 0;
|
|
184
179
|
padding: 0;
|
|
185
180
|
}
|
|
186
181
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import { css } from '@emotion/react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { Flex } from '../flex';
|
|
11
|
+
import { space } from '../ui/utils/space';
|
|
12
|
+
|
|
13
|
+
type TokensAndInputWrapperProps = {
|
|
14
|
+
__next36pxDefaultSize: boolean;
|
|
15
|
+
hasTokens: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const deprecatedPaddings = ( {
|
|
19
|
+
__next36pxDefaultSize,
|
|
20
|
+
hasTokens,
|
|
21
|
+
}: TokensAndInputWrapperProps ) =>
|
|
22
|
+
! __next36pxDefaultSize &&
|
|
23
|
+
css`
|
|
24
|
+
padding-top: ${ space( hasTokens ? 1 : 0.5 ) };
|
|
25
|
+
padding-bottom: ${ space( hasTokens ? 1 : 0.5 ) };
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
export const TokensAndInputWrapperFlex = styled( Flex )`
|
|
29
|
+
padding: 5px ${ space( 1 ) };
|
|
30
|
+
|
|
31
|
+
${ deprecatedPaddings }
|
|
32
|
+
`;
|
|
@@ -17,8 +17,6 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
17
17
|
*/
|
|
18
18
|
import type { SuggestionsListProps } from './types';
|
|
19
19
|
|
|
20
|
-
const { setTimeout, clearTimeout } = window;
|
|
21
|
-
|
|
22
20
|
const handleMouseDown: MouseEventHandler = ( e ) => {
|
|
23
21
|
// By preventing default here, we will not lose focus of <input> when clicking a suggestion.
|
|
24
22
|
e.preventDefault();
|
|
@@ -54,14 +52,14 @@ export function SuggestionsList< T extends string | { value: string } >( {
|
|
|
54
52
|
onlyScrollIfNeeded: true,
|
|
55
53
|
}
|
|
56
54
|
);
|
|
57
|
-
id = setTimeout( () => {
|
|
55
|
+
id = window.setTimeout( () => {
|
|
58
56
|
setScrollingIntoView( false );
|
|
59
57
|
}, 100 );
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
return () => {
|
|
63
61
|
if ( id !== undefined ) {
|
|
64
|
-
clearTimeout( id );
|
|
62
|
+
window.clearTimeout( id );
|
|
65
63
|
}
|
|
66
64
|
};
|
|
67
65
|
},
|
|
@@ -147,6 +147,13 @@ export interface FormTokenFieldProps
|
|
|
147
147
|
* @default true
|
|
148
148
|
*/
|
|
149
149
|
__experimentalShowHowTo?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Start opting into the larger default height that will become the
|
|
152
|
+
* default size in a future version.
|
|
153
|
+
*
|
|
154
|
+
* @default false
|
|
155
|
+
*/
|
|
156
|
+
__next36pxDefaultSize?: boolean;
|
|
150
157
|
}
|
|
151
158
|
|
|
152
159
|
export interface SuggestionsListProps< T = string | { value: string } > {
|
package/src/grid/README.md
CHANGED
|
@@ -27,56 +27,70 @@ function Example() {
|
|
|
27
27
|
|
|
28
28
|
## Props
|
|
29
29
|
|
|
30
|
-
##### align
|
|
31
|
-
|
|
32
|
-
**Type**: `CSS['alignItems']`
|
|
30
|
+
##### `align`: `CSS['alignItems']`
|
|
33
31
|
|
|
34
32
|
Adjusts the block alignment of children.
|
|
35
33
|
|
|
36
|
-
|
|
34
|
+
- Required: No
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
##### `alignment`: `GridAlignment`
|
|
39
37
|
|
|
40
38
|
Adjusts the horizontal and vertical alignment of children.
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
- Required: No
|
|
41
|
+
|
|
42
|
+
##### `columnGap`: `CSSProperties['gridColumnGap']`
|
|
43
|
+
|
|
44
|
+
Adjusts the `grid-column-gap`.
|
|
45
|
+
|
|
46
|
+
- Required: No
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
##### `columns`: `number`
|
|
45
49
|
|
|
46
50
|
Adjusts the number of columns of the `Grid`.
|
|
47
51
|
|
|
48
|
-
|
|
52
|
+
- Required: No
|
|
53
|
+
- Default: `2`
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
##### `gap`: `number`
|
|
51
56
|
|
|
52
57
|
Gap between each child.
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
- Required: No
|
|
60
|
+
- Default: `3`
|
|
55
61
|
|
|
56
|
-
|
|
62
|
+
##### `isInline`: `boolean`
|
|
57
63
|
|
|
58
64
|
Changes the CSS display from `grid` to `inline-grid`.
|
|
59
65
|
|
|
60
|
-
|
|
66
|
+
- Required: No
|
|
61
67
|
|
|
62
|
-
|
|
68
|
+
##### `justify`: `CSS['justifyContent']`
|
|
63
69
|
|
|
64
70
|
Adjusts the inline alignment of children.
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
- Required: No
|
|
67
73
|
|
|
68
|
-
|
|
74
|
+
##### `rowGap`: `CSSProperties['gridRowGap']`
|
|
75
|
+
|
|
76
|
+
Adjusts the `grid-row-gap`.
|
|
77
|
+
|
|
78
|
+
- Required: No
|
|
79
|
+
|
|
80
|
+
##### `rows`: `number`
|
|
69
81
|
|
|
70
82
|
Adjusts the number of rows of the `Grid`.
|
|
71
83
|
|
|
72
|
-
|
|
84
|
+
- Required: No
|
|
73
85
|
|
|
74
|
-
|
|
86
|
+
##### `templateColumns`: `CSS['gridTemplateColumns']`
|
|
75
87
|
|
|
76
88
|
Adjusts the CSS grid `template-columns`.
|
|
77
89
|
|
|
78
|
-
|
|
90
|
+
- Required: No
|
|
79
91
|
|
|
80
|
-
|
|
92
|
+
##### `templateRows`: `CSS['gridTemplateRows']`
|
|
81
93
|
|
|
82
94
|
Adjusts the CSS grid `template-rows`.
|
|
95
|
+
|
|
96
|
+
- Required: No
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { contextConnect } from '../ui/context';
|
|
9
|
+
import { contextConnect, WordPressComponentProps } from '../ui/context';
|
|
5
10
|
import { View } from '../view';
|
|
6
11
|
import useGrid from './hook';
|
|
12
|
+
import type { GridProps } from './types';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function Grid( props, forwardedRef ) {
|
|
14
|
+
function UnconnectedGrid(
|
|
15
|
+
props: WordPressComponentProps< GridProps, 'div' >,
|
|
16
|
+
forwardedRef: ForwardedRef< any >
|
|
17
|
+
) {
|
|
13
18
|
const gridProps = useGrid( props );
|
|
14
19
|
|
|
15
20
|
return <View { ...gridProps } ref={ forwardedRef } />;
|
|
@@ -18,7 +23,6 @@ function Grid( props, forwardedRef ) {
|
|
|
18
23
|
/**
|
|
19
24
|
* `Grid` is a primitive layout component that can arrange content in a grid configuration.
|
|
20
25
|
*
|
|
21
|
-
* @example
|
|
22
26
|
* ```jsx
|
|
23
27
|
* import {
|
|
24
28
|
* __experimentalGrid as Grid,
|
|
@@ -36,6 +40,6 @@ function Grid( props, forwardedRef ) {
|
|
|
36
40
|
* }
|
|
37
41
|
* ```
|
|
38
42
|
*/
|
|
39
|
-
const
|
|
43
|
+
export const Grid = contextConnect( UnconnectedGrid, 'Grid' );
|
|
40
44
|
|
|
41
|
-
export default
|
|
45
|
+
export default Grid;
|
|
@@ -11,16 +11,16 @@ import { useMemo } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { useContextSystem } from '../ui/context';
|
|
14
|
+
import { useContextSystem, WordPressComponentProps } from '../ui/context';
|
|
15
15
|
import { getAlignmentProps } from './utils';
|
|
16
16
|
import { useResponsiveValue } from '../ui/utils/use-responsive-value';
|
|
17
17
|
import CONFIG from '../utils/config-values';
|
|
18
18
|
import { useCx } from '../utils/hooks/use-cx';
|
|
19
|
+
import type { GridProps } from './types';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export default function useGrid( props ) {
|
|
21
|
+
export default function useGrid(
|
|
22
|
+
props: WordPressComponentProps< GridProps, 'div' >
|
|
23
|
+
) {
|
|
24
24
|
const {
|
|
25
25
|
align,
|
|
26
26
|
alignment,
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { View } from '../../view';
|
|
10
|
+
import { Grid } from '..';
|
|
11
|
+
|
|
12
|
+
const meta: ComponentMeta< typeof Grid > = {
|
|
13
|
+
component: Grid,
|
|
14
|
+
title: 'Components (Experimental)/Grid',
|
|
15
|
+
argTypes: {
|
|
16
|
+
as: { control: { type: 'text' } },
|
|
17
|
+
align: { control: { type: 'text' } },
|
|
18
|
+
children: { control: { type: null } },
|
|
19
|
+
columnGap: { control: { type: 'text' } },
|
|
20
|
+
columns: {
|
|
21
|
+
table: { type: { summary: 'number' } },
|
|
22
|
+
control: { type: 'number' },
|
|
23
|
+
},
|
|
24
|
+
justify: { control: { type: 'text' } },
|
|
25
|
+
rowGap: { control: { type: 'text' } },
|
|
26
|
+
rows: {
|
|
27
|
+
table: { type: { summary: 'number' } },
|
|
28
|
+
control: { type: 'number' },
|
|
29
|
+
},
|
|
30
|
+
templateColumns: { control: { type: 'text' } },
|
|
31
|
+
templateRows: { control: { type: 'text' } },
|
|
32
|
+
},
|
|
33
|
+
parameters: {
|
|
34
|
+
controls: {
|
|
35
|
+
expanded: true,
|
|
36
|
+
},
|
|
37
|
+
docs: { source: { state: 'open' } },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export default meta;
|
|
41
|
+
|
|
42
|
+
const Item = ( props: { children: string } ) => (
|
|
43
|
+
<View
|
|
44
|
+
style={ {
|
|
45
|
+
borderRadius: 8,
|
|
46
|
+
background: '#eee',
|
|
47
|
+
padding: 8,
|
|
48
|
+
textAlign: 'center',
|
|
49
|
+
} }
|
|
50
|
+
{ ...props }
|
|
51
|
+
/>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const Template: ComponentStory< typeof Grid > = ( props ) => (
|
|
55
|
+
<Grid { ...props }>
|
|
56
|
+
<Item>One</Item>
|
|
57
|
+
<Item>Two</Item>
|
|
58
|
+
<Item>Three</Item>
|
|
59
|
+
<Item>Four</Item>
|
|
60
|
+
<Item>Five</Item>
|
|
61
|
+
<Item>Six</Item>
|
|
62
|
+
<Item>Seven</Item>
|
|
63
|
+
<Item>Eight</Item>
|
|
64
|
+
</Grid>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const Default: ComponentStory< typeof Grid > = Template.bind( {} );
|
|
68
|
+
Default.args = {
|
|
69
|
+
alignment: 'bottom',
|
|
70
|
+
columns: 4,
|
|
71
|
+
gap: 2,
|
|
72
|
+
};
|
|
@@ -28,7 +28,7 @@ describe( 'props', () => {
|
|
|
28
28
|
|
|
29
29
|
test( 'should render gap', () => {
|
|
30
30
|
const { container } = render(
|
|
31
|
-
<Grid columns=
|
|
31
|
+
<Grid columns={ 3 } gap={ 4 }>
|
|
32
32
|
<View />
|
|
33
33
|
<View />
|
|
34
34
|
<View />
|
|
@@ -44,7 +44,7 @@ describe( 'props', () => {
|
|
|
44
44
|
|
|
45
45
|
test( 'should render custom columns', () => {
|
|
46
46
|
const { container } = render(
|
|
47
|
-
<Grid columns=
|
|
47
|
+
<Grid columns={ 7 }>
|
|
48
48
|
<View />
|
|
49
49
|
<View />
|
|
50
50
|
<View />
|
|
@@ -59,7 +59,7 @@ describe( 'props', () => {
|
|
|
59
59
|
|
|
60
60
|
test( 'should render custom rows', () => {
|
|
61
61
|
const { container } = render(
|
|
62
|
-
<Grid rows=
|
|
62
|
+
<Grid rows={ 7 }>
|
|
63
63
|
<View />
|
|
64
64
|
<View />
|
|
65
65
|
<View />
|
|
@@ -120,7 +120,7 @@ describe( 'props', () => {
|
|
|
120
120
|
|
|
121
121
|
test( 'should render isInline', () => {
|
|
122
122
|
const { container } = render(
|
|
123
|
-
<Grid columns=
|
|
123
|
+
<Grid columns={ 3 } isInline>
|
|
124
124
|
<View />
|
|
125
125
|
<View />
|
|
126
126
|
<View />
|