@wordpress/components 29.1.0 → 29.2.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 +19 -6
- package/CONTRIBUTING.md +4 -4
- package/README.md +1 -1
- package/build/badge/index.js +26 -22
- package/build/badge/index.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build/circular-option-picker/circular-option-picker.js +0 -1
- package/build/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build/color-palette/index.js +1 -6
- package/build/color-palette/index.js.map +1 -1
- package/build/font-size-picker/index.native.js +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/higher-order/with-focus-return/index.js +1 -1
- package/build/higher-order/with-focus-return/index.js.map +1 -1
- package/build/input-control/styles/input-control-styles.js +22 -22
- package/build/input-control/styles/input-control-styles.js.map +1 -1
- package/build/menu/checkbox-item.js +6 -6
- package/build/menu/checkbox-item.js.map +1 -1
- package/build/menu/context.js +2 -2
- package/build/menu/context.js.map +1 -1
- package/build/menu/group-label.js +4 -4
- package/build/menu/group-label.js.map +1 -1
- package/build/menu/group.js +4 -4
- package/build/menu/group.js.map +1 -1
- package/build/menu/index.js +87 -14
- package/build/menu/index.js.map +1 -1
- package/build/menu/item-help-text.js +4 -4
- package/build/menu/item-help-text.js.map +1 -1
- package/build/menu/item-label.js +4 -4
- package/build/menu/item-label.js.map +1 -1
- package/build/menu/item.js +6 -6
- package/build/menu/item.js.map +1 -1
- package/build/menu/popover.js +5 -5
- package/build/menu/popover.js.map +1 -1
- package/build/menu/radio-item.js +6 -6
- package/build/menu/radio-item.js.map +1 -1
- package/build/menu/separator.js +4 -4
- package/build/menu/separator.js.map +1 -1
- package/build/menu/styles.js +41 -41
- package/build/menu/styles.js.map +1 -1
- package/build/menu/submenu-trigger-item.js +5 -5
- package/build/menu/submenu-trigger-item.js.map +1 -1
- package/build/menu/trigger-button.js +3 -3
- package/build/menu/trigger-button.js.map +1 -1
- package/build/menu/types.js.map +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/notice/types.js.map +1 -1
- package/build/search-control/index.js +1 -1
- package/build/search-control/index.js.map +1 -1
- package/build/text/hook.js +8 -6
- package/build/text/hook.js.map +1 -1
- package/build/text/utils.js +1 -1
- package/build/text/utils.js.map +1 -1
- package/build-module/badge/index.js +28 -22
- package/build-module/badge/index.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker-option.js +9 -7
- package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
- package/build-module/circular-option-picker/circular-option-picker.js +0 -1
- package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
- package/build-module/color-palette/index.js +1 -6
- package/build-module/color-palette/index.js.map +1 -1
- package/build-module/font-size-picker/index.native.js +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/higher-order/with-focus-return/index.js +1 -1
- package/build-module/higher-order/with-focus-return/index.js.map +1 -1
- package/build-module/input-control/styles/input-control-styles.js +22 -22
- package/build-module/input-control/styles/input-control-styles.js.map +1 -1
- package/build-module/menu/checkbox-item.js +6 -6
- package/build-module/menu/checkbox-item.js.map +1 -1
- package/build-module/menu/context.js +1 -1
- package/build-module/menu/context.js.map +1 -1
- package/build-module/menu/group-label.js +4 -4
- package/build-module/menu/group-label.js.map +1 -1
- package/build-module/menu/group.js +4 -4
- package/build-module/menu/group.js.map +1 -1
- package/build-module/menu/index.js +99 -26
- package/build-module/menu/index.js.map +1 -1
- package/build-module/menu/item-help-text.js +4 -4
- package/build-module/menu/item-help-text.js.map +1 -1
- package/build-module/menu/item-label.js +4 -4
- package/build-module/menu/item-label.js.map +1 -1
- package/build-module/menu/item.js +6 -6
- package/build-module/menu/item.js.map +1 -1
- package/build-module/menu/popover.js +5 -5
- package/build-module/menu/popover.js.map +1 -1
- package/build-module/menu/radio-item.js +6 -6
- package/build-module/menu/radio-item.js.map +1 -1
- package/build-module/menu/separator.js +4 -4
- package/build-module/menu/separator.js.map +1 -1
- package/build-module/menu/styles.js +40 -40
- package/build-module/menu/styles.js.map +1 -1
- package/build-module/menu/submenu-trigger-item.js +6 -6
- package/build-module/menu/submenu-trigger-item.js.map +1 -1
- package/build-module/menu/trigger-button.js +3 -3
- package/build-module/menu/trigger-button.js.map +1 -1
- package/build-module/menu/types.js.map +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/build-module/mobile/bottom-sheet/nav-bar/action-button.native.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/notice/types.js.map +1 -1
- package/build-module/search-control/index.js +1 -1
- package/build-module/search-control/index.js.map +1 -1
- package/build-module/text/hook.js +8 -6
- package/build-module/text/hook.js.map +1 -1
- package/build-module/text/utils.js +1 -1
- package/build-module/text/utils.js.map +1 -1
- package/build-style/style-rtl.css +89 -170
- package/build-style/style.css +89 -170
- package/build-types/badge/index.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
- package/build-types/circular-option-picker/circular-option-picker.d.ts.map +1 -1
- package/build-types/circular-option-picker/stories/index.story.d.ts.map +1 -1
- package/build-types/color-palette/index.d.ts.map +1 -1
- package/build-types/higher-order/with-focus-return/index.d.ts +1 -1
- package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
- package/build-types/menu/checkbox-item.d.ts +2 -2
- package/build-types/menu/checkbox-item.d.ts.map +1 -1
- package/build-types/menu/context.d.ts +2 -2
- package/build-types/menu/context.d.ts.map +1 -1
- package/build-types/menu/group-label.d.ts +2 -2
- package/build-types/menu/group-label.d.ts.map +1 -1
- package/build-types/menu/group.d.ts +2 -2
- package/build-types/menu/group.d.ts.map +1 -1
- package/build-types/menu/index.d.ts +84 -12
- package/build-types/menu/index.d.ts.map +1 -1
- package/build-types/menu/item-help-text.d.ts +1 -1
- package/build-types/menu/item-help-text.d.ts.map +1 -1
- package/build-types/menu/item-label.d.ts +1 -1
- package/build-types/menu/item-label.d.ts.map +1 -1
- package/build-types/menu/item.d.ts +2 -2
- package/build-types/menu/item.d.ts.map +1 -1
- package/build-types/menu/popover.d.ts +2 -2
- package/build-types/menu/popover.d.ts.map +1 -1
- package/build-types/menu/radio-item.d.ts +2 -2
- package/build-types/menu/radio-item.d.ts.map +1 -1
- package/build-types/menu/separator.d.ts +2 -2
- package/build-types/menu/separator.d.ts.map +1 -1
- package/build-types/menu/styles.d.ts +15 -15
- package/build-types/menu/styles.d.ts.map +1 -1
- package/build-types/menu/submenu-trigger-item.d.ts +2 -2
- package/build-types/menu/submenu-trigger-item.d.ts.map +1 -1
- package/build-types/menu/trigger-button.d.ts +2 -2
- package/build-types/menu/trigger-button.d.ts.map +1 -1
- package/build-types/menu/types.d.ts +10 -10
- package/build-types/menu/types.d.ts.map +1 -1
- package/build-types/menu-group/stories/index.story.d.ts +1 -1
- package/build-types/notice/types.d.ts +1 -1
- package/build-types/progress-bar/stories/index.story.d.ts +1 -1
- package/build-types/tabs/stories/index.story.d.ts +0 -3
- package/build-types/tabs/stories/index.story.d.ts.map +1 -1
- package/build-types/text/hook.d.ts.map +1 -1
- package/build-types/text/utils.d.ts +1 -1
- package/package.json +19 -19
- package/src/animate/style.scss +16 -12
- package/src/badge/index.tsx +28 -27
- package/src/border-control/test/index.js +12 -4
- package/src/button/style.scss +15 -12
- package/src/checkbox-control/style.scss +4 -2
- package/src/circular-option-picker/README.md +1 -2
- package/src/circular-option-picker/circular-option-picker-option.tsx +17 -10
- package/src/circular-option-picker/circular-option-picker.tsx +0 -1
- package/src/circular-option-picker/stories/index.story.tsx +0 -1
- package/src/circular-option-picker/style.scss +10 -5
- package/src/color-palette/index.tsx +0 -7
- package/src/color-palette/test/index.tsx +2 -8
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/drop-zone/style.scss +6 -9
- package/src/font-size-picker/index.native.js +1 -1
- package/src/form-toggle/style.scss +17 -10
- package/src/form-token-field/style.scss +9 -4
- package/src/higher-order/navigate-regions/style.scss +2 -2
- package/src/higher-order/with-focus-return/index.tsx +1 -1
- package/src/input-control/styles/input-control-styles.tsx +6 -0
- package/src/menu/README.md +421 -174
- package/src/menu/checkbox-item.tsx +12 -12
- package/src/menu/context.tsx +2 -4
- package/src/menu/docs-manifest.json +62 -0
- package/src/menu/group-label.tsx +7 -7
- package/src/menu/group.tsx +7 -11
- package/src/menu/index.tsx +101 -31
- package/src/menu/item-help-text.tsx +5 -7
- package/src/menu/item-label.tsx +5 -7
- package/src/menu/item.tsx +12 -12
- package/src/menu/popover.tsx +9 -9
- package/src/menu/radio-item.tsx +12 -12
- package/src/menu/separator.tsx +7 -7
- package/src/menu/stories/best-practices.mdx +38 -0
- package/src/menu/stories/index.story.tsx +8 -8
- package/src/menu/styles.ts +24 -24
- package/src/menu/submenu-trigger-item.tsx +9 -9
- package/src/menu/trigger-button.tsx +6 -6
- package/src/menu/types.ts +10 -10
- package/src/menu-group/stories/index.story.tsx +2 -2
- package/src/mobile/bottom-sheet/nav-bar/action-button.native.js +1 -1
- package/src/mobile/utils/get-px-from-css-unit.native.js +3 -3
- package/src/modal/style.scss +4 -2
- package/src/modal/test/index.tsx +5 -4
- package/src/notice/README.md +3 -3
- package/src/notice/types.ts +1 -1
- package/src/palette-edit/test/index.tsx +1 -1
- package/src/panel/style.scss +14 -6
- package/src/placeholder/style.scss +5 -3
- package/src/progress-bar/stories/index.story.tsx +1 -1
- package/src/resizable-box/style.scss +14 -9
- package/src/search-control/index.tsx +1 -1
- package/src/tab-panel/style.scss +6 -4
- package/src/tabs/stories/index.story.tsx +0 -131
- package/src/text/README.md +1 -1
- package/src/text/hook.ts +3 -2
- package/src/text/stories/index.story.tsx +2 -2
- package/src/text/test/index.tsx +1 -1
- package/src/text/utils.ts +1 -1
- package/src/text-highlight/test/index.tsx +3 -3
- package/src/toolbar/toolbar/style.scss +4 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -15,7 +15,7 @@ import type { FindAllArgs } from 'highlight-words-core';
|
|
|
15
15
|
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
|
|
16
16
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
|
|
17
17
|
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
|
|
18
|
-
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `
|
|
18
|
+
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `sanitize` function to pass to `highlight-words-core`.
|
|
19
19
|
* @property {string[]} [searchWords=[]] Words to search for and highlight.
|
|
20
20
|
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
|
|
21
21
|
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.2.0",
|
|
4
4
|
"description": "UI components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -44,23 +44,23 @@
|
|
|
44
44
|
"@types/gradient-parser": "0.1.3",
|
|
45
45
|
"@types/highlight-words-core": "1.2.1",
|
|
46
46
|
"@use-gesture/react": "^10.3.1",
|
|
47
|
-
"@wordpress/a11y": "^4.
|
|
48
|
-
"@wordpress/compose": "^7.
|
|
49
|
-
"@wordpress/date": "^5.
|
|
50
|
-
"@wordpress/deprecated": "^4.
|
|
51
|
-
"@wordpress/dom": "^4.
|
|
52
|
-
"@wordpress/element": "^6.
|
|
53
|
-
"@wordpress/escape-html": "^3.
|
|
54
|
-
"@wordpress/hooks": "^4.
|
|
55
|
-
"@wordpress/html-entities": "^4.
|
|
56
|
-
"@wordpress/i18n": "^5.
|
|
57
|
-
"@wordpress/icons": "^10.
|
|
58
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/primitives": "^4.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/rich-text": "^7.
|
|
63
|
-
"@wordpress/warning": "^3.
|
|
47
|
+
"@wordpress/a11y": "^4.16.0",
|
|
48
|
+
"@wordpress/compose": "^7.16.0",
|
|
49
|
+
"@wordpress/date": "^5.16.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.16.0",
|
|
51
|
+
"@wordpress/dom": "^4.16.0",
|
|
52
|
+
"@wordpress/element": "^6.16.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.16.0",
|
|
54
|
+
"@wordpress/hooks": "^4.16.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.16.0",
|
|
56
|
+
"@wordpress/i18n": "^5.16.0",
|
|
57
|
+
"@wordpress/icons": "^10.16.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.16.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.16.0",
|
|
60
|
+
"@wordpress/primitives": "^4.16.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.16.0",
|
|
62
|
+
"@wordpress/rich-text": "^7.16.0",
|
|
63
|
+
"@wordpress/warning": "^3.16.0",
|
|
64
64
|
"change-case": "^4.1.2",
|
|
65
65
|
"clsx": "^2.1.1",
|
|
66
66
|
"colord": "^2.7.0",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"publishConfig": {
|
|
86
86
|
"access": "public"
|
|
87
87
|
},
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "f48b9f56629e400891abb5ae491504de475237ff"
|
|
89
89
|
}
|
package/src/animate/style.scss
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
.components-animate__appear {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
@media not (prefers-reduced-motion) {
|
|
3
|
+
animation: components-animate__appear-animation 0.1s cubic-bezier(0, 0, 0.2, 1) 0s;
|
|
4
|
+
animation-fill-mode: forwards;
|
|
5
|
+
}
|
|
5
6
|
|
|
6
7
|
&.is-from-top,
|
|
7
8
|
&.is-from-top.is-from-left {
|
|
@@ -29,16 +30,17 @@
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
.components-animate__slide-in {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
@media not (prefers-reduced-motion) {
|
|
34
|
+
animation: components-animate__slide-in-animation 0.1s cubic-bezier(0, 0, 0.2, 1);
|
|
35
|
+
animation-fill-mode: forwards;
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
&.is-from-left {
|
|
38
|
+
transform: translateX(+100%);
|
|
39
|
+
}
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
&.is-from-right {
|
|
42
|
+
transform: translateX(-100%);
|
|
43
|
+
}
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -49,7 +51,9 @@
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
.components-animate__loading {
|
|
52
|
-
|
|
54
|
+
@media not (prefers-reduced-motion) {
|
|
55
|
+
animation: components-animate__loading 1.6s ease-in-out infinite;
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
@keyframes components-animate__loading {
|
package/src/badge/index.tsx
CHANGED
|
@@ -15,45 +15,46 @@ import type { BadgeProps } from './types';
|
|
|
15
15
|
import type { WordPressComponentProps } from '../context';
|
|
16
16
|
import Icon from '../icon';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Returns an icon based on the badge context.
|
|
20
|
+
*
|
|
21
|
+
* @return The corresponding icon for the provided context.
|
|
22
|
+
*/
|
|
23
|
+
function contextBasedIcon( intent: BadgeProps[ 'intent' ] = 'default' ) {
|
|
24
|
+
switch ( intent ) {
|
|
25
|
+
case 'info':
|
|
26
|
+
return info;
|
|
27
|
+
case 'success':
|
|
28
|
+
return published;
|
|
29
|
+
case 'warning':
|
|
30
|
+
return caution;
|
|
31
|
+
case 'error':
|
|
32
|
+
return error;
|
|
33
|
+
default:
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
function Badge( {
|
|
19
39
|
className,
|
|
20
40
|
intent = 'default',
|
|
21
41
|
children,
|
|
22
42
|
...props
|
|
23
43
|
}: WordPressComponentProps< BadgeProps, 'span', false > ) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
* @return The corresponding icon for the provided context.
|
|
28
|
-
*/
|
|
29
|
-
function contextBasedIcon() {
|
|
30
|
-
switch ( intent ) {
|
|
31
|
-
case 'info':
|
|
32
|
-
return info;
|
|
33
|
-
case 'success':
|
|
34
|
-
return published;
|
|
35
|
-
case 'warning':
|
|
36
|
-
return caution;
|
|
37
|
-
case 'error':
|
|
38
|
-
return error;
|
|
39
|
-
default:
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
44
|
+
const icon = contextBasedIcon( intent );
|
|
45
|
+
const hasIcon = !! icon;
|
|
43
46
|
|
|
44
47
|
return (
|
|
45
48
|
<span
|
|
46
|
-
className={ clsx(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className
|
|
51
|
-
) }
|
|
49
|
+
className={ clsx( 'components-badge', className, {
|
|
50
|
+
[ `is-${ intent }` ]: intent,
|
|
51
|
+
'has-icon': hasIcon,
|
|
52
|
+
} ) }
|
|
52
53
|
{ ...props }
|
|
53
54
|
>
|
|
54
|
-
{
|
|
55
|
+
{ hasIcon && (
|
|
55
56
|
<Icon
|
|
56
|
-
icon={
|
|
57
|
+
icon={ icon }
|
|
57
58
|
size={ 16 }
|
|
58
59
|
fill="currentColor"
|
|
59
60
|
className="components-badge__icon"
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
fireEvent,
|
|
6
|
+
render,
|
|
7
|
+
screen,
|
|
8
|
+
waitFor,
|
|
9
|
+
within,
|
|
10
|
+
} from '@testing-library/react';
|
|
5
11
|
import userEvent from '@testing-library/user-event';
|
|
6
12
|
|
|
7
13
|
/**
|
|
@@ -56,7 +62,7 @@ const getButton = ( name ) => {
|
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
const getColorOption = ( color ) => {
|
|
59
|
-
return screen.getByRole( 'option', { name:
|
|
65
|
+
return screen.getByRole( 'option', { name: `${ color }` } );
|
|
60
66
|
};
|
|
61
67
|
|
|
62
68
|
const queryButton = ( name ) => {
|
|
@@ -131,9 +137,11 @@ describe( 'BorderControl', () => {
|
|
|
131
137
|
await openPopover( user );
|
|
132
138
|
|
|
133
139
|
const customColorPicker = getButton( /Custom color picker/ );
|
|
134
|
-
const
|
|
135
|
-
name:
|
|
140
|
+
const circularOptionPicker = screen.getByRole( 'listbox', {
|
|
141
|
+
name: 'Custom color picker.',
|
|
136
142
|
} );
|
|
143
|
+
const colorSwatchButtons =
|
|
144
|
+
within( circularOptionPicker ).getAllByRole( 'option' );
|
|
137
145
|
const styleLabel = screen.getByText( 'Style' );
|
|
138
146
|
const solidButton = getButton( 'Solid' );
|
|
139
147
|
const dashedButton = getButton( 'Dashed' );
|
package/src/button/style.scss
CHANGED
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
-webkit-appearance: none;
|
|
17
17
|
background: none;
|
|
18
|
-
|
|
19
|
-
@
|
|
18
|
+
|
|
19
|
+
@media not (prefers-reduced-motion) {
|
|
20
|
+
transition: box-shadow 0.1s linear;
|
|
21
|
+
}
|
|
22
|
+
|
|
20
23
|
height: $button-size;
|
|
21
24
|
align-items: center;
|
|
22
25
|
box-sizing: border-box;
|
|
@@ -245,10 +248,13 @@
|
|
|
245
248
|
text-align: left;
|
|
246
249
|
color: $components-color-accent;
|
|
247
250
|
text-decoration: underline;
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
251
|
+
|
|
252
|
+
@media not (prefers-reduced-motion) {
|
|
253
|
+
transition-property: border, background, color;
|
|
254
|
+
transition-duration: 0.05s;
|
|
255
|
+
transition-timing-function: ease-in-out;
|
|
256
|
+
}
|
|
257
|
+
|
|
252
258
|
height: auto;
|
|
253
259
|
|
|
254
260
|
&:focus {
|
|
@@ -275,11 +281,8 @@
|
|
|
275
281
|
&.is-secondary.is-busy,
|
|
276
282
|
&.is-secondary.is-busy:disabled,
|
|
277
283
|
&.is-secondary.is-busy[aria-disabled="true"] {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// as soon as https://github.com/WordPress/gutenberg/issues/55566 is closed.
|
|
281
|
-
@media (prefers-reduced-motion: reduce) {
|
|
282
|
-
animation-duration: 0s;
|
|
284
|
+
@media not (prefers-reduced-motion) {
|
|
285
|
+
animation: components-button__busy-animation 2500ms infinite linear;
|
|
283
286
|
}
|
|
284
287
|
background-size: 100px 100%;
|
|
285
288
|
/* stylelint-disable -- Disable reason: This function call looks nicer when each argument is on its own line. */
|
|
@@ -376,7 +379,7 @@
|
|
|
376
379
|
fill: currentColor;
|
|
377
380
|
outline: none;
|
|
378
381
|
|
|
379
|
-
//
|
|
382
|
+
// Optimize for high contrast modes.
|
|
380
383
|
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
|
|
381
384
|
@media (forced-colors: active) {
|
|
382
385
|
fill: CanvasText;
|
|
@@ -32,8 +32,10 @@
|
|
|
32
32
|
height: var(--checkbox-input-size);
|
|
33
33
|
|
|
34
34
|
appearance: none;
|
|
35
|
-
|
|
36
|
-
@
|
|
35
|
+
|
|
36
|
+
@media not (prefers-reduced-motion) {
|
|
37
|
+
transition: 0.1s border-color ease-in-out;
|
|
38
|
+
}
|
|
37
39
|
|
|
38
40
|
&:focus {
|
|
39
41
|
@include button-style-outset__focus(var(--wp-admin-theme-color));
|
|
@@ -29,7 +29,6 @@ const Example = () => {
|
|
|
29
29
|
style={ { backgroundColor: color, color } }
|
|
30
30
|
isSelected={ index === currentColor }
|
|
31
31
|
onClick={ () => setCurrentColor( index ) }
|
|
32
|
-
aria-label={ name }
|
|
33
32
|
/>
|
|
34
33
|
);
|
|
35
34
|
} ) }
|
|
@@ -150,6 +149,6 @@ Inherits all of the [`Dropdown` props](/packages/components/src/dropdown/README.
|
|
|
150
149
|
|
|
151
150
|
Props for the underlying `Button` component.
|
|
152
151
|
|
|
153
|
-
Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
|
|
152
|
+
Inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`, `target`, and `children`.
|
|
154
153
|
|
|
155
154
|
- Required: No
|
|
@@ -17,7 +17,6 @@ import { Icon, check } from '@wordpress/icons';
|
|
|
17
17
|
import { CircularOptionPickerContext } from './circular-option-picker-context';
|
|
18
18
|
import Button from '../button';
|
|
19
19
|
import { Composite } from '../composite';
|
|
20
|
-
import Tooltip from '../tooltip';
|
|
21
20
|
import type { OptionProps } from './types';
|
|
22
21
|
|
|
23
22
|
function UnforwardedOptionAsButton(
|
|
@@ -25,15 +24,17 @@ function UnforwardedOptionAsButton(
|
|
|
25
24
|
id?: string;
|
|
26
25
|
className?: string;
|
|
27
26
|
isPressed?: boolean;
|
|
27
|
+
label?: string;
|
|
28
28
|
},
|
|
29
29
|
forwardedRef: ForwardedRef< any >
|
|
30
30
|
) {
|
|
31
|
-
const { isPressed, ...additionalProps } = props;
|
|
31
|
+
const { isPressed, label, ...additionalProps } = props;
|
|
32
32
|
return (
|
|
33
33
|
<Button
|
|
34
34
|
{ ...additionalProps }
|
|
35
35
|
aria-pressed={ isPressed }
|
|
36
36
|
ref={ forwardedRef }
|
|
37
|
+
label={ label }
|
|
37
38
|
/>
|
|
38
39
|
);
|
|
39
40
|
}
|
|
@@ -45,10 +46,11 @@ function UnforwardedOptionAsOption(
|
|
|
45
46
|
id: string;
|
|
46
47
|
className?: string;
|
|
47
48
|
isSelected?: boolean;
|
|
49
|
+
label?: string;
|
|
48
50
|
},
|
|
49
51
|
forwardedRef: ForwardedRef< any >
|
|
50
52
|
) {
|
|
51
|
-
const { id, isSelected, ...additionalProps } = props;
|
|
53
|
+
const { id, isSelected, label, ...additionalProps } = props;
|
|
52
54
|
|
|
53
55
|
const { setActiveId, activeId } = useContext( CircularOptionPickerContext );
|
|
54
56
|
|
|
@@ -69,6 +71,7 @@ function UnforwardedOptionAsOption(
|
|
|
69
71
|
role="option"
|
|
70
72
|
aria-selected={ !! isSelected }
|
|
71
73
|
ref={ forwardedRef }
|
|
74
|
+
label={ label }
|
|
72
75
|
/>
|
|
73
76
|
}
|
|
74
77
|
id={ id }
|
|
@@ -100,9 +103,17 @@ export function Option( {
|
|
|
100
103
|
|
|
101
104
|
const isListbox = setActiveId !== undefined;
|
|
102
105
|
const optionControl = isListbox ? (
|
|
103
|
-
<OptionAsOption
|
|
106
|
+
<OptionAsOption
|
|
107
|
+
{ ...commonProps }
|
|
108
|
+
label={ tooltipText }
|
|
109
|
+
isSelected={ isSelected }
|
|
110
|
+
/>
|
|
104
111
|
) : (
|
|
105
|
-
<OptionAsButton
|
|
112
|
+
<OptionAsButton
|
|
113
|
+
{ ...commonProps }
|
|
114
|
+
label={ tooltipText }
|
|
115
|
+
isPressed={ isSelected }
|
|
116
|
+
/>
|
|
106
117
|
);
|
|
107
118
|
|
|
108
119
|
return (
|
|
@@ -112,11 +123,7 @@ export function Option( {
|
|
|
112
123
|
'components-circular-option-picker__option-wrapper'
|
|
113
124
|
) }
|
|
114
125
|
>
|
|
115
|
-
{
|
|
116
|
-
<Tooltip text={ tooltipText }>{ optionControl }</Tooltip>
|
|
117
|
-
) : (
|
|
118
|
-
optionControl
|
|
119
|
-
) }
|
|
126
|
+
{ optionControl }
|
|
120
127
|
{ isSelected && <Icon icon={ check } { ...selectedIconProps } /> }
|
|
121
128
|
</div>
|
|
122
129
|
);
|
|
@@ -35,9 +35,11 @@ $color-palette-circle-spacing: 12px;
|
|
|
35
35
|
width: $color-palette-circle-size;
|
|
36
36
|
vertical-align: top;
|
|
37
37
|
transform: scale(1);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
|
|
39
|
+
@media not (prefers-reduced-motion) {
|
|
40
|
+
transition: 100ms transform ease;
|
|
41
|
+
will-change: transform;
|
|
42
|
+
}
|
|
41
43
|
|
|
42
44
|
&:hover {
|
|
43
45
|
transform: scale(1.2);
|
|
@@ -73,8 +75,11 @@ $color-palette-circle-spacing: 12px;
|
|
|
73
75
|
border-radius: $radius-round;
|
|
74
76
|
background: transparent;
|
|
75
77
|
box-shadow: inset 0 0 0 ($color-palette-circle-size * 0.5);
|
|
76
|
-
|
|
77
|
-
@
|
|
78
|
+
|
|
79
|
+
@media not (prefers-reduced-motion) {
|
|
80
|
+
transition: 100ms box-shadow ease;
|
|
81
|
+
}
|
|
82
|
+
|
|
78
83
|
cursor: pointer;
|
|
79
84
|
|
|
80
85
|
&:hover {
|
|
@@ -79,13 +79,6 @@ function SinglePalette( {
|
|
|
79
79
|
onClick={
|
|
80
80
|
isSelected ? clearColor : () => onChange( color, index )
|
|
81
81
|
}
|
|
82
|
-
aria-label={
|
|
83
|
-
name
|
|
84
|
-
? // translators: %s: The name of the color e.g: "vivid red".
|
|
85
|
-
sprintf( __( 'Color: %s' ), name )
|
|
86
|
-
: // translators: %s: color hex code e.g: "#f00".
|
|
87
|
-
sprintf( __( 'Color code: %s' ), color )
|
|
88
|
-
}
|
|
89
82
|
/>
|
|
90
83
|
);
|
|
91
84
|
} );
|
|
@@ -50,9 +50,7 @@ describe( 'ColorPalette', () => {
|
|
|
50
50
|
/>
|
|
51
51
|
);
|
|
52
52
|
|
|
53
|
-
expect(
|
|
54
|
-
screen.getAllByRole( 'option', { name: /^Color:/ } )
|
|
55
|
-
).toHaveLength( 3 );
|
|
53
|
+
expect( screen.getAllByRole( 'option' ) ).toHaveLength( 3 );
|
|
56
54
|
} );
|
|
57
55
|
|
|
58
56
|
it( 'should call onClick on an active button with undefined', async () => {
|
|
@@ -67,9 +65,7 @@ describe( 'ColorPalette', () => {
|
|
|
67
65
|
/>
|
|
68
66
|
);
|
|
69
67
|
|
|
70
|
-
await user.click(
|
|
71
|
-
screen.getByRole( 'option', { name: /^Color:/, selected: true } )
|
|
72
|
-
);
|
|
68
|
+
await user.click( screen.getByRole( 'option', { selected: true } ) );
|
|
73
69
|
|
|
74
70
|
expect( onChange ).toHaveBeenCalledTimes( 1 );
|
|
75
71
|
expect( onChange ).toHaveBeenCalledWith( undefined );
|
|
@@ -91,7 +87,6 @@ describe( 'ColorPalette', () => {
|
|
|
91
87
|
// (i.e. a button representing a color that is not the current color)
|
|
92
88
|
await user.click(
|
|
93
89
|
screen.getAllByRole( 'option', {
|
|
94
|
-
name: /^Color:/,
|
|
95
90
|
selected: false,
|
|
96
91
|
} )[ 0 ]
|
|
97
92
|
);
|
|
@@ -230,7 +225,6 @@ describe( 'ColorPalette', () => {
|
|
|
230
225
|
// Click the first unpressed button
|
|
231
226
|
await user.click(
|
|
232
227
|
screen.getAllByRole( 'option', {
|
|
233
|
-
name: /^Color:/,
|
|
234
228
|
selected: false,
|
|
235
229
|
} )[ 0 ]
|
|
236
230
|
);
|
|
@@ -348,7 +348,7 @@ describe.each( [
|
|
|
348
348
|
expect( option ).toHaveTextContent( matches[ optionIndex ].label );
|
|
349
349
|
} );
|
|
350
350
|
|
|
351
|
-
// Confirm that the
|
|
351
|
+
// Confirm that the current option is selected
|
|
352
352
|
await user.keyboard( '{Enter}' );
|
|
353
353
|
|
|
354
354
|
expect( onChangeSpy ).toHaveBeenCalledTimes( 1 );
|
package/src/drop-zone/style.scss
CHANGED
|
@@ -46,9 +46,8 @@
|
|
|
46
46
|
.components-drop-zone__content {
|
|
47
47
|
opacity: 1;
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
transition: none;
|
|
49
|
+
@media not (prefers-reduced-motion) {
|
|
50
|
+
transition: opacity 0.2s ease-in-out;
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -56,12 +55,10 @@
|
|
|
56
55
|
opacity: 1;
|
|
57
56
|
transform: scale(1);
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@media (prefers-reduced-motion) {
|
|
64
|
-
transition: none;
|
|
58
|
+
@media not (prefers-reduced-motion) {
|
|
59
|
+
transition:
|
|
60
|
+
opacity 0.1s ease-in-out 0.1s,
|
|
61
|
+
transform 0.1s ease-in-out 0.1s;
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
}
|
|
@@ -126,7 +126,7 @@ function FontSizePicker( {
|
|
|
126
126
|
</View>
|
|
127
127
|
</BottomSheet.Cell>
|
|
128
128
|
{ fontSizes.map( ( item, index ) => {
|
|
129
|
-
// Only display a choice that we can
|
|
129
|
+
// Only display a choice that we can currently select.
|
|
130
130
|
if ( ! parseFloat( item.sizePx ) ) {
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
@@ -24,10 +24,13 @@ $transition-duration: 0.2s;
|
|
|
24
24
|
width: $toggle-width;
|
|
25
25
|
height: $toggle-height;
|
|
26
26
|
border-radius: math.div($toggle-height, 2);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
|
|
28
|
+
@media not (prefers-reduced-motion) {
|
|
29
|
+
transition:
|
|
30
|
+
$transition-duration background-color ease,
|
|
31
|
+
$transition-duration border-color ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
31
34
|
overflow: hidden;
|
|
32
35
|
|
|
33
36
|
// Windows High Contrast Mode
|
|
@@ -39,8 +42,9 @@ $transition-duration: 0.2s;
|
|
|
39
42
|
// Expand the border to fake a solid in Windows High Contrast Mode.
|
|
40
43
|
border-top: #{ $toggle-height } solid transparent;
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
@media not (prefers-reduced-motion) {
|
|
46
|
+
transition: $transition-duration opacity ease;
|
|
47
|
+
}
|
|
44
48
|
|
|
45
49
|
opacity: 0;
|
|
46
50
|
}
|
|
@@ -55,10 +59,13 @@ $transition-duration: 0.2s;
|
|
|
55
59
|
width: $toggle-thumb-size;
|
|
56
60
|
height: $toggle-thumb-size;
|
|
57
61
|
border-radius: $radius-round;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
|
|
63
|
+
@media not (prefers-reduced-motion) {
|
|
64
|
+
transition:
|
|
65
|
+
$transition-duration transform ease,
|
|
66
|
+
$transition-duration background-color ease-out;
|
|
67
|
+
}
|
|
68
|
+
|
|
62
69
|
background-color: $gray-900;
|
|
63
70
|
box-shadow: $elevation-x-small;
|
|
64
71
|
|
|
@@ -124,8 +124,10 @@
|
|
|
124
124
|
height: auto;
|
|
125
125
|
background: $gray-300;
|
|
126
126
|
min-width: unset;
|
|
127
|
-
|
|
128
|
-
@
|
|
127
|
+
|
|
128
|
+
@media not (prefers-reduced-motion) {
|
|
129
|
+
transition: all 0.2s cubic-bezier(0.4, 1, 0.4, 1);
|
|
130
|
+
}
|
|
129
131
|
}
|
|
130
132
|
|
|
131
133
|
.components-form-token-field__token-text {
|
|
@@ -154,8 +156,11 @@
|
|
|
154
156
|
min-width: 100%;
|
|
155
157
|
max-height: $grid-unit-80 * 2;
|
|
156
158
|
overflow-y: auto;
|
|
157
|
-
|
|
158
|
-
@
|
|
159
|
+
|
|
160
|
+
@media not (prefers-reduced-motion) {
|
|
161
|
+
transition: all 0.15s ease-in-out;
|
|
162
|
+
}
|
|
163
|
+
|
|
159
164
|
list-style: none;
|
|
160
165
|
box-shadow: inset 0 $border-width 0 0 $gray-600; // Matches the border color of the input.
|
|
161
166
|
margin: 0;
|
|
@@ -8,7 +8,7 @@ $regionOutlineRatio: 2;
|
|
|
8
8
|
[role="region"] {
|
|
9
9
|
position: relative;
|
|
10
10
|
|
|
11
|
-
// Handles the focus when we
|
|
11
|
+
// Handles the focus when we programmatically send focus to this region
|
|
12
12
|
&.interface-interface-skeleton__content:focus-visible::after {
|
|
13
13
|
@include region-selection-focus;
|
|
14
14
|
}
|
|
@@ -26,7 +26,7 @@ $regionOutlineRatio: 2;
|
|
|
26
26
|
// the navigable regions should always have a computed size. For now, we can
|
|
27
27
|
// fix some edge cases but these CSS rules should be later removed in favor of
|
|
28
28
|
// a more abstracted approach to make the navigable regions focus style work
|
|
29
|
-
//
|
|
29
|
+
// regardless of the CSS used on other components.
|
|
30
30
|
|
|
31
31
|
// Header top bar when Distraction free mode is on.
|
|
32
32
|
&.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
|
|
@@ -32,7 +32,7 @@ type Props = {
|
|
|
32
32
|
* describing the component and the
|
|
33
33
|
* focus return characteristics.
|
|
34
34
|
*
|
|
35
|
-
* @return Higher Order Component with the focus
|
|
35
|
+
* @return Higher Order Component with the focus restoration behaviour.
|
|
36
36
|
*/
|
|
37
37
|
export default createHigherOrderComponent(
|
|
38
38
|
// @ts-expect-error TODO: Reconcile with intended `createHigherOrderComponent` types
|