@wordpress/components 23.9.0 → 24.0.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 (279) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/CONTRIBUTING.md +65 -1
  3. package/README.md +1 -3
  4. package/build/autocomplete/autocompleter-ui.js +0 -2
  5. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  6. package/build/autocomplete/index.js +2 -0
  7. package/build/autocomplete/index.js.map +1 -1
  8. package/build/button/index.js +2 -0
  9. package/build/button/index.js.map +1 -1
  10. package/build/card/card-media/component.js +2 -1
  11. package/build/card/card-media/component.js.map +1 -1
  12. package/build/combobox-control/index.js +7 -5
  13. package/build/combobox-control/index.js.map +1 -1
  14. package/build/combobox-control/styles.js +3 -3
  15. package/build/combobox-control/styles.js.map +1 -1
  16. package/build/dimension-control/index.js +1 -1
  17. package/build/dimension-control/index.js.map +1 -1
  18. package/build/draggable/index.js +2 -7
  19. package/build/draggable/index.js.map +1 -1
  20. package/build/form-token-field/index.js +5 -3
  21. package/build/form-token-field/index.js.map +1 -1
  22. package/build/form-token-field/styles.js +3 -3
  23. package/build/form-token-field/styles.js.map +1 -1
  24. package/build/mobile/global-styles-context/index.native.js +13 -1
  25. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  26. package/build/mobile/link-picker/link-picker-results.native.js +3 -1
  27. package/build/mobile/link-picker/link-picker-results.native.js.map +1 -1
  28. package/build/modal/index.js +2 -1
  29. package/build/modal/index.js.map +1 -1
  30. package/build/navigable-container/container.js +39 -19
  31. package/build/navigable-container/container.js.map +1 -1
  32. package/build/navigable-container/index.js.map +1 -1
  33. package/build/navigable-container/menu.js +37 -5
  34. package/build/navigable-container/menu.js.map +1 -1
  35. package/build/navigable-container/tabbable.js +45 -4
  36. package/build/navigable-container/tabbable.js.map +1 -1
  37. package/build/navigable-container/types.js +6 -0
  38. package/build/navigable-container/types.js.map +1 -0
  39. package/build/palette-edit/index.js +34 -12
  40. package/build/palette-edit/index.js.map +1 -1
  41. package/build/sandbox/index.native.js +6 -2
  42. package/build/sandbox/index.native.js.map +1 -1
  43. package/build/slot-fill/bubbles-virtually/fill.js +2 -1
  44. package/build/slot-fill/bubbles-virtually/fill.js.map +1 -1
  45. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js +45 -35
  46. package/build/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  47. package/build/slot-fill/bubbles-virtually/use-slot.js +11 -26
  48. package/build/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  49. package/build/slot-fill/fill.js +7 -31
  50. package/build/slot-fill/fill.js.map +1 -1
  51. package/build/slot-fill/index.js.map +1 -1
  52. package/build/slot-fill/provider.js +0 -6
  53. package/build/slot-fill/provider.js.map +1 -1
  54. package/build/slot-fill/slot.js +0 -5
  55. package/build/slot-fill/slot.js.map +1 -1
  56. package/build/tab-panel/index.js.map +1 -1
  57. package/build/theme/color-algorithms.js +1 -1
  58. package/build/theme/color-algorithms.js.map +1 -1
  59. package/build/toolbar/toolbar-button/index.js +1 -2
  60. package/build/toolbar/toolbar-button/index.js.map +1 -1
  61. package/build/toolbar/toolbar-item/index.js +4 -2
  62. package/build/toolbar/toolbar-item/index.js.map +1 -1
  63. package/build/utils/colors-values.js +3 -3
  64. package/build/utils/colors-values.js.map +1 -1
  65. package/build/utils/use-deprecated-props.js +35 -0
  66. package/build/utils/use-deprecated-props.js.map +1 -0
  67. package/build-module/autocomplete/autocompleter-ui.js +1 -3
  68. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  69. package/build-module/autocomplete/index.js +3 -3
  70. package/build-module/autocomplete/index.js.map +1 -1
  71. package/build-module/button/index.js +2 -0
  72. package/build-module/button/index.js.map +1 -1
  73. package/build-module/card/card-media/component.js +2 -1
  74. package/build-module/card/card-media/component.js.map +1 -1
  75. package/build-module/combobox-control/index.js +6 -5
  76. package/build-module/combobox-control/index.js.map +1 -1
  77. package/build-module/combobox-control/styles.js +3 -3
  78. package/build-module/combobox-control/styles.js.map +1 -1
  79. package/build-module/dimension-control/index.js +1 -1
  80. package/build-module/dimension-control/index.js.map +1 -1
  81. package/build-module/draggable/index.js +2 -7
  82. package/build-module/draggable/index.js.map +1 -1
  83. package/build-module/form-token-field/index.js +4 -3
  84. package/build-module/form-token-field/index.js.map +1 -1
  85. package/build-module/form-token-field/styles.js +3 -3
  86. package/build-module/form-token-field/styles.js.map +1 -1
  87. package/build-module/mobile/global-styles-context/index.native.js +13 -1
  88. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  89. package/build-module/mobile/link-picker/link-picker-results.native.js +3 -1
  90. package/build-module/mobile/link-picker/link-picker-results.native.js.map +1 -1
  91. package/build-module/modal/index.js +2 -1
  92. package/build-module/modal/index.js.map +1 -1
  93. package/build-module/navigable-container/container.js +43 -19
  94. package/build-module/navigable-container/container.js.map +1 -1
  95. package/build-module/navigable-container/index.js +0 -2
  96. package/build-module/navigable-container/index.js.map +1 -1
  97. package/build-module/navigable-container/menu.js +36 -4
  98. package/build-module/navigable-container/menu.js.map +1 -1
  99. package/build-module/navigable-container/tabbable.js +44 -3
  100. package/build-module/navigable-container/tabbable.js.map +1 -1
  101. package/build-module/navigable-container/types.js +2 -0
  102. package/build-module/navigable-container/types.js.map +1 -0
  103. package/build-module/palette-edit/index.js +34 -13
  104. package/build-module/palette-edit/index.js.map +1 -1
  105. package/build-module/sandbox/index.native.js +6 -2
  106. package/build-module/sandbox/index.native.js.map +1 -1
  107. package/build-module/slot-fill/bubbles-virtually/fill.js +2 -1
  108. package/build-module/slot-fill/bubbles-virtually/fill.js.map +1 -1
  109. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -36
  110. package/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js.map +1 -1
  111. package/build-module/slot-fill/bubbles-virtually/use-slot.js +12 -27
  112. package/build-module/slot-fill/bubbles-virtually/use-slot.js.map +1 -1
  113. package/build-module/slot-fill/fill.js +7 -31
  114. package/build-module/slot-fill/fill.js.map +1 -1
  115. package/build-module/slot-fill/index.js +1 -2
  116. package/build-module/slot-fill/index.js.map +1 -1
  117. package/build-module/slot-fill/provider.js +0 -6
  118. package/build-module/slot-fill/provider.js.map +1 -1
  119. package/build-module/slot-fill/slot.js +0 -5
  120. package/build-module/slot-fill/slot.js.map +1 -1
  121. package/build-module/tab-panel/index.js.map +1 -1
  122. package/build-module/theme/color-algorithms.js +1 -1
  123. package/build-module/theme/color-algorithms.js.map +1 -1
  124. package/build-module/toolbar/toolbar-button/index.js +1 -2
  125. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  126. package/build-module/toolbar/toolbar-item/index.js +5 -2
  127. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  128. package/build-module/utils/colors-values.js +3 -3
  129. package/build-module/utils/colors-values.js.map +1 -1
  130. package/build-module/utils/use-deprecated-props.js +25 -0
  131. package/build-module/utils/use-deprecated-props.js.map +1 -0
  132. package/build-style/style-rtl.css +58 -55
  133. package/build-style/style.css +58 -55
  134. package/build-types/autocomplete/autocompleter-ui.d.ts.map +1 -1
  135. package/build-types/autocomplete/index.d.ts.map +1 -1
  136. package/build-types/autocomplete/types.d.ts +2 -18
  137. package/build-types/autocomplete/types.d.ts.map +1 -1
  138. package/build-types/button/deprecated.d.ts +6 -0
  139. package/build-types/button/deprecated.d.ts.map +1 -1
  140. package/build-types/button/index.d.ts.map +1 -1
  141. package/build-types/button/types.d.ts +7 -0
  142. package/build-types/button/types.d.ts.map +1 -1
  143. package/build-types/card/card-media/component.d.ts +2 -1
  144. package/build-types/card/card-media/component.d.ts.map +1 -1
  145. package/build-types/card/stories/index.d.ts +21 -1
  146. package/build-types/card/stories/index.d.ts.map +1 -1
  147. package/build-types/combobox-control/index.d.ts +1 -1
  148. package/build-types/combobox-control/index.d.ts.map +1 -1
  149. package/build-types/combobox-control/stories/index.d.ts.map +1 -1
  150. package/build-types/combobox-control/styles.d.ts +1 -1
  151. package/build-types/combobox-control/types.d.ts +8 -1
  152. package/build-types/combobox-control/types.d.ts.map +1 -1
  153. package/build-types/dimension-control/index.d.ts +1 -1
  154. package/build-types/draggable/index.d.ts.map +1 -1
  155. package/build-types/form-token-field/index.d.ts.map +1 -1
  156. package/build-types/form-token-field/styles.d.ts +1 -1
  157. package/build-types/form-token-field/types.d.ts +8 -1
  158. package/build-types/form-token-field/types.d.ts.map +1 -1
  159. package/build-types/modal/index.d.ts.map +1 -1
  160. package/build-types/navigable-container/container.d.ts +20 -1
  161. package/build-types/navigable-container/container.d.ts.map +1 -1
  162. package/build-types/navigable-container/index.d.ts +5 -2
  163. package/build-types/navigable-container/index.d.ts.map +1 -1
  164. package/build-types/navigable-container/menu.d.ts +45 -11
  165. package/build-types/navigable-container/menu.d.ts.map +1 -1
  166. package/build-types/navigable-container/stories/navigable-menu.d.ts +12 -0
  167. package/build-types/navigable-container/stories/navigable-menu.d.ts.map +1 -0
  168. package/build-types/navigable-container/stories/tabbable-container.d.ts +12 -0
  169. package/build-types/navigable-container/stories/tabbable-container.d.ts.map +1 -0
  170. package/build-types/navigable-container/tabbable.d.ts +52 -9
  171. package/build-types/navigable-container/tabbable.d.ts.map +1 -1
  172. package/build-types/navigable-container/test/navigable-menu.d.ts +2 -0
  173. package/build-types/navigable-container/test/navigable-menu.d.ts.map +1 -0
  174. package/build-types/navigable-container/test/tababble-container.d.ts +2 -0
  175. package/build-types/navigable-container/test/tababble-container.d.ts.map +1 -0
  176. package/build-types/navigable-container/types.d.ts +61 -0
  177. package/build-types/navigable-container/types.d.ts.map +1 -0
  178. package/build-types/navigator/navigator-back-button/component.d.ts +1 -0
  179. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  180. package/build-types/navigator/navigator-back-button/hook.d.ts +1 -0
  181. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  182. package/build-types/navigator/navigator-button/component.d.ts +1 -0
  183. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  184. package/build-types/navigator/navigator-button/hook.d.ts +1 -0
  185. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  186. package/build-types/navigator/navigator-to-parent-button/component.d.ts +1 -0
  187. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  188. package/build-types/palette-edit/index.d.ts +1 -1
  189. package/build-types/palette-edit/index.d.ts.map +1 -1
  190. package/build-types/palette-edit/stories/index.d.ts.map +1 -1
  191. package/build-types/palette-edit/types.d.ts +8 -0
  192. package/build-types/palette-edit/types.d.ts.map +1 -1
  193. package/build-types/slot-fill/bubbles-virtually/fill.d.ts.map +1 -1
  194. package/build-types/slot-fill/bubbles-virtually/slot-fill-provider.d.ts.map +1 -1
  195. package/build-types/slot-fill/bubbles-virtually/use-slot.d.ts.map +1 -1
  196. package/build-types/slot-fill/fill.d.ts +4 -2
  197. package/build-types/slot-fill/fill.d.ts.map +1 -1
  198. package/build-types/slot-fill/index.d.ts +1 -2
  199. package/build-types/slot-fill/index.d.ts.map +1 -1
  200. package/build-types/slot-fill/provider.d.ts +0 -2
  201. package/build-types/slot-fill/provider.d.ts.map +1 -1
  202. package/build-types/slot-fill/slot.d.ts.map +1 -1
  203. package/build-types/toolbar/stories/index.d.ts.map +1 -1
  204. package/build-types/toolbar/toolbar-button/index.d.ts +6 -0
  205. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -1
  206. package/build-types/toolbar/toolbar-item/index.d.ts +6 -4
  207. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -1
  208. package/build-types/tree-grid/types.d.ts +7 -0
  209. package/build-types/tree-grid/types.d.ts.map +1 -1
  210. package/build-types/utils/use-deprecated-props.d.ts +9 -0
  211. package/build-types/utils/use-deprecated-props.d.ts.map +1 -0
  212. package/package.json +19 -19
  213. package/src/autocomplete/README.md +78 -52
  214. package/src/autocomplete/autocompleter-ui.tsx +0 -2
  215. package/src/autocomplete/index.tsx +1 -2
  216. package/src/autocomplete/types.ts +3 -19
  217. package/src/button/index.tsx +2 -0
  218. package/src/button/style.scss +13 -6
  219. package/src/button/types.ts +7 -0
  220. package/src/card/card-media/README.md +1 -1
  221. package/src/card/card-media/component.tsx +2 -1
  222. package/src/card/stories/index.tsx +47 -26
  223. package/src/checkbox-control/style.scss +1 -4
  224. package/src/combobox-control/index.tsx +24 -18
  225. package/src/combobox-control/stories/index.tsx +0 -1
  226. package/src/combobox-control/styles.ts +4 -4
  227. package/src/combobox-control/types.ts +8 -1
  228. package/src/custom-gradient-picker/style.scss +2 -2
  229. package/src/dimension-control/index.tsx +1 -1
  230. package/src/draggable/index.tsx +1 -9
  231. package/src/form-toggle/style.scss +1 -5
  232. package/src/form-token-field/index.tsx +7 -3
  233. package/src/form-token-field/styles.ts +4 -4
  234. package/src/form-token-field/types.ts +8 -1
  235. package/src/mobile/global-styles-context/index.native.js +12 -1
  236. package/src/mobile/link-picker/link-picker-results.native.js +3 -0
  237. package/src/modal/index.tsx +6 -1
  238. package/src/modal/style.scss +1 -1
  239. package/src/navigable-container/README.md +24 -13
  240. package/src/navigable-container/{container.js → container.tsx} +57 -27
  241. package/src/navigable-container/{index.js → index.tsx} +0 -1
  242. package/src/navigable-container/menu.tsx +100 -0
  243. package/src/navigable-container/stories/{navigable-menu.js → navigable-menu.tsx} +15 -10
  244. package/src/navigable-container/stories/{tabbable-container.js → tabbable-container.tsx} +15 -6
  245. package/src/navigable-container/tabbable.tsx +92 -0
  246. package/src/navigable-container/test/{navigable-menu.js → navigable-menu.tsx} +3 -1
  247. package/src/navigable-container/test/{tababble-container.js → tababble-container.tsx} +53 -24
  248. package/src/navigable-container/types.ts +76 -0
  249. package/src/palette-edit/index.tsx +45 -7
  250. package/src/palette-edit/stories/index.tsx +4 -0
  251. package/src/palette-edit/types.ts +11 -0
  252. package/src/sandbox/index.native.js +4 -0
  253. package/src/slot-fill/bubbles-virtually/fill.js +2 -1
  254. package/src/slot-fill/bubbles-virtually/slot-fill-provider.js +46 -60
  255. package/src/slot-fill/bubbles-virtually/use-slot.js +14 -41
  256. package/src/slot-fill/fill.js +4 -26
  257. package/src/slot-fill/index.js +1 -3
  258. package/src/slot-fill/provider.js +0 -6
  259. package/src/slot-fill/slot.js +0 -5
  260. package/src/style.scss +6 -0
  261. package/src/tab-panel/index.tsx +1 -1
  262. package/src/theme/color-algorithms.ts +1 -1
  263. package/src/theme/stories/index.tsx +1 -1
  264. package/src/theme/test/color-algorithms.ts +2 -2
  265. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +4 -4
  266. package/src/toolbar/stories/index.tsx +26 -24
  267. package/src/toolbar/toolbar-button/index.tsx +10 -13
  268. package/src/toolbar/toolbar-item/{index.js → index.tsx} +12 -3
  269. package/src/tree-grid/README.md +18 -0
  270. package/src/tree-grid/types.ts +7 -0
  271. package/src/utils/colors-values.js +3 -3
  272. package/src/utils/theme-variables.scss +4 -4
  273. package/src/utils/use-deprecated-props.ts +29 -0
  274. package/tsconfig.json +1 -0
  275. package/tsconfig.tsbuildinfo +1 -1
  276. package/src/CONTRIBUTING.md +0 -78
  277. package/src/README.md +0 -20
  278. package/src/navigable-container/menu.js +0 -62
  279. package/src/navigable-container/tabbable.js +0 -46
@@ -41,31 +41,52 @@ const meta: ComponentMeta< typeof Card > = {
41
41
  export default meta;
42
42
 
43
43
  const Template: ComponentStory< typeof Card > = ( args ) => (
44
- <Card { ...args }>
45
- <CardHeader>
46
- <Heading>CardHeader</Heading>
47
- </CardHeader>
48
- <CardBody>
49
- <Text>CardBody</Text>
50
- </CardBody>
51
- <CardBody>
52
- <Text>CardBody (before CardDivider)</Text>
53
- </CardBody>
54
- <CardDivider />
55
- <CardBody>
56
- <Text>CardBody (after CardDivider)</Text>
57
- </CardBody>
58
- <CardMedia>
59
- <img
60
- alt="Card Media"
61
- src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
62
- />
63
- </CardMedia>
64
- <CardFooter>
65
- <Text>CardFooter</Text>
66
- <Button variant="secondary">Action Button</Button>
67
- </CardFooter>
68
- </Card>
44
+ <Card { ...args } />
69
45
  );
70
46
 
71
- export const Default: ComponentStory< typeof Card > = Template.bind( {} );
47
+ export const Default = Template.bind( {} );
48
+ Default.args = {
49
+ children: (
50
+ <>
51
+ <CardHeader>
52
+ <Heading>CardHeader</Heading>
53
+ </CardHeader>
54
+ <CardBody>
55
+ <Text>CardBody</Text>
56
+ </CardBody>
57
+ <CardBody>
58
+ <Text>CardBody (before CardDivider)</Text>
59
+ </CardBody>
60
+ <CardDivider />
61
+ <CardBody>
62
+ <Text>CardBody (after CardDivider)</Text>
63
+ </CardBody>
64
+ <CardMedia>
65
+ <img
66
+ alt="Card Media"
67
+ src="https://images.unsplash.com/photo-1566125882500-87e10f726cdc?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1867&q=80"
68
+ />
69
+ </CardMedia>
70
+ <CardFooter>
71
+ <Text>CardFooter</Text>
72
+ <Button variant="secondary">Action Button</Button>
73
+ </CardFooter>
74
+ </>
75
+ ),
76
+ };
77
+
78
+ /**
79
+ * `CardMedia` provides a container for full-bleed content within a `Card`,
80
+ * such as images, video, or even just a background color. The corners will be rounded if necessary.
81
+ */
82
+ export const FullBleedContent = Template.bind( {} );
83
+ FullBleedContent.args = {
84
+ ...Default.args,
85
+ children: (
86
+ <CardMedia>
87
+ <div style={ { padding: 16, background: 'beige' } }>
88
+ Some full bleed content
89
+ </div>
90
+ </CardMedia>
91
+ ),
92
+ };
@@ -27,10 +27,7 @@ $checkbox-input-size-sm: 24px; // Width & height for small viewports.
27
27
  @include reduce-motion("transition");
28
28
 
29
29
  &:focus {
30
- box-shadow: 0 0 0 ($border-width * 2) $white, 0 0 0 ($border-width * 2 + $border-width-focus) $components-color-accent;
31
-
32
- // Only visible in Windows High Contrast mode.
33
- outline: 2px solid transparent;
30
+ @include button-style-outset__focus(var(--wp-admin-theme-color));
34
31
  }
35
32
 
36
33
  &:checked,
@@ -32,6 +32,7 @@ import { useControlledValue } from '../utils/hooks';
32
32
  import { normalizeTextString } from '../utils/strings';
33
33
  import type { ComboboxControlOption, ComboboxControlProps } from './types';
34
34
  import type { TokenInputProps } from '../form-token-field/types';
35
+ import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
35
36
 
36
37
  const noop = () => {};
37
38
 
@@ -104,23 +105,28 @@ const getIndexOfMatchingSuggestion = (
104
105
  * }
105
106
  * ```
106
107
  */
107
- function ComboboxControl( {
108
- __nextHasNoMarginBottom = false,
109
- __next36pxDefaultSize = false,
110
- value: valueProp,
111
- label,
112
- options,
113
- onChange: onChangeProp,
114
- onFilterValueChange = noop,
115
- hideLabelFromVision,
116
- help,
117
- allowReset = true,
118
- className,
119
- messages = {
120
- selected: __( 'Item selected.' ),
121
- },
122
- __experimentalRenderItem,
123
- }: ComboboxControlProps ) {
108
+ function ComboboxControl( props: ComboboxControlProps ) {
109
+ const {
110
+ __nextHasNoMarginBottom = false,
111
+ __next40pxDefaultSize = false,
112
+ value: valueProp,
113
+ label,
114
+ options,
115
+ onChange: onChangeProp,
116
+ onFilterValueChange = noop,
117
+ hideLabelFromVision,
118
+ help,
119
+ allowReset = true,
120
+ className,
121
+ messages = {
122
+ selected: __( 'Item selected.' ),
123
+ },
124
+ __experimentalRenderItem,
125
+ } = useDeprecated36pxDefaultSizeProp< ComboboxControlProps >(
126
+ props,
127
+ 'wp.components.ComboboxControl'
128
+ );
129
+
124
130
  const [ value, setValue ] = useControlledValue( {
125
131
  value: valueProp,
126
132
  onChange: onChangeProp,
@@ -314,7 +320,7 @@ function ComboboxControl( {
314
320
  onKeyDown={ onKeyDown }
315
321
  >
316
322
  <InputWrapperFlex
317
- __next36pxDefaultSize={ __next36pxDefaultSize }
323
+ __next40pxDefaultSize={ __next40pxDefaultSize }
318
324
  >
319
325
  <FlexBlock>
320
326
  <TokenInput
@@ -65,7 +65,6 @@ const Template: ComponentStory< typeof ComboboxControl > = ( {
65
65
  };
66
66
  export const Default = Template.bind( {} );
67
67
  Default.args = {
68
- __next36pxDefaultSize: false,
69
68
  allowReset: false,
70
69
  label: 'Select a country',
71
70
  options: countryOptions,
@@ -12,9 +12,9 @@ import { space } from '../ui/utils/space';
12
12
  import type { ComboboxControlProps } from './types';
13
13
 
14
14
  const deprecatedDefaultSize = ( {
15
- __next36pxDefaultSize,
16
- }: Pick< ComboboxControlProps, '__next36pxDefaultSize' > ) =>
17
- ! __next36pxDefaultSize &&
15
+ __next40pxDefaultSize,
16
+ }: Pick< ComboboxControlProps, '__next40pxDefaultSize' > ) =>
17
+ ! __next40pxDefaultSize &&
18
18
  css`
19
19
  height: 28px; // 30px - 2px vertical borders on parent container
20
20
  padding-left: ${ space( 1 ) };
@@ -22,7 +22,7 @@ const deprecatedDefaultSize = ( {
22
22
  `;
23
23
 
24
24
  export const InputWrapperFlex = styled( Flex )`
25
- height: 34px; // 36px - 2px vertical borders on parent container
25
+ height: 38px; // 40px - 2px vertical borders on parent container
26
26
  padding-left: ${ space( 2 ) };
27
27
  padding-right: ${ space( 2 ) };
28
28
 
@@ -26,11 +26,18 @@ export type ComboboxControlProps = Pick<
26
26
  item: ComboboxControlOption;
27
27
  } ) => React.ReactNode;
28
28
  /**
29
- * Start opting into the larger default height that will become the default size in a future version.
29
+ * Deprecated. Use `__next40pxDefaultSize` instead.
30
30
  *
31
31
  * @default false
32
+ * @deprecated
32
33
  */
33
34
  __next36pxDefaultSize?: boolean;
35
+ /**
36
+ * Start opting into the larger default height that will become the default size in a future version.
37
+ *
38
+ * @default false
39
+ */
40
+ __next40pxDefaultSize?: boolean;
34
41
  /**
35
42
  * Show a reset button to clear the input.
36
43
  *
@@ -76,14 +76,14 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
76
76
  padding: 0;
77
77
 
78
78
  // Shadow and stroke.
79
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
79
+ box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
80
80
 
81
81
  // Windows High Contrast mode will show this outline, but not the box-shadow.
82
82
  outline: 2px solid transparent;
83
83
 
84
84
  &:focus,
85
85
  &.is-active {
86
- box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus 0 rgba($black, 0.25);
86
+ box-shadow: inset 0 0 0 calc(var(--wp-admin-border-width-focus) * 2) $white, 0 0 $border-width-focus-fallback 0 rgba($black, 0.25);
87
87
 
88
88
  // Windows High Contrast mode will show this outline, but not the box-shadow.
89
89
  outline: $border-width-tab solid transparent;
@@ -23,8 +23,8 @@ import type { SelectControlSingleSelectionProps } from '../select-control/types'
23
23
  * This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
24
24
  *
25
25
  * ```jsx
26
- * import { useState } from 'react';
27
26
  * import { __experimentalDimensionControl as DimensionControl } from '@wordpress/components';
27
+ * import { useState } from '@wordpress/element';
28
28
  *
29
29
  * export default function MyCustomDimensionControl() {
30
30
  * const [ paddingSize, setPaddingSize ] = useState( '' );
@@ -212,14 +212,8 @@ export function Draggable( {
212
212
  // Update cursor to 'grabbing', document wide.
213
213
  ownerDocument.body.classList.add( bodyClass );
214
214
 
215
- // Allow the Synthetic Event to be accessed from asynchronous code.
216
- // https://reactjs.org/docs/events.html#event-pooling
217
- event.persist();
218
-
219
- let timerId: number | undefined;
220
-
221
215
  if ( onDragStart ) {
222
- timerId = setTimeout( () => onDragStart( event ) );
216
+ onDragStart( event );
223
217
  }
224
218
 
225
219
  cleanup.current = () => {
@@ -236,8 +230,6 @@ export function Draggable( {
236
230
  ownerDocument.body.classList.remove( bodyClass );
237
231
 
238
232
  ownerDocument.removeEventListener( 'dragover', throttledDragOver );
239
-
240
- clearTimeout( timerId );
241
233
  };
242
234
  }
243
235
 
@@ -44,11 +44,7 @@ $toggle-border-width: 1px;
44
44
  }
45
45
 
46
46
  .components-form-toggle__input:focus + .components-form-toggle__track {
47
- box-shadow: 0 0 0 2px $white, 0 0 0 (2px + $border-width-focus) $components-color-accent;
48
-
49
- // Windows High Contrast mode will show this outline, but not the box-shadow.
50
- outline: 2px solid transparent;
51
- outline-offset: 2px;
47
+ @include button-style-outset__focus($components-color-accent);
52
48
  }
53
49
 
54
50
  &.is-checked {
@@ -27,6 +27,7 @@ import {
27
27
  StyledLabel,
28
28
  } from '../base-control/styles/base-control-styles';
29
29
  import { Spacer } from '../spacer';
30
+ import { useDeprecated36pxDefaultSizeProp } from '../utils/use-deprecated-props';
30
31
 
31
32
  const identity = ( value: string ) => value;
32
33
 
@@ -69,10 +70,13 @@ export function FormTokenField( props: FormTokenFieldProps ) {
69
70
  __experimentalExpandOnFocus = false,
70
71
  __experimentalValidateInput = () => true,
71
72
  __experimentalShowHowTo = true,
72
- __next36pxDefaultSize = false,
73
+ __next40pxDefaultSize = false,
73
74
  __experimentalAutoSelectFirstMatch = false,
74
75
  __nextHasNoMarginBottom = false,
75
- } = props;
76
+ } = useDeprecated36pxDefaultSizeProp< FormTokenFieldProps >(
77
+ props,
78
+ 'wp.components.FormTokenField'
79
+ );
76
80
 
77
81
  const instanceId = useInstanceId( FormTokenField );
78
82
 
@@ -702,7 +706,7 @@ export function FormTokenField( props: FormTokenFieldProps ) {
702
706
  align="center"
703
707
  gap={ 1 }
704
708
  wrap={ true }
705
- __next36pxDefaultSize={ __next36pxDefaultSize }
709
+ __next40pxDefaultSize={ __next40pxDefaultSize }
706
710
  hasTokens={ !! value.length }
707
711
  >
708
712
  { renderTokensAndInput() }
@@ -11,22 +11,22 @@ import { Flex } from '../flex';
11
11
  import { space } from '../ui/utils/space';
12
12
 
13
13
  type TokensAndInputWrapperProps = {
14
- __next36pxDefaultSize: boolean;
14
+ __next40pxDefaultSize: boolean;
15
15
  hasTokens: boolean;
16
16
  };
17
17
 
18
18
  const deprecatedPaddings = ( {
19
- __next36pxDefaultSize,
19
+ __next40pxDefaultSize,
20
20
  hasTokens,
21
21
  }: TokensAndInputWrapperProps ) =>
22
- ! __next36pxDefaultSize &&
22
+ ! __next40pxDefaultSize &&
23
23
  css`
24
24
  padding-top: ${ space( hasTokens ? 1 : 0.5 ) };
25
25
  padding-bottom: ${ space( hasTokens ? 1 : 0.5 ) };
26
26
  `;
27
27
 
28
28
  export const TokensAndInputWrapperFlex = styled( Flex )`
29
- padding: 5px ${ space( 1 ) };
29
+ padding: 7px;
30
30
 
31
31
  ${ deprecatedPaddings }
32
32
  `;
@@ -151,13 +151,20 @@ export interface FormTokenFieldProps
151
151
  * @default true
152
152
  */
153
153
  __experimentalShowHowTo?: boolean;
154
+ /**
155
+ * Deprecated. Use `__next40pxDefaultSize` instead.
156
+ *
157
+ * @default false
158
+ * @deprecated
159
+ */
160
+ __next36pxDefaultSize?: boolean;
154
161
  /**
155
162
  * Start opting into the larger default height that will become the
156
163
  * default size in a future version.
157
164
  *
158
165
  * @default false
159
166
  */
160
- __next36pxDefaultSize?: boolean;
167
+ __next40pxDefaultSize?: boolean;
161
168
  /**
162
169
  * If true, the select the first matching suggestion when the user presses
163
170
  * the Enter key (or space when tokenizeOnSpace is true).
@@ -26,9 +26,20 @@ export const getMergedGlobalStyles = (
26
26
  blockName,
27
27
  fontSizes
28
28
  ) => {
29
+ // Current support for general styles and blocks.
29
30
  const baseGlobalColors = {
30
- baseColors: baseGlobalStyles || {},
31
+ baseColors: {
32
+ color: baseGlobalStyles?.color,
33
+ typography: baseGlobalStyles?.typography,
34
+ elements: {
35
+ link: baseGlobalStyles?.elements?.link,
36
+ },
37
+ blocks: {
38
+ 'core/button': baseGlobalStyles?.blocks?.[ 'core/button' ],
39
+ },
40
+ },
31
41
  };
42
+
32
43
  const blockStyleAttributes = Object.fromEntries(
33
44
  Object.entries( blockAttributes ?? {} ).filter( ( [ key ] ) =>
34
45
  BLOCK_STYLE_ATTRIBUTES.includes( key )
@@ -74,6 +74,9 @@ export default function LinkPickerResults( {
74
74
  return {
75
75
  fetchMoreSuggestions: debounce( fetchMore, REQUEST_DEBOUNCE_DELAY ),
76
76
  };
77
+ // Disable eslint rule for now, to avoid introducing a regression
78
+ // (see https://github.com/WordPress/gutenberg/pull/23922#discussion_r1170634879).
79
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
80
  }, [] );
78
81
 
79
82
  // Prevent setting state when unmounted.
@@ -252,7 +252,12 @@ function UnforwardedModal(
252
252
  ) }
253
253
  </div>
254
254
  ) }
255
- <div ref={ childrenContainerRef }>{ children }</div>
255
+ <div
256
+ ref={ childrenContainerRef }
257
+ className="components-modal__children-container"
258
+ >
259
+ { children }
260
+ </div>
256
261
  </div>
257
262
  </div>
258
263
  </StyleProvider>
@@ -135,7 +135,7 @@
135
135
 
136
136
  &.hide-header {
137
137
  margin-top: 0;
138
- padding-top: $grid-unit-30;
138
+ padding-top: $grid-unit-40;
139
139
  }
140
140
 
141
141
  &.is-scrollable:focus-visible {
@@ -2,38 +2,49 @@
2
2
 
3
3
  `NavigableContainer` is a React component to render a container navigable using the keyboard. Only things that are focusable can be navigated to. It will currently always be a `div`.
4
4
 
5
- `NavigableContainer` is exported as two classes: `NavigableMenu` and `TabbableContainer`. `NavigableContainer` itself is **not** exported. `NavigableMenu` and `TabbableContainer` have the props listed below. Any other props will be passed through to the `div`.
5
+ `NavigableContainer` is exported as two components: `NavigableMenu` and `TabbableContainer`. `NavigableContainer` itself is **not** exported. `NavigableMenu` and `TabbableContainer` have the props listed below. Any other props will be passed through to the `div`.
6
6
 
7
7
  ---
8
8
 
9
9
  ## Props
10
10
 
11
- These are the props that `NavigableMenu` and `TabbableContainer`. Any props which are specific to one class are labelled appropriately.
11
+ These are the props that `NavigableMenu` and `TabbableContainer`. Any props which are specific to one component are labelled appropriately.
12
12
 
13
- ### onNavigate
13
+ ### `cycle`: `boolean`
14
14
 
15
- A callback invoked when the menu navigates to one of its children passing the index and child as an argument
15
+ A boolean which tells the component whether or not to cycle from the end back to the beginning and vice versa.
16
16
 
17
- - Type: `Function`
18
17
  - Required: No
18
+ - default: `true`
19
19
 
20
- ### cycle
20
+ ### `eventToOffset`: `( event: KeyboardEvent ) => -1 | 0 | 1 | undefined`
21
21
 
22
- A boolean which tells the component whether or not to cycle from the end back to the beginning and vice versa.
22
+ (TabbableContainer only)
23
+ Gets an offset, given an event.
24
+
25
+ - Required: No
26
+
27
+ ### `onKeydown`: `( event: KeyboardEvent ) => void`
28
+
29
+ A callback invoked on the keydown event.
30
+
31
+ - Required: No
32
+
33
+ ### `onNavigate`: `( index: number, focusable: HTMLElement ) => void`
34
+
35
+ A callback invoked when the menu navigates to one of its children passing the index and child as an argument
23
36
 
24
- - Type: `Boolean`
25
37
  - Required: No
26
- - default: true
27
38
 
28
- ### orientation (NavigableMenu only)
39
+ ### `orientation`: `'vertical' | 'horizontal' | 'both'`
29
40
 
30
- The orientation of the menu. It could be "vertical", "horizontal" or "both"
41
+ (NavigableMenu only)
42
+ The orientation of the menu. It could be "vertical", "horizontal", or "both".
31
43
 
32
- - Type: `String`
33
44
  - Required: No
34
45
  - Default: `"vertical"`
35
46
 
36
- ## Classes
47
+ ## Components
37
48
 
38
49
  ### NavigableMenu
39
50
 
@@ -1,14 +1,23 @@
1
- // @ts-nocheck
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
2
6
  /**
3
7
  * WordPress dependencies
4
8
  */
5
9
  import { Component, forwardRef } from '@wordpress/element';
6
10
  import { focus } from '@wordpress/dom';
7
11
 
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import type { NavigableContainerProps } from './types';
16
+
8
17
  const noop = () => {};
9
18
  const MENU_ITEM_ROLES = [ 'menuitem', 'menuitemradio', 'menuitemcheckbox' ];
10
19
 
11
- function cycleValue( value, total, offset ) {
20
+ function cycleValue( value: number, total: number, offset: number ) {
12
21
  const nextValue = value + offset;
13
22
  if ( nextValue < 0 ) {
14
23
  return total + nextValue;
@@ -19,9 +28,11 @@ function cycleValue( value, total, offset ) {
19
28
  return nextValue;
20
29
  }
21
30
 
22
- class NavigableContainer extends Component {
23
- constructor() {
24
- super( ...arguments );
31
+ class NavigableContainer extends Component< NavigableContainerProps > {
32
+ container?: HTMLDivElement;
33
+
34
+ constructor( args: NavigableContainerProps ) {
35
+ super( args );
25
36
  this.onKeyDown = this.onKeyDown.bind( this );
26
37
  this.bindContainer = this.bindContainer.bind( this );
27
38
 
@@ -30,21 +41,27 @@ class NavigableContainer extends Component {
30
41
  }
31
42
 
32
43
  componentDidMount() {
44
+ if ( ! this.container ) {
45
+ return;
46
+ }
47
+
33
48
  // We use DOM event listeners instead of React event listeners
34
49
  // because we want to catch events from the underlying DOM tree
35
50
  // The React Tree can be different from the DOM tree when using
36
51
  // portals. Block Toolbars for instance are rendered in a separate
37
52
  // React Trees.
38
53
  this.container.addEventListener( 'keydown', this.onKeyDown );
39
- this.container.addEventListener( 'focus', this.onFocus );
40
54
  }
41
55
 
42
56
  componentWillUnmount() {
57
+ if ( ! this.container ) {
58
+ return;
59
+ }
60
+
43
61
  this.container.removeEventListener( 'keydown', this.onKeyDown );
44
- this.container.removeEventListener( 'focus', this.onFocus );
45
62
  }
46
63
 
47
- bindContainer( ref ) {
64
+ bindContainer( ref: HTMLDivElement ) {
48
65
  const { forwardedRef } = this.props;
49
66
  this.container = ref;
50
67
 
@@ -55,10 +72,14 @@ class NavigableContainer extends Component {
55
72
  }
56
73
  }
57
74
 
58
- getFocusableContext( target ) {
75
+ getFocusableContext( target: Element ) {
76
+ if ( ! this.container ) {
77
+ return null;
78
+ }
79
+
59
80
  const { onlyBrowserTabstops } = this.props;
60
81
  const finder = onlyBrowserTabstops ? focus.tabbable : focus.focusable;
61
- const focusables = finder.find( this.container );
82
+ const focusables = finder.find( this.container ) as HTMLElement[];
62
83
 
63
84
  const index = this.getFocusableIndex( focusables, target );
64
85
  if ( index > -1 && target ) {
@@ -67,14 +88,11 @@ class NavigableContainer extends Component {
67
88
  return null;
68
89
  }
69
90
 
70
- getFocusableIndex( focusables, target ) {
71
- const directIndex = focusables.indexOf( target );
72
- if ( directIndex !== -1 ) {
73
- return directIndex;
74
- }
91
+ getFocusableIndex( focusables: Element[], target: Element ) {
92
+ return focusables.indexOf( target );
75
93
  }
76
94
 
77
- onKeyDown( event ) {
95
+ onKeyDown( event: KeyboardEvent ) {
78
96
  if ( this.props.onKeyDown ) {
79
97
  this.props.onKeyDown( event );
80
98
  }
@@ -98,15 +116,13 @@ class NavigableContainer extends Component {
98
116
  // from scrolling. The preventDefault also prevents Voiceover from
99
117
  // 'handling' the event, as voiceover will try to use arrow keys
100
118
  // for highlighting text.
101
- const targetRole = event.target.getAttribute( 'role' );
119
+ const targetRole = (
120
+ event.target as HTMLDivElement | null
121
+ )?.getAttribute( 'role' );
102
122
  const targetHasMenuItemRole =
103
- MENU_ITEM_ROLES.includes( targetRole );
104
-
105
- // `preventDefault()` on tab to avoid having the browser move the focus
106
- // after this component has already moved it.
107
- const isTab = event.code === 'Tab';
123
+ !! targetRole && MENU_ITEM_ROLES.includes( targetRole );
108
124
 
109
- if ( targetHasMenuItemRole || isTab ) {
125
+ if ( targetHasMenuItemRole ) {
110
126
  event.preventDefault();
111
127
  }
112
128
  }
@@ -115,9 +131,13 @@ class NavigableContainer extends Component {
115
131
  return;
116
132
  }
117
133
 
118
- const context = getFocusableContext(
119
- event.target.ownerDocument.activeElement
120
- );
134
+ const activeElement = ( event.target as HTMLElement | null )
135
+ ?.ownerDocument?.activeElement;
136
+ if ( ! activeElement ) {
137
+ return;
138
+ }
139
+
140
+ const context = getFocusableContext( activeElement );
121
141
  if ( ! context ) {
122
142
  return;
123
143
  }
@@ -126,9 +146,16 @@ class NavigableContainer extends Component {
126
146
  const nextIndex = cycle
127
147
  ? cycleValue( index, focusables.length, offset )
128
148
  : index + offset;
149
+
129
150
  if ( nextIndex >= 0 && nextIndex < focusables.length ) {
130
151
  focusables[ nextIndex ].focus();
131
152
  onNavigate( nextIndex, focusables[ nextIndex ] );
153
+
154
+ // `preventDefault()` on tab to avoid having the browser move the focus
155
+ // after this component has already moved it.
156
+ if ( event.code === 'Tab' ) {
157
+ event.preventDefault();
158
+ }
132
159
  }
133
160
  }
134
161
 
@@ -152,7 +179,10 @@ class NavigableContainer extends Component {
152
179
  }
153
180
  }
154
181
 
155
- const forwardedNavigableContainer = ( props, ref ) => {
182
+ const forwardedNavigableContainer = (
183
+ props: NavigableContainerProps,
184
+ ref: ForwardedRef< HTMLDivElement >
185
+ ) => {
156
186
  return <NavigableContainer { ...props } forwardedRef={ ref } />;
157
187
  };
158
188
  forwardedNavigableContainer.displayName = 'NavigableContainer';
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * Internal Dependencies
4
3
  */