@wordpress/components 19.15.0 → 19.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +51 -0
- package/build/angle-picker-control/index.js +2 -2
- package/build/angle-picker-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/border-control/component.js +38 -25
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +4 -7
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +13 -7
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +0 -4
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/border-control/styles.js +33 -56
- package/build/border-control/styles.js.map +1 -1
- package/build/box-control/axial-input-controls.js +1 -1
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/box-control/utils.js +2 -8
- package/build/box-control/utils.js.map +1 -1
- package/build/color-palette/index.js +14 -2
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/hex-input.js +2 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js +3 -2
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +8 -15
- package/build/color-picker/styles.js.map +1 -1
- package/build/combobox-control/index.js +5 -7
- package/build/combobox-control/index.js.map +1 -1
- package/build/custom-select-control/index.js +26 -8
- package/build/custom-select-control/index.js.map +1 -1
- package/build/divider/component.js +0 -1
- package/build/divider/component.js.map +1 -1
- package/build/divider/index.js.map +1 -1
- package/build/divider/styles.js +5 -5
- package/build/divider/styles.js.map +1 -1
- package/build/dropdown/dropdown-content-wrapper.js +60 -0
- package/build/dropdown/dropdown-content-wrapper.js.map +1 -0
- package/build/dropdown/styles.js +42 -0
- package/build/dropdown/styles.js.map +1 -0
- package/build/dropdown/types.js +6 -0
- package/build/dropdown/types.js.map +1 -0
- package/build/elevation/component.js +15 -15
- package/build/elevation/component.js.map +1 -1
- package/build/elevation/hook.js +5 -17
- package/build/elevation/hook.js.map +1 -1
- package/build/elevation/index.js.map +1 -1
- package/build/elevation/styles.js +1 -1
- package/build/elevation/styles.js.map +1 -1
- package/build/flex/flex/component.js +11 -17
- package/build/flex/flex/component.js.map +1 -1
- package/build/flex/flex-block/component.js +9 -3
- package/build/flex/flex-block/component.js.map +1 -1
- package/build/flex/flex-item/component.js +9 -3
- package/build/flex/flex-item/component.js.map +1 -1
- package/build/index.js +24 -0
- package/build/index.js.map +1 -1
- package/build/input-control/index.js +7 -0
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +23 -1
- package/build/input-control/input-base.js.map +1 -1
- package/build/input-control/input-prefix-wrapper.js +54 -0
- package/build/input-control/input-prefix-wrapper.js.map +1 -0
- package/build/input-control/input-suffix-wrapper.js +54 -0
- package/build/input-control/input-suffix-wrapper.js.map +1 -0
- package/build/input-control/styles/input-control-styles.js +61 -42
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/mobile/image/index.native.js +7 -4
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js +1 -7
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/popover/index.js +13 -10
- package/build/popover/index.js.map +1 -1
- package/build/radio-control/index.js +1 -3
- package/build/radio-control/index.js.map +1 -1
- package/build/range-control/utils.js +1 -1
- package/build/range-control/utils.js.map +1 -1
- package/build/sandbox/index.native.js +13 -2
- package/build/sandbox/index.native.js.map +1 -1
- package/build/scroll-lock/index.js +35 -6
- package/build/scroll-lock/index.js.map +1 -1
- package/build/select-control/index.js +1 -3
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +31 -11
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/shortcut/index.js +4 -13
- package/build/shortcut/index.js.map +1 -1
- package/build/shortcut/types.js +6 -0
- package/build/shortcut/types.js.map +1 -0
- package/build/spacer/component.js +3 -1
- package/build/spacer/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +4 -1
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +20 -4
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +7 -9
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/tooltip/index.js +51 -14
- package/build/tooltip/index.js.map +1 -1
- package/build/tree-select/index.js +2 -2
- package/build/tree-select/index.js.map +1 -1
- package/build/ui/context/use-context-system.js +7 -2
- package/build/ui/context/use-context-system.js.map +1 -1
- package/build/ui/utils/space.js +7 -1
- package/build/ui/utils/space.js.map +1 -1
- package/build/unit-control/styles/unit-control-styles.js +10 -26
- package/build/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -2
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/base-control/styles/base-control-styles.js +8 -8
- package/build-module/base-control/styles/base-control-styles.js.map +1 -1
- package/build-module/border-control/border-control/component.js +37 -25
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +4 -7
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +12 -7
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +0 -4
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/border-control/styles.js +33 -49
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js +1 -1
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/box-control/utils.js +2 -7
- package/build-module/box-control/utils.js.map +1 -1
- package/build-module/color-palette/index.js +10 -1
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/hex-input.js +2 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +3 -2
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +9 -16
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/combobox-control/index.js +5 -6
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +26 -10
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/divider/component.js +0 -1
- package/build-module/divider/component.js.map +1 -1
- package/build-module/divider/index.js.map +1 -1
- package/build-module/divider/styles.js +5 -5
- package/build-module/divider/styles.js.map +1 -1
- package/build-module/dropdown/dropdown-content-wrapper.js +47 -0
- package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -0
- package/build-module/dropdown/styles.js +31 -0
- package/build-module/dropdown/styles.js.map +1 -0
- package/build-module/dropdown/types.js +2 -0
- package/build-module/dropdown/types.js.map +1 -0
- package/build-module/elevation/component.js +15 -15
- package/build-module/elevation/component.js.map +1 -1
- package/build-module/elevation/hook.js +5 -17
- package/build-module/elevation/hook.js.map +1 -1
- package/build-module/elevation/index.js.map +1 -1
- package/build-module/elevation/styles.js +1 -1
- package/build-module/elevation/styles.js.map +1 -1
- package/build-module/flex/flex/component.js +11 -17
- package/build-module/flex/flex/component.js.map +1 -1
- package/build-module/flex/flex-block/component.js +9 -3
- package/build-module/flex/flex-block/component.js.map +1 -1
- package/build-module/flex/flex-item/component.js +9 -3
- package/build-module/flex/flex-item/component.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/index.js +6 -0
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +24 -3
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/input-control/input-prefix-wrapper.js +41 -0
- package/build-module/input-control/input-prefix-wrapper.js.map +1 -0
- package/build-module/input-control/input-suffix-wrapper.js +41 -0
- package/build-module/input-control/input-suffix-wrapper.js.map +1 -0
- package/build-module/input-control/styles/input-control-styles.js +57 -41
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/mobile/image/index.native.js +9 -6
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js +1 -6
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/popover/index.js +13 -10
- package/build-module/popover/index.js.map +1 -1
- package/build-module/radio-control/index.js +1 -2
- package/build-module/radio-control/index.js.map +1 -1
- package/build-module/range-control/utils.js +1 -1
- package/build-module/range-control/utils.js.map +1 -1
- package/build-module/sandbox/index.native.js +13 -3
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/scroll-lock/index.js +32 -6
- package/build-module/scroll-lock/index.js.map +1 -1
- package/build-module/select-control/index.js +1 -2
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +31 -11
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/shortcut/index.js +4 -13
- package/build-module/shortcut/index.js.map +1 -1
- package/build-module/shortcut/types.js +2 -0
- package/build-module/shortcut/types.js.map +1 -0
- package/build-module/spacer/component.js +3 -1
- package/build-module/spacer/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +4 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/styles.js +15 -3
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +6 -7
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/tooltip/index.js +53 -16
- package/build-module/tooltip/index.js.map +1 -1
- package/build-module/tree-select/index.js +3 -3
- package/build-module/tree-select/index.js.map +1 -1
- package/build-module/ui/context/use-context-system.js +7 -2
- package/build-module/ui/context/use-context-system.js.map +1 -1
- package/build-module/ui/utils/space.js +7 -1
- package/build-module/ui/utils/space.js.map +1 -1
- package/build-module/unit-control/styles/unit-control-styles.js +10 -27
- package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
- package/build-style/style-rtl.css +12 -26
- package/build-style/style.css +12 -24
- package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +1 -1
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts +1 -4
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/card/card-divider/hook.d.ts +1 -1
- package/build-types/color-palette/index.d.ts +1 -0
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/divider/component.d.ts +2 -3
- package/build-types/divider/component.d.ts.map +1 -1
- package/build-types/divider/index.d.ts +1 -1
- package/build-types/divider/index.d.ts.map +1 -1
- package/build-types/divider/styles.d.ts +6 -2
- package/build-types/divider/styles.d.ts.map +1 -1
- package/build-types/divider/test/index.d.ts +2 -0
- package/build-types/divider/test/index.d.ts.map +1 -0
- package/build-types/divider/types.d.ts +18 -10
- package/build-types/divider/types.d.ts.map +1 -1
- package/build-types/dropdown/dropdown-content-wrapper.d.ts +23 -0
- package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -0
- package/build-types/dropdown/styles.d.ts +7 -0
- package/build-types/dropdown/styles.d.ts.map +1 -0
- package/build-types/dropdown/types.d.ts +9 -0
- package/build-types/dropdown/types.d.ts.map +1 -0
- package/build-types/elevation/component.d.ts +11 -10
- package/build-types/elevation/component.d.ts.map +1 -1
- package/build-types/elevation/hook.d.ts +6 -7
- package/build-types/elevation/hook.d.ts.map +1 -1
- package/build-types/elevation/index.d.ts +2 -2
- package/build-types/elevation/index.d.ts.map +1 -1
- package/build-types/elevation/stories/index.d.ts +22 -0
- package/build-types/elevation/stories/index.d.ts.map +1 -0
- package/build-types/elevation/styles.d.ts +1 -1
- package/build-types/elevation/styles.d.ts.map +1 -1
- package/build-types/elevation/test/index.d.ts +2 -0
- package/build-types/elevation/test/index.d.ts.map +1 -0
- package/build-types/elevation/types.d.ts +12 -19
- package/build-types/elevation/types.d.ts.map +1 -1
- package/build-types/flex/flex/component.d.ts +11 -17
- package/build-types/flex/flex/component.d.ts.map +1 -1
- package/build-types/flex/flex-block/component.d.ts +9 -3
- package/build-types/flex/flex-block/component.d.ts.map +1 -1
- package/build-types/flex/flex-item/component.d.ts +9 -3
- package/build-types/flex/flex-item/component.d.ts.map +1 -1
- package/build-types/flex/types.d.ts +4 -1
- package/build-types/flex/types.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/input-prefix-wrapper.d.ts +19 -0
- package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -0
- package/build-types/input-control/input-suffix-wrapper.d.ts +19 -0
- package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -0
- package/build-types/input-control/stories/index.d.ts +10 -0
- package/build-types/input-control/stories/index.d.ts.map +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts +21 -0
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +45 -3
- package/build-types/input-control/types.d.ts.map +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/radio-control/index.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +4 -2
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/range-control/utils.d.ts.map +1 -1
- package/build-types/scroll-lock/index.d.ts +32 -3
- package/build-types/scroll-lock/index.d.ts.map +1 -1
- package/build-types/scroll-lock/stories/index.d.ts +9 -0
- package/build-types/scroll-lock/stories/index.d.ts.map +1 -0
- package/build-types/scroll-lock/test/index.d.ts +2 -0
- package/build-types/scroll-lock/test/index.d.ts.map +1 -0
- package/build-types/select-control/index.d.ts.map +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/select-control/types.d.ts +1 -1
- package/build-types/select-control/types.d.ts.map +1 -1
- package/build-types/shortcut/index.d.ts +5 -24
- package/build-types/shortcut/index.d.ts.map +1 -1
- package/build-types/shortcut/test/index.d.ts +2 -0
- package/build-types/shortcut/test/index.d.ts.map +1 -0
- package/build-types/shortcut/types.d.ts +14 -0
- package/build-types/shortcut/types.d.ts.map +1 -0
- package/build-types/spacer/component.d.ts +3 -1
- package/build-types/spacer/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +5 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +0 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +6 -0
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tooltip/index.d.ts.map +1 -1
- package/build-types/tree-select/index.d.ts.map +1 -1
- package/build-types/tree-select/types.d.ts +1 -0
- package/build-types/tree-select/types.d.ts.map +1 -1
- package/build-types/ui/context/use-context-system.d.ts.map +1 -1
- package/build-types/ui/utils/space.d.ts +7 -1
- package/build-types/ui/utils/space.d.ts.map +1 -1
- package/build-types/unit-control/index.d.ts +2 -2
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +0 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +1 -1
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/angle-picker-control/index.js +1 -2
- package/src/base-control/styles/base-control-styles.ts +5 -0
- package/src/border-control/border-control/component.tsx +41 -32
- package/src/border-control/border-control/hook.ts +4 -9
- package/src/border-control/border-control-dropdown/component.tsx +50 -45
- package/src/border-control/border-control-dropdown/hook.ts +0 -5
- package/src/border-control/stories/index.tsx +3 -0
- package/src/border-control/styles.ts +23 -69
- package/src/border-control/test/index.js +19 -8
- package/src/box-control/axial-input-controls.js +1 -1
- package/src/box-control/utils.js +6 -13
- package/src/card/test/__snapshots__/index.js.snap +8 -8
- package/src/color-palette/index.js +19 -8
- package/src/color-palette/style.scss +5 -0
- package/src/color-palette/test/utils.ts +19 -1
- package/src/color-picker/hex-input.tsx +2 -1
- package/src/color-picker/input-with-slider.tsx +2 -1
- package/src/color-picker/styles.ts +0 -11
- package/src/combobox-control/index.js +5 -6
- package/src/confirm-dialog/README.md +1 -1
- package/src/custom-select-control/index.js +44 -26
- package/src/custom-select-control/stories/index.js +7 -2
- package/src/custom-select-control/style.scss +4 -29
- package/src/divider/README.md +12 -5
- package/src/divider/component.tsx +2 -3
- package/src/divider/index.ts +1 -1
- package/src/divider/stories/index.tsx +4 -4
- package/src/divider/styles.ts +7 -7
- package/src/divider/test/__snapshots__/{index.js.snap → index.tsx.snap} +7 -7
- package/src/divider/test/index.tsx +40 -0
- package/src/divider/types.ts +21 -15
- package/src/draggable/README.md +1 -1
- package/src/dropdown/dropdown-content-wrapper.tsx +59 -0
- package/src/dropdown/stories/index.js +60 -69
- package/src/dropdown/styles.ts +38 -0
- package/src/dropdown/types.ts +8 -0
- package/src/elevation/README.md +16 -14
- package/src/elevation/component.tsx +48 -0
- package/src/elevation/{hook.js → hook.ts} +20 -17
- package/src/elevation/{index.js → index.ts} +0 -0
- package/src/elevation/stories/index.tsx +85 -0
- package/src/elevation/{styles.js → styles.ts} +0 -0
- package/src/elevation/test/__snapshots__/{index.js.snap → index.tsx.snap} +19 -13
- package/src/elevation/test/index.tsx +64 -0
- package/src/elevation/types.ts +12 -19
- package/src/flex/flex/README.md +1 -5
- package/src/flex/flex/component.js +11 -17
- package/src/flex/flex-block/README.md +0 -4
- package/src/flex/flex-block/component.js +9 -3
- package/src/flex/flex-item/README.md +0 -4
- package/src/flex/flex-item/component.js +9 -3
- package/src/flex/stories/index.js +1 -1
- package/src/flex/types.ts +4 -1
- package/src/form-token-field/test/index.js +1 -1
- package/src/index.js +3 -0
- package/src/input-control/index.tsx +6 -0
- package/src/input-control/input-base.tsx +28 -12
- package/src/input-control/input-prefix-wrapper.tsx +48 -0
- package/src/input-control/input-suffix-wrapper.tsx +48 -0
- package/src/input-control/stories/index.tsx +15 -2
- package/src/input-control/styles/input-control-styles.tsx +25 -11
- package/src/input-control/types.ts +52 -3
- package/src/mobile/image/index.native.js +12 -7
- package/src/mobile/media-edit/index.native.js +2 -7
- package/src/modal/style.scss +5 -1
- package/src/popover/index.js +13 -9
- package/src/popover/stories/index.js +2 -0
- package/src/popover/style.scss +1 -1
- package/src/radio-control/index.tsx +1 -2
- package/src/range-control/README.md +1 -1
- package/src/range-control/test/index.tsx +30 -0
- package/src/range-control/types.ts +4 -2
- package/src/range-control/utils.ts +4 -1
- package/src/sandbox/index.native.js +14 -1
- package/src/scroll-lock/README.md +1 -1
- package/src/scroll-lock/{index.js → index.tsx} +34 -7
- package/src/scroll-lock/stories/index.tsx +96 -0
- package/src/scroll-lock/test/index.tsx +26 -0
- package/src/select-control/index.tsx +1 -2
- package/src/select-control/styles/select-control-styles.ts +33 -9
- package/src/select-control/types.ts +1 -0
- package/src/shortcut/{index.js → index.tsx} +5 -9
- package/src/shortcut/test/__snapshots__/index.tsx.snap +15 -0
- package/src/shortcut/test/index.tsx +41 -0
- package/src/shortcut/types.ts +10 -0
- package/src/spacer/component.tsx +3 -1
- package/src/toggle-group-control/stories/index.js +19 -3
- package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -4
- package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
- package/src/toggle-group-control/toggle-group-control/styles.ts +22 -2
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -4
- package/src/toggle-group-control/types.ts +6 -0
- package/src/tools-panel/tools-panel/README.md +94 -21
- package/src/tooltip/index.js +56 -10
- package/src/tooltip/stories/index.js +28 -13
- package/src/tooltip/style.scss +1 -1
- package/src/tree-select/index.tsx +5 -4
- package/src/tree-select/types.ts +4 -0
- package/src/ui/context/test/context-system-provider.js +101 -1
- package/src/ui/context/use-context-system.js +7 -2
- package/src/ui/utils/space.ts +7 -1
- package/src/unit-control/styles/unit-control-styles.ts +15 -13
- package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -4
- package/src/unit-control/types.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/src/divider/test/index.js +0 -41
- package/src/elevation/component.js +0 -43
- package/src/elevation/stories/index.js +0 -148
- package/src/elevation/test/index.js +0 -51
- package/src/scroll-lock/stories/index.js +0 -71
- package/src/scroll-lock/test/index.js +0 -53
- package/src/shortcut/test/index.js +0 -37
|
@@ -373,7 +373,7 @@ Object {
|
|
|
373
373
|
will-change: box-shadow;
|
|
374
374
|
border-radius: inherit;
|
|
375
375
|
bottom: 0;
|
|
376
|
-
box-shadow: 0 0px 0px 0 rgba(0
|
|
376
|
+
box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
|
|
377
377
|
opacity: 1;
|
|
378
378
|
left: 0;
|
|
379
379
|
right: 0;
|
|
@@ -629,7 +629,7 @@ Object {
|
|
|
629
629
|
will-change: box-shadow;
|
|
630
630
|
border-radius: inherit;
|
|
631
631
|
bottom: 0;
|
|
632
|
-
box-shadow: 0 0px 0px 0 rgba(0
|
|
632
|
+
box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
|
|
633
633
|
opacity: 1;
|
|
634
634
|
left: 0;
|
|
635
635
|
right: 0;
|
|
@@ -786,15 +786,15 @@ Snapshot Diff:
|
|
|
786
786
|
</div>
|
|
787
787
|
<div
|
|
788
788
|
aria-hidden="true"
|
|
789
|
-
- class="components-elevation css-
|
|
790
|
-
+ class="components-elevation css-
|
|
789
|
+
- class="components-elevation css-1lsfy80-View-Elevation-sx-Base-elevationClassName em57xhy0"
|
|
790
|
+
+ class="components-elevation css-15t1t3g-View-Elevation-sx-Base-elevationClassName em57xhy0"
|
|
791
791
|
data-wp-c16t="true"
|
|
792
792
|
data-wp-component="Elevation"
|
|
793
793
|
/>
|
|
794
794
|
<div
|
|
795
795
|
aria-hidden="true"
|
|
796
|
-
- class="components-elevation css-
|
|
797
|
-
+ class="components-elevation css-
|
|
796
|
+
- class="components-elevation css-18cl04p-View-Elevation-sx-Base-elevationClassName em57xhy0"
|
|
797
|
+
+ class="components-elevation css-15t1t3g-View-Elevation-sx-Base-elevationClassName em57xhy0"
|
|
798
798
|
data-wp-c16t="true"
|
|
799
799
|
data-wp-component="Elevation"
|
|
800
800
|
/>
|
|
@@ -829,7 +829,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
|
|
|
829
829
|
will-change: box-shadow;
|
|
830
830
|
border-radius: inherit;
|
|
831
831
|
bottom: 0;
|
|
832
|
-
box-shadow: 0 1px 2px 0 rgba(0
|
|
832
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
833
833
|
opacity: 1;
|
|
834
834
|
left: 0;
|
|
835
835
|
right: 0;
|
|
@@ -854,7 +854,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
|
|
|
854
854
|
will-change: box-shadow;
|
|
855
855
|
border-radius: inherit;
|
|
856
856
|
bottom: 0;
|
|
857
|
-
box-shadow: 0 2px 4px 0 rgba(0
|
|
857
|
+
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
|
|
858
858
|
opacity: 1;
|
|
859
859
|
left: 0;
|
|
860
860
|
right: 0;
|
|
@@ -162,6 +162,13 @@ export const extractColorNameFromCurrentValue = (
|
|
|
162
162
|
return __( 'Custom' );
|
|
163
163
|
};
|
|
164
164
|
|
|
165
|
+
export const showTransparentBackground = ( currentValue ) => {
|
|
166
|
+
if ( typeof currentValue === 'undefined' ) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
return colord( currentValue ).alpha() === 0;
|
|
170
|
+
};
|
|
171
|
+
|
|
165
172
|
export default function ColorPalette( {
|
|
166
173
|
clearable = true,
|
|
167
174
|
className,
|
|
@@ -228,14 +235,18 @@ export default function ColorPalette( {
|
|
|
228
235
|
aria-haspopup="true"
|
|
229
236
|
onClick={ onToggle }
|
|
230
237
|
aria-label={ customColorAccessibleLabel }
|
|
231
|
-
style={
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
238
|
+
style={
|
|
239
|
+
showTransparentBackground( value )
|
|
240
|
+
? { color: '#000' }
|
|
241
|
+
: {
|
|
242
|
+
background: value,
|
|
243
|
+
color:
|
|
244
|
+
colordColor.contrast() >
|
|
245
|
+
colordColor.contrast( '#000' )
|
|
246
|
+
? '#fff'
|
|
247
|
+
: '#000',
|
|
248
|
+
}
|
|
249
|
+
}
|
|
239
250
|
>
|
|
240
251
|
<FlexItem
|
|
241
252
|
isBlock
|
|
@@ -7,10 +7,15 @@
|
|
|
7
7
|
padding: $grid-unit-15;
|
|
8
8
|
font-family: inherit;
|
|
9
9
|
width: 100%;
|
|
10
|
+
// The background image creates a checkerboard pattern. Ignore rtlcss to
|
|
11
|
+
// make it work both in LTR and RTL.
|
|
12
|
+
// See https://github.com/WordPress/gutenberg/pull/42510
|
|
13
|
+
/*rtl:begin:ignore*/
|
|
10
14
|
background-image:
|
|
11
15
|
repeating-linear-gradient(45deg, $gray-200 25%, transparent 25%, transparent 75%, $gray-200 75%, $gray-200),
|
|
12
16
|
repeating-linear-gradient(45deg, $gray-200 25%, transparent 25%, transparent 75%, $gray-200 75%, $gray-200);
|
|
13
17
|
background-position: 0 0, 25px 25px;
|
|
18
|
+
/*rtl:end:ignore*/
|
|
14
19
|
background-size: calc(2 * 25px) calc(2 * 25px);
|
|
15
20
|
box-sizing: border-box;
|
|
16
21
|
color: $white;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
extractColorNameFromCurrentValue,
|
|
6
|
+
showTransparentBackground,
|
|
7
|
+
} from '../';
|
|
5
8
|
|
|
6
9
|
describe( 'ColorPalette: Utils', () => {
|
|
7
10
|
describe( 'extractColorNameFromCurrentValue', () => {
|
|
@@ -21,4 +24,19 @@ describe( 'ColorPalette: Utils', () => {
|
|
|
21
24
|
expect( result ).toBe( 'Blue' );
|
|
22
25
|
} );
|
|
23
26
|
} );
|
|
27
|
+
describe( 'showTransparentBackground', () => {
|
|
28
|
+
test( 'should return true for undefined color values', () => {
|
|
29
|
+
expect( showTransparentBackground( undefined ) ).toBe( true );
|
|
30
|
+
} );
|
|
31
|
+
test( 'should return true for transparent colors', () => {
|
|
32
|
+
expect( showTransparentBackground( 'transparent' ) ).toBe( true );
|
|
33
|
+
expect( showTransparentBackground( '#75757500' ) ).toBe( true );
|
|
34
|
+
} );
|
|
35
|
+
|
|
36
|
+
test( 'should return false for non-transparent colors', () => {
|
|
37
|
+
expect( showTransparentBackground( '#FFF' ) ).toBe( false );
|
|
38
|
+
expect( showTransparentBackground( '#757575' ) ).toBe( false );
|
|
39
|
+
expect( showTransparentBackground( '#f5f5f524' ) ).toBe( false ); // 0.14 alpha.
|
|
40
|
+
} );
|
|
41
|
+
} );
|
|
24
42
|
} );
|
|
@@ -53,7 +53,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
|
53
53
|
prefix={
|
|
54
54
|
<Spacer
|
|
55
55
|
as={ Text }
|
|
56
|
-
marginLeft={ space(
|
|
56
|
+
marginLeft={ space( 4 ) }
|
|
57
57
|
color={ COLORS.ui.theme }
|
|
58
58
|
lineHeight={ 1 }
|
|
59
59
|
>
|
|
@@ -65,6 +65,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
|
65
65
|
maxLength={ enableAlpha ? 9 : 7 }
|
|
66
66
|
label={ __( 'Hex color' ) }
|
|
67
67
|
hideLabelFromVision
|
|
68
|
+
size="__unstable-large"
|
|
68
69
|
__unstableStateReducer={ stateReducer }
|
|
69
70
|
__unstableInputWidth="9em"
|
|
70
71
|
/>
|
|
@@ -37,7 +37,7 @@ export const InputWithSlider = ( {
|
|
|
37
37
|
prefix={
|
|
38
38
|
<Spacer
|
|
39
39
|
as={ Text }
|
|
40
|
-
paddingLeft={ space(
|
|
40
|
+
paddingLeft={ space( 4 ) }
|
|
41
41
|
color={ COLORS.ui.theme }
|
|
42
42
|
lineHeight={ 1 }
|
|
43
43
|
>
|
|
@@ -45,6 +45,7 @@ export const InputWithSlider = ( {
|
|
|
45
45
|
</Spacer>
|
|
46
46
|
}
|
|
47
47
|
hideHTMLArrows
|
|
48
|
+
size="__unstable-large"
|
|
48
49
|
/>
|
|
49
50
|
<RangeControl
|
|
50
51
|
label={ label }
|
|
@@ -17,7 +17,6 @@ import { HStack } from '../h-stack';
|
|
|
17
17
|
import {
|
|
18
18
|
BackdropUI,
|
|
19
19
|
Container as InputControlContainer,
|
|
20
|
-
Input,
|
|
21
20
|
} from '../input-control/styles/input-control-styles';
|
|
22
21
|
import CONFIG from '../utils/config-values';
|
|
23
22
|
|
|
@@ -44,14 +43,6 @@ export const RangeControl = styled( InnerRangeControl )`
|
|
|
44
43
|
}
|
|
45
44
|
`;
|
|
46
45
|
|
|
47
|
-
// All inputs should be the same height so this should be changed at the component level.
|
|
48
|
-
// That involves changing heights of multiple input types probably buttons too etc.
|
|
49
|
-
// So until that is done we are already using the new height on the color picker so it matches the mockups.
|
|
50
|
-
const inputHeightStyle = `
|
|
51
|
-
&&& ${ Input } {
|
|
52
|
-
height: 40px;
|
|
53
|
-
}`;
|
|
54
|
-
|
|
55
46
|
// Make the Hue circle picker not go out of the bar.
|
|
56
47
|
const interactiveHueStyles = `
|
|
57
48
|
.react-colorful__interactive {
|
|
@@ -125,8 +116,6 @@ export const ColorfulWrapper = styled.div`
|
|
|
125
116
|
${ StyledField } {
|
|
126
117
|
margin-bottom: 0;
|
|
127
118
|
}
|
|
128
|
-
|
|
129
|
-
${ inputHeightStyle }
|
|
130
119
|
`;
|
|
131
120
|
|
|
132
121
|
export const CopyButton = styled( Button )`
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
useEffect,
|
|
17
17
|
} from '@wordpress/element';
|
|
18
18
|
import { useInstanceId } from '@wordpress/compose';
|
|
19
|
-
import { ENTER, UP, DOWN, ESCAPE } from '@wordpress/keycodes';
|
|
20
19
|
import { speak } from '@wordpress/a11y';
|
|
21
20
|
import { closeSmall } from '@wordpress/icons';
|
|
22
21
|
|
|
@@ -119,22 +118,22 @@ function ComboboxControl( {
|
|
|
119
118
|
return;
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
switch ( event.
|
|
123
|
-
case
|
|
121
|
+
switch ( event.code ) {
|
|
122
|
+
case 'Enter':
|
|
124
123
|
if ( selectedSuggestion ) {
|
|
125
124
|
onSuggestionSelected( selectedSuggestion );
|
|
126
125
|
preventDefault = true;
|
|
127
126
|
}
|
|
128
127
|
break;
|
|
129
|
-
case
|
|
128
|
+
case 'ArrowUp':
|
|
130
129
|
handleArrowNavigation( -1 );
|
|
131
130
|
preventDefault = true;
|
|
132
131
|
break;
|
|
133
|
-
case
|
|
132
|
+
case 'ArrowDown':
|
|
134
133
|
handleArrowNavigation( 1 );
|
|
135
134
|
preventDefault = true;
|
|
136
135
|
break;
|
|
137
|
-
case
|
|
136
|
+
case 'Escape':
|
|
138
137
|
setIsExpanded( false );
|
|
139
138
|
setSelectedSuggestion( null );
|
|
140
139
|
preventDefault = true;
|
|
@@ -17,7 +17,7 @@ The dialog is confirmed by clicking the _confirm_ button or by pressing the `Ent
|
|
|
17
17
|
Allows the component to be used standalone, just by declaring it as part of another React's component render method:
|
|
18
18
|
|
|
19
19
|
- It will be automatically open (displayed) upon mounting;
|
|
20
|
-
- It will be automatically closed when
|
|
20
|
+
- It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
|
|
21
21
|
- `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.
|
|
22
22
|
|
|
23
23
|
Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:
|
|
@@ -9,12 +9,14 @@ import classnames from 'classnames';
|
|
|
9
9
|
*/
|
|
10
10
|
import { Icon, check, chevronDown } from '@wordpress/icons';
|
|
11
11
|
import { __, sprintf } from '@wordpress/i18n';
|
|
12
|
-
import { useCallback } from '@wordpress/element';
|
|
12
|
+
import { useCallback, useState } from '@wordpress/element';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import { VisuallyHidden } from '../';
|
|
18
|
+
import { Select as SelectControlSelect } from '../select-control/styles/select-control-styles';
|
|
19
|
+
import InputBase from '../input-control/input-base';
|
|
18
20
|
|
|
19
21
|
const itemToString = ( item ) => item?.name;
|
|
20
22
|
// This is needed so that in Windows, where
|
|
@@ -58,12 +60,16 @@ const stateReducer = (
|
|
|
58
60
|
export default function CustomSelectControl( {
|
|
59
61
|
/** Start opting into the larger default height that will become the default size in a future version. */
|
|
60
62
|
__next36pxDefaultSize = false,
|
|
63
|
+
/** Start opting into the unconstrained width that will become the default in a future version. */
|
|
64
|
+
__nextUnconstrainedWidth = false,
|
|
61
65
|
className,
|
|
62
66
|
hideLabelFromVision,
|
|
63
67
|
label,
|
|
64
68
|
describedBy,
|
|
65
69
|
options: items,
|
|
66
70
|
onChange: onSelectedItemChange,
|
|
71
|
+
/** @type {import('../select-control/types').SelectControlProps.size} */
|
|
72
|
+
size = 'default',
|
|
67
73
|
value: _selectedItem,
|
|
68
74
|
} ) {
|
|
69
75
|
const {
|
|
@@ -85,6 +91,8 @@ export default function CustomSelectControl( {
|
|
|
85
91
|
stateReducer,
|
|
86
92
|
} );
|
|
87
93
|
|
|
94
|
+
const [ isFocused, setIsFocused ] = useState( false );
|
|
95
|
+
|
|
88
96
|
function getDescribedBy() {
|
|
89
97
|
if ( describedBy ) {
|
|
90
98
|
return describedBy;
|
|
@@ -138,31 +146,41 @@ export default function CustomSelectControl( {
|
|
|
138
146
|
{ label }
|
|
139
147
|
</label>
|
|
140
148
|
) }
|
|
141
|
-
<
|
|
142
|
-
{
|
|
143
|
-
|
|
144
|
-
'
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
'components-custom-select-control__button',
|
|
148
|
-
{ 'is-next-36px-default-size': __next36pxDefaultSize }
|
|
149
|
-
),
|
|
150
|
-
isSmall: ! __next36pxDefaultSize,
|
|
151
|
-
describedBy: getDescribedBy(),
|
|
152
|
-
} ) }
|
|
149
|
+
<InputBase
|
|
150
|
+
isFocused={ isOpen || isFocused }
|
|
151
|
+
__unstableInputWidth={
|
|
152
|
+
__nextUnconstrainedWidth ? undefined : 'auto'
|
|
153
|
+
}
|
|
154
|
+
labelPosition={ __nextUnconstrainedWidth ? undefined : 'top' }
|
|
153
155
|
>
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
156
|
+
<SelectControlSelect
|
|
157
|
+
as="button"
|
|
158
|
+
onFocus={ () => setIsFocused( true ) }
|
|
159
|
+
onBlur={ () => setIsFocused( false ) }
|
|
160
|
+
selectSize={ size }
|
|
161
|
+
__next36pxDefaultSize={ __next36pxDefaultSize }
|
|
162
|
+
{ ...getToggleButtonProps( {
|
|
163
|
+
// This is needed because some speech recognition software don't support `aria-labelledby`.
|
|
164
|
+
'aria-label': label,
|
|
165
|
+
'aria-labelledby': undefined,
|
|
166
|
+
className: classnames(
|
|
167
|
+
'components-custom-select-control__button',
|
|
168
|
+
{
|
|
169
|
+
'is-next-unconstrained-width':
|
|
170
|
+
__nextUnconstrainedWidth,
|
|
171
|
+
}
|
|
172
|
+
),
|
|
173
|
+
describedBy: getDescribedBy(),
|
|
174
|
+
} ) }
|
|
175
|
+
>
|
|
176
|
+
{ itemToString( selectedItem ) }
|
|
177
|
+
<Icon
|
|
178
|
+
icon={ chevronDown }
|
|
179
|
+
className="components-custom-select-control__button-icon"
|
|
180
|
+
size={ 18 }
|
|
181
|
+
/>
|
|
182
|
+
</SelectControlSelect>
|
|
183
|
+
</InputBase>
|
|
166
184
|
{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
|
|
167
185
|
<ul { ...menuProps } onKeyDown={ onKeyDownHandler }>
|
|
168
186
|
{ isOpen &&
|
|
@@ -7,8 +7,13 @@ export default {
|
|
|
7
7
|
title: 'Components/CustomSelectControl',
|
|
8
8
|
component: CustomSelectControl,
|
|
9
9
|
argTypes: {
|
|
10
|
-
__next36pxDefaultSize: {
|
|
11
|
-
|
|
10
|
+
__next36pxDefaultSize: { control: { type: 'boolean' } },
|
|
11
|
+
__nextUnconstrainedWidth: { control: { type: 'boolean' } },
|
|
12
|
+
size: {
|
|
13
|
+
control: {
|
|
14
|
+
type: 'radio',
|
|
15
|
+
options: [ 'small', 'default', '__unstable-large' ],
|
|
16
|
+
},
|
|
12
17
|
},
|
|
13
18
|
},
|
|
14
19
|
};
|
|
@@ -8,45 +8,20 @@
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.components-custom-select-control__button {
|
|
11
|
-
border: 1px solid $gray-700;
|
|
12
|
-
border-radius: $radius-block-ui;
|
|
13
|
-
min-width: 130px;
|
|
14
11
|
position: relative;
|
|
15
12
|
text-align: left;
|
|
13
|
+
outline: 0; // focus ring is handled elsewhere
|
|
16
14
|
|
|
17
|
-
&:not(.is-next-
|
|
18
|
-
min-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
// For all button sizes allow sufficient space for the
|
|
22
|
-
// dropdown "arrow" icon to display.
|
|
23
|
-
&.components-custom-select-control__button {
|
|
24
|
-
// TODO: Some of these can be removed after some internal inconsistencies are addressed, such as the chevron
|
|
25
|
-
// (https://github.com/WordPress/gutenberg/issues/39400) and Button padding (https://github.com/WordPress/gutenberg/issues/39431)
|
|
26
|
-
padding-left: $grid-unit-20;
|
|
27
|
-
padding-right: $icon-size + $grid-unit-10;
|
|
28
|
-
|
|
29
|
-
&:not(.is-next-36px-default-size) {
|
|
30
|
-
padding-left: $grid-unit-10;
|
|
31
|
-
padding-right: $icon-size;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
&:focus:not(:disabled) {
|
|
36
|
-
border-color: var(--wp-admin-theme-color);
|
|
37
|
-
box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color);
|
|
15
|
+
&:not(.is-next-unconstrained-width) {
|
|
16
|
+
min-width: 130px;
|
|
38
17
|
}
|
|
39
18
|
|
|
40
19
|
.components-custom-select-control__button-icon {
|
|
41
20
|
height: 100%;
|
|
42
21
|
padding: 0;
|
|
43
22
|
position: absolute;
|
|
44
|
-
right: $grid-unit-
|
|
23
|
+
right: $grid-unit-05;
|
|
45
24
|
top: 0;
|
|
46
|
-
|
|
47
|
-
&:not(.is-next-36px-default-size) {
|
|
48
|
-
right: $grid-unit-05;
|
|
49
|
-
}
|
|
50
25
|
}
|
|
51
26
|
}
|
|
52
27
|
|
package/src/divider/README.md
CHANGED
|
@@ -32,19 +32,26 @@ function Example() {
|
|
|
32
32
|
|
|
33
33
|
Adjusts all margins on the inline dimension.
|
|
34
34
|
|
|
35
|
-
-
|
|
35
|
+
- Required: No
|
|
36
|
+
|
|
37
|
+
### `marginEnd`: `number`
|
|
38
|
+
|
|
39
|
+
Adjusts the inline-end margin.
|
|
40
|
+
|
|
41
|
+
- Required: No
|
|
36
42
|
|
|
37
43
|
### `marginStart`: `number`
|
|
38
44
|
|
|
39
45
|
Adjusts the inline-start margin.
|
|
40
46
|
|
|
41
|
-
-
|
|
47
|
+
- Required: No
|
|
42
48
|
|
|
43
|
-
### `
|
|
49
|
+
### `orientation`: `horizontal | vertical`
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
Divider's orientation. When using inside a flex container, you may need to make sure the divider is `stretch` aligned in order for it to be visible.
|
|
46
52
|
|
|
47
|
-
-
|
|
53
|
+
- Required: No
|
|
54
|
+
- Default: `horizontal`
|
|
48
55
|
|
|
49
56
|
### Inherited props
|
|
50
57
|
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
WordPressComponentProps,
|
|
15
15
|
} from '../ui/context';
|
|
16
16
|
import { DividerView } from './styles';
|
|
17
|
-
import type {
|
|
17
|
+
import type { DividerProps } from './types';
|
|
18
18
|
|
|
19
19
|
function UnconnectedDivider(
|
|
20
|
-
props: WordPressComponentProps<
|
|
20
|
+
props: WordPressComponentProps< DividerProps, 'hr', false >,
|
|
21
21
|
forwardedRef: ForwardedRef< any >
|
|
22
22
|
) {
|
|
23
23
|
const contextProps = useContextSystem( props, 'Divider' );
|
|
@@ -34,7 +34,6 @@ function UnconnectedDivider(
|
|
|
34
34
|
/**
|
|
35
35
|
* `Divider` is a layout component that separates groups of related content.
|
|
36
36
|
*
|
|
37
|
-
* @example
|
|
38
37
|
* ```js
|
|
39
38
|
* import {
|
|
40
39
|
* __experimentalDivider as Divider,
|
package/src/divider/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as Divider } from './component';
|
|
2
|
-
export type {
|
|
2
|
+
export type { DividerProps } from './types';
|
|
@@ -15,13 +15,13 @@ const meta: ComponentMeta< typeof Divider > = {
|
|
|
15
15
|
title: 'Components (Experimental)/Divider',
|
|
16
16
|
argTypes: {
|
|
17
17
|
margin: {
|
|
18
|
-
control: { type: '
|
|
18
|
+
control: { type: 'text' },
|
|
19
19
|
},
|
|
20
20
|
marginStart: {
|
|
21
|
-
control: { type: '
|
|
21
|
+
control: { type: 'text' },
|
|
22
22
|
},
|
|
23
23
|
marginEnd: {
|
|
24
|
-
control: { type: '
|
|
24
|
+
control: { type: 'text' },
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
parameters: {
|
|
@@ -41,7 +41,7 @@ const Template: ComponentStory< typeof Divider > = ( args ) => (
|
|
|
41
41
|
|
|
42
42
|
export const Horizontal: ComponentStory< typeof Divider > = Template.bind( {} );
|
|
43
43
|
Horizontal.args = {
|
|
44
|
-
margin: 2,
|
|
44
|
+
margin: '2',
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export const Vertical: ComponentStory< typeof Divider > = Template.bind( {} );
|
package/src/divider/styles.ts
CHANGED
|
@@ -9,10 +9,10 @@ import { css } from '@emotion/react';
|
|
|
9
9
|
*/
|
|
10
10
|
import { space } from '../ui/utils/space';
|
|
11
11
|
import { rtl } from '../utils';
|
|
12
|
-
import type {
|
|
12
|
+
import type { DividerProps } from './types';
|
|
13
13
|
|
|
14
14
|
const MARGIN_DIRECTIONS: Record<
|
|
15
|
-
NonNullable<
|
|
15
|
+
NonNullable< DividerProps[ 'orientation' ] >,
|
|
16
16
|
Record< 'start' | 'end', string >
|
|
17
17
|
> = {
|
|
18
18
|
vertical: {
|
|
@@ -33,7 +33,7 @@ const renderMargin = ( {
|
|
|
33
33
|
margin,
|
|
34
34
|
marginStart,
|
|
35
35
|
marginEnd,
|
|
36
|
-
}:
|
|
36
|
+
}: DividerProps ) =>
|
|
37
37
|
css(
|
|
38
38
|
rtl( {
|
|
39
39
|
[ MARGIN_DIRECTIONS[ orientation ].start ]: space(
|
|
@@ -47,7 +47,7 @@ const renderMargin = ( {
|
|
|
47
47
|
|
|
48
48
|
const renderDisplay = ( {
|
|
49
49
|
'aria-orientation': orientation = 'horizontal',
|
|
50
|
-
}:
|
|
50
|
+
}: DividerProps ) => {
|
|
51
51
|
return orientation === 'vertical'
|
|
52
52
|
? css( { display: 'inline' } )
|
|
53
53
|
: undefined;
|
|
@@ -55,7 +55,7 @@ const renderDisplay = ( {
|
|
|
55
55
|
|
|
56
56
|
const renderBorder = ( {
|
|
57
57
|
'aria-orientation': orientation = 'horizontal',
|
|
58
|
-
}:
|
|
58
|
+
}: DividerProps ) => {
|
|
59
59
|
return css( {
|
|
60
60
|
[ orientation === 'vertical' ? 'borderRight' : 'borderBottom' ]:
|
|
61
61
|
'1px solid currentColor',
|
|
@@ -64,13 +64,13 @@ const renderBorder = ( {
|
|
|
64
64
|
|
|
65
65
|
const renderSize = ( {
|
|
66
66
|
'aria-orientation': orientation = 'horizontal',
|
|
67
|
-
}:
|
|
67
|
+
}: DividerProps ) =>
|
|
68
68
|
css( {
|
|
69
69
|
height: orientation === 'vertical' ? 'auto' : 0,
|
|
70
70
|
width: orientation === 'vertical' ? 0 : 'auto',
|
|
71
71
|
} );
|
|
72
72
|
|
|
73
|
-
export const DividerView = styled.hr<
|
|
73
|
+
export const DividerView = styled.hr< DividerProps >`
|
|
74
74
|
border: 0;
|
|
75
75
|
margin: 0;
|
|
76
76
|
|
|
@@ -23,14 +23,14 @@ Snapshot Diff:
|
|
|
23
23
|
- Received styles
|
|
24
24
|
+ Base styles
|
|
25
25
|
|
|
26
|
-
@@ -2,
|
|
26
|
+
@@ -2,8 +2,10 @@
|
|
27
27
|
Object {
|
|
28
28
|
"border": "0",
|
|
29
29
|
"border-bottom": "1px solid currentColor",
|
|
30
30
|
"height": "0",
|
|
31
31
|
"margin": "0",
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
+ "margin-bottom": "calc(4px * 7)",
|
|
33
|
+
+ "margin-top": "calc(4px * 7)",
|
|
34
34
|
"width": "auto",
|
|
35
35
|
},
|
|
36
36
|
]
|
|
@@ -41,13 +41,13 @@ Snapshot Diff:
|
|
|
41
41
|
- Received styles
|
|
42
42
|
+ Base styles
|
|
43
43
|
|
|
44
|
-
@@ -2,
|
|
44
|
+
@@ -2,8 +2,9 @@
|
|
45
45
|
Object {
|
|
46
46
|
"border": "0",
|
|
47
47
|
"border-bottom": "1px solid currentColor",
|
|
48
48
|
"height": "0",
|
|
49
49
|
"margin": "0",
|
|
50
|
-
|
|
50
|
+
+ "margin-bottom": "calc(4px * 5)",
|
|
51
51
|
"width": "auto",
|
|
52
52
|
},
|
|
53
53
|
]
|
|
@@ -58,13 +58,13 @@ Snapshot Diff:
|
|
|
58
58
|
- Received styles
|
|
59
59
|
+ Base styles
|
|
60
60
|
|
|
61
|
-
@@ -2,
|
|
61
|
+
@@ -2,8 +2,9 @@
|
|
62
62
|
Object {
|
|
63
63
|
"border": "0",
|
|
64
64
|
"border-bottom": "1px solid currentColor",
|
|
65
65
|
"height": "0",
|
|
66
66
|
"margin": "0",
|
|
67
|
-
|
|
67
|
+
+ "margin-top": "calc(4px * 5)",
|
|
68
68
|
"width": "auto",
|
|
69
69
|
},
|
|
70
70
|
]
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Divider } from '..';
|
|
10
|
+
|
|
11
|
+
describe( 'props', () => {
|
|
12
|
+
beforeEach( () => {
|
|
13
|
+
render( <Divider /> );
|
|
14
|
+
} );
|
|
15
|
+
|
|
16
|
+
test( 'should render correctly', () => {
|
|
17
|
+
expect( screen.getByRole( 'separator' ) ).toMatchSnapshot();
|
|
18
|
+
} );
|
|
19
|
+
|
|
20
|
+
test( 'should render marginStart', () => {
|
|
21
|
+
render( <Divider marginStart={ 5 } /> );
|
|
22
|
+
|
|
23
|
+
const dividers = screen.getAllByRole( 'separator' );
|
|
24
|
+
expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
|
|
25
|
+
} );
|
|
26
|
+
|
|
27
|
+
test( 'should render marginEnd', () => {
|
|
28
|
+
render( <Divider marginEnd={ 5 } /> );
|
|
29
|
+
|
|
30
|
+
const dividers = screen.getAllByRole( 'separator' );
|
|
31
|
+
expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
|
|
32
|
+
} );
|
|
33
|
+
|
|
34
|
+
test( 'should render margin', () => {
|
|
35
|
+
render( <Divider margin={ 7 } /> );
|
|
36
|
+
|
|
37
|
+
const dividers = screen.getAllByRole( 'separator' );
|
|
38
|
+
expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
|
|
39
|
+
} );
|
|
40
|
+
} );
|