@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
package/src/divider/types.ts
CHANGED
|
@@ -9,31 +9,37 @@ import type { SeparatorProps } from 'reakit';
|
|
|
9
9
|
*/
|
|
10
10
|
import type { SpaceInput } from '../ui/utils/space';
|
|
11
11
|
|
|
12
|
-
export
|
|
12
|
+
export type DividerProps = Omit<
|
|
13
|
+
SeparatorProps,
|
|
14
|
+
'children' | 'unstable_system' | 'orientation'
|
|
15
|
+
> & {
|
|
13
16
|
/**
|
|
14
17
|
* Adjusts all margins on the inline dimension.
|
|
18
|
+
*
|
|
19
|
+
* Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
|
|
20
|
+
* or a literal CSS value string.
|
|
15
21
|
*/
|
|
16
22
|
margin?: SpaceInput;
|
|
17
|
-
/**
|
|
18
|
-
* Adjusts the inline-start margin.
|
|
19
|
-
*/
|
|
20
|
-
marginStart?: SpaceInput;
|
|
21
23
|
/**
|
|
22
24
|
* Adjusts the inline-end margin.
|
|
25
|
+
*
|
|
26
|
+
* Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
|
|
27
|
+
* or a literal CSS value string.
|
|
23
28
|
*/
|
|
24
29
|
marginEnd?: SpaceInput;
|
|
25
30
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
31
|
+
* Adjusts the inline-start margin.
|
|
32
|
+
*
|
|
33
|
+
* Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
|
|
34
|
+
* or a literal CSS value string.
|
|
35
|
+
*/
|
|
36
|
+
marginStart?: SpaceInput;
|
|
37
|
+
/**
|
|
38
|
+
* Divider's orientation. When using inside a flex container, you may need
|
|
39
|
+
* to make sure the divider is `stretch` aligned in order for it to be
|
|
40
|
+
* visible.
|
|
28
41
|
*
|
|
29
42
|
* @default 'horizontal'
|
|
30
43
|
*/
|
|
31
44
|
orientation?: SeparatorProps[ 'orientation' ];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface Props
|
|
35
|
-
extends Omit<
|
|
36
|
-
SeparatorProps,
|
|
37
|
-
'children' | 'unstable_system' | 'orientation'
|
|
38
|
-
>,
|
|
39
|
-
OwnProps {}
|
|
45
|
+
};
|
package/src/draggable/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Draggable
|
|
2
2
|
|
|
3
|
-
`Draggable` is a Component that provides a way to set up a
|
|
3
|
+
`Draggable` is a Component that provides a way to set up a cross-browser (including IE) customisable drag image and the transfer data for the drag event. It decouples the drag handle and the element to drag: use it by wrapping the component that will become the drag handle and providing the DOM ID of the element to drag.
|
|
4
4
|
|
|
5
5
|
Note that the drag handle needs to declare the `draggable="true"` property and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable` takes care of the logic to setup the drag image and the transfer data, but is not concerned with creating an actual DOM element that is draggable.
|
|
6
6
|
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
WordPressComponentProps,
|
|
11
|
+
contextConnect,
|
|
12
|
+
useContextSystem,
|
|
13
|
+
} from '../ui/context';
|
|
14
|
+
import { DropdownContentWrapperDiv } from './styles';
|
|
15
|
+
import type { DropdownContentWrapperProps } from './types';
|
|
16
|
+
|
|
17
|
+
function UnconnectedDropdownContentWrapper(
|
|
18
|
+
props: WordPressComponentProps< DropdownContentWrapperProps, 'div', false >,
|
|
19
|
+
forwardedRef: ForwardedRef< any >
|
|
20
|
+
) {
|
|
21
|
+
const { paddingSize = 'small', ...derivedProps } = useContextSystem(
|
|
22
|
+
props,
|
|
23
|
+
'DropdownContentWrapper'
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<DropdownContentWrapperDiv
|
|
28
|
+
{ ...derivedProps }
|
|
29
|
+
paddingSize={ paddingSize }
|
|
30
|
+
ref={ forwardedRef }
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* A convenience wrapper for the `renderContent` when you want to apply
|
|
37
|
+
* different padding. (Default is `paddingSize="small"`).
|
|
38
|
+
*
|
|
39
|
+
* ```jsx
|
|
40
|
+
* import {
|
|
41
|
+
* Dropdown,
|
|
42
|
+
* __experimentalDropdownContentWrapper as DropdownContentWrapper,
|
|
43
|
+
* } from '@wordpress/components';
|
|
44
|
+
*
|
|
45
|
+
* <Dropdown
|
|
46
|
+
* renderContent={ () => (
|
|
47
|
+
* <DropdownContentWrapper paddingSize="medium">
|
|
48
|
+
* My dropdown content
|
|
49
|
+
* </DropdownContentWrapper>
|
|
50
|
+
* ) }
|
|
51
|
+
* />
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export const DropdownContentWrapper = contextConnect(
|
|
55
|
+
UnconnectedDropdownContentWrapper,
|
|
56
|
+
'DropdownContentWrapper'
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
export default DropdownContentWrapper;
|
|
@@ -1,81 +1,72 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
more,
|
|
6
|
-
arrowLeft,
|
|
7
|
-
arrowRight,
|
|
8
|
-
arrowUp,
|
|
9
|
-
arrowDown,
|
|
10
|
-
} from '@wordpress/icons';
|
|
11
|
-
|
|
12
1
|
/**
|
|
13
2
|
* Internal dependencies
|
|
14
3
|
*/
|
|
15
4
|
import Dropdown from '../';
|
|
16
5
|
import Button from '../../button';
|
|
17
|
-
import
|
|
18
|
-
import MenuItem from '../../menu-item';
|
|
19
|
-
import DropdownMenu from '../../dropdown-menu';
|
|
6
|
+
import { DropdownContentWrapper } from '../dropdown-content-wrapper';
|
|
20
7
|
|
|
21
|
-
export default {
|
|
8
|
+
export default {
|
|
9
|
+
title: 'Components/Dropdown',
|
|
10
|
+
component: Dropdown,
|
|
11
|
+
subcomponents: { DropdownContentWrapper },
|
|
12
|
+
argTypes: {
|
|
13
|
+
expandOnMobile: { control: { type: 'boolean' } },
|
|
14
|
+
focusOnMount: {
|
|
15
|
+
control: {
|
|
16
|
+
type: 'radio',
|
|
17
|
+
options: [ 'firstElement', 'container', false ],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
headerTitle: { control: { type: 'text' } },
|
|
21
|
+
renderContent: { control: { type: null } },
|
|
22
|
+
renderToggle: { control: { type: null } },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
22
25
|
|
|
23
|
-
const
|
|
26
|
+
const Template = ( args ) => {
|
|
24
27
|
return (
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
<DropdownMenu
|
|
29
|
-
icon={ more }
|
|
30
|
-
label="Select a direction"
|
|
31
|
-
controls={ [
|
|
32
|
-
{
|
|
33
|
-
title: 'Up',
|
|
34
|
-
icon: arrowUp,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: 'Right',
|
|
38
|
-
icon: arrowRight,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
title: 'Down',
|
|
42
|
-
icon: arrowDown,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
title: 'Left',
|
|
46
|
-
icon: arrowLeft,
|
|
47
|
-
},
|
|
48
|
-
] }
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
<div>
|
|
52
|
-
<p>This is an assembled Dropdown component:</p>
|
|
53
|
-
<Dropdown
|
|
54
|
-
className="my-container-class-name"
|
|
55
|
-
contentClassName="my-popover-content-classname"
|
|
56
|
-
position="bottom right"
|
|
57
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
58
|
-
<Button
|
|
59
|
-
icon={ more }
|
|
60
|
-
onClick={ onToggle }
|
|
61
|
-
aria-expanded={ isOpen }
|
|
62
|
-
label="Select a direction"
|
|
63
|
-
/>
|
|
64
|
-
) }
|
|
65
|
-
renderContent={ () => (
|
|
66
|
-
<MenuGroup>
|
|
67
|
-
<MenuItem icon={ arrowUp }>Up</MenuItem>
|
|
68
|
-
<MenuItem icon={ arrowDown }>Down</MenuItem>
|
|
69
|
-
<MenuItem icon={ arrowLeft }>Left</MenuItem>
|
|
70
|
-
<MenuItem icon={ arrowRight }>Right</MenuItem>
|
|
71
|
-
</MenuGroup>
|
|
72
|
-
) }
|
|
73
|
-
/>
|
|
74
|
-
</div>
|
|
75
|
-
</>
|
|
28
|
+
<div style={ { height: 150 } }>
|
|
29
|
+
<Dropdown { ...args } />
|
|
30
|
+
</div>
|
|
76
31
|
);
|
|
77
32
|
};
|
|
78
33
|
|
|
79
|
-
export const
|
|
80
|
-
|
|
34
|
+
export const Default = Template.bind( {} );
|
|
35
|
+
Default.args = {
|
|
36
|
+
position: 'bottom right',
|
|
37
|
+
renderToggle: ( { isOpen, onToggle } ) => (
|
|
38
|
+
<Button onClick={ onToggle } aria-expanded={ isOpen } isPrimary>
|
|
39
|
+
Open dropdown
|
|
40
|
+
</Button>
|
|
41
|
+
),
|
|
42
|
+
renderContent: () => <div>This is the dropdown content.</div>,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* To apply more padding to the dropdown content, use the provided `<DropdownContentWrapper>`
|
|
47
|
+
* convenience wrapper. A `paddingSize` of `"medium"` is suitable for relatively larger dropdowns (default is `"small"`).
|
|
48
|
+
*/
|
|
49
|
+
export const WithMorePadding = Template.bind( {} );
|
|
50
|
+
WithMorePadding.args = {
|
|
51
|
+
...Default.args,
|
|
52
|
+
renderContent: () => (
|
|
53
|
+
<DropdownContentWrapper paddingSize="medium">
|
|
54
|
+
Content wrapped with <code>{ `paddingSize="medium"` }</code>.
|
|
55
|
+
</DropdownContentWrapper>
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The `<DropdownContentWrapper>` convenience wrapper can also be used to remove padding entirely,
|
|
61
|
+
* with a `paddingSize` of `"none"`. This can also serve as a clean foundation to add arbitrary
|
|
62
|
+
* paddings, for example when child components already have padding on their own.
|
|
63
|
+
*/
|
|
64
|
+
export const WithNoPadding = Template.bind( {} );
|
|
65
|
+
WithNoPadding.args = {
|
|
66
|
+
...Default.args,
|
|
67
|
+
renderContent: () => (
|
|
68
|
+
<DropdownContentWrapper paddingSize="none">
|
|
69
|
+
Content wrapped with <code>{ `paddingSize="none"` }</code>.
|
|
70
|
+
</DropdownContentWrapper>
|
|
71
|
+
),
|
|
81
72
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { css } from '@emotion/react';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { space } from '../ui/utils/space';
|
|
11
|
+
import type { DropdownContentWrapperProps } from './types';
|
|
12
|
+
|
|
13
|
+
const padding = ( { paddingSize = 'small' }: DropdownContentWrapperProps ) => {
|
|
14
|
+
if ( paddingSize === 'none' ) return;
|
|
15
|
+
|
|
16
|
+
const paddingValues = {
|
|
17
|
+
small: space( 2 ),
|
|
18
|
+
medium: space( 4 ),
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return css`
|
|
22
|
+
padding: ${ paddingValues[ paddingSize ] || paddingValues.small };
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const DropdownContentWrapperDiv = styled.div< DropdownContentWrapperProps >`
|
|
27
|
+
// Negative margin to reset (offset) the default padding on .components-popover__content
|
|
28
|
+
margin-left: ${ space( -2 ) };
|
|
29
|
+
margin-right: ${ space( -2 ) };
|
|
30
|
+
&:first-of-type {
|
|
31
|
+
margin-top: ${ space( -2 ) };
|
|
32
|
+
}
|
|
33
|
+
&:last-of-type {
|
|
34
|
+
margin-bottom: ${ space( -2 ) };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
${ padding };
|
|
38
|
+
`;
|
package/src/elevation/README.md
CHANGED
|
@@ -33,46 +33,45 @@ function Example() {
|
|
|
33
33
|
|
|
34
34
|
Size of the shadow value when active (see the `value` and `isInteractive` props).
|
|
35
35
|
|
|
36
|
-
-
|
|
36
|
+
- Required: No
|
|
37
37
|
|
|
38
38
|
### `borderRadius`: `CSSProperties[ 'borderRadius' ]`
|
|
39
39
|
|
|
40
40
|
Renders the border-radius of the shadow.
|
|
41
41
|
|
|
42
|
-
-
|
|
43
|
-
-
|
|
42
|
+
- Required: No
|
|
43
|
+
- Default: `inherit`
|
|
44
44
|
|
|
45
45
|
### `focus`: `number`
|
|
46
46
|
|
|
47
|
-
Size of the shadow value when focused (see the `value` and `isInteractive`
|
|
47
|
+
Size of the shadow value when focused (see the `value` and `isInteractive`props).
|
|
48
48
|
|
|
49
|
-
-
|
|
49
|
+
- Required: No
|
|
50
50
|
|
|
51
51
|
### `hover`: `number`
|
|
52
52
|
|
|
53
|
-
Size of the shadow value when hovered
|
|
53
|
+
Size of the shadow value when hovered (see the `value` and `isInteractive` props).
|
|
54
54
|
|
|
55
|
-
-
|
|
55
|
+
- Required: No
|
|
56
56
|
|
|
57
57
|
### `isInteractive`: `boolean`
|
|
58
58
|
|
|
59
59
|
Determines if `hover`, `active`, and `focus` shadow values should be automatically calculated and rendered.
|
|
60
60
|
|
|
61
|
-
-
|
|
62
|
-
-
|
|
61
|
+
- Required: No
|
|
62
|
+
- Default: `false`
|
|
63
63
|
|
|
64
64
|
### `offset`: `number`
|
|
65
65
|
|
|
66
66
|
Dimensional offsets (margin) for the shadow.
|
|
67
67
|
|
|
68
|
-
-
|
|
69
|
-
-
|
|
68
|
+
- Required: No
|
|
69
|
+
- Default: `0`
|
|
70
70
|
|
|
71
|
-
### `value`
|
|
72
|
-
|
|
73
|
-
**Type**: `number`
|
|
71
|
+
### `value`: `number`
|
|
74
72
|
|
|
75
73
|
Size of the shadow, based on the Style system's elevation system. The `value` determines the strength of the shadow, which sense of depth.
|
|
74
|
+
|
|
76
75
|
In the example below, `isInteractive` is activated to give a better sense of depth.
|
|
77
76
|
|
|
78
77
|
```jsx
|
|
@@ -86,3 +85,6 @@ function Example() {
|
|
|
86
85
|
);
|
|
87
86
|
}
|
|
88
87
|
```
|
|
88
|
+
|
|
89
|
+
- Required: No
|
|
90
|
+
- Default: `0`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ForwardedRef } from 'react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { contextConnect, WordPressComponentProps } from '../ui/context';
|
|
10
|
+
import { View } from '../view';
|
|
11
|
+
import { useElevation } from './hook';
|
|
12
|
+
import type { ElevationProps } from './types';
|
|
13
|
+
|
|
14
|
+
function UnconnectedElevation(
|
|
15
|
+
props: WordPressComponentProps< ElevationProps, 'div' >,
|
|
16
|
+
forwardedRef: ForwardedRef< any >
|
|
17
|
+
) {
|
|
18
|
+
const elevationProps = useElevation( props );
|
|
19
|
+
|
|
20
|
+
return <View { ...elevationProps } ref={ forwardedRef } />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `Elevation` is a core component that renders shadow, using the component
|
|
25
|
+
* system's shadow system.
|
|
26
|
+
*
|
|
27
|
+
* The shadow effect is generated using the `value` prop.
|
|
28
|
+
*
|
|
29
|
+
* ```jsx
|
|
30
|
+
* import {
|
|
31
|
+
* __experimentalElevation as Elevation,
|
|
32
|
+
* __experimentalSurface as Surface,
|
|
33
|
+
* __experimentalText as Text,
|
|
34
|
+
* } from '@wordpress/components';
|
|
35
|
+
*
|
|
36
|
+
* function Example() {
|
|
37
|
+
* return (
|
|
38
|
+
* <Surface>
|
|
39
|
+
* <Text>Code is Poetry</Text>
|
|
40
|
+
* <Elevation value={ 5 } />
|
|
41
|
+
* </Surface>
|
|
42
|
+
* );
|
|
43
|
+
* }
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export const Elevation = contextConnect( UnconnectedElevation, 'Elevation' );
|
|
47
|
+
|
|
48
|
+
export default Elevation;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { css } from '@emotion/react';
|
|
4
|
+
import { css, SerializedStyles } from '@emotion/react';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -11,28 +11,24 @@ import { useMemo } from '@wordpress/element';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { useContextSystem } from '../ui/context';
|
|
14
|
+
import { useContextSystem, WordPressComponentProps } from '../ui/context';
|
|
15
15
|
import * as styles from './styles';
|
|
16
16
|
import { CONFIG, reduceMotion } from '../utils';
|
|
17
17
|
import { useCx } from '../utils/hooks/use-cx';
|
|
18
18
|
import { isValueDefined } from '../utils/values';
|
|
19
|
+
import type { ElevationProps } from './types';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* @return {string} The box shadow value.
|
|
23
|
-
*/
|
|
24
|
-
export function getBoxShadow( value ) {
|
|
25
|
-
const boxShadowColor = `rgba(0 ,0, 0, ${ value / 20 })`;
|
|
21
|
+
export function getBoxShadow( value: number ) {
|
|
22
|
+
const boxShadowColor = `rgba(0, 0, 0, ${ value / 20 })`;
|
|
26
23
|
const boxShadow = `0 ${ value }px ${ value * 2 }px 0
|
|
27
24
|
${ boxShadowColor }`;
|
|
28
25
|
|
|
29
26
|
return boxShadow;
|
|
30
27
|
}
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
export function useElevation( props ) {
|
|
29
|
+
export function useElevation(
|
|
30
|
+
props: WordPressComponentProps< ElevationProps, 'div' >
|
|
31
|
+
) {
|
|
36
32
|
const {
|
|
37
33
|
active,
|
|
38
34
|
borderRadius = 'inherit',
|
|
@@ -48,10 +44,12 @@ export function useElevation( props ) {
|
|
|
48
44
|
const cx = useCx();
|
|
49
45
|
|
|
50
46
|
const classes = useMemo( () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
let activeValue = isValueDefined( active )
|
|
47
|
+
let hoverValue: number | undefined = isValueDefined( hover )
|
|
48
|
+
? hover
|
|
49
|
+
: value * 2;
|
|
50
|
+
let activeValue: number | undefined = isValueDefined( active )
|
|
51
|
+
? active
|
|
52
|
+
: value / 2;
|
|
55
53
|
|
|
56
54
|
if ( ! isInteractive ) {
|
|
57
55
|
hoverValue = isValueDefined( hover ) ? hover : undefined;
|
|
@@ -60,7 +58,12 @@ export function useElevation( props ) {
|
|
|
60
58
|
|
|
61
59
|
const transition = `box-shadow ${ CONFIG.transitionDuration } ${ CONFIG.transitionTimingFunction }`;
|
|
62
60
|
|
|
63
|
-
const sx
|
|
61
|
+
const sx: {
|
|
62
|
+
Base?: SerializedStyles;
|
|
63
|
+
hover?: SerializedStyles;
|
|
64
|
+
active?: SerializedStyles;
|
|
65
|
+
focus?: SerializedStyles;
|
|
66
|
+
} = {};
|
|
64
67
|
|
|
65
68
|
sx.Base = css(
|
|
66
69
|
{
|
|
File without changes
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Elevation } from '..';
|
|
10
|
+
|
|
11
|
+
const meta: ComponentMeta< typeof Elevation > = {
|
|
12
|
+
component: Elevation,
|
|
13
|
+
title: 'Components (Experimental)/Elevation',
|
|
14
|
+
argTypes: {
|
|
15
|
+
as: { control: { type: 'text' } },
|
|
16
|
+
borderRadius: { control: { type: 'text' } },
|
|
17
|
+
},
|
|
18
|
+
parameters: {
|
|
19
|
+
controls: {
|
|
20
|
+
expanded: true,
|
|
21
|
+
},
|
|
22
|
+
docs: { source: { state: 'open' } },
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
const Template: ComponentStory< typeof Elevation > = ( args ) => {
|
|
28
|
+
return (
|
|
29
|
+
<div
|
|
30
|
+
style={ {
|
|
31
|
+
width: 150,
|
|
32
|
+
height: 150,
|
|
33
|
+
position: 'relative',
|
|
34
|
+
} }
|
|
35
|
+
>
|
|
36
|
+
<Elevation { ...args } />
|
|
37
|
+
</div>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const InteractiveTemplate: ComponentStory< typeof Elevation > = ( args ) => {
|
|
42
|
+
return (
|
|
43
|
+
<button
|
|
44
|
+
style={ {
|
|
45
|
+
border: 0,
|
|
46
|
+
background: 'transparent',
|
|
47
|
+
width: 150,
|
|
48
|
+
height: 150,
|
|
49
|
+
position: 'relative',
|
|
50
|
+
} }
|
|
51
|
+
>
|
|
52
|
+
Click me
|
|
53
|
+
<Elevation { ...args } />
|
|
54
|
+
</button>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const Default: ComponentStory< typeof Elevation > = Template.bind( {} );
|
|
59
|
+
Default.args = {
|
|
60
|
+
value: 5,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Enable the `isInteractive` prop to automatically generate values
|
|
65
|
+
* for the hover/active/focus states.
|
|
66
|
+
*/
|
|
67
|
+
export const WithInteractive: ComponentStory< typeof Elevation > =
|
|
68
|
+
InteractiveTemplate.bind( {} );
|
|
69
|
+
WithInteractive.args = {
|
|
70
|
+
...Default.args,
|
|
71
|
+
isInteractive: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* You can also provide custom values for the hover/active/focus states
|
|
76
|
+
* instead of using the `isInteractive` prop.
|
|
77
|
+
*/
|
|
78
|
+
export const WithCustomInteractive: ComponentStory< typeof Elevation > =
|
|
79
|
+
InteractiveTemplate.bind( {} );
|
|
80
|
+
WithCustomInteractive.args = {
|
|
81
|
+
...Default.args,
|
|
82
|
+
hover: 7,
|
|
83
|
+
active: 1,
|
|
84
|
+
focus: 10,
|
|
85
|
+
};
|
|
File without changes
|