@wordpress/components 25.12.0 → 25.13.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 (155) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/build/angle-picker-control/index.js +0 -1
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/custom-select-control-v2/index.js +87 -0
  5. package/build/custom-select-control-v2/index.js.map +1 -0
  6. package/build/custom-select-control-v2/styles.js +85 -0
  7. package/build/custom-select-control-v2/styles.js.map +1 -0
  8. package/build/custom-select-control-v2/types.js +6 -0
  9. package/build/custom-select-control-v2/types.js.map +1 -0
  10. package/build/dropdown-menu-v2-ariakit/index.js +49 -20
  11. package/build/dropdown-menu-v2-ariakit/index.js.map +1 -1
  12. package/build/dropdown-menu-v2-ariakit/styles.js +82 -59
  13. package/build/dropdown-menu-v2-ariakit/styles.js.map +1 -1
  14. package/build/dropdown-menu-v2-ariakit/types.js.map +1 -1
  15. package/build/form-token-field/index.js +6 -2
  16. package/build/form-token-field/index.js.map +1 -1
  17. package/build/form-token-field/token-input.js.map +1 -1
  18. package/build/form-token-field/types.js.map +1 -1
  19. package/build/heading/hook.js +6 -3
  20. package/build/heading/hook.js.map +1 -1
  21. package/build/heading/types.js.map +1 -1
  22. package/build/mobile/utils/alignments.native.js +1 -1
  23. package/build/mobile/utils/alignments.native.js.map +1 -1
  24. package/build/private-apis.js +3 -2
  25. package/build/private-apis.js.map +1 -1
  26. package/build/slot-fill/types.js.map +1 -1
  27. package/build/tabs/index.js +6 -4
  28. package/build/tabs/index.js.map +1 -1
  29. package/build/tabs/tab.js +2 -2
  30. package/build/tabs/tab.js.map +1 -1
  31. package/build/tabs/tabpanel.js +1 -1
  32. package/build/tabs/tabpanel.js.map +1 -1
  33. package/build/text/types.js.map +1 -1
  34. package/build/tools-panel/tools-panel-item/hook.js +5 -1
  35. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  36. package/build-module/angle-picker-control/index.js +0 -1
  37. package/build-module/angle-picker-control/index.js.map +1 -1
  38. package/build-module/custom-select-control-v2/index.js +74 -0
  39. package/build-module/custom-select-control-v2/index.js.map +1 -0
  40. package/build-module/custom-select-control-v2/styles.js +71 -0
  41. package/build-module/custom-select-control-v2/styles.js.map +1 -0
  42. package/build-module/custom-select-control-v2/types.js +2 -0
  43. package/build-module/custom-select-control-v2/types.js.map +1 -0
  44. package/build-module/dropdown-menu-v2-ariakit/index.js +46 -18
  45. package/build-module/dropdown-menu-v2-ariakit/index.js.map +1 -1
  46. package/build-module/dropdown-menu-v2-ariakit/styles.js +69 -40
  47. package/build-module/dropdown-menu-v2-ariakit/styles.js.map +1 -1
  48. package/build-module/dropdown-menu-v2-ariakit/types.js.map +1 -1
  49. package/build-module/form-token-field/index.js +6 -2
  50. package/build-module/form-token-field/index.js.map +1 -1
  51. package/build-module/form-token-field/token-input.js.map +1 -1
  52. package/build-module/form-token-field/types.js.map +1 -1
  53. package/build-module/heading/hook.js +6 -3
  54. package/build-module/heading/hook.js.map +1 -1
  55. package/build-module/heading/types.js.map +1 -1
  56. package/build-module/mobile/utils/alignments.native.js +1 -1
  57. package/build-module/mobile/utils/alignments.native.js.map +1 -1
  58. package/build-module/private-apis.js +4 -3
  59. package/build-module/private-apis.js.map +1 -1
  60. package/build-module/slot-fill/types.js.map +1 -1
  61. package/build-module/tabs/index.js +7 -5
  62. package/build-module/tabs/index.js.map +1 -1
  63. package/build-module/tabs/tab.js +4 -4
  64. package/build-module/tabs/tab.js.map +1 -1
  65. package/build-module/tabs/tabpanel.js +3 -3
  66. package/build-module/tabs/tabpanel.js.map +1 -1
  67. package/build-module/text/types.js.map +1 -1
  68. package/build-module/tools-panel/tools-panel-item/hook.js +6 -2
  69. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  70. package/build-style/style-rtl.css +31 -5
  71. package/build-style/style.css +31 -5
  72. package/build-types/angle-picker-control/index.d.ts.map +1 -1
  73. package/build-types/box-control/stories/index.story.d.ts +1944 -0
  74. package/build-types/box-control/stories/index.story.d.ts.map +1 -0
  75. package/build-types/color-palette/styles.d.ts +4 -1
  76. package/build-types/color-palette/styles.d.ts.map +1 -1
  77. package/build-types/custom-select-control-v2/index.d.ts +6 -0
  78. package/build-types/custom-select-control-v2/index.d.ts.map +1 -0
  79. package/build-types/custom-select-control-v2/stories/index.story.d.ts +19 -0
  80. package/build-types/custom-select-control-v2/stories/index.story.d.ts.map +1 -0
  81. package/build-types/custom-select-control-v2/styles.d.ts +47 -0
  82. package/build-types/custom-select-control-v2/styles.d.ts.map +1 -0
  83. package/build-types/custom-select-control-v2/types.d.ts +57 -0
  84. package/build-types/custom-select-control-v2/types.d.ts.map +1 -0
  85. package/build-types/date-time/date/styles.d.ts +4 -1
  86. package/build-types/date-time/date/styles.d.ts.map +1 -1
  87. package/build-types/dropdown-menu-v2-ariakit/index.d.ts +11 -2
  88. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +1 -1
  89. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +1 -1
  90. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts +26 -18
  91. package/build-types/dropdown-menu-v2-ariakit/styles.d.ts.map +1 -1
  92. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +0 -6
  93. package/build-types/dropdown-menu-v2-ariakit/types.d.ts.map +1 -1
  94. package/build-types/form-token-field/index.d.ts.map +1 -1
  95. package/build-types/form-token-field/token-input.d.ts.map +1 -1
  96. package/build-types/form-token-field/types.d.ts +1 -1
  97. package/build-types/form-token-field/types.d.ts.map +1 -1
  98. package/build-types/heading/component.d.ts +4 -1
  99. package/build-types/heading/component.d.ts.map +1 -1
  100. package/build-types/heading/hook.d.ts.map +1 -1
  101. package/build-types/heading/types.d.ts +20 -1
  102. package/build-types/heading/types.d.ts.map +1 -1
  103. package/build-types/navigation/styles/navigation-styles.d.ts +4 -1
  104. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -1
  105. package/build-types/palette-edit/styles.d.ts +4 -1
  106. package/build-types/palette-edit/styles.d.ts.map +1 -1
  107. package/build-types/private-apis.d.ts.map +1 -1
  108. package/build-types/slot-fill/bubbles-virtually/slot.d.ts +1 -1
  109. package/build-types/slot-fill/types.d.ts +16 -6
  110. package/build-types/slot-fill/types.d.ts.map +1 -1
  111. package/build-types/tabs/index.d.ts +1 -0
  112. package/build-types/tabs/index.d.ts.map +1 -1
  113. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  114. package/build-types/text/types.d.ts +15 -2
  115. package/build-types/text/types.d.ts.map +1 -1
  116. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  117. package/package.json +19 -19
  118. package/src/angle-picker-control/index.tsx +0 -1
  119. package/src/box-control/stories/index.story.tsx +82 -0
  120. package/src/button/style.scss +10 -2
  121. package/src/combobox-control/README.md +1 -3
  122. package/src/custom-select-control-v2/README.md +73 -0
  123. package/src/custom-select-control-v2/index.tsx +99 -0
  124. package/src/custom-select-control-v2/stories/index.story.tsx +149 -0
  125. package/src/custom-select-control-v2/styles.ts +76 -0
  126. package/src/custom-select-control-v2/types.ts +63 -0
  127. package/src/dropdown-menu-v2-ariakit/README.md +19 -5
  128. package/src/dropdown-menu-v2-ariakit/index.tsx +85 -36
  129. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +204 -90
  130. package/src/dropdown-menu-v2-ariakit/styles.ts +153 -117
  131. package/src/dropdown-menu-v2-ariakit/test/index.tsx +5 -10
  132. package/src/dropdown-menu-v2-ariakit/types.ts +0 -7
  133. package/src/form-toggle/style.scss +37 -7
  134. package/src/form-token-field/index.tsx +11 -3
  135. package/src/form-token-field/token-input.tsx +1 -3
  136. package/src/form-token-field/types.ts +1 -0
  137. package/src/heading/README.md +6 -1
  138. package/src/heading/hook.ts +6 -3
  139. package/src/heading/types.ts +23 -1
  140. package/src/mobile/utils/alignments.native.js +1 -0
  141. package/src/navigable-container/README.md +1 -1
  142. package/src/private-apis.ts +4 -2
  143. package/src/slot-fill/README.md +1 -1
  144. package/src/slot-fill/types.ts +18 -6
  145. package/src/tabs/index.tsx +12 -2
  146. package/src/tabs/stories/index.story.tsx +8 -0
  147. package/src/tabs/tab.tsx +4 -4
  148. package/src/tabs/tabpanel.tsx +3 -3
  149. package/src/tabs/test/index.tsx +19 -0
  150. package/src/text/README.md +5 -1
  151. package/src/text/types.ts +15 -2
  152. package/src/toggle-control/README.md +2 -2
  153. package/src/tools-panel/tools-panel-item/hook.ts +11 -2
  154. package/tsconfig.tsbuildinfo +1 -1
  155. package/src/box-control/stories/index.story.js +0 -75
@@ -32,11 +32,12 @@ import {
32
32
  import {
33
33
  DropdownMenu as DropdownMenuV2Ariakit,
34
34
  DropdownMenuGroup as DropdownMenuGroupV2Ariakit,
35
- DropdownMenuGroupLabel as DropdownMenuGroupLabelV2Ariakit,
36
35
  DropdownMenuItem as DropdownMenuItemV2Ariakit,
37
36
  DropdownMenuCheckboxItem as DropdownMenuCheckboxItemV2Ariakit,
38
37
  DropdownMenuRadioItem as DropdownMenuRadioItemV2Ariakit,
39
38
  DropdownMenuSeparator as DropdownMenuSeparatorV2Ariakit,
39
+ DropdownMenuItemLabel as DropdownMenuItemLabelV2Ariakit,
40
+ DropdownMenuItemHelpText as DropdownMenuItemHelpTextV2Ariakit,
40
41
  } from './dropdown-menu-v2-ariakit';
41
42
  import { ComponentsContext } from './context/context-system-provider';
42
43
  import Theme from './theme';
@@ -74,9 +75,10 @@ lock( privateApis, {
74
75
  Theme,
75
76
  DropdownMenuV2Ariakit,
76
77
  DropdownMenuGroupV2Ariakit,
77
- DropdownMenuGroupLabelV2Ariakit,
78
78
  DropdownMenuItemV2Ariakit,
79
79
  DropdownMenuCheckboxItemV2Ariakit,
80
80
  DropdownMenuRadioItemV2Ariakit,
81
81
  DropdownMenuSeparatorV2Ariakit,
82
+ DropdownMenuItemLabelV2Ariakit,
83
+ DropdownMenuItemHelpTextV2Ariakit,
82
84
  } );
@@ -68,7 +68,7 @@ Both `Slot` and `Fill` accept a `name` string prop, where a `Slot` with a given
68
68
  - By default, events will bubble to their parents on the DOM hierarchy (native event bubbling)
69
69
  - If `bubblesVirtually` is set to true, events will bubble to their virtual parent in the React elements hierarchy instead.
70
70
 
71
- `Slot` with `bubblesVirtually` set to true also accept an optional `className` to add to the slot container.
71
+ `Slot` with `bubblesVirtually` set to true also accept optional `className` and `style` props to add to the slot container.
72
72
 
73
73
  `Slot` **without** `bubblesVirtually` accepts an optional `children` function prop, which takes `fills` as a param. It allows you to perform additional processing and wrap `fills` conditionally.
74
74
 
@@ -36,15 +36,21 @@ export type SlotComponentProps =
36
36
 
37
37
  /**
38
38
  * A function that returns nodes to be rendered.
39
- * Not supported when `bubblesVirtually` is true.
39
+ * Supported only when `bubblesVirtually` is `false`.
40
40
  */
41
41
  children?: never;
42
42
 
43
43
  /**
44
- * className.
45
- * Not supported when `bubblesVirtually` is true.
44
+ * Additional className for the `Slot` component.
45
+ * Supported only when `bubblesVirtually` is `true`.
46
46
  */
47
47
  className?: string;
48
+
49
+ /**
50
+ * Additional styles for the `Slot` component.
51
+ * Supported only when `bubblesVirtually` is `true`.
52
+ */
53
+ style?: React.CSSProperties;
48
54
  } )
49
55
  | ( SlotPropBase & {
50
56
  /**
@@ -56,15 +62,21 @@ export type SlotComponentProps =
56
62
 
57
63
  /**
58
64
  * A function that returns nodes to be rendered.
59
- * Not supported when `bubblesVirtually` is true.
65
+ * Supported only when `bubblesVirtually` is `false`.
60
66
  */
61
67
  children?: ( fills: ReactNode ) => ReactNode;
62
68
 
63
69
  /**
64
- * className.
65
- * Not supported when `bubblesVirtually` is false.
70
+ * Additional className for the `Slot` component.
71
+ * Supported only when `bubblesVirtually` is `true`.
66
72
  */
67
73
  className?: never;
74
+
75
+ /**
76
+ * Additional styles for the `Slot` component.
77
+ * Supported only when `bubblesVirtually` is `true`.
78
+ */
79
+ style?: never;
68
80
  } );
69
81
 
70
82
  export type FillComponentProps = {
@@ -8,7 +8,7 @@ import * as Ariakit from '@ariakit/react';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { useInstanceId } from '@wordpress/compose';
11
- import { useLayoutEffect, useRef } from '@wordpress/element';
11
+ import { useLayoutEffect, useMemo, useRef } from '@wordpress/element';
12
12
 
13
13
  /**
14
14
  * Internal dependencies
@@ -154,8 +154,16 @@ function Tabs( {
154
154
  setSelectedId,
155
155
  ] );
156
156
 
157
+ const contextValue = useMemo(
158
+ () => ( {
159
+ store,
160
+ instanceId,
161
+ } ),
162
+ [ store, instanceId ]
163
+ );
164
+
157
165
  return (
158
- <TabsContext.Provider value={ { store, instanceId } }>
166
+ <TabsContext.Provider value={ contextValue }>
159
167
  { children }
160
168
  </TabsContext.Provider>
161
169
  );
@@ -164,4 +172,6 @@ function Tabs( {
164
172
  Tabs.TabList = TabList;
165
173
  Tabs.Tab = Tab;
166
174
  Tabs.TabPanel = TabPanel;
175
+ Tabs.Context = TabsContext;
176
+
167
177
  export default Tabs;
@@ -20,6 +20,14 @@ import Button from '../../button';
20
20
  const meta: Meta< typeof Tabs > = {
21
21
  title: 'Components (Experimental)/Tabs',
22
22
  component: Tabs,
23
+ subcomponents: {
24
+ // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
25
+ 'Tabs.TabList': Tabs.TabList,
26
+ // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
27
+ 'Tabs.Tab': Tabs.Tab,
28
+ // @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
29
+ 'Tabs.TabPanel': Tabs.TabPanel,
30
+ },
23
31
  parameters: {
24
32
  actions: { argTypesRegex: '^on.*' },
25
33
  controls: { expanded: true },
package/src/tabs/tab.tsx CHANGED
@@ -2,14 +2,14 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
 
5
- import { useContext, forwardRef } from '@wordpress/element';
5
+ import { forwardRef } from '@wordpress/element';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
9
9
  */
10
10
  import type { TabProps } from './types';
11
11
  import warning from '@wordpress/warning';
12
- import { TabsContext } from './context';
12
+ import { useTabsContext } from './context';
13
13
  import { Tab as StyledTab } from './styles';
14
14
  import type { WordPressComponentProps } from '../context';
15
15
 
@@ -17,9 +17,9 @@ export const Tab = forwardRef<
17
17
  HTMLButtonElement,
18
18
  WordPressComponentProps< TabProps, 'button', false >
19
19
  >( function Tab( { children, id, disabled, render, ...otherProps }, ref ) {
20
- const context = useContext( TabsContext );
20
+ const context = useTabsContext();
21
21
  if ( ! context ) {
22
- warning( '`Tabs.TabList` must be wrapped in a `Tabs` component.' );
22
+ warning( '`Tabs.Tab` must be wrapped in a `Tabs` component.' );
23
23
  return null;
24
24
  }
25
25
  const { store, instanceId } = context;
@@ -6,7 +6,7 @@
6
6
  * WordPress dependencies
7
7
  */
8
8
 
9
- import { forwardRef, useContext } from '@wordpress/element';
9
+ import { forwardRef } from '@wordpress/element';
10
10
 
11
11
  /**
12
12
  * Internal dependencies
@@ -15,14 +15,14 @@ import type { TabPanelProps } from './types';
15
15
  import { TabPanel as StyledTabPanel } from './styles';
16
16
 
17
17
  import warning from '@wordpress/warning';
18
- import { TabsContext } from './context';
18
+ import { useTabsContext } from './context';
19
19
  import type { WordPressComponentProps } from '../context';
20
20
 
21
21
  export const TabPanel = forwardRef<
22
22
  HTMLDivElement,
23
23
  WordPressComponentProps< TabPanelProps, 'div', false >
24
24
  >( function TabPanel( { children, id, focusable = true, ...otherProps }, ref ) {
25
- const context = useContext( TabsContext );
25
+ const context = useTabsContext();
26
26
  if ( ! context ) {
27
27
  warning( '`Tabs.TabPanel` must be wrapped in a `Tabs` component.' );
28
28
  return null;
@@ -524,6 +524,15 @@ describe( 'Tabs', () => {
524
524
  await screen.findByRole( 'tab', { name: 'Alpha' } )
525
525
  ).toHaveFocus();
526
526
 
527
+ // This assertion ensures the component has had time to fully
528
+ // render, preventing flakiness.
529
+ // see https://github.com/WordPress/gutenberg/pull/55950
530
+ await waitFor( () =>
531
+ expect(
532
+ screen.getByRole( 'tab', { name: 'Beta' } )
533
+ ).toHaveAttribute( 'tabindex', '-1' )
534
+ );
535
+
527
536
  // Because all other tabs should have `tabindex=-1`, pressing Tab
528
537
  // should NOT move the focus to the next tab, which is Beta.
529
538
  // Instead, focus should go to the currently selected tabpanel (alpha).
@@ -847,6 +856,16 @@ describe( 'Tabs', () => {
847
856
  // onSelect should not be called since the disabled tab is
848
857
  // highlighted, but not selected.
849
858
  await user.keyboard( '[Tab]' );
859
+
860
+ // This assertion ensures focus has time to move to the first
861
+ // tab before the test proceeds, preventing flakiness.
862
+ // see https://github.com/WordPress/gutenberg/pull/55950
863
+ await waitFor( () =>
864
+ expect(
865
+ screen.getByRole( 'tab', { name: 'Alpha' } )
866
+ ).toHaveFocus()
867
+ );
868
+
850
869
  await user.keyboard( '[ArrowLeft]' );
851
870
  expect( mockOnSelect ).toHaveBeenCalledTimes( 1 );
852
871
 
@@ -132,6 +132,8 @@ function Example() {
132
132
 
133
133
  Sets `Text` to have `display: block`.
134
134
 
135
+ Note: text truncation only works when `isBlock` is `false`.
136
+
135
137
  ### isDestructive
136
138
 
137
139
  **Type**: `boolean`
@@ -196,7 +198,9 @@ function Example() {
196
198
 
197
199
  **Type**: `boolean`
198
200
 
199
- Enables text truncation. When `truncate` is set,we are able to truncate the long text in a variety of ways.
201
+ Enables text truncation. When `truncate` is set, we are able to truncate the long text in a variety of ways.
202
+
203
+ Note: text truncation won't work if the `isBlock` property is set to `true`
200
204
 
201
205
  ```jsx
202
206
  import { __experimentalText as Text } from '@wordpress/components';
package/src/text/types.ts CHANGED
@@ -46,10 +46,14 @@ export interface Props extends TruncateProps {
46
46
  isDestructive?: boolean;
47
47
  /**
48
48
  * Escape characters in `highlightWords` which are meaningful in regular expressions.
49
+ *
50
+ * @default false
49
51
  */
50
52
  highlightEscape?: boolean;
51
53
  /**
52
54
  * Determines if `highlightWords` should be case sensitive.
55
+ *
56
+ * @default false
53
57
  */
54
58
  highlightCaseSensitive?: boolean;
55
59
  /**
@@ -57,7 +61,10 @@ export interface Props extends TruncateProps {
57
61
  */
58
62
  highlightSanitize?: FindAllArgs[ 'sanitize' ];
59
63
  /**
60
- * Sets `Text` to have `display: block`.
64
+ * Sets `Text` to have `display: block`. Note: text truncation only works
65
+ * when `isBlock` is `false`.
66
+ *
67
+ * @default false
61
68
  */
62
69
  isBlock?: boolean;
63
70
  /**
@@ -73,11 +80,15 @@ export interface Props extends TruncateProps {
73
80
  */
74
81
  size?: CSSProperties[ 'fontSize' ] | TextSize;
75
82
  /**
76
- * Enables text truncation. When `truncate` is set,we are able to truncate the long text in a variety of ways.
83
+ * Enables text truncation. When `truncate` is set, we are able to truncate the long text in a variety of ways. Note: text truncation won't work if the `isBlock` property is set to `true`
84
+ *
85
+ * @default false
77
86
  */
78
87
  truncate?: boolean;
79
88
  /**
80
89
  * Uppercases the text content.
90
+ *
91
+ * @default false
81
92
  */
82
93
  upperCase?: boolean;
83
94
  /**
@@ -86,6 +97,8 @@ export interface Props extends TruncateProps {
86
97
  variant?: TextVariant;
87
98
  /**
88
99
  * Adjusts font-weight of the text.
100
+ *
101
+ * @default 'normal'
89
102
  */
90
103
  weight?: CSSProperties[ 'fontWeight' ] | TextWeight;
91
104
  /**
@@ -22,8 +22,8 @@ const MyToggleControl = () => {
22
22
  : 'No fixed background.'
23
23
  }
24
24
  checked={ hasFixedBackground }
25
- onChange={ () => {
26
- setHasFixedBackground( ( state ) => ! state );
25
+ onChange={ (newValue) => {
26
+ setHasFixedBackground( newValue );
27
27
  } }
28
28
  />
29
29
  );
@@ -2,7 +2,12 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { usePrevious } from '@wordpress/compose';
5
- import { useCallback, useEffect, useMemo } from '@wordpress/element';
5
+ import {
6
+ useCallback,
7
+ useEffect,
8
+ useLayoutEffect,
9
+ useMemo,
10
+ } from '@wordpress/element';
6
11
 
7
12
  /**
8
13
  * Internal dependencies
@@ -59,7 +64,11 @@ export function useToolsPanelItem(
59
64
 
60
65
  // Registering the panel item allows the panel to include it in its
61
66
  // automatically generated menu and determine its initial checked status.
62
- useEffect( () => {
67
+ //
68
+ // This is performed in a layout effect to ensure that the panel item
69
+ // is registered before it is rendered preventing a rendering glitch.
70
+ // See: https://github.com/WordPress/gutenberg/issues/56470
71
+ useLayoutEffect( () => {
63
72
  if ( hasMatchingPanel && previousPanelId !== null ) {
64
73
  registerPanelItem( {
65
74
  hasValue: hasValueCallback,