@wordpress/components 19.16.0 → 19.17.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 +40 -4
- package/build/base-control/index.js +6 -3
- package/build/base-control/index.js.map +1 -1
- package/build/base-control/styles/base-control-styles.js +8 -8
- package/build/base-control/styles/base-control-styles.js.map +1 -1
- package/build/border-control/styles.js +17 -25
- package/build/border-control/styles.js.map +1 -1
- package/build/box-control/all-input-control.js +2 -27
- package/build/box-control/all-input-control.js.map +1 -1
- package/build/box-control/index.js +10 -5
- package/build/box-control/index.js.map +1 -1
- package/build/box-control/styles/box-control-styles.js +17 -9
- package/build/box-control/styles/box-control-styles.js.map +1 -1
- package/build/box-control/utils.js +35 -0
- package/build/box-control/utils.js.map +1 -1
- package/build/color-picker/styles.js +10 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +14 -6
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-select-control/index.js +3 -1
- package/build/custom-select-control/index.js.map +1 -1
- package/build/date-time/time/index.js +6 -2
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/time/styles.js +17 -24
- package/build/date-time/time/styles.js.map +1 -1
- package/build/external-link/index.js +6 -0
- package/build/external-link/index.js.map +1 -1
- package/build/flex/flex/component.js +9 -9
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex/hook.js +6 -16
- package/build/flex/flex/hook.js.map +1 -1
- package/build/flex/flex/index.js.map +1 -1
- package/build/flex/flex-block/component.js +9 -9
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-block/hook.js +0 -4
- package/build/flex/flex-block/hook.js.map +1 -1
- package/build/flex/flex-block/index.js.map +1 -1
- package/build/flex/flex-item/component.js +9 -9
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/flex/flex-item/hook.js +1 -5
- package/build/flex/flex-item/hook.js.map +1 -1
- package/build/flex/flex-item/index.js.map +1 -1
- package/build/flex/index.js.map +1 -1
- package/build/flex/styles.js +5 -5
- package/build/flex/styles.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +22 -22
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +5 -5
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/font-size-picker/index.js +15 -6
- package/build/font-size-picker/index.js.map +1 -1
- package/build/form-token-field/index.js +6 -2
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +19 -6
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/index.js +7 -1
- package/build/index.js.map +1 -1
- package/build/input-control/input-base.js +1 -2
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/reducer/actions.js +3 -1
- package/build/input-control/reducer/actions.js.map +1 -1
- package/build/input-control/reducer/reducer.js +28 -11
- package/build/input-control/reducer/reducer.js.map +1 -1
- package/build/input-control/reducer/state.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +26 -26
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +23 -3
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/image/index.native.js +23 -2
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/link-picker/link-picker-screen.native.js +10 -4
- package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build/mobile/picker/index.ios.js +16 -3
- package/build/mobile/picker/index.ios.js.map +1 -1
- package/build/placeholder/index.js +11 -14
- package/build/placeholder/index.js.map +1 -1
- package/build/placeholder/types.js +6 -0
- package/build/placeholder/types.js.map +1 -0
- package/build/popover/index.js +113 -62
- package/build/popover/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +40 -40
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
- package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +6 -6
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/style-provider/index.js +10 -7
- package/build/style-provider/index.js.map +1 -1
- package/build/style-provider/types.js +6 -0
- package/build/style-provider/types.js.map +1 -0
- package/build/swatch/index.js +2 -0
- package/build/swatch/index.js.map +1 -1
- package/build/swatch/types.js +6 -0
- package/build/swatch/types.js.map +1 -0
- package/build/text/hook.js +5 -8
- package/build/text/hook.js.map +1 -1
- package/build/tools-panel/styles.js +13 -10
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +1 -1
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/ui/tooltip/styles.js +4 -4
- package/build/ui/tooltip/styles.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +34 -9
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build/utils/base-label.js +24 -0
- package/build/utils/base-label.js.map +1 -0
- package/build/utils/box-sizing.js +22 -0
- package/build/utils/box-sizing.js.map +1 -0
- package/build/utils/style-mixins.js +16 -0
- package/build/utils/style-mixins.js.map +1 -1
- package/build-module/base-control/index.js +7 -5
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-control/styles/base-control-styles.js +9 -9
- package/build-module/base-control/styles/base-control-styles.js.map +1 -1
- package/build-module/border-control/styles.js +18 -26
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/box-control/all-input-control.js +3 -28
- package/build-module/box-control/all-input-control.js.map +1 -1
- package/build-module/box-control/index.js +4 -4
- package/build-module/box-control/index.js.map +1 -1
- package/build-module/box-control/styles/box-control-styles.js +18 -10
- package/build-module/box-control/styles/box-control-styles.js.map +1 -1
- package/build-module/box-control/utils.js +33 -0
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/color-picker/styles.js +9 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +13 -6
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +2 -1
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/date-time/time/index.js +6 -3
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/time/styles.js +15 -21
- package/build-module/date-time/time/styles.js.map +1 -1
- package/build-module/external-link/index.js +6 -0
- package/build-module/external-link/index.js.map +1 -1
- package/build-module/flex/flex/component.js +9 -9
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex/hook.js +6 -15
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/flex/flex/index.js.map +1 -1
- package/build-module/flex/flex-block/component.js +9 -9
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-block/hook.js +0 -4
- package/build-module/flex/flex-block/hook.js.map +1 -1
- package/build-module/flex/flex-block/index.js.map +1 -1
- package/build-module/flex/flex-item/component.js +9 -9
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/flex/flex-item/hook.js +1 -5
- package/build-module/flex/flex-item/hook.js.map +1 -1
- package/build-module/flex/flex-item/index.js.map +1 -1
- package/build-module/flex/index.js.map +1 -1
- package/build-module/flex/styles.js +5 -5
- package/build-module/flex/styles.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +22 -22
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +5 -5
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/font-size-picker/index.js +14 -6
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/form-token-field/index.js +5 -2
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +19 -6
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/input-base.js +1 -2
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/reducer/actions.js +1 -0
- package/build-module/input-control/reducer/actions.js.map +1 -1
- package/build-module/input-control/reducer/reducer.js +28 -11
- package/build-module/input-control/reducer/reducer.js.map +1 -1
- package/build-module/input-control/reducer/state.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +27 -27
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +23 -4
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +25 -4
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/link-picker/link-picker-screen.native.js +11 -4
- package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
- package/build-module/mobile/picker/index.ios.js +14 -3
- package/build-module/mobile/picker/index.ios.js.map +1 -1
- package/build-module/placeholder/index.js +10 -15
- package/build-module/placeholder/index.js.map +1 -1
- package/build-module/placeholder/types.js +2 -0
- package/build-module/placeholder/types.js.map +1 -0
- package/build-module/popover/index.js +112 -62
- package/build-module/popover/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +40 -40
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
- package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +6 -6
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/style-provider/index.js +10 -5
- package/build-module/style-provider/index.js.map +1 -1
- package/build-module/style-provider/types.js +2 -0
- package/build-module/style-provider/types.js.map +1 -0
- package/build-module/swatch/index.js +2 -0
- package/build-module/swatch/index.js.map +1 -1
- package/build-module/swatch/types.js +2 -0
- package/build-module/swatch/types.js.map +1 -0
- package/build-module/text/hook.js +5 -7
- package/build-module/text/hook.js.map +1 -1
- package/build-module/tools-panel/styles.js +12 -11
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +1 -1
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/ui/tooltip/styles.js +4 -4
- package/build-module/ui/tooltip/styles.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +35 -9
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/utils/base-label.js +18 -0
- package/build-module/utils/base-label.js.map +1 -0
- package/build-module/utils/box-sizing.js +16 -0
- package/build-module/utils/box-sizing.js.map +1 -0
- package/build-module/utils/style-mixins.js +2 -0
- package/build-module/utils/style-mixins.js.map +1 -1
- package/build-style/style-rtl.css +50 -30
- package/build-style/style.css +52 -30
- package/build-types/base-control/index.d.ts +4 -3
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.d.ts +1 -1
- package/build-types/base-control/stories/index.d.ts.map +1 -1
- package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
- package/build-types/base-control/types.d.ts +0 -1
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/color-picker/color-display.d.ts +13 -0
- package/build-types/color-picker/color-display.d.ts.map +1 -0
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/time/styles.d.ts +0 -4
- package/build-types/date-time/time/styles.d.ts.map +1 -1
- package/build-types/external-link/index.d.ts.map +1 -1
- package/build-types/flex/flex/component.d.ts +5 -4
- package/build-types/flex/flex/component.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +5 -2
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/flex/flex/index.d.ts +2 -2
- package/build-types/flex/flex/index.d.ts.map +1 -1
- package/build-types/flex/flex-block/component.d.ts +5 -4
- package/build-types/flex/flex-block/component.d.ts.map +1 -1
- package/build-types/flex/flex-block/hook.d.ts +6 -3
- package/build-types/flex/flex-block/hook.d.ts.map +1 -1
- package/build-types/flex/flex-block/index.d.ts +2 -2
- package/build-types/flex/flex-block/index.d.ts.map +1 -1
- package/build-types/flex/flex-item/component.d.ts +5 -4
- package/build-types/flex/flex-item/component.d.ts.map +1 -1
- package/build-types/flex/flex-item/hook.d.ts +6 -3
- package/build-types/flex/flex-item/hook.d.ts.map +1 -1
- package/build-types/flex/flex-item/index.d.ts +2 -2
- package/build-types/flex/flex-item/index.d.ts.map +1 -1
- package/build-types/flex/index.d.ts +3 -3
- package/build-types/flex/index.d.ts.map +1 -1
- package/build-types/flex/stories/index.d.ts +13 -0
- package/build-types/flex/stories/index.d.ts.map +1 -0
- package/build-types/flex/styles.d.ts +5 -5
- package/build-types/flex/styles.d.ts.map +1 -1
- package/build-types/flex/test/index.d.ts +2 -0
- package/build-types/flex/test/index.d.ts.map +1 -0
- package/build-types/flex/types.d.ts +15 -11
- package/build-types/flex/types.d.ts.map +1 -1
- package/build-types/flyout/context.d.ts +6 -0
- package/build-types/flyout/context.d.ts.map +1 -0
- package/build-types/flyout/flyout/component.d.ts +21 -0
- package/build-types/flyout/flyout/component.d.ts.map +1 -0
- package/build-types/flyout/flyout/hook.d.ts +270 -0
- package/build-types/flyout/flyout/hook.d.ts.map +1 -0
- package/build-types/flyout/flyout/index.d.ts +3 -0
- package/build-types/flyout/flyout/index.d.ts.map +1 -0
- package/build-types/flyout/flyout-content/component.d.ts +3 -0
- package/build-types/flyout/flyout-content/component.d.ts.map +1 -0
- package/build-types/flyout/flyout-content/index.d.ts +2 -0
- package/build-types/flyout/flyout-content/index.d.ts.map +1 -0
- package/build-types/flyout/index.d.ts +2 -0
- package/build-types/flyout/index.d.ts.map +1 -0
- package/build-types/flyout/styles.d.ts +22 -0
- package/build-types/flyout/styles.d.ts.map +1 -0
- package/build-types/flyout/types.d.ts +80 -0
- package/build-types/flyout/types.d.ts.map +1 -0
- package/build-types/flyout/utils.d.ts +8 -0
- package/build-types/flyout/utils.d.ts.map +1 -0
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.d.ts +6 -0
- package/build-types/form-token-field/stories/index.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +15 -3
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/reducer/actions.d.ts +3 -1
- package/build-types/input-control/reducer/actions.d.ts.map +1 -1
- package/build-types/input-control/reducer/reducer.d.ts +2 -2
- package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
- package/build-types/input-control/reducer/state.d.ts +2 -2
- package/build-types/input-control/reducer/state.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/placeholder/index.d.ts +16 -0
- package/build-types/placeholder/index.d.ts.map +1 -0
- package/build-types/placeholder/stories/index.d.ts +12 -0
- package/build-types/placeholder/stories/index.d.ts.map +1 -0
- package/build-types/placeholder/types.d.ts +47 -0
- package/build-types/placeholder/types.d.ts.map +1 -0
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +70 -0
- package/build-types/popover/utils.d.ts.map +1 -0
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/style-provider/index.d.ts +7 -4
- package/build-types/style-provider/index.d.ts.map +1 -1
- package/build-types/style-provider/types.d.ts +15 -0
- package/build-types/style-provider/types.d.ts.map +1 -0
- package/build-types/swatch/index.d.ts +5 -0
- package/build-types/swatch/index.d.ts.map +1 -0
- package/build-types/swatch/types.d.ts +11 -0
- package/build-types/swatch/types.d.ts.map +1 -0
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/tools-panel/styles.d.ts +1 -1
- package/build-types/tools-panel/styles.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/ui/tooltip/styles.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/stories/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +1 -7
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/base-label.d.ts +2 -0
- package/build-types/utils/base-label.d.ts.map +1 -0
- package/build-types/utils/box-sizing.d.ts +2 -0
- package/build-types/utils/box-sizing.d.ts.map +1 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
- package/build-types/utils/style-mixins.d.ts +2 -0
- package/package.json +17 -17
- package/src/base-control/index.tsx +5 -3
- package/src/base-control/stories/index.tsx +1 -0
- package/src/base-control/styles/base-control-styles.ts +9 -5
- package/src/base-control/types.ts +0 -1
- package/src/border-control/styles.ts +2 -1
- package/src/box-control/all-input-control.js +3 -27
- package/src/box-control/index.js +5 -6
- package/src/box-control/styles/box-control-styles.js +1 -2
- package/src/box-control/utils.js +32 -0
- package/src/color-picker/styles.ts +3 -0
- package/src/combobox-control/README.md +7 -0
- package/src/combobox-control/index.js +14 -4
- package/src/combobox-control/stories/index.js +49 -5
- package/src/custom-gradient-picker/style.scss +0 -12
- package/src/custom-select-control/index.js +3 -2
- package/src/custom-select-control/style.scss +1 -5
- package/src/date-time/time/index.tsx +7 -5
- package/src/date-time/time/styles.ts +3 -6
- package/src/external-link/index.tsx +10 -0
- package/src/flex/flex/README.md +19 -13
- package/src/flex/flex/{component.js → component.tsx} +15 -10
- package/src/flex/flex/{hook.js → hook.ts} +14 -13
- package/src/flex/flex/{index.js → index.ts} +0 -0
- package/src/flex/flex-block/README.md +3 -3
- package/src/flex/flex-block/{component.js → component.tsx} +15 -10
- package/src/flex/flex-block/{hook.js → hook.ts} +5 -5
- package/src/flex/flex-block/{index.js → index.ts} +0 -0
- package/src/flex/flex-item/README.md +6 -5
- package/src/flex/flex-item/{component.js → component.tsx} +15 -10
- package/src/flex/flex-item/{hook.js → hook.ts} +10 -7
- package/src/flex/flex-item/{index.js → index.ts} +0 -0
- package/src/flex/{index.js → index.ts} +0 -0
- package/src/flex/stories/index.tsx +81 -0
- package/src/flex/{styles.js → styles.ts} +0 -0
- package/src/flex/test/__snapshots__/{index.js.snap → index.tsx.snap} +49 -9
- package/src/flex/test/index.tsx +84 -0
- package/src/flex/types.ts +15 -11
- package/src/focal-point-picker/styles/focal-point-picker-style.js +0 -5
- package/src/focal-point-picker/styles/focal-point-style.js +0 -1
- package/src/font-size-picker/index.js +18 -7
- package/src/font-size-picker/stories/index.js +6 -0
- package/src/form-token-field/README.md +2 -1
- package/src/form-token-field/index.tsx +5 -2
- package/src/form-token-field/stories/index.tsx +14 -0
- package/src/form-token-field/style.scss +0 -5
- package/src/form-token-field/suggestions-list.tsx +21 -12
- package/src/form-token-field/types.ts +16 -2
- package/src/index.js +4 -1
- package/src/input-control/input-base.tsx +0 -1
- package/src/input-control/reducer/actions.ts +3 -1
- package/src/input-control/reducer/reducer.ts +27 -10
- package/src/input-control/reducer/state.ts +7 -2
- package/src/input-control/styles/input-control-styles.tsx +3 -1
- package/src/input-control/test/index.js +20 -4
- package/src/mobile/global-styles-context/utils.native.js +21 -4
- package/src/mobile/image/index.native.js +27 -2
- package/src/mobile/link-picker/link-picker-screen.native.js +12 -4
- package/src/mobile/picker/index.ios.js +16 -0
- package/src/mobile/picker/styles.native.scss +8 -0
- package/src/panel/style.scss +4 -1
- package/src/placeholder/README.md +49 -9
- package/src/placeholder/{index.js → index.tsx} +27 -23
- package/src/placeholder/stories/index.tsx +64 -0
- package/src/placeholder/style.scss +0 -4
- package/src/placeholder/types.ts +48 -0
- package/src/popover/README.md +7 -0
- package/src/popover/index.js +144 -70
- package/src/popover/stories/index.js +199 -98
- package/src/popover/style.scss +60 -6
- package/src/popover/test/index.js +23 -1
- package/src/range-control/styles/range-control-styles.ts +0 -12
- package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +1 -1
- package/src/select-control/styles/select-control-styles.ts +0 -1
- package/src/style-provider/index.tsx +41 -0
- package/src/style-provider/types.ts +15 -0
- package/src/swatch/{index.js → index.tsx} +4 -1
- package/src/swatch/types.ts +11 -0
- package/src/text/hook.js +5 -3
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +24 -0
- package/src/tools-panel/styles.ts +7 -16
- package/src/tools-panel/test/__snapshots__/index.js.snap +2 -11
- package/src/tools-panel/tools-panel/hook.ts +6 -1
- package/src/ui/tooltip/styles.js +1 -0
- package/src/ui/tooltip/test/__snapshots__/index.js.snap +1 -0
- package/src/unit-control/stories/index.tsx +16 -23
- package/src/unit-control/styles/unit-control-styles.ts +93 -41
- package/src/unit-control/types.ts +1 -7
- package/src/utils/base-label.ts +13 -0
- package/src/utils/box-sizing.ts +14 -0
- package/src/utils/style-mixins.js +2 -0
- package/tsconfig.json +2 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/src/flex/stories/index.js +0 -29
- package/src/flex/test/index.js +0 -77
- package/src/placeholder/stories/index.js +0 -44
- package/src/popover/stories/_utils.js +0 -64
- package/src/style-provider/index.js +0 -31
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import UnitControl from './unit-control';
|
|
5
5
|
import {
|
|
6
|
-
ALL_SIDES,
|
|
7
6
|
LABELS,
|
|
7
|
+
applyValueToSides,
|
|
8
8
|
getAllValue,
|
|
9
9
|
isValuesMixed,
|
|
10
10
|
isValuesDefined,
|
|
@@ -32,34 +32,10 @@ export default function AllInputControl( {
|
|
|
32
32
|
onFocus( event, { side: 'all' } );
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
// Applies a value to an object representing top, right, bottom and left
|
|
36
|
-
// sides while taking into account any custom side configuration.
|
|
37
|
-
const applyValueToSides = ( currentValues, newValue ) => {
|
|
38
|
-
const newValues = { ...currentValues };
|
|
39
|
-
|
|
40
|
-
if ( sides?.length ) {
|
|
41
|
-
sides.forEach( ( side ) => {
|
|
42
|
-
if ( side === 'vertical' ) {
|
|
43
|
-
newValues.top = newValue;
|
|
44
|
-
newValues.bottom = newValue;
|
|
45
|
-
} else if ( side === 'horizontal' ) {
|
|
46
|
-
newValues.left = newValue;
|
|
47
|
-
newValues.right = newValue;
|
|
48
|
-
} else {
|
|
49
|
-
newValues[ side ] = newValue;
|
|
50
|
-
}
|
|
51
|
-
} );
|
|
52
|
-
} else {
|
|
53
|
-
ALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return newValues;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
35
|
const handleOnChange = ( next ) => {
|
|
60
36
|
const isNumeric = ! isNaN( parseFloat( next ) );
|
|
61
37
|
const nextValue = isNumeric ? next : undefined;
|
|
62
|
-
const nextValues = applyValueToSides( values, nextValue );
|
|
38
|
+
const nextValues = applyValueToSides( values, nextValue, sides );
|
|
63
39
|
|
|
64
40
|
onChange( nextValues );
|
|
65
41
|
};
|
|
@@ -67,7 +43,7 @@ export default function AllInputControl( {
|
|
|
67
43
|
// Set selected unit so it can be used as fallback by unlinked controls
|
|
68
44
|
// when individual sides do not have a value containing a unit.
|
|
69
45
|
const handleOnUnitChange = ( unit ) => {
|
|
70
|
-
const newUnits = applyValueToSides( selectedUnits, unit );
|
|
46
|
+
const newUnits = applyValueToSides( selectedUnits, unit, sides );
|
|
71
47
|
setSelectedUnits( newUnits );
|
|
72
48
|
};
|
|
73
49
|
|
package/src/box-control/index.js
CHANGED
|
@@ -8,13 +8,13 @@ import { __ } from '@wordpress/i18n';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
+
import { BaseControl } from '../base-control';
|
|
11
12
|
import Button from '../button';
|
|
12
13
|
import { FlexItem, FlexBlock } from '../flex';
|
|
13
14
|
import AllInputControl from './all-input-control';
|
|
14
15
|
import InputControls from './input-controls';
|
|
15
16
|
import AxialInputControls from './axial-input-controls';
|
|
16
17
|
import BoxControlIcon from './icon';
|
|
17
|
-
import { Text } from '../text';
|
|
18
18
|
import LinkedButton from './linked-button';
|
|
19
19
|
import {
|
|
20
20
|
Root,
|
|
@@ -120,12 +120,9 @@ export default function BoxControl( {
|
|
|
120
120
|
<Root id={ id } role="group" aria-labelledby={ headingId }>
|
|
121
121
|
<Header className="component-box-control__header">
|
|
122
122
|
<FlexItem>
|
|
123
|
-
<
|
|
124
|
-
id={ headingId }
|
|
125
|
-
className="component-box-control__label"
|
|
126
|
-
>
|
|
123
|
+
<BaseControl.VisualLabel id={ headingId }>
|
|
127
124
|
{ label }
|
|
128
|
-
</
|
|
125
|
+
</BaseControl.VisualLabel>
|
|
129
126
|
</FlexItem>
|
|
130
127
|
{ allowReset && (
|
|
131
128
|
<FlexItem>
|
|
@@ -173,3 +170,5 @@ export default function BoxControl( {
|
|
|
173
170
|
</Root>
|
|
174
171
|
);
|
|
175
172
|
}
|
|
173
|
+
|
|
174
|
+
export { applyValueToSides } from './utils';
|
|
@@ -8,7 +8,7 @@ import styled from '@emotion/styled';
|
|
|
8
8
|
*/
|
|
9
9
|
import { Flex } from '../../flex';
|
|
10
10
|
import BaseUnitControl from '../../unit-control';
|
|
11
|
-
import {
|
|
11
|
+
import { rtl } from '../../utils';
|
|
12
12
|
|
|
13
13
|
export const Root = styled.div`
|
|
14
14
|
box-sizing: border-box;
|
|
@@ -18,7 +18,6 @@ export const Root = styled.div`
|
|
|
18
18
|
`;
|
|
19
19
|
|
|
20
20
|
export const Header = styled( Flex )`
|
|
21
|
-
color: ${ COLORS.ui.label };
|
|
22
21
|
margin-bottom: 8px;
|
|
23
22
|
`;
|
|
24
23
|
|
package/src/box-control/utils.js
CHANGED
|
@@ -194,3 +194,35 @@ export function normalizeSides( sides ) {
|
|
|
194
194
|
|
|
195
195
|
return filteredSides;
|
|
196
196
|
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Applies a value to an object representing top, right, bottom and left sides
|
|
200
|
+
* while taking into account any custom side configuration.
|
|
201
|
+
*
|
|
202
|
+
* @param {Object} currentValues The current values for each side.
|
|
203
|
+
* @param {string|number} newValue The value to apply to the sides object.
|
|
204
|
+
* @param {string[]} sides Array defining valid sides.
|
|
205
|
+
*
|
|
206
|
+
* @return {Object} Object containing the updated values for each side.
|
|
207
|
+
*/
|
|
208
|
+
export function applyValueToSides( currentValues, newValue, sides ) {
|
|
209
|
+
const newValues = { ...currentValues };
|
|
210
|
+
|
|
211
|
+
if ( sides?.length ) {
|
|
212
|
+
sides.forEach( ( side ) => {
|
|
213
|
+
if ( side === 'vertical' ) {
|
|
214
|
+
newValues.top = newValue;
|
|
215
|
+
newValues.bottom = newValue;
|
|
216
|
+
} else if ( side === 'horizontal' ) {
|
|
217
|
+
newValues.left = newValue;
|
|
218
|
+
newValues.right = newValue;
|
|
219
|
+
} else {
|
|
220
|
+
newValues[ side ] = newValue;
|
|
221
|
+
}
|
|
222
|
+
} );
|
|
223
|
+
} else {
|
|
224
|
+
ALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return newValues;
|
|
228
|
+
}
|
|
@@ -11,6 +11,7 @@ import InnerSelectControl from '../select-control';
|
|
|
11
11
|
import InnerRangeControl from '../range-control';
|
|
12
12
|
import { StyledField } from '../base-control/styles/base-control-styles';
|
|
13
13
|
import { space } from '../ui/utils/space';
|
|
14
|
+
import { boxSizingReset } from '../utils';
|
|
14
15
|
import Button from '../button';
|
|
15
16
|
import { Flex } from '../flex';
|
|
16
17
|
import { HStack } from '../h-stack';
|
|
@@ -70,6 +71,8 @@ export const ColorInputWrapper = styled( Flex )`
|
|
|
70
71
|
`;
|
|
71
72
|
|
|
72
73
|
export const ColorfulWrapper = styled.div`
|
|
74
|
+
${ boxSizingReset };
|
|
75
|
+
|
|
73
76
|
width: 216px;
|
|
74
77
|
|
|
75
78
|
.react-colorful {
|
|
@@ -116,6 +116,13 @@ The current value of the input.
|
|
|
116
116
|
- Type: `mixed`
|
|
117
117
|
- Required: Yes
|
|
118
118
|
|
|
119
|
+
#### __experimentalRenderItem
|
|
120
|
+
|
|
121
|
+
Custom renderer invoked for each option in the suggestion list. The render prop receives as its argument an object containing, under the `item` key, the single option's data (directly from the array of data passed to the `options` prop).
|
|
122
|
+
|
|
123
|
+
- Type: `Function` - `( args: { item: object } ) => ReactNode`
|
|
124
|
+
- Required: No
|
|
125
|
+
|
|
119
126
|
## Related components
|
|
120
127
|
|
|
121
128
|
- Like this component, but without a search input, the `CustomSelectControl` component.
|
|
@@ -29,6 +29,7 @@ import BaseControl from '../base-control';
|
|
|
29
29
|
import Button from '../button';
|
|
30
30
|
import { FlexBlock, FlexItem } from '../flex';
|
|
31
31
|
import withFocusOutside from '../higher-order/with-focus-outside';
|
|
32
|
+
import { useControlledValue } from '../utils/hooks';
|
|
32
33
|
|
|
33
34
|
const noop = () => {};
|
|
34
35
|
|
|
@@ -46,10 +47,10 @@ const DetectOutside = withFocusOutside(
|
|
|
46
47
|
|
|
47
48
|
function ComboboxControl( {
|
|
48
49
|
__next36pxDefaultSize,
|
|
49
|
-
value,
|
|
50
|
+
value: valueProp,
|
|
50
51
|
label,
|
|
51
52
|
options,
|
|
52
|
-
onChange,
|
|
53
|
+
onChange: onChangeProp,
|
|
53
54
|
onFilterValueChange = noop,
|
|
54
55
|
hideLabelFromVision,
|
|
55
56
|
help,
|
|
@@ -58,7 +59,13 @@ function ComboboxControl( {
|
|
|
58
59
|
messages = {
|
|
59
60
|
selected: __( 'Item selected.' ),
|
|
60
61
|
},
|
|
62
|
+
__experimentalRenderItem,
|
|
61
63
|
} ) {
|
|
64
|
+
const [ value, setValue ] = useControlledValue( {
|
|
65
|
+
value: valueProp,
|
|
66
|
+
onChange: onChangeProp,
|
|
67
|
+
} );
|
|
68
|
+
|
|
62
69
|
const currentOption = options.find( ( option ) => option.value === value );
|
|
63
70
|
const currentLabel = currentOption?.label ?? '';
|
|
64
71
|
// Use a custom prefix when generating the `instanceId` to avoid having
|
|
@@ -92,7 +99,7 @@ function ComboboxControl( {
|
|
|
92
99
|
}, [ inputValue, options, value ] );
|
|
93
100
|
|
|
94
101
|
const onSuggestionSelected = ( newSelectedSuggestion ) => {
|
|
95
|
-
|
|
102
|
+
setValue( newSelectedSuggestion.value );
|
|
96
103
|
speak( messages.selected, 'assertive' );
|
|
97
104
|
setSelectedSuggestion( newSelectedSuggestion );
|
|
98
105
|
setInputValue( '' );
|
|
@@ -172,7 +179,7 @@ function ComboboxControl( {
|
|
|
172
179
|
};
|
|
173
180
|
|
|
174
181
|
const handleOnReset = () => {
|
|
175
|
-
|
|
182
|
+
setValue( null );
|
|
176
183
|
inputContainer.current.focus();
|
|
177
184
|
};
|
|
178
185
|
|
|
@@ -279,6 +286,9 @@ function ComboboxControl( {
|
|
|
279
286
|
onHover={ setSelectedSuggestion }
|
|
280
287
|
onSelect={ onSuggestionSelected }
|
|
281
288
|
scrollIntoView
|
|
289
|
+
__experimentalRenderItem={
|
|
290
|
+
__experimentalRenderItem
|
|
291
|
+
}
|
|
282
292
|
/>
|
|
283
293
|
) }
|
|
284
294
|
</div>
|
|
@@ -266,7 +266,7 @@ const mapCountryOption = ( country ) => ( {
|
|
|
266
266
|
|
|
267
267
|
const countryOptions = countries.map( mapCountryOption );
|
|
268
268
|
|
|
269
|
-
function
|
|
269
|
+
function Template( args ) {
|
|
270
270
|
const [ value, setValue ] = useState( null );
|
|
271
271
|
|
|
272
272
|
return (
|
|
@@ -275,15 +275,59 @@ function CountryCodeComboboxControl( args ) {
|
|
|
275
275
|
{ ...args }
|
|
276
276
|
value={ value }
|
|
277
277
|
onChange={ setValue }
|
|
278
|
-
label="Select a country"
|
|
279
|
-
options={ countryOptions }
|
|
280
278
|
/>
|
|
281
279
|
<p>Value: { value }</p>
|
|
282
280
|
</>
|
|
283
281
|
);
|
|
284
282
|
}
|
|
285
|
-
export const
|
|
286
|
-
|
|
283
|
+
export const Default = Template.bind( {} );
|
|
284
|
+
Default.args = {
|
|
287
285
|
__next36pxDefaultSize: false,
|
|
288
286
|
allowReset: false,
|
|
287
|
+
label: 'Select a country',
|
|
288
|
+
options: countryOptions,
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
const authorOptions = [
|
|
292
|
+
{
|
|
293
|
+
value: 'parsley',
|
|
294
|
+
label: 'Parsley Montana',
|
|
295
|
+
age: 48,
|
|
296
|
+
country: 'Germany',
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
value: 'cabbage',
|
|
300
|
+
label: 'Cabbage New York',
|
|
301
|
+
age: 44,
|
|
302
|
+
country: 'France',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
value: 'jake',
|
|
306
|
+
label: 'Jake Weary',
|
|
307
|
+
age: 41,
|
|
308
|
+
country: 'United Kingdom',
|
|
309
|
+
},
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* The rendered output of each suggestion can be customized by passing a
|
|
314
|
+
* render function to the `__experimentalRenderItem` prop. (This is still an experimental feature
|
|
315
|
+
* and is subject to change.)
|
|
316
|
+
*/
|
|
317
|
+
export const WithCustomRenderItem = Template.bind( {} );
|
|
318
|
+
WithCustomRenderItem.args = {
|
|
319
|
+
...Default.args,
|
|
320
|
+
label: 'Select an author',
|
|
321
|
+
options: authorOptions,
|
|
322
|
+
__experimentalRenderItem: ( { item } ) => {
|
|
323
|
+
const { label, age, country } = item;
|
|
324
|
+
return (
|
|
325
|
+
<div>
|
|
326
|
+
<div style={ { marginBottom: '0.2rem' } }>{ label }</div>
|
|
327
|
+
<small>
|
|
328
|
+
Age: { age }, Country: { country }
|
|
329
|
+
</small>
|
|
330
|
+
</div>
|
|
331
|
+
);
|
|
332
|
+
},
|
|
289
333
|
};
|
|
@@ -106,15 +106,3 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
|
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
// All these styles should be made generic and changed on the inputs for all components.
|
|
111
|
-
.components-custom-gradient-picker {
|
|
112
|
-
.components-input-control__label {
|
|
113
|
-
line-height: 1;
|
|
114
|
-
}
|
|
115
|
-
label {
|
|
116
|
-
text-transform: uppercase;
|
|
117
|
-
font-size: 11px;
|
|
118
|
-
font-weight: 500;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -17,6 +17,7 @@ import { useCallback, useState } from '@wordpress/element';
|
|
|
17
17
|
import { VisuallyHidden } from '../';
|
|
18
18
|
import { Select as SelectControlSelect } from '../select-control/styles/select-control-styles';
|
|
19
19
|
import InputBase from '../input-control/input-base';
|
|
20
|
+
import { StyledLabel } from '../base-control/styles/base-control-styles';
|
|
20
21
|
|
|
21
22
|
const itemToString = ( item ) => item?.name;
|
|
22
23
|
// This is needed so that in Windows, where
|
|
@@ -138,13 +139,13 @@ export default function CustomSelectControl( {
|
|
|
138
139
|
</VisuallyHidden>
|
|
139
140
|
) : (
|
|
140
141
|
/* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
|
|
141
|
-
<
|
|
142
|
+
<StyledLabel
|
|
142
143
|
{ ...getLabelProps( {
|
|
143
144
|
className: 'components-custom-select-control__label',
|
|
144
145
|
} ) }
|
|
145
146
|
>
|
|
146
147
|
{ label }
|
|
147
|
-
</
|
|
148
|
+
</StyledLabel>
|
|
148
149
|
) }
|
|
149
150
|
<InputBase
|
|
150
151
|
isFocused={ isOpen || isFocused }
|
|
@@ -12,6 +12,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
+
import BaseControl from '../../base-control';
|
|
15
16
|
import Button from '../../button';
|
|
16
17
|
import ButtonGroup from '../../button-group';
|
|
17
18
|
import TimeZone from './timezone';
|
|
@@ -19,7 +20,6 @@ import type { TimePickerProps } from '../types';
|
|
|
19
20
|
import {
|
|
20
21
|
Wrapper,
|
|
21
22
|
Fieldset,
|
|
22
|
-
Legend,
|
|
23
23
|
HoursInput,
|
|
24
24
|
TimeSeparator,
|
|
25
25
|
MinutesInput,
|
|
@@ -220,11 +220,12 @@ export function TimePicker( {
|
|
|
220
220
|
className="components-datetime__time" // Unused, for backwards compatibility.
|
|
221
221
|
>
|
|
222
222
|
<Fieldset>
|
|
223
|
-
<
|
|
223
|
+
<BaseControl.VisualLabel
|
|
224
|
+
as="legend"
|
|
224
225
|
className="components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
225
226
|
>
|
|
226
227
|
{ __( 'Time' ) }
|
|
227
|
-
</
|
|
228
|
+
</BaseControl.VisualLabel>
|
|
228
229
|
<HStack
|
|
229
230
|
className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
230
231
|
>
|
|
@@ -309,11 +310,12 @@ export function TimePicker( {
|
|
|
309
310
|
</HStack>
|
|
310
311
|
</Fieldset>
|
|
311
312
|
<Fieldset>
|
|
312
|
-
<
|
|
313
|
+
<BaseControl.VisualLabel
|
|
314
|
+
as="legend"
|
|
313
315
|
className="components-datetime__time-legend" // Unused, for backwards compatibility.
|
|
314
316
|
>
|
|
315
317
|
{ __( 'Date' ) }
|
|
316
|
-
</
|
|
318
|
+
</BaseControl.VisualLabel>
|
|
317
319
|
<HStack
|
|
318
320
|
className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
|
|
319
321
|
>
|
|
@@ -17,7 +17,9 @@ import NumberControl from '../../number-control';
|
|
|
17
17
|
import SelectControl from '../../select-control';
|
|
18
18
|
import { Select } from '../../select-control/styles/select-control-styles';
|
|
19
19
|
|
|
20
|
-
export const Wrapper = styled.div
|
|
20
|
+
export const Wrapper = styled.div`
|
|
21
|
+
font-size: ${ CONFIG.fontSize };
|
|
22
|
+
`;
|
|
21
23
|
|
|
22
24
|
export const Fieldset = styled.fieldset`
|
|
23
25
|
border: 0;
|
|
@@ -29,11 +31,6 @@ export const Fieldset = styled.fieldset`
|
|
|
29
31
|
}
|
|
30
32
|
`;
|
|
31
33
|
|
|
32
|
-
export const Legend = styled.legend`
|
|
33
|
-
margin-bottom: ${ space( 2 ) };
|
|
34
|
-
padding: 0;
|
|
35
|
-
`;
|
|
36
|
-
|
|
37
34
|
export const TimeWrapper = styled.div`
|
|
38
35
|
direction: ltr;
|
|
39
36
|
display: flex;
|
|
@@ -38,12 +38,22 @@ function UnforwardedExternalLink(
|
|
|
38
38
|
),
|
|
39
39
|
].join( ' ' );
|
|
40
40
|
const classes = classnames( 'components-external-link', className );
|
|
41
|
+
/* Anchor links are percieved as external links.
|
|
42
|
+
This constant helps check for on page anchor links,
|
|
43
|
+
to prevent them from being opened in the editor. */
|
|
44
|
+
const isInternalAnchor = !! href?.startsWith( '#' );
|
|
45
|
+
|
|
41
46
|
return (
|
|
42
47
|
/* eslint-disable react/jsx-no-target-blank */
|
|
43
48
|
<a
|
|
44
49
|
{ ...additionalProps }
|
|
45
50
|
className={ classes }
|
|
46
51
|
href={ href }
|
|
52
|
+
onClick={
|
|
53
|
+
isInternalAnchor
|
|
54
|
+
? ( event ) => event.preventDefault()
|
|
55
|
+
: undefined
|
|
56
|
+
}
|
|
47
57
|
target="_blank"
|
|
48
58
|
rel={ optimizedRel }
|
|
49
59
|
ref={ ref }
|
package/src/flex/flex/README.md
CHANGED
|
@@ -25,38 +25,44 @@ function Example() {
|
|
|
25
25
|
|
|
26
26
|
## Props
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**Type**: `CSSProperties['alignItems']`
|
|
28
|
+
### `align`: `CSSProperties['alignItems']`
|
|
31
29
|
|
|
32
30
|
Aligns children using CSS Flexbox `align-items`. Vertically aligns content if the `direction` is `row`, or horizontally aligns content if the `direction` is `column`.
|
|
33
31
|
|
|
34
|
-
|
|
32
|
+
- Required: No
|
|
33
|
+
- Default: `center`
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
### `direction`: `ResponsiveCSSValue<CSSProperties['flexDirection']>`
|
|
37
36
|
|
|
38
37
|
The direction flow of the children content can be adjusted with `direction`. `column` will align children vertically and `row` will align children horizontally.
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
- Required: No
|
|
40
|
+
- Default: `row`
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### `expanded`: `boolean`
|
|
43
43
|
|
|
44
44
|
Expands to the maximum available width (if horizontal) or height (if vertical).
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
- Required: No
|
|
47
|
+
- Default: `true`
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
### `gap`: `number`
|
|
49
50
|
|
|
50
51
|
Spacing in between each child can be adjusted by using `gap`. The value of `gap` works as a multiplier to the library's grid system (base of `4px`).
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
- Required: No
|
|
54
|
+
- Default: `2`
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
##### `justify`: `CSSProperties['justifyContent']`
|
|
55
57
|
|
|
56
58
|
Horizontally aligns content if the `direction` is `row`, or vertically aligns content if the `direction` is `column`.
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
- Required: No
|
|
61
|
+
- Default: `space-between`
|
|
59
62
|
|
|
60
|
-
|
|
63
|
+
##### `wrap`: `boolean`
|
|
61
64
|
|
|
62
65
|
Determines if children should wrap.
|
|
66
|
+
|
|
67
|
+
- Required: No
|
|
68
|
+
- Default: `false`
|
|
@@ -1,16 +1,21 @@
|
|
|
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 { useFlex } from './hook';
|
|
6
11
|
import { FlexContext } from './../context';
|
|
7
12
|
import { View } from '../../view';
|
|
13
|
+
import type { FlexProps } from '../types';
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function Flex( props, forwardedRef ) {
|
|
15
|
+
function UnconnectedFlex(
|
|
16
|
+
props: WordPressComponentProps< FlexProps, 'div' >,
|
|
17
|
+
forwardedRef: ForwardedRef< any >
|
|
18
|
+
) {
|
|
14
19
|
const { children, isColumn, ...otherProps } = useFlex( props );
|
|
15
20
|
|
|
16
21
|
return (
|
|
@@ -29,9 +34,9 @@ function Flex( props, forwardedRef ) {
|
|
|
29
34
|
* horizontally or vertically. `Flex` powers components like `HStack` and
|
|
30
35
|
* `VStack`.
|
|
31
36
|
*
|
|
32
|
-
* `Flex` is used with any of
|
|
37
|
+
* `Flex` is used with any of its two sub-components, `FlexItem` and
|
|
38
|
+
* `FlexBlock`.
|
|
33
39
|
*
|
|
34
|
-
* @example
|
|
35
40
|
* ```jsx
|
|
36
41
|
* import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
|
|
37
42
|
*
|
|
@@ -49,6 +54,6 @@ function Flex( props, forwardedRef ) {
|
|
|
49
54
|
* }
|
|
50
55
|
* ```
|
|
51
56
|
*/
|
|
52
|
-
const
|
|
57
|
+
export const Flex = contextConnect( UnconnectedFlex, 'Flex' );
|
|
53
58
|
|
|
54
|
-
export default
|
|
59
|
+
export default Flex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { css } from '@emotion/react';
|
|
4
|
+
import { css, SerializedStyles } from '@emotion/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -12,18 +12,18 @@ import deprecated from '@wordpress/deprecated';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import { useContextSystem } from '../../ui/context';
|
|
15
|
+
import { useContextSystem, WordPressComponentProps } from '../../ui/context';
|
|
16
16
|
import { useResponsiveValue } from '../../ui/utils/use-responsive-value';
|
|
17
17
|
import { space } from '../../ui/utils/space';
|
|
18
18
|
import * as styles from '../styles';
|
|
19
19
|
import { useCx, rtl } from '../../utils';
|
|
20
|
+
import type { FlexProps } from '../types';
|
|
21
|
+
|
|
22
|
+
function useDeprecatedProps(
|
|
23
|
+
props: WordPressComponentProps< FlexProps, 'div' >
|
|
24
|
+
): WordPressComponentProps< FlexProps, 'div' > {
|
|
25
|
+
const { isReversed, ...otherProps } = props;
|
|
20
26
|
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
|
|
24
|
-
* @return {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} Props with the deprecated props removed.
|
|
25
|
-
*/
|
|
26
|
-
function useDeprecatedProps( { isReversed, ...otherProps } ) {
|
|
27
27
|
if ( typeof isReversed !== 'undefined' ) {
|
|
28
28
|
deprecated( 'Flex isReversed', {
|
|
29
29
|
alternative: 'Flex direction="row-reverse" or "column-reverse"',
|
|
@@ -38,10 +38,7 @@ function useDeprecatedProps( { isReversed, ...otherProps } ) {
|
|
|
38
38
|
return otherProps;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
* @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
|
|
43
|
-
*/
|
|
44
|
-
export function useFlex( props ) {
|
|
41
|
+
export function useFlex( props: WordPressComponentProps< FlexProps, 'div' > ) {
|
|
45
42
|
const {
|
|
46
43
|
align = 'center',
|
|
47
44
|
className,
|
|
@@ -67,7 +64,11 @@ export function useFlex( props ) {
|
|
|
67
64
|
const rtlWatchResult = rtl.watch();
|
|
68
65
|
|
|
69
66
|
const classes = useMemo( () => {
|
|
70
|
-
const sx
|
|
67
|
+
const sx: {
|
|
68
|
+
Base?: SerializedStyles;
|
|
69
|
+
Items?: SerializedStyles;
|
|
70
|
+
WrapItems?: SerializedStyles;
|
|
71
|
+
} = {};
|
|
71
72
|
|
|
72
73
|
sx.Base = css( {
|
|
73
74
|
alignItems: isColumn ? 'normal' : align,
|
|
File without changes
|
|
@@ -8,8 +8,8 @@ See [`flex/README.md#usage`](/packages/components/src/flex/README.md#usage) for
|
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
|
|
11
|
-
### display
|
|
12
|
-
|
|
13
|
-
**Type**: `[CSSProperties['display']]`
|
|
11
|
+
### `display`: `CSSProperties['display']`
|
|
14
12
|
|
|
15
13
|
The CSS display property of `FlexBlock`.
|
|
14
|
+
|
|
15
|
+
- Required: No
|