@wordpress/components 19.16.0 → 19.17.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 (434) hide show
  1. package/CHANGELOG.md +40 -4
  2. package/build/base-control/index.js +6 -3
  3. package/build/base-control/index.js.map +1 -1
  4. package/build/base-control/styles/base-control-styles.js +8 -8
  5. package/build/base-control/styles/base-control-styles.js.map +1 -1
  6. package/build/border-control/styles.js +17 -25
  7. package/build/border-control/styles.js.map +1 -1
  8. package/build/box-control/all-input-control.js +2 -27
  9. package/build/box-control/all-input-control.js.map +1 -1
  10. package/build/box-control/index.js +10 -5
  11. package/build/box-control/index.js.map +1 -1
  12. package/build/box-control/styles/box-control-styles.js +17 -9
  13. package/build/box-control/styles/box-control-styles.js.map +1 -1
  14. package/build/box-control/utils.js +35 -0
  15. package/build/box-control/utils.js.map +1 -1
  16. package/build/color-picker/styles.js +10 -8
  17. package/build/color-picker/styles.js.map +1 -1
  18. package/build/combobox-control/index.js +14 -6
  19. package/build/combobox-control/index.js.map +1 -1
  20. package/build/custom-select-control/index.js +3 -1
  21. package/build/custom-select-control/index.js.map +1 -1
  22. package/build/date-time/time/index.js +6 -2
  23. package/build/date-time/time/index.js.map +1 -1
  24. package/build/date-time/time/styles.js +17 -24
  25. package/build/date-time/time/styles.js.map +1 -1
  26. package/build/external-link/index.js +6 -0
  27. package/build/external-link/index.js.map +1 -1
  28. package/build/flex/flex/component.js +9 -9
  29. package/build/flex/flex/component.js.map +1 -1
  30. package/build/flex/flex/hook.js +6 -16
  31. package/build/flex/flex/hook.js.map +1 -1
  32. package/build/flex/flex/index.js.map +1 -1
  33. package/build/flex/flex-block/component.js +9 -9
  34. package/build/flex/flex-block/component.js.map +1 -1
  35. package/build/flex/flex-block/hook.js +0 -4
  36. package/build/flex/flex-block/hook.js.map +1 -1
  37. package/build/flex/flex-block/index.js.map +1 -1
  38. package/build/flex/flex-item/component.js +9 -9
  39. package/build/flex/flex-item/component.js.map +1 -1
  40. package/build/flex/flex-item/hook.js +1 -5
  41. package/build/flex/flex-item/hook.js.map +1 -1
  42. package/build/flex/flex-item/index.js.map +1 -1
  43. package/build/flex/index.js.map +1 -1
  44. package/build/flex/styles.js +5 -5
  45. package/build/flex/styles.js.map +1 -1
  46. package/build/focal-point-picker/styles/focal-point-picker-style.js +22 -22
  47. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  48. package/build/focal-point-picker/styles/focal-point-style.js +5 -5
  49. package/build/focal-point-picker/styles/focal-point-style.js.map +1 -1
  50. package/build/font-size-picker/index.js +15 -6
  51. package/build/font-size-picker/index.js.map +1 -1
  52. package/build/form-token-field/index.js +6 -2
  53. package/build/form-token-field/index.js.map +1 -1
  54. package/build/form-token-field/suggestions-list.js +19 -6
  55. package/build/form-token-field/suggestions-list.js.map +1 -1
  56. package/build/index.js +7 -1
  57. package/build/index.js.map +1 -1
  58. package/build/input-control/input-base.js +1 -2
  59. package/build/input-control/input-base.js.map +1 -1
  60. package/build/input-control/reducer/actions.js +3 -1
  61. package/build/input-control/reducer/actions.js.map +1 -1
  62. package/build/input-control/reducer/reducer.js +28 -11
  63. package/build/input-control/reducer/reducer.js.map +1 -1
  64. package/build/input-control/reducer/state.js.map +1 -1
  65. package/build/input-control/styles/input-control-styles.js +26 -26
  66. package/build/input-control/styles/input-control-styles.js.map +1 -1
  67. package/build/mobile/global-styles-context/utils.native.js +23 -3
  68. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  69. package/build/mobile/image/index.native.js +23 -2
  70. package/build/mobile/image/index.native.js.map +1 -1
  71. package/build/mobile/link-picker/link-picker-screen.native.js +10 -4
  72. package/build/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  73. package/build/mobile/picker/index.ios.js +16 -3
  74. package/build/mobile/picker/index.ios.js.map +1 -1
  75. package/build/placeholder/index.js +11 -14
  76. package/build/placeholder/index.js.map +1 -1
  77. package/build/placeholder/types.js +6 -0
  78. package/build/placeholder/types.js.map +1 -0
  79. package/build/popover/index.js +113 -62
  80. package/build/popover/index.js.map +1 -1
  81. package/build/range-control/styles/range-control-styles.js +40 -40
  82. package/build/range-control/styles/range-control-styles.js.map +1 -1
  83. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  84. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  85. package/build/select-control/styles/select-control-styles.js +6 -6
  86. package/build/select-control/styles/select-control-styles.js.map +1 -1
  87. package/build/style-provider/index.js +10 -7
  88. package/build/style-provider/index.js.map +1 -1
  89. package/build/style-provider/types.js +6 -0
  90. package/build/style-provider/types.js.map +1 -0
  91. package/build/swatch/index.js +2 -0
  92. package/build/swatch/index.js.map +1 -1
  93. package/build/swatch/types.js +6 -0
  94. package/build/swatch/types.js.map +1 -0
  95. package/build/text/hook.js +5 -8
  96. package/build/text/hook.js.map +1 -1
  97. package/build/tools-panel/styles.js +13 -10
  98. package/build/tools-panel/styles.js.map +1 -1
  99. package/build/tools-panel/tools-panel/hook.js +1 -1
  100. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  101. package/build/ui/tooltip/styles.js +4 -4
  102. package/build/ui/tooltip/styles.js.map +1 -1
  103. package/build/unit-control/styles/unit-control-styles.js +34 -9
  104. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  105. package/build/utils/base-label.js +24 -0
  106. package/build/utils/base-label.js.map +1 -0
  107. package/build/utils/box-sizing.js +22 -0
  108. package/build/utils/box-sizing.js.map +1 -0
  109. package/build/utils/style-mixins.js +16 -0
  110. package/build/utils/style-mixins.js.map +1 -1
  111. package/build-module/base-control/index.js +7 -5
  112. package/build-module/base-control/index.js.map +1 -1
  113. package/build-module/base-control/styles/base-control-styles.js +9 -9
  114. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  115. package/build-module/border-control/styles.js +18 -26
  116. package/build-module/border-control/styles.js.map +1 -1
  117. package/build-module/box-control/all-input-control.js +3 -28
  118. package/build-module/box-control/all-input-control.js.map +1 -1
  119. package/build-module/box-control/index.js +4 -4
  120. package/build-module/box-control/index.js.map +1 -1
  121. package/build-module/box-control/styles/box-control-styles.js +18 -10
  122. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  123. package/build-module/box-control/utils.js +33 -0
  124. package/build-module/box-control/utils.js.map +1 -1
  125. package/build-module/color-picker/styles.js +9 -8
  126. package/build-module/color-picker/styles.js.map +1 -1
  127. package/build-module/combobox-control/index.js +13 -6
  128. package/build-module/combobox-control/index.js.map +1 -1
  129. package/build-module/custom-select-control/index.js +2 -1
  130. package/build-module/custom-select-control/index.js.map +1 -1
  131. package/build-module/date-time/time/index.js +6 -3
  132. package/build-module/date-time/time/index.js.map +1 -1
  133. package/build-module/date-time/time/styles.js +15 -21
  134. package/build-module/date-time/time/styles.js.map +1 -1
  135. package/build-module/external-link/index.js +6 -0
  136. package/build-module/external-link/index.js.map +1 -1
  137. package/build-module/flex/flex/component.js +9 -9
  138. package/build-module/flex/flex/component.js.map +1 -1
  139. package/build-module/flex/flex/hook.js +6 -15
  140. package/build-module/flex/flex/hook.js.map +1 -1
  141. package/build-module/flex/flex/index.js.map +1 -1
  142. package/build-module/flex/flex-block/component.js +9 -9
  143. package/build-module/flex/flex-block/component.js.map +1 -1
  144. package/build-module/flex/flex-block/hook.js +0 -4
  145. package/build-module/flex/flex-block/hook.js.map +1 -1
  146. package/build-module/flex/flex-block/index.js.map +1 -1
  147. package/build-module/flex/flex-item/component.js +9 -9
  148. package/build-module/flex/flex-item/component.js.map +1 -1
  149. package/build-module/flex/flex-item/hook.js +1 -5
  150. package/build-module/flex/flex-item/hook.js.map +1 -1
  151. package/build-module/flex/flex-item/index.js.map +1 -1
  152. package/build-module/flex/index.js.map +1 -1
  153. package/build-module/flex/styles.js +5 -5
  154. package/build-module/flex/styles.js.map +1 -1
  155. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +22 -22
  156. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  157. package/build-module/focal-point-picker/styles/focal-point-style.js +5 -5
  158. package/build-module/focal-point-picker/styles/focal-point-style.js.map +1 -1
  159. package/build-module/font-size-picker/index.js +14 -6
  160. package/build-module/font-size-picker/index.js.map +1 -1
  161. package/build-module/form-token-field/index.js +5 -2
  162. package/build-module/form-token-field/index.js.map +1 -1
  163. package/build-module/form-token-field/suggestions-list.js +19 -6
  164. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  165. package/build-module/index.js +1 -1
  166. package/build-module/index.js.map +1 -1
  167. package/build-module/input-control/input-base.js +1 -2
  168. package/build-module/input-control/input-base.js.map +1 -1
  169. package/build-module/input-control/reducer/actions.js +1 -0
  170. package/build-module/input-control/reducer/actions.js.map +1 -1
  171. package/build-module/input-control/reducer/reducer.js +28 -11
  172. package/build-module/input-control/reducer/reducer.js.map +1 -1
  173. package/build-module/input-control/reducer/state.js.map +1 -1
  174. package/build-module/input-control/styles/input-control-styles.js +27 -27
  175. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  176. package/build-module/mobile/global-styles-context/utils.native.js +23 -4
  177. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  178. package/build-module/mobile/image/index.native.js +25 -4
  179. package/build-module/mobile/image/index.native.js.map +1 -1
  180. package/build-module/mobile/link-picker/link-picker-screen.native.js +11 -4
  181. package/build-module/mobile/link-picker/link-picker-screen.native.js.map +1 -1
  182. package/build-module/mobile/picker/index.ios.js +14 -3
  183. package/build-module/mobile/picker/index.ios.js.map +1 -1
  184. package/build-module/placeholder/index.js +10 -15
  185. package/build-module/placeholder/index.js.map +1 -1
  186. package/build-module/placeholder/types.js +2 -0
  187. package/build-module/placeholder/types.js.map +1 -0
  188. package/build-module/popover/index.js +112 -62
  189. package/build-module/popover/index.js.map +1 -1
  190. package/build-module/range-control/styles/range-control-styles.js +40 -40
  191. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  192. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +4 -4
  193. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  194. package/build-module/select-control/styles/select-control-styles.js +6 -6
  195. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  196. package/build-module/style-provider/index.js +10 -5
  197. package/build-module/style-provider/index.js.map +1 -1
  198. package/build-module/style-provider/types.js +2 -0
  199. package/build-module/style-provider/types.js.map +1 -0
  200. package/build-module/swatch/index.js +2 -0
  201. package/build-module/swatch/index.js.map +1 -1
  202. package/build-module/swatch/types.js +2 -0
  203. package/build-module/swatch/types.js.map +1 -0
  204. package/build-module/text/hook.js +5 -7
  205. package/build-module/text/hook.js.map +1 -1
  206. package/build-module/tools-panel/styles.js +12 -11
  207. package/build-module/tools-panel/styles.js.map +1 -1
  208. package/build-module/tools-panel/tools-panel/hook.js +1 -1
  209. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  210. package/build-module/ui/tooltip/styles.js +4 -4
  211. package/build-module/ui/tooltip/styles.js.map +1 -1
  212. package/build-module/unit-control/styles/unit-control-styles.js +35 -9
  213. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  214. package/build-module/utils/base-label.js +18 -0
  215. package/build-module/utils/base-label.js.map +1 -0
  216. package/build-module/utils/box-sizing.js +16 -0
  217. package/build-module/utils/box-sizing.js.map +1 -0
  218. package/build-module/utils/style-mixins.js +2 -0
  219. package/build-module/utils/style-mixins.js.map +1 -1
  220. package/build-style/style-rtl.css +50 -30
  221. package/build-style/style.css +52 -30
  222. package/build-types/base-control/index.d.ts +4 -3
  223. package/build-types/base-control/index.d.ts.map +1 -1
  224. package/build-types/base-control/stories/index.d.ts +1 -1
  225. package/build-types/base-control/stories/index.d.ts.map +1 -1
  226. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  227. package/build-types/base-control/types.d.ts +0 -1
  228. package/build-types/base-control/types.d.ts.map +1 -1
  229. package/build-types/border-control/styles.d.ts.map +1 -1
  230. package/build-types/color-picker/color-display.d.ts +13 -0
  231. package/build-types/color-picker/color-display.d.ts.map +1 -0
  232. package/build-types/color-picker/styles.d.ts.map +1 -1
  233. package/build-types/date-time/time/index.d.ts.map +1 -1
  234. package/build-types/date-time/time/styles.d.ts +0 -4
  235. package/build-types/date-time/time/styles.d.ts.map +1 -1
  236. package/build-types/external-link/index.d.ts.map +1 -1
  237. package/build-types/flex/flex/component.d.ts +5 -4
  238. package/build-types/flex/flex/component.d.ts.map +1 -1
  239. package/build-types/flex/flex/hook.d.ts +5 -2
  240. package/build-types/flex/flex/hook.d.ts.map +1 -1
  241. package/build-types/flex/flex/index.d.ts +2 -2
  242. package/build-types/flex/flex/index.d.ts.map +1 -1
  243. package/build-types/flex/flex-block/component.d.ts +5 -4
  244. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  245. package/build-types/flex/flex-block/hook.d.ts +6 -3
  246. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  247. package/build-types/flex/flex-block/index.d.ts +2 -2
  248. package/build-types/flex/flex-block/index.d.ts.map +1 -1
  249. package/build-types/flex/flex-item/component.d.ts +5 -4
  250. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  251. package/build-types/flex/flex-item/hook.d.ts +6 -3
  252. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  253. package/build-types/flex/flex-item/index.d.ts +2 -2
  254. package/build-types/flex/flex-item/index.d.ts.map +1 -1
  255. package/build-types/flex/index.d.ts +3 -3
  256. package/build-types/flex/index.d.ts.map +1 -1
  257. package/build-types/flex/stories/index.d.ts +13 -0
  258. package/build-types/flex/stories/index.d.ts.map +1 -0
  259. package/build-types/flex/styles.d.ts +5 -5
  260. package/build-types/flex/styles.d.ts.map +1 -1
  261. package/build-types/flex/test/index.d.ts +2 -0
  262. package/build-types/flex/test/index.d.ts.map +1 -0
  263. package/build-types/flex/types.d.ts +15 -11
  264. package/build-types/flex/types.d.ts.map +1 -1
  265. package/build-types/flyout/context.d.ts +6 -0
  266. package/build-types/flyout/context.d.ts.map +1 -0
  267. package/build-types/flyout/flyout/component.d.ts +21 -0
  268. package/build-types/flyout/flyout/component.d.ts.map +1 -0
  269. package/build-types/flyout/flyout/hook.d.ts +270 -0
  270. package/build-types/flyout/flyout/hook.d.ts.map +1 -0
  271. package/build-types/flyout/flyout/index.d.ts +3 -0
  272. package/build-types/flyout/flyout/index.d.ts.map +1 -0
  273. package/build-types/flyout/flyout-content/component.d.ts +3 -0
  274. package/build-types/flyout/flyout-content/component.d.ts.map +1 -0
  275. package/build-types/flyout/flyout-content/index.d.ts +2 -0
  276. package/build-types/flyout/flyout-content/index.d.ts.map +1 -0
  277. package/build-types/flyout/index.d.ts +2 -0
  278. package/build-types/flyout/index.d.ts.map +1 -0
  279. package/build-types/flyout/styles.d.ts +22 -0
  280. package/build-types/flyout/styles.d.ts.map +1 -0
  281. package/build-types/flyout/types.d.ts +80 -0
  282. package/build-types/flyout/types.d.ts.map +1 -0
  283. package/build-types/flyout/utils.d.ts +8 -0
  284. package/build-types/flyout/utils.d.ts.map +1 -0
  285. package/build-types/form-token-field/index.d.ts.map +1 -1
  286. package/build-types/form-token-field/stories/index.d.ts +6 -0
  287. package/build-types/form-token-field/stories/index.d.ts.map +1 -1
  288. package/build-types/form-token-field/suggestions-list.d.ts +1 -1
  289. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -1
  290. package/build-types/form-token-field/types.d.ts +15 -3
  291. package/build-types/form-token-field/types.d.ts.map +1 -1
  292. package/build-types/input-control/input-base.d.ts.map +1 -1
  293. package/build-types/input-control/reducer/actions.d.ts +3 -1
  294. package/build-types/input-control/reducer/actions.d.ts.map +1 -1
  295. package/build-types/input-control/reducer/reducer.d.ts +2 -2
  296. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  297. package/build-types/input-control/reducer/state.d.ts +2 -2
  298. package/build-types/input-control/reducer/state.d.ts.map +1 -1
  299. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  300. package/build-types/placeholder/index.d.ts +16 -0
  301. package/build-types/placeholder/index.d.ts.map +1 -0
  302. package/build-types/placeholder/stories/index.d.ts +12 -0
  303. package/build-types/placeholder/stories/index.d.ts.map +1 -0
  304. package/build-types/placeholder/types.d.ts +47 -0
  305. package/build-types/placeholder/types.d.ts.map +1 -0
  306. package/build-types/popover/index.d.ts +1 -1
  307. package/build-types/popover/index.d.ts.map +1 -1
  308. package/build-types/popover/utils.d.ts +70 -0
  309. package/build-types/popover/utils.d.ts.map +1 -0
  310. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  311. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  312. package/build-types/style-provider/index.d.ts +7 -4
  313. package/build-types/style-provider/index.d.ts.map +1 -1
  314. package/build-types/style-provider/types.d.ts +15 -0
  315. package/build-types/style-provider/types.d.ts.map +1 -0
  316. package/build-types/swatch/index.d.ts +5 -0
  317. package/build-types/swatch/index.d.ts.map +1 -0
  318. package/build-types/swatch/types.d.ts +11 -0
  319. package/build-types/swatch/types.d.ts.map +1 -0
  320. package/build-types/text/hook.d.ts.map +1 -1
  321. package/build-types/tools-panel/styles.d.ts +1 -1
  322. package/build-types/tools-panel/styles.d.ts.map +1 -1
  323. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  324. package/build-types/ui/tooltip/styles.d.ts.map +1 -1
  325. package/build-types/unit-control/index.d.ts +1 -1
  326. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  327. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  328. package/build-types/unit-control/types.d.ts +1 -7
  329. package/build-types/unit-control/types.d.ts.map +1 -1
  330. package/build-types/utils/base-label.d.ts +2 -0
  331. package/build-types/utils/base-label.d.ts.map +1 -0
  332. package/build-types/utils/box-sizing.d.ts +2 -0
  333. package/build-types/utils/box-sizing.d.ts.map +1 -0
  334. package/build-types/utils/hooks/use-combined-ref.d.ts +8 -0
  335. package/build-types/utils/hooks/use-combined-ref.d.ts.map +1 -0
  336. package/build-types/utils/style-mixins.d.ts +2 -0
  337. package/package.json +17 -17
  338. package/src/base-control/index.tsx +5 -3
  339. package/src/base-control/stories/index.tsx +1 -0
  340. package/src/base-control/styles/base-control-styles.ts +9 -5
  341. package/src/base-control/types.ts +0 -1
  342. package/src/border-control/styles.ts +2 -1
  343. package/src/box-control/all-input-control.js +3 -27
  344. package/src/box-control/index.js +5 -6
  345. package/src/box-control/styles/box-control-styles.js +1 -2
  346. package/src/box-control/utils.js +32 -0
  347. package/src/color-picker/styles.ts +3 -0
  348. package/src/combobox-control/README.md +7 -0
  349. package/src/combobox-control/index.js +14 -4
  350. package/src/combobox-control/stories/index.js +49 -5
  351. package/src/custom-gradient-picker/style.scss +0 -12
  352. package/src/custom-select-control/index.js +3 -2
  353. package/src/custom-select-control/style.scss +1 -5
  354. package/src/date-time/time/index.tsx +7 -5
  355. package/src/date-time/time/styles.ts +3 -6
  356. package/src/external-link/index.tsx +10 -0
  357. package/src/flex/flex/README.md +19 -13
  358. package/src/flex/flex/{component.js → component.tsx} +15 -10
  359. package/src/flex/flex/{hook.js → hook.ts} +14 -13
  360. package/src/flex/flex/{index.js → index.ts} +0 -0
  361. package/src/flex/flex-block/README.md +3 -3
  362. package/src/flex/flex-block/{component.js → component.tsx} +15 -10
  363. package/src/flex/flex-block/{hook.js → hook.ts} +5 -5
  364. package/src/flex/flex-block/{index.js → index.ts} +0 -0
  365. package/src/flex/flex-item/README.md +6 -5
  366. package/src/flex/flex-item/{component.js → component.tsx} +15 -10
  367. package/src/flex/flex-item/{hook.js → hook.ts} +10 -7
  368. package/src/flex/flex-item/{index.js → index.ts} +0 -0
  369. package/src/flex/{index.js → index.ts} +0 -0
  370. package/src/flex/stories/index.tsx +81 -0
  371. package/src/flex/{styles.js → styles.ts} +0 -0
  372. package/src/flex/test/__snapshots__/{index.js.snap → index.tsx.snap} +49 -9
  373. package/src/flex/test/index.tsx +84 -0
  374. package/src/flex/types.ts +15 -11
  375. package/src/focal-point-picker/styles/focal-point-picker-style.js +0 -5
  376. package/src/focal-point-picker/styles/focal-point-style.js +0 -1
  377. package/src/font-size-picker/index.js +18 -7
  378. package/src/font-size-picker/stories/index.js +6 -0
  379. package/src/form-token-field/README.md +2 -1
  380. package/src/form-token-field/index.tsx +5 -2
  381. package/src/form-token-field/stories/index.tsx +14 -0
  382. package/src/form-token-field/style.scss +0 -5
  383. package/src/form-token-field/suggestions-list.tsx +21 -12
  384. package/src/form-token-field/types.ts +16 -2
  385. package/src/index.js +4 -1
  386. package/src/input-control/input-base.tsx +0 -1
  387. package/src/input-control/reducer/actions.ts +3 -1
  388. package/src/input-control/reducer/reducer.ts +27 -10
  389. package/src/input-control/reducer/state.ts +7 -2
  390. package/src/input-control/styles/input-control-styles.tsx +3 -1
  391. package/src/input-control/test/index.js +20 -4
  392. package/src/mobile/global-styles-context/utils.native.js +21 -4
  393. package/src/mobile/image/index.native.js +27 -2
  394. package/src/mobile/link-picker/link-picker-screen.native.js +12 -4
  395. package/src/mobile/picker/index.ios.js +16 -0
  396. package/src/mobile/picker/styles.native.scss +8 -0
  397. package/src/panel/style.scss +4 -1
  398. package/src/placeholder/README.md +49 -9
  399. package/src/placeholder/{index.js → index.tsx} +27 -23
  400. package/src/placeholder/stories/index.tsx +64 -0
  401. package/src/placeholder/style.scss +0 -4
  402. package/src/placeholder/types.ts +48 -0
  403. package/src/popover/README.md +7 -0
  404. package/src/popover/index.js +144 -70
  405. package/src/popover/stories/index.js +199 -98
  406. package/src/popover/style.scss +60 -6
  407. package/src/popover/test/index.js +23 -1
  408. package/src/range-control/styles/range-control-styles.ts +0 -12
  409. package/src/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +1 -1
  410. package/src/select-control/styles/select-control-styles.ts +0 -1
  411. package/src/style-provider/index.tsx +41 -0
  412. package/src/style-provider/types.ts +15 -0
  413. package/src/swatch/{index.js → index.tsx} +4 -1
  414. package/src/swatch/types.ts +11 -0
  415. package/src/text/hook.js +5 -3
  416. package/src/toggle-group-control/test/__snapshots__/index.js.snap +24 -0
  417. package/src/tools-panel/styles.ts +7 -16
  418. package/src/tools-panel/test/__snapshots__/index.js.snap +2 -11
  419. package/src/tools-panel/tools-panel/hook.ts +6 -1
  420. package/src/ui/tooltip/styles.js +1 -0
  421. package/src/ui/tooltip/test/__snapshots__/index.js.snap +1 -0
  422. package/src/unit-control/stories/index.tsx +16 -23
  423. package/src/unit-control/styles/unit-control-styles.ts +93 -41
  424. package/src/unit-control/types.ts +1 -7
  425. package/src/utils/base-label.ts +13 -0
  426. package/src/utils/box-sizing.ts +14 -0
  427. package/src/utils/style-mixins.js +2 -0
  428. package/tsconfig.json +2 -0
  429. package/tsconfig.tsbuildinfo +1 -1
  430. package/src/flex/stories/index.js +0 -29
  431. package/src/flex/test/index.js +0 -77
  432. package/src/placeholder/stories/index.js +0 -44
  433. package/src/popover/stories/_utils.js +0 -64
  434. package/src/style-provider/index.js +0 -31
@@ -3,8 +3,8 @@
3
3
  */
4
4
  import UnitControl from './unit-control';
5
5
  import {
6
- ALL_SIDES,
7
6
  LABELS,
7
+ applyValueToSides,
8
8
  getAllValue,
9
9
  isValuesMixed,
10
10
  isValuesDefined,
@@ -32,34 +32,10 @@ export default function AllInputControl( {
32
32
  onFocus( event, { side: 'all' } );
33
33
  };
34
34
 
35
- // Applies a value to an object representing top, right, bottom and left
36
- // sides while taking into account any custom side configuration.
37
- const applyValueToSides = ( currentValues, newValue ) => {
38
- const newValues = { ...currentValues };
39
-
40
- if ( sides?.length ) {
41
- sides.forEach( ( side ) => {
42
- if ( side === 'vertical' ) {
43
- newValues.top = newValue;
44
- newValues.bottom = newValue;
45
- } else if ( side === 'horizontal' ) {
46
- newValues.left = newValue;
47
- newValues.right = newValue;
48
- } else {
49
- newValues[ side ] = newValue;
50
- }
51
- } );
52
- } else {
53
- ALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );
54
- }
55
-
56
- return newValues;
57
- };
58
-
59
35
  const handleOnChange = ( next ) => {
60
36
  const isNumeric = ! isNaN( parseFloat( next ) );
61
37
  const nextValue = isNumeric ? next : undefined;
62
- const nextValues = applyValueToSides( values, nextValue );
38
+ const nextValues = applyValueToSides( values, nextValue, sides );
63
39
 
64
40
  onChange( nextValues );
65
41
  };
@@ -67,7 +43,7 @@ export default function AllInputControl( {
67
43
  // Set selected unit so it can be used as fallback by unlinked controls
68
44
  // when individual sides do not have a value containing a unit.
69
45
  const handleOnUnitChange = ( unit ) => {
70
- const newUnits = applyValueToSides( selectedUnits, unit );
46
+ const newUnits = applyValueToSides( selectedUnits, unit, sides );
71
47
  setSelectedUnits( newUnits );
72
48
  };
73
49
 
@@ -8,13 +8,13 @@ import { __ } from '@wordpress/i18n';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
+ import { BaseControl } from '../base-control';
11
12
  import Button from '../button';
12
13
  import { FlexItem, FlexBlock } from '../flex';
13
14
  import AllInputControl from './all-input-control';
14
15
  import InputControls from './input-controls';
15
16
  import AxialInputControls from './axial-input-controls';
16
17
  import BoxControlIcon from './icon';
17
- import { Text } from '../text';
18
18
  import LinkedButton from './linked-button';
19
19
  import {
20
20
  Root,
@@ -120,12 +120,9 @@ export default function BoxControl( {
120
120
  <Root id={ id } role="group" aria-labelledby={ headingId }>
121
121
  <Header className="component-box-control__header">
122
122
  <FlexItem>
123
- <Text
124
- id={ headingId }
125
- className="component-box-control__label"
126
- >
123
+ <BaseControl.VisualLabel id={ headingId }>
127
124
  { label }
128
- </Text>
125
+ </BaseControl.VisualLabel>
129
126
  </FlexItem>
130
127
  { allowReset && (
131
128
  <FlexItem>
@@ -173,3 +170,5 @@ export default function BoxControl( {
173
170
  </Root>
174
171
  );
175
172
  }
173
+
174
+ export { applyValueToSides } from './utils';
@@ -8,7 +8,7 @@ import styled from '@emotion/styled';
8
8
  */
9
9
  import { Flex } from '../../flex';
10
10
  import BaseUnitControl from '../../unit-control';
11
- import { COLORS, rtl } from '../../utils';
11
+ import { rtl } from '../../utils';
12
12
 
13
13
  export const Root = styled.div`
14
14
  box-sizing: border-box;
@@ -18,7 +18,6 @@ export const Root = styled.div`
18
18
  `;
19
19
 
20
20
  export const Header = styled( Flex )`
21
- color: ${ COLORS.ui.label };
22
21
  margin-bottom: 8px;
23
22
  `;
24
23
 
@@ -194,3 +194,35 @@ export function normalizeSides( sides ) {
194
194
 
195
195
  return filteredSides;
196
196
  }
197
+
198
+ /**
199
+ * Applies a value to an object representing top, right, bottom and left sides
200
+ * while taking into account any custom side configuration.
201
+ *
202
+ * @param {Object} currentValues The current values for each side.
203
+ * @param {string|number} newValue The value to apply to the sides object.
204
+ * @param {string[]} sides Array defining valid sides.
205
+ *
206
+ * @return {Object} Object containing the updated values for each side.
207
+ */
208
+ export function applyValueToSides( currentValues, newValue, sides ) {
209
+ const newValues = { ...currentValues };
210
+
211
+ if ( sides?.length ) {
212
+ sides.forEach( ( side ) => {
213
+ if ( side === 'vertical' ) {
214
+ newValues.top = newValue;
215
+ newValues.bottom = newValue;
216
+ } else if ( side === 'horizontal' ) {
217
+ newValues.left = newValue;
218
+ newValues.right = newValue;
219
+ } else {
220
+ newValues[ side ] = newValue;
221
+ }
222
+ } );
223
+ } else {
224
+ ALL_SIDES.forEach( ( side ) => ( newValues[ side ] = newValue ) );
225
+ }
226
+
227
+ return newValues;
228
+ }
@@ -11,6 +11,7 @@ import InnerSelectControl from '../select-control';
11
11
  import InnerRangeControl from '../range-control';
12
12
  import { StyledField } from '../base-control/styles/base-control-styles';
13
13
  import { space } from '../ui/utils/space';
14
+ import { boxSizingReset } from '../utils';
14
15
  import Button from '../button';
15
16
  import { Flex } from '../flex';
16
17
  import { HStack } from '../h-stack';
@@ -70,6 +71,8 @@ export const ColorInputWrapper = styled( Flex )`
70
71
  `;
71
72
 
72
73
  export const ColorfulWrapper = styled.div`
74
+ ${ boxSizingReset };
75
+
73
76
  width: 216px;
74
77
 
75
78
  .react-colorful {
@@ -116,6 +116,13 @@ The current value of the input.
116
116
  - Type: `mixed`
117
117
  - Required: Yes
118
118
 
119
+ #### __experimentalRenderItem
120
+
121
+ Custom renderer invoked for each option in the suggestion list. The render prop receives as its argument an object containing, under the `item` key, the single option's data (directly from the array of data passed to the `options` prop).
122
+
123
+ - Type: `Function` - `( args: { item: object } ) => ReactNode`
124
+ - Required: No
125
+
119
126
  ## Related components
120
127
 
121
128
  - Like this component, but without a search input, the `CustomSelectControl` component.
@@ -29,6 +29,7 @@ import BaseControl from '../base-control';
29
29
  import Button from '../button';
30
30
  import { FlexBlock, FlexItem } from '../flex';
31
31
  import withFocusOutside from '../higher-order/with-focus-outside';
32
+ import { useControlledValue } from '../utils/hooks';
32
33
 
33
34
  const noop = () => {};
34
35
 
@@ -46,10 +47,10 @@ const DetectOutside = withFocusOutside(
46
47
 
47
48
  function ComboboxControl( {
48
49
  __next36pxDefaultSize,
49
- value,
50
+ value: valueProp,
50
51
  label,
51
52
  options,
52
- onChange,
53
+ onChange: onChangeProp,
53
54
  onFilterValueChange = noop,
54
55
  hideLabelFromVision,
55
56
  help,
@@ -58,7 +59,13 @@ function ComboboxControl( {
58
59
  messages = {
59
60
  selected: __( 'Item selected.' ),
60
61
  },
62
+ __experimentalRenderItem,
61
63
  } ) {
64
+ const [ value, setValue ] = useControlledValue( {
65
+ value: valueProp,
66
+ onChange: onChangeProp,
67
+ } );
68
+
62
69
  const currentOption = options.find( ( option ) => option.value === value );
63
70
  const currentLabel = currentOption?.label ?? '';
64
71
  // Use a custom prefix when generating the `instanceId` to avoid having
@@ -92,7 +99,7 @@ function ComboboxControl( {
92
99
  }, [ inputValue, options, value ] );
93
100
 
94
101
  const onSuggestionSelected = ( newSelectedSuggestion ) => {
95
- onChange( newSelectedSuggestion.value );
102
+ setValue( newSelectedSuggestion.value );
96
103
  speak( messages.selected, 'assertive' );
97
104
  setSelectedSuggestion( newSelectedSuggestion );
98
105
  setInputValue( '' );
@@ -172,7 +179,7 @@ function ComboboxControl( {
172
179
  };
173
180
 
174
181
  const handleOnReset = () => {
175
- onChange( null );
182
+ setValue( null );
176
183
  inputContainer.current.focus();
177
184
  };
178
185
 
@@ -279,6 +286,9 @@ function ComboboxControl( {
279
286
  onHover={ setSelectedSuggestion }
280
287
  onSelect={ onSuggestionSelected }
281
288
  scrollIntoView
289
+ __experimentalRenderItem={
290
+ __experimentalRenderItem
291
+ }
282
292
  />
283
293
  ) }
284
294
  </div>
@@ -266,7 +266,7 @@ const mapCountryOption = ( country ) => ( {
266
266
 
267
267
  const countryOptions = countries.map( mapCountryOption );
268
268
 
269
- function CountryCodeComboboxControl( args ) {
269
+ function Template( args ) {
270
270
  const [ value, setValue ] = useState( null );
271
271
 
272
272
  return (
@@ -275,15 +275,59 @@ function CountryCodeComboboxControl( args ) {
275
275
  { ...args }
276
276
  value={ value }
277
277
  onChange={ setValue }
278
- label="Select a country"
279
- options={ countryOptions }
280
278
  />
281
279
  <p>Value: { value }</p>
282
280
  </>
283
281
  );
284
282
  }
285
- export const _default = CountryCodeComboboxControl.bind( {} );
286
- _default.args = {
283
+ export const Default = Template.bind( {} );
284
+ Default.args = {
287
285
  __next36pxDefaultSize: false,
288
286
  allowReset: false,
287
+ label: 'Select a country',
288
+ options: countryOptions,
289
+ };
290
+
291
+ const authorOptions = [
292
+ {
293
+ value: 'parsley',
294
+ label: 'Parsley Montana',
295
+ age: 48,
296
+ country: 'Germany',
297
+ },
298
+ {
299
+ value: 'cabbage',
300
+ label: 'Cabbage New York',
301
+ age: 44,
302
+ country: 'France',
303
+ },
304
+ {
305
+ value: 'jake',
306
+ label: 'Jake Weary',
307
+ age: 41,
308
+ country: 'United Kingdom',
309
+ },
310
+ ];
311
+
312
+ /**
313
+ * The rendered output of each suggestion can be customized by passing a
314
+ * render function to the `__experimentalRenderItem` prop. (This is still an experimental feature
315
+ * and is subject to change.)
316
+ */
317
+ export const WithCustomRenderItem = Template.bind( {} );
318
+ WithCustomRenderItem.args = {
319
+ ...Default.args,
320
+ label: 'Select an author',
321
+ options: authorOptions,
322
+ __experimentalRenderItem: ( { item } ) => {
323
+ const { label, age, country } = item;
324
+ return (
325
+ <div>
326
+ <div style={ { marginBottom: '0.2rem' } }>{ label }</div>
327
+ <small>
328
+ Age: { age }, Country: { country }
329
+ </small>
330
+ </div>
331
+ );
332
+ },
289
333
  };
@@ -106,15 +106,3 @@ $components-custom-gradient-picker__padding: $grid-unit-20; // 48px container, 1
106
106
  }
107
107
  }
108
108
  }
109
-
110
- // All these styles should be made generic and changed on the inputs for all components.
111
- .components-custom-gradient-picker {
112
- .components-input-control__label {
113
- line-height: 1;
114
- }
115
- label {
116
- text-transform: uppercase;
117
- font-size: 11px;
118
- font-weight: 500;
119
- }
120
- }
@@ -17,6 +17,7 @@ import { useCallback, useState } from '@wordpress/element';
17
17
  import { VisuallyHidden } from '../';
18
18
  import { Select as SelectControlSelect } from '../select-control/styles/select-control-styles';
19
19
  import InputBase from '../input-control/input-base';
20
+ import { StyledLabel } from '../base-control/styles/base-control-styles';
20
21
 
21
22
  const itemToString = ( item ) => item?.name;
22
23
  // This is needed so that in Windows, where
@@ -138,13 +139,13 @@ export default function CustomSelectControl( {
138
139
  </VisuallyHidden>
139
140
  ) : (
140
141
  /* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
141
- <label
142
+ <StyledLabel
142
143
  { ...getLabelProps( {
143
144
  className: 'components-custom-select-control__label',
144
145
  } ) }
145
146
  >
146
147
  { label }
147
- </label>
148
+ </StyledLabel>
148
149
  ) }
149
150
  <InputBase
150
151
  isFocused={ isOpen || isFocused }
@@ -1,10 +1,6 @@
1
1
  .components-custom-select-control {
2
2
  position: relative;
3
- }
4
-
5
- .components-custom-select-control__label {
6
- display: block;
7
- margin-bottom: $grid-unit-10;
3
+ font-size: $default-font-size;
8
4
  }
9
5
 
10
6
  .components-custom-select-control__button {
@@ -12,6 +12,7 @@ import { __ } from '@wordpress/i18n';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
+ import BaseControl from '../../base-control';
15
16
  import Button from '../../button';
16
17
  import ButtonGroup from '../../button-group';
17
18
  import TimeZone from './timezone';
@@ -19,7 +20,6 @@ import type { TimePickerProps } from '../types';
19
20
  import {
20
21
  Wrapper,
21
22
  Fieldset,
22
- Legend,
23
23
  HoursInput,
24
24
  TimeSeparator,
25
25
  MinutesInput,
@@ -220,11 +220,12 @@ export function TimePicker( {
220
220
  className="components-datetime__time" // Unused, for backwards compatibility.
221
221
  >
222
222
  <Fieldset>
223
- <Legend
223
+ <BaseControl.VisualLabel
224
+ as="legend"
224
225
  className="components-datetime__time-legend" // Unused, for backwards compatibility.
225
226
  >
226
227
  { __( 'Time' ) }
227
- </Legend>
228
+ </BaseControl.VisualLabel>
228
229
  <HStack
229
230
  className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
230
231
  >
@@ -309,11 +310,12 @@ export function TimePicker( {
309
310
  </HStack>
310
311
  </Fieldset>
311
312
  <Fieldset>
312
- <Legend
313
+ <BaseControl.VisualLabel
314
+ as="legend"
313
315
  className="components-datetime__time-legend" // Unused, for backwards compatibility.
314
316
  >
315
317
  { __( 'Date' ) }
316
- </Legend>
318
+ </BaseControl.VisualLabel>
317
319
  <HStack
318
320
  className="components-datetime__time-wrapper" // Unused, for backwards compatibility.
319
321
  >
@@ -17,7 +17,9 @@ import NumberControl from '../../number-control';
17
17
  import SelectControl from '../../select-control';
18
18
  import { Select } from '../../select-control/styles/select-control-styles';
19
19
 
20
- export const Wrapper = styled.div``;
20
+ export const Wrapper = styled.div`
21
+ font-size: ${ CONFIG.fontSize };
22
+ `;
21
23
 
22
24
  export const Fieldset = styled.fieldset`
23
25
  border: 0;
@@ -29,11 +31,6 @@ export const Fieldset = styled.fieldset`
29
31
  }
30
32
  `;
31
33
 
32
- export const Legend = styled.legend`
33
- margin-bottom: ${ space( 2 ) };
34
- padding: 0;
35
- `;
36
-
37
34
  export const TimeWrapper = styled.div`
38
35
  direction: ltr;
39
36
  display: flex;
@@ -38,12 +38,22 @@ function UnforwardedExternalLink(
38
38
  ),
39
39
  ].join( ' ' );
40
40
  const classes = classnames( 'components-external-link', className );
41
+ /* Anchor links are percieved as external links.
42
+ This constant helps check for on page anchor links,
43
+ to prevent them from being opened in the editor. */
44
+ const isInternalAnchor = !! href?.startsWith( '#' );
45
+
41
46
  return (
42
47
  /* eslint-disable react/jsx-no-target-blank */
43
48
  <a
44
49
  { ...additionalProps }
45
50
  className={ classes }
46
51
  href={ href }
52
+ onClick={
53
+ isInternalAnchor
54
+ ? ( event ) => event.preventDefault()
55
+ : undefined
56
+ }
47
57
  target="_blank"
48
58
  rel={ optimizedRel }
49
59
  ref={ ref }
@@ -25,38 +25,44 @@ function Example() {
25
25
 
26
26
  ## Props
27
27
 
28
- ##### align
29
-
30
- **Type**: `CSSProperties['alignItems']`
28
+ ### `align`: `CSSProperties['alignItems']`
31
29
 
32
30
  Aligns children using CSS Flexbox `align-items`. Vertically aligns content if the `direction` is `row`, or horizontally aligns content if the `direction` is `column`.
33
31
 
34
- ##### direction
32
+ - Required: No
33
+ - Default: `center`
35
34
 
36
- **Type**: `[ResponsiveCSSValue<CSSProperties['flexDirection']>]`
35
+ ### `direction`: `ResponsiveCSSValue<CSSProperties['flexDirection']>`
37
36
 
38
37
  The direction flow of the children content can be adjusted with `direction`. `column` will align children vertically and `row` will align children horizontally.
39
38
 
40
- ##### expanded
39
+ - Required: No
40
+ - Default: `row`
41
41
 
42
- **Type**: `[boolean]`
42
+ ### `expanded`: `boolean`
43
43
 
44
44
  Expands to the maximum available width (if horizontal) or height (if vertical).
45
45
 
46
- ##### gap
46
+ - Required: No
47
+ - Default: `true`
47
48
 
48
- **Type**: `[number | string]`
49
+ ### `gap`: `number`
49
50
 
50
51
  Spacing in between each child can be adjusted by using `gap`. The value of `gap` works as a multiplier to the library's grid system (base of `4px`).
51
52
 
52
- ##### justify
53
+ - Required: No
54
+ - Default: `2`
53
55
 
54
- **Type**: `[CSSProperties['justifyContent']]`
56
+ ##### `justify`: `CSSProperties['justifyContent']`
55
57
 
56
58
  Horizontally aligns content if the `direction` is `row`, or vertically aligns content if the `direction` is `column`.
57
59
 
58
- ##### wrap
60
+ - Required: No
61
+ - Default: `space-between`
59
62
 
60
- **Type**: `[boolean]`
63
+ ##### `wrap`: `boolean`
61
64
 
62
65
  Determines if children should wrap.
66
+
67
+ - Required: No
68
+ - Default: `false`
@@ -1,16 +1,21 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
1
6
  /**
2
7
  * Internal dependencies
3
8
  */
4
- import { contextConnect } from '../../ui/context';
9
+ import { contextConnect, WordPressComponentProps } from '../../ui/context';
5
10
  import { useFlex } from './hook';
6
11
  import { FlexContext } from './../context';
7
12
  import { View } from '../../view';
13
+ import type { FlexProps } from '../types';
8
14
 
9
- /**
10
- * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
11
- * @param {import('react').ForwardedRef<any>} forwardedRef
12
- */
13
- function Flex( props, forwardedRef ) {
15
+ function UnconnectedFlex(
16
+ props: WordPressComponentProps< FlexProps, 'div' >,
17
+ forwardedRef: ForwardedRef< any >
18
+ ) {
14
19
  const { children, isColumn, ...otherProps } = useFlex( props );
15
20
 
16
21
  return (
@@ -29,9 +34,9 @@ function Flex( props, forwardedRef ) {
29
34
  * horizontally or vertically. `Flex` powers components like `HStack` and
30
35
  * `VStack`.
31
36
  *
32
- * `Flex` is used with any of it's two sub-components, `FlexItem` and `FlexBlock`.
37
+ * `Flex` is used with any of its two sub-components, `FlexItem` and
38
+ * `FlexBlock`.
33
39
  *
34
- * @example
35
40
  * ```jsx
36
41
  * import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
37
42
  *
@@ -49,6 +54,6 @@ function Flex( props, forwardedRef ) {
49
54
  * }
50
55
  * ```
51
56
  */
52
- const ConnectedFlex = contextConnect( Flex, 'Flex' );
57
+ export const Flex = contextConnect( UnconnectedFlex, 'Flex' );
53
58
 
54
- export default ConnectedFlex;
59
+ export default Flex;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { css } from '@emotion/react';
4
+ import { css, SerializedStyles } from '@emotion/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -12,18 +12,18 @@ import deprecated from '@wordpress/deprecated';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import { useContextSystem } from '../../ui/context';
15
+ import { useContextSystem, WordPressComponentProps } from '../../ui/context';
16
16
  import { useResponsiveValue } from '../../ui/utils/use-responsive-value';
17
17
  import { space } from '../../ui/utils/space';
18
18
  import * as styles from '../styles';
19
19
  import { useCx, rtl } from '../../utils';
20
+ import type { FlexProps } from '../types';
21
+
22
+ function useDeprecatedProps(
23
+ props: WordPressComponentProps< FlexProps, 'div' >
24
+ ): WordPressComponentProps< FlexProps, 'div' > {
25
+ const { isReversed, ...otherProps } = props;
20
26
 
21
- /**
22
- *
23
- * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
24
- * @return {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} Props with the deprecated props removed.
25
- */
26
- function useDeprecatedProps( { isReversed, ...otherProps } ) {
27
27
  if ( typeof isReversed !== 'undefined' ) {
28
28
  deprecated( 'Flex isReversed', {
29
29
  alternative: 'Flex direction="row-reverse" or "column-reverse"',
@@ -38,10 +38,7 @@ function useDeprecatedProps( { isReversed, ...otherProps } ) {
38
38
  return otherProps;
39
39
  }
40
40
 
41
- /**
42
- * @param {import('../../ui/context').WordPressComponentProps<import('../types').FlexProps, 'div'>} props
43
- */
44
- export function useFlex( props ) {
41
+ export function useFlex( props: WordPressComponentProps< FlexProps, 'div' > ) {
45
42
  const {
46
43
  align = 'center',
47
44
  className,
@@ -67,7 +64,11 @@ export function useFlex( props ) {
67
64
  const rtlWatchResult = rtl.watch();
68
65
 
69
66
  const classes = useMemo( () => {
70
- const sx = {};
67
+ const sx: {
68
+ Base?: SerializedStyles;
69
+ Items?: SerializedStyles;
70
+ WrapItems?: SerializedStyles;
71
+ } = {};
71
72
 
72
73
  sx.Base = css( {
73
74
  alignItems: isColumn ? 'normal' : align,
File without changes
@@ -8,8 +8,8 @@ See [`flex/README.md#usage`](/packages/components/src/flex/README.md#usage) for
8
8
 
9
9
  ## Props
10
10
 
11
- ### display
12
-
13
- **Type**: `[CSSProperties['display']]`
11
+ ### `display`: `CSSProperties['display']`
14
12
 
15
13
  The CSS display property of `FlexBlock`.
14
+
15
+ - Required: No