@wordpress/components 19.0.3 → 19.1.1

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 (116) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/circular-option-picker/index.js +2 -2
  3. package/build/circular-option-picker/index.js.map +1 -1
  4. package/build/color-palette/index.js +1 -0
  5. package/build/color-palette/index.js.map +1 -1
  6. package/build/date-time/time.js +17 -3
  7. package/build/date-time/time.js.map +1 -1
  8. package/build/duotone-picker/duotone-picker.js +2 -1
  9. package/build/duotone-picker/duotone-picker.js.map +1 -1
  10. package/build/font-size-picker/index.js +2 -1
  11. package/build/font-size-picker/index.js.map +1 -1
  12. package/build/index.js +7 -7
  13. package/build/index.js.map +1 -1
  14. package/build/mobile/global-styles-context/utils.native.js +3 -3
  15. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  16. package/build/navigation/item/index.js +6 -3
  17. package/build/navigation/item/index.js.map +1 -1
  18. package/build/navigation/styles/navigation-styles.js +37 -30
  19. package/build/navigation/styles/navigation-styles.js.map +1 -1
  20. package/build/palette-edit/index.js +303 -0
  21. package/build/palette-edit/index.js.map +1 -0
  22. package/build/palette-edit/styles.js +112 -0
  23. package/build/palette-edit/styles.js.map +1 -0
  24. package/build/popover/index.js +1 -1
  25. package/build/popover/index.js.map +1 -1
  26. package/build/toggle-group-control/toggle-group-control-option/component.js +30 -4
  27. package/build/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  28. package/build/tooltip/index.js +4 -4
  29. package/build/tooltip/index.js.map +1 -1
  30. package/build-module/circular-option-picker/index.js +2 -2
  31. package/build-module/circular-option-picker/index.js.map +1 -1
  32. package/build-module/color-palette/index.js +1 -0
  33. package/build-module/color-palette/index.js.map +1 -1
  34. package/build-module/date-time/time.js +17 -3
  35. package/build-module/date-time/time.js.map +1 -1
  36. package/build-module/duotone-picker/duotone-picker.js +2 -1
  37. package/build-module/duotone-picker/duotone-picker.js.map +1 -1
  38. package/build-module/font-size-picker/index.js +2 -1
  39. package/build-module/font-size-picker/index.js.map +1 -1
  40. package/build-module/index.js +1 -1
  41. package/build-module/index.js.map +1 -1
  42. package/build-module/mobile/global-styles-context/utils.native.js +3 -3
  43. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  44. package/build-module/navigation/item/index.js +7 -4
  45. package/build-module/navigation/item/index.js.map +1 -1
  46. package/build-module/navigation/styles/navigation-styles.js +34 -28
  47. package/build-module/navigation/styles/navigation-styles.js.map +1 -1
  48. package/build-module/palette-edit/index.js +276 -0
  49. package/build-module/palette-edit/index.js.map +1 -0
  50. package/build-module/palette-edit/styles.js +90 -0
  51. package/build-module/palette-edit/styles.js.map +1 -0
  52. package/build-module/popover/index.js +1 -1
  53. package/build-module/popover/index.js.map +1 -1
  54. package/build-module/toggle-group-control/toggle-group-control-option/component.js +26 -5
  55. package/build-module/toggle-group-control/toggle-group-control-option/component.js.map +1 -1
  56. package/build-module/tooltip/index.js +4 -4
  57. package/build-module/tooltip/index.js.map +1 -1
  58. package/build-style/style-rtl.css +21 -1
  59. package/build-style/style.css +21 -1
  60. package/build-types/confirm-dialog/component.d.ts +34 -0
  61. package/build-types/confirm-dialog/component.d.ts.map +1 -0
  62. package/build-types/confirm-dialog/index.d.ts +6 -0
  63. package/build-types/confirm-dialog/index.d.ts.map +1 -0
  64. package/build-types/confirm-dialog/types.d.ts +20 -0
  65. package/build-types/confirm-dialog/types.d.ts.map +1 -0
  66. package/build-types/higher-order/with-focus-outside/index.d.ts +3 -0
  67. package/build-types/higher-order/with-focus-outside/index.d.ts.map +1 -0
  68. package/build-types/modal/aria-helper.d.ts +27 -0
  69. package/build-types/modal/aria-helper.d.ts.map +1 -0
  70. package/build-types/modal/index.d.ts +3 -0
  71. package/build-types/modal/index.d.ts.map +1 -0
  72. package/build-types/popover/index.d.ts.map +1 -1
  73. package/build-types/style-provider/index.d.ts +5 -0
  74. package/build-types/style-provider/index.d.ts.map +1 -0
  75. package/build-types/toggle-group-control/toggle-group-control-option/component.d.ts.map +1 -1
  76. package/build-types/toggle-group-control/types.d.ts +23 -0
  77. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  78. package/build-types/tooltip/index.d.ts +1 -7
  79. package/build-types/tooltip/index.d.ts.map +1 -1
  80. package/package.json +2 -2
  81. package/src/circular-option-picker/index.js +7 -5
  82. package/src/color-palette/index.js +1 -0
  83. package/src/color-palette/style.scss +9 -0
  84. package/src/color-palette/test/__snapshots__/index.js.snap +2 -0
  85. package/src/date-time/test/time.js +32 -2
  86. package/src/date-time/time.js +14 -6
  87. package/src/duotone-picker/duotone-picker.js +8 -5
  88. package/src/font-size-picker/index.js +1 -0
  89. package/src/index.js +1 -1
  90. package/src/mobile/global-styles-context/test/fixtures/theme.native.js +4 -4
  91. package/src/mobile/global-styles-context/utils.native.js +3 -3
  92. package/src/navigation/item/index.js +10 -3
  93. package/src/navigation/stories/more-examples.js +2 -1
  94. package/src/navigation/styles/navigation-styles.js +5 -0
  95. package/src/palette-edit/index.js +392 -0
  96. package/src/palette-edit/style.scss +19 -0
  97. package/src/{color-edit → palette-edit}/styles.js +15 -18
  98. package/src/popover/index.js +5 -1
  99. package/src/style.scss +1 -1
  100. package/src/toggle-group-control/stories/index.js +15 -0
  101. package/src/toggle-group-control/test/index.js +57 -0
  102. package/src/toggle-group-control/toggle-group-control-option/README.md +8 -1
  103. package/src/toggle-group-control/toggle-group-control-option/component.tsx +40 -17
  104. package/src/toggle-group-control/types.ts +24 -0
  105. package/src/tooltip/index.js +2 -7
  106. package/tsconfig.tsbuildinfo +1 -1
  107. package/build/color-edit/index.js +0 -251
  108. package/build/color-edit/index.js.map +0 -1
  109. package/build/color-edit/styles.js +0 -112
  110. package/build/color-edit/styles.js.map +0 -1
  111. package/build-module/color-edit/index.js +0 -227
  112. package/build-module/color-edit/index.js.map +0 -1
  113. package/build-module/color-edit/styles.js +0 -90
  114. package/build-module/color-edit/styles.js.map +0 -1
  115. package/src/color-edit/index.js +0 -300
  116. package/src/color-edit/style.scss +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/toggle-group-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,oBAAY,6BAA6B,GAAG;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,oBAAY,uBAAuB,GAAG,IAAI,CACzC,gBAAgB,CAAE,GAAG,CAAE,EACvB,cAAc,CACd,GAAG;IACH;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAE,KAAK,EAAE,SAAS,GAAG,SAAS,KAAM,IAAI,CAAC;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,oBAAY,8BAA8B,GAAG,gBAAgB,GAAG;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,+BAA+B,GAAG;IAC7C,YAAY,EAAE,gBAAgB,CAAE,WAAW,GAAG,SAAS,CAAE,CAAC;IAC1D,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/toggle-group-control/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE/C;;GAEG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,oBAAY,6BAA6B,GAAG;IAC3C,KAAK,EAAE,SAAS,CAAC;IACjB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAC9B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,oBAAY,uBAAuB,GAAG,IAAI,CACzC,gBAAgB,CAAE,GAAG,CAAE,EACvB,cAAc,CACd,GAAG;IACH;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAE,KAAK,EAAE,SAAS,GAAG,SAAS,KAAM,IAAI,CAAC;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CACjB,CAAC;AAEF,oBAAY,8BAA8B,GAAG,gBAAgB,GAAG;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,oBAAY,+BAA+B,GAAG;IAC7C,YAAY,EAAE,gBAAgB,CAAE,WAAW,GAAG,SAAS,CAAE,CAAC;IAC1D,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC"}
@@ -5,11 +5,5 @@
5
5
  */
6
6
  export const TOOLTIP_DELAY: number;
7
7
  export default Tooltip;
8
- declare function Tooltip({ children, position, text, shortcut, delay, }: {
9
- children: any;
10
- position: any;
11
- text: any;
12
- shortcut: any;
13
- delay?: number | undefined;
14
- }): any;
8
+ declare function Tooltip(props: any): any;
15
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,4BAFU,MAAM,CAEiB;;AAiEjC;;;;;;QAuIC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tooltip/index.js"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,4BAFU,MAAM,CAEiB;;AAiEjC,0CAkIC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "19.0.3",
3
+ "version": "19.1.1",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "c6594e767659bd3289e633a17c44fdf6a4933194"
77
+ "gitHead": "49c7be0ff5dc493fc9e5a861e18273dd1f3fce8c"
78
78
  }
@@ -25,15 +25,17 @@ function Option( {
25
25
  const optionButton = (
26
26
  <Button
27
27
  isPressed={ isSelected }
28
- className={ classnames(
29
- className,
30
- 'components-circular-option-picker__option'
31
- ) }
28
+ className="components-circular-option-picker__option"
32
29
  { ...additionalProps }
33
30
  />
34
31
  );
35
32
  return (
36
- <div className="components-circular-option-picker__option-wrapper">
33
+ <div
34
+ className={ classnames(
35
+ className,
36
+ 'components-circular-option-picker__option-wrapper'
37
+ ) }
38
+ >
37
39
  { tooltipText ? (
38
40
  <Tooltip text={ tooltipText }>{ optionButton }</Tooltip>
39
41
  ) : (
@@ -135,6 +135,7 @@ export default function ColorPalette( {
135
135
  <VStack spacing={ 3 } className={ className }>
136
136
  { ! disableCustomColors && (
137
137
  <Dropdown
138
+ contentClassName="components-color-palette__custom-color-dropdown-content"
138
139
  renderContent={ renderCustomColorPicker }
139
140
  renderToggle={ ( { isOpen, onToggle } ) => (
140
141
  <button
@@ -16,3 +16,12 @@
16
16
  color: $white;
17
17
  cursor: pointer;
18
18
  }
19
+
20
+ .components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content {
21
+ overflow: visible;
22
+ box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05);
23
+ border: none;
24
+ & > div {
25
+ padding: 0;
26
+ }
27
+ }
@@ -26,6 +26,7 @@ exports[`ColorPalette Dropdown .renderToggle should render dropdown content 1`]
26
26
 
27
27
  exports[`ColorPalette Dropdown should render it correctly 1`] = `
28
28
  <Dropdown
29
+ contentClassName="components-color-palette__custom-color-dropdown-content"
29
30
  key=".0"
30
31
  renderContent={[Function]}
31
32
  renderToggle={[Function]}
@@ -177,6 +178,7 @@ exports[`ColorPalette should render a dynamic toolbar of colors 1`] = `
177
178
  data-wp-component="VStack"
178
179
  >
179
180
  <Dropdown
181
+ contentClassName="components-color-palette__custom-color-dropdown-content"
180
182
  key=".0"
181
183
  renderContent={[Function]}
182
184
  renderToggle={[Function]}
@@ -47,13 +47,13 @@ describe( 'TimePicker', () => {
47
47
  fireEvent.change( hoursInput, { target: { value: '12' } } );
48
48
  fireEvent.blur( hoursInput );
49
49
 
50
- expect( onChangeSpy ).toHaveBeenCalledWith( '2018-12-22T12:00:00' );
50
+ expect( onChangeSpy ).toHaveBeenCalledWith( '2018-12-22T00:00:00' );
51
51
  onChangeSpy.mockClear();
52
52
 
53
53
  fireEvent.change( minutesInput, { target: { value: '35' } } );
54
54
  fireEvent.blur( minutesInput );
55
55
 
56
- expect( onChangeSpy ).toHaveBeenCalledWith( '2018-12-22T12:35:00' );
56
+ expect( onChangeSpy ).toHaveBeenCalledWith( '2018-12-22T00:35:00' );
57
57
  onChangeSpy.mockClear();
58
58
  } );
59
59
 
@@ -169,6 +169,36 @@ describe( 'TimePicker', () => {
169
169
  expect( onChangeSpy ).toHaveBeenCalledWith( '1986-10-18T11:00:00' );
170
170
  } );
171
171
 
172
+ it( 'should allow to set the time correctly when the PM period is selected', () => {
173
+ const onChangeSpy = jest.fn();
174
+
175
+ render(
176
+ <TimePicker
177
+ currentTime="1986-10-18T11:00:00"
178
+ onChange={ onChangeSpy }
179
+ is12Hour
180
+ />
181
+ );
182
+
183
+ const pmButton = screen.getByText( 'PM' );
184
+ fireEvent.click( pmButton );
185
+
186
+ const hoursInput = screen.getByLabelText( 'Hours' );
187
+ fireEvent.change( hoursInput, { target: { value: '6' } } );
188
+ fireEvent.blur( hoursInput );
189
+
190
+ // When clicking on 'PM', we expect the time to be 11pm
191
+ expect( onChangeSpy ).toHaveBeenNthCalledWith(
192
+ 1,
193
+ '1986-10-18T23:00:00'
194
+ );
195
+ // When changing the hours to '6', we expect the time to be 6pm
196
+ expect( onChangeSpy ).toHaveBeenNthCalledWith(
197
+ 2,
198
+ '1986-10-18T18:00:00'
199
+ );
200
+ } );
201
+
172
202
  it( 'should truncate at the minutes on change', () => {
173
203
  const onChangeSpy = jest.fn();
174
204
 
@@ -28,6 +28,10 @@ import TimeZone from './timezone';
28
28
  */
29
29
  const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
30
30
 
31
+ function from12hTo24h( hours, isPm ) {
32
+ return isPm ? ( ( hours % 12 ) + 12 ) % 24 : hours % 12;
33
+ }
34
+
31
35
  /**
32
36
  * <UpdateOnBlurAsIntegerField>
33
37
  * A shared component to parse, validate, and handle remounting of the underlying form field element like <input> and <select>.
@@ -117,8 +121,16 @@ export function TimePicker( { is12Hour, currentTime, onChange } ) {
117
121
  }
118
122
 
119
123
  function update( name, value ) {
124
+ // If the 12-hour format is being used and the 'PM' period is selected, then
125
+ // the incoming value (which ranges 1-12) should be increased by 12 to match
126
+ // the expected 24-hour format.
127
+ let adjustedValue = value;
128
+ if ( name === 'hours' && is12Hour ) {
129
+ adjustedValue = from12hTo24h( value, am === 'PM' );
130
+ }
131
+
120
132
  // Clone the date and call the specific setter function according to `name`.
121
- const newDate = date.clone()[ name ]( value );
133
+ const newDate = date.clone()[ name ]( adjustedValue );
122
134
  changeDate( newDate );
123
135
  }
124
136
 
@@ -132,11 +144,7 @@ export function TimePicker( { is12Hour, currentTime, onChange } ) {
132
144
 
133
145
  const newDate = date
134
146
  .clone()
135
- .hours(
136
- value === 'PM'
137
- ? ( ( parsedHours % 12 ) + 12 ) % 24
138
- : parsedHours % 12
139
- );
147
+ .hours( from12hTo24h( parsedHours, value === 'PM' ) );
140
148
 
141
149
  changeDate( newDate );
142
150
  };
@@ -19,6 +19,7 @@ import CustomDuotoneBar from './custom-duotone-bar';
19
19
  import { getDefaultColors, getGradientFromCSSColors } from './utils';
20
20
 
21
21
  function DuotonePicker( {
22
+ clearable = true,
22
23
  colorPalette,
23
24
  duotonePalette,
24
25
  disableCustomColors,
@@ -69,11 +70,13 @@ function DuotonePicker( {
69
70
  );
70
71
  } ) }
71
72
  actions={
72
- <CircularOptionPicker.ButtonAction
73
- onClick={ () => onChange( undefined ) }
74
- >
75
- { __( 'Clear' ) }
76
- </CircularOptionPicker.ButtonAction>
73
+ !! clearable && (
74
+ <CircularOptionPicker.ButtonAction
75
+ onClick={ () => onChange( undefined ) }
76
+ >
77
+ { __( 'Clear' ) }
78
+ </CircularOptionPicker.ButtonAction>
79
+ )
77
80
  }
78
81
  >
79
82
  { ! disableCustomColors && ! disableCustomDuotone && (
@@ -186,6 +186,7 @@ function FontSizePicker(
186
186
  value={ option.value }
187
187
  label={ option.label }
188
188
  aria-label={ option.name }
189
+ showTooltip={ true }
189
190
  />
190
191
  ) ) }
191
192
  </ToggleGroupControl>
package/src/index.js CHANGED
@@ -36,7 +36,7 @@ export {
36
36
  } from './card';
37
37
  export { default as CheckboxControl } from './checkbox-control';
38
38
  export { default as ClipboardButton } from './clipboard-button';
39
- export { default as __experimentalColorEdit } from './color-edit';
39
+ export { default as __experimentalPaletteEdit } from './palette-edit';
40
40
  export { default as ColorIndicator } from './color-indicator';
41
41
  export { default as ColorPalette } from './color-palette';
42
42
  export { ColorPicker } from './color-picker';
@@ -23,7 +23,7 @@ export const GLOBAL_STYLES_PALETTE = [
23
23
  ];
24
24
 
25
25
  export const GLOBAL_STYLES_GRADIENTS = {
26
- core: [
26
+ default: [
27
27
  {
28
28
  name: 'Vivid cyan blue to vivid purple',
29
29
  gradient:
@@ -138,7 +138,7 @@ export const PARSED_GLOBAL_STYLES = {
138
138
  export const RAW_FEATURES = {
139
139
  color: {
140
140
  palette: {
141
- core: [
141
+ default: [
142
142
  {
143
143
  name: 'Black',
144
144
  slug: 'black',
@@ -174,7 +174,7 @@ export const RAW_FEATURES = {
174
174
  ],
175
175
  },
176
176
  gradients: {
177
- core: [
177
+ default: [
178
178
  {
179
179
  name: 'Vivid cyan blue to vivid purple',
180
180
  gradient:
@@ -204,7 +204,7 @@ export const RAW_FEATURES = {
204
204
  },
205
205
  typography: {
206
206
  fontSizes: {
207
- core: [
207
+ default: [
208
208
  {
209
209
  name: 'Small',
210
210
  slug: 'small',
@@ -233,10 +233,10 @@ export function parseStylesVariables( styles, mappedValues, customValues ) {
233
233
 
234
234
  export function getMappedValues( features, palette ) {
235
235
  const typography = features?.typography;
236
- const colors = { ...palette?.theme, ...palette?.user };
236
+ const colors = { ...palette?.theme, ...palette?.custom };
237
237
  const fontSizes = {
238
238
  ...typography?.fontSizes?.theme,
239
- ...typography?.fontSizes?.user,
239
+ ...typography?.fontSizes?.custom,
240
240
  };
241
241
  const mappedValues = {
242
242
  color: {
@@ -265,7 +265,7 @@ function normalizeFontSizes( fontSizes ) {
265
265
  const normalizedFontSizes = {};
266
266
  const dimensions = Dimensions.get( 'window' );
267
267
 
268
- [ 'core', 'theme', 'user' ].forEach( ( key ) => {
268
+ [ 'default', 'theme', 'user' ].forEach( ( key ) => {
269
269
  if ( fontSizes[ key ] ) {
270
270
  normalizedFontSizes[ key ] = fontSizes[ key ]?.map(
271
271
  ( fontSizeObject ) => {
@@ -15,7 +15,7 @@ import { isRTL } from '@wordpress/i18n';
15
15
  */
16
16
  import Button from '../../button';
17
17
  import { useNavigationContext } from '../context';
18
- import { ItemUI } from '../styles/navigation-styles';
18
+ import { ItemUI, ItemIconUI } from '../styles/navigation-styles';
19
19
  import NavigationItemBaseContent from './base-content';
20
20
  import NavigationItemBase from './base';
21
21
 
@@ -29,6 +29,7 @@ export default function NavigationItem( props ) {
29
29
  navigateToMenu,
30
30
  onClick = noop,
31
31
  title,
32
+ icon,
32
33
  hideIfTargetMenuEmpty,
33
34
  isText,
34
35
  ...restProps
@@ -62,7 +63,7 @@ export default function NavigationItem( props ) {
62
63
 
63
64
  onClick( event );
64
65
  };
65
- const icon = isRTL() ? chevronLeft : chevronRight;
66
+ const navigationIcon = isRTL() ? chevronLeft : chevronRight;
66
67
  const baseProps = children ? props : { ...props, onClick: undefined };
67
68
  const itemProps = isText
68
69
  ? restProps
@@ -72,12 +73,18 @@ export default function NavigationItem( props ) {
72
73
  <NavigationItemBase { ...baseProps } className={ classes }>
73
74
  { children || (
74
75
  <ItemUI { ...itemProps }>
76
+ { icon && (
77
+ <ItemIconUI>
78
+ <Icon icon={ icon } />
79
+ </ItemIconUI>
80
+ ) }
81
+
75
82
  <NavigationItemBaseContent
76
83
  title={ title }
77
84
  badge={ badge }
78
85
  />
79
86
 
80
- { navigateToMenu && <Icon icon={ icon } /> }
87
+ { navigateToMenu && <Icon icon={ navigationIcon } /> }
81
88
  </ItemUI>
82
89
  ) }
83
90
  </NavigationItemBase>
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useEffect, useState } from '@wordpress/element';
5
- import { Icon, wordpress } from '@wordpress/icons';
5
+ import { Icon, wordpress, home } from '@wordpress/icons';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -33,6 +33,7 @@ export function MoreExamplesStory() {
33
33
  </NavigationGroup>
34
34
  <NavigationGroup title="Items with Unusual Features">
35
35
  <NavigationItem
36
+ icon={ home }
36
37
  item="item-sub-menu"
37
38
  navigateToMenu="sub-menu"
38
39
  title="Sub-Menu with Custom Back Label"
@@ -184,6 +184,11 @@ export const ItemUI = styled.div`
184
184
  opacity: 0.7;
185
185
  `;
186
186
 
187
+ export const ItemIconUI = styled.span`
188
+ display: flex;
189
+ margin-right: ${ space( 2 ) };
190
+ `;
191
+
187
192
  export const ItemBadgeUI = styled.span`
188
193
  margin-left: ${ () => ( isRTL() ? '0' : space( 2 ) ) };
189
194
  margin-right: ${ () => ( isRTL() ? space( 2 ) : '0' ) };