@wordpress/components 23.6.0 → 23.8.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 +43 -4
- package/build/angle-picker-control/angle-circle.js +1 -4
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +10 -22
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/animate/index.js +27 -19
- package/build/animate/index.js.map +1 -1
- package/build/animate/types.js.map +1 -0
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/color-picker/color-input.js +0 -4
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/component.js +5 -4
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hsl-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/legacy-adapter.js.map +1 -1
- package/build/color-picker/picker.js.map +1 -1
- package/build/color-picker/rgb-input.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/custom-gradient-picker/constants.js +1 -1
- package/build/custom-gradient-picker/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -5
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +14 -9
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +34 -54
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +45 -16
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +10 -4
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build/custom-gradient-picker/types.js +6 -0
- package/build/custom-gradient-picker/types.js.map +1 -0
- package/build/custom-gradient-picker/utils.js +17 -12
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/drop-zone/index.js +8 -8
- package/build/drop-zone/index.js.map +1 -1
- package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build/duotone-picker/color-list-picker/types.js +6 -0
- package/build/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +39 -2
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/duotone-picker/index.js.map +1 -1
- package/build/duotone-picker/types.js +6 -0
- package/build/duotone-picker/types.js.map +1 -0
- package/build/duotone-picker/utils.js +13 -11
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +9 -3
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +61 -9
- package/build/gradient-picker/index.js.map +1 -1
- package/build/gradient-picker/types.js +6 -0
- package/build/gradient-picker/types.js.map +1 -0
- package/build/index.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.android.js +0 -4
- package/build/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +100 -55
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +82 -0
- package/build/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +85 -0
- package/build/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +44 -0
- package/build/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js.map +1 -0
- package/build/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +53 -0
- package/build/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js.map +1 -0
- package/build/navigator/navigator-provider/component.js +4 -2
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +4 -3
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/palette-edit/index.js +1 -2
- package/build/palette-edit/index.js.map +1 -1
- package/build/private-apis.js.map +1 -1
- package/build/query-controls/author-select.js +2 -1
- package/build/query-controls/author-select.js.map +1 -1
- package/build/query-controls/category-select.js +3 -1
- package/build/query-controls/category-select.js.map +1 -1
- package/build/query-controls/index.js +7 -1
- package/build/query-controls/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/sandbox/index.native.js +129 -93
- package/build/sandbox/index.native.js.map +1 -1
- package/build/tab-panel/index.js +1 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +45 -6
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/utils/input/input-control.js +1 -1
- package/build/utils/input/input-control.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +1 -4
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +12 -21
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/animate/index.js +25 -17
- package/build-module/animate/index.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/color-picker/color-input.js +0 -4
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/component.js +3 -3
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hsl-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/legacy-adapter.js.map +1 -1
- package/build-module/color-picker/picker.js +4 -0
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/color-picker/rgb-input.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/custom-gradient-picker/constants.js +1 -1
- package/build-module/custom-gradient-picker/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -4
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -8
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -54
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +44 -17
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +10 -4
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build-module/custom-gradient-picker/types.js +2 -0
- package/build-module/custom-gradient-picker/utils.js +17 -12
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/drop-zone/index.js +8 -8
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build-module/duotone-picker/color-list-picker/types.js +2 -0
- package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +38 -2
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/duotone-picker/index.js.map +1 -1
- package/build-module/duotone-picker/types.js +2 -0
- package/build-module/duotone-picker/types.js.map +1 -0
- package/build-module/duotone-picker/utils.js +17 -11
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +9 -4
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +61 -10
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/gradient-picker/types.js +2 -0
- package/build-module/gradient-picker/types.js.map +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js +0 -4
- package/build-module/mobile/keyboard-aware-flat-list/index.android.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +97 -54
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +73 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +76 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +33 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js.map +1 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +40 -0
- package/build-module/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js.map +1 -0
- package/build-module/navigator/navigator-provider/component.js +4 -2
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +4 -3
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -2
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/query-controls/author-select.js +2 -1
- package/build-module/query-controls/author-select.js.map +1 -1
- package/build-module/query-controls/category-select.js +3 -1
- package/build-module/query-controls/category-select.js.map +1 -1
- package/build-module/query-controls/index.js +7 -2
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/sandbox/index.native.js +121 -87
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +45 -6
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/utils/input/input-control.js +1 -1
- package/build-module/utils/input/input-control.js.map +1 -1
- package/build-style/style-rtl.css +41 -29
- package/build-style/style.css +43 -29
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +6 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/animate/index.d.ts +27 -22
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/animate/stories/index.d.ts +18 -0
- package/build-types/animate/stories/index.d.ts.map +1 -0
- package/build-types/animate/types.d.ts +30 -0
- package/build-types/animate/types.d.ts.map +1 -0
- package/build-types/border-box-control/border-box-control/hook.d.ts +2 -2
- package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +2 -2
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +2 -2
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +2 -2
- package/build-types/border-control/border-control/hook.d.ts +2 -2
- package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
- package/build-types/border-control/border-control-style-picker/hook.d.ts +2 -2
- package/build-types/box-control/styles/box-control-styles.d.ts +5 -5
- package/build-types/button/deprecated.d.ts +2 -2
- package/build-types/card/card/hook.d.ts +2 -2
- package/build-types/card/card-body/hook.d.ts +2 -2
- package/build-types/card/card-divider/hook.d.ts +2 -2
- package/build-types/card/card-footer/hook.d.ts +2 -2
- package/build-types/card/card-header/hook.d.ts +2 -2
- package/build-types/card/card-media/hook.d.ts +2 -2
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-picker/color-input.d.ts +1 -11
- package/build-types/color-picker/color-input.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +8 -9
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts +1 -10
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/hsl-input.d.ts +1 -10
- package/build-types/color-picker/hsl-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts +1 -9
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/legacy-adapter.d.ts +1 -3
- package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
- package/build-types/color-picker/picker.d.ts +4 -7
- package/build-types/color-picker/picker.d.ts.map +1 -1
- package/build-types/color-picker/rgb-input.d.ts +1 -10
- package/build-types/color-picker/rgb-input.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.d.ts +19 -0
- package/build-types/color-picker/stories/index.d.ts.map +1 -0
- package/build-types/color-picker/styles.d.ts +5 -5
- package/build-types/color-picker/test/index.d.ts +2 -0
- package/build-types/color-picker/test/index.d.ts.map +1 -0
- package/build-types/color-picker/types.d.ts +105 -1
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/combobox-control/styles.d.ts +1 -1
- package/build-types/custom-gradient-picker/constants.d.ts +8 -8
- package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +7 -7
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +5 -22
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +3 -9
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +44 -92
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/index.d.ts +27 -6
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/serializer.d.ts +9 -16
- package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
- package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +3 -2
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/types.d.ts +118 -0
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/utils.d.ts +12 -4
- package/build-types/custom-gradient-picker/utils.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +2 -2
- package/build-types/date-time/date-time/styles.d.ts +1 -1
- package/build-types/date-time/time/styles.d.ts +8 -8
- package/build-types/drop-zone/index.d.ts.map +1 -1
- package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
- package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +2 -2
- package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/index.d.ts +3 -0
- package/build-types/duotone-picker/index.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/types.d.ts +60 -0
- package/build-types/duotone-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/utils.d.ts +52 -0
- package/build-types/duotone-picker/utils.d.ts.map +1 -0
- package/build-types/elevation/hook.d.ts +2 -2
- package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
- package/build-types/flex/flex/hook.d.ts +2 -2
- package/build-types/flex/flex-block/hook.d.ts +2 -2
- package/build-types/flex/flex-item/hook.d.ts +2 -2
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -2
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/styles.d.ts +1 -1
- package/build-types/form-token-field/types.d.ts +6 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +49 -11
- package/build-types/gradient-picker/index.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.d.ts +14 -0
- package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/gradient-picker/types.d.ts +87 -0
- package/build-types/gradient-picker/types.d.ts.map +1 -0
- package/build-types/grid/hook.d.ts +2 -2
- package/build-types/h-stack/hook.d.ts +2 -2
- package/build-types/heading/hook.d.ts +2 -2
- package/build-types/index.d.ts +128 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
- package/build-types/item-group/item/hook.d.ts +2 -2
- package/build-types/item-group/item-group/hook.d.ts +2 -2
- package/build-types/navigation/styles/navigation-styles.d.ts +2 -2
- package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
- package/build-types/navigator/navigator-button/hook.d.ts +2 -2
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/navigator/stories/index.d.ts +1 -0
- package/build-types/navigator/stories/index.d.ts.map +1 -1
- package/build-types/navigator/types.d.ts +2 -2
- package/build-types/navigator/types.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +2 -2
- package/build-types/number-control/stories/index.d.ts +2 -2
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/palette-edit/styles.d.ts +3 -3
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/stories/e2e/index.d.ts +1 -1
- package/build-types/private-apis.d.ts +2 -3
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/query-controls/author-select.d.ts.map +1 -1
- package/build-types/query-controls/category-select.d.ts.map +1 -1
- package/build-types/query-controls/index.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +2 -2
- package/build-types/resizable-box/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/resizable-box/stories/index.d.ts +2 -2
- package/build-types/scrollable/hook.d.ts +2 -2
- package/build-types/search-control/index.d.ts +1 -1
- package/build-types/search-control/stories/index.d.ts +2 -2
- package/build-types/spacer/hook.d.ts +2 -2
- package/build-types/spinner/index.d.ts +1 -1
- package/build-types/surface/hook.d.ts +2 -2
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +2 -2
- package/build-types/text-control/index.d.ts +1 -1
- package/build-types/toolbar/toolbar-button/index.d.ts +2 -2
- package/build-types/tools-panel/tools-panel/hook.d.ts +2 -2
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -2
- package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -2
- package/build-types/tools-panel/types.d.ts +1 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +2 -2
- package/build-types/ui/control-group/hook.d.ts +2 -2
- package/build-types/ui/control-label/hook.d.ts +2 -2
- package/build-types/ui/form-group/form-group.d.ts +2 -2
- package/build-types/ui/form-group/use-form-group.d.ts +2 -2
- package/build-types/unit-control/index.d.ts +1 -1
- package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -2
- package/build-types/utils/input/input-control.d.ts.map +1 -1
- package/build-types/v-stack/hook.d.ts +2 -2
- package/package.json +20 -19
- package/src/angle-picker-control/angle-circle.tsx +0 -1
- package/src/angle-picker-control/index.tsx +14 -27
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
- package/src/animate/index.tsx +75 -0
- package/src/animate/stories/index.tsx +102 -0
- package/src/animate/types.ts +32 -0
- package/src/border-box-control/stories/index.tsx +1 -1
- package/src/box-control/axial-input-controls.tsx +1 -1
- package/src/circular-option-picker/style.scss +10 -0
- package/src/color-indicator/style.scss +1 -0
- package/src/color-picker/README.md +2 -2
- package/src/color-picker/color-input.tsx +1 -12
- package/src/color-picker/component.tsx +9 -18
- package/src/color-picker/hex-input.tsx +2 -7
- package/src/color-picker/hsl-input.tsx +2 -7
- package/src/color-picker/input-with-slider.tsx +1 -9
- package/src/color-picker/legacy-adapter.tsx +1 -2
- package/src/color-picker/picker.tsx +5 -6
- package/src/color-picker/rgb-input.tsx +2 -7
- package/src/color-picker/stories/index.tsx +51 -0
- package/src/color-picker/test/{index.js → index.tsx} +36 -18
- package/src/color-picker/types.ts +128 -1
- package/src/color-picker/use-deprecated-props.ts +2 -53
- package/src/combobox-control/stories/index.tsx +1 -1
- package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
- package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -134
- package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -10
- package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
- package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
- package/src/custom-gradient-picker/{index.js → index.tsx} +63 -22
- package/src/custom-gradient-picker/serializer.ts +78 -0
- package/src/custom-gradient-picker/stories/index.tsx +45 -0
- package/src/custom-gradient-picker/style.scss +25 -4
- package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
- package/src/custom-gradient-picker/types.ts +119 -0
- package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -22
- package/src/custom-select-control/test/index.js +6 -4
- package/src/drop-zone/index.tsx +12 -8
- package/src/drop-zone/style.scss +1 -1
- package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
- package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
- package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
- package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
- package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
- package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
- package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
- package/src/duotone-picker/types.ts +61 -0
- package/src/duotone-picker/{utils.js → utils.ts} +29 -14
- package/src/flex/flex-item/README.md +1 -1
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +10 -3
- package/src/form-token-field/style.scss +0 -7
- package/src/form-token-field/test/index.tsx +1 -0
- package/src/form-token-field/types.ts +6 -0
- package/src/gradient-picker/README.md +16 -23
- package/src/gradient-picker/{index.js → index.tsx} +70 -16
- package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
- package/src/gradient-picker/types.ts +89 -0
- package/src/item-group/test/index.js +5 -3
- package/src/mobile/keyboard-aware-flat-list/index.android.js +0 -4
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +118 -67
- package/src/mobile/keyboard-aware-flat-list/test/use-keyboard-offset.native.js +203 -0
- package/src/mobile/keyboard-aware-flat-list/test/use-scroll-to-text-input.native.js +140 -0
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-caret-position.native.js +82 -0
- package/src/mobile/keyboard-aware-flat-list/test/use-text-input-offset.native.js +147 -0
- package/src/mobile/keyboard-aware-flat-list/use-keyboard-offset.native.js +87 -0
- package/src/mobile/keyboard-aware-flat-list/use-scroll-to-text-input.native.js +105 -0
- package/src/mobile/keyboard-aware-flat-list/use-text-input-caret-position.native.js +36 -0
- package/src/mobile/keyboard-aware-flat-list/use-text-input-offset.native.js +54 -0
- package/src/navigator/navigator-provider/component.tsx +2 -0
- package/src/navigator/navigator-screen/component.tsx +5 -2
- package/src/navigator/stories/index.tsx +68 -0
- package/src/navigator/test/index.tsx +52 -0
- package/src/navigator/types.ts +2 -1
- package/src/palette-edit/index.tsx +4 -5
- package/src/query-controls/author-select.tsx +1 -0
- package/src/query-controls/category-select.tsx +1 -0
- package/src/query-controls/index.tsx +4 -2
- package/src/resizable-box/resize-tooltip/utils.ts +1 -1
- package/src/sandbox/index.native.js +139 -112
- package/src/slot-fill/test/slot.js +8 -6
- package/src/style.scss +1 -1
- package/src/tab-panel/index.tsx +7 -2
- package/src/tools-panel/test/index.tsx +86 -0
- package/src/tools-panel/tools-panel/hook.ts +44 -4
- package/src/tools-panel/types.ts +1 -0
- package/src/tooltip/test/index.js +251 -301
- package/src/utils/input/input-control.js +1 -0
- package/tsconfig.json +1 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/color-list-picker/index.js.map +0 -1
- package/build-module/color-list-picker/index.js.map +0 -1
- package/build-types/color-list-picker/index.d.ts.map +0 -1
- package/build-types/color-list-picker/types.d.ts.map +0 -1
- package/src/animate/index.js +0 -60
- package/src/animate/stories/index.js +0 -53
- package/src/color-picker/stories/index.js +0 -41
- package/src/custom-gradient-picker/gradient-bar/utils.js +0 -189
- package/src/custom-gradient-picker/serializer.js +0 -48
- package/src/custom-gradient-picker/stories/index.js +0 -33
- /package/build/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
- /package/{build/color-list-picker → build-module/custom-gradient-picker}/types.js.map +0 -0
- /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
- /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
- /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
- /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
- /package/src/duotone-picker/{index.js → index.ts} +0 -0
- /package/src/{index.js → index.ts} +0 -0
- /package/src/{private-apis.js → private-apis.ts} +0 -0
|
@@ -10,12 +10,13 @@ import styled from '@emotion/styled';
|
|
|
10
10
|
import { Flex } from '../../flex';
|
|
11
11
|
import { COLORS } from '../../utils';
|
|
12
12
|
import { space } from '../../ui/utils/space';
|
|
13
|
+
import { Text } from '../../text';
|
|
13
14
|
import CONFIG from '../../utils/config-values';
|
|
14
15
|
|
|
15
16
|
import type { AnglePickerControlProps } from '../types';
|
|
16
17
|
|
|
17
18
|
const CIRCLE_SIZE = 32;
|
|
18
|
-
const INNER_CIRCLE_SIZE =
|
|
19
|
+
const INNER_CIRCLE_SIZE = 6;
|
|
19
20
|
|
|
20
21
|
const deprecatedBottomMargin = ( {
|
|
21
22
|
__nextHasNoMarginBottom,
|
|
@@ -39,6 +40,10 @@ export const CircleRoot = styled.div`
|
|
|
39
40
|
height: ${ CIRCLE_SIZE }px;
|
|
40
41
|
overflow: hidden;
|
|
41
42
|
width: ${ CIRCLE_SIZE }px;
|
|
43
|
+
|
|
44
|
+
:active {
|
|
45
|
+
cursor: grabbing;
|
|
46
|
+
}
|
|
42
47
|
`;
|
|
43
48
|
|
|
44
49
|
export const CircleIndicatorWrapper = styled.div`
|
|
@@ -55,15 +60,17 @@ export const CircleIndicatorWrapper = styled.div`
|
|
|
55
60
|
export const CircleIndicator = styled.div`
|
|
56
61
|
background: ${ COLORS.ui.theme };
|
|
57
62
|
border-radius: 50%;
|
|
58
|
-
border: ${ INNER_CIRCLE_SIZE }px solid ${ COLORS.ui.theme };
|
|
59
|
-
bottom: 0;
|
|
60
63
|
box-sizing: border-box;
|
|
61
64
|
display: block;
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
left: 50%;
|
|
66
|
+
top: 4px;
|
|
67
|
+
transform: translateX( -50% );
|
|
65
68
|
position: absolute;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
width: ${ INNER_CIRCLE_SIZE }px;
|
|
70
|
+
height: ${ INNER_CIRCLE_SIZE }px;
|
|
71
|
+
`;
|
|
72
|
+
|
|
73
|
+
export const UnitText = styled( Text )`
|
|
74
|
+
color: ${ COLORS.ui.theme };
|
|
75
|
+
margin-right: ${ space( 3 ) };
|
|
69
76
|
`;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import type { AnimateProps, GetAnimateOptions } from './types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param type The animation type
|
|
13
|
+
* @return Default origin
|
|
14
|
+
*/
|
|
15
|
+
function getDefaultOrigin( type?: GetAnimateOptions[ 'type' ] ) {
|
|
16
|
+
return type === 'appear' ? 'top' : 'left';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @param options
|
|
21
|
+
*
|
|
22
|
+
* @return ClassName that applies the animations
|
|
23
|
+
*/
|
|
24
|
+
export function getAnimateClassName( options: GetAnimateOptions ) {
|
|
25
|
+
if ( options.type === 'loading' ) {
|
|
26
|
+
return classnames( 'components-animate__loading' );
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { type, origin = getDefaultOrigin( type ) } = options;
|
|
30
|
+
|
|
31
|
+
if ( type === 'appear' ) {
|
|
32
|
+
const [ yAxis, xAxis = 'center' ] = origin.split( ' ' );
|
|
33
|
+
return classnames( 'components-animate__appear', {
|
|
34
|
+
[ 'is-from-' + xAxis ]: xAxis !== 'center',
|
|
35
|
+
[ 'is-from-' + yAxis ]: yAxis !== 'middle',
|
|
36
|
+
} );
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ( type === 'slide-in' ) {
|
|
40
|
+
return classnames(
|
|
41
|
+
'components-animate__slide-in',
|
|
42
|
+
'is-from-' + origin
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Simple interface to introduce animations to components.
|
|
51
|
+
*
|
|
52
|
+
* ```jsx
|
|
53
|
+
* import { Animate, Notice } from '@wordpress/components';
|
|
54
|
+
*
|
|
55
|
+
* const MyAnimatedNotice = () => (
|
|
56
|
+
* <Animate type="slide-in" options={ { origin: 'top' } }>
|
|
57
|
+
* { ( { className } ) => (
|
|
58
|
+
* <Notice className={ className } status="success">
|
|
59
|
+
* <p>Animation finished.</p>
|
|
60
|
+
* </Notice>
|
|
61
|
+
* ) }
|
|
62
|
+
* </Animate>
|
|
63
|
+
* );
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export function Animate( { type, options = {}, children }: AnimateProps ) {
|
|
67
|
+
return children( {
|
|
68
|
+
className: getAnimateClassName( {
|
|
69
|
+
type,
|
|
70
|
+
...options,
|
|
71
|
+
} as GetAnimateOptions ),
|
|
72
|
+
} );
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default Animate;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Animate } from '..';
|
|
10
|
+
import Notice from '../../notice';
|
|
11
|
+
|
|
12
|
+
const meta: ComponentMeta< typeof Animate > = {
|
|
13
|
+
title: 'Components/Animate',
|
|
14
|
+
component: Animate,
|
|
15
|
+
parameters: {
|
|
16
|
+
controls: { expanded: true },
|
|
17
|
+
docs: { source: { state: 'open' } },
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
|
|
22
|
+
const Template: ComponentStory< typeof Animate > = ( props ) => (
|
|
23
|
+
<Animate { ...props } />
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const Default: ComponentStory< typeof Animate > = Template.bind( {} );
|
|
27
|
+
Default.args = {
|
|
28
|
+
children: ( { className } ) => (
|
|
29
|
+
<Notice className={ className } status="success">
|
|
30
|
+
<p>{ `No default animation. Use one of type = "appear", "slide-in", or "loading".` }</p>
|
|
31
|
+
</Notice>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const AppearTopLeft: ComponentStory< typeof Animate > = Template.bind(
|
|
36
|
+
{}
|
|
37
|
+
);
|
|
38
|
+
AppearTopLeft.args = {
|
|
39
|
+
type: 'appear',
|
|
40
|
+
options: { origin: 'top left' },
|
|
41
|
+
children: ( { className } ) => (
|
|
42
|
+
<Notice className={ className } status="success">
|
|
43
|
+
<p>Appear animation. Origin: top left.</p>
|
|
44
|
+
</Notice>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
export const AppearTopRight: ComponentStory< typeof Animate > = Template.bind(
|
|
48
|
+
{}
|
|
49
|
+
);
|
|
50
|
+
AppearTopRight.args = {
|
|
51
|
+
type: 'appear',
|
|
52
|
+
options: { origin: 'top right' },
|
|
53
|
+
children: ( { className } ) => (
|
|
54
|
+
<Notice className={ className } status="success">
|
|
55
|
+
<p>Appear animation. Origin: top right.</p>
|
|
56
|
+
</Notice>
|
|
57
|
+
),
|
|
58
|
+
};
|
|
59
|
+
export const AppearBottomLeft: ComponentStory< typeof Animate > = Template.bind(
|
|
60
|
+
{}
|
|
61
|
+
);
|
|
62
|
+
AppearBottomLeft.args = {
|
|
63
|
+
type: 'appear',
|
|
64
|
+
options: { origin: 'bottom left' },
|
|
65
|
+
children: ( { className } ) => (
|
|
66
|
+
<Notice className={ className } status="success">
|
|
67
|
+
<p>Appear animation. Origin: bottom left.</p>
|
|
68
|
+
</Notice>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
export const AppearBottomRight: ComponentStory< typeof Animate > =
|
|
72
|
+
Template.bind( {} );
|
|
73
|
+
AppearBottomRight.args = {
|
|
74
|
+
type: 'appear',
|
|
75
|
+
options: { origin: 'bottom right' },
|
|
76
|
+
children: ( { className } ) => (
|
|
77
|
+
<Notice className={ className } status="success">
|
|
78
|
+
<p>Appear animation. Origin: bottom right.</p>
|
|
79
|
+
</Notice>
|
|
80
|
+
),
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export const Loading: ComponentStory< typeof Animate > = Template.bind( {} );
|
|
84
|
+
Loading.args = {
|
|
85
|
+
type: 'loading',
|
|
86
|
+
children: ( { className } ) => (
|
|
87
|
+
<Notice className={ className } status="success">
|
|
88
|
+
<p>Loading animation.</p>
|
|
89
|
+
</Notice>
|
|
90
|
+
),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const SlideIn: ComponentStory< typeof Animate > = Template.bind( {} );
|
|
94
|
+
SlideIn.args = {
|
|
95
|
+
type: 'slide-in',
|
|
96
|
+
options: { origin: 'left' },
|
|
97
|
+
children: ( { className } ) => (
|
|
98
|
+
<Notice className={ className } status="success">
|
|
99
|
+
<p>Slide-in animation.</p>
|
|
100
|
+
</Notice>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type AppearOptions = {
|
|
2
|
+
type: 'appear';
|
|
3
|
+
origin?:
|
|
4
|
+
| 'top'
|
|
5
|
+
| 'top left'
|
|
6
|
+
| 'top right'
|
|
7
|
+
| 'middle'
|
|
8
|
+
| 'middle left'
|
|
9
|
+
| 'middle right'
|
|
10
|
+
| 'bottom'
|
|
11
|
+
| 'bottom left'
|
|
12
|
+
| 'bottom right';
|
|
13
|
+
};
|
|
14
|
+
type SlideInOptions = { type: 'slide-in'; origin?: 'left' | 'right' };
|
|
15
|
+
type LoadingOptions = { type: 'loading'; origin?: never };
|
|
16
|
+
type NoAnimationOptions = { type?: never; origin?: never };
|
|
17
|
+
|
|
18
|
+
export type GetAnimateOptions =
|
|
19
|
+
| AppearOptions
|
|
20
|
+
| SlideInOptions
|
|
21
|
+
| LoadingOptions
|
|
22
|
+
| NoAnimationOptions;
|
|
23
|
+
|
|
24
|
+
// Create a new type that and distributes the `Pick` operator separately to
|
|
25
|
+
// every individual type of a union, thus preserving that same union.
|
|
26
|
+
type DistributiveTypeAndOptions< T extends { type?: any } > = T extends any
|
|
27
|
+
? Pick< T, 'type' > & { options?: Omit< T, 'type' > }
|
|
28
|
+
: never;
|
|
29
|
+
|
|
30
|
+
export type AnimateProps = DistributiveTypeAndOptions< GetAnimateOptions > & {
|
|
31
|
+
children: ( props: { className?: string } ) => JSX.Element;
|
|
32
|
+
};
|
|
@@ -43,7 +43,7 @@ const colors = [
|
|
|
43
43
|
|
|
44
44
|
const Template: ComponentStory< typeof BorderBoxControl > = ( props ) => {
|
|
45
45
|
const { onChange, ...otherProps } = props;
|
|
46
|
-
const [ borders, setBorders ] = useState< typeof props[ 'value' ] >();
|
|
46
|
+
const [ borders, setBorders ] = useState< ( typeof props )[ 'value' ] >();
|
|
47
47
|
|
|
48
48
|
const onChangeMerged: ComponentProps<
|
|
49
49
|
typeof BorderBoxControl
|
|
@@ -8,7 +8,7 @@ import { Layout } from './styles/box-control-styles';
|
|
|
8
8
|
import type { BoxControlInputControlProps } from './types';
|
|
9
9
|
|
|
10
10
|
const groupedSides = [ 'vertical', 'horizontal' ] as const;
|
|
11
|
-
type GroupedSide = typeof groupedSides[ number ];
|
|
11
|
+
type GroupedSide = ( typeof groupedSides )[ number ];
|
|
12
12
|
|
|
13
13
|
export default function AxialInputControls( {
|
|
14
14
|
onChange,
|
|
@@ -16,6 +16,16 @@ $color-palette-circle-spacing: 12px;
|
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-wrap: wrap;
|
|
18
18
|
gap: $color-palette-circle-spacing;
|
|
19
|
+
position: relative;
|
|
20
|
+
z-index: z-index(".components-circular-option-picker__swatches");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Make sure that the .components-circular-option-picker__swatches element
|
|
24
|
+
// renders visually on top of its siblings. This is necessary to make sure
|
|
25
|
+
// that the tooltip rendered when hovering an `Option` always appears on top.
|
|
26
|
+
> *:not(.components-circular-option-picker__swatches) {
|
|
27
|
+
position: relative;
|
|
28
|
+
z-index: z-index("> *:not(.components-circular-option-picker__swatches)");
|
|
19
29
|
}
|
|
20
30
|
}
|
|
21
31
|
|
|
@@ -31,13 +31,13 @@ The current color value to display in the picker. Must be a hex or hex8 string.
|
|
|
31
31
|
|
|
32
32
|
### `onChange`: `(hex8Color: string) => void`
|
|
33
33
|
|
|
34
|
-
Fired when the color changes. Always passes a hex8 color string.
|
|
34
|
+
Fired when the color changes. Always passes a hex or hex8 color string.
|
|
35
35
|
|
|
36
36
|
- Required: No
|
|
37
37
|
|
|
38
38
|
### `enableAlpha`: `boolean`
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
When `true` the color picker will display the alpha channel both in the bottom inputs as well as in the color picker itself.
|
|
41
41
|
|
|
42
42
|
- Required: No
|
|
43
43
|
- Default: `false`
|
|
@@ -1,21 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import type { Colord } from 'colord';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { RgbInput } from './rgb-input';
|
|
10
5
|
import { HslInput } from './hsl-input';
|
|
11
6
|
import { HexInput } from './hex-input';
|
|
12
|
-
|
|
13
|
-
interface ColorInputProps {
|
|
14
|
-
colorType: 'hsl' | 'hex' | 'rgb';
|
|
15
|
-
color: Colord;
|
|
16
|
-
onChange: ( nextColor: Colord ) => void;
|
|
17
|
-
enableAlpha: boolean;
|
|
18
|
-
}
|
|
7
|
+
import type { ColorInputProps } from './types';
|
|
19
8
|
|
|
20
9
|
export const ColorInput = ( {
|
|
21
10
|
colorType,
|
|
@@ -15,11 +15,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
import {
|
|
19
|
-
useContextSystem,
|
|
20
|
-
contextConnect,
|
|
21
|
-
WordPressComponentProps,
|
|
22
|
-
} from '../ui/context';
|
|
18
|
+
import { useContextSystem, contextConnect } from '../ui/context';
|
|
23
19
|
import {
|
|
24
20
|
ColorfulWrapper,
|
|
25
21
|
SelectControl,
|
|
@@ -32,26 +28,18 @@ import { ColorInput } from './color-input';
|
|
|
32
28
|
import { Picker } from './picker';
|
|
33
29
|
import { useControlledValue } from '../utils/hooks';
|
|
34
30
|
|
|
35
|
-
import type { ColorType } from './types';
|
|
31
|
+
import type { ColorPickerProps, ColorType } from './types';
|
|
36
32
|
|
|
37
33
|
extend( [ namesPlugin ] );
|
|
38
34
|
|
|
39
|
-
export interface ColorPickerProps {
|
|
40
|
-
enableAlpha?: boolean;
|
|
41
|
-
color?: string;
|
|
42
|
-
onChange?: ( color: string ) => void;
|
|
43
|
-
defaultValue?: string;
|
|
44
|
-
copyFormat?: ColorType;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
35
|
const options = [
|
|
48
36
|
{ label: 'RGB', value: 'rgb' as const },
|
|
49
37
|
{ label: 'HSL', value: 'hsl' as const },
|
|
50
38
|
{ label: 'Hex', value: 'hex' as const },
|
|
51
39
|
];
|
|
52
40
|
|
|
53
|
-
const
|
|
54
|
-
props:
|
|
41
|
+
const UnconnectedColorPicker = (
|
|
42
|
+
props: ColorPickerProps,
|
|
55
43
|
forwardedRef: ForwardedRef< any >
|
|
56
44
|
) => {
|
|
57
45
|
const {
|
|
@@ -124,6 +112,9 @@ const ColorPicker = (
|
|
|
124
112
|
);
|
|
125
113
|
};
|
|
126
114
|
|
|
127
|
-
const
|
|
115
|
+
export const ColorPicker = contextConnect(
|
|
116
|
+
UnconnectedColorPicker,
|
|
117
|
+
'ColorPicker'
|
|
118
|
+
);
|
|
128
119
|
|
|
129
|
-
export default
|
|
120
|
+
export default ColorPicker;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { colord
|
|
4
|
+
import { colord } from 'colord';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -17,12 +17,7 @@ import { Spacer } from '../spacer';
|
|
|
17
17
|
import { space } from '../ui/utils/space';
|
|
18
18
|
import { COLORS } from '../utils/colors-values';
|
|
19
19
|
import type { StateReducer } from '../input-control/reducer/state';
|
|
20
|
-
|
|
21
|
-
interface HexInputProps {
|
|
22
|
-
color: Colord;
|
|
23
|
-
onChange: ( nextColor: Colord ) => void;
|
|
24
|
-
enableAlpha: boolean;
|
|
25
|
-
}
|
|
20
|
+
import type { HexInputProps } from './types';
|
|
26
21
|
|
|
27
22
|
export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
|
|
28
23
|
const handleChange = ( nextValue: string | undefined ) => {
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { colord
|
|
4
|
+
import { colord } from 'colord';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { InputWithSlider } from './input-with-slider';
|
|
10
|
-
|
|
11
|
-
interface HslInputProps {
|
|
12
|
-
color: Colord;
|
|
13
|
-
onChange: ( nextColor: Colord ) => void;
|
|
14
|
-
enableAlpha: boolean;
|
|
15
|
-
}
|
|
10
|
+
import type { HslInputProps } from './types';
|
|
16
11
|
|
|
17
12
|
export const HslInput = ( { color, onChange, enableAlpha }: HslInputProps ) => {
|
|
18
13
|
const { h, s, l, a } = color.toHsl();
|
|
@@ -7,15 +7,7 @@ import { Spacer } from '../spacer';
|
|
|
7
7
|
import { space } from '../ui/utils/space';
|
|
8
8
|
import { RangeControl, NumberControlWrapper } from './styles';
|
|
9
9
|
import { COLORS } from '../utils/colors-values';
|
|
10
|
-
|
|
11
|
-
interface InputWithSliderProps {
|
|
12
|
-
min: number;
|
|
13
|
-
max: number;
|
|
14
|
-
value: number;
|
|
15
|
-
label: string;
|
|
16
|
-
abbreviation: string;
|
|
17
|
-
onChange: ( value: number ) => void;
|
|
18
|
-
}
|
|
10
|
+
import type { InputWithSliderProps } from './types';
|
|
19
11
|
|
|
20
12
|
export const InputWithSlider = ( {
|
|
21
13
|
min,
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
4
|
import ColorPicker from './component';
|
|
5
|
+
import type { LegacyAdapterProps } from './types';
|
|
5
6
|
import { useDeprecatedProps } from './use-deprecated-props';
|
|
6
7
|
|
|
7
|
-
type LegacyAdapterProps = Parameters< typeof useDeprecatedProps >[ 0 ];
|
|
8
|
-
|
|
9
8
|
export const LegacyAdapter = ( props: LegacyAdapterProps ) => {
|
|
10
9
|
return <ColorPicker { ...useDeprecatedProps( props ) } />;
|
|
11
10
|
};
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { RgbStringColorPicker, RgbaStringColorPicker } from 'react-colorful';
|
|
5
|
-
import { colord
|
|
5
|
+
import { colord } from 'colord';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { useMemo } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import type { PickerProps } from './types';
|
|
16
15
|
|
|
17
16
|
export const Picker = ( { color, enableAlpha, onChange }: PickerProps ) => {
|
|
18
17
|
const Component = enableAlpha
|
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { colord
|
|
4
|
+
import { colord } from 'colord';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { InputWithSlider } from './input-with-slider';
|
|
10
|
-
|
|
11
|
-
interface RgbInputProps {
|
|
12
|
-
color: Colord;
|
|
13
|
-
onChange: ( nextColor: Colord ) => void;
|
|
14
|
-
enableAlpha: boolean;
|
|
15
|
-
}
|
|
10
|
+
import type { RgbInputProps } from './types';
|
|
16
11
|
|
|
17
12
|
export const RgbInput = ( { color, onChange, enableAlpha }: RgbInputProps ) => {
|
|
18
13
|
const { r, g, b, a } = color.toRgb();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { ColorPicker } from '../component';
|
|
15
|
+
|
|
16
|
+
const meta: ComponentMeta< typeof ColorPicker > = {
|
|
17
|
+
component: ColorPicker,
|
|
18
|
+
title: 'Components/ColorPicker',
|
|
19
|
+
argTypes: {
|
|
20
|
+
as: { control: { type: null } },
|
|
21
|
+
color: { control: { type: null } },
|
|
22
|
+
},
|
|
23
|
+
parameters: {
|
|
24
|
+
actions: { argTypesRegex: '^on.*' },
|
|
25
|
+
controls: {
|
|
26
|
+
expanded: true,
|
|
27
|
+
},
|
|
28
|
+
docs: { source: { state: 'open' } },
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
export default meta;
|
|
32
|
+
|
|
33
|
+
const Template: ComponentStory< typeof ColorPicker > = ( {
|
|
34
|
+
onChange,
|
|
35
|
+
...props
|
|
36
|
+
} ) => {
|
|
37
|
+
const [ color, setColor ] = useState< string | undefined >();
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ColorPicker
|
|
41
|
+
{ ...props }
|
|
42
|
+
color={ color }
|
|
43
|
+
onChange={ ( ...changeArgs ) => {
|
|
44
|
+
onChange?.( ...changeArgs );
|
|
45
|
+
setColor( ...changeArgs );
|
|
46
|
+
} }
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Default = Template.bind( {} );
|
|
@@ -9,34 +9,37 @@ import { render, fireEvent, waitFor } from '@testing-library/react';
|
|
|
9
9
|
import { ColorPicker } from '..';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Ordinarily we'd try to select the
|
|
12
|
+
* Ordinarily we'd try to select the component by role but the slider role appears
|
|
13
13
|
* on several elements and we'd end up encoding assumptions about order when
|
|
14
|
-
* trying to select the appropriate element. We might as well just use the
|
|
14
|
+
* trying to select the appropriate element. We might as well just use the class name
|
|
15
15
|
* on the container which will be more durable if, for example, the order changes.
|
|
16
|
-
*
|
|
17
|
-
* @param {HTMLElement} container
|
|
18
|
-
* @return {HTMLElement} The saturation element
|
|
19
16
|
*/
|
|
20
|
-
function getSaturation( container ) {
|
|
17
|
+
function getSaturation( container: HTMLElement ) {
|
|
21
18
|
return container.querySelector(
|
|
22
19
|
'.react-colorful__saturation .react-colorful__interactive'
|
|
23
20
|
);
|
|
24
21
|
}
|
|
25
22
|
|
|
23
|
+
type PageXPageY = { pageX: number; pageY: number };
|
|
24
|
+
|
|
26
25
|
// Fix to pass `pageX` and `pageY`
|
|
27
26
|
// See https://github.com/testing-library/react-testing-library/issues/268
|
|
28
|
-
class FakeMouseEvent extends
|
|
29
|
-
constructor( type, values
|
|
27
|
+
class FakeMouseEvent extends MouseEvent {
|
|
28
|
+
constructor( type: MouseEvent[ 'type' ], values?: PageXPageY ) {
|
|
30
29
|
super( type, { buttons: 1, bubbles: true, ...values } );
|
|
31
30
|
|
|
32
31
|
Object.assign( this, {
|
|
33
|
-
pageX: values
|
|
34
|
-
pageY: values
|
|
32
|
+
pageX: values?.pageX ?? 0,
|
|
33
|
+
pageY: values?.pageY ?? 0,
|
|
35
34
|
} );
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
function moveReactColorfulSlider(
|
|
38
|
+
function moveReactColorfulSlider(
|
|
39
|
+
sliderElement: Element,
|
|
40
|
+
from: PageXPageY,
|
|
41
|
+
to: PageXPageY
|
|
42
|
+
) {
|
|
40
43
|
fireEvent( sliderElement, new FakeMouseEvent( 'mousedown', from ) );
|
|
41
44
|
fireEvent( sliderElement, new FakeMouseEvent( 'mousemove', to ) );
|
|
42
45
|
}
|
|
@@ -81,6 +84,13 @@ describe( 'ColorPicker', () => {
|
|
|
81
84
|
);
|
|
82
85
|
|
|
83
86
|
const saturation = getSaturation( container );
|
|
87
|
+
|
|
88
|
+
if ( saturation === null ) {
|
|
89
|
+
throw new Error( 'The saturation slider could not be found' );
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
expect( saturation ).toBeInTheDocument();
|
|
93
|
+
|
|
84
94
|
moveReactColorfulSlider(
|
|
85
95
|
saturation,
|
|
86
96
|
{ pageX: 0, pageY: 0 },
|
|
@@ -106,6 +116,13 @@ describe( 'ColorPicker', () => {
|
|
|
106
116
|
);
|
|
107
117
|
|
|
108
118
|
const saturation = getSaturation( container );
|
|
119
|
+
|
|
120
|
+
if ( saturation === null ) {
|
|
121
|
+
throw new Error( 'The saturation slider could not be found' );
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
expect( saturation ).toBeInTheDocument();
|
|
125
|
+
|
|
109
126
|
moveReactColorfulSlider(
|
|
110
127
|
saturation,
|
|
111
128
|
{ pageX: 0, pageY: 0 },
|
|
@@ -121,13 +138,7 @@ describe( 'ColorPicker', () => {
|
|
|
121
138
|
|
|
122
139
|
it( 'should fire onChange with the HSL value', async () => {
|
|
123
140
|
const onChange = jest.fn();
|
|
124
|
-
const color =
|
|
125
|
-
h: 125,
|
|
126
|
-
s: 0.2,
|
|
127
|
-
l: 0.5,
|
|
128
|
-
// Add alpha to prove it's ignored.
|
|
129
|
-
a: 0.5,
|
|
130
|
-
};
|
|
141
|
+
const color = 'hsla(125, 20%, 50%, 0.5)';
|
|
131
142
|
|
|
132
143
|
const { container } = render(
|
|
133
144
|
<ColorPicker
|
|
@@ -138,6 +149,13 @@ describe( 'ColorPicker', () => {
|
|
|
138
149
|
);
|
|
139
150
|
|
|
140
151
|
const saturation = getSaturation( container );
|
|
152
|
+
|
|
153
|
+
if ( saturation === null ) {
|
|
154
|
+
throw new Error( 'The saturation slider could not be found' );
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
expect( saturation ).toBeInTheDocument();
|
|
158
|
+
|
|
141
159
|
moveReactColorfulSlider(
|
|
142
160
|
saturation,
|
|
143
161
|
{ pageX: 0, pageY: 0 },
|