@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
|
@@ -1,24 +1,29 @@
|
|
|
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';
|
|
11
|
+
import type { FlexBlockProps } from '../types';
|
|
6
12
|
import { useFlexBlock } from './hook';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function FlexBlock( props, forwardedRef ) {
|
|
14
|
+
function UnconnectedFlexBlock(
|
|
15
|
+
props: WordPressComponentProps< FlexBlockProps, 'div' >,
|
|
16
|
+
forwardedRef: ForwardedRef< any >
|
|
17
|
+
) {
|
|
13
18
|
const flexBlockProps = useFlexBlock( props );
|
|
14
19
|
|
|
15
20
|
return <View { ...flexBlockProps } ref={ forwardedRef } />;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
|
-
* `FlexBlock` is a primitive layout component that adaptively resizes content
|
|
24
|
+
* `FlexBlock` is a primitive layout component that adaptively resizes content
|
|
25
|
+
* within layout containers like `Flex`.
|
|
20
26
|
*
|
|
21
|
-
* @example
|
|
22
27
|
* ```jsx
|
|
23
28
|
* import { Flex, FlexBlock } from '@wordpress/components';
|
|
24
29
|
*
|
|
@@ -31,6 +36,6 @@ function FlexBlock( props, forwardedRef ) {
|
|
|
31
36
|
* }
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
const
|
|
39
|
+
export const FlexBlock = contextConnect( UnconnectedFlexBlock, 'FlexBlock' );
|
|
35
40
|
|
|
36
|
-
export default
|
|
41
|
+
export default FlexBlock;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useContextSystem } from '../../ui/context';
|
|
4
|
+
import { useContextSystem, WordPressComponentProps } from '../../ui/context';
|
|
5
5
|
import { useFlexItem } from '../flex-item';
|
|
6
|
+
import type { FlexBlockProps } from '../types';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export function useFlexBlock( props ) {
|
|
8
|
+
export function useFlexBlock(
|
|
9
|
+
props: WordPressComponentProps< FlexBlockProps, 'div' >
|
|
10
|
+
) {
|
|
11
11
|
const otherProps = useContextSystem( props, 'FlexBlock' );
|
|
12
12
|
const flexItemProps = useFlexItem( { isBlock: true, ...otherProps } );
|
|
13
13
|
|
|
File without changes
|
|
@@ -8,14 +8,15 @@ See [`flex/README.md#usage`](/packages/components/src/flex/flex/README.md#usage)
|
|
|
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 `FlexItem`.
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
- Required: No
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
### `isBlock`: `boolean`
|
|
20
18
|
|
|
21
19
|
Determins if `FlexItem` should render as an adaptive full-width block.
|
|
20
|
+
|
|
21
|
+
- Required: No
|
|
22
|
+
- Default: `false`
|
|
@@ -1,24 +1,29 @@
|
|
|
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 { useFlexItem } from './hook';
|
|
12
|
+
import type { FlexItemProps } from '../types';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function FlexItem( props, forwardedRef ) {
|
|
14
|
+
function UnconnectedFlexItem(
|
|
15
|
+
props: WordPressComponentProps< FlexItemProps, 'div' >,
|
|
16
|
+
forwardedRef: ForwardedRef< any >
|
|
17
|
+
) {
|
|
13
18
|
const flexItemProps = useFlexItem( props );
|
|
14
19
|
|
|
15
20
|
return <View { ...flexItemProps } ref={ forwardedRef } />;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
/**
|
|
19
|
-
* `FlexItem` is a primitive layout component that aligns content within layout
|
|
24
|
+
* `FlexItem` is a primitive layout component that aligns content within layout
|
|
25
|
+
* containers like `Flex`.
|
|
20
26
|
*
|
|
21
|
-
* @example
|
|
22
27
|
* ```jsx
|
|
23
28
|
* import { Flex, FlexItem } from '@wordpress/components';
|
|
24
29
|
*
|
|
@@ -31,6 +36,6 @@ function FlexItem( props, forwardedRef ) {
|
|
|
31
36
|
* }
|
|
32
37
|
* ```
|
|
33
38
|
*/
|
|
34
|
-
const
|
|
39
|
+
export const FlexItem = contextConnect( UnconnectedFlexItem, 'FlexItem' );
|
|
35
40
|
|
|
36
|
-
export default
|
|
41
|
+
export default FlexItem;
|
|
@@ -1,27 +1,30 @@
|
|
|
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
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useContextSystem } from '../../ui/context';
|
|
9
|
+
import { useContextSystem, WordPressComponentProps } from '../../ui/context';
|
|
10
10
|
import { useFlexContext } from '../context';
|
|
11
11
|
import * as styles from '../styles';
|
|
12
12
|
import { useCx } from '../../utils/hooks/use-cx';
|
|
13
|
+
import type { FlexItemProps } from '../types';
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
export function useFlexItem( props ) {
|
|
15
|
+
export function useFlexItem(
|
|
16
|
+
props: WordPressComponentProps< FlexItemProps, 'div' >
|
|
17
|
+
) {
|
|
18
18
|
const {
|
|
19
19
|
className,
|
|
20
20
|
display: displayProp,
|
|
21
21
|
isBlock = false,
|
|
22
22
|
...otherProps
|
|
23
23
|
} = useContextSystem( props, 'FlexItem' );
|
|
24
|
-
|
|
24
|
+
|
|
25
|
+
const sx: {
|
|
26
|
+
Base?: SerializedStyles;
|
|
27
|
+
} = {};
|
|
25
28
|
|
|
26
29
|
const contextDisplay = useFlexContext().flexItemDisplay;
|
|
27
30
|
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Flex, FlexItem, FlexBlock } from '../';
|
|
10
|
+
import { View } from '../../view';
|
|
11
|
+
|
|
12
|
+
const meta: ComponentMeta< typeof Flex > = {
|
|
13
|
+
component: Flex,
|
|
14
|
+
title: 'Components/Flex',
|
|
15
|
+
subcomponents: { FlexBlock, FlexItem },
|
|
16
|
+
argTypes: {
|
|
17
|
+
align: { control: { type: 'text' } },
|
|
18
|
+
as: { control: { type: 'text' } },
|
|
19
|
+
children: { control: { type: null } },
|
|
20
|
+
gap: { control: { type: 'text' } },
|
|
21
|
+
justify: { control: { type: 'text' } },
|
|
22
|
+
// Disabled isReversed because it's deprecated.
|
|
23
|
+
isReversed: {
|
|
24
|
+
table: {
|
|
25
|
+
disable: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
parameters: {
|
|
30
|
+
controls: {
|
|
31
|
+
expanded: true,
|
|
32
|
+
},
|
|
33
|
+
docs: { source: { state: 'open' } },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
const GrayBox = ( { children }: { children: string } ) => (
|
|
39
|
+
<View style={ { backgroundColor: '#eee', padding: 10 } }>{ children }</View>
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const Default: ComponentStory< typeof Flex > = ( { ...args } ) => {
|
|
43
|
+
return (
|
|
44
|
+
<Flex { ...args }>
|
|
45
|
+
<FlexItem>
|
|
46
|
+
<GrayBox>Item 1</GrayBox>
|
|
47
|
+
</FlexItem>
|
|
48
|
+
<FlexItem>
|
|
49
|
+
<GrayBox>Item 2</GrayBox>
|
|
50
|
+
</FlexItem>
|
|
51
|
+
<FlexItem>
|
|
52
|
+
<GrayBox>Item 3</GrayBox>
|
|
53
|
+
</FlexItem>
|
|
54
|
+
</Flex>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
Default.args = {};
|
|
58
|
+
|
|
59
|
+
export const ResponsiveDirection: ComponentStory< typeof Flex > = ( {
|
|
60
|
+
...args
|
|
61
|
+
} ) => {
|
|
62
|
+
return (
|
|
63
|
+
<Flex { ...args }>
|
|
64
|
+
<FlexItem>
|
|
65
|
+
<GrayBox>Item 1</GrayBox>
|
|
66
|
+
</FlexItem>
|
|
67
|
+
<FlexBlock>
|
|
68
|
+
<GrayBox>Item 2</GrayBox>
|
|
69
|
+
</FlexBlock>
|
|
70
|
+
<FlexItem>
|
|
71
|
+
<GrayBox>Item 3</GrayBox>
|
|
72
|
+
</FlexItem>
|
|
73
|
+
<FlexItem>
|
|
74
|
+
<GrayBox>Item 4</GrayBox>
|
|
75
|
+
</FlexItem>
|
|
76
|
+
</Flex>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
ResponsiveDirection.args = {
|
|
80
|
+
direction: [ 'column', 'row' ],
|
|
81
|
+
};
|
|
File without changes
|
|
@@ -5,21 +5,30 @@ Snapshot Diff:
|
|
|
5
5
|
- First value
|
|
6
6
|
+ Second value
|
|
7
7
|
|
|
8
|
-
@@ -
|
|
8
|
+
@@ -1,22 +1,18 @@
|
|
9
|
+
<div
|
|
10
|
+
class="components-flex css-1giw1wa-View-Flex-sx-Base-sx-Items-ItemsRow em57xhy0"
|
|
11
|
+
- data-testid="flex"
|
|
12
|
+
+ data-testid="base-flex"
|
|
13
|
+
data-wp-c16t="true"
|
|
14
|
+
data-wp-component="Flex"
|
|
15
|
+
>
|
|
16
|
+
<div
|
|
9
17
|
class="components-flex-item css-mw3lhz-View-Item-sx-Base em57xhy0"
|
|
10
18
|
data-wp-c16t="true"
|
|
11
19
|
data-wp-component="FlexItem"
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
>
|
|
21
|
+
Item
|
|
22
|
+
</div>
|
|
23
|
+
- <div
|
|
14
24
|
- class="css-1mm2cvy-View em57xhy0"
|
|
15
25
|
- />
|
|
16
26
|
- <div />
|
|
17
|
-
|
|
27
|
+
<div
|
|
18
28
|
class="components-flex-item components-flex-block css-14wzr73-View-Item-sx-Base-block em57xhy0"
|
|
19
29
|
data-wp-c16t="true"
|
|
20
30
|
data-wp-component="FlexBlock"
|
|
21
|
-
|
|
22
|
-
</div>
|
|
31
|
+
>
|
|
23
32
|
`;
|
|
24
33
|
|
|
25
34
|
exports[`props should render align 1`] = `
|
|
@@ -97,6 +106,7 @@ exports[`props should render correctly 1`] = `
|
|
|
97
106
|
|
|
98
107
|
<div
|
|
99
108
|
class="components-flex emotion-0 emotion-1"
|
|
109
|
+
data-testid="base-flex"
|
|
100
110
|
data-wp-c16t="true"
|
|
101
111
|
data-wp-component="Flex"
|
|
102
112
|
>
|
|
@@ -104,12 +114,16 @@ exports[`props should render correctly 1`] = `
|
|
|
104
114
|
class="components-flex-item emotion-2 emotion-1"
|
|
105
115
|
data-wp-c16t="true"
|
|
106
116
|
data-wp-component="FlexItem"
|
|
107
|
-
|
|
117
|
+
>
|
|
118
|
+
Item
|
|
119
|
+
</div>
|
|
108
120
|
<div
|
|
109
121
|
class="components-flex-item components-flex-block emotion-4 emotion-1"
|
|
110
122
|
data-wp-c16t="true"
|
|
111
123
|
data-wp-component="FlexBlock"
|
|
112
|
-
|
|
124
|
+
>
|
|
125
|
+
Item
|
|
126
|
+
</div>
|
|
113
127
|
</div>
|
|
114
128
|
`;
|
|
115
129
|
|
|
@@ -142,5 +156,31 @@ Snapshot Diff:
|
|
|
142
156
|
|
|
143
157
|
exports[`props should render spacing 1`] = `
|
|
144
158
|
Snapshot Diff:
|
|
145
|
-
|
|
159
|
+
- Received styles
|
|
160
|
+
+ Base styles
|
|
161
|
+
|
|
162
|
+
Array [
|
|
163
|
+
Object {
|
|
164
|
+
- "margin-left": "calc(4px * 2)",
|
|
165
|
+
- },
|
|
166
|
+
- Object {
|
|
167
|
+
- "min-width": "0",
|
|
168
|
+
- },
|
|
169
|
+
- Object {
|
|
170
|
+
"-ms-flex": "1",
|
|
171
|
+
"-webkit-flex": "1",
|
|
172
|
+
"display": "block",
|
|
173
|
+
"flex": "1",
|
|
174
|
+
"max-height": "100%",
|
|
175
|
+
"max-width": "100%",
|
|
176
|
+
"min-height": "0",
|
|
177
|
+
+ "min-width": "0",
|
|
178
|
+
+ },
|
|
179
|
+
+ Object {
|
|
180
|
+
+ "margin-left": "calc(4px * 5)",
|
|
181
|
+
+ },
|
|
182
|
+
+ Object {
|
|
183
|
+
"min-width": "0",
|
|
184
|
+
},
|
|
185
|
+
]
|
|
146
186
|
`;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { View } from '../../view';
|
|
10
|
+
import { Flex, FlexBlock, FlexItem } from '../';
|
|
11
|
+
|
|
12
|
+
describe( 'props', () => {
|
|
13
|
+
beforeEach( () => {
|
|
14
|
+
render(
|
|
15
|
+
<Flex data-testid="base-flex">
|
|
16
|
+
<FlexItem>Item</FlexItem>
|
|
17
|
+
<FlexBlock>Item</FlexBlock>
|
|
18
|
+
</Flex>
|
|
19
|
+
);
|
|
20
|
+
} );
|
|
21
|
+
|
|
22
|
+
test( 'should render correctly', () => {
|
|
23
|
+
expect( screen.getByTestId( 'base-flex' ) ).toMatchSnapshot();
|
|
24
|
+
} );
|
|
25
|
+
|
|
26
|
+
test( 'should render + wrap non Flex children', () => {
|
|
27
|
+
render(
|
|
28
|
+
<Flex data-testid="flex">
|
|
29
|
+
<FlexItem>Item</FlexItem>
|
|
30
|
+
<View />
|
|
31
|
+
<div />
|
|
32
|
+
<FlexBlock>Item</FlexBlock>
|
|
33
|
+
</Flex>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
expect( screen.getByTestId( 'flex' ) ).toMatchDiffSnapshot(
|
|
37
|
+
screen.getByTestId( 'base-flex' )
|
|
38
|
+
);
|
|
39
|
+
} );
|
|
40
|
+
|
|
41
|
+
test( 'should render align', () => {
|
|
42
|
+
render(
|
|
43
|
+
<Flex align="flex-start" data-testid="flex">
|
|
44
|
+
<FlexItem>Item</FlexItem>
|
|
45
|
+
<FlexBlock>Item</FlexBlock>
|
|
46
|
+
</Flex>
|
|
47
|
+
);
|
|
48
|
+
expect( screen.getByTestId( 'flex' ) ).toMatchStyleDiffSnapshot(
|
|
49
|
+
screen.getByTestId( 'base-flex' )
|
|
50
|
+
);
|
|
51
|
+
} );
|
|
52
|
+
|
|
53
|
+
test( 'should render justify', () => {
|
|
54
|
+
render(
|
|
55
|
+
<Flex justify="flex-start" data-testid="flex">
|
|
56
|
+
<FlexItem>Item</FlexItem>
|
|
57
|
+
<FlexBlock>Item</FlexBlock>
|
|
58
|
+
</Flex>
|
|
59
|
+
);
|
|
60
|
+
expect( screen.getByTestId( 'flex' ) ).toMatchStyleDiffSnapshot(
|
|
61
|
+
screen.getByTestId( 'base-flex' )
|
|
62
|
+
);
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
test( 'should render spacing', () => {
|
|
66
|
+
render(
|
|
67
|
+
<>
|
|
68
|
+
<Flex>
|
|
69
|
+
<FlexItem>Item</FlexItem>
|
|
70
|
+
<FlexBlock data-testid="flex-block">Item</FlexBlock>
|
|
71
|
+
</Flex>
|
|
72
|
+
<Flex gap={ 5 }>
|
|
73
|
+
<FlexItem>Item</FlexItem>
|
|
74
|
+
<FlexBlock data-testid="flex-block-with-gap">
|
|
75
|
+
Item
|
|
76
|
+
</FlexBlock>
|
|
77
|
+
</Flex>
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
expect( screen.getByTestId( 'flex-block' ) ).toMatchStyleDiffSnapshot(
|
|
81
|
+
screen.getByTestId( 'flex-block-with-gap' )
|
|
82
|
+
);
|
|
83
|
+
} );
|
|
84
|
+
} );
|
package/src/flex/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { CSSProperties } from 'react';
|
|
4
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -15,21 +15,24 @@ export type FlexDirection = ResponsiveCSSValue<
|
|
|
15
15
|
|
|
16
16
|
export type FlexProps = {
|
|
17
17
|
/**
|
|
18
|
-
* Aligns children using CSS Flexbox `align-items`. Vertically aligns
|
|
19
|
-
*
|
|
20
|
-
*
|
|
18
|
+
* Aligns children using CSS Flexbox `align-items`. Vertically aligns
|
|
19
|
+
* content if the `direction` is `row`, or horizontally aligns content if
|
|
20
|
+
* the `direction` is `column`.
|
|
21
21
|
*
|
|
22
22
|
* @default 'center'
|
|
23
23
|
*/
|
|
24
24
|
align?: CSSProperties[ 'alignItems' ];
|
|
25
25
|
/**
|
|
26
|
-
* The direction flow of the children content can be adjusted with
|
|
26
|
+
* The direction flow of the children content can be adjusted with
|
|
27
|
+
* `direction`. `column` will align children vertically and `row` will align
|
|
28
|
+
* children horizontally.
|
|
27
29
|
*
|
|
28
30
|
* @default 'row'
|
|
29
31
|
*/
|
|
30
32
|
direction?: FlexDirection;
|
|
31
33
|
/**
|
|
32
|
-
* Expands to the maximum available width (if horizontal) or height (if
|
|
34
|
+
* Expands to the maximum available width (if horizontal) or height (if
|
|
35
|
+
* vertical).
|
|
33
36
|
*
|
|
34
37
|
* @default true
|
|
35
38
|
*/
|
|
@@ -37,14 +40,15 @@ export type FlexProps = {
|
|
|
37
40
|
/**
|
|
38
41
|
* Spacing in between each child can be adjusted by using `gap`.
|
|
39
42
|
*
|
|
40
|
-
* Can either be a number (which will act as a multiplier to the library's
|
|
41
|
-
* or a literal CSS value string.
|
|
43
|
+
* Can either be a number (which will act as a multiplier to the library's
|
|
44
|
+
* grid system base of 4px), or a literal CSS value string.
|
|
42
45
|
*
|
|
43
46
|
* @default 2
|
|
44
47
|
*/
|
|
45
48
|
gap?: SpaceInput;
|
|
46
49
|
/**
|
|
47
|
-
* Horizontally aligns content if the `direction` is `row`, or vertically
|
|
50
|
+
* Horizontally aligns content if the `direction` is `row`, or vertically
|
|
51
|
+
* aligns content if the `direction` is `column`.
|
|
48
52
|
*
|
|
49
53
|
* @default 'space-between'
|
|
50
54
|
*/
|
|
@@ -58,7 +62,7 @@ export type FlexProps = {
|
|
|
58
62
|
/**
|
|
59
63
|
* The children elements.
|
|
60
64
|
*/
|
|
61
|
-
children:
|
|
65
|
+
children: ReactNode;
|
|
62
66
|
/**
|
|
63
67
|
* @deprecated
|
|
64
68
|
*/
|
|
@@ -79,7 +83,7 @@ export type FlexItemProps = {
|
|
|
79
83
|
/**
|
|
80
84
|
* The children elements.
|
|
81
85
|
*/
|
|
82
|
-
children
|
|
86
|
+
children?: ReactNode;
|
|
83
87
|
};
|
|
84
88
|
|
|
85
89
|
export type FlexBlockProps = Omit< FlexItemProps, 'isBlock' >;
|
|
@@ -12,14 +12,12 @@ import { COLORS } from '../../utils';
|
|
|
12
12
|
|
|
13
13
|
export const MediaWrapper = styled.div`
|
|
14
14
|
background-color: transparent;
|
|
15
|
-
box-sizing: border-box;
|
|
16
15
|
text-align: center;
|
|
17
16
|
width: 100%;
|
|
18
17
|
`;
|
|
19
18
|
|
|
20
19
|
export const MediaContainer = styled.div`
|
|
21
20
|
align-items: center;
|
|
22
|
-
box-sizing: border-box;
|
|
23
21
|
box-shadow: 0 0 0 1px rgba( 0, 0, 0, 0.2 );
|
|
24
22
|
cursor: pointer;
|
|
25
23
|
display: inline-flex;
|
|
@@ -44,7 +42,6 @@ export const MediaContainer = styled.div`
|
|
|
44
42
|
|
|
45
43
|
export const MediaPlaceholder = styled.div`
|
|
46
44
|
background: ${ COLORS.lightGray[ 300 ] };
|
|
47
|
-
box-sizing: border-box;
|
|
48
45
|
height: 170px;
|
|
49
46
|
max-width: 280px;
|
|
50
47
|
min-width: 200px;
|
|
@@ -61,7 +58,6 @@ export const ControlWrapper = styled( Flex )`
|
|
|
61
58
|
`;
|
|
62
59
|
|
|
63
60
|
export const GridView = styled.div`
|
|
64
|
-
box-sizing: border-box;
|
|
65
61
|
left: 50%;
|
|
66
62
|
opacity: 0;
|
|
67
63
|
overflow: hidden;
|
|
@@ -80,7 +76,6 @@ export const GridView = styled.div`
|
|
|
80
76
|
`;
|
|
81
77
|
|
|
82
78
|
export const GridLine = styled.div`
|
|
83
|
-
box-sizing: border-box;
|
|
84
79
|
background: white;
|
|
85
80
|
box-shadow: 0 0 2px rgba( 0, 0, 0, 0.6 );
|
|
86
81
|
position: absolute;
|
|
@@ -8,6 +8,7 @@ import { useState, useMemo, forwardRef } from '@wordpress/element';
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
+
import { BaseControl } from '../base-control';
|
|
11
12
|
import Button from '../button';
|
|
12
13
|
import RangeControl from '../range-control';
|
|
13
14
|
import { Flex, FlexItem } from '../flex';
|
|
@@ -32,6 +33,8 @@ function FontSizePicker(
|
|
|
32
33
|
fontSizes = [],
|
|
33
34
|
disableCustomFontSizes = false,
|
|
34
35
|
onChange,
|
|
36
|
+
/** @type {'default' | '__unstable-large'} */
|
|
37
|
+
size = 'default',
|
|
35
38
|
value,
|
|
36
39
|
withSlider = false,
|
|
37
40
|
withReset = true,
|
|
@@ -52,7 +55,7 @@ function FontSizePicker(
|
|
|
52
55
|
* than six and a select control when they are more.
|
|
53
56
|
*/
|
|
54
57
|
const fontSizesContainComplexValues = fontSizes.some(
|
|
55
|
-
( { size } ) => ! isSimpleCssValue(
|
|
58
|
+
( { size: sizeArg } ) => ! isSimpleCssValue( sizeArg )
|
|
56
59
|
);
|
|
57
60
|
const shouldUseSelectControl = fontSizes.length > 5;
|
|
58
61
|
const options = useMemo(
|
|
@@ -131,12 +134,16 @@ function FontSizePicker(
|
|
|
131
134
|
className={ `${ baseClassName }__header` }
|
|
132
135
|
>
|
|
133
136
|
<FlexItem>
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
<BaseControl.VisualLabel>
|
|
138
|
+
{ __( 'Size' ) }
|
|
139
|
+
{ headerHint && (
|
|
140
|
+
<span
|
|
141
|
+
className={ `${ baseClassName }__header__hint` }
|
|
142
|
+
>
|
|
143
|
+
{ headerHint }
|
|
144
|
+
</span>
|
|
145
|
+
) }
|
|
146
|
+
</BaseControl.VisualLabel>
|
|
140
147
|
</FlexItem>
|
|
141
148
|
{ ! disableCustomFontSizes && (
|
|
142
149
|
<FlexItem>
|
|
@@ -163,6 +170,7 @@ function FontSizePicker(
|
|
|
163
170
|
shouldUseSelectControl &&
|
|
164
171
|
! showCustomValueControl && (
|
|
165
172
|
<CustomSelectControl
|
|
173
|
+
__nextUnconstrainedWidth
|
|
166
174
|
className={ `${ baseClassName }__select` }
|
|
167
175
|
label={ __( 'Font size' ) }
|
|
168
176
|
hideLabelFromVision
|
|
@@ -181,6 +189,7 @@ function FontSizePicker(
|
|
|
181
189
|
setShowCustomValueControl( true );
|
|
182
190
|
}
|
|
183
191
|
} }
|
|
192
|
+
size={ size }
|
|
184
193
|
/>
|
|
185
194
|
) }
|
|
186
195
|
{ ! shouldUseSelectControl && ! showCustomValueControl && (
|
|
@@ -194,6 +203,7 @@ function FontSizePicker(
|
|
|
194
203
|
);
|
|
195
204
|
} }
|
|
196
205
|
isBlock
|
|
206
|
+
size={ size }
|
|
197
207
|
>
|
|
198
208
|
{ options.map( ( option ) => (
|
|
199
209
|
<ToggleGroupControlOption
|
|
@@ -233,6 +243,7 @@ function FontSizePicker(
|
|
|
233
243
|
);
|
|
234
244
|
}
|
|
235
245
|
} }
|
|
246
|
+
size={ size }
|
|
236
247
|
units={ hasUnits ? units : [] }
|
|
237
248
|
/>
|
|
238
249
|
</FlexItem>
|
|
@@ -17,6 +17,12 @@ export default {
|
|
|
17
17
|
description:
|
|
18
18
|
'If no value exists, this prop defines the starting position for the font size picker slider. Only relevant if `withSlider` is `true`.',
|
|
19
19
|
},
|
|
20
|
+
size: {
|
|
21
|
+
control: {
|
|
22
|
+
type: 'radio',
|
|
23
|
+
options: [ 'default', '__unstable-large' ],
|
|
24
|
+
},
|
|
25
|
+
},
|
|
20
26
|
withReset: {
|
|
21
27
|
description:
|
|
22
28
|
'If `true`, a reset button will be displayed alongside the input field when a custom font size is active. Has no effect when `disableCustomFontSizes` or `withSlider` is `true`.',
|
|
@@ -56,6 +56,7 @@ The `value` property is handled in a manner similar to controlled form component
|
|
|
56
56
|
- `removed` - The user removed an existing token.
|
|
57
57
|
- `remove` - The user focused the button to remove the token.
|
|
58
58
|
- `__experimentalInvalid` - The user tried to add a token that didn't pass the validation.
|
|
59
|
+
- `__experimentalRenderItem` - 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).
|
|
59
60
|
- `__experimentalExpandOnFocus` - If true, the suggestions list will be always expanded when the input field has the focus.
|
|
60
61
|
- `__experimentalShowHowTo` - If false, the text on how to use the select (ie: _Separate with commas or the Enter key._) will be hidden.
|
|
61
62
|
- `__experimentalValidateInput` - If passed, all introduced values will be validated before being added as tokens.
|
|
@@ -78,7 +79,7 @@ const continents = [
|
|
|
78
79
|
const MyFormTokenField = () => {
|
|
79
80
|
const [ selectedContinents, setSelectedContinents ] = useState( [] );
|
|
80
81
|
|
|
81
|
-
return(
|
|
82
|
+
return (
|
|
82
83
|
<FormTokenField
|
|
83
84
|
value={ selectedContinents }
|
|
84
85
|
suggestions={ continents }
|