@wordpress/components 29.9.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/color-picker/color-copy-button.js +3 -2
  3. package/build/color-picker/color-copy-button.js.map +1 -1
  4. package/build/drop-zone/index.js +2 -1
  5. package/build/drop-zone/index.js.map +1 -1
  6. package/build/drop-zone/types.js.map +1 -1
  7. package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  8. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  9. package/build/form-token-field/index.js +2 -2
  10. package/build/form-token-field/index.js.map +1 -1
  11. package/build/form-token-field/suggestions-list.js +2 -8
  12. package/build/form-token-field/suggestions-list.js.map +1 -1
  13. package/build/input-control/input-field.js +0 -14
  14. package/build/input-control/input-field.js.map +1 -1
  15. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -1
  16. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  17. package/build/notice/types.js.map +1 -1
  18. package/build/popover/types.js.map +1 -1
  19. package/build/private-apis.js +4 -1
  20. package/build/private-apis.js.map +1 -1
  21. package/build/snackbar/index.js +16 -11
  22. package/build/snackbar/index.js.map +1 -1
  23. package/build/snackbar/types.js.map +1 -1
  24. package/build/spinner/index.js +5 -5
  25. package/build/spinner/index.js.map +1 -1
  26. package/build/textarea-control/styles/textarea-control-styles.js +3 -3
  27. package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
  28. package/build/utils/strings.js +1 -1
  29. package/build/utils/strings.js.map +1 -1
  30. package/build/utils/with-ignore-ime-events.js +5 -5
  31. package/build/utils/with-ignore-ime-events.js.map +1 -1
  32. package/build-module/color-picker/color-copy-button.js +4 -3
  33. package/build-module/color-picker/color-copy-button.js.map +1 -1
  34. package/build-module/drop-zone/index.js +2 -1
  35. package/build-module/drop-zone/index.js.map +1 -1
  36. package/build-module/drop-zone/types.js.map +1 -1
  37. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  38. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  39. package/build-module/form-token-field/index.js +2 -2
  40. package/build-module/form-token-field/index.js.map +1 -1
  41. package/build-module/form-token-field/suggestions-list.js +2 -8
  42. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  43. package/build-module/input-control/input-field.js +0 -14
  44. package/build-module/input-control/input-field.js.map +1 -1
  45. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -1
  46. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  47. package/build-module/notice/types.js.map +1 -1
  48. package/build-module/popover/types.js.map +1 -1
  49. package/build-module/private-apis.js +5 -2
  50. package/build-module/private-apis.js.map +1 -1
  51. package/build-module/snackbar/index.js +16 -11
  52. package/build-module/snackbar/index.js.map +1 -1
  53. package/build-module/snackbar/types.js.map +1 -1
  54. package/build-module/spinner/index.js +5 -5
  55. package/build-module/spinner/index.js.map +1 -1
  56. package/build-module/textarea-control/styles/textarea-control-styles.js +3 -3
  57. package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
  58. package/build-module/utils/strings.js +1 -1
  59. package/build-module/utils/strings.js.map +1 -1
  60. package/build-module/utils/with-ignore-ime-events.js +5 -5
  61. package/build-module/utils/with-ignore-ime-events.js.map +1 -1
  62. package/build-style/style-rtl.css +81 -70
  63. package/build-style/style.css +81 -70
  64. package/build-types/drop-zone/index.d.ts +1 -1
  65. package/build-types/drop-zone/index.d.ts.map +1 -1
  66. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  67. package/build-types/drop-zone/types.d.ts +6 -0
  68. package/build-types/drop-zone/types.d.ts.map +1 -1
  69. package/build-types/form-token-field/index.d.ts.map +1 -1
  70. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  71. package/build-types/input-control/input-field.d.ts.map +1 -1
  72. package/build-types/notice/types.d.ts +3 -1
  73. package/build-types/notice/types.d.ts.map +1 -1
  74. package/build-types/popover/types.d.ts +4 -0
  75. package/build-types/popover/types.d.ts.map +1 -1
  76. package/build-types/private-apis.d.ts.map +1 -1
  77. package/build-types/snackbar/index.d.ts +1 -1
  78. package/build-types/snackbar/index.d.ts.map +1 -1
  79. package/build-types/snackbar/types.d.ts +1 -1
  80. package/build-types/snackbar/types.d.ts.map +1 -1
  81. package/build-types/spinner/index.d.ts +5 -5
  82. package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
  83. package/build-types/utils/strings.d.ts.map +1 -1
  84. package/build-types/utils/with-ignore-ime-events.d.ts +4 -4
  85. package/build-types/utils/with-ignore-ime-events.d.ts.map +1 -1
  86. package/package.json +19 -19
  87. package/src/color-picker/color-copy-button.tsx +4 -4
  88. package/src/drop-zone/index.tsx +2 -1
  89. package/src/drop-zone/stories/index.story.tsx +15 -0
  90. package/src/drop-zone/types.ts +6 -0
  91. package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
  92. package/src/form-token-field/index.tsx +5 -2
  93. package/src/form-token-field/suggestions-list.tsx +4 -8
  94. package/src/form-token-field/test/index.tsx +39 -0
  95. package/src/input-control/input-field.tsx +0 -18
  96. package/src/input-control/test/index.js +0 -17
  97. package/src/mobile/utils/get-px-from-css-unit.native.js +1 -1
  98. package/src/notice/README.md +3 -2
  99. package/src/notice/types.ts +3 -1
  100. package/src/popover/README.md +11 -0
  101. package/src/popover/types.ts +4 -0
  102. package/src/private-apis.ts +4 -1
  103. package/src/snackbar/index.tsx +30 -17
  104. package/src/snackbar/style.scss +2 -1
  105. package/src/snackbar/types.ts +4 -1
  106. package/src/spinner/index.tsx +5 -5
  107. package/src/text-control/style.scss +3 -1
  108. package/src/textarea-control/styles/textarea-control-styles.ts +2 -0
  109. package/src/toolbar/toolbar/style.scss +3 -6
  110. package/src/toolbar/toolbar-group/style.scss +4 -4
  111. package/src/utils/strings.ts +1 -0
  112. package/src/utils/test/strings.js +11 -0
  113. package/src/utils/with-ignore-ime-events.ts +5 -5
  114. package/tsconfig.tsbuildinfo +1 -1
@@ -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
  *
@@ -53,7 +53,7 @@ export const MediaContainer = styled.div`
53
53
  max-width: 100%;
54
54
  pointer-events: none;
55
55
  user-select: none;
56
- width: auto;
56
+ width: 100%;
57
57
  }
58
58
  `;
59
59
 
@@ -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.toLocaleLowerCase().indexOf( match );
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 ).toLocaleLowerCase();
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 converfted value to px.
119
+ * @return {string} return a converted value to px.
120
120
  */
121
121
  function evalMathExpression( cssUnit ) {
122
122
  let errorFound = false;
@@ -61,7 +61,7 @@ If an icon is included in the Notice, it should be color-coded to match the Noti
61
61
  To display a plain notice, pass `Notice` a string:
62
62
 
63
63
  ```jsx
64
- import { Notice } from `@wordpress/components`;
64
+ import { Notice } from '@wordpress/components';
65
65
 
66
66
  const MyNotice = () => (
67
67
  <Notice status="error">An unknown error occurred.</Notice>
@@ -71,7 +71,7 @@ const MyNotice = () => (
71
71
  For more complex markup, you can pass any JSX element:
72
72
 
73
73
  ```jsx
74
- import { Notice } from `@wordpress/components`;
74
+ import { Notice } from '@wordpress/components';
75
75
 
76
76
  const MyNotice = () => (
77
77
  <Notice status="error">
@@ -145,6 +145,7 @@ An array of notice actions. Each member object should contain:
145
145
 
146
146
  - `label`: `string` containing the text of the button/link
147
147
  - `url`: `string` OR `onClick`: `( event: SyntheticEvent ) => void` to specify what the action does.
148
+ - `openInNewTab`: `boolean` (optional) When set to `true`, opens the URL in a new browser tab.
148
149
  - `className`: `string` (optional) to add custom classes to the button styles.
149
150
  - `noDefaultClasses`: `boolean` (optional) A value of `true` will remove all default styling.
150
151
  - `variant`: `'primary' | 'secondary' | 'link'` (optional) You can denote a primary button action for a notice by passing a value of `primary`.
@@ -14,11 +14,13 @@ type CommonNoticeActionProps = {
14
14
  // `onClick` will be ignored.
15
15
  type NoticeActionWithURL = CommonNoticeActionProps & {
16
16
  url: string;
17
+ openInNewTab?: boolean;
17
18
  onClick?: never;
18
19
  };
19
20
  type NoticeActionWithOnClick = CommonNoticeActionProps & {
20
21
  url?: never;
21
- onClick: MouseEventHandler< HTMLButtonElement >;
22
+ openInNewTab?: never;
23
+ onClick: MouseEventHandler< HTMLButtonElement | HTMLAnchorElement >;
22
24
  };
23
25
 
24
26
  export type NoticeAction = NoticeActionWithURL | NoticeActionWithOnClick;
@@ -223,9 +223,20 @@ Possible values:
223
223
 
224
224
  Adjusts the size of the popover to prevent its contents from going out of view when meeting the viewport edges.
225
225
 
226
+ **Note:** The `resize` and `shift` props are not intended to be used together. Enabling both can cause unexpected behavior.
227
+
226
228
  - Required: No
227
229
  - Default: `true`
228
230
 
231
+ ### `shift`: `boolean`
232
+
233
+ Enables the `Popover` to shift in order to stay in view when meeting the viewport edges.
234
+
235
+ **Note:** The `shift` and `resize` props are not intended to be used together. If you enable `shift`, set `resize` to `false`.
236
+
237
+ - Required: No
238
+ - Default: `false`
239
+
229
240
  ### `variant`: `'toolbar' | 'unstyled'`
230
241
 
231
242
  Specifies the popover's style.
@@ -129,6 +129,8 @@ export type PopoverProps = {
129
129
  /**
130
130
  * Adjusts the size of the popover to prevent its contents from going out of
131
131
  * view when meeting the viewport edges.
132
+ * _Note: The `resize` and `shift` props are not intended to be used together.
133
+ * Enabling both can cause unexpected behavior._
132
134
  *
133
135
  * @default true
134
136
  */
@@ -136,6 +138,8 @@ export type PopoverProps = {
136
138
  /**
137
139
  * Enables the `Popover` to shift in order to stay in view when meeting the
138
140
  * viewport edges.
141
+ * _Note: The `resize` and `shift` props are not intended to be used together.
142
+ * Enabling both can cause unexpected behavior._
139
143
  *
140
144
  * @default false
141
145
  */
@@ -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
  } );
@@ -22,6 +22,7 @@ import warning from '@wordpress/warning';
22
22
  * Internal dependencies
23
23
  */
24
24
  import Button from '../button';
25
+ import ExternalLink from '../external-link';
25
26
  import type { SnackbarProps } from './types';
26
27
  import type { NoticeAction } from '../notice/types';
27
28
  import type { WordPressComponentProps } from '../context';
@@ -80,7 +81,7 @@ function UnforwardedSnackbar(
80
81
  }
81
82
 
82
83
  function onActionClick(
83
- event: MouseEvent< HTMLButtonElement >,
84
+ event: MouseEvent< HTMLButtonElement | HTMLAnchorElement >,
84
85
  onClick: NoticeAction[ 'onClick' ]
85
86
  ) {
86
87
  event.stopPropagation();
@@ -147,22 +148,34 @@ function UnforwardedSnackbar(
147
148
  <div className="components-snackbar__icon">{ icon }</div>
148
149
  ) }
149
150
  { children }
150
- { actions.map( ( { label, onClick, url }, index ) => {
151
- return (
152
- <Button
153
- __next40pxDefaultSize
154
- key={ index }
155
- href={ url }
156
- variant="link"
157
- onClick={ (
158
- event: MouseEvent< HTMLButtonElement >
159
- ) => onActionClick( event, onClick ) }
160
- className="components-snackbar__action"
161
- >
162
- { label }
163
- </Button>
164
- );
165
- } ) }
151
+ { actions.map(
152
+ ( { label, onClick, url, openInNewTab = false }, index ) =>
153
+ url !== undefined && openInNewTab ? (
154
+ <ExternalLink
155
+ key={ index }
156
+ href={ url }
157
+ onClick={ ( event ) =>
158
+ onActionClick( event, onClick )
159
+ }
160
+ className="components-snackbar__action"
161
+ >
162
+ { label }
163
+ </ExternalLink>
164
+ ) : (
165
+ <Button
166
+ __next40pxDefaultSize
167
+ key={ index }
168
+ href={ url }
169
+ variant="link"
170
+ onClick={ (
171
+ event: MouseEvent< HTMLButtonElement >
172
+ ) => onActionClick( event, onClick ) }
173
+ className="components-snackbar__action"
174
+ >
175
+ { label }
176
+ </Button>
177
+ )
178
+ ) }
166
179
  { explicitDismiss && (
167
180
  <span
168
181
  role="button"
@@ -45,7 +45,8 @@
45
45
  }
46
46
  }
47
47
 
48
- .components-snackbar__action.components-button {
48
+ .components-snackbar__action.components-button,
49
+ .components-snackbar__action.components-external-link {
49
50
  margin-left: $grid-unit-40;
50
51
  color: $white;
51
52
  flex-shrink: 0;
@@ -56,7 +56,10 @@ export type SnackbarProps = Pick<
56
56
  *
57
57
  * @default []
58
58
  */
59
- actions?: Pick< NoticeAction, 'label' | 'url' | 'onClick' >[];
59
+ actions?: Pick<
60
+ NoticeAction,
61
+ 'label' | 'url' | 'onClick' | 'openInNewTab'
62
+ >[];
60
63
  };
61
64
 
62
65
  export type SnackbarListProps = {
@@ -50,12 +50,12 @@ export function UnforwardedSpinner(
50
50
  /**
51
51
  * `Spinner` is a component used to notify users that their action is being processed.
52
52
  *
53
- * ```js
54
- * import { Spinner } from '@wordpress/components';
53
+ * ```jsx
54
+ * import { Spinner } from '@wordpress/components';
55
55
  *
56
- * function Example() {
57
- * return <Spinner />;
58
- * }
56
+ * function Example() {
57
+ * return <Spinner />;
58
+ * }
59
59
  * ```
60
60
  */
61
61
  export const Spinner = forwardRef( UnforwardedSpinner );
@@ -16,7 +16,9 @@
16
16
  height: $grid-unit-40;
17
17
  // Override input style margin in WP forms.css.
18
18
  margin: 0;
19
- @include input-control;
19
+ background: $components-color-background;
20
+ color: $components-color-foreground;
21
+ @include input-control( $components-color-accent);
20
22
 
21
23
  &.is-next-40px-default-size {
22
24
  height: $grid-unit-50;
@@ -37,6 +37,8 @@ export const StyledTextarea = styled.textarea`
37
37
  display: block;
38
38
  font-family: ${ font( 'default.fontFamily' ) };
39
39
  line-height: 20px;
40
+ background: ${ COLORS.theme.background };
41
+ color: ${ COLORS.theme.foreground };
40
42
 
41
43
  // Vertical padding is to match the standard 40px control height when rows=1,
42
44
  // in conjunction with the 20px line-height.
@@ -1,6 +1,6 @@
1
1
  .components-accessible-toolbar {
2
2
  display: inline-flex;
3
- border: $border-width solid $gray-900;
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: $gray-900;
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 $gray-900;
4
- background-color: $white;
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 $gray-900;
45
- background-color: $white;
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;
@@ -20,6 +20,7 @@ const ALL_UNICODE_DASH_CHARACTERS = new RegExp(
20
20
 
21
21
  export const normalizeTextString = ( value: string ): string => {
22
22
  return removeAccents( value )
23
+ .normalize( 'NFKC' )
23
24
  .toLocaleLowerCase()
24
25
  .replace( ALL_UNICODE_DASH_CHARACTERS, '-' );
25
26
  };
@@ -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
  } );
@@ -1,18 +1,18 @@
1
1
  /**
2
- * A higher-order function that wraps a keydown event handler to ensure it is not an IME event.
2
+ * A higher-order function that wraps a keyboard event handler to ensure it is not an IME event.
3
3
  *
4
4
  * In CJK languages, an IME (Input Method Editor) is used to input complex characters.
5
- * During an IME composition, keydown events (e.g. Enter or Escape) can be fired
5
+ * During an IME composition, keyboard events (e.g. Enter or Escape) can be fired
6
6
  * which are intended to control the IME and not the application.
7
7
  * These events should be ignored by any application logic.
8
8
  *
9
- * @param keydownHandler The keydown event handler to execute after ensuring it was not an IME event.
9
+ * @param handler The keyboard event handler to execute after ensuring it was not an IME event.
10
10
  *
11
11
  * @return A wrapped version of the given event handler that ignores IME events.
12
12
  */
13
13
  export function withIgnoreIMEEvents<
14
14
  E extends React.KeyboardEvent | KeyboardEvent,
15
- >( keydownHandler: ( event: E ) => void ) {
15
+ >( handler: ( event: E ) => void ) {
16
16
  return ( event: E ) => {
17
17
  const { isComposing } =
18
18
  'nativeEvent' in event ? event.nativeEvent : event;
@@ -27,6 +27,6 @@ export function withIgnoreIMEEvents<
27
27
  return;
28
28
  }
29
29
 
30
- keydownHandler( event );
30
+ handler( event );
31
31
  };
32
32
  }