@wordpress/components 25.11.1-next.f8d8eceb.0 → 25.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 (195) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/build/disclosure/index.js +37 -7
  3. package/build/disclosure/index.js.map +1 -1
  4. package/build/disclosure/types.js +6 -0
  5. package/build/disclosure/types.js.map +1 -0
  6. package/build/divider/component.js +5 -3
  7. package/build/divider/component.js.map +1 -1
  8. package/build/divider/types.js.map +1 -1
  9. package/build/dropdown-menu-v2-ariakit/index.js +26 -16
  10. package/build/dropdown-menu-v2-ariakit/index.js.map +1 -1
  11. package/build/dropdown-menu-v2-ariakit/types.js.map +1 -1
  12. package/build/gradient-picker/index.js +1 -1
  13. package/build/gradient-picker/index.js.map +1 -1
  14. package/build/index.native.js +8 -1
  15. package/build/index.native.js.map +1 -1
  16. package/build/mobile/audio-player/index.native.js +8 -9
  17. package/build/mobile/audio-player/index.native.js.map +1 -1
  18. package/build/mobile/global-styles-context/utils.native.js +44 -3
  19. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  20. package/build/radio-group/context.js +22 -0
  21. package/build/radio-group/context.js.map +1 -0
  22. package/build/radio-group/index.js +27 -23
  23. package/build/radio-group/index.js.map +1 -1
  24. package/build/radio-group/radio.js +58 -0
  25. package/build/radio-group/radio.js.map +1 -0
  26. package/build/radio-group/types.js +6 -0
  27. package/build/radio-group/types.js.map +1 -0
  28. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  29. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  30. package/build/tabs/styles.js +14 -7
  31. package/build/tabs/styles.js.map +1 -1
  32. package/build/tabs/tab.js +3 -5
  33. package/build/tabs/tab.js.map +1 -1
  34. package/build/tabs/tablist.js +3 -5
  35. package/build/tabs/tablist.js.map +1 -1
  36. package/build/tabs/tabpanel.js +6 -9
  37. package/build/tabs/tabpanel.js.map +1 -1
  38. package/build/tabs/types.js.map +1 -1
  39. package/build/text-control/index.js +5 -1
  40. package/build/text-control/index.js.map +1 -1
  41. package/build/text-control/types.js.map +1 -1
  42. package/build/toggle-group-control/toggle-group-control/component.js +4 -2
  43. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  44. package/build/toggle-group-control/toggle-group-control/styles.js +13 -9
  45. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  46. package/build/toggle-group-control/types.js.map +1 -1
  47. package/build-module/disclosure/index.js +33 -8
  48. package/build-module/disclosure/index.js.map +1 -1
  49. package/build-module/disclosure/types.js +2 -0
  50. package/build-module/disclosure/types.js.map +1 -0
  51. package/build-module/divider/component.js +3 -3
  52. package/build-module/divider/component.js.map +1 -1
  53. package/build-module/divider/types.js.map +1 -1
  54. package/build-module/dropdown-menu-v2-ariakit/index.js +27 -17
  55. package/build-module/dropdown-menu-v2-ariakit/index.js.map +1 -1
  56. package/build-module/dropdown-menu-v2-ariakit/types.js.map +1 -1
  57. package/build-module/gradient-picker/index.js +1 -1
  58. package/build-module/gradient-picker/index.js.map +1 -1
  59. package/build-module/index.native.js +1 -1
  60. package/build-module/index.native.js.map +1 -1
  61. package/build-module/mobile/audio-player/index.native.js +9 -10
  62. package/build-module/mobile/audio-player/index.native.js.map +1 -1
  63. package/build-module/mobile/global-styles-context/utils.native.js +43 -4
  64. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  65. package/build-module/radio-group/context.js +14 -0
  66. package/build-module/radio-group/context.js.map +1 -0
  67. package/build-module/radio-group/index.js +24 -23
  68. package/build-module/radio-group/index.js.map +1 -1
  69. package/build-module/radio-group/radio.js +46 -0
  70. package/build-module/radio-group/radio.js.map +1 -0
  71. package/build-module/radio-group/types.js +2 -0
  72. package/build-module/radio-group/types.js.map +1 -0
  73. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +1 -1
  74. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  75. package/build-module/tabs/styles.js +11 -5
  76. package/build-module/tabs/styles.js.map +1 -1
  77. package/build-module/tabs/tab.js +3 -5
  78. package/build-module/tabs/tab.js.map +1 -1
  79. package/build-module/tabs/tablist.js +3 -5
  80. package/build-module/tabs/tablist.js.map +1 -1
  81. package/build-module/tabs/tabpanel.js +6 -7
  82. package/build-module/tabs/tabpanel.js.map +1 -1
  83. package/build-module/tabs/types.js.map +1 -1
  84. package/build-module/text-control/index.js +6 -1
  85. package/build-module/text-control/index.js.map +1 -1
  86. package/build-module/text-control/types.js.map +1 -1
  87. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -2
  88. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  89. package/build-module/toggle-group-control/toggle-group-control/styles.js +13 -9
  90. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  91. package/build-module/toggle-group-control/types.js.map +1 -1
  92. package/build-style/style-rtl.css +21 -3
  93. package/build-style/style.css +21 -3
  94. package/build-types/card/card-divider/component.d.ts +1 -1
  95. package/build-types/card/card-divider/hook.d.ts +162 -162
  96. package/build-types/disclosure/index.d.ts +7 -1
  97. package/build-types/disclosure/index.d.ts.map +1 -1
  98. package/build-types/disclosure/types.d.ts +12 -0
  99. package/build-types/disclosure/types.d.ts.map +1 -0
  100. package/build-types/divider/component.d.ts +5 -1
  101. package/build-types/divider/component.d.ts.map +1 -1
  102. package/build-types/divider/stories/index.story.d.ts.map +1 -1
  103. package/build-types/divider/styles.d.ts +1 -1
  104. package/build-types/divider/types.d.ts +2 -2
  105. package/build-types/divider/types.d.ts.map +1 -1
  106. package/build-types/dropdown-menu-v2-ariakit/index.d.ts.map +1 -1
  107. package/build-types/dropdown-menu-v2-ariakit/stories/index.story.d.ts.map +1 -1
  108. package/build-types/dropdown-menu-v2-ariakit/types.d.ts +1 -1
  109. package/build-types/radio-group/context.d.ts +10 -0
  110. package/build-types/radio-group/context.d.ts.map +1 -0
  111. package/build-types/radio-group/index.d.ts +7 -9
  112. package/build-types/radio-group/index.d.ts.map +1 -1
  113. package/build-types/radio-group/radio.d.ts +8 -0
  114. package/build-types/radio-group/radio.d.ts.map +1 -0
  115. package/build-types/radio-group/stories/index.story.d.ts +14 -0
  116. package/build-types/radio-group/stories/index.story.d.ts.map +1 -0
  117. package/build-types/radio-group/types.d.ts +40 -0
  118. package/build-types/radio-group/types.d.ts.map +1 -0
  119. package/build-types/tabs/index.d.ts +3 -3
  120. package/build-types/tabs/stories/index.story.d.ts.map +1 -1
  121. package/build-types/tabs/styles.d.ts +10 -0
  122. package/build-types/tabs/styles.d.ts.map +1 -1
  123. package/build-types/tabs/tab.d.ts +1 -1
  124. package/build-types/tabs/tab.d.ts.map +1 -1
  125. package/build-types/tabs/tablist.d.ts +1 -1
  126. package/build-types/tabs/tablist.d.ts.map +1 -1
  127. package/build-types/tabs/tabpanel.d.ts +4 -1
  128. package/build-types/tabs/tabpanel.d.ts.map +1 -1
  129. package/build-types/tabs/types.d.ts +7 -31
  130. package/build-types/tabs/types.d.ts.map +1 -1
  131. package/build-types/text-control/index.d.ts +2 -1
  132. package/build-types/text-control/index.d.ts.map +1 -1
  133. package/build-types/text-control/types.d.ts +6 -0
  134. package/build-types/text-control/types.d.ts.map +1 -1
  135. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +1 -0
  136. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  137. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +2 -2
  138. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  139. package/build-types/toggle-group-control/types.d.ts +6 -0
  140. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  141. package/package.json +19 -20
  142. package/src/disclosure/index.tsx +44 -0
  143. package/src/disclosure/types.tsx +10 -0
  144. package/src/divider/component.tsx +3 -3
  145. package/src/divider/stories/index.story.tsx +8 -0
  146. package/src/divider/types.ts +2 -2
  147. package/src/dropdown-menu/style.scss +4 -0
  148. package/src/dropdown-menu-v2-ariakit/README.md +0 -7
  149. package/src/dropdown-menu-v2-ariakit/index.tsx +31 -15
  150. package/src/dropdown-menu-v2-ariakit/stories/index.story.tsx +1 -4
  151. package/src/dropdown-menu-v2-ariakit/test/index.tsx +0 -26
  152. package/src/dropdown-menu-v2-ariakit/types.ts +1 -1
  153. package/src/gradient-picker/index.tsx +1 -1
  154. package/src/index.native.js +1 -0
  155. package/src/mobile/audio-player/index.native.js +9 -13
  156. package/src/mobile/global-styles-context/utils.native.js +52 -3
  157. package/src/radio-group/context.tsx +18 -0
  158. package/src/radio-group/index.tsx +65 -0
  159. package/src/radio-group/radio.tsx +55 -0
  160. package/src/radio-group/stories/index.story.tsx +90 -0
  161. package/src/radio-group/types.ts +39 -0
  162. package/src/slot-fill/bubbles-virtually/slot-fill-provider.tsx +1 -1
  163. package/src/tabs/README.md +3 -33
  164. package/src/tabs/stories/index.story.tsx +9 -1
  165. package/src/tabs/styles.ts +16 -0
  166. package/src/tabs/tab.tsx +6 -6
  167. package/src/tabs/tablist.tsx +21 -20
  168. package/src/tabs/tabpanel.tsx +24 -23
  169. package/src/tabs/test/index.tsx +71 -16
  170. package/src/tabs/types.ts +7 -32
  171. package/src/text-control/index.tsx +5 -1
  172. package/src/text-control/style.scss +5 -0
  173. package/src/text-control/types.ts +6 -0
  174. package/src/toggle-group-control/toggle-group-control/component.tsx +8 -2
  175. package/src/toggle-group-control/toggle-group-control/styles.ts +13 -4
  176. package/src/toggle-group-control/types.ts +6 -0
  177. package/src/toolbar/toolbar-button/style.scss +0 -5
  178. package/tsconfig.tsbuildinfo +1 -1
  179. package/build/radio-group/radio/index.js +0 -49
  180. package/build/radio-group/radio/index.js.map +0 -1
  181. package/build/radio-group/radio-context/index.js +0 -18
  182. package/build/radio-group/radio-context/index.js.map +0 -1
  183. package/build-module/radio-group/radio/index.js +0 -40
  184. package/build-module/radio-group/radio/index.js.map +0 -1
  185. package/build-module/radio-group/radio-context/index.js +0 -10
  186. package/build-module/radio-group/radio-context/index.js.map +0 -1
  187. package/build-types/radio-group/radio/index.d.ts +0 -7
  188. package/build-types/radio-group/radio/index.d.ts.map +0 -1
  189. package/build-types/radio-group/radio-context/index.d.ts +0 -6
  190. package/build-types/radio-group/radio-context/index.d.ts.map +0 -1
  191. package/src/disclosure/index.js +0 -11
  192. package/src/radio-group/index.js +0 -51
  193. package/src/radio-group/radio/index.js +0 -40
  194. package/src/radio-group/radio-context/index.js +0 -11
  195. package/src/radio-group/stories/index.story.js +0 -83
@@ -7,7 +7,6 @@ import userEvent from '@testing-library/user-event';
7
7
  /**
8
8
  * WordPress dependencies
9
9
  */
10
- import { wordpress, category, media } from '@wordpress/icons';
11
10
  import { useState } from '@wordpress/element';
12
11
 
13
12
  /**
@@ -15,7 +14,6 @@ import { useState } from '@wordpress/element';
15
14
  */
16
15
  import Tabs from '..';
17
16
  import type { TabsProps } from '../types';
18
- import type { IconType } from '../../icon';
19
17
 
20
18
  type Tab = {
21
19
  id: string;
@@ -23,9 +21,11 @@ type Tab = {
23
21
  content: React.ReactNode;
24
22
  tab: {
25
23
  className?: string;
26
- icon?: IconType;
27
24
  disabled?: boolean;
28
25
  };
26
+ tabpanel?: {
27
+ focusable?: boolean;
28
+ };
29
29
  };
30
30
 
31
31
  const TABS: Tab[] = [
@@ -33,19 +33,19 @@ const TABS: Tab[] = [
33
33
  id: 'alpha',
34
34
  title: 'Alpha',
35
35
  content: 'Selected tab: Alpha',
36
- tab: { className: 'alpha-class', icon: wordpress },
36
+ tab: { className: 'alpha-class' },
37
37
  },
38
38
  {
39
39
  id: 'beta',
40
40
  title: 'Beta',
41
41
  content: 'Selected tab: Beta',
42
- tab: { className: 'beta-class', icon: category },
42
+ tab: { className: 'beta-class' },
43
43
  },
44
44
  {
45
45
  id: 'gamma',
46
46
  title: 'Gamma',
47
47
  content: 'Selected tab: Gamma',
48
- tab: { className: 'gamma-class', icon: media },
48
+ tab: { className: 'gamma-class' },
49
49
  },
50
50
  ];
51
51
 
@@ -55,17 +55,15 @@ const TABS_WITH_DELTA: Tab[] = [
55
55
  id: 'delta',
56
56
  title: 'Delta',
57
57
  content: 'Selected tab: Delta',
58
- tab: { className: 'delta-class', icon: media },
58
+ tab: { className: 'delta-class' },
59
59
  },
60
60
  ];
61
61
 
62
62
  const UncontrolledTabs = ( {
63
63
  tabs,
64
- showTabIcons = false,
65
64
  ...props
66
65
  }: Omit< TabsProps, 'children' > & {
67
66
  tabs: Tab[];
68
- showTabIcons?: boolean;
69
67
  } ) => {
70
68
  return (
71
69
  <Tabs { ...props }>
@@ -76,14 +74,17 @@ const UncontrolledTabs = ( {
76
74
  id={ tabObj.id }
77
75
  className={ tabObj.tab.className }
78
76
  disabled={ tabObj.tab.disabled }
79
- icon={ showTabIcons ? tabObj.tab.icon : undefined }
80
77
  >
81
- { showTabIcons ? null : tabObj.title }
78
+ { tabObj.title }
82
79
  </Tabs.Tab>
83
80
  ) ) }
84
81
  </Tabs.TabList>
85
82
  { tabs.map( ( tabObj ) => (
86
- <Tabs.TabPanel key={ tabObj.id } id={ tabObj.id }>
83
+ <Tabs.TabPanel
84
+ key={ tabObj.id }
85
+ id={ tabObj.id }
86
+ focusable={ tabObj.tabpanel?.focusable }
87
+ >
87
88
  { tabObj.content }
88
89
  </Tabs.TabPanel>
89
90
  ) ) }
@@ -93,11 +94,9 @@ const UncontrolledTabs = ( {
93
94
 
94
95
  const ControlledTabs = ( {
95
96
  tabs,
96
- showTabIcons = false,
97
97
  ...props
98
98
  }: Omit< TabsProps, 'children' > & {
99
99
  tabs: Tab[];
100
- showTabIcons?: boolean;
101
100
  } ) => {
102
101
  const [ selectedTabId, setSelectedTabId ] = useState<
103
102
  string | undefined | null
@@ -119,9 +118,8 @@ const ControlledTabs = ( {
119
118
  id={ tabObj.id }
120
119
  className={ tabObj.tab.className }
121
120
  disabled={ tabObj.tab.disabled }
122
- icon={ showTabIcons ? tabObj.tab.icon : undefined }
123
121
  >
124
- { showTabIcons ? null : tabObj.title }
122
+ { tabObj.title }
125
123
  </Tabs.Tab>
126
124
  ) ) }
127
125
  </Tabs.TabList>
@@ -184,6 +182,63 @@ describe( 'Tabs', () => {
184
182
  );
185
183
  } );
186
184
  } );
185
+ describe( 'Focus Behavior', () => {
186
+ it( 'should focus on the related TabPanel when pressing the Tab key', async () => {
187
+ const user = userEvent.setup();
188
+
189
+ render( <UncontrolledTabs tabs={ TABS } /> );
190
+
191
+ const selectedTabPanel = await screen.findByRole( 'tabpanel' );
192
+
193
+ // Tab should initially focus the first tab in the tablist, which
194
+ // is Alpha.
195
+ await user.keyboard( '[Tab]' );
196
+ expect(
197
+ await screen.findByRole( 'tab', { name: 'Alpha' } )
198
+ ).toHaveFocus();
199
+
200
+ // By default the tabpanel should receive focus
201
+ await user.keyboard( '[Tab]' );
202
+ expect( selectedTabPanel ).toHaveFocus();
203
+ } );
204
+ it( 'should not focus on the related TabPanel when pressing the Tab key if `focusable: false` is set', async () => {
205
+ const user = userEvent.setup();
206
+
207
+ const TABS_WITH_ALPHA_FOCUSABLE_FALSE = TABS.map( ( tabObj ) =>
208
+ tabObj.id === 'alpha'
209
+ ? {
210
+ ...tabObj,
211
+ content: (
212
+ <>
213
+ Selected Tab: Alpha
214
+ <button>Alpha Button</button>
215
+ </>
216
+ ),
217
+ tabpanel: { focusable: false },
218
+ }
219
+ : tabObj
220
+ );
221
+
222
+ render(
223
+ <UncontrolledTabs tabs={ TABS_WITH_ALPHA_FOCUSABLE_FALSE } />
224
+ );
225
+
226
+ const alphaButton = await screen.findByRole( 'button', {
227
+ name: /alpha button/i,
228
+ } );
229
+
230
+ // Tab should initially focus the first tab in the tablist, which
231
+ // is Alpha.
232
+ await user.keyboard( '[Tab]' );
233
+ expect(
234
+ await screen.findByRole( 'tab', { name: 'Alpha' } )
235
+ ).toHaveFocus();
236
+ // Because the alpha tabpanel is set to `focusable: false`, pressing
237
+ // the Tab key should focus the button, not the tabpanel
238
+ await user.keyboard( '[Tab]' );
239
+ expect( alphaButton ).toHaveFocus();
240
+ } );
241
+ } );
187
242
 
188
243
  describe( 'Tab Attributes', () => {
189
244
  it( "should apply the tab's `className` to the tab button", async () => {
package/src/tabs/types.ts CHANGED
@@ -4,11 +4,6 @@
4
4
  // eslint-disable-next-line no-restricted-imports
5
5
  import type * as Ariakit from '@ariakit/react';
6
6
 
7
- /**
8
- * Internal dependencies
9
- */
10
- import type { IconType } from '../icon';
11
-
12
7
  export type TabsContextProps =
13
8
  | {
14
9
  /**
@@ -78,14 +73,6 @@ export type TabListProps = {
78
73
  * The children elements, which should be a series of `Tabs.TabPanel` components.
79
74
  */
80
75
  children?: React.ReactNode;
81
- /**
82
- * The class name to apply to the tablist.
83
- */
84
- className?: string;
85
- /**
86
- * Custom CSS styles for the rendered tablist.
87
- */
88
- style?: React.CSSProperties;
89
76
  };
90
77
 
91
78
  export type TabProps = {
@@ -93,22 +80,10 @@ export type TabProps = {
93
80
  * The id of the tab, which is prepended with the `Tabs` instanceId.
94
81
  */
95
82
  id: string;
96
- /**
97
- * Custom CSS styles for the tab.
98
- */
99
- style?: React.CSSProperties;
100
83
  /**
101
84
  * The children elements, generally the text to display on the tab.
102
85
  */
103
86
  children?: React.ReactNode;
104
- /**
105
- * The class name to apply to the tab button.
106
- */
107
- className?: string;
108
- /**
109
- * The icon used for the tab button.
110
- */
111
- icon?: IconType;
112
87
  /**
113
88
  * Determines if the tab button should be disabled.
114
89
  *
@@ -128,15 +103,15 @@ export type TabPanelProps = {
128
103
  */
129
104
  children?: React.ReactNode;
130
105
  /**
131
- * A unique identifier for the TabPanel, which is used to generate a unique `id` for the underlying element.
106
+ * A unique identifier for the tabpanel, which is used to generate a unique `id` for the underlying element.
132
107
  */
133
108
  id: string;
134
109
  /**
135
- * The class name to apply to the tabpanel.
136
- */
137
- className?: string;
138
- /**
139
- * Custom CSS styles for the rendered `TabPanel` component.
110
+ * Determines whether or not the tabpanel element should be focusable.
111
+ * If `false`, pressing the tab key will skip over the tabpanel, and instead
112
+ * focus on the first focusable element in the panel (if there is one).
113
+ *
114
+ * @default true
140
115
  */
141
- style?: React.CSSProperties;
116
+ focusable?: boolean;
142
117
  };
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import type { ChangeEvent, ForwardedRef } from 'react';
5
+ import classnames from 'classnames';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
@@ -22,6 +23,7 @@ function UnforwardedTextControl(
22
23
  ) {
23
24
  const {
24
25
  __nextHasNoMarginBottom,
26
+ __next40pxDefaultSize = false,
25
27
  label,
26
28
  hideLabelFromVision,
27
29
  value,
@@ -46,7 +48,9 @@ function UnforwardedTextControl(
46
48
  className={ className }
47
49
  >
48
50
  <input
49
- className="components-text-control__input"
51
+ className={ classnames( 'components-text-control__input', {
52
+ 'is-next-40px-default-size': __next40pxDefaultSize,
53
+ } ) }
50
54
  type={ type }
51
55
  id={ id }
52
56
  value={ value }
@@ -13,5 +13,10 @@
13
13
  .components-text-control__input[type="month"],
14
14
  .components-text-control__input[type="number"] {
15
15
  width: 100%;
16
+ height: $grid-unit-40;
16
17
  @include input-control;
18
+
19
+ &.is-next-40px-default-size {
20
+ height: $grid-unit-50;
21
+ }
17
22
  }
@@ -25,4 +25,10 @@ export type TextControlProps = Pick<
25
25
  * @default 'text'
26
26
  */
27
27
  type?: 'email' | 'number' | 'password' | 'tel' | 'text' | 'search' | 'url';
28
+ /**
29
+ * Start opting into the larger default height that will become the default size in a future version.
30
+ *
31
+ * @default false
32
+ */
33
+ __next40pxDefaultSize?: boolean;
28
34
  };
@@ -31,6 +31,7 @@ function UnconnectedToggleGroupControl(
31
31
  ) {
32
32
  const {
33
33
  __nextHasNoMarginBottom = false,
34
+ __next40pxDefaultSize = false,
34
35
  className,
35
36
  isAdaptiveWidth = false,
36
37
  isBlock = false,
@@ -52,11 +53,16 @@ function UnconnectedToggleGroupControl(
52
53
  const classes = useMemo(
53
54
  () =>
54
55
  cx(
55
- styles.toggleGroupControl( { isBlock, isDeselectable, size } ),
56
+ styles.toggleGroupControl( {
57
+ isBlock,
58
+ isDeselectable,
59
+ size,
60
+ __next40pxDefaultSize,
61
+ } ),
56
62
  isBlock && styles.block,
57
63
  className
58
64
  ),
59
- [ className, cx, isBlock, isDeselectable, size ]
65
+ [ className, cx, isBlock, isDeselectable, size, __next40pxDefaultSize ]
60
66
  );
61
67
 
62
68
  const MainControl = isDeselectable
@@ -14,7 +14,11 @@ export const toggleGroupControl = ( {
14
14
  isBlock,
15
15
  isDeselectable,
16
16
  size,
17
- }: Pick< ToggleGroupControlProps, 'isBlock' | 'isDeselectable' > & {
17
+ __next40pxDefaultSize,
18
+ }: Pick<
19
+ ToggleGroupControlProps,
20
+ 'isBlock' | 'isDeselectable' | '__next40pxDefaultSize'
21
+ > & {
18
22
  size: NonNullable< ToggleGroupControlProps[ 'size' ] >;
19
23
  } ) => css`
20
24
  background: ${ COLORS.ui.background };
@@ -25,7 +29,7 @@ export const toggleGroupControl = ( {
25
29
  padding: 2px;
26
30
  position: relative;
27
31
 
28
- ${ toggleGroupControlSize( size ) }
32
+ ${ toggleGroupControlSize( size, __next40pxDefaultSize ) }
29
33
  ${ ! isDeselectable && enclosingBorders( isBlock ) }
30
34
  `;
31
35
 
@@ -53,13 +57,18 @@ const enclosingBorders = ( isBlock: ToggleGroupControlProps[ 'isBlock' ] ) => {
53
57
  };
54
58
 
55
59
  export const toggleGroupControlSize = (
56
- size: NonNullable< ToggleGroupControlProps[ 'size' ] >
60
+ size: NonNullable< ToggleGroupControlProps[ 'size' ] >,
61
+ __next40pxDefaultSize: ToggleGroupControlProps[ '__next40pxDefaultSize' ]
57
62
  ) => {
58
63
  const heights = {
59
- default: '36px',
64
+ default: '40px',
60
65
  '__unstable-large': '40px',
61
66
  };
62
67
 
68
+ if ( ! __next40pxDefaultSize ) {
69
+ heights.default = '36px';
70
+ }
71
+
63
72
  return css`
64
73
  min-height: ${ heights[ size ] };
65
74
  `;
@@ -122,6 +122,12 @@ export type ToggleGroupControlProps = Pick<
122
122
  * @default 'default'
123
123
  */
124
124
  size?: 'default' | '__unstable-large';
125
+ /**
126
+ * Start opting into the larger default height that will become the default size in a future version.
127
+ *
128
+ * @default false
129
+ */
130
+ __next40pxDefaultSize?: boolean;
125
131
  };
126
132
 
127
133
  export type ToggleGroupControlContextProps = {
@@ -17,11 +17,6 @@
17
17
  bottom: 10px;
18
18
  }
19
19
 
20
- // Hide focus rectangle on click.
21
- &:active::before {
22
- display: none;
23
- }
24
-
25
20
  &:not(:disabled).is-pressed[data-subscript]::after {
26
21
  color: $white;
27
22
  }