@wordpress/components 29.10.0 → 29.11.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 -0
- package/build/drop-zone/index.js +2 -1
- package/build/drop-zone/index.js.map +1 -1
- package/build/drop-zone/types.js.map +1 -1
- package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build/form-token-field/index.js +2 -2
- package/build/form-token-field/index.js.map +1 -1
- package/build/form-token-field/suggestions-list.js +2 -8
- package/build/form-token-field/suggestions-list.js.map +1 -1
- package/build/input-control/input-field.js +0 -14
- package/build/input-control/input-field.js.map +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js +1 -1
- package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build/private-apis.js +4 -1
- package/build/private-apis.js.map +1 -1
- package/build/utils/strings.js +1 -1
- package/build/utils/strings.js.map +1 -1
- package/build-module/drop-zone/index.js +2 -1
- package/build-module/drop-zone/index.js.map +1 -1
- package/build-module/drop-zone/types.js.map +1 -1
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
- package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
- package/build-module/form-token-field/index.js +2 -2
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/form-token-field/suggestions-list.js +2 -8
- package/build-module/form-token-field/suggestions-list.js.map +1 -1
- package/build-module/input-control/input-field.js +0 -14
- package/build-module/input-control/input-field.js.map +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -1
- package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/utils/strings.js +1 -1
- package/build-module/utils/strings.js.map +1 -1
- package/build-style/style-rtl.css +6 -6
- package/build-style/style.css +6 -6
- package/build-types/drop-zone/index.d.ts +1 -1
- package/build-types/drop-zone/index.d.ts.map +1 -1
- package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
- package/build-types/drop-zone/types.d.ts +6 -0
- package/build-types/drop-zone/types.d.ts.map +1 -1
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
- package/build-types/input-control/input-field.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/utils/strings.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/drop-zone/index.tsx +2 -1
- package/src/drop-zone/stories/index.story.tsx +15 -0
- package/src/drop-zone/types.ts +6 -0
- package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
- package/src/form-token-field/index.tsx +5 -2
- package/src/form-token-field/suggestions-list.tsx +4 -8
- package/src/form-token-field/test/index.tsx +39 -0
- package/src/input-control/input-field.tsx +0 -18
- package/src/input-control/test/index.js +0 -17
- package/src/mobile/utils/get-px-from-css-unit.native.js +1 -1
- package/src/private-apis.ts +4 -1
- package/src/toolbar/toolbar/style.scss +3 -6
- package/src/toolbar/toolbar-group/style.scss +4 -4
- package/src/utils/strings.ts +1 -0
- package/src/utils/test/strings.js +11 -0
- package/tsconfig.tsbuildinfo +1 -1
package/build-style/style.css
CHANGED
|
@@ -3335,7 +3335,7 @@ body.lockscroll {
|
|
|
3335
3335
|
|
|
3336
3336
|
.components-accessible-toolbar {
|
|
3337
3337
|
display: inline-flex;
|
|
3338
|
-
border: 1px solid #1e1e1e;
|
|
3338
|
+
border: 1px solid var(--wp-components-color-foreground, #1e1e1e);
|
|
3339
3339
|
border-radius: 2px;
|
|
3340
3340
|
flex-shrink: 0;
|
|
3341
3341
|
}
|
|
@@ -3402,7 +3402,7 @@ body.lockscroll {
|
|
|
3402
3402
|
}
|
|
3403
3403
|
.components-accessible-toolbar .components-button.is-pressed::before,
|
|
3404
3404
|
.components-toolbar .components-button.is-pressed::before {
|
|
3405
|
-
background: #1e1e1e;
|
|
3405
|
+
background: var(--wp-components-color-foreground, #1e1e1e);
|
|
3406
3406
|
}
|
|
3407
3407
|
.components-accessible-toolbar .components-button:focus::before,
|
|
3408
3408
|
.components-toolbar .components-button:focus::before {
|
|
@@ -3446,8 +3446,8 @@ body.lockscroll {
|
|
|
3446
3446
|
|
|
3447
3447
|
.components-toolbar-group {
|
|
3448
3448
|
min-height: 48px;
|
|
3449
|
-
border-right: 1px solid #1e1e1e;
|
|
3450
|
-
background-color: #fff;
|
|
3449
|
+
border-right: 1px solid var(--wp-components-color-foreground, #1e1e1e);
|
|
3450
|
+
background-color: var(--wp-components-color-background, #fff);
|
|
3451
3451
|
display: inline-flex;
|
|
3452
3452
|
flex-shrink: 0;
|
|
3453
3453
|
flex-wrap: wrap;
|
|
@@ -3479,8 +3479,8 @@ body.lockscroll {
|
|
|
3479
3479
|
.components-toolbar {
|
|
3480
3480
|
min-height: 48px;
|
|
3481
3481
|
margin: 0;
|
|
3482
|
-
border: 1px solid #1e1e1e;
|
|
3483
|
-
background-color: #fff;
|
|
3482
|
+
border: 1px solid var(--wp-components-color-foreground, #1e1e1e);
|
|
3483
|
+
background-color: var(--wp-components-color-background, #fff);
|
|
3484
3484
|
display: inline-flex;
|
|
3485
3485
|
flex-shrink: 0;
|
|
3486
3486
|
flex-wrap: wrap;
|
|
@@ -26,6 +26,6 @@ import type { WordPressComponentProps } from '../context';
|
|
|
26
26
|
* }
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare function DropZoneComponent({ className, label, onFilesDrop, onHTMLDrop, onDrop, isEligible, ...restProps }: WordPressComponentProps<DropZoneProps, 'div', false>): import("react").JSX.Element;
|
|
29
|
+
export declare function DropZoneComponent({ className, icon, label, onFilesDrop, onHTMLDrop, onDrop, isEligible, ...restProps }: WordPressComponentProps<DropZoneProps, 'div', false>): import("react").JSX.Element;
|
|
30
30
|
export default DropZoneComponent;
|
|
31
31
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drop-zone/index.tsx"],"names":[],"mappings":"AAcA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAE,EAClC,SAAS,EACT,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,UAAuB,EACvB,GAAG,SAAS,EACZ,EAAE,uBAAuB,CAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAE,+BAqFxD;AAED,eAAe,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drop-zone/index.tsx"],"names":[],"mappings":"AAcA;;GAEG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAE,EAClC,SAAS,EACT,IAAa,EACb,KAAK,EACL,WAAW,EACX,UAAU,EACV,MAAM,EACN,UAAuB,EACvB,GAAG,SAAS,EACZ,EAAE,uBAAuB,CAAE,aAAa,EAAE,KAAK,EAAE,KAAK,CAAE,+BAqFxD;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/drop-zone/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/drop-zone/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAOtD;;GAEG;AACH,OAAO,QAAQ,MAAM,IAAI,CAAC;AAI1B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,QAAQ,CAgBhC,CAAC;AACF,eAAe,IAAI,CAAC;AAiBpB,eAAO,MAAM,OAAO,0SAAsB,CAAC"}
|
|
@@ -4,6 +4,12 @@ export type DropZoneProps = {
|
|
|
4
4
|
* A CSS `class` to give to the wrapper element.
|
|
5
5
|
*/
|
|
6
6
|
className?: string;
|
|
7
|
+
/**
|
|
8
|
+
* An icon to be shown within the drop zone area.
|
|
9
|
+
*
|
|
10
|
+
* @default "upload"
|
|
11
|
+
*/
|
|
12
|
+
icon?: JSX.Element;
|
|
7
13
|
/**
|
|
8
14
|
* A string to be shown within the drop zone area.
|
|
9
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/drop-zone/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAE,KAAK,EAAE,SAAS,KAAM,IAAI,CAAC;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,KAAM,IAAI,CAAC;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAE,YAAY,EAAE,YAAY,KAAM,OAAO,CAAC;CACvD,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/drop-zone/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,aAAa,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAE,KAAK,EAAE,SAAS,KAAM,IAAI,CAAC;IACtC;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,KAAM,IAAI,CAAC;IACxC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAE,YAAY,EAAE,YAAY,KAAM,OAAO,CAAC;CACvD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAa9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,mBAAmB,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/form-token-field/index.tsx"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,mBAAmB,EAAa,MAAM,SAAS,CAAC;AAa9D;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAE,KAAK,EAAE,mBAAmB,+BAktBzD;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestions-list.d.ts","sourceRoot":"","sources":["../../src/form-token-field/suggestions-list.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAOpD,wBAAgB,eAAe,CAC9B,CAAC,SAAS,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EACtD,EACF,aAAa,EACb,cAAc,EACd,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,GACxB,EAAE,oBAAoB,CAAE,CAAC,CAAE,+
|
|
1
|
+
{"version":3,"file":"suggestions-list.d.ts","sourceRoot":"","sources":["../../src/form-token-field/suggestions-list.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAOpD,wBAAgB,eAAe,CAC9B,CAAC,SAAS,MAAM,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EACtD,EACF,aAAa,EACb,cAAc,EACd,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,wBAAwB,GACxB,EAAE,oBAAoB,CAAE,CAAC,CAAE,+BAgI3B;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../src/input-control/input-field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"input-field.d.ts","sourceRoot":"","sources":["../../src/input-control/input-field.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AA2L/C,QAAA,MAAM,kBAAkB,yRAA2B,CAAC;AAEpD,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private-apis.d.ts","sourceRoot":"","sources":["../src/private-apis.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,IAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,UAAY,MAAM,KAAI,
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../src/utils/strings.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,mBAAmB,UAAY,MAAM,KAAI,MAKrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAE,GAAG,EAAE,OAAO,UActC;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAE,MAAM,EAAE,MAAM,GAAI,MAAM,CAErD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/components",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.11.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.25.0",
|
|
48
|
+
"@wordpress/compose": "^7.25.0",
|
|
49
|
+
"@wordpress/date": "^5.25.0",
|
|
50
|
+
"@wordpress/deprecated": "^4.25.0",
|
|
51
|
+
"@wordpress/dom": "^4.25.0",
|
|
52
|
+
"@wordpress/element": "^6.25.0",
|
|
53
|
+
"@wordpress/escape-html": "^3.25.0",
|
|
54
|
+
"@wordpress/hooks": "^4.25.0",
|
|
55
|
+
"@wordpress/html-entities": "^4.25.0",
|
|
56
|
+
"@wordpress/i18n": "^5.25.0",
|
|
57
|
+
"@wordpress/icons": "^10.25.0",
|
|
58
|
+
"@wordpress/is-shallow-equal": "^5.25.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.25.0",
|
|
60
|
+
"@wordpress/primitives": "^4.25.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.25.0",
|
|
62
|
+
"@wordpress/rich-text": "^7.25.0",
|
|
63
|
+
"@wordpress/warning": "^3.25.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": "d1acd76ffff33ab01f0a948d2f51e5e45c95158d"
|
|
89
89
|
}
|
package/src/drop-zone/index.tsx
CHANGED
|
@@ -43,6 +43,7 @@ import type { WordPressComponentProps } from '../context';
|
|
|
43
43
|
*/
|
|
44
44
|
export function DropZoneComponent( {
|
|
45
45
|
className,
|
|
46
|
+
icon = upload,
|
|
46
47
|
label,
|
|
47
48
|
onFilesDrop,
|
|
48
49
|
onHTMLDrop,
|
|
@@ -124,7 +125,7 @@ export function DropZoneComponent( {
|
|
|
124
125
|
<div className="components-drop-zone__content">
|
|
125
126
|
<div className="components-drop-zone__content-inner">
|
|
126
127
|
<Icon
|
|
127
|
-
icon={
|
|
128
|
+
icon={ icon }
|
|
128
129
|
className="components-drop-zone__content-icon"
|
|
129
130
|
/>
|
|
130
131
|
<span className="components-drop-zone__content-text">
|
|
@@ -2,15 +2,30 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import type { Meta, StoryFn } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { upload, media } from '@wordpress/icons';
|
|
10
|
+
|
|
5
11
|
/**
|
|
6
12
|
* Internal dependencies
|
|
7
13
|
*/
|
|
8
14
|
import DropZone from '..';
|
|
9
15
|
|
|
16
|
+
const ICONS = { upload, media };
|
|
17
|
+
|
|
10
18
|
const meta: Meta< typeof DropZone > = {
|
|
11
19
|
component: DropZone,
|
|
12
20
|
id: 'components-dropzone',
|
|
13
21
|
title: 'Components/Selection & Input/File Upload/DropZone',
|
|
22
|
+
argTypes: {
|
|
23
|
+
icon: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: Object.keys( ICONS ),
|
|
26
|
+
mapping: ICONS,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
14
29
|
parameters: {
|
|
15
30
|
actions: { argTypesRegex: '^on.*' },
|
|
16
31
|
controls: { expanded: true },
|
package/src/drop-zone/types.ts
CHANGED
|
@@ -5,6 +5,12 @@ export type DropZoneProps = {
|
|
|
5
5
|
* A CSS `class` to give to the wrapper element.
|
|
6
6
|
*/
|
|
7
7
|
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* An icon to be shown within the drop zone area.
|
|
10
|
+
*
|
|
11
|
+
* @default "upload"
|
|
12
|
+
*/
|
|
13
|
+
icon?: JSX.Element;
|
|
8
14
|
/**
|
|
9
15
|
* A string to be shown within the drop zone area.
|
|
10
16
|
*
|
|
@@ -513,10 +513,13 @@ export function FormTokenField( props: FormTokenFieldProps ) {
|
|
|
513
513
|
( suggestion ) => ! normalizedValue.includes( suggestion )
|
|
514
514
|
);
|
|
515
515
|
} else {
|
|
516
|
-
match = match.toLocaleLowerCase();
|
|
516
|
+
match = match.normalize( 'NFKC' ).toLocaleLowerCase();
|
|
517
517
|
|
|
518
518
|
_suggestions.forEach( ( suggestion ) => {
|
|
519
|
-
const index = suggestion
|
|
519
|
+
const index = suggestion
|
|
520
|
+
.normalize( 'NFKC' )
|
|
521
|
+
.toLocaleLowerCase()
|
|
522
|
+
.indexOf( match );
|
|
520
523
|
if ( normalizedValue.indexOf( suggestion ) === -1 ) {
|
|
521
524
|
if ( index === 0 ) {
|
|
522
525
|
startsWithMatch.push( suggestion );
|
|
@@ -37,7 +37,6 @@ export function SuggestionsList<
|
|
|
37
37
|
( listNode ) => {
|
|
38
38
|
// only have to worry about scrolling selected suggestion into view
|
|
39
39
|
// when already expanded.
|
|
40
|
-
let rafId: number | undefined;
|
|
41
40
|
if (
|
|
42
41
|
selectedIndex > -1 &&
|
|
43
42
|
scrollIntoView &&
|
|
@@ -49,12 +48,6 @@ export function SuggestionsList<
|
|
|
49
48
|
inline: 'nearest',
|
|
50
49
|
} );
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
return () => {
|
|
54
|
-
if ( rafId !== undefined ) {
|
|
55
|
-
cancelAnimationFrame( rafId );
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
51
|
},
|
|
59
52
|
[ selectedIndex, scrollIntoView ]
|
|
60
53
|
);
|
|
@@ -72,13 +65,16 @@ export function SuggestionsList<
|
|
|
72
65
|
};
|
|
73
66
|
|
|
74
67
|
const computeSuggestionMatch = ( suggestion: T ) => {
|
|
75
|
-
const matchText = displayTransform( match )
|
|
68
|
+
const matchText = displayTransform( match )
|
|
69
|
+
.normalize( 'NFKC' )
|
|
70
|
+
.toLocaleLowerCase();
|
|
76
71
|
if ( matchText.length === 0 ) {
|
|
77
72
|
return null;
|
|
78
73
|
}
|
|
79
74
|
|
|
80
75
|
const transformedSuggestion = displayTransform( suggestion );
|
|
81
76
|
const indexOfMatch = transformedSuggestion
|
|
77
|
+
.normalize( 'NFKC' )
|
|
82
78
|
.toLocaleLowerCase()
|
|
83
79
|
.indexOf( matchText );
|
|
84
80
|
|
|
@@ -1275,6 +1275,45 @@ describe( 'FormTokenField', () => {
|
|
|
1275
1275
|
expect( screen.queryByRole( 'listbox' ) ).not.toBeInTheDocument();
|
|
1276
1276
|
} );
|
|
1277
1277
|
|
|
1278
|
+
it( 'should match suggestions with half-width and full-width characters', async () => {
|
|
1279
|
+
const user = userEvent.setup();
|
|
1280
|
+
|
|
1281
|
+
const suggestions = [
|
|
1282
|
+
// Half-width characters
|
|
1283
|
+
'WordPress',
|
|
1284
|
+
'Gutenberg',
|
|
1285
|
+
// Full-width characters
|
|
1286
|
+
'WordPress',
|
|
1287
|
+
'Gutenberg',
|
|
1288
|
+
// Mixed characters
|
|
1289
|
+
'WordPress',
|
|
1290
|
+
'Gutenberg',
|
|
1291
|
+
];
|
|
1292
|
+
|
|
1293
|
+
render( <FormTokenFieldWithState suggestions={ suggestions } /> );
|
|
1294
|
+
|
|
1295
|
+
const input = screen.getByRole( 'combobox' );
|
|
1296
|
+
|
|
1297
|
+
// Search with half-width characters.
|
|
1298
|
+
await user.type( input, 'rdp' );
|
|
1299
|
+
|
|
1300
|
+
expectVisibleSuggestionsToBe( screen.getByRole( 'listbox' ), [
|
|
1301
|
+
'WordPress',
|
|
1302
|
+
'WordPress',
|
|
1303
|
+
'WordPress',
|
|
1304
|
+
] );
|
|
1305
|
+
|
|
1306
|
+
// Search with full-width characters.
|
|
1307
|
+
await user.clear( input );
|
|
1308
|
+
await user.type( input, 'ten' );
|
|
1309
|
+
|
|
1310
|
+
expectVisibleSuggestionsToBe( screen.getByRole( 'listbox' ), [
|
|
1311
|
+
'Gutenberg',
|
|
1312
|
+
'Gutenberg',
|
|
1313
|
+
'Gutenberg',
|
|
1314
|
+
] );
|
|
1315
|
+
} );
|
|
1316
|
+
|
|
1278
1317
|
it( 'should re-render if suggestions change', async () => {
|
|
1279
1318
|
const user = userEvent.setup();
|
|
1280
1319
|
|
|
@@ -9,7 +9,6 @@ import type {
|
|
|
9
9
|
PointerEvent,
|
|
10
10
|
FocusEvent,
|
|
11
11
|
ForwardedRef,
|
|
12
|
-
MouseEvent,
|
|
13
12
|
} from 'react';
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -187,22 +186,6 @@ function InputField(
|
|
|
187
186
|
);
|
|
188
187
|
|
|
189
188
|
const dragProps = isDragEnabled ? dragGestureProps() : {};
|
|
190
|
-
/*
|
|
191
|
-
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
|
|
192
|
-
* type=number when their spinner arrows are pressed.
|
|
193
|
-
*/
|
|
194
|
-
let handleOnMouseDown;
|
|
195
|
-
if ( type === 'number' ) {
|
|
196
|
-
handleOnMouseDown = ( event: MouseEvent< HTMLInputElement > ) => {
|
|
197
|
-
props.onMouseDown?.( event );
|
|
198
|
-
if (
|
|
199
|
-
event.currentTarget !==
|
|
200
|
-
event.currentTarget.ownerDocument.activeElement
|
|
201
|
-
) {
|
|
202
|
-
event.currentTarget.focus();
|
|
203
|
-
}
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
189
|
|
|
207
190
|
return (
|
|
208
191
|
<Input
|
|
@@ -216,7 +199,6 @@ function InputField(
|
|
|
216
199
|
onBlur={ handleOnBlur }
|
|
217
200
|
onChange={ handleOnChange }
|
|
218
201
|
onKeyDown={ withIgnoreIMEEvents( handleOnKeyDown ) }
|
|
219
|
-
onMouseDown={ handleOnMouseDown }
|
|
220
202
|
ref={ ref }
|
|
221
203
|
inputSize={ size }
|
|
222
204
|
// Fallback to `''` to avoid "uncontrolled to controlled" warning.
|
|
@@ -72,23 +72,6 @@ describe( 'InputControl', () => {
|
|
|
72
72
|
} );
|
|
73
73
|
} );
|
|
74
74
|
|
|
75
|
-
describe( 'Ensurance of focus for number inputs', () => {
|
|
76
|
-
it( 'should focus its input on mousedown events', async () => {
|
|
77
|
-
const user = await userEvent.setup();
|
|
78
|
-
const spy = jest.fn();
|
|
79
|
-
render( <InputControl type="number" onFocus={ spy } /> );
|
|
80
|
-
const target = getInput();
|
|
81
|
-
|
|
82
|
-
// Hovers the input and presses (without releasing) primary button.
|
|
83
|
-
await user.pointer( [
|
|
84
|
-
{ target },
|
|
85
|
-
{ keys: '[MouseLeft]', target },
|
|
86
|
-
] );
|
|
87
|
-
|
|
88
|
-
expect( spy ).toHaveBeenCalledTimes( 1 );
|
|
89
|
-
} );
|
|
90
|
-
} );
|
|
91
|
-
|
|
92
75
|
describe( 'Value', () => {
|
|
93
76
|
it( 'should update value onChange', async () => {
|
|
94
77
|
const user = await userEvent.setup();
|
|
@@ -116,7 +116,7 @@ function isMathExpression( cssUnit ) {
|
|
|
116
116
|
* Evaluates the math expression and return a px value.
|
|
117
117
|
*
|
|
118
118
|
* @param {string} cssUnit the cssUnit value being evaluated.
|
|
119
|
-
* @return {string} return a
|
|
119
|
+
* @return {string} return a converted value to px.
|
|
120
120
|
*/
|
|
121
121
|
function evalMathExpression( cssUnit ) {
|
|
122
122
|
let errorFound = false;
|
package/src/private-apis.ts
CHANGED
|
@@ -6,7 +6,8 @@ import { Menu } from './menu';
|
|
|
6
6
|
import { ComponentsContext } from './context/context-system-provider';
|
|
7
7
|
import Theme from './theme';
|
|
8
8
|
import { Tabs } from './tabs';
|
|
9
|
-
import { kebabCase } from './utils/strings';
|
|
9
|
+
import { kebabCase, normalizeTextString } from './utils/strings';
|
|
10
|
+
import { withIgnoreIMEEvents } from './utils/with-ignore-ime-events';
|
|
10
11
|
import { lock } from './lock-unlock';
|
|
11
12
|
import Badge from './badge';
|
|
12
13
|
|
|
@@ -18,5 +19,7 @@ lock( privateApis, {
|
|
|
18
19
|
Theme,
|
|
19
20
|
Menu,
|
|
20
21
|
kebabCase,
|
|
22
|
+
withIgnoreIMEEvents,
|
|
21
23
|
Badge,
|
|
24
|
+
normalizeTextString,
|
|
22
25
|
} );
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.components-accessible-toolbar {
|
|
2
2
|
display: inline-flex;
|
|
3
|
-
border: $border-width solid $
|
|
3
|
+
border: $border-width solid $components-color-foreground;
|
|
4
4
|
border-radius: $radius-small;
|
|
5
5
|
flex-shrink: 0;
|
|
6
6
|
|
|
@@ -14,13 +14,11 @@
|
|
|
14
14
|
& > .components-toolbar-group {
|
|
15
15
|
border-right: none;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
.components-accessible-toolbar,
|
|
22
21
|
.components-toolbar {
|
|
23
|
-
|
|
24
22
|
&[aria-orientation="vertical"] {
|
|
25
23
|
display: flex;
|
|
26
24
|
flex-direction: column;
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
z-index: -1;
|
|
57
55
|
|
|
58
56
|
// Animate in.
|
|
59
|
-
@media not (prefers-reduced-motion) {
|
|
57
|
+
@media not ( prefers-reduced-motion ) {
|
|
60
58
|
animation: components-button__appear-animation 0.1s ease;
|
|
61
59
|
animation-fill-mode: forwards;
|
|
62
60
|
}
|
|
@@ -79,7 +77,7 @@
|
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
&::before {
|
|
82
|
-
background: $
|
|
80
|
+
background: $components-color-foreground;
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -99,7 +97,6 @@
|
|
|
99
97
|
}
|
|
100
98
|
}
|
|
101
99
|
|
|
102
|
-
|
|
103
100
|
@keyframes components-button__appear-animation {
|
|
104
101
|
from {
|
|
105
102
|
transform: scaleY(0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.components-toolbar-group {
|
|
2
2
|
min-height: $block-toolbar-height;
|
|
3
|
-
border-right: $border-width solid $
|
|
4
|
-
background-color: $
|
|
3
|
+
border-right: $border-width solid $components-color-foreground;
|
|
4
|
+
background-color: $components-color-background;
|
|
5
5
|
display: inline-flex;
|
|
6
6
|
flex-shrink: 0;
|
|
7
7
|
flex-wrap: wrap;
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
.components-toolbar {
|
|
42
42
|
min-height: $block-toolbar-height;
|
|
43
43
|
margin: 0;
|
|
44
|
-
border: $border-width solid $
|
|
45
|
-
background-color: $
|
|
44
|
+
border: $border-width solid $components-color-foreground;
|
|
45
|
+
background-color: $components-color-background;
|
|
46
46
|
display: inline-flex;
|
|
47
47
|
flex-shrink: 0;
|
|
48
48
|
flex-wrap: wrap;
|
package/src/utils/strings.ts
CHANGED
|
@@ -169,4 +169,15 @@ describe( 'normalizeTextString', () => {
|
|
|
169
169
|
'-'.repeat( dashCharacters.length )
|
|
170
170
|
);
|
|
171
171
|
} );
|
|
172
|
+
|
|
173
|
+
it( 'should normalize unicode to standard characters', () => {
|
|
174
|
+
expect( normalizeTextString( '①' ) ).toBe( '1' );
|
|
175
|
+
expect( normalizeTextString( 'Ⅸ' ) ).toBe( 'ix' );
|
|
176
|
+
expect( normalizeTextString( 'MC²' ) ).toBe( 'mc2' );
|
|
177
|
+
expect( normalizeTextString( 'PlayStation 2' ) ).toBe(
|
|
178
|
+
'playstation 2'
|
|
179
|
+
);
|
|
180
|
+
expect( normalizeTextString( 'ABC' ) ).toBe( 'abc' );
|
|
181
|
+
expect( normalizeTextString( 'Amélie' ) ).toBe( 'amelie' );
|
|
182
|
+
} );
|
|
172
183
|
} );
|