@wordpress/components 19.12.0 → 19.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (717) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/CONTRIBUTING.md +94 -12
  3. package/build/alignment-matrix-control/index.js +3 -3
  4. package/build/alignment-matrix-control/index.js.map +1 -1
  5. package/build/angle-picker-control/index.js +2 -2
  6. package/build/angle-picker-control/index.js.map +1 -1
  7. package/build/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  8. package/build/border-box-control/utils.js.map +1 -1
  9. package/build/border-control/border-control/hook.js.map +1 -1
  10. package/build/box-control/all-input-control.js +6 -10
  11. package/build/box-control/all-input-control.js.map +1 -1
  12. package/build/box-control/axial-input-controls.js.map +1 -1
  13. package/build/box-control/index.js +3 -7
  14. package/build/box-control/index.js.map +1 -1
  15. package/build/box-control/input-controls.js +6 -10
  16. package/build/box-control/input-controls.js.map +1 -1
  17. package/build/box-control/unit-control.js +4 -4
  18. package/build/box-control/unit-control.js.map +1 -1
  19. package/build/button/index.native.js +1 -3
  20. package/build/button/index.native.js.map +1 -1
  21. package/build/checkbox-control/index.js.map +1 -1
  22. package/build/color-picker/index.native.js.map +1 -1
  23. package/build/combobox-control/index.js +4 -2
  24. package/build/combobox-control/index.js.map +1 -1
  25. package/build/confirm-dialog/component.js.map +1 -1
  26. package/build/custom-gradient-bar/constants.js +1 -3
  27. package/build/custom-gradient-bar/constants.js.map +1 -1
  28. package/build/custom-gradient-bar/control-points.js +15 -8
  29. package/build/custom-gradient-bar/control-points.js.map +1 -1
  30. package/build/custom-gradient-bar/index.js +5 -5
  31. package/build/custom-gradient-bar/index.js.map +1 -1
  32. package/build/custom-gradient-bar/utils.js +5 -7
  33. package/build/custom-gradient-bar/utils.js.map +1 -1
  34. package/build/custom-gradient-picker/utils.js.map +1 -1
  35. package/build/custom-select-control/index.js.map +1 -1
  36. package/build/date-time/date/index.js +4 -4
  37. package/build/date-time/date/index.js.map +1 -1
  38. package/build/date-time/date-time/index.js +3 -3
  39. package/build/date-time/date-time/index.js.map +1 -1
  40. package/build/dimension-control/index.js +1 -3
  41. package/build/dimension-control/index.js.map +1 -1
  42. package/build/divider/styles.js +5 -5
  43. package/build/divider/styles.js.map +1 -1
  44. package/build/draggable/index.js.map +1 -1
  45. package/build/draggable/index.native.js +6 -1
  46. package/build/draggable/index.native.js.map +1 -1
  47. package/build/drop-zone/provider.js.map +1 -1
  48. package/build/dropdown/index.js +2 -2
  49. package/build/dropdown/index.js.map +1 -1
  50. package/build/dropdown-menu/index.js +13 -2
  51. package/build/dropdown-menu/index.js.map +1 -1
  52. package/build/dropdown-menu/index.native.js +13 -2
  53. package/build/dropdown-menu/index.native.js.map +1 -1
  54. package/build/external-link/index.js +20 -8
  55. package/build/external-link/index.js.map +1 -1
  56. package/build/external-link/styles/external-link-styles.js +3 -3
  57. package/build/external-link/styles/external-link-styles.js.map +1 -1
  58. package/build/external-link/types.js +6 -0
  59. package/build/external-link/types.js.map +1 -0
  60. package/build/flex/flex/hook.js +9 -5
  61. package/build/flex/flex/hook.js.map +1 -1
  62. package/build/focal-point-picker/controls.js +3 -7
  63. package/build/focal-point-picker/controls.js.map +1 -1
  64. package/build/focal-point-picker/index.js.map +1 -1
  65. package/build/focal-point-picker/media.js +4 -8
  66. package/build/focal-point-picker/media.js.map +1 -1
  67. package/build/font-size-picker/index.js +1 -1
  68. package/build/font-size-picker/index.js.map +1 -1
  69. package/build/form-toggle/index.js +6 -4
  70. package/build/form-toggle/index.js.map +1 -1
  71. package/build/form-token-field/index.js +328 -359
  72. package/build/form-token-field/index.js.map +1 -1
  73. package/build/form-token-field/suggestions-list.js +26 -20
  74. package/build/form-token-field/suggestions-list.js.map +1 -1
  75. package/build/form-token-field/token-input.js +39 -53
  76. package/build/form-token-field/token-input.js.map +1 -1
  77. package/build/form-token-field/token.js +3 -3
  78. package/build/form-token-field/token.js.map +1 -1
  79. package/build/form-token-field/types.js +6 -0
  80. package/build/form-token-field/types.js.map +1 -0
  81. package/build/gradient-picker/index.js.map +1 -1
  82. package/build/heading/hook.js.map +1 -1
  83. package/build/higher-order/navigate-regions/index.js.map +1 -1
  84. package/build/higher-order/with-focus-return/index.js.map +1 -1
  85. package/build/higher-order/with-spoken-messages/index.js.map +1 -1
  86. package/build/icon/index.js.map +1 -1
  87. package/build/input-control/index.js +5 -5
  88. package/build/input-control/index.js.map +1 -1
  89. package/build/input-control/input-field.js +10 -10
  90. package/build/input-control/input-field.js.map +1 -1
  91. package/build/input-control/reducer/reducer.js.map +1 -1
  92. package/build/input-control/utils.js +1 -1
  93. package/build/input-control/utils.js.map +1 -1
  94. package/build/menu-items-choice/index.js +3 -7
  95. package/build/menu-items-choice/index.js.map +1 -1
  96. package/build/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  97. package/build/mobile/bottom-sheet/cell.native.js.map +1 -1
  98. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -7
  99. package/build/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  100. package/build/mobile/bottom-sheet/index.native.js.map +1 -1
  101. package/build/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  102. package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  103. package/build/mobile/color-settings/index.native.js.map +1 -1
  104. package/build/mobile/global-styles-context/index.native.js.map +1 -1
  105. package/build/mobile/gradient/index.native.js.map +1 -1
  106. package/build/mobile/html-text-input/index.native.js.map +1 -1
  107. package/build/mobile/inserter-button/index.native.js.map +1 -1
  108. package/build/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  109. package/build/mobile/media-edit/index.native.js.map +1 -1
  110. package/build/mobile/segmented-control/index.native.js +1 -1
  111. package/build/mobile/segmented-control/index.native.js.map +1 -1
  112. package/build/modal/index.js +1 -1
  113. package/build/modal/index.js.map +1 -1
  114. package/build/navigable-container/container.js +4 -2
  115. package/build/navigable-container/container.js.map +1 -1
  116. package/build/navigation/context.js +12 -16
  117. package/build/navigation/context.js.map +1 -1
  118. package/build/navigation/index.js +3 -3
  119. package/build/navigation/index.js.map +1 -1
  120. package/build/navigation/item/index.js +3 -3
  121. package/build/navigation/item/index.js.map +1 -1
  122. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  123. package/build/navigator/navigator-button/hook.js.map +1 -1
  124. package/build/navigator/navigator-provider/component.js +1 -1
  125. package/build/navigator/navigator-provider/component.js.map +1 -1
  126. package/build/navigator/navigator-screen/component.js +1 -1
  127. package/build/navigator/navigator-screen/component.js.map +1 -1
  128. package/build/notice/index.js +5 -5
  129. package/build/notice/index.js.map +1 -1
  130. package/build/notice/list.js +4 -2
  131. package/build/notice/list.js.map +1 -1
  132. package/build/panel/body.js +3 -3
  133. package/build/panel/body.js.map +1 -1
  134. package/build/placeholder/index.js +26 -12
  135. package/build/placeholder/index.js.map +1 -1
  136. package/build/radio-control/index.js +43 -7
  137. package/build/radio-control/index.js.map +1 -1
  138. package/build/radio-control/types.js +6 -0
  139. package/build/radio-control/types.js.map +1 -0
  140. package/build/range-control/index.js +8 -6
  141. package/build/range-control/index.js.map +1 -1
  142. package/build/range-control/input-range.js +6 -10
  143. package/build/range-control/input-range.js.map +1 -1
  144. package/build/range-control/utils.js +7 -5
  145. package/build/range-control/utils.js.map +1 -1
  146. package/build/resizable-box/resize-tooltip/index.js +3 -3
  147. package/build/resizable-box/resize-tooltip/index.js.map +1 -1
  148. package/build/resizable-box/resize-tooltip/utils.js +4 -7
  149. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  150. package/build/responsive-wrapper/index.js.map +1 -1
  151. package/build/select-control/index.js +5 -3
  152. package/build/select-control/index.js.map +1 -1
  153. package/build/slot-fill/fill.js +1 -7
  154. package/build/slot-fill/fill.js.map +1 -1
  155. package/build/slot-fill/slot.js +14 -3
  156. package/build/slot-fill/slot.js.map +1 -1
  157. package/build/snackbar/index.js +7 -7
  158. package/build/snackbar/index.js.map +1 -1
  159. package/build/snackbar/list.js +3 -1
  160. package/build/snackbar/list.js.map +1 -1
  161. package/build/tab-panel/index.js +3 -1
  162. package/build/tab-panel/index.js.map +1 -1
  163. package/build/text/hook.js +4 -4
  164. package/build/text/hook.js.map +1 -1
  165. package/build/text/utils.js.map +1 -1
  166. package/build/toggle-control/index.js +1 -3
  167. package/build/toggle-control/index.js.map +1 -1
  168. package/build/toggle-control/index.native.js +1 -7
  169. package/build/toggle-control/index.native.js.map +1 -1
  170. package/build/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  171. package/build/toolbar/index.js.map +1 -1
  172. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  173. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  174. package/build/tooltip/index.js +2 -1
  175. package/build/tooltip/index.js.map +1 -1
  176. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  177. package/build/tree-select/index.js +57 -4
  178. package/build/tree-select/index.js.map +1 -1
  179. package/build/tree-select/types.js +6 -0
  180. package/build/tree-select/types.js.map +1 -0
  181. package/build/ui/form-group/form-group-content.js.map +1 -1
  182. package/build/unit-control/index.js.map +1 -1
  183. package/build/utils/unit-values.js.map +1 -1
  184. package/build/utils/values.js.map +1 -1
  185. package/build/z-stack/component.js +22 -3
  186. package/build/z-stack/component.js.map +1 -1
  187. package/build/z-stack/types.js +6 -0
  188. package/build/z-stack/types.js.map +1 -0
  189. package/build-module/alignment-matrix-control/index.js +2 -1
  190. package/build-module/alignment-matrix-control/index.js.map +1 -1
  191. package/build-module/angle-picker-control/index.js +1 -1
  192. package/build-module/angle-picker-control/index.js.map +1 -1
  193. package/build-module/border-box-control/border-box-control-linked-button/component.js.map +1 -1
  194. package/build-module/border-box-control/utils.js.map +1 -1
  195. package/build-module/border-control/border-control/hook.js.map +1 -1
  196. package/build-module/box-control/all-input-control.js +3 -5
  197. package/build-module/box-control/all-input-control.js.map +1 -1
  198. package/build-module/box-control/axial-input-controls.js.map +1 -1
  199. package/build-module/box-control/index.js +2 -5
  200. package/build-module/box-control/index.js.map +1 -1
  201. package/build-module/box-control/input-controls.js +3 -5
  202. package/build-module/box-control/input-controls.js.map +1 -1
  203. package/build-module/box-control/unit-control.js +3 -1
  204. package/build-module/box-control/unit-control.js.map +1 -1
  205. package/build-module/button/index.native.js +1 -2
  206. package/build-module/button/index.native.js.map +1 -1
  207. package/build-module/checkbox-control/index.js.map +1 -1
  208. package/build-module/color-picker/index.native.js.map +1 -1
  209. package/build-module/combobox-control/index.js +5 -2
  210. package/build-module/combobox-control/index.js.map +1 -1
  211. package/build-module/confirm-dialog/component.js.map +1 -1
  212. package/build-module/custom-gradient-bar/constants.js +0 -1
  213. package/build-module/custom-gradient-bar/constants.js.map +1 -1
  214. package/build-module/custom-gradient-bar/control-points.js +16 -9
  215. package/build-module/custom-gradient-bar/control-points.js.map +1 -1
  216. package/build-module/custom-gradient-bar/index.js +6 -6
  217. package/build-module/custom-gradient-bar/index.js.map +1 -1
  218. package/build-module/custom-gradient-bar/utils.js +6 -8
  219. package/build-module/custom-gradient-bar/utils.js.map +1 -1
  220. package/build-module/custom-gradient-picker/utils.js.map +1 -1
  221. package/build-module/custom-select-control/index.js.map +1 -1
  222. package/build-module/date-time/date/index.js +4 -3
  223. package/build-module/date-time/date/index.js.map +1 -1
  224. package/build-module/date-time/date-time/index.js +2 -1
  225. package/build-module/date-time/date-time/index.js.map +1 -1
  226. package/build-module/dimension-control/index.js +1 -2
  227. package/build-module/dimension-control/index.js.map +1 -1
  228. package/build-module/divider/styles.js +5 -5
  229. package/build-module/divider/styles.js.map +1 -1
  230. package/build-module/draggable/index.js.map +1 -1
  231. package/build-module/draggable/index.native.js +6 -1
  232. package/build-module/draggable/index.native.js.map +1 -1
  233. package/build-module/drop-zone/provider.js.map +1 -1
  234. package/build-module/dropdown/index.js +2 -2
  235. package/build-module/dropdown/index.js.map +1 -1
  236. package/build-module/dropdown-menu/index.js +12 -1
  237. package/build-module/dropdown-menu/index.js.map +1 -1
  238. package/build-module/dropdown-menu/index.native.js +12 -1
  239. package/build-module/dropdown-menu/index.native.js.map +1 -1
  240. package/build-module/external-link/index.js +22 -7
  241. package/build-module/external-link/index.js.map +1 -1
  242. package/build-module/external-link/styles/external-link-styles.js +3 -3
  243. package/build-module/external-link/styles/external-link-styles.js.map +1 -1
  244. package/build-module/external-link/types.js +2 -0
  245. package/build-module/external-link/types.js.map +1 -0
  246. package/build-module/flex/flex/hook.js +7 -5
  247. package/build-module/flex/flex/hook.js.map +1 -1
  248. package/build-module/focal-point-picker/controls.js +3 -5
  249. package/build-module/focal-point-picker/controls.js.map +1 -1
  250. package/build-module/focal-point-picker/index.js.map +1 -1
  251. package/build-module/focal-point-picker/media.js +3 -5
  252. package/build-module/focal-point-picker/media.js.map +1 -1
  253. package/build-module/font-size-picker/index.js +1 -1
  254. package/build-module/font-size-picker/index.js.map +1 -1
  255. package/build-module/form-toggle/index.js +1 -1
  256. package/build-module/form-toggle/index.js.map +1 -1
  257. package/build-module/form-token-field/index.js +329 -361
  258. package/build-module/form-token-field/index.js.map +1 -1
  259. package/build-module/form-token-field/suggestions-list.js +32 -23
  260. package/build-module/form-token-field/suggestions-list.js.map +1 -1
  261. package/build-module/form-token-field/token-input.js +43 -58
  262. package/build-module/form-token-field/token-input.js.map +1 -1
  263. package/build-module/form-token-field/token.js +3 -1
  264. package/build-module/form-token-field/token.js.map +1 -1
  265. package/build-module/form-token-field/types.js +2 -0
  266. package/build-module/form-token-field/types.js.map +1 -0
  267. package/build-module/gradient-picker/index.js.map +1 -1
  268. package/build-module/heading/hook.js.map +1 -1
  269. package/build-module/higher-order/navigate-regions/index.js.map +1 -1
  270. package/build-module/higher-order/with-focus-return/index.js.map +1 -1
  271. package/build-module/higher-order/with-spoken-messages/index.js.map +1 -1
  272. package/build-module/icon/index.js.map +1 -1
  273. package/build-module/input-control/index.js +2 -1
  274. package/build-module/input-control/index.js.map +1 -1
  275. package/build-module/input-control/input-field.js +2 -1
  276. package/build-module/input-control/input-field.js.map +1 -1
  277. package/build-module/input-control/reducer/reducer.js.map +1 -1
  278. package/build-module/input-control/utils.js +1 -1
  279. package/build-module/input-control/utils.js.map +1 -1
  280. package/build-module/menu-items-choice/index.js +3 -5
  281. package/build-module/menu-items-choice/index.js.map +1 -1
  282. package/build-module/mobile/bottom-sheet/bottom-sheet-context.native.js.map +1 -1
  283. package/build-module/mobile/bottom-sheet/cell.native.js.map +1 -1
  284. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js +1 -6
  285. package/build-module/mobile/bottom-sheet/cycle-picker-cell.native.js.map +1 -1
  286. package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
  287. package/build-module/mobile/bottom-sheet/picker-cell.native.js.map +1 -1
  288. package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
  289. package/build-module/mobile/color-settings/index.native.js.map +1 -1
  290. package/build-module/mobile/global-styles-context/index.native.js.map +1 -1
  291. package/build-module/mobile/gradient/index.native.js.map +1 -1
  292. package/build-module/mobile/html-text-input/index.native.js.map +1 -1
  293. package/build-module/mobile/inserter-button/index.native.js.map +1 -1
  294. package/build-module/mobile/link-settings/image-link-destinations-screen.native.js.map +1 -1
  295. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  296. package/build-module/mobile/segmented-control/index.native.js +2 -2
  297. package/build-module/mobile/segmented-control/index.native.js.map +1 -1
  298. package/build-module/modal/index.js +1 -1
  299. package/build-module/modal/index.js.map +1 -1
  300. package/build-module/navigable-container/container.js +5 -2
  301. package/build-module/navigable-container/container.js.map +1 -1
  302. package/build-module/navigation/context.js +3 -5
  303. package/build-module/navigation/context.js.map +1 -1
  304. package/build-module/navigation/index.js +3 -1
  305. package/build-module/navigation/index.js.map +1 -1
  306. package/build-module/navigation/item/index.js +3 -1
  307. package/build-module/navigation/item/index.js.map +1 -1
  308. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  309. package/build-module/navigator/navigator-button/hook.js.map +1 -1
  310. package/build-module/navigator/navigator-provider/component.js +1 -1
  311. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  312. package/build-module/navigator/navigator-screen/component.js +1 -1
  313. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  314. package/build-module/notice/index.js +2 -1
  315. package/build-module/notice/index.js.map +1 -1
  316. package/build-module/notice/list.js +4 -1
  317. package/build-module/notice/list.js.map +1 -1
  318. package/build-module/panel/body.js +3 -1
  319. package/build-module/panel/body.js.map +1 -1
  320. package/build-module/placeholder/index.js +24 -11
  321. package/build-module/placeholder/index.js.map +1 -1
  322. package/build-module/radio-control/index.js +40 -7
  323. package/build-module/radio-control/index.js.map +1 -1
  324. package/build-module/radio-control/types.js +2 -0
  325. package/build-module/radio-control/types.js.map +1 -0
  326. package/build-module/range-control/index.js +4 -2
  327. package/build-module/range-control/index.js.map +1 -1
  328. package/build-module/range-control/input-range.js +2 -5
  329. package/build-module/range-control/input-range.js.map +1 -1
  330. package/build-module/range-control/utils.js +4 -1
  331. package/build-module/range-control/utils.js.map +1 -1
  332. package/build-module/resizable-box/resize-tooltip/index.js +2 -1
  333. package/build-module/resizable-box/resize-tooltip/index.js.map +1 -1
  334. package/build-module/resizable-box/resize-tooltip/utils.js +3 -5
  335. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  336. package/build-module/responsive-wrapper/index.js.map +1 -1
  337. package/build-module/select-control/index.js +3 -1
  338. package/build-module/select-control/index.js.map +1 -1
  339. package/build-module/slot-fill/fill.js +1 -6
  340. package/build-module/slot-fill/fill.js.map +1 -1
  341. package/build-module/slot-fill/slot.js +12 -2
  342. package/build-module/slot-fill/slot.js.map +1 -1
  343. package/build-module/snackbar/index.js +3 -1
  344. package/build-module/snackbar/index.js.map +1 -1
  345. package/build-module/snackbar/list.js +4 -1
  346. package/build-module/snackbar/list.js.map +1 -1
  347. package/build-module/tab-panel/index.js +3 -1
  348. package/build-module/tab-panel/index.js.map +1 -1
  349. package/build-module/text/hook.js +4 -4
  350. package/build-module/text/hook.js.map +1 -1
  351. package/build-module/text/utils.js.map +1 -1
  352. package/build-module/toggle-control/index.js +1 -2
  353. package/build-module/toggle-control/index.js.map +1 -1
  354. package/build-module/toggle-control/index.native.js +1 -6
  355. package/build-module/toggle-control/index.native.js.map +1 -1
  356. package/build-module/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.js.map +1 -1
  357. package/build-module/toolbar/index.js.map +1 -1
  358. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  359. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  360. package/build-module/tooltip/index.js +2 -1
  361. package/build-module/tooltip/index.js.map +1 -1
  362. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  363. package/build-module/tree-select/index.js +53 -3
  364. package/build-module/tree-select/index.js.map +1 -1
  365. package/build-module/tree-select/types.js +2 -0
  366. package/build-module/tree-select/types.js.map +1 -0
  367. package/build-module/ui/form-group/form-group-content.js.map +1 -1
  368. package/build-module/unit-control/index.js.map +1 -1
  369. package/build-module/utils/unit-values.js.map +1 -1
  370. package/build-module/utils/values.js.map +1 -1
  371. package/build-module/z-stack/component.js +21 -2
  372. package/build-module/z-stack/component.js.map +1 -1
  373. package/build-module/z-stack/types.js +2 -0
  374. package/build-module/z-stack/types.js.map +1 -0
  375. package/build-style/style-rtl.css +32 -3
  376. package/build-style/style.css +32 -4
  377. package/build-types/base-control/stories/index.d.ts.map +1 -1
  378. package/build-types/base-field/hook.d.ts +0 -1
  379. package/build-types/base-field/hook.d.ts.map +1 -1
  380. package/build-types/border-box-control/border-box-control/hook.d.ts +0 -1
  381. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  382. package/build-types/border-box-control/border-box-control-linked-button/component.d.ts.map +1 -1
  383. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +0 -1
  384. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts.map +1 -1
  385. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +0 -1
  386. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts.map +1 -1
  387. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +0 -1
  388. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts.map +1 -1
  389. package/build-types/border-box-control/utils.d.ts.map +1 -1
  390. package/build-types/border-control/border-control/hook.d.ts +0 -1
  391. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  392. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  393. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  394. package/build-types/border-control/border-control-style-picker/hook.d.ts +0 -1
  395. package/build-types/border-control/border-control-style-picker/hook.d.ts.map +1 -1
  396. package/build-types/button-group/index.d.ts +1 -1
  397. package/build-types/button-group/index.d.ts.map +1 -1
  398. package/build-types/card/card/hook.d.ts +0 -1
  399. package/build-types/card/card/hook.d.ts.map +1 -1
  400. package/build-types/card/card-body/hook.d.ts +0 -1
  401. package/build-types/card/card-body/hook.d.ts.map +1 -1
  402. package/build-types/card/card-divider/hook.d.ts +0 -1
  403. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  404. package/build-types/card/card-footer/hook.d.ts +0 -1
  405. package/build-types/card/card-footer/hook.d.ts.map +1 -1
  406. package/build-types/card/card-header/hook.d.ts +0 -1
  407. package/build-types/card/card-header/hook.d.ts.map +1 -1
  408. package/build-types/card/card-media/hook.d.ts +0 -1
  409. package/build-types/card/card-media/hook.d.ts.map +1 -1
  410. package/build-types/checkbox-control/index.d.ts.map +1 -1
  411. package/build-types/checkbox-control/stories/index.d.ts.map +1 -1
  412. package/build-types/color-picker/styles.d.ts +7 -7
  413. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  414. package/build-types/date-time/date/index.d.ts.map +1 -1
  415. package/build-types/date-time/date-time/index.d.ts.map +1 -1
  416. package/build-types/date-time/stories/date-time.d.ts.map +1 -1
  417. package/build-types/date-time/stories/date.d.ts.map +1 -1
  418. package/build-types/date-time/time/styles.d.ts +1 -1
  419. package/build-types/divider/styles.d.ts.map +1 -1
  420. package/build-types/dropdown-menu/index.d.ts.map +1 -1
  421. package/build-types/elevation/hook.d.ts +0 -1
  422. package/build-types/elevation/hook.d.ts.map +1 -1
  423. package/build-types/external-link/index.d.ts +17 -0
  424. package/build-types/external-link/index.d.ts.map +1 -0
  425. package/build-types/external-link/stories/index.d.ts +12 -0
  426. package/build-types/external-link/stories/index.d.ts.map +1 -0
  427. package/build-types/external-link/styles/external-link-styles.d.ts +10 -0
  428. package/build-types/external-link/styles/external-link-styles.d.ts.map +1 -0
  429. package/build-types/external-link/types.d.ts +15 -0
  430. package/build-types/external-link/types.d.ts.map +1 -0
  431. package/build-types/flex/flex/hook.d.ts +0 -1
  432. package/build-types/flex/flex/hook.d.ts.map +1 -1
  433. package/build-types/flex/flex-block/hook.d.ts +0 -1
  434. package/build-types/flex/flex-block/hook.d.ts.map +1 -1
  435. package/build-types/flex/flex-item/hook.d.ts +0 -1
  436. package/build-types/flex/flex-item/hook.d.ts.map +1 -1
  437. package/build-types/form-token-field/index.d.ts +15 -0
  438. package/build-types/form-token-field/index.d.ts.map +1 -0
  439. package/build-types/form-token-field/stories/index.d.ts +13 -0
  440. package/build-types/form-token-field/stories/index.d.ts.map +1 -0
  441. package/build-types/form-token-field/suggestions-list.d.ts +10 -0
  442. package/build-types/form-token-field/suggestions-list.d.ts.map +1 -0
  443. package/build-types/form-token-field/test/lib/fixtures.d.ts +26 -0
  444. package/build-types/form-token-field/test/lib/fixtures.d.ts.map +1 -0
  445. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts +18 -0
  446. package/build-types/form-token-field/test/lib/token-field-wrapper.d.ts.map +1 -0
  447. package/build-types/form-token-field/token-input.d.ts +12 -0
  448. package/build-types/form-token-field/token-input.d.ts.map +1 -0
  449. package/build-types/form-token-field/token.d.ts +4 -0
  450. package/build-types/form-token-field/token.d.ts.map +1 -0
  451. package/build-types/form-token-field/types.d.ts +176 -0
  452. package/build-types/form-token-field/types.d.ts.map +1 -0
  453. package/build-types/grid/hook.d.ts +0 -1
  454. package/build-types/grid/hook.d.ts.map +1 -1
  455. package/build-types/h-stack/hook.d.ts +0 -1
  456. package/build-types/h-stack/hook.d.ts.map +1 -1
  457. package/build-types/heading/hook.d.ts +0 -1
  458. package/build-types/heading/hook.d.ts.map +1 -1
  459. package/build-types/higher-order/with-focus-outside/index.d.ts +1 -1
  460. package/build-types/input-control/index.d.ts +1 -1
  461. package/build-types/input-control/index.d.ts.map +1 -1
  462. package/build-types/input-control/input-field.d.ts +1 -1
  463. package/build-types/input-control/input-field.d.ts.map +1 -1
  464. package/build-types/input-control/reducer/reducer.d.ts.map +1 -1
  465. package/build-types/input-control/stories/index.d.ts +5 -5
  466. package/build-types/input-control/stories/index.d.ts.map +1 -1
  467. package/build-types/item-group/item/hook.d.ts +0 -1
  468. package/build-types/item-group/item/hook.d.ts.map +1 -1
  469. package/build-types/item-group/item-group/hook.d.ts +0 -1
  470. package/build-types/item-group/item-group/hook.d.ts.map +1 -1
  471. package/build-types/navigator/navigator-back-button/hook.d.ts +0 -1
  472. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  473. package/build-types/navigator/navigator-button/hook.d.ts +0 -1
  474. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  475. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  476. package/build-types/number-control/styles/number-control-styles.d.ts +1 -1
  477. package/build-types/radio-control/index.d.ts +31 -0
  478. package/build-types/radio-control/index.d.ts.map +1 -0
  479. package/build-types/radio-control/stories/index.d.ts +12 -0
  480. package/build-types/radio-control/stories/index.d.ts.map +1 -0
  481. package/build-types/radio-control/types.d.ts +29 -0
  482. package/build-types/radio-control/types.d.ts.map +1 -0
  483. package/build-types/range-control/index.d.ts +5 -5
  484. package/build-types/range-control/index.d.ts.map +1 -1
  485. package/build-types/range-control/input-range.d.ts +4 -4
  486. package/build-types/range-control/input-range.d.ts.map +1 -1
  487. package/build-types/range-control/utils.d.ts.map +1 -1
  488. package/build-types/resizable-box/resize-tooltip/index.d.ts.map +1 -1
  489. package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
  490. package/build-types/scrollable/hook.d.ts +0 -1
  491. package/build-types/scrollable/hook.d.ts.map +1 -1
  492. package/build-types/select-control/index.d.ts +1 -1
  493. package/build-types/select-control/index.d.ts.map +1 -1
  494. package/build-types/select-control/stories/index.d.ts +3 -3
  495. package/build-types/select-control/stories/index.d.ts.map +1 -1
  496. package/build-types/slot-fill/fill.d.ts.map +1 -1
  497. package/build-types/slot-fill/slot.d.ts.map +1 -1
  498. package/build-types/spacer/hook.d.ts +0 -1
  499. package/build-types/spacer/hook.d.ts.map +1 -1
  500. package/build-types/surface/hook.d.ts +0 -1
  501. package/build-types/surface/hook.d.ts.map +1 -1
  502. package/build-types/text/hook.d.ts +0 -1
  503. package/build-types/text/hook.d.ts.map +1 -1
  504. package/build-types/text/utils.d.ts.map +1 -1
  505. package/build-types/text-control/index.d.ts +1 -1
  506. package/build-types/text-control/index.d.ts.map +1 -1
  507. package/build-types/text-control/stories/index.d.ts.map +1 -1
  508. package/build-types/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.d.ts.map +1 -1
  509. package/build-types/tools-panel/tools-panel/hook.d.ts +0 -1
  510. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  511. package/build-types/tools-panel/tools-panel-header/hook.d.ts +0 -1
  512. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  513. package/build-types/tools-panel/tools-panel-item/hook.d.ts +0 -1
  514. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  515. package/build-types/tooltip/index.d.ts.map +1 -1
  516. package/build-types/tree-select/index.d.ts +53 -0
  517. package/build-types/tree-select/index.d.ts.map +1 -0
  518. package/build-types/tree-select/stories/index.d.ts +12 -0
  519. package/build-types/tree-select/stories/index.d.ts.map +1 -0
  520. package/build-types/tree-select/types.d.ts +30 -0
  521. package/build-types/tree-select/types.d.ts.map +1 -0
  522. package/build-types/truncate/hook.d.ts +0 -1
  523. package/build-types/truncate/hook.d.ts.map +1 -1
  524. package/build-types/ui/context/wordpress-component.d.ts.map +1 -1
  525. package/build-types/ui/control-group/hook.d.ts +0 -1
  526. package/build-types/ui/control-group/hook.d.ts.map +1 -1
  527. package/build-types/ui/control-label/hook.d.ts +0 -1
  528. package/build-types/ui/control-label/hook.d.ts.map +1 -1
  529. package/build-types/ui/form-group/use-form-group.d.ts +0 -2
  530. package/build-types/ui/form-group/use-form-group.d.ts.map +1 -1
  531. package/build-types/unit-control/index.d.ts +1 -1
  532. package/build-types/unit-control/index.d.ts.map +1 -1
  533. package/build-types/unit-control/stories/index.d.ts.map +1 -1
  534. package/build-types/utils/unit-values.d.ts.map +1 -1
  535. package/build-types/utils/values.d.ts.map +1 -1
  536. package/build-types/v-stack/hook.d.ts +0 -1
  537. package/build-types/v-stack/hook.d.ts.map +1 -1
  538. package/build-types/z-stack/component.d.ts +18 -28
  539. package/build-types/z-stack/component.d.ts.map +1 -1
  540. package/build-types/z-stack/stories/index.d.ts +6 -0
  541. package/build-types/z-stack/stories/index.d.ts.map +1 -0
  542. package/build-types/z-stack/types.d.ts +33 -0
  543. package/build-types/z-stack/types.d.ts.map +1 -0
  544. package/package.json +17 -17
  545. package/src/alignment-matrix-control/index.js +2 -1
  546. package/src/angle-picker-control/index.js +1 -1
  547. package/src/base-control/stories/index.tsx +2 -3
  548. package/src/border-box-control/border-box-control-linked-button/component.tsx +2 -5
  549. package/src/border-box-control/utils.ts +5 -2
  550. package/src/border-control/border-control/hook.ts +2 -3
  551. package/src/box-control/all-input-control.js +2 -4
  552. package/src/box-control/axial-input-controls.js +4 -6
  553. package/src/box-control/index.js +2 -5
  554. package/src/box-control/input-controls.js +33 -36
  555. package/src/box-control/unit-control.js +2 -1
  556. package/src/button/index.native.js +1 -2
  557. package/src/card/stories/index.js +10 -5
  558. package/src/checkbox-control/index.tsx +2 -3
  559. package/src/checkbox-control/stories/index.tsx +2 -3
  560. package/src/checkbox-control/test/index.tsx +2 -1
  561. package/src/color-picker/index.native.js +7 -4
  562. package/src/combobox-control/index.js +4 -2
  563. package/src/confirm-dialog/component.tsx +7 -8
  564. package/src/custom-gradient-bar/constants.js +2 -2
  565. package/src/custom-gradient-bar/control-points.js +20 -16
  566. package/src/custom-gradient-bar/index.js +11 -11
  567. package/src/custom-gradient-bar/test/utils.js +79 -0
  568. package/src/custom-gradient-bar/utils.js +6 -18
  569. package/src/custom-gradient-picker/style.scss +1 -3
  570. package/src/custom-gradient-picker/utils.js +4 -3
  571. package/src/custom-select-control/index.js +2 -1
  572. package/src/custom-select-control/stories/index.js +1 -2
  573. package/src/date-time/date/index.tsx +2 -2
  574. package/src/date-time/date/style.scss +10 -0
  575. package/src/date-time/date/test/index.tsx +1 -1
  576. package/src/date-time/date-time/index.tsx +6 -8
  577. package/src/date-time/stories/date-time.tsx +4 -6
  578. package/src/date-time/stories/date.tsx +2 -3
  579. package/src/date-time/time/test/index.tsx +12 -12
  580. package/src/dimension-control/index.js +1 -2
  581. package/src/divider/styles.ts +2 -3
  582. package/src/draggable/index.js +3 -3
  583. package/src/draggable/index.native.js +12 -4
  584. package/src/drop-zone/provider.js +1 -2
  585. package/src/dropdown/index.js +2 -2
  586. package/src/dropdown-menu/index.js +11 -1
  587. package/src/dropdown-menu/index.native.js +11 -1
  588. package/src/external-link/README.md +18 -0
  589. package/src/external-link/{index.js → index.tsx} +26 -6
  590. package/src/external-link/stories/index.tsx +36 -0
  591. package/src/external-link/styles/{external-link-styles.js → external-link-styles.ts} +0 -0
  592. package/src/external-link/types.ts +15 -0
  593. package/src/flex/flex/hook.js +4 -1
  594. package/src/focal-point-picker/controls.js +1 -5
  595. package/src/focal-point-picker/index.js +2 -8
  596. package/src/focal-point-picker/media.js +2 -5
  597. package/src/font-size-picker/index.js +3 -1
  598. package/src/form-toggle/index.js +2 -1
  599. package/src/form-toggle/test/index.js +1 -2
  600. package/src/form-token-field/index.tsx +694 -0
  601. package/src/form-token-field/stories/index.tsx +103 -0
  602. package/src/form-token-field/style.scss +2 -1
  603. package/src/form-token-field/{suggestions-list.js → suggestions-list.tsx} +45 -29
  604. package/src/form-token-field/test/index.js +64 -31
  605. package/src/form-token-field/test/lib/{token-field-wrapper.js → token-field-wrapper.tsx} +24 -9
  606. package/src/form-token-field/token-input.tsx +76 -0
  607. package/src/form-token-field/{token.js → token.tsx} +4 -2
  608. package/src/form-token-field/types.ts +178 -0
  609. package/src/gradient-picker/index.js +4 -3
  610. package/src/heading/hook.ts +5 -4
  611. package/src/higher-order/navigate-regions/index.js +7 -5
  612. package/src/higher-order/with-filters/test/index.js +43 -36
  613. package/src/higher-order/with-focus-return/index.js +14 -13
  614. package/src/higher-order/with-spoken-messages/index.js +8 -7
  615. package/src/higher-order/with-spoken-messages/test/index.js +1 -1
  616. package/src/icon/index.tsx +2 -2
  617. package/src/input-control/index.tsx +2 -1
  618. package/src/input-control/input-field.tsx +2 -1
  619. package/src/input-control/reducer/reducer.ts +23 -21
  620. package/src/input-control/utils.ts +1 -1
  621. package/src/item-group/stories/index.js +2 -1
  622. package/src/menu-item/test/index.js +2 -1
  623. package/src/menu-items-choice/index.js +2 -5
  624. package/src/mobile/bottom-sheet/bottom-sheet-context.native.js +2 -4
  625. package/src/mobile/bottom-sheet/cell.native.js +2 -3
  626. package/src/mobile/bottom-sheet/cycle-picker-cell.native.js +3 -5
  627. package/src/mobile/bottom-sheet/index.native.js +14 -17
  628. package/src/mobile/bottom-sheet/picker-cell.native.js +2 -7
  629. package/src/mobile/bottom-sheet/stepper-cell/index.native.js +4 -6
  630. package/src/mobile/color-settings/index.native.js +2 -4
  631. package/src/mobile/global-styles-context/index.native.js +8 -7
  632. package/src/mobile/gradient/index.native.js +12 -9
  633. package/src/mobile/gradient/test/index.native.js +1 -3
  634. package/src/mobile/html-text-input/index.native.js +2 -3
  635. package/src/mobile/inserter-button/index.native.js +2 -6
  636. package/src/mobile/link-settings/image-link-destinations-screen.native.js +6 -2
  637. package/src/mobile/media-edit/index.native.js +2 -3
  638. package/src/mobile/segmented-control/index.native.js +4 -5
  639. package/src/mobile/utils/test/index.native.js +3 -12
  640. package/src/modal/index.js +1 -1
  641. package/src/navigable-container/container.js +3 -2
  642. package/src/navigable-container/test/menu.js +1 -2
  643. package/src/navigable-container/test/tabbable.js +1 -2
  644. package/src/navigation/context.js +2 -5
  645. package/src/navigation/index.js +2 -1
  646. package/src/navigation/item/index.js +2 -1
  647. package/src/navigation/stories/controlled-state.js +1 -1
  648. package/src/navigation/stories/more-examples.js +2 -3
  649. package/src/navigation/test/index.js +252 -52
  650. package/src/navigator/navigator-back-button/hook.ts +14 -12
  651. package/src/navigator/navigator-button/hook.ts +14 -13
  652. package/src/navigator/navigator-provider/component.tsx +2 -6
  653. package/src/navigator/navigator-screen/component.tsx +3 -3
  654. package/src/notice/index.js +2 -1
  655. package/src/notice/list.js +3 -1
  656. package/src/panel/body.js +2 -1
  657. package/src/placeholder/README.md +7 -6
  658. package/src/placeholder/index.js +27 -10
  659. package/src/placeholder/style.scss +23 -0
  660. package/src/radio-control/README.md +17 -23
  661. package/src/radio-control/index.tsx +107 -0
  662. package/src/radio-control/stories/index.tsx +72 -0
  663. package/src/radio-control/types.ts +32 -0
  664. package/src/range-control/index.js +4 -2
  665. package/src/range-control/input-range.js +2 -5
  666. package/src/range-control/utils.js +3 -1
  667. package/src/resizable-box/resize-tooltip/index.tsx +2 -1
  668. package/src/resizable-box/resize-tooltip/utils.ts +1 -5
  669. package/src/responsive-wrapper/index.js +2 -4
  670. package/src/sandbox/test/index.js +4 -6
  671. package/src/select-control/index.tsx +3 -1
  672. package/src/select-control/stories/index.tsx +3 -4
  673. package/src/slot-fill/fill.js +1 -5
  674. package/src/slot-fill/slot.js +12 -2
  675. package/src/snackbar/index.js +1 -1
  676. package/src/snackbar/list.js +2 -1
  677. package/src/tab-panel/index.js +3 -1
  678. package/src/text/hook.js +4 -1
  679. package/src/text/utils.js +2 -3
  680. package/src/text-control/stories/index.tsx +4 -6
  681. package/src/toggle-control/index.js +1 -2
  682. package/src/toggle-control/index.native.js +2 -6
  683. package/src/toggle-group-control/toggle-group-control/toggle-group-control-backdrop.tsx +2 -4
  684. package/src/toolbar/index.js +1 -2
  685. package/src/tools-panel/tools-panel/hook.ts +2 -4
  686. package/src/tools-panel/tools-panel-header/hook.ts +2 -5
  687. package/src/tooltip/index.js +1 -0
  688. package/src/tree-grid/roving-tab-index-item.js +2 -4
  689. package/src/tree-grid/test/index.js +2 -3
  690. package/src/tree-select/README.md +2 -2
  691. package/src/tree-select/index.tsx +99 -0
  692. package/src/tree-select/stories/index.tsx +80 -0
  693. package/src/tree-select/types.ts +35 -0
  694. package/src/ui/context/wordpress-component.ts +4 -5
  695. package/src/ui/form-group/form-group-content.js +4 -4
  696. package/src/unit-control/index.tsx +7 -9
  697. package/src/unit-control/stories/index.tsx +8 -12
  698. package/src/unit-control/test/index.tsx +4 -7
  699. package/src/utils/hooks/stories/use-cx.js +8 -7
  700. package/src/utils/hooks/test/use-controlled-state.js +2 -1
  701. package/src/utils/unit-values.ts +2 -1
  702. package/src/utils/values.js +2 -3
  703. package/src/z-stack/README.md +14 -3
  704. package/src/z-stack/component.tsx +24 -29
  705. package/src/z-stack/stories/index.tsx +76 -0
  706. package/src/z-stack/types.ts +33 -0
  707. package/tsconfig.json +5 -0
  708. package/tsconfig.tsbuildinfo +1 -1
  709. package/src/external-link/stories/index.js +0 -23
  710. package/src/form-token-field/index.js +0 -725
  711. package/src/form-token-field/stories/index.js +0 -102
  712. package/src/form-token-field/token-input.js +0 -81
  713. package/src/radio-control/index.js +0 -69
  714. package/src/radio-control/stories/index.js +0 -41
  715. package/src/tree-select/index.js +0 -48
  716. package/src/tree-select/stories/index.js +0 -80
  717. package/src/z-stack/stories/index.js +0 -70
@@ -75,57 +75,51 @@ const MyRadioControl = () => {
75
75
  onChange={ ( value ) => setOption( value ) }
76
76
  />
77
77
  );
78
- }
78
+ };
79
79
  ```
80
80
 
81
81
  ### Props
82
82
 
83
83
  The component accepts the following props:
84
84
 
85
- ### hideLabelFromVision
85
+ #### `help`: `string | WPElement`
86
86
 
87
- If true, the label will only be visible to screen readers.
87
+ If this property is added, a help text will be generated using help property as the content.
88
88
 
89
- - Type: `Boolean`
90
89
  - Required: No
91
90
 
92
- #### label
91
+ #### `hideLabelFromVision`: `boolean`
93
92
 
94
- If this property is added, a label will be generated using label property as the content.
93
+ If true, the label will only be visible to screen readers.
95
94
 
96
- - Type: `String`
97
95
  - Required: No
98
96
 
99
- #### help
97
+ #### `label`: `string`
100
98
 
101
- If this property is added, a help text will be generated using help property as the content.
99
+ If this property is added, a label will be generated using label property as the content.
102
100
 
103
- - Type: `String|WPElement`
104
101
  - Required: No
105
102
 
106
- #### selected
103
+ #### `onChange`: `( value: string ) => void`
107
104
 
108
- The value property of the currently selected option.
105
+ A function that receives the value of the new option that is being selected as input.
109
106
 
110
- - Type: `Object`
111
- - Required: No
107
+ - Required: Yes
112
108
 
113
- #### options
109
+ #### `options`: `{ label: string, value: string }[]`
114
110
 
115
- An array of objects containing the following properties:
111
+ An array of objects containing the value and label of the options.
116
112
 
117
- - `label`: (string) The label to be shown to the user.
118
- - `value`: (Object) The internal value compared against select and passed to onChange.
113
+ - `label`: `string` The label to be shown to the user.
114
+ - `value`: `string` The internal value compared against select and passed to onChange.
119
115
 
120
- * Type: `Array`
121
116
  * Required: No
122
117
 
123
- #### onChange
118
+ #### `selected`: `string`
124
119
 
125
- A function that receives the value of the new option that is being selected as input.
120
+ The value property of the currently selected option.
126
121
 
127
- - Type: `function`
128
- - Required: Yes
122
+ - Required: No
129
123
 
130
124
  ## Related components
131
125
 
@@ -0,0 +1,107 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { isEmpty } from 'lodash';
5
+ import classnames from 'classnames';
6
+ import type { ChangeEvent } from 'react';
7
+
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+ import { useInstanceId } from '@wordpress/compose';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import BaseControl from '../base-control';
17
+ import type { WordPressComponentProps } from '../ui/context';
18
+ import type { RadioControlProps } from './types';
19
+
20
+ /**
21
+ * Render a user interface to select the user type using radio inputs.
22
+ *
23
+ * ```jsx
24
+ * import { RadioControl } from '@wordpress/components';
25
+ * import { useState } from '@wordpress/element';
26
+ *
27
+ * const MyRadioControl = () => {
28
+ * const [ option, setOption ] = useState( 'a' );
29
+ *
30
+ * return (
31
+ * <RadioControl
32
+ * label="User type"
33
+ * help="The type of the current user"
34
+ * selected={ option }
35
+ * options={ [
36
+ * { label: 'Author', value: 'a' },
37
+ * { label: 'Editor', value: 'e' },
38
+ * ] }
39
+ * onChange={ ( value ) => setOption( value ) }
40
+ * />
41
+ * );
42
+ * };
43
+ * ```
44
+ */
45
+ export function RadioControl(
46
+ // ref is omitted until we have `WordPressComponentPropsWithoutRef` or add
47
+ // ref forwarding to RadioControl.
48
+ props: Omit<
49
+ WordPressComponentProps< RadioControlProps, 'input', false >,
50
+ 'ref'
51
+ >
52
+ ) {
53
+ const {
54
+ label,
55
+ className,
56
+ selected,
57
+ help,
58
+ onChange,
59
+ hideLabelFromVision,
60
+ options = [],
61
+ ...additionalProps
62
+ } = props;
63
+ const instanceId = useInstanceId( RadioControl );
64
+ const id = `inspector-radio-control-${ instanceId }`;
65
+ const onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>
66
+ onChange( event.target.value );
67
+
68
+ if ( isEmpty( options ) ) {
69
+ return null;
70
+ }
71
+
72
+ return (
73
+ <BaseControl
74
+ label={ label }
75
+ id={ id }
76
+ hideLabelFromVision={ hideLabelFromVision }
77
+ help={ help }
78
+ className={ classnames( className, 'components-radio-control' ) }
79
+ >
80
+ { options.map( ( option, index ) => (
81
+ <div
82
+ key={ `${ id }-${ index }` }
83
+ className="components-radio-control__option"
84
+ >
85
+ <input
86
+ id={ `${ id }-${ index }` }
87
+ className="components-radio-control__input"
88
+ type="radio"
89
+ name={ id }
90
+ value={ option.value }
91
+ onChange={ onChangeValue }
92
+ checked={ option.value === selected }
93
+ aria-describedby={
94
+ !! help ? `${ id }__help` : undefined
95
+ }
96
+ { ...additionalProps }
97
+ />
98
+ <label htmlFor={ `${ id }-${ index }` }>
99
+ { option.label }
100
+ </label>
101
+ </div>
102
+ ) ) }
103
+ </BaseControl>
104
+ );
105
+ }
106
+
107
+ export default RadioControl;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useState } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import RadioControl from '..';
15
+
16
+ const meta: ComponentMeta< typeof RadioControl > = {
17
+ component: RadioControl,
18
+ title: 'Components/RadioControl',
19
+ argTypes: {
20
+ onChange: {
21
+ action: 'onChange',
22
+ },
23
+ selected: {
24
+ control: { type: null },
25
+ },
26
+ label: {
27
+ control: { type: 'text' },
28
+ },
29
+ help: {
30
+ control: { type: 'text' },
31
+ },
32
+ },
33
+ parameters: {
34
+ controls: {
35
+ expanded: true,
36
+ },
37
+ docs: { source: { state: 'open' } },
38
+ },
39
+ };
40
+ export default meta;
41
+
42
+ const Template: ComponentStory< typeof RadioControl > = ( {
43
+ onChange,
44
+ options,
45
+ ...args
46
+ } ) => {
47
+ const [ value, setValue ] = useState( options?.[ 0 ]?.value );
48
+
49
+ return (
50
+ <RadioControl
51
+ { ...args }
52
+ selected={ value }
53
+ options={ options }
54
+ onChange={ ( v ) => {
55
+ setValue( v );
56
+ onChange( v );
57
+ } }
58
+ />
59
+ );
60
+ };
61
+
62
+ export const Default: ComponentStory< typeof RadioControl > = Template.bind(
63
+ {}
64
+ );
65
+ Default.args = {
66
+ label: 'Post visibility',
67
+ options: [
68
+ { label: 'Public', value: 'public' },
69
+ { label: 'Private', value: 'private' },
70
+ { label: 'Password Protected', value: 'password' },
71
+ ],
72
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { BaseControlProps } from '../base-control/types';
5
+
6
+ export type RadioControlProps = Pick<
7
+ BaseControlProps,
8
+ 'label' | 'help' | 'hideLabelFromVision'
9
+ > & {
10
+ /**
11
+ * A function that receives the value of the new option that is being
12
+ * selected as input.
13
+ */
14
+ onChange: ( value: string ) => void;
15
+ /**
16
+ * An array of objects containing the value and label of the options.
17
+ */
18
+ options?: {
19
+ /**
20
+ * The label to be shown to the user
21
+ */
22
+ label: string;
23
+ /**
24
+ * The internal value compared against select and passed to onChange
25
+ */
26
+ value: string;
27
+ }[];
28
+ /**
29
+ * The value property of the currently selected option.
30
+ */
31
+ selected?: string;
32
+ };
@@ -3,7 +3,7 @@
3
3
  * External dependencies
4
4
  */
5
5
  import classnames from 'classnames';
6
- import { clamp, isFinite, noop } from 'lodash';
6
+ import { clamp } from 'lodash';
7
7
 
8
8
  /**
9
9
  * WordPress dependencies
@@ -35,6 +35,8 @@ import {
35
35
  Wrapper,
36
36
  } from './styles/range-control-styles';
37
37
 
38
+ const noop = () => {};
39
+
38
40
  function RangeControl(
39
41
  {
40
42
  afterIcon,
@@ -121,7 +123,7 @@ function RangeControl(
121
123
 
122
124
  const id = useInstanceId( RangeControl, 'inspector-range-control' );
123
125
  const describedBy = !! help ? `${ id }__help` : undefined;
124
- const enableTooltip = showTooltipProp !== false && isFinite( value );
126
+ const enableTooltip = showTooltipProp !== false && Number.isFinite( value );
125
127
 
126
128
  const handleOnRangeChange = ( event ) => {
127
129
  const nextValue = parseFloat( event.target.value );
@@ -1,9 +1,4 @@
1
1
  // @ts-nocheck
2
- /**
3
- * External dependencies
4
- */
5
- import { noop } from 'lodash';
6
-
7
2
  /**
8
3
  * WordPress dependencies
9
4
  */
@@ -15,6 +10,8 @@ import { forwardRef } from '@wordpress/element';
15
10
  import { InputRange as BaseInputRange } from './styles/range-control-styles';
16
11
  import { useDebouncedHoverInteraction } from './utils';
17
12
 
13
+ const noop = () => {};
14
+
18
15
  function InputRange(
19
16
  {
20
17
  describedBy,
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import { clamp, noop } from 'lodash';
5
+ import { clamp } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -14,6 +14,8 @@ import { useCallback, useRef, useEffect, useState } from '@wordpress/element';
14
14
  */
15
15
  import { useControlledState } from '../utils/hooks';
16
16
 
17
+ const noop = () => {};
18
+
17
19
  /**
18
20
  * A float supported clamp function for a specific value.
19
21
  *
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { noop } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
  import type { Ref, ForwardedRef } from 'react';
7
6
 
@@ -30,6 +29,8 @@ type ResizeTooltipProps = React.ComponentProps< typeof Root > & {
30
29
  zIndex?: number;
31
30
  };
32
31
 
32
+ const noop = () => {};
33
+
33
34
  function ResizeTooltip(
34
35
  {
35
36
  axis,
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { noop } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -10,6 +5,7 @@ import { useEffect, useRef, useState } from '@wordpress/element';
10
5
  import { useResizeObserver } from '@wordpress/compose';
11
6
 
12
7
  const { clearTimeout, setTimeout } = window;
8
+ const noop = () => {};
13
9
 
14
10
  export type Axis = 'x' | 'y';
15
11
 
@@ -15,10 +15,8 @@ function ResponsiveWrapper( {
15
15
  children,
16
16
  isInline = false,
17
17
  } ) {
18
- const [
19
- containerResizeListener,
20
- { width: containerWidth },
21
- ] = useResizeObserver();
18
+ const [ containerResizeListener, { width: containerWidth } ] =
19
+ useResizeObserver();
22
20
  if ( Children.count( children ) !== 1 ) {
23
21
  return null;
24
22
  }
@@ -46,9 +46,8 @@ describe( 'Sandbox', () => {
46
46
 
47
47
  const iframe = result.container.querySelector( '.components-sandbox' );
48
48
 
49
- let sandboxedIframe = iframe.contentWindow.document.body.querySelector(
50
- '.mock-iframe'
51
- );
49
+ let sandboxedIframe =
50
+ iframe.contentWindow.document.body.querySelector( '.mock-iframe' );
52
51
 
53
52
  expect( sandboxedIframe.getAttribute( 'src' ) ).toBe(
54
53
  'https://super.embed'
@@ -58,9 +57,8 @@ describe( 'Sandbox', () => {
58
57
  fireEvent.click( result.getByRole( 'button' ) );
59
58
  } );
60
59
 
61
- sandboxedIframe = iframe.contentWindow.document.body.querySelector(
62
- '.mock-iframe'
63
- );
60
+ sandboxedIframe =
61
+ iframe.contentWindow.document.body.querySelector( '.mock-iframe' );
64
62
 
65
63
  expect( sandboxedIframe.getAttribute( 'src' ) ).toBe(
66
64
  'https://another.super.embed'
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { isEmpty, noop } from 'lodash';
4
+ import { isEmpty } from 'lodash';
5
5
  import classNames from 'classnames';
6
6
  import type { ChangeEvent, FocusEvent, ForwardedRef } from 'react';
7
7
 
@@ -21,6 +21,8 @@ import { Select, DownArrowWrapper } from './styles/select-control-styles';
21
21
  import type { WordPressComponentProps } from '../ui/context';
22
22
  import type { SelectControlProps } from './types';
23
23
 
24
+ const noop = () => {};
25
+
24
26
  function useUniqueId( idProp?: string ) {
25
27
  const instanceId = useInstanceId( SelectControl );
26
28
  const id = `inspector-select-control-${ instanceId }`;
@@ -12,7 +12,7 @@ import { useState } from '@wordpress/element';
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import SelectControl from '..';
15
+ import SelectControl from '../';
16
16
 
17
17
  const meta: ComponentMeta< typeof SelectControl > = {
18
18
  title: 'Components/SelectControl',
@@ -34,9 +34,8 @@ export default meta;
34
34
  const SelectControlWithState: ComponentStory< typeof SelectControl > = (
35
35
  args
36
36
  ) => {
37
- const [ selection, setSelection ] = useState<
38
- ComponentProps< typeof SelectControl >[ 'value' ]
39
- >();
37
+ const [ selection, setSelection ] =
38
+ useState< ComponentProps< typeof SelectControl >[ 'value' ] >();
40
39
 
41
40
  return (
42
41
  <SelectControl
@@ -1,8 +1,4 @@
1
1
  // @ts-nocheck
2
- /**
3
- * External dependencies
4
- */
5
- import { isFunction } from 'lodash';
6
2
 
7
3
  /**
8
4
  * WordPress dependencies
@@ -50,7 +46,7 @@ function FillComponent( { name, children, registerFill, unregisterFill } ) {
50
46
  }
51
47
 
52
48
  // If a function is passed as a child, provide it with the fillProps.
53
- if ( isFunction( children ) ) {
49
+ if ( typeof children === 'function' ) {
54
50
  children = children( slot.props.fillProps );
55
51
  }
56
52
 
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * External dependencies
4
4
  */
5
- import { isFunction, isString, map, negate } from 'lodash';
5
+ import { isString, map } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -19,6 +19,16 @@ import {
19
19
  */
20
20
  import SlotFillContext from './context';
21
21
 
22
+ /**
23
+ * Whether the argument is a function.
24
+ *
25
+ * @param {*} maybeFunc The argument to check.
26
+ * @return {boolean} True if the argument is a function, false otherwise.
27
+ */
28
+ function isFunction( maybeFunc ) {
29
+ return typeof maybeFunc === 'function';
30
+ }
31
+
22
32
  class SlotComponent extends Component {
23
33
  constructor() {
24
34
  super( ...arguments );
@@ -79,7 +89,7 @@ class SlotComponent extends Component {
79
89
  // In some cases fills are rendered only when some conditions apply.
80
90
  // This ensures that we only use non-empty fills when rendering, i.e.,
81
91
  // it allows us to render wrappers only when the fills are actually present.
82
- negate( isEmptyElement )
92
+ ( element ) => ! isEmptyElement( element )
83
93
  );
84
94
 
85
95
  return <>{ isFunction( children ) ? children( fills ) : fills }</>;
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { noop } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
 
7
6
  /**
@@ -17,6 +16,7 @@ import warning from '@wordpress/warning';
17
16
  */
18
17
  import { Button } from '../';
19
18
 
19
+ const noop = () => {};
20
20
  const NOTICE_TIMEOUT = 10000;
21
21
 
22
22
  /** @typedef {import('@wordpress/element').WPElement} WPElement */
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import { omit, noop } from 'lodash';
5
+ import { omit } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -19,6 +19,7 @@ import {
19
19
  __unstableAnimatePresence as AnimatePresence,
20
20
  } from '../animation';
21
21
 
22
+ const noop = () => {};
22
23
  const SNACKBAR_VARIANTS = {
23
24
  init: {
24
25
  height: 0,
@@ -2,7 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import classnames from 'classnames';
5
- import { partial, noop, find } from 'lodash';
5
+ import { partial, find } from 'lodash';
6
6
 
7
7
  /**
8
8
  * WordPress dependencies
@@ -16,6 +16,8 @@ import { useInstanceId } from '@wordpress/compose';
16
16
  import { NavigableMenu } from '../navigable-container';
17
17
  import Button from '../button';
18
18
 
19
+ const noop = () => {};
20
+
19
21
  const TabButton = ( { tabId, onClick, children, selected, ...rest } ) => (
20
22
  <Button
21
23
  role="tab"
package/src/text/hook.js CHANGED
@@ -89,7 +89,10 @@ export default function useText( props ) {
89
89
  display,
90
90
  fontSize: getFontSize( size ),
91
91
  /* eslint-disable jsdoc/valid-types */
92
- fontWeight: /** @type {import('react').CSSProperties['fontWeight']} */ ( weight ),
92
+ fontWeight:
93
+ /** @type {import('react').CSSProperties['fontWeight']} */ (
94
+ weight
95
+ ),
93
96
  /* eslint-enable jsdoc/valid-types */
94
97
  lineHeight,
95
98
  letterSpacing,
package/src/text/utils.js CHANGED
@@ -102,9 +102,8 @@ export function createHighlighterText( {
102
102
  let highlightClass;
103
103
  if ( typeof highlightClassName === 'object' ) {
104
104
  if ( ! caseSensitive ) {
105
- highlightClassName = memoizedLowercaseProps(
106
- highlightClassName
107
- );
105
+ highlightClassName =
106
+ memoizedLowercaseProps( highlightClassName );
108
107
  highlightClass = highlightClassName[ text.toLowerCase() ];
109
108
  } else {
110
109
  highlightClass = highlightClassName[ text ];
@@ -51,14 +51,12 @@ const DefaultTemplate: ComponentStory< typeof TextControl > = ( {
51
51
  );
52
52
  };
53
53
 
54
- export const Default: ComponentStory<
55
- typeof TextControl
56
- > = DefaultTemplate.bind( {} );
54
+ export const Default: ComponentStory< typeof TextControl > =
55
+ DefaultTemplate.bind( {} );
57
56
  Default.args = {};
58
57
 
59
- export const WithLabelAndHelpText: ComponentStory<
60
- typeof TextControl
61
- > = DefaultTemplate.bind( {} );
58
+ export const WithLabelAndHelpText: ComponentStory< typeof TextControl > =
59
+ DefaultTemplate.bind( {} );
62
60
  WithLabelAndHelpText.args = {
63
61
  ...Default.args,
64
62
  label: 'Label Text',
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { isFunction } from 'lodash';
5
4
  import classnames from 'classnames';
6
5
 
7
6
  /**
@@ -32,7 +31,7 @@ export default function ToggleControl( {
32
31
  let describedBy, helpLabel;
33
32
  if ( help ) {
34
33
  describedBy = id + '__help';
35
- helpLabel = isFunction( help ) ? help( checked ) : help;
34
+ helpLabel = typeof help === 'function' ? help( checked ) : help;
36
35
  }
37
36
 
38
37
  return (
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { isFunction } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -16,7 +11,8 @@ const ToggleControl = memo(
16
11
  ( { label, checked, help, instanceId, className, onChange, ...props } ) => {
17
12
  const id = `inspector-toggle-control-${ instanceId }`;
18
13
 
19
- const helpLabel = help && isFunction( help ) ? help( checked ) : help;
14
+ const helpLabel =
15
+ help && typeof help === 'function' ? help( checked ) : help;
20
16
 
21
17
  return (
22
18
  <SwitchCell
@@ -36,10 +36,8 @@ function ToggleGroupControlBackdrop( {
36
36
  }
37
37
 
38
38
  const computeDimensions = () => {
39
- const {
40
- width: offsetWidth,
41
- x,
42
- } = targetNode.getBoundingClientRect();
39
+ const { width: offsetWidth, x } =
40
+ targetNode.getBoundingClientRect();
43
41
 
44
42
  const { x: parentX } = containerNode.getBoundingClientRect();
45
43
 
@@ -30,8 +30,7 @@ function Toolbar( { className, label, ...props }, ref ) {
30
30
  deprecated( 'Using Toolbar without label prop', {
31
31
  since: '5.6',
32
32
  alternative: 'ToolbarGroup component',
33
- link:
34
- 'https://developer.wordpress.org/block-editor/components/toolbar/',
33
+ link: 'https://developer.wordpress.org/block-editor/components/toolbar/',
35
34
  } );
36
35
  return <ToolbarGroup { ...props } className={ className } />;
37
36
  }