@wordpress/components 29.10.0 → 29.12.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 (76) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/build/drop-zone/index.js +2 -1
  3. package/build/drop-zone/index.js.map +1 -1
  4. package/build/drop-zone/types.js.map +1 -1
  5. package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  6. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  7. package/build/form-file-upload/index.js +4 -6
  8. package/build/form-file-upload/index.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/image/index.native.js +1 -1
  16. package/build/mobile/image/index.native.js.map +1 -1
  17. package/build/mobile/utils/get-px-from-css-unit.native.js +1 -1
  18. package/build/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  19. package/build/private-apis.js +4 -1
  20. package/build/private-apis.js.map +1 -1
  21. package/build/utils/strings.js +1 -1
  22. package/build/utils/strings.js.map +1 -1
  23. package/build-module/drop-zone/index.js +2 -1
  24. package/build-module/drop-zone/index.js.map +1 -1
  25. package/build-module/drop-zone/types.js.map +1 -1
  26. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  27. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  28. package/build-module/form-file-upload/index.js +4 -6
  29. package/build-module/form-file-upload/index.js.map +1 -1
  30. package/build-module/form-token-field/index.js +2 -2
  31. package/build-module/form-token-field/index.js.map +1 -1
  32. package/build-module/form-token-field/suggestions-list.js +2 -8
  33. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  34. package/build-module/input-control/input-field.js +0 -14
  35. package/build-module/input-control/input-field.js.map +1 -1
  36. package/build-module/mobile/image/index.native.js +1 -1
  37. package/build-module/mobile/image/index.native.js.map +1 -1
  38. package/build-module/mobile/utils/get-px-from-css-unit.native.js +1 -1
  39. package/build-module/mobile/utils/get-px-from-css-unit.native.js.map +1 -1
  40. package/build-module/private-apis.js +5 -2
  41. package/build-module/private-apis.js.map +1 -1
  42. package/build-module/utils/strings.js +1 -1
  43. package/build-module/utils/strings.js.map +1 -1
  44. package/build-style/style-rtl.css +6 -6
  45. package/build-style/style.css +6 -6
  46. package/build-types/drop-zone/index.d.ts +1 -1
  47. package/build-types/drop-zone/index.d.ts.map +1 -1
  48. package/build-types/drop-zone/stories/index.story.d.ts.map +1 -1
  49. package/build-types/drop-zone/types.d.ts +6 -0
  50. package/build-types/drop-zone/types.d.ts.map +1 -1
  51. package/build-types/form-file-upload/index.d.ts.map +1 -1
  52. package/build-types/form-token-field/index.d.ts.map +1 -1
  53. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  54. package/build-types/input-control/input-field.d.ts.map +1 -1
  55. package/build-types/private-apis.d.ts.map +1 -1
  56. package/build-types/utils/strings.d.ts.map +1 -1
  57. package/package.json +19 -19
  58. package/src/circular-option-picker/stories/index.story.tsx +2 -2
  59. package/src/drop-zone/index.tsx +2 -1
  60. package/src/drop-zone/stories/index.story.tsx +15 -0
  61. package/src/drop-zone/types.ts +6 -0
  62. package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
  63. package/src/form-file-upload/index.tsx +6 -12
  64. package/src/form-token-field/index.tsx +5 -2
  65. package/src/form-token-field/suggestions-list.tsx +4 -8
  66. package/src/form-token-field/test/index.tsx +39 -0
  67. package/src/input-control/input-field.tsx +0 -18
  68. package/src/input-control/test/index.js +0 -17
  69. package/src/mobile/image/index.native.js +1 -1
  70. package/src/mobile/utils/get-px-from-css-unit.native.js +1 -1
  71. package/src/private-apis.ts +4 -1
  72. package/src/toolbar/toolbar/style.scss +3 -6
  73. package/src/toolbar/toolbar-group/style.scss +4 -4
  74. package/src/utils/strings.ts +1 -0
  75. package/src/utils/test/strings.js +11 -0
  76. package/tsconfig.tsbuildinfo +1 -1
@@ -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();
@@ -282,7 +282,7 @@ const ImageComponent = ( {
282
282
  accessible
283
283
  disabled={ ! isSelected }
284
284
  accessibilityLabel={ alt }
285
- accessibilityHint={ __( 'Double tap and hold to edit' ) }
285
+ accessibilityHint={ __( 'Double tap to view larger.' ) }
286
286
  accessibilityRole="imagebutton"
287
287
  key={ url }
288
288
  style={ imageContainerStyles }
@@ -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;
@@ -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 $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
  } );