@wordpress/components 22.0.0 → 23.0.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 +99 -0
- package/build/alignment-matrix-control/cell.js.map +1 -1
- package/build/alignment-matrix-control/icon.js +4 -2
- package/build/alignment-matrix-control/icon.js.map +1 -1
- package/build/alignment-matrix-control/index.js +25 -1
- package/build/alignment-matrix-control/index.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +13 -13
- package/build/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +1 -1
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +16 -16
- package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build/alignment-matrix-control/types.js +6 -0
- package/build/alignment-matrix-control/types.js.map +1 -0
- package/build/alignment-matrix-control/utils.js +9 -8
- package/build/alignment-matrix-control/utils.js.map +1 -1
- package/build/angle-picker-control/index.js +3 -1
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +9 -9
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/autocomplete/index.js +45 -12
- package/build/autocomplete/index.js.map +1 -1
- package/build/base-control/hooks.js +52 -0
- package/build/base-control/hooks.js.map +1 -0
- package/build/base-control/index.js +24 -7
- package/build/base-control/index.js.map +1 -1
- package/build/base-field/hook.js +0 -14
- package/build/base-field/hook.js.map +1 -1
- package/build/base-field/index.js.map +1 -1
- package/build/base-field/styles.js +5 -5
- package/build/base-field/styles.js.map +1 -1
- package/build/base-field/types.js +6 -0
- package/build/base-field/types.js.map +1 -0
- package/build/border-box-control/border-box-control/component.js +1 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control/hook.js +13 -1
- package/build/border-box-control/border-box-control/hook.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/hook.js +11 -1
- package/build/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build/border-control/border-control/component.js +3 -2
- package/build/border-control/border-control/component.js.map +1 -1
- package/build/border-control/border-control/hook.js +11 -1
- package/build/border-control/border-control/hook.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/hook.js +10 -2
- package/build/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build/border-control/styles.js +16 -16
- package/build/border-control/styles.js.map +1 -1
- package/build/box-control/linked-button.js +3 -4
- package/build/box-control/linked-button.js.map +1 -1
- package/build/color-palette/index.js +3 -8
- package/build/color-palette/index.js.map +1 -1
- package/build/color-picker/input-with-slider.js +18 -3
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/styles.js +8 -8
- package/build/color-picker/styles.js.map +1 -1
- package/build/custom-select-control/index.js +19 -4
- package/build/custom-select-control/index.js.map +1 -1
- package/build/dashicon/index.js +18 -6
- package/build/dashicon/index.js.map +1 -1
- package/build/date-time/date-time/index.js +4 -4
- package/build/date-time/date-time/index.js.map +1 -1
- package/build/draggable/index.js +58 -38
- package/build/draggable/index.js.map +1 -1
- package/build/draggable/types.js +6 -0
- package/build/draggable/types.js.map +1 -0
- package/build/duotone-picker/duotone-picker.js +2 -2
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/flex/flex/hook.js +2 -3
- package/build/flex/flex/hook.js.map +1 -1
- package/build/focal-point-picker/focal-point.js +2 -12
- package/build/focal-point-picker/focal-point.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-style.js +11 -51
- package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build/font-size-picker/constants.js +41 -0
- package/build/font-size-picker/constants.js.map +1 -0
- package/build/font-size-picker/font-size-picker-select.js +97 -0
- package/build/font-size-picker/font-size-picker-select.js.map +1 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js +50 -0
- package/build/font-size-picker/font-size-picker-toggle-group.js.map +1 -0
- package/build/font-size-picker/index.js +39 -76
- package/build/font-size-picker/index.js.map +1 -1
- package/build/font-size-picker/utils.js +17 -89
- package/build/font-size-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +9 -6
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +3 -9
- package/build/gradient-picker/index.js.map +1 -1
- package/build/higher-order/navigate-regions/index.js +3 -0
- package/build/higher-order/navigate-regions/index.js.map +1 -1
- package/build/higher-order/with-fallback-styles/index.js +2 -2
- package/build/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build/icon/index.js +3 -2
- package/build/icon/index.js.map +1 -1
- package/build/index.js +21 -1
- package/build/index.js.map +1 -1
- package/build/input-control/index.js +17 -5
- package/build/input-control/index.js.map +1 -1
- package/build/input-control/input-base.js +2 -0
- package/build/input-control/input-base.js.map +1 -1
- package/build/menu-group/index.js +17 -3
- package/build/menu-group/index.js.map +1 -1
- package/build/menu-group/types.js +6 -0
- package/build/menu-group/types.js.map +1 -0
- package/build/mobile/bottom-sheet/cell.native.js +1 -1
- package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/switch-cell.native.js +1 -3
- package/build/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build/mobile/global-styles-context/index.native.js +8 -8
- package/build/mobile/global-styles-context/index.native.js.map +1 -1
- package/build/mobile/keyboard-aware-flat-list/index.ios.js +4 -2
- package/build/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build/modal/index.js +8 -0
- package/build/modal/index.js.map +1 -1
- package/build/navigator/navigator-provider/component.js +12 -8
- package/build/navigator/navigator-provider/component.js.map +1 -1
- package/build/navigator/navigator-screen/component.js +9 -5
- package/build/navigator/navigator-screen/component.js.map +1 -1
- package/build/number-control/styles/number-control-styles.js +8 -8
- package/build/number-control/styles/number-control-styles.js.map +1 -1
- package/build/palette-edit/index.js +75 -34
- package/build/palette-edit/index.js.map +1 -1
- package/build/popover/index.js +18 -6
- package/build/popover/index.js.map +1 -1
- package/build/query-controls/index.js +1 -0
- package/build/query-controls/index.js.map +1 -1
- package/build/range-control/styles/range-control-styles.js +47 -57
- package/build/range-control/styles/range-control-styles.js.map +1 -1
- package/build/snackbar/index.js +35 -24
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +14 -19
- package/build/snackbar/list.js.map +1 -1
- package/build/snackbar/types.js +6 -0
- package/build/snackbar/types.js.map +1 -0
- package/build/spinner/styles.js +4 -4
- package/build/spinner/styles.js.map +1 -1
- package/build/tab-panel/index.js +12 -8
- package/build/tab-panel/index.js.map +1 -1
- package/build/theme/color-algorithms.js +118 -0
- package/build/theme/color-algorithms.js.map +1 -0
- package/build/theme/index.js +21 -18
- package/build/theme/index.js.map +1 -1
- package/build/theme/styles.js +10 -7
- package/build/theme/styles.js.map +1 -1
- package/build/toggle-control/index.js +5 -2
- package/build/toggle-control/index.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/component.js +1 -0
- package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
- package/build/toggle-group-control/toggle-group-control/styles.js +11 -6
- package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build/tools-panel/styles.js +14 -14
- package/build/tools-panel/styles.js.map +1 -1
- package/build/tools-panel/tools-panel-item/hook.js +9 -5
- package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build/ui/context/context-system-provider.js +3 -1
- package/build/ui/context/context-system-provider.js.map +1 -1
- package/build/unit-control/index.js +5 -2
- package/build/unit-control/index.js.map +1 -1
- package/build/utils/colors-values.js +4 -3
- package/build/utils/colors-values.js.map +1 -1
- package/build/utils/config-values.js +0 -2
- package/build/utils/config-values.js.map +1 -1
- package/build/utils/hooks/use-controlled-value.js.map +1 -1
- package/build/utils/input/base.js +2 -2
- package/build/utils/input/base.js.map +1 -1
- package/build/view/index.js.map +1 -1
- package/build-module/alignment-matrix-control/cell.js.map +1 -1
- package/build-module/alignment-matrix-control/icon.js +4 -2
- package/build-module/alignment-matrix-control/icon.js.map +1 -1
- package/build-module/alignment-matrix-control/index.js +23 -1
- package/build-module/alignment-matrix-control/index.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js +13 -13
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +16 -16
- package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
- package/build-module/alignment-matrix-control/types.js +2 -0
- package/build-module/alignment-matrix-control/types.js.map +1 -0
- package/build-module/alignment-matrix-control/utils.js +13 -8
- package/build-module/alignment-matrix-control/utils.js.map +1 -1
- package/build-module/angle-picker-control/index.js +2 -1
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +9 -9
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/autocomplete/index.js +45 -12
- package/build-module/autocomplete/index.js.map +1 -1
- package/build-module/base-control/hooks.js +41 -0
- package/build-module/base-control/hooks.js.map +1 -0
- package/build-module/base-control/index.js +18 -8
- package/build-module/base-control/index.js.map +1 -1
- package/build-module/base-field/hook.js +0 -14
- package/build-module/base-field/hook.js.map +1 -1
- package/build-module/base-field/index.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/base-field/types.js +2 -0
- package/build-module/base-field/types.js.map +1 -0
- package/build-module/border-box-control/border-box-control/component.js +1 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control/hook.js +13 -1
- package/build-module/border-box-control/border-box-control/hook.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/hook.js +11 -1
- package/build-module/border-box-control/border-box-control-split-controls/hook.js.map +1 -1
- package/build-module/border-control/border-control/component.js +3 -2
- package/build-module/border-control/border-control/component.js.map +1 -1
- package/build-module/border-control/border-control/hook.js +11 -1
- package/build-module/border-control/border-control/hook.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/hook.js +10 -2
- package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
- package/build-module/border-control/styles.js +17 -17
- package/build-module/border-control/styles.js.map +1 -1
- package/build-module/box-control/linked-button.js +3 -4
- package/build-module/box-control/linked-button.js.map +1 -1
- package/build-module/color-palette/index.js +3 -8
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js +18 -3
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/styles.js +8 -8
- package/build-module/color-picker/styles.js.map +1 -1
- package/build-module/custom-select-control/index.js +19 -4
- package/build-module/custom-select-control/index.js.map +1 -1
- package/build-module/dashicon/index.js +18 -6
- package/build-module/dashicon/index.js.map +1 -1
- package/build-module/date-time/date-time/index.js +4 -4
- package/build-module/date-time/date-time/index.js.map +1 -1
- package/build-module/draggable/index.js +59 -38
- package/build-module/draggable/index.js.map +1 -1
- package/build-module/draggable/types.js +2 -0
- package/build-module/draggable/types.js.map +1 -0
- package/build-module/duotone-picker/duotone-picker.js +2 -2
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/flex/flex/hook.js +2 -3
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/focal-point-picker/focal-point.js +3 -13
- package/build-module/focal-point-picker/focal-point.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-style.js +6 -52
- package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
- package/build-module/font-size-picker/constants.js +31 -0
- package/build-module/font-size-picker/constants.js.map +1 -0
- package/build-module/font-size-picker/font-size-picker-select.js +83 -0
- package/build-module/font-size-picker/font-size-picker-select.js.map +1 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js +40 -0
- package/build-module/font-size-picker/font-size-picker-toggle-group.js.map +1 -0
- package/build-module/font-size-picker/index.js +38 -76
- package/build-module/font-size-picker/index.js.map +1 -1
- package/build-module/font-size-picker/utils.js +15 -86
- package/build-module/font-size-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +9 -6
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +3 -8
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/higher-order/navigate-regions/index.js +3 -0
- package/build-module/higher-order/navigate-regions/index.js.map +1 -1
- package/build-module/higher-order/with-fallback-styles/index.js +2 -2
- package/build-module/higher-order/with-fallback-styles/index.js.map +1 -1
- package/build-module/icon/index.js +3 -2
- package/build-module/icon/index.js.map +1 -1
- package/build-module/index.js +3 -2
- package/build-module/index.js.map +1 -1
- package/build-module/input-control/index.js +16 -5
- package/build-module/input-control/index.js.map +1 -1
- package/build-module/input-control/input-base.js +2 -0
- package/build-module/input-control/input-base.js.map +1 -1
- package/build-module/menu-group/index.js +20 -2
- package/build-module/menu-group/index.js.map +1 -1
- package/build-module/menu-group/types.js +2 -0
- package/build-module/menu-group/types.js.map +1 -0
- package/build-module/mobile/bottom-sheet/cell.native.js +1 -1
- package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/switch-cell.native.js +1 -2
- package/build-module/mobile/bottom-sheet/switch-cell.native.js.map +1 -1
- package/build-module/mobile/global-styles-context/index.native.js +8 -7
- package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/build-module/mobile/keyboard-aware-flat-list/index.ios.js.map +1 -1
- package/build-module/modal/index.js +8 -0
- package/build-module/modal/index.js.map +1 -1
- package/build-module/navigator/navigator-provider/component.js +12 -8
- package/build-module/navigator/navigator-provider/component.js.map +1 -1
- package/build-module/navigator/navigator-screen/component.js +9 -5
- package/build-module/navigator/navigator-screen/component.js.map +1 -1
- package/build-module/number-control/styles/number-control-styles.js +8 -10
- package/build-module/number-control/styles/number-control-styles.js.map +1 -1
- package/build-module/palette-edit/index.js +76 -35
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/popover/index.js +18 -6
- package/build-module/popover/index.js.map +1 -1
- package/build-module/query-controls/index.js +1 -0
- package/build-module/query-controls/index.js.map +1 -1
- package/build-module/range-control/styles/range-control-styles.js +47 -57
- package/build-module/range-control/styles/range-control-styles.js.map +1 -1
- package/build-module/snackbar/index.js +33 -23
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +14 -22
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/snackbar/types.js +2 -0
- package/build-module/snackbar/types.js.map +1 -0
- package/build-module/spinner/styles.js +4 -4
- package/build-module/spinner/styles.js.map +1 -1
- package/build-module/tab-panel/index.js +13 -9
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/theme/color-algorithms.js +105 -0
- package/build-module/theme/color-algorithms.js.map +1 -0
- package/build-module/theme/index.js +21 -17
- package/build-module/theme/index.js.map +1 -1
- package/build-module/theme/styles.js +8 -6
- package/build-module/theme/styles.js.map +1 -1
- package/build-module/toggle-control/index.js +4 -2
- package/build-module/toggle-control/index.js.map +1 -1
- package/build-module/toggle-group-control/toggle-group-control/component.js +1 -0
- 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 +12 -6
- package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
- package/build-module/tools-panel/styles.js +14 -14
- package/build-module/tools-panel/styles.js.map +1 -1
- package/build-module/tools-panel/tools-panel-item/hook.js +9 -5
- package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
- package/build-module/ui/context/context-system-provider.js +3 -2
- package/build-module/ui/context/context-system-provider.js.map +1 -1
- package/build-module/unit-control/index.js +5 -2
- package/build-module/unit-control/index.js.map +1 -1
- package/build-module/utils/colors-values.js +4 -3
- package/build-module/utils/colors-values.js.map +1 -1
- package/build-module/utils/config-values.js +0 -2
- package/build-module/utils/config-values.js.map +1 -1
- package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
- package/build-module/utils/input/base.js +2 -2
- package/build-module/utils/input/base.js.map +1 -1
- package/build-module/view/index.js.map +1 -1
- package/build-style/style-rtl.css +145 -100
- package/build-style/style.css +145 -100
- package/build-types/alignment-matrix-control/cell.d.ts +5 -0
- package/build-types/alignment-matrix-control/cell.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/icon.d.ts +6 -0
- package/build-types/alignment-matrix-control/icon.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/index.d.ts +30 -0
- package/build-types/alignment-matrix-control/index.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/stories/index.d.ts +14 -0
- package/build-types/alignment-matrix-control/stories/index.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts +19 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts +23 -0
- package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/test/index.d.ts +2 -0
- package/build-types/alignment-matrix-control/test/index.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/types.d.ts +39 -0
- package/build-types/alignment-matrix-control/types.d.ts.map +1 -0
- package/build-types/alignment-matrix-control/utils.d.ts +33 -0
- package/build-types/alignment-matrix-control/utils.d.ts.map +1 -0
- package/build-types/base-control/hooks.d.ts +23 -0
- package/build-types/base-control/hooks.d.ts.map +1 -0
- package/build-types/base-control/index.d.ts +17 -7
- package/build-types/base-control/index.d.ts.map +1 -1
- package/build-types/base-control/stories/index.d.ts.map +1 -1
- package/build-types/base-control/test/index.d.ts +2 -0
- package/build-types/base-control/test/index.d.ts.map +1 -0
- package/build-types/base-control/types.d.ts +8 -2
- package/build-types/base-control/types.d.ts.map +1 -1
- package/build-types/base-field/hook.d.ts +7 -31
- package/build-types/base-field/hook.d.ts.map +1 -1
- package/build-types/base-field/index.d.ts +1 -1
- package/build-types/base-field/index.d.ts.map +1 -1
- package/build-types/base-field/styles.d.ts +5 -5
- package/build-types/base-field/styles.d.ts.map +1 -1
- package/build-types/base-field/test/index.d.ts +2 -0
- package/build-types/base-field/test/index.d.ts.map +1 -0
- package/build-types/base-field/types.d.ts +29 -0
- package/build-types/base-field/types.d.ts.map +1 -0
- package/build-types/border-box-control/border-box-control/component.d.ts +4 -4
- package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control/hook.d.ts +8 -8
- package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts +4 -2
- package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
- 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/component.d.ts +3 -3
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +7 -7
- package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/component.d.ts +3 -2
- package/build-types/border-box-control/border-box-control-visualizer/component.d.ts.map +1 -1
- package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +2 -2
- package/build-types/border-box-control/stories/index.d.ts +3 -3
- package/build-types/border-box-control/types.d.ts +5 -38
- package/build-types/border-box-control/types.d.ts.map +1 -1
- package/build-types/border-control/border-control/component.d.ts +4 -2
- package/build-types/border-control/border-control/component.d.ts.map +1 -1
- package/build-types/border-control/border-control/hook.d.ts +7 -7
- package/build-types/border-control/border-control/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/component.d.ts +3 -3
- package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
- package/build-types/border-control/border-control-dropdown/hook.d.ts +7 -7
- package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
- package/build-types/border-control/border-control-style-picker/hook.d.ts +2 -2
- package/build-types/border-control/stories/index.d.ts +24 -12
- package/build-types/border-control/stories/index.d.ts.map +1 -1
- package/build-types/border-control/styles.d.ts.map +1 -1
- package/build-types/border-control/types.d.ts +10 -51
- package/build-types/border-control/types.d.ts.map +1 -1
- 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/index.d.ts +16 -2
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/color-palette/stories/index.d.ts +30 -2
- package/build-types/color-palette/stories/index.d.ts.map +1 -1
- package/build-types/color-palette/styles.d.ts +1 -1
- package/build-types/color-palette/types.d.ts +14 -10
- package/build-types/color-palette/types.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/styles.d.ts +5 -5
- package/build-types/color-picker/styles.d.ts.map +1 -1
- package/build-types/custom-select-control/index.d.ts.map +1 -1
- package/build-types/dashicon/index.d.ts +7 -16
- package/build-types/dashicon/index.d.ts.map +1 -1
- package/build-types/dashicon/types.d.ts +14 -0
- package/build-types/dashicon/types.d.ts.map +1 -1
- package/build-types/date-time/date/styles.d.ts +3 -3
- package/build-types/date-time/date-time/styles.d.ts +3 -3
- package/build-types/date-time/time/styles.d.ts +8 -8
- package/build-types/date-time/types.d.ts +0 -16
- package/build-types/date-time/types.d.ts.map +1 -1
- package/build-types/draggable/index.d.ts +42 -66
- package/build-types/draggable/index.d.ts.map +1 -1
- package/build-types/draggable/stories/index.d.ts +12 -0
- package/build-types/draggable/stories/index.d.ts.map +1 -0
- package/build-types/draggable/types.d.ts +58 -0
- package/build-types/draggable/types.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/hook.d.ts.map +1 -1
- 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/focal-point.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -5
- package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts +1 -12
- package/build-types/focal-point-picker/styles/focal-point-style.d.ts.map +1 -1
- package/build-types/font-size-picker/constants.d.ts +15 -0
- package/build-types/font-size-picker/constants.d.ts.map +1 -0
- package/build-types/font-size-picker/font-size-picker-select.d.ts +5 -0
- package/build-types/font-size-picker/font-size-picker-select.d.ts.map +1 -0
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts +5 -0
- package/build-types/font-size-picker/font-size-picker-toggle-group.d.ts.map +1 -0
- package/build-types/font-size-picker/index.d.ts.map +1 -1
- package/build-types/font-size-picker/types.d.ts +13 -13
- package/build-types/font-size-picker/types.d.ts.map +1 -1
- package/build-types/font-size-picker/utils.d.ts +6 -18
- package/build-types/font-size-picker/utils.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/grid/hook.d.ts +2 -2
- package/build-types/h-stack/component.d.ts +1 -1
- package/build-types/h-stack/hook.d.ts +2 -2
- package/build-types/heading/hook.d.ts +2 -2
- package/build-types/icon/index.d.ts +1 -1
- package/build-types/icon/index.d.ts.map +1 -1
- package/build-types/input-control/index.d.ts +1 -1
- package/build-types/input-control/index.d.ts.map +1 -1
- package/build-types/input-control/input-base.d.ts.map +1 -1
- package/build-types/input-control/stories/index.d.ts +1 -0
- package/build-types/input-control/stories/index.d.ts.map +1 -1
- package/build-types/input-control/types.d.ts +2 -1
- package/build-types/input-control/types.d.ts.map +1 -1
- 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/menu-group/index.d.ts +21 -1
- package/build-types/menu-group/index.d.ts.map +1 -1
- package/build-types/menu-group/test/index.d.ts +2 -0
- package/build-types/menu-group/test/index.d.ts.map +1 -0
- package/build-types/menu-group/types.d.ts +23 -0
- package/build-types/menu-group/types.d.ts.map +1 -0
- package/build-types/modal/index.d.ts.map +1 -1
- package/build-types/modal/stories/index.d.ts.map +1 -1
- package/build-types/navigator/navigator-back-button/hook.d.ts +3 -3
- package/build-types/navigator/navigator-button/hook.d.ts +3 -3
- package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
- package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
- package/build-types/number-control/index.d.ts +2 -2
- package/build-types/number-control/index.d.ts.map +1 -1
- package/build-types/number-control/stories/index.d.ts +25 -0
- package/build-types/number-control/stories/index.d.ts.map +1 -0
- package/build-types/number-control/styles/number-control-styles.d.ts +6 -6
- package/build-types/number-control/styles/number-control-styles.d.ts.map +1 -1
- package/build-types/number-control/test/index.d.ts +2 -0
- package/build-types/number-control/test/index.d.ts.map +1 -0
- package/build-types/popover/index.d.ts +1 -1
- package/build-types/popover/index.d.ts.map +1 -1
- package/build-types/popover/stories/e2e/index.d.ts +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/resize-tooltip/index.d.ts +15 -19
- package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/label.d.ts +4 -3
- package/build-types/resizable-box/resize-tooltip/label.d.ts.map +1 -1
- 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/snackbar/index.d.ts +19 -0
- package/build-types/snackbar/index.d.ts.map +1 -0
- package/build-types/snackbar/list.d.ts +18 -0
- package/build-types/snackbar/list.d.ts.map +1 -0
- package/build-types/snackbar/stories/index.d.ts +16 -0
- package/build-types/snackbar/stories/index.d.ts.map +1 -0
- package/build-types/snackbar/stories/list.d.ts +12 -0
- package/build-types/snackbar/stories/list.d.ts.map +1 -0
- package/build-types/snackbar/types.d.ts +111 -0
- package/build-types/snackbar/types.d.ts.map +1 -0
- 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 +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tab-panel/types.d.ts +19 -1
- package/build-types/tab-panel/types.d.ts.map +1 -1
- package/build-types/text/hook.d.ts +2 -2
- package/build-types/text-control/index.d.ts +2 -2
- package/build-types/text-control/stories/index.d.ts.map +1 -1
- package/build-types/text-control/types.d.ts +1 -5
- package/build-types/text-control/types.d.ts.map +1 -1
- package/build-types/theme/color-algorithms.d.ts +20 -0
- package/build-types/theme/color-algorithms.d.ts.map +1 -0
- package/build-types/theme/index.d.ts +1 -1
- package/build-types/theme/index.d.ts.map +1 -1
- package/build-types/theme/stories/index.d.ts +4 -0
- package/build-types/theme/stories/index.d.ts.map +1 -1
- package/build-types/theme/styles.d.ts +3 -2
- package/build-types/theme/styles.d.ts.map +1 -1
- package/build-types/theme/test/color-algorithms.d.ts +2 -0
- package/build-types/theme/test/color-algorithms.d.ts.map +1 -0
- package/build-types/theme/types.d.ts +41 -3
- package/build-types/theme/types.d.ts.map +1 -1
- package/build-types/toggle-control/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/stories/index.d.ts.map +1 -1
- package/build-types/toggle-group-control/toggle-group-control/as-button-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts +2 -2
- package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +1 -2
- 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 +1 -1
- package/build-types/toggle-group-control/toggle-group-control-option-icon/component.d.ts +1 -1
- package/build-types/toggle-group-control/types.d.ts +2 -1
- package/build-types/toggle-group-control/types.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts +2 -2
- 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/tools-panel-item/hook.d.ts.map +1 -1
- package/build-types/truncate/hook.d.ts +2 -2
- package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
- 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 +5 -5
- 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/styles/unit-control-styles.d.ts +2 -2
- package/build-types/unit-control/types.d.ts +4 -0
- package/build-types/unit-control/types.d.ts.map +1 -1
- package/build-types/utils/colors-values.d.ts +1 -0
- package/build-types/utils/colors-values.d.ts.map +1 -1
- package/build-types/utils/config-values.d.ts +0 -2
- package/build-types/utils/hooks/use-controlled-value.d.ts +2 -1
- package/build-types/utils/hooks/use-controlled-value.d.ts.map +1 -1
- package/build-types/v-stack/component.d.ts +2 -2
- package/build-types/v-stack/hook.d.ts +2 -2
- package/build-types/v-stack/stories/index.d.ts +2 -2
- package/build-types/view/index.d.ts +1 -1
- package/build-types/view/index.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/alignment-matrix-control/README.md +7 -7
- package/src/alignment-matrix-control/{cell.js → cell.tsx} +7 -1
- package/src/alignment-matrix-control/{icon.js → icon.tsx} +6 -3
- package/src/alignment-matrix-control/{index.js → index.tsx} +31 -4
- package/src/alignment-matrix-control/stories/{index.js → index.tsx} +17 -9
- package/src/alignment-matrix-control/styles/{alignment-matrix-control-icon-styles.js → alignment-matrix-control-icon-styles.ts} +11 -3
- package/src/alignment-matrix-control/styles/{alignment-matrix-control-styles.js → alignment-matrix-control-styles.ts} +13 -3
- package/src/alignment-matrix-control/test/{index.js → index.tsx} +5 -5
- package/src/alignment-matrix-control/types.ts +54 -0
- package/src/alignment-matrix-control/{utils.js → utils.tsx} +24 -14
- package/src/angle-picker-control/index.js +2 -1
- package/src/angle-picker-control/styles/angle-picker-control-styles.js +4 -0
- package/src/autocomplete/index.js +55 -15
- package/src/autocomplete/style.scss +1 -1
- package/src/base-control/README.md +21 -12
- package/src/base-control/hooks.ts +45 -0
- package/src/base-control/index.tsx +18 -7
- package/src/base-control/stories/index.tsx +8 -10
- package/src/base-control/test/index.tsx +52 -0
- package/src/base-control/types.ts +8 -2
- package/src/base-field/README.md +21 -22
- package/src/base-field/{hook.js → hook.ts} +5 -15
- package/src/base-field/{index.js → index.ts} +0 -0
- package/src/base-field/{styles.js → styles.ts} +2 -2
- package/src/base-field/test/__snapshots__/{index.js.snap → index.tsx.snap} +13 -11
- package/src/base-field/test/index.tsx +84 -0
- package/src/base-field/types.ts +29 -0
- package/src/border-box-control/border-box-control/README.md +6 -17
- package/src/border-box-control/border-box-control/component.tsx +1 -1
- package/src/border-box-control/border-box-control/hook.ts +18 -4
- package/src/border-box-control/border-box-control-split-controls/hook.ts +10 -0
- package/src/border-box-control/test/index.js +3 -1
- package/src/border-box-control/types.ts +32 -58
- package/src/border-control/border-control/README.md +4 -17
- package/src/border-control/border-control/component.tsx +3 -2
- package/src/border-control/border-control/hook.ts +10 -0
- package/src/border-control/border-control-dropdown/component.tsx +7 -6
- package/src/border-control/border-control-dropdown/hook.ts +9 -1
- package/src/border-control/styles.ts +1 -10
- package/src/border-control/types.ts +43 -80
- package/src/box-control/linked-button.js +8 -11
- package/src/box-control/test/index.js +206 -135
- package/src/button/stories/index.js +30 -0
- package/src/button/style.scss +17 -14
- package/src/button/test/index.js +32 -15
- package/src/card/test/__snapshots__/index.tsx.snap +64 -368
- package/src/card/test/index.tsx +34 -22
- package/src/checkbox-control/style.scss +3 -3
- package/src/circular-option-picker/style.scss +1 -0
- package/src/color-palette/README.md +12 -16
- package/src/color-palette/index.tsx +5 -7
- package/src/color-palette/stories/index.tsx +1 -5
- package/src/color-palette/style.scss +1 -1
- package/src/color-palette/test/__snapshots__/index.tsx.snap +4 -4
- package/src/color-palette/test/index.tsx +84 -36
- package/src/color-palette/types.ts +14 -10
- package/src/color-picker/README.md +1 -0
- package/src/color-picker/input-with-slider.tsx +14 -2
- package/src/color-picker/styles.ts +0 -4
- package/src/confirm-dialog/README.md +3 -2
- package/src/custom-select-control/README.md +14 -0
- package/src/custom-select-control/index.js +21 -2
- package/src/custom-select-control/stories/index.js +1 -0
- package/src/custom-select-control/style.scss +6 -1
- package/src/custom-select-control/test/index.js +39 -0
- package/src/dashicon/index.tsx +51 -0
- package/src/dashicon/types.ts +17 -0
- package/src/date-time/date/test/index.tsx +2 -2
- package/src/date-time/date-time/index.tsx +2 -2
- package/src/date-time/types.ts +0 -19
- package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -8
- package/src/disabled/test/index.tsx +21 -11
- package/src/divider/test/index.tsx +4 -4
- package/src/draggable/README.md +13 -18
- package/src/draggable/{index.js → index.tsx} +71 -47
- package/src/draggable/stories/index.tsx +83 -0
- package/src/draggable/types.ts +58 -0
- package/src/drop-zone/style.scss +1 -1
- package/src/dropdown/test/index.js +39 -49
- package/src/dropdown-menu/test/index.js +18 -12
- package/src/duotone-picker/duotone-picker.js +2 -2
- package/src/flex/flex/hook.ts +0 -3
- package/src/flex/test/index.tsx +29 -3
- package/src/focal-point-picker/focal-point.tsx +2 -24
- package/src/focal-point-picker/styles/focal-point-style.ts +8 -32
- package/src/focal-point-picker/test/media.js +26 -21
- package/src/font-size-picker/constants.ts +37 -0
- package/src/font-size-picker/font-size-picker-select.tsx +98 -0
- package/src/font-size-picker/font-size-picker-toggle-group.tsx +41 -0
- package/src/font-size-picker/index.tsx +55 -118
- package/src/font-size-picker/test/index.tsx +253 -44
- package/src/font-size-picker/test/utils.ts +58 -98
- package/src/font-size-picker/types.ts +25 -16
- package/src/font-size-picker/utils.ts +16 -102
- package/src/form-toggle/style.scss +3 -3
- package/src/form-token-field/index.tsx +13 -5
- package/src/form-token-field/style.scss +3 -3
- package/src/form-token-field/test/index.tsx +6 -6
- package/src/gradient-picker/index.js +5 -8
- package/src/grid/test/grid.tsx +31 -31
- package/src/higher-order/navigate-regions/index.js +4 -0
- package/src/higher-order/navigate-regions/style.scss +52 -20
- package/src/higher-order/with-fallback-styles/index.js +4 -2
- package/src/higher-order/with-filters/test/index.js +94 -101
- package/src/higher-order/with-focus-return/test/index.js +1 -4
- package/src/higher-order/with-notices/test/index.js +1 -1
- package/src/icon/index.tsx +3 -2
- package/src/icon/test/index.js +10 -0
- package/src/index.js +3 -2
- package/src/input-control/index.tsx +42 -28
- package/src/input-control/input-base.tsx +8 -1
- package/src/input-control/stories/index.tsx +6 -0
- package/src/input-control/test/index.js +18 -0
- package/src/input-control/types.ts +2 -0
- package/src/item-group/stories/index.js +1 -1
- package/src/menu-group/{index.js → index.tsx} +22 -3
- package/src/menu-group/test/{index.js → index.tsx} +0 -0
- package/src/menu-group/types.ts +23 -0
- package/src/menu-item/style.scss +1 -1
- package/src/mobile/bottom-sheet/cell.native.js +1 -1
- package/src/mobile/bottom-sheet/switch-cell.native.js +2 -2
- package/src/mobile/bottom-sheet/test/range-cell.native.js +4 -4
- package/src/mobile/global-styles-context/index.native.js +9 -11
- package/src/mobile/html-text-input/test/index.native.js +2 -2
- package/src/mobile/keyboard-aware-flat-list/index.ios.js +2 -2
- package/src/mobile/link-settings/test/edit.native.js +70 -126
- package/src/mobile/link-settings/test/link-settings-navigation.native.js +5 -5
- package/src/modal/index.tsx +11 -0
- package/src/modal/stories/index.tsx +3 -0
- package/src/modal/test/index.tsx +15 -0
- package/src/navigation/stories/index.js +6 -6
- package/src/navigation/stories/{controlled-state.js → utils/controlled-state.js} +3 -3
- package/src/navigation/stories/{default.js → utils/default.js} +3 -3
- package/src/navigation/stories/{group.js → utils/group.js} +4 -4
- package/src/navigation/stories/{hide-if-empty.js → utils/hide-if-empty.js} +3 -3
- package/src/navigation/stories/{more-examples.js → utils/more-examples.js} +4 -4
- package/src/navigation/stories/{search.js → utils/search.js} +5 -5
- package/src/navigator/navigator-provider/component.tsx +13 -10
- package/src/navigator/navigator-screen/component.tsx +8 -3
- package/src/notice/README.md +2 -1
- package/src/notice/style.scss +1 -1
- package/src/notice/test/list.js +8 -5
- package/src/number-control/stories/{index.js → index.tsx} +24 -7
- package/src/number-control/styles/{number-control-styles.js → number-control-styles.ts} +5 -3
- package/src/number-control/test/index.tsx +600 -0
- package/src/palette-edit/index.js +91 -39
- package/src/palette-edit/test/index.js +25 -1
- package/src/panel/style.scss +1 -1
- package/src/popover/index.tsx +28 -9
- package/src/popover/style.scss +12 -11
- package/src/popover/test/index.tsx +25 -15
- package/src/query-controls/index.js +1 -0
- package/src/range-control/styles/range-control-styles.ts +2 -2
- package/src/range-control/test/index.tsx +57 -60
- package/src/resizable-box/style.scss +3 -2
- package/src/sandbox/test/index.js +13 -11
- package/src/scrollable/test/index.tsx +7 -3
- package/src/search-control/style.scss +5 -1
- package/src/snackbar/README.md +63 -8
- package/src/snackbar/{index.js → index.tsx} +46 -28
- package/src/snackbar/{list.js → list.tsx} +20 -21
- package/src/snackbar/stories/index.tsx +96 -0
- package/src/snackbar/stories/list.tsx +98 -0
- package/src/snackbar/style.scss +2 -2
- package/src/snackbar/types.ts +116 -0
- package/src/spacer/test/index.tsx +33 -3
- package/src/spinner/styles.ts +1 -1
- package/src/surface/test/index.tsx +12 -12
- package/src/tab-panel/README.md +9 -0
- package/src/tab-panel/index.tsx +23 -9
- package/src/tab-panel/style.scss +46 -35
- package/src/tab-panel/test/index.tsx +111 -0
- package/src/tab-panel/types.ts +20 -1
- package/src/text/test/__snapshots__/index.tsx.snap +1 -0
- package/src/text/test/index.tsx +100 -48
- package/src/text-control/stories/index.tsx +0 -1
- package/src/text-control/types.ts +1 -6
- package/src/theme/README.md +32 -2
- package/src/theme/color-algorithms.ts +138 -0
- package/src/theme/index.tsx +23 -16
- package/src/theme/stories/index.tsx +67 -0
- package/src/theme/styles.ts +22 -17
- package/src/theme/test/color-algorithms.ts +100 -0
- package/src/theme/test/index.tsx +68 -35
- package/src/theme/types.ts +43 -3
- package/src/toggle-control/index.tsx +4 -2
- package/src/toggle-group-control/stories/index.tsx +2 -0
- package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +6 -8
- package/src/toggle-group-control/test/index.tsx +40 -17
- package/src/toggle-group-control/toggle-group-control/README.md +8 -1
- package/src/toggle-group-control/toggle-group-control/component.tsx +1 -1
- package/src/toggle-group-control/toggle-group-control/styles.ts +22 -16
- package/src/toggle-group-control/types.ts +2 -1
- package/src/toolbar-group/test/index.js +8 -6
- package/src/tools-panel/stories/index.js +1 -1
- package/src/tools-panel/stories/{tools-panel-with-item-group-slot.js → utils/tools-panel-with-item-group-slot.js} +14 -11
- package/src/tools-panel/styles.ts +1 -1
- package/src/tools-panel/test/index.js +20 -14
- package/src/tools-panel/tools-panel-item/hook.ts +6 -1
- package/src/tooltip/README.md +7 -0
- package/src/tooltip/style.scss +2 -2
- package/src/tooltip/test/index.js +109 -18
- package/src/tree-grid/test/index.js +12 -12
- package/src/truncate/test/index.tsx +9 -9
- package/src/ui/context/context-system-provider.js +3 -2
- package/src/ui/context/test/context-system-provider.js +5 -4
- package/src/ui/control-label/test/index.js +3 -5
- package/src/ui/form-group/test/index.js +16 -17
- package/src/unit-control/README.md +9 -1
- package/src/unit-control/index.tsx +3 -0
- package/src/unit-control/test/index.tsx +1 -0
- package/src/unit-control/types.ts +4 -0
- package/src/utils/colors-values.js +5 -3
- package/src/utils/config-values.js +0 -2
- package/src/utils/hooks/stories/use-cx.js +1 -1
- package/src/utils/hooks/use-controlled-value.ts +2 -2
- package/src/utils/input/base.js +2 -2
- package/src/utils/theme-variables.scss +20 -0
- package/src/view/{index.js → index.ts} +0 -0
- package/tsconfig.json +2 -4
- package/tsconfig.tsbuildinfo +1 -1
- package/src/base-field/test/index.js +0 -67
- package/src/dashicon/index.js +0 -26
- package/src/draggable/stories/index.js +0 -72
- package/src/number-control/test/index.js +0 -478
- package/src/snackbar/stories/index.js +0 -89
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { colord, extend } from 'colord';
|
|
5
|
+
import a11yPlugin from 'colord/plugins/a11y';
|
|
6
|
+
import namesPlugin from 'colord/plugins/names';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
import warning from '@wordpress/warning';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
import type { ThemeInputValues, ThemeOutputValues } from './types';
|
|
17
|
+
import { COLORS } from '../utils';
|
|
18
|
+
|
|
19
|
+
extend( [ namesPlugin, a11yPlugin ] );
|
|
20
|
+
|
|
21
|
+
export function generateThemeVariables(
|
|
22
|
+
inputs: ThemeInputValues
|
|
23
|
+
): ThemeOutputValues {
|
|
24
|
+
validateInputs( inputs );
|
|
25
|
+
|
|
26
|
+
const generatedColors = {
|
|
27
|
+
...generateAccentDependentColors( inputs.accent ),
|
|
28
|
+
...generateBackgroundDependentColors( inputs.background ),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
warnContrastIssues( checkContrasts( inputs, generatedColors ) );
|
|
32
|
+
|
|
33
|
+
return { colors: generatedColors };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function validateInputs( inputs: ThemeInputValues ) {
|
|
37
|
+
for ( const [ key, value ] of Object.entries( inputs ) ) {
|
|
38
|
+
if ( typeof value !== 'undefined' && ! colord( value ).isValid() ) {
|
|
39
|
+
warning(
|
|
40
|
+
`wp.components.Theme: "${ value }" is not a valid color value for the '${ key }' prop.`
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function checkContrasts(
|
|
47
|
+
inputs: ThemeInputValues,
|
|
48
|
+
outputs: ThemeOutputValues[ 'colors' ]
|
|
49
|
+
) {
|
|
50
|
+
const background = inputs.background || COLORS.white;
|
|
51
|
+
const accent = inputs.accent || '#007cba';
|
|
52
|
+
const foreground = outputs.foreground || COLORS.gray[ 900 ];
|
|
53
|
+
const gray = outputs.gray || COLORS.gray;
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
accent: colord( background ).isReadable( accent )
|
|
57
|
+
? undefined
|
|
58
|
+
: `The background color ("${ background }") does not have sufficient contrast against the accent color ("${ accent }").`,
|
|
59
|
+
foreground: colord( background ).isReadable( foreground )
|
|
60
|
+
? undefined
|
|
61
|
+
: `The background color provided ("${ background }") does not have sufficient contrast against the standard foreground colors.`,
|
|
62
|
+
grays:
|
|
63
|
+
colord( background ).contrast( gray[ 600 ] ) >= 3 &&
|
|
64
|
+
colord( background ).contrast( gray[ 700 ] ) >= 4.5
|
|
65
|
+
? undefined
|
|
66
|
+
: `The background color provided ("${ background }") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.`,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function warnContrastIssues( issues: ReturnType< typeof checkContrasts > ) {
|
|
71
|
+
for ( const error of Object.values( issues ) ) {
|
|
72
|
+
if ( error ) {
|
|
73
|
+
warning( 'wp.components.Theme: ' + error );
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function generateAccentDependentColors( accent?: string ) {
|
|
79
|
+
if ( ! accent ) return {};
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
accent,
|
|
83
|
+
accentDarker10: colord( accent ).darken( 0.1 ).toHex(),
|
|
84
|
+
accentDarker20: colord( accent ).darken( 0.2 ).toHex(),
|
|
85
|
+
accentInverted: getForegroundForColor( accent ),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function generateBackgroundDependentColors( background?: string ) {
|
|
90
|
+
if ( ! background ) return {};
|
|
91
|
+
|
|
92
|
+
const foreground = getForegroundForColor( background );
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
background,
|
|
96
|
+
foreground,
|
|
97
|
+
foregroundInverted: getForegroundForColor( foreground ),
|
|
98
|
+
gray: generateShades( background, foreground ),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function getForegroundForColor( color: string ) {
|
|
103
|
+
return colord( color ).isDark() ? COLORS.white : COLORS.gray[ 900 ];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function generateShades( background: string, foreground: string ) {
|
|
107
|
+
// How much darkness you need to add to #fff to get the COLORS.gray[n] color
|
|
108
|
+
const SHADES = {
|
|
109
|
+
100: 0.06,
|
|
110
|
+
200: 0.121,
|
|
111
|
+
300: 0.132,
|
|
112
|
+
400: 0.2,
|
|
113
|
+
600: 0.42,
|
|
114
|
+
700: 0.543,
|
|
115
|
+
800: 0.821,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// Darkness of COLORS.gray[ 900 ], relative to #fff
|
|
119
|
+
const limit = 0.884;
|
|
120
|
+
|
|
121
|
+
const direction = colord( background ).isDark() ? 'lighten' : 'darken';
|
|
122
|
+
|
|
123
|
+
// Lightness delta between the background and foreground colors
|
|
124
|
+
const range =
|
|
125
|
+
Math.abs(
|
|
126
|
+
colord( background ).toHsl().l - colord( foreground ).toHsl().l
|
|
127
|
+
) / 100;
|
|
128
|
+
|
|
129
|
+
const result: Record< number, string > = {};
|
|
130
|
+
|
|
131
|
+
Object.entries( SHADES ).forEach( ( [ key, value ] ) => {
|
|
132
|
+
result[ parseInt( key ) ] = colord( background )
|
|
133
|
+
[ direction ]( ( value / limit ) * range )
|
|
134
|
+
.toHex();
|
|
135
|
+
} );
|
|
136
|
+
|
|
137
|
+
return result as NonNullable< ThemeOutputValues[ 'colors' ][ 'gray' ] >;
|
|
138
|
+
}
|
package/src/theme/index.tsx
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import a11yPlugin from 'colord/plugins/a11y';
|
|
6
|
-
import namesPlugin from 'colord/plugins/names';
|
|
4
|
+
import { useMemo } from '@wordpress/element';
|
|
7
5
|
|
|
8
6
|
/**
|
|
9
7
|
* Internal dependencies
|
|
10
8
|
*/
|
|
11
9
|
import type { ThemeProps } from './types';
|
|
12
10
|
import type { WordPressComponentProps } from '../ui/context';
|
|
13
|
-
import { Wrapper } from './styles';
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
import { colorVariables, Wrapper } from './styles';
|
|
12
|
+
import { generateThemeVariables } from './color-algorithms';
|
|
13
|
+
import { useCx } from '../utils';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* `Theme` allows defining theme variables for components in the `@wordpress/components` package.
|
|
@@ -36,16 +34,25 @@ extend( [ namesPlugin, a11yPlugin ] );
|
|
|
36
34
|
* };
|
|
37
35
|
* ```
|
|
38
36
|
*/
|
|
39
|
-
function Theme(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
function Theme( {
|
|
38
|
+
accent,
|
|
39
|
+
background,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}: WordPressComponentProps< ThemeProps, 'div', true > ) {
|
|
43
|
+
const cx = useCx();
|
|
44
|
+
const classes = useMemo(
|
|
45
|
+
() =>
|
|
46
|
+
cx(
|
|
47
|
+
...colorVariables(
|
|
48
|
+
generateThemeVariables( { accent, background } )
|
|
49
|
+
),
|
|
50
|
+
className
|
|
51
|
+
),
|
|
52
|
+
[ accent, background, className, cx ]
|
|
53
|
+
);
|
|
47
54
|
|
|
48
|
-
return <Wrapper { ...props } />;
|
|
55
|
+
return <Wrapper className={ classes } { ...props } />;
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
export default Theme;
|
|
@@ -8,12 +8,15 @@ import type { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
|
8
8
|
*/
|
|
9
9
|
import Theme from '../index';
|
|
10
10
|
import Button from '../../button';
|
|
11
|
+
import { generateThemeVariables, checkContrasts } from '../color-algorithms';
|
|
12
|
+
import { HStack } from '../../h-stack';
|
|
11
13
|
|
|
12
14
|
const meta: ComponentMeta< typeof Theme > = {
|
|
13
15
|
component: Theme,
|
|
14
16
|
title: 'Components (Experimental)/Theme',
|
|
15
17
|
argTypes: {
|
|
16
18
|
accent: { control: { type: 'color' } },
|
|
19
|
+
background: { control: { type: 'color' } },
|
|
17
20
|
},
|
|
18
21
|
parameters: {
|
|
19
22
|
controls: { expanded: true },
|
|
@@ -45,3 +48,67 @@ export const Nested: ComponentStory< typeof Theme > = ( args ) => (
|
|
|
45
48
|
Nested.args = {
|
|
46
49
|
accent: 'blue',
|
|
47
50
|
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The rest of the required colors are generated based on the given accent and background colors.
|
|
54
|
+
*/
|
|
55
|
+
export const ColorScheme: ComponentStory< typeof Theme > = ( {
|
|
56
|
+
accent,
|
|
57
|
+
background,
|
|
58
|
+
} ) => {
|
|
59
|
+
const { colors } = generateThemeVariables( { accent, background } );
|
|
60
|
+
const { gray, ...otherColors } = colors;
|
|
61
|
+
const contrastIssues = Object.entries(
|
|
62
|
+
checkContrasts( { accent, background }, colors )
|
|
63
|
+
).filter( ( [ _, error ] ) => !! error );
|
|
64
|
+
|
|
65
|
+
const Chip = ( { color, name }: { color: string; name: string } ) => (
|
|
66
|
+
<HStack justify="flex-start">
|
|
67
|
+
<div
|
|
68
|
+
style={ {
|
|
69
|
+
backgroundColor: color,
|
|
70
|
+
height: '1.25em',
|
|
71
|
+
width: 40,
|
|
72
|
+
} }
|
|
73
|
+
/>
|
|
74
|
+
<div style={ { fontSize: 14 } }>{ name }</div>
|
|
75
|
+
</HStack>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
{ Object.entries( otherColors ).map( ( [ key, value ] ) => (
|
|
81
|
+
<Chip color={ value } name={ key } key={ key } />
|
|
82
|
+
) ) }
|
|
83
|
+
{ Object.entries( gray as NonNullable< typeof gray > ).map(
|
|
84
|
+
( [ key, value ] ) => (
|
|
85
|
+
<Chip
|
|
86
|
+
color={ value }
|
|
87
|
+
name={ `gray ${ key }` }
|
|
88
|
+
key={ key }
|
|
89
|
+
/>
|
|
90
|
+
)
|
|
91
|
+
) }
|
|
92
|
+
{ !! contrastIssues.length && (
|
|
93
|
+
<>
|
|
94
|
+
<h2>Contrast issues</h2>
|
|
95
|
+
<ul>
|
|
96
|
+
{ contrastIssues.map( ( [ key, error ] ) => (
|
|
97
|
+
<li key={ key }>{ error }</li>
|
|
98
|
+
) ) }
|
|
99
|
+
</ul>
|
|
100
|
+
</>
|
|
101
|
+
) }
|
|
102
|
+
</>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
ColorScheme.args = {
|
|
106
|
+
accent: '#007cba',
|
|
107
|
+
background: '#fff',
|
|
108
|
+
};
|
|
109
|
+
ColorScheme.argTypes = {
|
|
110
|
+
children: { table: { disable: true } },
|
|
111
|
+
};
|
|
112
|
+
ColorScheme.parameters = {
|
|
113
|
+
docs: { source: { state: 'closed' } },
|
|
114
|
+
};
|
package/src/theme/styles.ts
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { colord } from 'colord';
|
|
5
4
|
import styled from '@emotion/styled';
|
|
6
5
|
import { css } from '@emotion/react';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
|
-
import type {
|
|
10
|
+
import type { ThemeOutputValues } from './types';
|
|
12
11
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
--wp-components-color-accent-darker-10: ${ colord( accent )
|
|
18
|
-
.darken( 0.1 )
|
|
19
|
-
.toHex() };
|
|
20
|
-
--wp-components-color-accent-darker-20: ${ colord( accent )
|
|
21
|
-
.darken( 0.2 )
|
|
22
|
-
.toHex() };
|
|
23
|
-
`
|
|
24
|
-
: undefined;
|
|
12
|
+
export const colorVariables = ( { colors }: ThemeOutputValues ) => {
|
|
13
|
+
const shades = Object.entries( colors.gray || {} )
|
|
14
|
+
.map( ( [ k, v ] ) => `--wp-components-color-gray-${ k }: ${ v };` )
|
|
15
|
+
.join( '' );
|
|
25
16
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
return [
|
|
18
|
+
css`
|
|
19
|
+
--wp-components-color-accent: ${ colors.accent };
|
|
20
|
+
--wp-components-color-accent-darker-10: ${ colors.accentDarker10 };
|
|
21
|
+
--wp-components-color-accent-darker-20: ${ colors.accentDarker20 };
|
|
22
|
+
--wp-components-color-accent-inverted: ${ colors.accentInverted };
|
|
23
|
+
|
|
24
|
+
--wp-components-color-background: ${ colors.background };
|
|
25
|
+
--wp-components-color-foreground: ${ colors.foreground };
|
|
26
|
+
--wp-components-color-foreground-inverted: ${ colors.foregroundInverted };
|
|
27
|
+
|
|
28
|
+
${ shades }
|
|
29
|
+
`,
|
|
30
|
+
];
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Wrapper = styled.div``;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { colord } from 'colord';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { COLORS } from '../../utils';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { generateShades, generateThemeVariables } from '../color-algorithms';
|
|
15
|
+
|
|
16
|
+
describe( 'Theme color algorithms', () => {
|
|
17
|
+
describe( 'generateThemeVariables', () => {
|
|
18
|
+
it( 'should allow explicitly undefined values', () => {
|
|
19
|
+
generateThemeVariables( {
|
|
20
|
+
accent: undefined,
|
|
21
|
+
background: undefined,
|
|
22
|
+
} );
|
|
23
|
+
expect( console ).not.toHaveWarned();
|
|
24
|
+
} );
|
|
25
|
+
|
|
26
|
+
it( 'should warn if invalid colors are passed', () => {
|
|
27
|
+
generateThemeVariables( { accent: 'var(--invalid)' } );
|
|
28
|
+
expect( console ).toHaveWarned();
|
|
29
|
+
} );
|
|
30
|
+
|
|
31
|
+
it( 'should warn if standard foreground colors are not readable against background', () => {
|
|
32
|
+
generateThemeVariables( { background: '#777' } );
|
|
33
|
+
expect( console ).toHaveWarnedWith(
|
|
34
|
+
'wp.components.Theme: The background color provided ("#777") does not have sufficient contrast against the standard foreground colors.'
|
|
35
|
+
);
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
it( 'should warn if accent color is not readable against background', () => {
|
|
39
|
+
generateThemeVariables( { background: '#fefefe' } );
|
|
40
|
+
expect( console ).not.toHaveWarned();
|
|
41
|
+
|
|
42
|
+
generateThemeVariables( {
|
|
43
|
+
accent: '#000',
|
|
44
|
+
background: '#fff',
|
|
45
|
+
} );
|
|
46
|
+
expect( console ).not.toHaveWarned();
|
|
47
|
+
|
|
48
|
+
generateThemeVariables( {
|
|
49
|
+
accent: '#111',
|
|
50
|
+
background: '#000',
|
|
51
|
+
} );
|
|
52
|
+
expect( console ).toHaveWarnedWith(
|
|
53
|
+
'wp.components.Theme: The background color ("#000") does not have sufficient contrast against the accent color ("#111").'
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
generateThemeVariables( { background: '#eee' } );
|
|
57
|
+
expect( console ).toHaveWarnedWith(
|
|
58
|
+
'wp.components.Theme: The background color ("#eee") does not have sufficient contrast against the accent color ("#007cba").'
|
|
59
|
+
);
|
|
60
|
+
} );
|
|
61
|
+
|
|
62
|
+
it( 'should warn if a readable grayscale cannot be generated', () => {
|
|
63
|
+
generateThemeVariables( { background: '#ddd' } );
|
|
64
|
+
expect( console ).toHaveWarnedWith(
|
|
65
|
+
'wp.components.Theme: The background color provided ("#ddd") cannot generate a set of grayscale foreground colors with sufficient contrast. Try adjusting the color to be lighter or darker.'
|
|
66
|
+
);
|
|
67
|
+
} );
|
|
68
|
+
} );
|
|
69
|
+
|
|
70
|
+
describe( 'generateShades', () => {
|
|
71
|
+
it( 'should generate the default WP shades when the default WP background/foreground colors are given', () => {
|
|
72
|
+
const shades = generateShades( '#fff', '#1e1e1e' );
|
|
73
|
+
|
|
74
|
+
Object.entries( shades ).forEach( ( [ k, color ] ) => {
|
|
75
|
+
const key = parseInt( k, 10 ) as keyof typeof shades;
|
|
76
|
+
const normalizedExpectedColor = colord(
|
|
77
|
+
COLORS.gray[ key ]
|
|
78
|
+
).toHex();
|
|
79
|
+
|
|
80
|
+
expect( color ).toBe( normalizedExpectedColor );
|
|
81
|
+
} );
|
|
82
|
+
} );
|
|
83
|
+
|
|
84
|
+
it.each( [
|
|
85
|
+
[ '#000', '#fff' ], // wide delta
|
|
86
|
+
[ '#fff', '#000' ], // flipped
|
|
87
|
+
[ '#eee', '#fff' ], // narrow delta
|
|
88
|
+
] )( 'should generate unique shades (bg: %s, fg: %s)', ( bg, fg ) => {
|
|
89
|
+
const shades = generateShades( bg, fg );
|
|
90
|
+
|
|
91
|
+
// The darkest and lightest shades should be different from the fg/bg colors
|
|
92
|
+
expect( colord( shades[ 100 ] ).isEqual( bg ) ).toBe( false );
|
|
93
|
+
expect( colord( shades[ 800 ] ).isEqual( fg ) ).toBe( false );
|
|
94
|
+
|
|
95
|
+
// The shades should be unique
|
|
96
|
+
const shadeValues = Object.values( shades );
|
|
97
|
+
expect( shadeValues ).toHaveLength( new Set( shadeValues ).size );
|
|
98
|
+
} );
|
|
99
|
+
} );
|
|
100
|
+
} );
|
package/src/theme/test/index.tsx
CHANGED
|
@@ -28,59 +28,93 @@ describe( 'Theme', () => {
|
|
|
28
28
|
describe( 'accent color', () => {
|
|
29
29
|
it( 'it does not define the accent color (and its variations) as a CSS variable when the `accent` prop is undefined', () => {
|
|
30
30
|
render(
|
|
31
|
-
<Theme>
|
|
31
|
+
<Theme data-testid="theme">
|
|
32
32
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
33
33
|
</Theme>
|
|
34
34
|
);
|
|
35
35
|
|
|
36
|
-
const inner = screen.getByText( 'Inner' );
|
|
37
|
-
|
|
38
|
-
if ( inner?.parentElement === null ) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
'Somehow the `Theme` component does not render a DOM element?'
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
36
|
const innerElementStyles = window.getComputedStyle(
|
|
45
|
-
|
|
37
|
+
screen.getByTestId( 'theme' )
|
|
46
38
|
);
|
|
47
39
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
).toBe( '' );
|
|
59
|
-
|
|
60
|
-
expect(
|
|
61
|
-
innerElementStyles.getPropertyValue(
|
|
62
|
-
'--wp-components-color-accent-darker-20'
|
|
63
|
-
)
|
|
64
|
-
).toBe( '' );
|
|
40
|
+
[
|
|
41
|
+
'--wp-components-color-accent',
|
|
42
|
+
'--wp-components-color-accent-darker-10',
|
|
43
|
+
'--wp-components-color-accent-darker-20',
|
|
44
|
+
'--wp-components-color-accent-inverted',
|
|
45
|
+
].forEach( ( cssVariable ) => {
|
|
46
|
+
expect(
|
|
47
|
+
innerElementStyles.getPropertyValue( cssVariable )
|
|
48
|
+
).toBe( '' );
|
|
49
|
+
} );
|
|
65
50
|
} );
|
|
66
51
|
|
|
67
52
|
it( 'it defines the accent color (and its variations) as a CSS variable', () => {
|
|
68
53
|
render(
|
|
69
|
-
<Theme accent="#123abc">
|
|
54
|
+
<Theme accent="#123abc" data-testid="theme">
|
|
70
55
|
<MyThemableComponent>Inner</MyThemableComponent>
|
|
71
56
|
</Theme>
|
|
72
57
|
);
|
|
73
58
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
expect( inner?.parentElement ).toHaveStyle( {
|
|
59
|
+
expect( screen.getByTestId( 'theme' ) ).toHaveStyle( {
|
|
77
60
|
'--wp-components-color-accent': '#123abc',
|
|
78
61
|
'--wp-components-color-accent-darker-10': '#0e2c8d',
|
|
79
62
|
'--wp-components-color-accent-darker-20': '#091d5f',
|
|
63
|
+
'--wp-components-color-accent-inverted': '#fff',
|
|
64
|
+
} );
|
|
65
|
+
} );
|
|
66
|
+
} );
|
|
67
|
+
|
|
68
|
+
describe( 'background color', () => {
|
|
69
|
+
it( 'it does not define the background color (and its dependent colors) as a CSS variable when the `background` prop is undefined', () => {
|
|
70
|
+
render(
|
|
71
|
+
<Theme data-testid="theme">
|
|
72
|
+
<MyThemableComponent>Inner</MyThemableComponent>
|
|
73
|
+
</Theme>
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
const innerElementStyles = window.getComputedStyle(
|
|
77
|
+
screen.getByTestId( 'theme' )
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
[
|
|
81
|
+
'--wp-components-color-background',
|
|
82
|
+
'--wp-components-color-foreground',
|
|
83
|
+
'--wp-components-color-foreground-inverted',
|
|
84
|
+
...[ '100', '200', '300', '400', '600', '700', '800' ].map(
|
|
85
|
+
( shade ) => `--wp-components-color-gray-${ shade }`
|
|
86
|
+
),
|
|
87
|
+
].forEach( ( cssVariable ) => {
|
|
88
|
+
expect(
|
|
89
|
+
innerElementStyles.getPropertyValue( cssVariable )
|
|
90
|
+
).toBe( '' );
|
|
91
|
+
} );
|
|
92
|
+
} );
|
|
93
|
+
|
|
94
|
+
it( 'it defines the background color (and its dependent colors) as a CSS variable', () => {
|
|
95
|
+
render(
|
|
96
|
+
<Theme background="#ffffff" data-testid="theme">
|
|
97
|
+
<MyThemableComponent>Inner</MyThemableComponent>
|
|
98
|
+
</Theme>
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
expect( screen.getByTestId( 'theme' ) ).toHaveStyle( {
|
|
102
|
+
'--wp-components-color-background': '#ffffff',
|
|
103
|
+
'--wp-components-color-foreground': '#1e1e1e',
|
|
104
|
+
'--wp-components-color-foreground-inverted': '#fff',
|
|
105
|
+
'--wp-components-color-gray-100': '#f0f0f0',
|
|
106
|
+
'--wp-components-color-gray-200': '#e0e0e0',
|
|
107
|
+
'--wp-components-color-gray-300': '#dddddd',
|
|
108
|
+
'--wp-components-color-gray-400': '#cccccc',
|
|
109
|
+
'--wp-components-color-gray-600': '#949494',
|
|
110
|
+
'--wp-components-color-gray-700': '#757575',
|
|
111
|
+
'--wp-components-color-gray-800': '#2f2f2f',
|
|
80
112
|
} );
|
|
81
113
|
} );
|
|
114
|
+
} );
|
|
82
115
|
|
|
83
|
-
|
|
116
|
+
describe( 'unsupported values', () => {
|
|
117
|
+
describe.each( [ 'accent', 'background' ] )( '%s', ( propName ) => {
|
|
84
118
|
it.each( [
|
|
85
119
|
// Keywords
|
|
86
120
|
'currentcolor',
|
|
@@ -91,9 +125,8 @@ describe( 'Theme', () => {
|
|
|
91
125
|
'unset',
|
|
92
126
|
// CSS Custom properties
|
|
93
127
|
'var( --my-variable )',
|
|
94
|
-
] )( 'should warn when the value is "%s"', (
|
|
95
|
-
render( <Theme
|
|
96
|
-
|
|
128
|
+
] )( 'should warn when the value is "%s"', ( value ) => {
|
|
129
|
+
render( <Theme { ...{ [ propName ]: value } } /> );
|
|
97
130
|
expect( console ).toHaveWarned();
|
|
98
131
|
} );
|
|
99
132
|
} );
|
package/src/theme/types.ts
CHANGED
|
@@ -3,17 +3,57 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type ThemeInputValues = {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* The accent color (used by components as the primary color).
|
|
9
9
|
*
|
|
10
10
|
* If an accent color is not defined, the default fallback value is the original
|
|
11
|
-
* WP Admin main theme color.
|
|
11
|
+
* WP Admin main theme color. Not all valid CSS color syntaxes are supported —
|
|
12
12
|
* in particular, keywords (like `'currentcolor'`, `'inherit'`, `'initial'`,
|
|
13
13
|
* `'revert'`, `'unset'`...) and CSS custom properties (e.g.
|
|
14
14
|
* `var(--my-custom-property)`) are _not_ supported values for this property.
|
|
15
15
|
*/
|
|
16
16
|
accent?: string;
|
|
17
|
+
/**
|
|
18
|
+
* The background color.
|
|
19
|
+
*
|
|
20
|
+
* If a component explicitly has a background, it will be this color.
|
|
21
|
+
* Otherwise, this color will simply be used to determine what the foreground colors should be.
|
|
22
|
+
* The actual background color will need to be set on the component's container element.
|
|
23
|
+
*
|
|
24
|
+
* If a background color is not defined, the default fallback value is #fff.
|
|
25
|
+
* Not all valid CSS color syntaxes are supported —
|
|
26
|
+
* in particular, keywords (like `'currentcolor'`, `'inherit'`, `'initial'`,
|
|
27
|
+
* `'revert'`, `'unset'`...) and CSS custom properties (e.g.
|
|
28
|
+
* `var(--my-custom-property)`) are _not_ supported values for this property.
|
|
29
|
+
*/
|
|
30
|
+
background?: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type ThemeOutputValues = {
|
|
34
|
+
colors: Partial< {
|
|
35
|
+
accent: string;
|
|
36
|
+
accentDarker10: string;
|
|
37
|
+
accentDarker20: string;
|
|
38
|
+
/** Foreground color to use when accent color is the background. */
|
|
39
|
+
accentInverted: string;
|
|
40
|
+
background: string;
|
|
41
|
+
foreground: string;
|
|
42
|
+
/** Foreground color to use when foreground color is the background. */
|
|
43
|
+
foregroundInverted: string;
|
|
44
|
+
gray: {
|
|
45
|
+
100: string;
|
|
46
|
+
200: string;
|
|
47
|
+
300: string;
|
|
48
|
+
400: string;
|
|
49
|
+
600: string;
|
|
50
|
+
700: string;
|
|
51
|
+
800: string;
|
|
52
|
+
};
|
|
53
|
+
} >;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type ThemeProps = ThemeInputValues & {
|
|
17
57
|
/**
|
|
18
58
|
* The children elements.
|
|
19
59
|
*/
|
|
@@ -12,6 +12,7 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
+
import { FlexBlock } from '../flex';
|
|
15
16
|
import FormToggle from '../form-toggle';
|
|
16
17
|
import BaseControl from '../base-control';
|
|
17
18
|
import type { WordPressComponentProps } from '../ui/context/wordpress-component';
|
|
@@ -94,12 +95,13 @@ export function ToggleControl( {
|
|
|
94
95
|
aria-describedby={ describedBy }
|
|
95
96
|
disabled={ disabled }
|
|
96
97
|
/>
|
|
97
|
-
<
|
|
98
|
+
<FlexBlock
|
|
99
|
+
as="label"
|
|
98
100
|
htmlFor={ id }
|
|
99
101
|
className="components-toggle-control__label"
|
|
100
102
|
>
|
|
101
103
|
{ label }
|
|
102
|
-
</
|
|
104
|
+
</FlexBlock>
|
|
103
105
|
</HStack>
|
|
104
106
|
</BaseControl>
|
|
105
107
|
);
|
|
@@ -81,6 +81,7 @@ Default.args = {
|
|
|
81
81
|
{ value: 'right', label: 'Right' },
|
|
82
82
|
{ value: 'justify', label: 'Justify' },
|
|
83
83
|
].map( mapPropsToOptionComponent ),
|
|
84
|
+
isBlock: true,
|
|
84
85
|
label: 'Label',
|
|
85
86
|
};
|
|
86
87
|
|
|
@@ -121,6 +122,7 @@ WithIcons.args = {
|
|
|
121
122
|
{ value: 'uppercase', label: 'Uppercase', icon: formatUppercase },
|
|
122
123
|
{ value: 'lowercase', label: 'Lowercase', icon: formatLowercase },
|
|
123
124
|
].map( mapPropsToOptionIconComponent ),
|
|
125
|
+
isBlock: false,
|
|
124
126
|
};
|
|
125
127
|
|
|
126
128
|
/**
|