@wordpress/components 19.17.0 → 20.0.1-next.d6164808d3.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 +68 -1
- package/build/alignment-matrix-control/index.js +1 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/angle-picker-control/index.js +3 -0
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +14 -4
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/autocomplete/index.js +9 -11
- package/build/autocomplete/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/base-field/styles.js +5 -5
- package/build/base-field/styles.js.map +1 -1
- package/build/box-control/styles/box-control-visualizer-styles.js +8 -8
- package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build/color-list-picker/index.js +16 -5
- package/build/color-list-picker/index.js.map +1 -1
- package/build/color-palette/index.js +22 -12
- package/build/color-palette/index.js.map +1 -1
- package/build/color-palette/index.native.js +3 -3
- package/build/color-palette/index.native.js.map +1 -1
- package/build/combobox-control/index.js +7 -4
- package/build/combobox-control/index.js.map +1 -1
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -0
- package/build/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
- package/build/custom-gradient-picker/index.js +19 -4
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-select-control/index.js +21 -11
- package/build/custom-select-control/index.js.map +1 -1
- package/build/custom-select-control/styles.js +34 -0
- package/build/custom-select-control/styles.js.map +1 -0
- package/build/date-time/constants.js +9 -0
- package/build/date-time/constants.js.map +1 -0
- package/build/date-time/date/index.js +175 -186
- package/build/date-time/date/index.js.map +1 -1
- package/build/date-time/date/styles.js +59 -40
- package/build/date-time/date/styles.js.map +1 -1
- package/build/date-time/date-time/index.js +5 -2
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/date-time/time/index.js +22 -17
- package/build/date-time/time/index.js.map +1 -1
- package/build/date-time/utils.js +27 -0
- package/build/date-time/utils.js.map +1 -0
- package/build/dimension-control/index.js +2 -6
- package/build/dimension-control/index.js.map +1 -1
- package/build/disabled/index.js +28 -11
- package/build/disabled/index.js.map +1 -1
- package/build/disabled/styles/disabled-styles.js +3 -3
- package/build/disabled/styles/disabled-styles.js.map +1 -1
- package/build/{swatch → disabled}/types.js +0 -0
- package/build/{swatch → disabled}/types.js.map +0 -0
- package/build/dropdown/index.js +5 -6
- package/build/dropdown/index.js.map +1 -1
- package/build/duotone-picker/custom-duotone-bar.js +2 -2
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +9 -1
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js +13 -3
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/focal-point-picker/index.js +4 -6
- package/build/focal-point-picker/index.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +4 -4
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/font-size-picker/index.js +43 -14
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +32 -22
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +11 -5
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +15 -3
- package/build/gradient-picker/index.js.map +1 -1
- package/build/guide/index.js +5 -3
- package/build/guide/index.js.map +1 -1
- package/build/guide/page-control.js +3 -7
- package/build/guide/page-control.js.map +1 -1
- package/build/item-group/styles.js +10 -10
- package/build/item-group/styles.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js +3 -6
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/global-styles-context/utils.native.js +3 -1
- package/build/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build/mobile/image/index.native.js +6 -26
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/picker/index.android.js +3 -3
- package/build/mobile/picker/index.android.js.map +1 -1
- package/build/modal/index.js +1 -3
- package/build/modal/index.js.map +1 -1
- package/build/navigable-container/container.js +9 -8
- package/build/navigable-container/container.js.map +1 -1
- package/build/navigator/navigator-back-button/hook.js +0 -4
- package/build/navigator/navigator-back-button/hook.js.map +1 -1
- package/build/navigator/navigator-button/hook.js +0 -4
- package/build/navigator/navigator-button/hook.js.map +1 -1
- package/build/notice/list.js +10 -6
- package/build/notice/list.js.map +1 -1
- package/build/palette-edit/index.js +1 -0
- package/build/palette-edit/index.js.map +1 -1
- package/build/palette-edit/styles.js +10 -10
- package/build/palette-edit/styles.js.map +1 -1
- package/build/popover/index.js +100 -97
- package/build/popover/index.js.map +1 -1
- package/build/popover/utils.js +178 -0
- package/build/popover/utils.js.map +1 -0
- package/build/range-control/index.js +3 -0
- package/build/range-control/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +43 -37
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/select-control/chevron-down.js +30 -0
- package/build/select-control/chevron-down.js.map +1 -0
- package/build/select-control/index.js +7 -7
- package/build/select-control/index.js.map +1 -1
- package/build/select-control/styles/select-control-styles.js +30 -15
- package/build/select-control/styles/select-control-styles.js.map +1 -1
- package/build/snackbar/list.js +5 -3
- package/build/snackbar/list.js.map +1 -1
- package/build/spinner/index.js +2 -0
- package/build/spinner/index.js.map +1 -1
- package/build/text/styles.js +7 -7
- package/build/text/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +16 -8
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +7 -5
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option/component.js +15 -5
- package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
- package/build/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js +20 -7
- package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js +26 -7
- package/build/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build/tools-panel/styles.js +11 -11
- package/build/tools-panel/styles.js.map +1 -1
- package/build/ui/context/context-connect.js +1 -3
- package/build/ui/context/context-connect.js.map +1 -1
- package/build/unit-control/index.js +2 -3
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/colors-values.js +52 -142
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js +1 -1
- package/build/utils/config-values.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/utils/rtl.js +6 -5
- package/build/utils/rtl.js.map +1 -1
- package/build/utils/strings.js +50 -0
- package/build/utils/strings.js.map +1 -0
- package/build-module/alignment-matrix-control/index.js +1 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -9
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/angle-picker-control/index.js +3 -0
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -4
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/autocomplete/index.js +9 -10
- package/build-module/autocomplete/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/base-field/styles.js +5 -5
- package/build-module/base-field/styles.js.map +1 -1
- package/build-module/box-control/styles/box-control-visualizer-styles.js +8 -8
- package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
- package/build-module/color-list-picker/index.js +13 -5
- package/build-module/color-list-picker/index.js.map +1 -1
- package/build-module/color-palette/index.js +22 -11
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-palette/index.native.js +4 -4
- package/build-module/color-palette/index.native.js.map +1 -1
- package/build-module/combobox-control/index.js +6 -3
- package/build-module/combobox-control/index.js.map +1 -1
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +34 -41
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -0
- package/build-module/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -0
- package/build-module/custom-gradient-picker/index.js +16 -3
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-select-control/index.js +20 -12
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/custom-select-control/styles.js +22 -0
- package/build-module/custom-select-control/styles.js.map +1 -0
- package/build-module/date-time/constants.js +2 -0
- package/build-module/date-time/constants.js.map +1 -0
- package/build-module/date-time/date/index.js +178 -184
- package/build-module/date-time/date/index.js.map +1 -1
- package/build-module/date-time/date/styles.js +47 -38
- package/build-module/date-time/date/styles.js.map +1 -1
- package/build-module/date-time/date-time/index.js +4 -2
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/date-time/time/index.js +20 -16
- package/build-module/date-time/time/index.js.map +1 -1
- package/build-module/date-time/utils.js +19 -0
- package/build-module/date-time/utils.js.map +1 -0
- package/build-module/dimension-control/index.js +1 -5
- package/build-module/dimension-control/index.js.map +1 -1
- package/build-module/disabled/index.js +28 -11
- package/build-module/disabled/index.js.map +1 -1
- package/build-module/disabled/styles/disabled-styles.js +3 -3
- package/build-module/disabled/styles/disabled-styles.js.map +1 -1
- package/build-module/{swatch → disabled}/types.js +0 -0
- package/build-module/{swatch → disabled}/types.js.map +0 -0
- package/build-module/dropdown/index.js +5 -6
- package/build-module/dropdown/index.js.map +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js +1 -1
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +7 -1
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js +11 -3
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/focal-point-picker/index.js +4 -5
- package/build-module/focal-point-picker/index.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +4 -4
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/font-size-picker/index.js +39 -14
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +31 -23
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +12 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +14 -3
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/guide/index.js +5 -3
- package/build-module/guide/index.js.map +1 -1
- package/build-module/guide/page-control.js +3 -6
- package/build-module/guide/page-control.js.map +1 -1
- package/build-module/item-group/styles.js +10 -10
- package/build-module/item-group/styles.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js +3 -5
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/utils.native.js +2 -1
- package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +8 -28
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/picker/index.android.js +3 -3
- package/build-module/mobile/picker/index.android.js.map +1 -1
- package/build-module/modal/index.js +1 -2
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigable-container/container.js +9 -7
- package/build-module/navigable-container/container.js.map +1 -1
- package/build-module/navigator/navigator-back-button/hook.js +0 -4
- package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
- package/build-module/navigator/navigator-button/hook.js +0 -4
- package/build-module/navigator/navigator-button/hook.js.map +1 -1
- package/build-module/notice/list.js +10 -5
- package/build-module/notice/list.js.map +1 -1
- package/build-module/palette-edit/index.js +1 -0
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/palette-edit/styles.js +10 -10
- package/build-module/palette-edit/styles.js.map +1 -1
- package/build-module/popover/index.js +100 -98
- package/build-module/popover/index.js.map +1 -1
- package/build-module/popover/utils.js +164 -0
- package/build-module/popover/utils.js.map +1 -0
- package/build-module/range-control/index.js +3 -0
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +43 -37
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/select-control/chevron-down.js +21 -0
- package/build-module/select-control/chevron-down.js.map +1 -0
- package/build-module/select-control/index.js +7 -7
- package/build-module/select-control/index.js.map +1 -1
- package/build-module/select-control/styles/select-control-styles.js +24 -13
- package/build-module/select-control/styles/select-control-styles.js.map +1 -1
- package/build-module/snackbar/list.js +5 -2
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/spinner/index.js +2 -0
- package/build-module/spinner/index.js.map +1 -1
- package/build-module/text/styles.js +7 -7
- package/build-module/text/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +14 -7
- 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 +5 -4
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option/component.js +17 -3
- package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js +5 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/component.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +16 -6
- package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js +27 -5
- package/build-module/toggle-group-control/toggle-group-control-option-icon/component.js.map +1 -1
- package/build-module/tools-panel/styles.js +11 -11
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/ui/context/context-connect.js +1 -2
- package/build-module/ui/context/context-connect.js.map +1 -1
- package/build-module/unit-control/index.js +2 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/colors-values.js +52 -141
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js +1 -1
- package/build-module/utils/config-values.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-module/utils/rtl.js +6 -4
- package/build-module/utils/rtl.js.map +1 -1
- package/build-module/utils/strings.js +37 -0
- package/build-module/utils/strings.js.map +1 -0
- package/build-style/style-rtl.css +176 -1227
- package/build-style/style.css +171 -1225
- package/build-types/color-palette/index.d.ts +2 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +2 -2
- package/build-types/date-time/constants.d.ts +2 -0
- package/build-types/date-time/constants.d.ts.map +1 -0
- package/build-types/date-time/date/index.d.ts +3 -1
- package/build-types/date-time/date/index.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +22 -8
- package/build-types/date-time/date/styles.d.ts.map +1 -1
- package/build-types/date-time/date/test/index.d.ts +1 -1
- package/build-types/date-time/date/test/index.d.ts.map +1 -1
- package/build-types/date-time/date-time/index.d.ts.map +1 -1
- package/build-types/date-time/time/index.d.ts.map +1 -1
- package/build-types/date-time/utils.d.ts +8 -0
- package/build-types/date-time/utils.d.ts.map +1 -0
- package/build-types/disabled/index.d.ts +35 -28
- package/build-types/disabled/index.d.ts.map +1 -1
- package/build-types/disabled/stories/index.d.ts +13 -0
- package/build-types/disabled/stories/index.d.ts.map +1 -0
- package/build-types/disabled/styles/disabled-styles.d.ts +2 -1
- package/build-types/disabled/styles/disabled-styles.d.ts.map +1 -1
- package/build-types/disabled/test/index.d.ts +2 -0
- package/build-types/{flyout/flyout → disabled/test}/index.d.ts.map +1 -1
- package/build-types/disabled/types.d.ts +14 -0
- package/build-types/disabled/types.d.ts.map +1 -0
- package/build-types/dropdown/index.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/stories/index.d.ts +1 -0
- package/build-types/form-token-field/stories/index.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +7 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +0 -3
- package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
- package/build-types/navigator/navigator-button/hook.d.ts +0 -3
- package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
- package/build-types/placeholder/test/index.d.ts +2 -0
- package/build-types/{flyout → placeholder/test}/index.d.ts.map +1 -1
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/utils.d.ts +26 -69
- package/build-types/popover/utils.d.ts.map +1 -1
- package/build-types/range-control/index.d.ts +2 -2
- package/build-types/range-control/index.d.ts.map +1 -1
- package/build-types/range-control/styles/range-control-styles.d.ts +5 -2
- package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
- package/build-types/range-control/types.d.ts +2 -2
- package/build-types/range-control/types.d.ts.map +1 -1
- package/build-types/select-control/chevron-down.d.ts +4 -0
- package/build-types/select-control/chevron-down.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 +8 -0
- package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
- package/build-types/spinner/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts +25 -0
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/test/index.d.ts +2 -0
- package/build-types/toggle-group-control/test/index.d.ts.map +1 -0
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts +6 -3
- package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -0
- 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/component.d.ts +6 -7
- package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +4 -0
- package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +11 -9
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts.map +1 -1
- package/build-types/toggle-group-control/types.d.ts +23 -10
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/ui/context/context-connect.d.ts +3 -0
- package/build-types/ui/context/context-connect.d.ts.map +1 -1
- package/build-types/ui/form-group/use-form-group.d.ts +2 -2
- package/build-types/unit-control/index.d.ts +2 -1
- package/build-types/unit-control/index.d.ts.map +1 -1
- package/build-types/unit-control/types.d.ts +5 -1
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +18 -97
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/rtl.d.ts.map +1 -1
- package/build-types/utils/strings.d.ts +2 -0
- package/build-types/utils/strings.d.ts.map +1 -0
- package/package.json +22 -21
- package/src/alignment-matrix-control/index.js +1 -1
- package/src/alignment-matrix-control/stories/index.js +49 -24
- package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +1 -3
- package/src/angle-picker-control/index.js +7 -1
- package/src/angle-picker-control/stories/index.js +8 -5
- package/src/angle-picker-control/styles/angle-picker-control-styles.js +12 -3
- package/src/autocomplete/index.js +9 -18
- package/src/base-control/styles/base-control-styles.ts +1 -1
- package/src/base-field/styles.js +1 -1
- package/src/base-field/test/__snapshots__/index.js.snap +2 -2
- package/src/box-control/styles/box-control-visualizer-styles.js +0 -1
- package/src/box-control/test/index.js +8 -8
- package/src/button/test/index.js +188 -146
- package/src/color-list-picker/index.js +15 -3
- package/src/color-list-picker/style.scss +11 -0
- package/src/color-palette/index.js +32 -16
- package/src/color-palette/index.native.js +10 -6
- package/src/color-palette/stories/index.js +1 -1
- package/src/color-palette/test/__snapshots__/index.js.snap +17 -3
- package/src/combobox-control/index.js +6 -5
- package/src/combobox-control/stories/index.js +9 -3
- package/src/combobox-control/style.scss +0 -1
- package/src/confirm-dialog/test/index.js +85 -62
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/constants.js +0 -0
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/control-points.js +54 -50
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/index.js +0 -3
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/test/utils.js +0 -0
- package/src/{custom-gradient-bar → custom-gradient-picker/gradient-bar}/utils.js +0 -0
- package/src/custom-gradient-picker/index.js +18 -3
- package/src/custom-gradient-picker/stories/index.js +4 -3
- package/src/custom-gradient-picker/style.scss +30 -27
- package/src/custom-select-control/README.md +10 -0
- package/src/custom-select-control/index.js +22 -16
- package/src/custom-select-control/stories/index.js +1 -1
- package/src/custom-select-control/style.scss +0 -12
- package/src/custom-select-control/styles.ts +28 -0
- package/src/custom-select-control/test/index.js +4 -1
- package/src/date-time/constants.ts +1 -0
- package/src/date-time/date/index.tsx +289 -184
- package/src/date-time/date/styles.ts +86 -27
- package/src/date-time/date/test/index.tsx +18 -28
- package/src/date-time/date-time/index.tsx +3 -2
- package/src/date-time/time/index.tsx +23 -19
- package/src/date-time/utils.ts +17 -0
- package/src/dimension-control/index.js +1 -5
- package/src/disabled/index.tsx +80 -0
- package/src/disabled/stories/index.tsx +87 -0
- package/src/disabled/styles/{disabled-styles.js → disabled-styles.tsx} +0 -0
- package/src/disabled/test/index.tsx +174 -0
- package/src/disabled/types.ts +13 -0
- package/src/dropdown/index.js +3 -5
- package/src/dropdown-menu/stories/index.js +13 -2
- package/src/duotone-picker/custom-duotone-bar.js +1 -1
- package/src/duotone-picker/duotone-picker.js +34 -26
- package/src/duotone-picker/duotone-swatch.js +12 -5
- package/src/duotone-picker/stories/duotone-picker.js +66 -0
- package/src/duotone-picker/stories/duotone-swatch.js +32 -0
- package/src/focal-point-picker/index.js +10 -5
- package/src/focal-point-picker/styles/focal-point-style.js +0 -1
- package/src/focal-point-picker/test/index.js +78 -45
- package/src/font-size-picker/index.js +161 -144
- package/src/font-size-picker/stories/index.js +1 -0
- package/src/font-size-picker/style.scss +8 -5
- package/src/font-size-picker/test/index.js +13 -6
- package/src/font-size-picker/test/{util.js → utils.js} +77 -1
- package/src/font-size-picker/utils.js +38 -23
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +24 -10
- package/src/form-token-field/stories/index.tsx +8 -0
- package/src/form-token-field/test/index.js +31 -0
- package/src/form-token-field/types.ts +7 -0
- package/src/gradient-picker/index.js +22 -7
- package/src/gradient-picker/stories/index.js +56 -81
- package/src/guide/index.js +3 -1
- package/src/guide/page-control.js +1 -6
- package/src/guide/stories/index.js +12 -11
- package/src/guide/test/index.js +54 -37
- package/src/guide/test/page-control.js +14 -17
- package/src/higher-order/with-notices/test/index.js +4 -2
- package/src/higher-order/with-spoken-messages/test/index.js +1 -1
- package/src/item-group/styles.ts +3 -3
- package/src/menu-group/test/index.js +18 -7
- package/src/mobile/bottom-sheet/index.native.js +2 -4
- package/src/mobile/global-styles-context/utils.native.js +2 -1
- package/src/mobile/image/index.native.js +9 -30
- package/src/mobile/picker/index.android.js +10 -4
- package/src/mobile/picker/styles.native.scss +4 -4
- package/src/modal/index.js +1 -2
- package/src/modal/test/index.js +11 -9
- package/src/navigable-container/container.js +12 -18
- package/src/navigable-container/test/menu.js +14 -11
- package/src/navigator/navigator-back-button/hook.ts +0 -3
- package/src/navigator/navigator-button/hook.ts +0 -3
- package/src/notice/list.js +12 -10
- package/src/palette-edit/index.js +1 -0
- package/src/palette-edit/styles.js +6 -5
- package/src/placeholder/README.md +1 -1
- package/src/placeholder/style.scss +65 -20
- package/src/placeholder/test/index.tsx +174 -0
- package/src/popover/index.js +133 -112
- package/src/popover/stories/index.js +17 -3
- package/src/popover/test/__snapshots__/index.js.snap +6 -6
- package/src/popover/test/index.js +129 -36
- package/src/popover/utils.js +107 -0
- package/src/range-control/index.tsx +3 -0
- package/src/range-control/styles/range-control-styles.ts +9 -4
- package/src/range-control/types.ts +5 -2
- package/src/select-control/chevron-down.tsx +25 -0
- package/src/select-control/index.tsx +6 -9
- package/src/select-control/styles/select-control-styles.ts +23 -14
- package/src/slot-fill/test/slot.js +5 -5
- package/src/snackbar/list.js +3 -2
- package/src/spinner/index.tsx +2 -0
- package/src/style.scss +0 -2
- package/src/text/styles.js +1 -1
- package/src/text/test/index.tsx +1 -1
- package/src/toggle-group-control/stories/index.tsx +127 -0
- package/src/toggle-group-control/test/__snapshots__/{index.js.snap → index.tsx.snap} +28 -22
- package/src/toggle-group-control/test/{index.js → index.tsx} +2 -4
- package/src/toggle-group-control/toggle-group-control/README.md +2 -0
- package/src/toggle-group-control/toggle-group-control/component.tsx +18 -9
- package/src/toggle-group-control/toggle-group-control/styles.ts +9 -6
- package/src/toggle-group-control/toggle-group-control-option/component.tsx +19 -3
- package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +3 -0
- package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +18 -0
- package/src/toggle-group-control/toggle-group-control-option-icon/README.md +6 -8
- package/src/toggle-group-control/toggle-group-control-option-icon/component.tsx +30 -7
- package/src/toggle-group-control/types.ts +74 -59
- package/src/toolbar/test/index.js +4 -4
- package/src/toolbar-group/test/index.js +9 -15
- package/src/tools-panel/styles.ts +2 -2
- package/src/tools-panel/test/index.js +3 -2
- package/src/tooltip/test/index.js +188 -172
- package/src/ui/context/context-connect.ts +3 -2
- package/src/unit-control/index.tsx +2 -2
- package/src/unit-control/types.ts +10 -1
- package/src/utils/colors-values.js +42 -137
- package/src/utils/config-values.js +1 -1
- package/src/utils/input/input-control.js +6 -6
- package/src/utils/rtl.js +6 -2
- package/src/utils/strings.ts +72 -0
- package/src/utils/test/strings.js +15 -0
- package/tsconfig.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-gradient-bar/constants.js.map +0 -1
- package/build/custom-gradient-bar/control-points.js.map +0 -1
- package/build/custom-gradient-bar/index.js.map +0 -1
- package/build/custom-gradient-bar/utils.js.map +0 -1
- package/build/date-time/date/utils.js +0 -34
- package/build/date-time/date/utils.js.map +0 -1
- package/build/swatch/index.js +0 -41
- package/build/swatch/index.js.map +0 -1
- package/build-module/custom-gradient-bar/constants.js.map +0 -1
- package/build-module/custom-gradient-bar/control-points.js.map +0 -1
- package/build-module/custom-gradient-bar/index.js.map +0 -1
- package/build-module/custom-gradient-bar/utils.js.map +0 -1
- package/build-module/date-time/date/utils.js +0 -22
- package/build-module/date-time/date/utils.js.map +0 -1
- package/build-module/swatch/index.js +0 -30
- package/build-module/swatch/index.js.map +0 -1
- package/build-types/color-picker/color-display.d.ts +0 -13
- package/build-types/color-picker/color-display.d.ts.map +0 -1
- package/build-types/date-time/date/test/utils.d.ts +0 -2
- package/build-types/date-time/date/test/utils.d.ts.map +0 -1
- package/build-types/date-time/date/utils.d.ts +0 -15
- package/build-types/date-time/date/utils.d.ts.map +0 -1
- package/build-types/flyout/context.d.ts +0 -6
- package/build-types/flyout/context.d.ts.map +0 -1
- package/build-types/flyout/flyout/component.d.ts +0 -21
- package/build-types/flyout/flyout/component.d.ts.map +0 -1
- package/build-types/flyout/flyout/hook.d.ts +0 -270
- package/build-types/flyout/flyout/hook.d.ts.map +0 -1
- package/build-types/flyout/flyout/index.d.ts +0 -3
- package/build-types/flyout/flyout-content/component.d.ts +0 -3
- package/build-types/flyout/flyout-content/component.d.ts.map +0 -1
- package/build-types/flyout/flyout-content/index.d.ts +0 -2
- package/build-types/flyout/flyout-content/index.d.ts.map +0 -1
- package/build-types/flyout/index.d.ts +0 -2
- package/build-types/flyout/styles.d.ts +0 -22
- package/build-types/flyout/styles.d.ts.map +0 -1
- package/build-types/flyout/types.d.ts +0 -80
- package/build-types/flyout/types.d.ts.map +0 -1
- package/build-types/flyout/utils.d.ts +0 -8
- package/build-types/flyout/utils.d.ts.map +0 -1
- package/build-types/swatch/index.d.ts +0 -5
- package/build-types/swatch/index.d.ts.map +0 -1
- package/build-types/swatch/types.d.ts +0 -11
- package/build-types/swatch/types.d.ts.map +0 -1
- package/build-types/utils/hooks/use-combined-ref.d.ts +0 -8
- package/build-types/utils/hooks/use-combined-ref.d.ts.map +0 -1
- package/src/date-time/date/datepicker.scss +0 -863
- package/src/date-time/date/style.scss +0 -85
- package/src/date-time/date/test/utils.ts +0 -32
- package/src/date-time/date/utils.ts +0 -20
- package/src/date-time/style.scss +0 -1
- package/src/disabled/index.js +0 -55
- package/src/disabled/stories/index.js +0 -61
- package/src/disabled/test/index.js +0 -240
- package/src/menu-group/test/__snapshots__/index.js.snap +0 -23
- package/src/placeholder/test/index.js +0 -163
- package/src/swatch/index.tsx +0 -22
- package/src/swatch/style.scss +0 -21
- package/src/swatch/types.ts +0 -11
- package/src/toggle-group-control/stories/index.js +0 -203
- package/src/tools-panel/test/__snapshots__/index.js.snap +0 -210
package/src/button/test/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
@@ -12,172 +12,188 @@ import { plusCircle } from '@wordpress/icons';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
-
import
|
|
16
|
-
|
|
15
|
+
import Button from '../';
|
|
16
|
+
|
|
17
|
+
jest.mock( '../../icon', () => () => <div data-testid="test-icon" /> );
|
|
17
18
|
|
|
18
19
|
describe( 'Button', () => {
|
|
19
20
|
describe( 'basic rendering', () => {
|
|
20
21
|
it( 'should render a button element with only one class', () => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
expect( button.
|
|
25
|
-
expect( button.
|
|
26
|
-
expect( button.
|
|
27
|
-
expect( button.
|
|
28
|
-
expect( button
|
|
29
|
-
expect( button
|
|
22
|
+
render( <Button /> );
|
|
23
|
+
const button = screen.getByRole( 'button' );
|
|
24
|
+
|
|
25
|
+
expect( button ).toHaveClass( 'components-button' );
|
|
26
|
+
expect( button ).not.toHaveClass( 'is-large' );
|
|
27
|
+
expect( button ).not.toHaveClass( 'is-primary' );
|
|
28
|
+
expect( button ).not.toHaveClass( 'is-pressed' );
|
|
29
|
+
expect( button ).not.toHaveAttribute( 'disabled' );
|
|
30
|
+
expect( button ).not.toHaveAttribute( 'aria-disabled' );
|
|
31
|
+
expect( button ).toHaveAttribute( 'type', 'button' );
|
|
30
32
|
} );
|
|
31
33
|
|
|
32
34
|
it( 'should render a button element with is-primary class', () => {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
expect( button.
|
|
37
|
-
expect( button.
|
|
35
|
+
render( <Button variant="primary" /> );
|
|
36
|
+
const button = screen.getByRole( 'button' );
|
|
37
|
+
|
|
38
|
+
expect( button ).not.toHaveClass( 'is-large' );
|
|
39
|
+
expect( button ).toHaveClass( 'is-primary' );
|
|
38
40
|
} );
|
|
39
41
|
|
|
40
42
|
it( 'should render a button element with is-secondary and is-small class', () => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
expect( button.
|
|
45
|
-
expect( button.
|
|
46
|
-
expect( button.
|
|
47
|
-
expect( button.
|
|
43
|
+
render( <Button variant="secondary" isSmall /> );
|
|
44
|
+
const button = screen.getByRole( 'button' );
|
|
45
|
+
|
|
46
|
+
expect( button ).toHaveClass( 'is-secondary' );
|
|
47
|
+
expect( button ).not.toHaveClass( 'is-large' );
|
|
48
|
+
expect( button ).toHaveClass( 'is-small' );
|
|
49
|
+
expect( button ).not.toHaveClass( 'is-primary' );
|
|
48
50
|
} );
|
|
49
51
|
|
|
50
52
|
it( 'should render a button element with is-tertiary class', () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
expect( button.
|
|
55
|
-
expect( button.
|
|
56
|
-
expect( button.
|
|
57
|
-
expect( button.
|
|
53
|
+
render( <Button variant="tertiary" /> );
|
|
54
|
+
const button = screen.getByRole( 'button' );
|
|
55
|
+
|
|
56
|
+
expect( button ).not.toHaveClass( 'is-large' );
|
|
57
|
+
expect( button ).not.toHaveClass( 'is-primary' );
|
|
58
|
+
expect( button ).not.toHaveClass( 'is-secondary' );
|
|
59
|
+
expect( button ).toHaveClass( 'is-tertiary' );
|
|
58
60
|
} );
|
|
59
61
|
|
|
60
62
|
it( 'should render a button element with is-link class', () => {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
expect( button.
|
|
65
|
-
expect( button.
|
|
66
|
-
expect( button.
|
|
67
|
-
expect( button.
|
|
63
|
+
render( <Button variant="link" /> );
|
|
64
|
+
const button = screen.getByRole( 'button' );
|
|
65
|
+
|
|
66
|
+
expect( button ).not.toHaveClass( 'is-primary' );
|
|
67
|
+
expect( button ).not.toHaveClass( 'is-secondary' );
|
|
68
|
+
expect( button ).not.toHaveClass( 'is-tertiary' );
|
|
69
|
+
expect( button ).toHaveClass( 'is-link' );
|
|
68
70
|
} );
|
|
69
71
|
|
|
70
72
|
it( 'should render a button element with is-pressed without button class', () => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
render( <Button isPressed /> );
|
|
74
|
+
|
|
75
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-pressed' );
|
|
73
76
|
} );
|
|
74
77
|
|
|
75
78
|
it( 'should add a disabled prop to the button', () => {
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
render( <Button disabled /> );
|
|
80
|
+
|
|
81
|
+
expect( screen.getByRole( 'button' ) ).toHaveAttribute(
|
|
82
|
+
'disabled'
|
|
83
|
+
);
|
|
78
84
|
} );
|
|
79
85
|
|
|
80
86
|
it( 'should add only aria-disabled attribute when disabled and isFocusable are true', () => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
expect( button.
|
|
85
|
-
expect( button.
|
|
87
|
+
render( <Button disabled __experimentalIsFocusable /> );
|
|
88
|
+
const button = screen.getByRole( 'button' );
|
|
89
|
+
|
|
90
|
+
expect( button ).not.toHaveAttribute( 'disabled' );
|
|
91
|
+
expect( button ).toHaveAttribute( 'aria-disabled' );
|
|
86
92
|
} );
|
|
87
93
|
|
|
88
|
-
it( 'should not
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
it( 'should not pass the prop target into the element', () => {
|
|
95
|
+
render( <Button target="_blank" /> );
|
|
96
|
+
|
|
97
|
+
expect( screen.getByRole( 'button' ) ).not.toHaveAttribute(
|
|
98
|
+
'target'
|
|
91
99
|
);
|
|
92
|
-
expect( button.prop( 'target' ) ).toBeUndefined();
|
|
93
100
|
} );
|
|
94
101
|
|
|
95
102
|
it( 'should render with an additional className', () => {
|
|
96
|
-
|
|
97
|
-
'button'
|
|
98
|
-
);
|
|
103
|
+
render( <Button className="gutenberg" /> );
|
|
99
104
|
|
|
100
|
-
expect(
|
|
105
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'gutenberg' );
|
|
101
106
|
} );
|
|
102
107
|
|
|
103
|
-
it( 'should render
|
|
104
|
-
|
|
105
|
-
'button'
|
|
106
|
-
);
|
|
108
|
+
it( 'should render an additional WordPress prop of value awesome', () => {
|
|
109
|
+
render( <Button WordPress="awesome" /> );
|
|
107
110
|
|
|
108
|
-
expect(
|
|
111
|
+
expect( console ).toHaveErrored();
|
|
112
|
+
expect( screen.getByRole( 'button' ) ).toHaveAttribute(
|
|
113
|
+
'wordpress',
|
|
114
|
+
'awesome'
|
|
115
|
+
);
|
|
109
116
|
} );
|
|
110
117
|
|
|
111
118
|
it( 'should render an icon button', () => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
expect(
|
|
116
|
-
expect(
|
|
119
|
+
render( <Button icon={ plusCircle } /> );
|
|
120
|
+
const button = screen.getByRole( 'button' );
|
|
121
|
+
|
|
122
|
+
expect( button ).toHaveClass( 'has-icon' );
|
|
123
|
+
expect( button ).not.toHaveAttribute( 'aria-label' );
|
|
117
124
|
} );
|
|
118
125
|
|
|
119
126
|
it( 'should render a Dashicon component matching the wordpress icon', () => {
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
render( <Button icon={ plusCircle } /> );
|
|
128
|
+
|
|
129
|
+
expect( screen.getByRole( 'button' ) ).toContainElement(
|
|
130
|
+
screen.getByTestId( 'test-icon' )
|
|
122
131
|
);
|
|
123
|
-
expect( iconButton.find( 'Icon' ).dive() ).not.toBeNull();
|
|
124
132
|
} );
|
|
125
133
|
|
|
126
134
|
it( 'should render child elements and icon', () => {
|
|
127
|
-
|
|
135
|
+
render(
|
|
128
136
|
<Button
|
|
129
137
|
icon={ plusCircle }
|
|
130
138
|
children={ <p className="test">Test</p> }
|
|
131
139
|
/>
|
|
132
|
-
).find( 'button' );
|
|
133
|
-
expect( iconButton.find( 'Icon' ).dive() ).not.toBeNull();
|
|
134
|
-
expect( iconButton.find( '.test' ).shallow().text() ).toBe(
|
|
135
|
-
'Test'
|
|
136
140
|
);
|
|
137
|
-
} );
|
|
138
141
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
<Button icon={ plusCircle } label="WordPress" />
|
|
142
|
-
).find( 'Tooltip' );
|
|
143
|
-
expect( iconButton.name() ).toBe( 'Tooltip' );
|
|
144
|
-
expect( iconButton.prop( 'text' ) ).toBe( 'WordPress' );
|
|
145
|
-
expect( iconButton.find( 'button' ).prop( 'aria-label' ) ).toBe(
|
|
146
|
-
'WordPress'
|
|
142
|
+
expect( screen.getByRole( 'button' ) ).toContainElement(
|
|
143
|
+
screen.getByTestId( 'test-icon' )
|
|
147
144
|
);
|
|
145
|
+
|
|
146
|
+
const paragraph = screen.getByText( 'Test' );
|
|
147
|
+
expect( paragraph ).toBeVisible();
|
|
148
|
+
expect( paragraph ).toHaveClass( 'test' );
|
|
149
|
+
} );
|
|
150
|
+
|
|
151
|
+
it( 'should add an aria-label when the label property is used, with Tooltip wrapper', async () => {
|
|
152
|
+
render( <Button icon={ plusCircle } label="WordPress" /> );
|
|
153
|
+
|
|
154
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
155
|
+
|
|
156
|
+
await screen.getByRole( 'button', { name: 'WordPress' } ).focus();
|
|
157
|
+
|
|
158
|
+
expect( screen.getByText( 'WordPress' ) ).toBeVisible();
|
|
148
159
|
} );
|
|
149
160
|
|
|
150
161
|
it( 'should support explicit aria-label override', () => {
|
|
151
|
-
|
|
152
|
-
|
|
162
|
+
render( <Button aria-label="Custom" /> );
|
|
163
|
+
|
|
164
|
+
expect( screen.getByRole( 'button' ) ).toHaveAttribute(
|
|
165
|
+
'aria-label',
|
|
166
|
+
'Custom'
|
|
153
167
|
);
|
|
154
|
-
expect( iconButton.prop( 'aria-label' ) ).toBe( 'Custom' );
|
|
155
168
|
} );
|
|
156
169
|
|
|
157
170
|
it( 'should support adding aria-describedby text', () => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
expect( buttonDescription ).toBe( 'Description text' );
|
|
171
|
+
render( <Button describedBy="Description text" /> );
|
|
172
|
+
expect(
|
|
173
|
+
screen.getByRole( 'button', {
|
|
174
|
+
description: 'Description text',
|
|
175
|
+
} )
|
|
176
|
+
).toBeVisible();
|
|
165
177
|
} );
|
|
166
178
|
|
|
167
|
-
it( 'should populate tooltip with label content for buttons without visible labels (no children)', () => {
|
|
168
|
-
|
|
179
|
+
it( 'should populate tooltip with label content for buttons without visible labels (no children)', async () => {
|
|
180
|
+
render(
|
|
169
181
|
<Button
|
|
170
182
|
describedBy="Description text"
|
|
171
183
|
label="Label"
|
|
172
184
|
icon={ plusCircle }
|
|
173
185
|
/>
|
|
174
|
-
)
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
expect( screen.queryByText( 'Label' ) ).not.toBeInTheDocument();
|
|
175
189
|
|
|
176
|
-
|
|
190
|
+
await screen.getByRole( 'button', { name: 'Label' } ).focus();
|
|
191
|
+
|
|
192
|
+
expect( screen.getByText( 'Label' ) ).toBeVisible();
|
|
177
193
|
} );
|
|
178
194
|
|
|
179
195
|
it( 'should populate tooltip with description content for buttons with visible labels (buttons with children)', () => {
|
|
180
|
-
|
|
196
|
+
render(
|
|
181
197
|
<Button
|
|
182
198
|
label="Label"
|
|
183
199
|
describedBy="Description text"
|
|
@@ -186,74 +202,98 @@ describe( 'Button', () => {
|
|
|
186
202
|
>
|
|
187
203
|
Children
|
|
188
204
|
</Button>
|
|
189
|
-
)
|
|
205
|
+
);
|
|
190
206
|
|
|
191
|
-
expect(
|
|
207
|
+
expect(
|
|
208
|
+
screen.getByRole( 'button', {
|
|
209
|
+
description: 'Description text',
|
|
210
|
+
} )
|
|
211
|
+
).toBeVisible();
|
|
192
212
|
} );
|
|
193
213
|
|
|
194
|
-
it( 'should allow tooltip disable', () => {
|
|
195
|
-
|
|
214
|
+
it( 'should allow tooltip disable', async () => {
|
|
215
|
+
render(
|
|
196
216
|
<Button
|
|
197
217
|
icon={ plusCircle }
|
|
198
218
|
label="WordPress"
|
|
199
219
|
showTooltip={ false }
|
|
200
220
|
/>
|
|
201
|
-
)
|
|
202
|
-
|
|
203
|
-
|
|
221
|
+
);
|
|
222
|
+
const button = screen.getByRole( 'button', { name: 'WordPress' } );
|
|
223
|
+
|
|
224
|
+
expect( button ).toHaveAttribute( 'aria-label', 'WordPress' );
|
|
225
|
+
|
|
226
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
227
|
+
|
|
228
|
+
await button.focus();
|
|
229
|
+
|
|
230
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
204
231
|
} );
|
|
205
232
|
|
|
206
|
-
it( 'should show the tooltip for empty children', () => {
|
|
207
|
-
|
|
233
|
+
it( 'should show the tooltip for empty children', async () => {
|
|
234
|
+
render(
|
|
208
235
|
<Button icon={ plusCircle } label="WordPress" children={ [] } />
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
expect(
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
239
|
+
|
|
240
|
+
await screen.getByRole( 'button', { name: 'WordPress' } ).focus();
|
|
241
|
+
|
|
242
|
+
expect( screen.getByText( 'WordPress' ) ).toBeVisible();
|
|
212
243
|
} );
|
|
213
244
|
|
|
214
|
-
it( 'should not show the tooltip when icon and children defined', () => {
|
|
215
|
-
|
|
245
|
+
it( 'should not show the tooltip when icon and children defined', async () => {
|
|
246
|
+
render(
|
|
216
247
|
<Button icon={ plusCircle } label="WordPress">
|
|
217
248
|
Children
|
|
218
249
|
</Button>
|
|
219
|
-
)
|
|
220
|
-
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
253
|
+
|
|
254
|
+
await screen.getByRole( 'button', { name: 'WordPress' } ).focus();
|
|
255
|
+
|
|
256
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
221
257
|
} );
|
|
222
258
|
|
|
223
|
-
it( 'should force showing the tooltip even if icon and children defined', () => {
|
|
224
|
-
|
|
259
|
+
it( 'should force showing the tooltip even if icon and children defined', async () => {
|
|
260
|
+
render(
|
|
225
261
|
<Button icon={ plusCircle } label="WordPress" showTooltip>
|
|
226
262
|
Children
|
|
227
263
|
</Button>
|
|
228
|
-
)
|
|
229
|
-
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
expect( screen.queryByText( 'WordPress' ) ).not.toBeInTheDocument();
|
|
267
|
+
|
|
268
|
+
await screen.getByRole( 'button', { name: 'WordPress' } ).focus();
|
|
269
|
+
|
|
270
|
+
expect( screen.getByText( 'WordPress' ) ).toBeVisible();
|
|
230
271
|
} );
|
|
231
272
|
} );
|
|
232
273
|
|
|
233
274
|
describe( 'with href property', () => {
|
|
234
275
|
it( 'should render a link instead of a button with href prop', () => {
|
|
235
|
-
|
|
236
|
-
<Button href="https://wordpress.org/" />
|
|
237
|
-
).find( 'a' );
|
|
276
|
+
render( <Button href="https://wordpress.org/" /> );
|
|
238
277
|
|
|
239
|
-
expect(
|
|
240
|
-
|
|
278
|
+
expect( screen.getByRole( 'link' ) ).toHaveAttribute(
|
|
279
|
+
'href',
|
|
280
|
+
'https://wordpress.org/'
|
|
281
|
+
);
|
|
241
282
|
} );
|
|
242
283
|
|
|
243
284
|
it( 'should allow for the passing of the target prop when a link is created', () => {
|
|
244
|
-
|
|
245
|
-
<Button href="https://wordpress.org/" target="_blank" />
|
|
246
|
-
).find( 'a' );
|
|
285
|
+
render( <Button href="https://wordpress.org/" target="_blank" /> );
|
|
247
286
|
|
|
248
|
-
expect(
|
|
287
|
+
expect( screen.getByRole( 'link' ) ).toHaveAttribute(
|
|
288
|
+
'target',
|
|
289
|
+
'_blank'
|
|
290
|
+
);
|
|
249
291
|
} );
|
|
250
292
|
|
|
251
293
|
it( 'should become a button again when disabled is supplied', () => {
|
|
252
|
-
|
|
253
|
-
<Button href="https://wordpress.org/" disabled />
|
|
254
|
-
).find( 'button' );
|
|
294
|
+
render( <Button href="https://wordpress.org/" disabled /> );
|
|
255
295
|
|
|
256
|
-
expect(
|
|
296
|
+
expect( screen.getByRole( 'button' ) ).toBeVisible();
|
|
257
297
|
} );
|
|
258
298
|
} );
|
|
259
299
|
|
|
@@ -261,38 +301,40 @@ describe( 'Button', () => {
|
|
|
261
301
|
it( 'should enable access to DOM element', () => {
|
|
262
302
|
const ref = createRef();
|
|
263
303
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
);
|
|
267
|
-
expect( ref.current.type ).toBe( 'button' );
|
|
304
|
+
render( <Button ref={ ref } /> );
|
|
305
|
+
|
|
306
|
+
expect( ref.current ).toBe( screen.getByRole( 'button' ) );
|
|
268
307
|
} );
|
|
269
308
|
} );
|
|
270
309
|
|
|
271
310
|
describe( 'deprecated props', () => {
|
|
272
311
|
it( 'should not break when the legacy isPrimary prop is passed', () => {
|
|
273
|
-
|
|
274
|
-
expect(
|
|
312
|
+
render( <Button isPrimary /> );
|
|
313
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-primary' );
|
|
275
314
|
} );
|
|
276
315
|
|
|
277
316
|
it( 'should not break when the legacy isSecondary prop is passed', () => {
|
|
278
|
-
|
|
279
|
-
expect(
|
|
317
|
+
render( <Button isSecondary /> );
|
|
318
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass(
|
|
319
|
+
'is-secondary'
|
|
320
|
+
);
|
|
280
321
|
} );
|
|
281
322
|
|
|
282
323
|
it( 'should not break when the legacy isTertiary prop is passed', () => {
|
|
283
|
-
|
|
284
|
-
expect(
|
|
324
|
+
render( <Button isTertiary /> );
|
|
325
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-tertiary' );
|
|
285
326
|
} );
|
|
286
327
|
|
|
287
328
|
it( 'should not break when the legacy isLink prop is passed', () => {
|
|
288
|
-
|
|
289
|
-
expect(
|
|
329
|
+
render( <Button isLink /> );
|
|
330
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass( 'is-link' );
|
|
290
331
|
} );
|
|
291
332
|
|
|
292
333
|
it( 'should warn when the isDefault prop is passed', () => {
|
|
293
|
-
|
|
294
|
-
expect(
|
|
295
|
-
|
|
334
|
+
render( <Button isDefault /> );
|
|
335
|
+
expect( screen.getByRole( 'button' ) ).toHaveClass(
|
|
336
|
+
'is-secondary'
|
|
337
|
+
);
|
|
296
338
|
expect( console ).toHaveWarned();
|
|
297
339
|
} );
|
|
298
340
|
} );
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useState } from '@wordpress/element';
|
|
5
|
+
import { swatch } from '@wordpress/icons';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Internal dependencies
|
|
8
9
|
*/
|
|
9
10
|
import Button from '../button';
|
|
10
11
|
import ColorPalette from '../color-palette';
|
|
11
|
-
import
|
|
12
|
+
import ColorIndicator from '../color-indicator';
|
|
13
|
+
import Icon from '../icon';
|
|
14
|
+
import { HStack } from '../h-stack';
|
|
12
15
|
|
|
13
16
|
function ColorOption( {
|
|
14
17
|
label,
|
|
@@ -23,10 +26,19 @@ function ColorOption( {
|
|
|
23
26
|
<>
|
|
24
27
|
<Button
|
|
25
28
|
className="components-color-list-picker__swatch-button"
|
|
26
|
-
icon={ <Swatch fill={ value } /> }
|
|
27
29
|
onClick={ () => setIsOpen( ( prev ) => ! prev ) }
|
|
28
30
|
>
|
|
29
|
-
{
|
|
31
|
+
<HStack justify="flex-start" spacing={ 2 }>
|
|
32
|
+
{ value ? (
|
|
33
|
+
<ColorIndicator
|
|
34
|
+
colorValue={ value }
|
|
35
|
+
className="components-color-list-picker__swatch-color"
|
|
36
|
+
/>
|
|
37
|
+
) : (
|
|
38
|
+
<Icon icon={ swatch } />
|
|
39
|
+
) }
|
|
40
|
+
<span>{ label }</span>
|
|
41
|
+
</HStack>
|
|
30
42
|
</Button>
|
|
31
43
|
{ isOpen && (
|
|
32
44
|
<ColorPalette
|
|
@@ -6,3 +6,14 @@
|
|
|
6
6
|
.components-color-list-picker__color-picker {
|
|
7
7
|
margin: $grid-unit-10 0;
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
.components-color-list-picker__swatch-button {
|
|
11
|
+
// Used to simulate styles as a .button.has-icon (which this component can't
|
|
12
|
+
// opt into, because it has to show more than a simple SVG as the "icon")
|
|
13
|
+
padding: 6px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.components-color-list-picker__swatch-color {
|
|
17
|
+
// Match the 24px size of the `swatch` icon (used when no color is set)
|
|
18
|
+
margin: 2px;
|
|
19
|
+
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* External dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { map } from 'lodash';
|
|
6
5
|
import { colord, extend } from 'colord';
|
|
7
6
|
import namesPlugin from 'colord/plugins/names';
|
|
8
7
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
@@ -35,15 +34,16 @@ function SinglePalette( {
|
|
|
35
34
|
actions,
|
|
36
35
|
} ) {
|
|
37
36
|
const colorOptions = useMemo( () => {
|
|
38
|
-
return map(
|
|
37
|
+
return colors.map( ( { color, name }, index ) => {
|
|
39
38
|
const colordColor = colord( color );
|
|
39
|
+
const isSelected = value === color;
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<CircularOptionPicker.Option
|
|
43
|
-
key={ color }
|
|
44
|
-
isSelected={
|
|
43
|
+
key={ `${ color }-${ index }` }
|
|
44
|
+
isSelected={ isSelected }
|
|
45
45
|
selectedIconProps={
|
|
46
|
-
|
|
46
|
+
isSelected
|
|
47
47
|
? {
|
|
48
48
|
fill:
|
|
49
49
|
colordColor.contrast() >
|
|
@@ -60,7 +60,7 @@ function SinglePalette( {
|
|
|
60
60
|
}
|
|
61
61
|
style={ { backgroundColor: color, color } }
|
|
62
62
|
onClick={
|
|
63
|
-
|
|
63
|
+
isSelected ? clearColor : () => onChange( color )
|
|
64
64
|
}
|
|
65
65
|
aria-label={
|
|
66
66
|
name
|
|
@@ -112,19 +112,35 @@ function MultiplePalettes( {
|
|
|
112
112
|
);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
export function CustomColorPickerDropdown( {
|
|
115
|
+
export function CustomColorPickerDropdown( {
|
|
116
|
+
isRenderedInSidebar,
|
|
117
|
+
popoverProps: receivedPopoverProps,
|
|
118
|
+
...props
|
|
119
|
+
} ) {
|
|
120
|
+
const popoverProps = useMemo(
|
|
121
|
+
() => ( {
|
|
122
|
+
__unstableShift: true,
|
|
123
|
+
...( isRenderedInSidebar
|
|
124
|
+
? {
|
|
125
|
+
// When in the sidebar: open to the left (stacking),
|
|
126
|
+
// leaving the same gap as the parent popover.
|
|
127
|
+
placement: 'left-start',
|
|
128
|
+
offset: 34,
|
|
129
|
+
}
|
|
130
|
+
: {
|
|
131
|
+
// Default behavior: open below the anchor
|
|
132
|
+
placement: 'bottom',
|
|
133
|
+
offset: 8,
|
|
134
|
+
} ),
|
|
135
|
+
...receivedPopoverProps,
|
|
136
|
+
} ),
|
|
137
|
+
[ isRenderedInSidebar, receivedPopoverProps ]
|
|
138
|
+
);
|
|
139
|
+
|
|
116
140
|
return (
|
|
117
141
|
<Dropdown
|
|
118
142
|
contentClassName="components-color-palette__custom-color-dropdown-content"
|
|
119
|
-
popoverProps={
|
|
120
|
-
isRenderedInSidebar
|
|
121
|
-
? {
|
|
122
|
-
placement: 'left-start',
|
|
123
|
-
offset: 20,
|
|
124
|
-
__unstableShift: true,
|
|
125
|
-
}
|
|
126
|
-
: undefined
|
|
127
|
-
}
|
|
143
|
+
popoverProps={ popoverProps }
|
|
128
144
|
{ ...props }
|
|
129
145
|
/>
|
|
130
146
|
);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
Platform,
|
|
12
12
|
Text,
|
|
13
13
|
} from 'react-native';
|
|
14
|
-
import { map
|
|
14
|
+
import { map } from 'lodash';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* WordPress dependencies
|
|
@@ -63,11 +63,15 @@ function ColorPalette( {
|
|
|
63
63
|
const scale = useRef( new Animated.Value( 1 ) ).current;
|
|
64
64
|
const opacity = useRef( new Animated.Value( 1 ) ).current;
|
|
65
65
|
|
|
66
|
-
const defaultColors =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const defaultColors = [
|
|
67
|
+
...new Set( map( defaultSettings.colors, 'color' ) ),
|
|
68
|
+
];
|
|
69
|
+
const mergedColors = [
|
|
70
|
+
...new Set( map( defaultSettings.allColors, 'color' ) ),
|
|
71
|
+
];
|
|
72
|
+
const defaultGradientColors = [
|
|
73
|
+
...new Set( map( defaultSettings.gradients, 'gradient' ) ),
|
|
74
|
+
];
|
|
71
75
|
const colors = isGradientSegment ? defaultGradientColors : defaultColors;
|
|
72
76
|
|
|
73
77
|
const customIndicatorColor = isGradientSegment
|