@wordpress/components 23.3.5 → 23.5.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 (777) hide show
  1. package/CHANGELOG.md +35 -5
  2. package/build/alignment-matrix-control/utils.js +4 -4
  3. package/build/alignment-matrix-control/utils.js.map +1 -1
  4. package/build/angle-picker-control/angle-circle.js +37 -29
  5. package/build/angle-picker-control/angle-circle.js.map +1 -1
  6. package/build/angle-picker-control/index.js +44 -9
  7. package/build/angle-picker-control/index.js.map +1 -1
  8. package/build/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  9. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  10. package/build/angle-picker-control/types.js.map +1 -0
  11. package/build/autocomplete/autocompleter-ui.js +41 -17
  12. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  13. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  14. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  15. package/build/autocomplete/index.js +31 -33
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/base-control/hooks.js +1 -1
  18. package/build/base-control/hooks.js.map +1 -1
  19. package/build/border-box-control/utils.js +1 -1
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/box-control/all-input-control.js +2 -2
  22. package/build/box-control/all-input-control.js.map +1 -1
  23. package/build/box-control/axial-input-controls.js +1 -1
  24. package/build/box-control/axial-input-controls.js.map +1 -1
  25. package/build/box-control/icon.js.map +1 -1
  26. package/build/box-control/index.js +32 -3
  27. package/build/box-control/index.js.map +1 -1
  28. package/build/box-control/input-controls.js +5 -5
  29. package/build/box-control/input-controls.js.map +1 -1
  30. package/build/box-control/linked-button.js.map +1 -1
  31. package/build/box-control/styles/box-control-icon-styles.js +28 -28
  32. package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
  33. package/build/box-control/styles/box-control-styles.js +23 -23
  34. package/build/box-control/styles/box-control-styles.js.map +1 -1
  35. package/build/box-control/styles/box-control-visualizer-styles.js +19 -19
  36. package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  37. package/build/box-control/types.js +6 -0
  38. package/build/box-control/types.js.map +1 -0
  39. package/build/box-control/unit-control.js.map +1 -1
  40. package/build/box-control/utils.js +23 -23
  41. package/build/box-control/utils.js.map +1 -1
  42. package/build/circular-option-picker/index.js +63 -14
  43. package/build/circular-option-picker/index.js.map +1 -1
  44. package/build/circular-option-picker/types.js +6 -0
  45. package/build/circular-option-picker/types.js.map +1 -0
  46. package/build/color-palette/index.js +8 -3
  47. package/build/color-palette/index.js.map +1 -1
  48. package/build/combobox-control/index.js +68 -12
  49. package/build/combobox-control/index.js.map +1 -1
  50. package/build/combobox-control/styles.js +2 -2
  51. package/build/combobox-control/styles.js.map +1 -1
  52. package/build/combobox-control/types.js +6 -0
  53. package/build/combobox-control/types.js.map +1 -0
  54. package/build/custom-gradient-picker/index.js +0 -1
  55. package/build/custom-gradient-picker/index.js.map +1 -1
  56. package/build/date-time/time/index.js +1 -1
  57. package/build/date-time/time/index.js.map +1 -1
  58. package/build/date-time/utils.js +1 -1
  59. package/build/date-time/utils.js.map +1 -1
  60. package/build/draggable/index.js +2 -2
  61. package/build/draggable/index.js.map +1 -1
  62. package/build/focal-point-picker/utils.js +3 -3
  63. package/build/focal-point-picker/utils.js.map +1 -1
  64. package/build/font-size-picker/utils.js +2 -2
  65. package/build/font-size-picker/utils.js.map +1 -1
  66. package/build/gradient-picker/index.js +9 -4
  67. package/build/gradient-picker/index.js.map +1 -1
  68. package/build/higher-order/with-constrained-tabbing/index.js +9 -0
  69. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  70. package/build/input-control/reducer/reducer.js +5 -5
  71. package/build/input-control/reducer/reducer.js.map +1 -1
  72. package/build/input-control/utils.js +1 -1
  73. package/build/input-control/utils.js.map +1 -1
  74. package/build/menu-items-choice/index.js +40 -3
  75. package/build/menu-items-choice/index.js.map +1 -1
  76. package/build/menu-items-choice/types.js +6 -0
  77. package/build/menu-items-choice/types.js.map +1 -0
  78. package/build/mobile/global-styles-context/utils.native.js +2 -1
  79. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  80. package/build/modal/index.js +41 -3
  81. package/build/modal/index.js.map +1 -1
  82. package/build/palette-edit/index.js +4 -1
  83. package/build/palette-edit/index.js.map +1 -1
  84. package/build/panel/header.js +9 -0
  85. package/build/panel/header.js.map +1 -1
  86. package/build/panel/index.js +21 -3
  87. package/build/panel/index.js.map +1 -1
  88. package/build/panel/row.js +10 -4
  89. package/build/panel/row.js.map +1 -1
  90. package/build/panel/types.js +6 -0
  91. package/build/panel/types.js.map +1 -0
  92. package/build/popover/index.js +15 -3
  93. package/build/popover/index.js.map +1 -1
  94. package/build/popover/overlay-middlewares.js +46 -0
  95. package/build/popover/overlay-middlewares.js.map +1 -0
  96. package/build/popover/utils.js +45 -6
  97. package/build/popover/utils.js.map +1 -1
  98. package/build/query-controls/terms.js +1 -1
  99. package/build/query-controls/terms.js.map +1 -1
  100. package/build/range-control/utils.js +4 -4
  101. package/build/range-control/utils.js.map +1 -1
  102. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  103. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  104. package/build/resizable-box/resize-tooltip/utils.js +14 -14
  105. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  106. package/build/snackbar/index.js +2 -2
  107. package/build/snackbar/index.js.map +1 -1
  108. package/build/toolbar/toolbar/index.js +25 -14
  109. package/build/toolbar/toolbar/index.js.map +1 -1
  110. package/build/toolbar/toolbar/toolbar-container.js +5 -4
  111. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  112. package/build/toolbar/toolbar/types.js +6 -0
  113. package/build/toolbar/toolbar/types.js.map +1 -0
  114. package/build/toolbar/toolbar-button/index.js +2 -0
  115. package/build/toolbar/toolbar-button/index.js.map +1 -1
  116. package/build/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  117. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  118. package/build/toolbar/toolbar-context/index.js +2 -0
  119. package/build/toolbar/toolbar-context/index.js.map +1 -1
  120. package/build/toolbar/toolbar-dropdown-menu/index.js +2 -0
  121. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  122. package/build/toolbar/toolbar-group/index.js +2 -0
  123. package/build/toolbar/toolbar-group/index.js.map +1 -1
  124. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  125. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  126. package/build/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  127. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  128. package/build/toolbar/toolbar-item/index.js +2 -0
  129. package/build/toolbar/toolbar-item/index.js.map +1 -1
  130. package/build/tools-panel/context.js +2 -0
  131. package/build/tools-panel/context.js.map +1 -1
  132. package/build/tools-panel/tools-panel/component.js +61 -5
  133. package/build/tools-panel/tools-panel/component.js.map +1 -1
  134. package/build/tools-panel/tools-panel/hook.js +22 -14
  135. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  136. package/build/tools-panel/tools-panel-header/component.js +2 -1
  137. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  138. package/build/tools-panel/tools-panel-header/hook.js +2 -0
  139. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  140. package/build/tools-panel/tools-panel-item/component.js +5 -4
  141. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  142. package/build/tools-panel/tools-panel-item/hook.js +18 -4
  143. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  144. package/build/tree-grid/cell.js +15 -4
  145. package/build/tree-grid/cell.js.map +1 -1
  146. package/build/tree-grid/index.js +81 -19
  147. package/build/tree-grid/index.js.map +1 -1
  148. package/build/tree-grid/item.js +14 -3
  149. package/build/tree-grid/item.js.map +1 -1
  150. package/build/tree-grid/roving-tab-index-context.js +1 -1
  151. package/build/tree-grid/roving-tab-index-context.js.map +1 -1
  152. package/build/tree-grid/roving-tab-index-item.js +13 -6
  153. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  154. package/build/tree-grid/roving-tab-index.js +0 -3
  155. package/build/tree-grid/roving-tab-index.js.map +1 -1
  156. package/build/tree-grid/row.js +20 -18
  157. package/build/tree-grid/row.js.map +1 -1
  158. package/build/tree-grid/types.js +6 -0
  159. package/build/tree-grid/types.js.map +1 -0
  160. package/build/ui/context/context-connect.js +7 -7
  161. package/build/ui/context/context-connect.js.map +1 -1
  162. package/build/ui/context/context-system-provider.js +8 -4
  163. package/build/ui/context/context-system-provider.js.map +1 -1
  164. package/build/ui/context/get-styled-class-name-from-key.js +1 -1
  165. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  166. package/build/ui/utils/get-valid-children.js +1 -1
  167. package/build/ui/utils/get-valid-children.js.map +1 -1
  168. package/build/ui/utils/space.js +1 -1
  169. package/build/ui/utils/space.js.map +1 -1
  170. package/build/unit-control/index.js +2 -2
  171. package/build/unit-control/index.js.map +1 -1
  172. package/build/unit-control/utils.js +20 -20
  173. package/build/unit-control/utils.js.map +1 -1
  174. package/build/utils/events.js +4 -4
  175. package/build/utils/events.js.map +1 -1
  176. package/build/utils/hooks/use-controlled-state.js +2 -2
  177. package/build/utils/hooks/use-controlled-state.js.map +1 -1
  178. package/build/utils/hooks/use-controlled-value.js +4 -4
  179. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  180. package/build/utils/hooks/use-latest-ref.js +1 -1
  181. package/build/utils/hooks/use-latest-ref.js.map +1 -1
  182. package/build/utils/unit-values.js +3 -3
  183. package/build/utils/unit-values.js.map +1 -1
  184. package/build-module/alignment-matrix-control/utils.js +4 -4
  185. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  186. package/build-module/angle-picker-control/angle-circle.js +37 -29
  187. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  188. package/build-module/angle-picker-control/index.js +42 -8
  189. package/build-module/angle-picker-control/index.js.map +1 -1
  190. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  191. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  192. package/build-module/autocomplete/autocompleter-ui.js +40 -19
  193. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  194. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  195. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  196. package/build-module/autocomplete/index.js +30 -32
  197. package/build-module/autocomplete/index.js.map +1 -1
  198. package/build-module/base-control/hooks.js +1 -1
  199. package/build-module/base-control/hooks.js.map +1 -1
  200. package/build-module/border-box-control/utils.js +1 -1
  201. package/build-module/border-box-control/utils.js.map +1 -1
  202. package/build-module/box-control/all-input-control.js +2 -2
  203. package/build-module/box-control/all-input-control.js.map +1 -1
  204. package/build-module/box-control/axial-input-controls.js +1 -1
  205. package/build-module/box-control/axial-input-controls.js.map +1 -1
  206. package/build-module/box-control/icon.js.map +1 -1
  207. package/build-module/box-control/index.js +31 -3
  208. package/build-module/box-control/index.js.map +1 -1
  209. package/build-module/box-control/input-controls.js +5 -5
  210. package/build-module/box-control/input-controls.js.map +1 -1
  211. package/build-module/box-control/linked-button.js.map +1 -1
  212. package/build-module/box-control/styles/box-control-icon-styles.js +28 -28
  213. package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
  214. package/build-module/box-control/styles/box-control-styles.js +23 -23
  215. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  216. package/build-module/box-control/styles/box-control-visualizer-styles.js +19 -19
  217. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  218. package/build-module/box-control/types.js +2 -0
  219. package/build-module/box-control/unit-control.js.map +1 -1
  220. package/build-module/box-control/utils.js +23 -23
  221. package/build-module/box-control/utils.js.map +1 -1
  222. package/build-module/circular-option-picker/index.js +59 -16
  223. package/build-module/circular-option-picker/index.js.map +1 -1
  224. package/build-module/circular-option-picker/types.js +2 -0
  225. package/build-module/color-palette/index.js +8 -3
  226. package/build-module/color-palette/index.js.map +1 -1
  227. package/build-module/combobox-control/index.js +68 -12
  228. package/build-module/combobox-control/index.js.map +1 -1
  229. package/build-module/combobox-control/styles.js +2 -2
  230. package/build-module/combobox-control/styles.js.map +1 -1
  231. package/build-module/combobox-control/types.js +2 -0
  232. package/build-module/custom-gradient-picker/index.js +0 -1
  233. package/build-module/custom-gradient-picker/index.js.map +1 -1
  234. package/build-module/date-time/time/index.js +1 -1
  235. package/build-module/date-time/time/index.js.map +1 -1
  236. package/build-module/date-time/utils.js +1 -1
  237. package/build-module/date-time/utils.js.map +1 -1
  238. package/build-module/draggable/index.js +2 -2
  239. package/build-module/draggable/index.js.map +1 -1
  240. package/build-module/focal-point-picker/utils.js +3 -3
  241. package/build-module/focal-point-picker/utils.js.map +1 -1
  242. package/build-module/font-size-picker/utils.js +2 -2
  243. package/build-module/font-size-picker/utils.js.map +1 -1
  244. package/build-module/gradient-picker/index.js +9 -4
  245. package/build-module/gradient-picker/index.js.map +1 -1
  246. package/build-module/higher-order/with-constrained-tabbing/index.js +9 -0
  247. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  248. package/build-module/input-control/reducer/reducer.js +5 -5
  249. package/build-module/input-control/reducer/reducer.js.map +1 -1
  250. package/build-module/input-control/utils.js +1 -1
  251. package/build-module/input-control/utils.js.map +1 -1
  252. package/build-module/menu-items-choice/index.js +40 -4
  253. package/build-module/menu-items-choice/index.js.map +1 -1
  254. package/build-module/menu-items-choice/types.js +2 -0
  255. package/build-module/menu-items-choice/types.js.map +1 -0
  256. package/build-module/mobile/global-styles-context/utils.native.js +2 -1
  257. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  258. package/build-module/modal/index.js +41 -4
  259. package/build-module/modal/index.js.map +1 -1
  260. package/build-module/palette-edit/index.js +4 -1
  261. package/build-module/palette-edit/index.js.map +1 -1
  262. package/build-module/panel/header.js +9 -0
  263. package/build-module/panel/header.js.map +1 -1
  264. package/build-module/panel/index.js +20 -2
  265. package/build-module/panel/index.js.map +1 -1
  266. package/build-module/panel/row.js +9 -3
  267. package/build-module/panel/row.js.map +1 -1
  268. package/build-module/panel/types.js +2 -0
  269. package/build-module/panel/types.js.map +1 -0
  270. package/build-module/popover/index.js +14 -4
  271. package/build-module/popover/index.js.map +1 -1
  272. package/build-module/popover/overlay-middlewares.js +38 -0
  273. package/build-module/popover/overlay-middlewares.js.map +1 -0
  274. package/build-module/popover/utils.js +41 -5
  275. package/build-module/popover/utils.js.map +1 -1
  276. package/build-module/query-controls/terms.js +1 -1
  277. package/build-module/query-controls/terms.js.map +1 -1
  278. package/build-module/range-control/utils.js +4 -4
  279. package/build-module/range-control/utils.js.map +1 -1
  280. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  281. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  282. package/build-module/resizable-box/resize-tooltip/utils.js +14 -14
  283. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  284. package/build-module/snackbar/index.js +2 -2
  285. package/build-module/snackbar/index.js.map +1 -1
  286. package/build-module/toolbar/toolbar/index.js +25 -13
  287. package/build-module/toolbar/toolbar/index.js.map +1 -1
  288. package/build-module/toolbar/toolbar/toolbar-container.js +4 -3
  289. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  290. package/build-module/toolbar/toolbar/types.js +2 -0
  291. package/build-module/toolbar/toolbar/types.js.map +1 -0
  292. package/build-module/toolbar/toolbar-button/index.js +1 -0
  293. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  294. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  295. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  296. package/build-module/toolbar/toolbar-context/index.js +2 -0
  297. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  298. package/build-module/toolbar/toolbar-dropdown-menu/index.js +1 -0
  299. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  300. package/build-module/toolbar/toolbar-group/index.js +1 -0
  301. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  302. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +1 -0
  303. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  304. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  305. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  306. package/build-module/toolbar/toolbar-item/index.js +1 -0
  307. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  308. package/build-module/tools-panel/context.js +2 -0
  309. package/build-module/tools-panel/context.js.map +1 -1
  310. package/build-module/tools-panel/tools-panel/component.js +59 -4
  311. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  312. package/build-module/tools-panel/tools-panel/hook.js +22 -14
  313. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  314. package/build-module/tools-panel/tools-panel-header/component.js +2 -1
  315. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  316. package/build-module/tools-panel/tools-panel-header/hook.js +2 -0
  317. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  318. package/build-module/tools-panel/tools-panel-item/component.js +3 -3
  319. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  320. package/build-module/tools-panel/tools-panel-item/hook.js +19 -4
  321. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  322. package/build-module/tree-grid/cell.js +16 -4
  323. package/build-module/tree-grid/cell.js.map +1 -1
  324. package/build-module/tree-grid/index.js +81 -21
  325. package/build-module/tree-grid/index.js.map +1 -1
  326. package/build-module/tree-grid/item.js +14 -2
  327. package/build-module/tree-grid/item.js.map +1 -1
  328. package/build-module/tree-grid/roving-tab-index-context.js +1 -1
  329. package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
  330. package/build-module/tree-grid/roving-tab-index-item.js +11 -4
  331. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  332. package/build-module/tree-grid/roving-tab-index.js +0 -3
  333. package/build-module/tree-grid/roving-tab-index.js.map +1 -1
  334. package/build-module/tree-grid/row.js +22 -17
  335. package/build-module/tree-grid/row.js.map +1 -1
  336. package/build-module/tree-grid/types.js +2 -0
  337. package/build-module/tree-grid/types.js.map +1 -0
  338. package/build-module/ui/context/context-connect.js +7 -7
  339. package/build-module/ui/context/context-connect.js.map +1 -1
  340. package/build-module/ui/context/context-system-provider.js +7 -4
  341. package/build-module/ui/context/context-system-provider.js.map +1 -1
  342. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  343. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  344. package/build-module/ui/utils/get-valid-children.js +1 -1
  345. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  346. package/build-module/ui/utils/space.js +1 -1
  347. package/build-module/ui/utils/space.js.map +1 -1
  348. package/build-module/unit-control/index.js +2 -2
  349. package/build-module/unit-control/index.js.map +1 -1
  350. package/build-module/unit-control/utils.js +20 -20
  351. package/build-module/unit-control/utils.js.map +1 -1
  352. package/build-module/utils/events.js +4 -4
  353. package/build-module/utils/events.js.map +1 -1
  354. package/build-module/utils/hooks/use-controlled-state.js +2 -2
  355. package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
  356. package/build-module/utils/hooks/use-controlled-value.js +4 -4
  357. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  358. package/build-module/utils/hooks/use-latest-ref.js +1 -1
  359. package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
  360. package/build-module/utils/unit-values.js +3 -3
  361. package/build-module/utils/unit-values.js.map +1 -1
  362. package/build-style/style-rtl.css +5 -0
  363. package/build-style/style.css +5 -0
  364. package/build-types/alignment-matrix-control/utils.d.ts +4 -4
  365. package/build-types/angle-picker-control/angle-circle.d.ts +6 -0
  366. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -0
  367. package/build-types/angle-picker-control/index.d.ts +29 -0
  368. package/build-types/angle-picker-control/index.d.ts.map +1 -0
  369. package/build-types/angle-picker-control/stories/index.d.ts +15 -0
  370. package/build-types/angle-picker-control/stories/index.d.ts.map +1 -0
  371. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +20 -0
  372. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
  373. package/build-types/angle-picker-control/types.d.ts +26 -0
  374. package/build-types/angle-picker-control/types.d.ts.map +1 -0
  375. package/build-types/base-control/hooks.d.ts +1 -1
  376. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  377. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  378. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  379. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  380. package/build-types/border-box-control/stories/index.d.ts +1 -1
  381. package/build-types/border-box-control/test/index.d.ts.map +1 -0
  382. package/build-types/border-box-control/test/utils.d.ts +2 -0
  383. package/build-types/border-box-control/test/utils.d.ts.map +1 -0
  384. package/build-types/box-control/all-input-control.d.ts +4 -0
  385. package/build-types/box-control/all-input-control.d.ts.map +1 -0
  386. package/build-types/box-control/axial-input-controls.d.ts +4 -0
  387. package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
  388. package/build-types/box-control/icon.d.ts +8 -0
  389. package/build-types/box-control/icon.d.ts.map +1 -0
  390. package/build-types/box-control/index.d.ts +31 -0
  391. package/build-types/box-control/index.d.ts.map +1 -0
  392. package/build-types/box-control/input-controls.d.ts +4 -0
  393. package/build-types/box-control/input-controls.d.ts.map +1 -0
  394. package/build-types/box-control/linked-button.d.ts +9 -0
  395. package/build-types/box-control/linked-button.d.ts.map +1 -0
  396. package/build-types/box-control/styles/box-control-icon-styles.d.ts +42 -0
  397. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -0
  398. package/build-types/box-control/styles/box-control-styles.d.ts +42 -0
  399. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -0
  400. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
  401. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
  402. package/build-types/box-control/test/index.d.ts +2 -0
  403. package/build-types/box-control/test/index.d.ts.map +1 -0
  404. package/build-types/box-control/types.d.ts +99 -0
  405. package/build-types/box-control/types.d.ts.map +1 -0
  406. package/build-types/box-control/unit-control.d.ts +4 -0
  407. package/build-types/box-control/unit-control.d.ts.map +1 -0
  408. package/build-types/box-control/utils.d.ts +84 -0
  409. package/build-types/box-control/utils.d.ts.map +1 -0
  410. package/build-types/circular-option-picker/index.d.ts +56 -7
  411. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  412. package/build-types/circular-option-picker/stories/index.d.ts +14 -0
  413. package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
  414. package/build-types/circular-option-picker/types.d.ts +49 -0
  415. package/build-types/circular-option-picker/types.d.ts.map +1 -0
  416. package/build-types/color-palette/index.d.ts +3 -1
  417. package/build-types/color-palette/index.d.ts.map +1 -1
  418. package/build-types/color-palette/stories/index.d.ts +6 -2
  419. package/build-types/color-palette/stories/index.d.ts.map +1 -1
  420. package/build-types/color-palette/types.d.ts +8 -0
  421. package/build-types/color-palette/types.d.ts.map +1 -1
  422. package/build-types/combobox-control/index.d.ts +51 -0
  423. package/build-types/combobox-control/index.d.ts.map +1 -0
  424. package/build-types/combobox-control/stories/index.d.ts +18 -0
  425. package/build-types/combobox-control/stories/index.d.ts.map +1 -0
  426. package/build-types/combobox-control/styles.d.ts +8 -0
  427. package/build-types/combobox-control/styles.d.ts.map +1 -0
  428. package/build-types/combobox-control/test/index.d.ts +2 -0
  429. package/build-types/combobox-control/test/index.d.ts.map +1 -0
  430. package/build-types/combobox-control/types.d.ts +62 -0
  431. package/build-types/combobox-control/types.d.ts.map +1 -0
  432. package/build-types/date-time/utils.d.ts +1 -1
  433. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  434. package/build-types/focal-point-picker/utils.d.ts +3 -3
  435. package/build-types/font-size-picker/utils.d.ts +2 -2
  436. package/build-types/h-stack/stories/e2e/index.d.ts +9 -0
  437. package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
  438. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
  439. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  440. package/build-types/input-control/reducer/reducer.d.ts +3 -3
  441. package/build-types/input-control/utils.d.ts +1 -1
  442. package/build-types/menu-items-choice/index.d.ts +38 -0
  443. package/build-types/menu-items-choice/index.d.ts.map +1 -0
  444. package/build-types/menu-items-choice/stories/index.d.ts +12 -0
  445. package/build-types/menu-items-choice/stories/index.d.ts.map +1 -0
  446. package/build-types/menu-items-choice/types.d.ts +53 -0
  447. package/build-types/menu-items-choice/types.d.ts.map +1 -0
  448. package/build-types/modal/index.d.ts.map +1 -1
  449. package/build-types/modal/types.d.ts +2 -0
  450. package/build-types/modal/types.d.ts.map +1 -1
  451. package/build-types/panel/header.d.ts +13 -0
  452. package/build-types/panel/header.d.ts.map +1 -0
  453. package/build-types/panel/index.d.ts +21 -0
  454. package/build-types/panel/index.d.ts.map +1 -0
  455. package/build-types/panel/row.d.ts +12 -0
  456. package/build-types/panel/row.d.ts.map +1 -0
  457. package/build-types/panel/test/header.d.ts +2 -0
  458. package/build-types/panel/test/header.d.ts.map +1 -0
  459. package/build-types/panel/test/index.d.ts +2 -0
  460. package/build-types/{base-field → panel}/test/index.d.ts.map +1 -1
  461. package/build-types/panel/test/row.d.ts +2 -0
  462. package/build-types/panel/test/row.d.ts.map +1 -0
  463. package/build-types/panel/types.d.ts +38 -0
  464. package/build-types/panel/types.d.ts.map +1 -0
  465. package/build-types/popover/index.d.ts.map +1 -1
  466. package/build-types/popover/overlay-middlewares.d.ts +9 -0
  467. package/build-types/popover/overlay-middlewares.d.ts.map +1 -0
  468. package/build-types/popover/stories/index.d.ts.map +1 -1
  469. package/build-types/popover/types.d.ts +3 -2
  470. package/build-types/popover/types.d.ts.map +1 -1
  471. package/build-types/popover/utils.d.ts +12 -4
  472. package/build-types/popover/utils.d.ts.map +1 -1
  473. package/build-types/query-controls/terms.d.ts +1 -1
  474. package/build-types/range-control/utils.d.ts +4 -4
  475. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +5 -4
  476. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  477. package/build-types/resizable-box/resize-tooltip/utils.d.ts +6 -6
  478. package/build-types/tab-panel/stories/index.d.ts +1 -0
  479. package/build-types/tab-panel/stories/index.d.ts.map +1 -1
  480. package/build-types/toolbar/index.d.ts +7 -0
  481. package/build-types/toolbar/index.d.ts.map +1 -0
  482. package/build-types/toolbar/stories/index.d.ts +14 -0
  483. package/build-types/toolbar/stories/index.d.ts.map +1 -0
  484. package/build-types/toolbar/test/index.d.ts +2 -0
  485. package/build-types/toolbar/test/index.d.ts.map +1 -0
  486. package/build-types/toolbar/test/toolbar-group.d.ts +2 -0
  487. package/build-types/toolbar/test/toolbar-group.d.ts.map +1 -0
  488. package/build-types/toolbar/toolbar/index.d.ts +25 -0
  489. package/build-types/toolbar/toolbar/index.d.ts.map +1 -0
  490. package/build-types/toolbar/toolbar/toolbar-container.d.ts +5 -0
  491. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -0
  492. package/build-types/toolbar/toolbar/types.d.ts +15 -0
  493. package/build-types/toolbar/toolbar/types.d.ts.map +1 -0
  494. package/build-types/toolbar/toolbar-button/index.d.ts +12 -0
  495. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -0
  496. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +3 -0
  497. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -0
  498. package/build-types/toolbar/toolbar-context/index.d.ts +3 -0
  499. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -0
  500. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -0
  501. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -0
  502. package/build-types/toolbar/toolbar-group/index.d.ts +39 -0
  503. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -0
  504. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +7 -0
  505. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -0
  506. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -0
  507. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -0
  508. package/build-types/toolbar/toolbar-item/index.d.ts +7 -0
  509. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -0
  510. package/build-types/tools-panel/context.d.ts.map +1 -1
  511. package/build-types/tools-panel/stories/index.d.ts +17 -0
  512. package/build-types/tools-panel/stories/index.d.ts.map +1 -0
  513. package/build-types/tools-panel/test/index.d.ts +2 -0
  514. package/build-types/tools-panel/test/index.d.ts.map +1 -0
  515. package/build-types/tools-panel/tools-panel/component.d.ts +54 -2
  516. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  517. package/build-types/tools-panel/tools-panel/hook.d.ts +5 -2
  518. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  519. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  520. package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
  521. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  522. package/build-types/tools-panel/tools-panel-item/component.d.ts +3 -2
  523. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  524. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  525. package/build-types/tools-panel/types.d.ts +49 -20
  526. package/build-types/tools-panel/types.d.ts.map +1 -1
  527. package/build-types/tree-grid/cell.d.ts +13 -0
  528. package/build-types/tree-grid/cell.d.ts.map +1 -0
  529. package/build-types/tree-grid/index.d.ts +70 -0
  530. package/build-types/tree-grid/index.d.ts.map +1 -0
  531. package/build-types/tree-grid/item.d.ts +12 -0
  532. package/build-types/tree-grid/item.d.ts.map +1 -0
  533. package/build-types/tree-grid/roving-tab-index-context.d.ts +10 -0
  534. package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -0
  535. package/build-types/tree-grid/roving-tab-index-item.d.ts +5 -0
  536. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -0
  537. package/build-types/tree-grid/roving-tab-index.d.ts +10 -0
  538. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -0
  539. package/build-types/tree-grid/row.d.ts +12 -0
  540. package/build-types/tree-grid/row.d.ts.map +1 -0
  541. package/build-types/tree-grid/stories/index.d.ts +13 -0
  542. package/build-types/tree-grid/stories/index.d.ts.map +1 -0
  543. package/build-types/tree-grid/test/cell.d.ts +2 -0
  544. package/build-types/tree-grid/test/cell.d.ts.map +1 -0
  545. package/build-types/tree-grid/test/index.d.ts +2 -0
  546. package/build-types/tree-grid/test/index.d.ts.map +1 -0
  547. package/build-types/tree-grid/test/roving-tab-index-item.d.ts +2 -0
  548. package/build-types/tree-grid/test/roving-tab-index-item.d.ts.map +1 -0
  549. package/build-types/tree-grid/test/roving-tab-index.d.ts +2 -0
  550. package/build-types/tree-grid/test/roving-tab-index.d.ts.map +1 -0
  551. package/build-types/tree-grid/test/row.d.ts +2 -0
  552. package/build-types/tree-grid/test/row.d.ts.map +1 -0
  553. package/build-types/tree-grid/types.d.ts +109 -0
  554. package/build-types/tree-grid/types.d.ts.map +1 -0
  555. package/build-types/ui/context/context-connect.d.ts +7 -7
  556. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  557. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -1
  558. package/build-types/ui/utils/get-valid-children.d.ts +1 -1
  559. package/build-types/ui/utils/space.d.ts +1 -1
  560. package/build-types/unit-control/index.d.ts +1 -1
  561. package/build-types/unit-control/utils.d.ts +20 -20
  562. package/build-types/utils/events.d.ts +2 -2
  563. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  564. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  565. package/build-types/utils/hooks/use-controlled-value.d.ts +4 -4
  566. package/build-types/utils/hooks/use-latest-ref.d.ts +1 -1
  567. package/build-types/utils/unit-values.d.ts +3 -3
  568. package/build-types/v-stack/stories/e2e/index.d.ts +9 -0
  569. package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
  570. package/package.json +21 -19
  571. package/src/alignment-matrix-control/utils.tsx +4 -4
  572. package/src/angle-picker-control/README.md +17 -14
  573. package/src/angle-picker-control/{angle-circle.js → angle-circle.tsx} +44 -12
  574. package/src/angle-picker-control/{index.js → index.tsx} +54 -10
  575. package/src/angle-picker-control/stories/index.tsx +57 -0
  576. package/src/angle-picker-control/styles/{angle-picker-control-styles.js → angle-picker-control-styles.tsx} +5 -1
  577. package/src/angle-picker-control/types.ts +29 -0
  578. package/src/autocomplete/autocompleter-ui.js +72 -34
  579. package/src/autocomplete/autocompleter-ui.native.js +1 -0
  580. package/src/autocomplete/index.js +36 -36
  581. package/src/base-control/hooks.ts +1 -1
  582. package/src/border-box-control/test/{index.js → index.tsx} +76 -102
  583. package/src/border-box-control/test/{utils.js → utils.ts} +20 -0
  584. package/src/border-box-control/utils.ts +1 -1
  585. package/src/box-control/README.md +17 -26
  586. package/src/box-control/{all-input-control.js → all-input-control.tsx} +10 -6
  587. package/src/box-control/{axial-input-controls.js → axial-input-controls.tsx} +29 -24
  588. package/src/box-control/{icon.js → icon.tsx} +9 -4
  589. package/src/box-control/{index.js → index.tsx} +43 -8
  590. package/src/box-control/{input-controls.js → input-controls.tsx} +26 -16
  591. package/src/box-control/{linked-button.js → linked-button.tsx} +4 -1
  592. package/src/box-control/styles/{box-control-icon-styles.js → box-control-icon-styles.ts} +1 -1
  593. package/src/box-control/styles/{box-control-styles.js → box-control-styles.ts} +10 -2
  594. package/src/box-control/styles/{box-control-visualizer-styles.js → box-control-visualizer-styles.ts} +6 -2
  595. package/src/box-control/test/{index.js → index.tsx} +12 -9
  596. package/src/box-control/types.ts +121 -0
  597. package/src/box-control/{unit-control.js → unit-control.tsx} +9 -2
  598. package/src/box-control/{utils.js → utils.ts} +47 -38
  599. package/src/button/test/index.tsx +38 -30
  600. package/src/circular-option-picker/README.md +141 -0
  601. package/src/circular-option-picker/{index.js → index.tsx} +74 -14
  602. package/src/circular-option-picker/stories/index.tsx +134 -0
  603. package/src/circular-option-picker/types.ts +69 -0
  604. package/src/color-palette/README.md +7 -0
  605. package/src/color-palette/index.tsx +6 -1
  606. package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -1
  607. package/src/color-palette/types.ts +8 -0
  608. package/src/combobox-control/README.md +8 -15
  609. package/src/combobox-control/{index.js → index.tsx} +91 -19
  610. package/src/combobox-control/stories/index.tsx +114 -0
  611. package/src/combobox-control/styles.ts +4 -1
  612. package/src/combobox-control/test/{index.js → index.tsx} +9 -7
  613. package/src/combobox-control/types.ts +69 -0
  614. package/src/custom-gradient-picker/index.js +0 -1
  615. package/src/custom-select-control/stories/index.js +1 -1
  616. package/src/date-time/time/index.tsx +1 -1
  617. package/src/date-time/utils.ts +1 -1
  618. package/src/draggable/index.tsx +2 -2
  619. package/src/dropdown-menu/test/index.js +3 -11
  620. package/src/focal-point-picker/utils.ts +3 -3
  621. package/src/font-size-picker/utils.ts +2 -2
  622. package/src/gradient-picker/README.md +8 -0
  623. package/src/gradient-picker/index.js +6 -1
  624. package/src/h-stack/stories/e2e/index.tsx +36 -0
  625. package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
  626. package/src/input-control/reducer/reducer.ts +5 -5
  627. package/src/input-control/utils.ts +1 -1
  628. package/src/menu-items-choice/index.tsx +83 -0
  629. package/src/menu-items-choice/stories/index.tsx +79 -0
  630. package/src/menu-items-choice/types.ts +54 -0
  631. package/src/mobile/global-styles-context/utils.native.js +1 -0
  632. package/src/modal/index.tsx +45 -1
  633. package/src/modal/style.scss +8 -0
  634. package/src/modal/types.ts +2 -0
  635. package/src/palette-edit/index.js +4 -1
  636. package/src/panel/README.md +2 -2
  637. package/src/panel/header.tsx +20 -0
  638. package/src/panel/index.tsx +48 -0
  639. package/src/panel/row.tsx +37 -0
  640. package/src/panel/stories/index.js +22 -0
  641. package/src/panel/test/{header.js → header.tsx} +1 -1
  642. package/src/panel/test/{index.js → index.tsx} +6 -4
  643. package/src/panel/test/{row.js → row.tsx} +4 -2
  644. package/src/panel/types.ts +38 -0
  645. package/src/popover/README.md +4 -1
  646. package/src/popover/index.tsx +17 -1
  647. package/src/popover/overlay-middlewares.tsx +29 -0
  648. package/src/popover/stories/index.tsx +7 -1
  649. package/src/popover/test/index.tsx +29 -21
  650. package/src/popover/types.ts +4 -2
  651. package/src/popover/utils.ts +39 -3
  652. package/src/query-controls/terms.ts +1 -1
  653. package/src/range-control/utils.ts +4 -4
  654. package/src/resizable-box/resize-tooltip/utils.ts +14 -14
  655. package/src/snackbar/index.tsx +2 -2
  656. package/src/tab-panel/stories/index.tsx +41 -0
  657. package/src/tab-panel/test/index.tsx +794 -262
  658. package/src/toolbar/stories/{index.js → index.tsx} +39 -26
  659. package/src/toolbar/test/{toolbar-group.js → toolbar-group.tsx} +2 -2
  660. package/src/toolbar/toolbar/README.md +7 -2
  661. package/src/toolbar/toolbar/{index.js → index.tsx} +33 -12
  662. package/src/toolbar/toolbar/{toolbar-container.js → toolbar-container.tsx} +9 -2
  663. package/src/toolbar/toolbar/types.ts +15 -0
  664. package/src/toolbar/toolbar-button/index.js +2 -0
  665. package/src/toolbar/toolbar-button/toolbar-button-container.js +2 -0
  666. package/src/toolbar/toolbar-context/index.js +2 -0
  667. package/src/toolbar/toolbar-dropdown-menu/index.js +2 -0
  668. package/src/toolbar/toolbar-group/index.js +2 -0
  669. package/src/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  670. package/src/toolbar/toolbar-group/toolbar-group-container.js +2 -0
  671. package/src/toolbar/toolbar-item/index.js +2 -0
  672. package/src/tools-panel/context.ts +2 -0
  673. package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
  674. package/src/tools-panel/test/{index.js → index.tsx} +177 -67
  675. package/src/tools-panel/tools-panel/README.md +12 -4
  676. package/src/tools-panel/tools-panel/component.tsx +57 -3
  677. package/src/tools-panel/tools-panel/hook.ts +34 -13
  678. package/src/tools-panel/tools-panel-header/README.md +7 -0
  679. package/src/tools-panel/tools-panel-header/component.tsx +2 -1
  680. package/src/tools-panel/tools-panel-header/hook.ts +6 -4
  681. package/src/tools-panel/tools-panel-item/README.md +6 -4
  682. package/src/tools-panel/tools-panel-item/component.tsx +4 -4
  683. package/src/tools-panel/tools-panel-item/hook.ts +22 -4
  684. package/src/tools-panel/types.ts +51 -20
  685. package/src/tree-grid/README.md +18 -58
  686. package/src/tree-grid/cell.tsx +41 -0
  687. package/src/tree-grid/{index.js → index.tsx} +111 -35
  688. package/src/tree-grid/item.tsx +32 -0
  689. package/src/tree-grid/{roving-tab-index-context.js → roving-tab-index-context.ts} +9 -1
  690. package/src/tree-grid/roving-tab-index-item.tsx +50 -0
  691. package/src/tree-grid/{roving-tab-index.js → roving-tab-index.tsx} +7 -5
  692. package/src/tree-grid/row.tsx +47 -0
  693. package/src/tree-grid/stories/index.tsx +144 -0
  694. package/src/tree-grid/test/__snapshots__/index.tsx.snap +3 -0
  695. package/src/tree-grid/test/{cell.js → cell.tsx} +7 -4
  696. package/src/tree-grid/test/{index.js → index.tsx} +13 -5
  697. package/src/tree-grid/test/{roving-tab-index-item.js → roving-tab-index-item.tsx} +7 -4
  698. package/src/tree-grid/test/{row.js → row.tsx} +4 -4
  699. package/src/tree-grid/types.ts +116 -0
  700. package/src/ui/context/context-connect.ts +7 -7
  701. package/src/ui/context/context-system-provider.js +7 -4
  702. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  703. package/src/ui/utils/get-valid-children.ts +1 -1
  704. package/src/ui/utils/space.ts +1 -1
  705. package/src/unit-control/index.tsx +2 -2
  706. package/src/unit-control/utils.ts +20 -20
  707. package/src/utils/events.ts +4 -4
  708. package/src/utils/hooks/use-controlled-state.js +2 -2
  709. package/src/utils/hooks/use-controlled-value.ts +4 -4
  710. package/src/utils/hooks/use-latest-ref.ts +1 -1
  711. package/src/utils/unit-values.ts +3 -3
  712. package/src/v-stack/stories/e2e/index.tsx +36 -0
  713. package/tsconfig.json +1 -7
  714. package/tsconfig.tsbuildinfo +1 -1
  715. package/build/base-field/hook.js +0 -54
  716. package/build/base-field/hook.js.map +0 -1
  717. package/build/base-field/index.js +0 -14
  718. package/build/base-field/index.js.map +0 -1
  719. package/build/base-field/styles.js +0 -33
  720. package/build/base-field/styles.js.map +0 -1
  721. package/build/resizable-box/styles/resizable-box.styles.js +0 -2
  722. package/build-module/base-field/hook.js +0 -37
  723. package/build-module/base-field/hook.js.map +0 -1
  724. package/build-module/base-field/index.js +0 -2
  725. package/build-module/base-field/index.js.map +0 -1
  726. package/build-module/base-field/styles.js +0 -18
  727. package/build-module/base-field/styles.js.map +0 -1
  728. package/build-module/resizable-box/styles/resizable-box.styles.js +0 -2
  729. package/build-types/base-field/hook.d.ts +0 -270
  730. package/build-types/base-field/hook.d.ts.map +0 -1
  731. package/build-types/base-field/index.d.ts +0 -2
  732. package/build-types/base-field/index.d.ts.map +0 -1
  733. package/build-types/base-field/styles.d.ts +0 -6
  734. package/build-types/base-field/styles.d.ts.map +0 -1
  735. package/build-types/base-field/types.d.ts +0 -29
  736. package/build-types/base-field/types.d.ts.map +0 -1
  737. package/build-types/resizable-box/styles/resizable-box.styles.d.ts +0 -1
  738. package/build-types/resizable-box/styles/resizable-box.styles.d.ts.map +0 -1
  739. package/src/angle-picker-control/stories/index.js +0 -29
  740. package/src/base-field/README.md +0 -66
  741. package/src/base-field/hook.ts +0 -51
  742. package/src/base-field/index.ts +0 -1
  743. package/src/base-field/styles.ts +0 -86
  744. package/src/base-field/test/__snapshots__/index.tsx.snap +0 -141
  745. package/src/base-field/test/index.tsx +0 -84
  746. package/src/base-field/types.ts +0 -29
  747. package/src/combobox-control/stories/index.js +0 -339
  748. package/src/higher-order/with-constrained-tabbing/index.js +0 -22
  749. package/src/menu-items-choice/index.js +0 -43
  750. package/src/panel/header.js +0 -10
  751. package/src/panel/index.js +0 -26
  752. package/src/panel/row.js +0 -20
  753. package/src/resizable-box/styles/resizable-box.styles.js +0 -0
  754. package/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +0 -246
  755. package/src/tree-grid/cell.js +0 -24
  756. package/src/tree-grid/item.js +0 -20
  757. package/src/tree-grid/roving-tab-index-item.js +0 -33
  758. package/src/tree-grid/row.js +0 -31
  759. package/src/tree-grid/stories/index.js +0 -106
  760. package/src/tree-grid/test/__snapshots__/index.js.snap +0 -3
  761. /package/build/{base-field → angle-picker-control}/types.js +0 -0
  762. /package/build-module/{base-field → angle-picker-control}/types.js +0 -0
  763. /package/build-module/{base-field → angle-picker-control}/types.js.map +0 -0
  764. /package/{build/base-field → build-module/box-control}/types.js.map +0 -0
  765. /package/build-module/{resizable-box/styles/resizable-box.styles.js.map → circular-option-picker/types.js.map} +0 -0
  766. /package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/combobox-control/types.js.map} +0 -0
  767. /package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -0
  768. /package/src/panel/test/__snapshots__/{header.js.snap → header.tsx.snap} +0 -0
  769. /package/src/panel/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  770. /package/src/panel/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  771. /package/src/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
  772. /package/src/toolbar/test/{index.js → index.tsx} +0 -0
  773. /package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.tsx.snap} +0 -0
  774. /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.js.snap → roving-tab-index-item.tsx.snap} +0 -0
  775. /package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap} +0 -0
  776. /package/src/tree-grid/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  777. /package/src/tree-grid/test/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.js"],"names":["RovingTabIndexContext","useRovingTabIndexContext","RovingTabIndexProvider","Provider"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAG,6BAA9B;;AACO,MAAMC,wBAAwB,GAAG,MACvC,yBAAYD,qBAAZ,CADM;;;AAEA,MAAME,sBAAsB,GAAGF,qBAAqB,CAACG,QAArD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext();\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-context.ts"],"names":["RovingTabIndexContext","undefined","useRovingTabIndexContext","RovingTabIndexProvider","Provider"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,qBAAqB,GAAG,4BAQ3BC,SAR2B,CAA9B;;AASO,MAAMC,wBAAwB,GAAG,MACvC,yBAAYF,qBAAZ,CADM;;;AAEA,MAAMG,sBAAsB,GAAGH,qBAAqB,CAACI,QAArD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useContext } from '@wordpress/element';\n\nconst RovingTabIndexContext = createContext<\n\t| {\n\t\t\tlastFocusedElement: HTMLElement | undefined;\n\t\t\tsetLastFocusedElement: React.Dispatch<\n\t\t\t\tReact.SetStateAction< HTMLElement | undefined >\n\t\t\t>;\n\t }\n\t| undefined\n>( undefined );\nexport const useRovingTabIndexContext = () =>\n\tuseContext( RovingTabIndexContext );\nexport const RovingTabIndexProvider = RovingTabIndexContext.Provider;\n"]}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.default = exports.RovingTabIndexItem = void 0;
7
7
 
8
8
  var _element = require("@wordpress/element");
9
9
 
@@ -16,14 +16,15 @@ var _rovingTabIndexContext = require("./roving-tab-index-context");
16
16
  /**
17
17
  * Internal dependencies
18
18
  */
19
- var _default = (0, _element.forwardRef)(function RovingTabIndexItem(_ref, forwardedRef) {
19
+ const RovingTabIndexItem = (0, _element.forwardRef)(function UnforwardedRovingTabIndexItem(_ref, forwardedRef) {
20
20
  let {
21
21
  children,
22
22
  as: Component,
23
23
  ...props
24
24
  } = _ref;
25
25
  const localRef = (0, _element.useRef)();
26
- const ref = forwardedRef || localRef;
26
+ const ref = forwardedRef || localRef; // @ts-expect-error - We actually want to throw an error if this is undefined.
27
+
27
28
  const {
28
29
  lastFocusedElement,
29
30
  setLastFocusedElement
@@ -31,10 +32,14 @@ var _default = (0, _element.forwardRef)(function RovingTabIndexItem(_ref, forwar
31
32
  let tabIndex;
32
33
 
33
34
  if (lastFocusedElement) {
34
- tabIndex = lastFocusedElement === ref.current ? 0 : -1;
35
+ tabIndex = lastFocusedElement === ( // TODO: The original implementation simply used `ref.current` here, assuming
36
+ // that a forwarded ref would always be an object, which is not necessarily true.
37
+ // This workaround maintains the original runtime behavior in a type-safe way,
38
+ // but should be revisited.
39
+ 'current' in ref ? ref.current : undefined) ? 0 : -1;
35
40
  }
36
41
 
37
- const onFocus = event => setLastFocusedElement(event.target);
42
+ const onFocus = event => setLastFocusedElement === null || setLastFocusedElement === void 0 ? void 0 : setLastFocusedElement(event.target);
38
43
 
39
44
  const allProps = {
40
45
  ref,
@@ -47,8 +52,10 @@ var _default = (0, _element.forwardRef)(function RovingTabIndexItem(_ref, forwar
47
52
  return children(allProps);
48
53
  }
49
54
 
55
+ if (!Component) return null;
50
56
  return (0, _element.createElement)(Component, allProps, children);
51
57
  });
52
-
58
+ exports.RovingTabIndexItem = RovingTabIndexItem;
59
+ var _default = RovingTabIndexItem;
53
60
  exports.default = _default;
54
61
  //# sourceMappingURL=roving-tab-index-item.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.js"],"names":["RovingTabIndexItem","forwardedRef","children","as","Component","props","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","onFocus","event","target","allProps"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;eAGe,yBAAY,SAASA,kBAAT,OAE1BC,YAF0B,EAGzB;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAE,EAAEC,SAAhB;AAA2B,OAAGC;AAA9B,GAEC;AACD,QAAMC,QAAQ,GAAG,sBAAjB;AACA,QAAMC,GAAG,GAAGN,YAAY,IAAIK,QAA5B;AACA,QAAM;AAAEE,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACL,sDADD;AAEA,MAAIC,QAAJ;;AAEA,MAAKF,kBAAL,EAA0B;AACzBE,IAAAA,QAAQ,GAAGF,kBAAkB,KAAKD,GAAG,CAACI,OAA3B,GAAqC,CAArC,GAAyC,CAAC,CAArD;AACA;;AAED,QAAMC,OAAO,GAAKC,KAAF,IAAaJ,qBAAqB,CAAEI,KAAK,CAACC,MAAR,CAAlD;;AACA,QAAMC,QAAQ,GAAG;AAAER,IAAAA,GAAF;AAAOG,IAAAA,QAAP;AAAiBE,IAAAA,OAAjB;AAA0B,OAAGP;AAA7B,GAAjB;;AAEA,MAAK,OAAOH,QAAP,KAAoB,UAAzB,EAAsC;AACrC,WAAOA,QAAQ,CAAEa,QAAF,CAAf;AACA;;AAED,SAAO,4BAAC,SAAD,EAAgBA,QAAhB,EAA6Bb,QAA7B,CAAP;AACA,CAtBc,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\n\nexport default forwardRef( function RovingTabIndexItem(\n\t{ children, as: Component, ...props },\n\tforwardedRef\n) {\n\tconst localRef = useRef();\n\tconst ref = forwardedRef || localRef;\n\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\tuseRovingTabIndexContext();\n\tlet tabIndex;\n\n\tif ( lastFocusedElement ) {\n\t\ttabIndex = lastFocusedElement === ref.current ? 0 : -1;\n\t}\n\n\tconst onFocus = ( event ) => setLastFocusedElement( event.target );\n\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\tif ( typeof children === 'function' ) {\n\t\treturn children( allProps );\n\t}\n\n\treturn <Component { ...allProps }>{ children }</Component>;\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index-item.tsx"],"names":["RovingTabIndexItem","UnforwardedRovingTabIndexItem","forwardedRef","children","as","Component","props","localRef","ref","lastFocusedElement","setLastFocusedElement","tabIndex","current","undefined","onFocus","event","target","allProps"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAIO,MAAMA,kBAAkB,GAAG,yBACjC,SAASC,6BAAT,OAECC,YAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,EAAE,EAAEC,SAAhB;AAA2B,OAAGC;AAA9B,GAEC;AACD,QAAMC,QAAQ,GAAG,sBAAjB;AACA,QAAMC,GAAG,GAAGN,YAAY,IAAIK,QAA5B,CAFC,CAGD;;AACA,QAAM;AAAEE,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,MACL,sDADD;AAEA,MAAIC,QAAJ;;AAEA,MAAKF,kBAAL,EAA0B;AACzBE,IAAAA,QAAQ,GACPF,kBAAkB,OAClB;AACA;AACA;AACA;AACE,iBAAaD,GAAb,GAAmBA,GAAG,CAACI,OAAvB,GAAiCC,SALjB,CAAlB,GAMG,CANH,GAOG,CAAC,CARL;AASA;;AAED,QAAMC,OAA+C,GAAKC,KAAF,IACvDL,qBADuD,aACvDA,qBADuD,uBACvDA,qBAAqB,CAAIK,KAAK,CAACC,MAAV,CADtB;;AAEA,QAAMC,QAAQ,GAAG;AAAET,IAAAA,GAAF;AAAOG,IAAAA,QAAP;AAAiBG,IAAAA,OAAjB;AAA0B,OAAGR;AAA7B,GAAjB;;AAEA,MAAK,OAAOH,QAAP,KAAoB,UAAzB,EAAsC;AACrC,WAAOA,QAAQ,CAAEc,QAAF,CAAf;AACA;;AAED,MAAK,CAAEZ,SAAP,EAAmB,OAAO,IAAP;AAEnB,SAAO,4BAAC,SAAD,EAAgBY,QAAhB,EAA6Bd,QAA7B,CAAP;AACA,CAnCgC,CAA3B;;eAsCQH,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useRovingTabIndexContext } from './roving-tab-index-context';\nimport type { RovingTabIndexItemProps } from './types';\n\nexport const RovingTabIndexItem = forwardRef(\n\tfunction UnforwardedRovingTabIndexItem(\n\t\t{ children, as: Component, ...props }: RovingTabIndexItemProps,\n\t\tforwardedRef: React.ForwardedRef< any >\n\t) {\n\t\tconst localRef = useRef< any >();\n\t\tconst ref = forwardedRef || localRef;\n\t\t// @ts-expect-error - We actually want to throw an error if this is undefined.\n\t\tconst { lastFocusedElement, setLastFocusedElement } =\n\t\t\tuseRovingTabIndexContext();\n\t\tlet tabIndex;\n\n\t\tif ( lastFocusedElement ) {\n\t\t\ttabIndex =\n\t\t\t\tlastFocusedElement ===\n\t\t\t\t// TODO: The original implementation simply used `ref.current` here, assuming\n\t\t\t\t// that a forwarded ref would always be an object, which is not necessarily true.\n\t\t\t\t// This workaround maintains the original runtime behavior in a type-safe way,\n\t\t\t\t// but should be revisited.\n\t\t\t\t( 'current' in ref ? ref.current : undefined )\n\t\t\t\t\t? 0\n\t\t\t\t\t: -1;\n\t\t}\n\n\t\tconst onFocus: React.FocusEventHandler< HTMLElement > = ( event ) =>\n\t\t\tsetLastFocusedElement?.( event.target );\n\t\tconst allProps = { ref, tabIndex, onFocus, ...props };\n\n\t\tif ( typeof children === 'function' ) {\n\t\t\treturn children( allProps );\n\t\t}\n\n\t\tif ( ! Component ) return null;\n\n\t\treturn <Component { ...allProps }>{ children }</Component>;\n\t}\n);\n\nexport default RovingTabIndexItem;\n"]}
@@ -21,9 +21,6 @@ var _rovingTabIndexContext = require("./roving-tab-index-context");
21
21
  * Provider for adding roving tab index behaviors to tree grid structures.
22
22
  *
23
23
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
24
- *
25
- * @param {Object} props Component props.
26
- * @param {WPElement} props.children Children to be rendered
27
24
  */
28
25
  function RovingTabIndex(_ref) {
29
26
  let {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index.js"],"names":["RovingTabIndex","children","lastFocusedElement","setLastFocusedElement","providerValue"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,OAAwC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACtD,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IAAgD,wBAAtD,CADsD,CAGtD;AACA;AACA;;AACA,QAAMC,aAAa,GAAG,sBACrB,OAAQ;AAAEF,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,GAAR,CADqB,EAErB,CAAED,kBAAF,CAFqB,CAAtB;AAKA,SACC,4BAAC,6CAAD;AAAwB,IAAA,KAAK,EAAGE;AAAhC,KACGH,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { RovingTabIndexProvider } from './roving-tab-index-context';\n\n/**\n * Provider for adding roving tab index behaviors to tree grid structures.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n *\n * @param {Object} props Component props.\n * @param {WPElement} props.children Children to be rendered\n */\nexport default function RovingTabIndex( { children } ) {\n\tconst [ lastFocusedElement, setLastFocusedElement ] = useState();\n\n\t// Use `useMemo` to avoid creation of a new object for the providerValue\n\t// on every render. Only create a new object when the `lastFocusedElement`\n\t// value changes.\n\tconst providerValue = useMemo(\n\t\t() => ( { lastFocusedElement, setLastFocusedElement } ),\n\t\t[ lastFocusedElement ]\n\t);\n\n\treturn (\n\t\t<RovingTabIndexProvider value={ providerValue }>\n\t\t\t{ children }\n\t\t</RovingTabIndexProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/roving-tab-index.tsx"],"names":["RovingTabIndex","children","lastFocusedElement","setLastFocusedElement","providerValue"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACe,SAASA,cAAT,OAIX;AAAA,MAJoC;AACvCC,IAAAA;AADuC,GAIpC;AACH,QAAM,CAAEC,kBAAF,EAAsBC,qBAAtB,IACL,wBADD,CADG,CAIH;AACA;AACA;;AACA,QAAMC,aAAa,GAAG,sBACrB,OAAQ;AAAEF,IAAAA,kBAAF;AAAsBC,IAAAA;AAAtB,GAAR,CADqB,EAErB,CAAED,kBAAF,CAFqB,CAAtB;AAKA,SACC,4BAAC,6CAAD;AAAwB,IAAA,KAAK,EAAGE;AAAhC,KACGH,QADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { RovingTabIndexProvider } from './roving-tab-index-context';\n\n/**\n * Provider for adding roving tab index behaviors to tree grid structures.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md\n */\nexport default function RovingTabIndex( {\n\tchildren,\n}: {\n\tchildren: React.ReactNode;\n} ) {\n\tconst [ lastFocusedElement, setLastFocusedElement ] =\n\t\tuseState< HTMLElement >();\n\n\t// Use `useMemo` to avoid creation of a new object for the providerValue\n\t// on every render. Only create a new object when the `lastFocusedElement`\n\t// value changes.\n\tconst providerValue = useMemo(\n\t\t() => ( { lastFocusedElement, setLastFocusedElement } ),\n\t\t[ lastFocusedElement ]\n\t);\n\n\treturn (\n\t\t<RovingTabIndexProvider value={ providerValue }>\n\t\t\t{ children }\n\t\t</RovingTabIndexProvider>\n\t);\n}\n"]}
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.default = exports.TreeGridRow = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
@@ -14,7 +14,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
14
14
  /**
15
15
  * WordPress dependencies
16
16
  */
17
- function TreeGridRow(_ref, ref) {
17
+ function UnforwardedTreeGridRow(_ref, ref) {
18
18
  let {
19
19
  children,
20
20
  level,
@@ -23,24 +23,26 @@ function TreeGridRow(_ref, ref) {
23
23
  isExpanded,
24
24
  ...props
25
25
  } = _ref;
26
- return (// Disable reason: Due to an error in the ARIA 1.1 specification, the
27
- // aria-posinset and aria-setsize properties are not supported on row
28
- // elements. This is being corrected in ARIA 1.2. Consequently, the
29
- // linting rule fails when validating this markup.
30
- //
31
- // eslint-disable-next-line jsx-a11y/role-supports-aria-props
32
- (0, _element.createElement)("tr", (0, _extends2.default)({}, props, {
33
- ref: ref,
34
- role: "row",
35
- "aria-level": level,
36
- "aria-posinset": positionInSet,
37
- "aria-setsize": setSize,
38
- "aria-expanded": isExpanded
39
- }), children)
40
- );
26
+ return (0, _element.createElement)("tr", (0, _extends2.default)({}, props, {
27
+ ref: ref,
28
+ role: "row",
29
+ "aria-level": level,
30
+ "aria-posinset": positionInSet,
31
+ "aria-setsize": setSize,
32
+ "aria-expanded": isExpanded
33
+ }), children);
41
34
  }
35
+ /**
36
+ * `TreeGridRow` is used to create a tree hierarchy.
37
+ * It is not a visually styled component, but instead helps with adding
38
+ * keyboard navigation and roving tab index behaviors to tree grid structures.
39
+ *
40
+ * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}
41
+ */
42
42
 
43
- var _default = (0, _element.forwardRef)(TreeGridRow);
44
43
 
44
+ const TreeGridRow = (0, _element.forwardRef)(UnforwardedTreeGridRow);
45
+ exports.TreeGridRow = TreeGridRow;
46
+ var _default = TreeGridRow;
45
47
  exports.default = _default;
46
48
  //# sourceMappingURL=row.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/tree-grid/row.js"],"names":["TreeGridRow","ref","children","level","positionInSet","setSize","isExpanded","props"],"mappings":";;;;;;;;;AAGA;;;;AAHA;AACA;AACA;AAGA,SAASA,WAAT,OAECC,GAFD,EAGE;AAAA,MAFD;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,KAAZ;AAAmBC,IAAAA,aAAnB;AAAkCC,IAAAA,OAAlC;AAA2CC,IAAAA,UAA3C;AAAuD,OAAGC;AAA1D,GAEC;AACD,SACC;AACA;AACA;AACA;AACA;AACA;AACA,iEACMA,KADN;AAEC,MAAA,GAAG,EAAGN,GAFP;AAGC,MAAA,IAAI,EAAC,KAHN;AAIC,oBAAaE,KAJd;AAKC,uBAAgBC,aALjB;AAMC,sBAAeC,OANhB;AAOC,uBAAgBC;AAPjB,QASGJ,QATH;AAPD;AAmBA;;eAEc,yBAAYF,WAAZ,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\nfunction TreeGridRow(\n\t{ children, level, positionInSet, setSize, isExpanded, ...props },\n\tref\n) {\n\treturn (\n\t\t// Disable reason: Due to an error in the ARIA 1.1 specification, the\n\t\t// aria-posinset and aria-setsize properties are not supported on row\n\t\t// elements. This is being corrected in ARIA 1.2. Consequently, the\n\t\t// linting rule fails when validating this markup.\n\t\t//\n\t\t// eslint-disable-next-line jsx-a11y/role-supports-aria-props\n\t\t<tr\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\trole=\"row\"\n\t\t\taria-level={ level }\n\t\t\taria-posinset={ positionInSet }\n\t\t\taria-setsize={ setSize }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t{ children }\n\t\t</tr>\n\t);\n}\n\nexport default forwardRef( TreeGridRow );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/tree-grid/row.tsx"],"names":["UnforwardedTreeGridRow","ref","children","level","positionInSet","setSize","isExpanded","props","TreeGridRow"],"mappings":";;;;;;;;;AAGA;;;;AAHA;AACA;AACA;AASA,SAASA,sBAAT,OASCC,GATD,EAUE;AAAA,MATD;AACCC,IAAAA,QADD;AAECC,IAAAA,KAFD;AAGCC,IAAAA,aAHD;AAICC,IAAAA,OAJD;AAKCC,IAAAA,UALD;AAMC,OAAGC;AANJ,GASC;AACD,SACC,6DACMA,KADN;AAEC,IAAA,GAAG,EAAGN,GAFP;AAGC,IAAA,IAAI,EAAC,KAHN;AAIC,kBAAaE,KAJd;AAKC,qBAAgBC,aALjB;AAMC,oBAAeC,OANhB;AAOC,qBAAgBC;AAPjB,MASGJ,QATH,CADD;AAaA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMM,WAAW,GAAG,yBAAYR,sBAAZ,CAApB;;eAEQQ,W","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { TreeGridRowProps } from './types';\n\nfunction UnforwardedTreeGridRow(\n\t{\n\t\tchildren,\n\t\tlevel,\n\t\tpositionInSet,\n\t\tsetSize,\n\t\tisExpanded,\n\t\t...props\n\t}: WordPressComponentProps< TreeGridRowProps, 'tr', false >,\n\tref: React.ForwardedRef< HTMLTableRowElement >\n) {\n\treturn (\n\t\t<tr\n\t\t\t{ ...props }\n\t\t\tref={ ref }\n\t\t\trole=\"row\"\n\t\t\taria-level={ level }\n\t\t\taria-posinset={ positionInSet }\n\t\t\taria-setsize={ setSize }\n\t\t\taria-expanded={ isExpanded }\n\t\t>\n\t\t\t{ children }\n\t\t</tr>\n\t);\n}\n\n/**\n * `TreeGridRow` is used to create a tree hierarchy.\n * It is not a visually styled component, but instead helps with adding\n * keyboard navigation and roving tab index behaviors to tree grid structures.\n *\n * @see {@link https://www.w3.org/TR/wai-aria-practices/examples/treegrid/treegrid-1.html}\n */\nexport const TreeGridRow = forwardRef( UnforwardedTreeGridRow );\n\nexport default TreeGridRow;\n"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -34,8 +34,8 @@ var _getStyledClassNameFromKey = require("./get-styled-class-name-from-key");
34
34
  * Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
35
35
  * within the Context system under a specified namespace.
36
36
  *
37
- * @param Component The component to register into the Context system.
38
- * @param namespace The namespace to register the component under.
37
+ * @param Component The component to register into the Context system.
38
+ * @param namespace The namespace to register the component under.
39
39
  * @return The connected WordPressComponent
40
40
  */
41
41
  function contextConnect(Component, namespace) {
@@ -47,8 +47,8 @@ function contextConnect(Component, namespace) {
47
47
  * "Connects" (or registers) a component within the Context system under a specified namespace.
48
48
  * Does not forward a ref.
49
49
  *
50
- * @param Component The component to register into the Context system.
51
- * @param namespace The namespace to register the component under.
50
+ * @param Component The component to register into the Context system.
51
+ * @param namespace The namespace to register the component under.
52
52
  * @return The connected WordPressComponent
53
53
  */
54
54
 
@@ -92,7 +92,7 @@ function _contextConnect(Component, namespace, options) {
92
92
  /**
93
93
  * Attempts to retrieve the connected namespace from a component.
94
94
  *
95
- * @param Component The component to retrieve a namespace from.
95
+ * @param Component The component to retrieve a namespace from.
96
96
  * @return The connected namespaces.
97
97
  */
98
98
 
@@ -117,8 +117,8 @@ function getConnectNamespace(Component) {
117
117
  /**
118
118
  * Checks to see if a component is connected within the Context system.
119
119
  *
120
- * @param Component The component to retrieve a namespace from.
121
- * @param match The namespace to check.
120
+ * @param Component The component to retrieve a namespace from.
121
+ * @param match The namespace to check.
122
122
  */
123
123
 
124
124
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.ts"],"names":["contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":";;;;;;;;;;;;AAQA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAGNC,SAHM,EAQNC,SARM,EASL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb,EAAwB;AAAEE,IAAAA,WAAW,EAAE;AAAf,GAAxB,CAAtB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CACNJ,SADM,EAENC,SAFM,EAGL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb,CAAtB;AACA,C,CAED;AACA;AACA;;;AACA,SAASC,eAAT,CAICF,SAJD,EAKCC,SALD,EAMCI,OAND,EAUE;AACD,QAAMC,gBAAgB,GAAGD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEF,WAAT,GACtB,yBAAyCH,SAAzC,CADsB,GAEtBA,SAFH;;AAIA,MAAK,OAAOC,SAAP,KAAqB,WAA1B,EAAwC;AACvC,mHAAM,4CAAN;AACA,GAPA,CASD;;;AACA,MAAIM,eAAe,GAAGD,gBAAgB,CAAEE,mCAAF,CAAhB,IAAgD,CACrEP,SADqE,CAAtE;AAIA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B,SAAF,CAAnB,CAAiCqB,QAAjC,CAA2CD,KAA3C,CAAP;AACA;;AACD,MAAKX,KAAK,CAACC,OAAN,CAAeU,KAAf,CAAL,EAA8B;AAC7B,WAAOA,KAAK,CAACE,IAAN,CAAcC,MAAF,IAClBP,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiCqB,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/9620bae6fef4fde7cc2b7833f416e240207cda29/packages/components/src/ui/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-connect.ts"],"names":["contextConnect","Component","namespace","_contextConnect","forwardsRef","contextConnectWithoutRef","options","WrappedComponent","mergedNamespace","CONNECT_STATIC_NAMESPACE","Array","isArray","Object","assign","Set","displayName","selector","getConnectNamespace","namespaces","type","hasConnectNamespace","match","includes","some","result"],"mappings":";;;;;;;;;;;;AAQA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAGNC,SAHM,EAQNC,SARM,EASL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb,EAAwB;AAAEE,IAAAA,WAAW,EAAE;AAAf,GAAxB,CAAtB;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,wBAAT,CACNJ,SADM,EAENC,SAFM,EAGL;AACD,SAAOC,eAAe,CAAEF,SAAF,EAAaC,SAAb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AAKR,SAAS,CAACkB,IAAV,IAAkBlB,SAAS,CAACkB,IAAV,CAAgBV,mCAAhB,CAAvB,EAAoE;AACnE;AACAS,IAAAA,UAAU,GAAGjB,SAAS,CAACkB,IAAV,CAAgBV,mCAAhB,CAAb;AACA;;AAED,SAAOS,UAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,mBAAT,CACNnB,SADM,EAENoB,KAFM,EAGI;AACV,MAAK,CAAEpB,SAAP,EAAmB,OAAO,KAAP;;AAEnB,MAAK,OAAOoB,KAAP,KAAiB,QAAtB,EAAiC;AAChC,WAAOJ,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiCqB,QAAjC,CAA2CD,KAA3C,CAAP;AACA;;AACD,MAAKX,KAAK,CAACC,OAAN,CAAeU,KAAf,CAAL,EAA8B;AAC7B,WAAOA,KAAK,CAACE,IAAN,CAAcC,MAAF,IAClBP,mBAAmB,CAAEhB,SAAF,CAAnB,CAAiCqB,QAAjC,CAA2CE,MAA3C,CADM,CAAP;AAGA;;AAED,SAAO,KAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef, ReactChild, ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { CONNECT_STATIC_NAMESPACE } from './constants';\nimport { getStyledClassNameFromKey } from './get-styled-class-name-from-key';\nimport type { WordPressComponentFromProps } from '.';\n\ntype AcceptsTwoArgs<\n\tF extends ( ...args: any ) => any,\n\tErrorMessage = never\n> = Parameters< F >[ 'length' ] extends 2 ? {} : ErrorMessage;\n\ntype ContextConnectOptions = {\n\tforwardsRef?: boolean;\n};\n\n/**\n * Forwards ref (React.ForwardRef) and \"Connects\" (or registers) a component\n * within the Context system under a specified namespace.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null\n>(\n\tComponent: C &\n\t\tAcceptsTwoArgs<\n\t\t\tC,\n\t\t\t'Warning: Your component function does not take a ref as the second argument. Did you mean to use `contextConnectWithoutRef`?'\n\t\t>,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace, { forwardsRef: true } );\n}\n\n/**\n * \"Connects\" (or registers) a component within the Context system under a specified namespace.\n * Does not forward a ref.\n *\n * @param Component The component to register into the Context system.\n * @param namespace The namespace to register the component under.\n * @return The connected WordPressComponent\n */\nexport function contextConnectWithoutRef< P >(\n\tComponent: ( props: P ) => JSX.Element | null,\n\tnamespace: string\n) {\n\treturn _contextConnect( Component, namespace );\n}\n\n// This is an (experimental) evolution of the initial connect() HOC.\n// The hope is that we can improve render performance by removing functional\n// component wrappers.\nfunction _contextConnect<\n\tC extends ( props: any, ref: ForwardedRef< any > ) => JSX.Element | null,\n\tO extends ContextConnectOptions\n>(\n\tComponent: C,\n\tnamespace: string,\n\toptions?: O\n): WordPressComponentFromProps<\n\tParameters< C >[ 0 ],\n\tO[ 'forwardsRef' ] extends true ? true : false\n> {\n\tconst WrappedComponent = options?.forwardsRef\n\t\t? forwardRef< any, Parameters< C >[ 0 ] >( Component )\n\t\t: Component;\n\n\tif ( typeof namespace === 'undefined' ) {\n\t\twarn( 'contextConnect: Please provide a namespace' );\n\t}\n\n\t// @ts-expect-error internal property\n\tlet mergedNamespace = WrappedComponent[ CONNECT_STATIC_NAMESPACE ] || [\n\t\tnamespace,\n\t];\n\n\t/**\n\t * Consolidate (merge) namespaces before attaching it to the WrappedComponent.\n\t */\n\tif ( Array.isArray( namespace ) ) {\n\t\tmergedNamespace = [ ...mergedNamespace, ...namespace ];\n\t}\n\tif ( typeof namespace === 'string' ) {\n\t\tmergedNamespace = [ ...mergedNamespace, namespace ];\n\t}\n\n\t// @ts-expect-error We can't rely on inferred types here because of the\n\t// `as` prop polymorphism we're handling in https://github.com/WordPress/gutenberg/blob/9620bae6fef4fde7cc2b7833f416e240207cda29/packages/components/src/ui/context/wordpress-component.ts#L32-L33\n\treturn Object.assign( WrappedComponent, {\n\t\t[ CONNECT_STATIC_NAMESPACE ]: [ ...new Set( mergedNamespace ) ],\n\t\tdisplayName: namespace,\n\t\tselector: `.${ getStyledClassNameFromKey( namespace ) }`,\n\t} );\n}\n\n/**\n * Attempts to retrieve the connected namespace from a component.\n *\n * @param Component The component to retrieve a namespace from.\n * @return The connected namespaces.\n */\nexport function getConnectNamespace(\n\tComponent: ReactChild | undefined | {}\n): string[] {\n\tif ( ! Component ) return [];\n\n\tlet namespaces = [];\n\n\t// @ts-ignore internal property\n\tif ( Component[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore internal property\n\t\tnamespaces = Component[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\t// @ts-ignore\n\tif ( Component.type && Component.type[ CONNECT_STATIC_NAMESPACE ] ) {\n\t\t// @ts-ignore\n\t\tnamespaces = Component.type[ CONNECT_STATIC_NAMESPACE ];\n\t}\n\n\treturn namespaces;\n}\n\n/**\n * Checks to see if a component is connected within the Context system.\n *\n * @param Component The component to retrieve a namespace from.\n * @param match The namespace to check.\n */\nexport function hasConnectNamespace(\n\tComponent: ReactNode,\n\tmatch: string[] | string\n): boolean {\n\tif ( ! Component ) return false;\n\n\tif ( typeof match === 'string' ) {\n\t\treturn getConnectNamespace( Component ).includes( match );\n\t}\n\tif ( Array.isArray( match ) ) {\n\t\treturn match.some( ( result ) =>\n\t\t\tgetConnectNamespace( Component ).includes( result )\n\t\t);\n\t}\n\n\treturn false;\n}\n"]}
@@ -9,9 +9,11 @@ exports.useComponentsContext = exports.ContextSystemProvider = exports.Component
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
12
+ var _deepmerge = _interopRequireDefault(require("deepmerge"));
13
+
12
14
  var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
13
15
 
14
- var _lodash = require("lodash");
16
+ var _isPlainObject = require("is-plain-object");
15
17
 
16
18
  var _warning = _interopRequireDefault(require("@wordpress/warning"));
17
19
 
@@ -62,7 +64,7 @@ function useContextSystemBridge(_ref) {
62
64
  }, [value]); // `parentContext` will always be memoized (i.e., the result of this hook itself)
63
65
  // or the default value from when the `ComponentsContext` was originally
64
66
  // initialized (which will never change, it's a static variable)
65
- // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless
67
+ // so this memoization will prevent `deepmerge()` from rerunning unless
66
68
  // the references to `value` change OR the `parentContext` has an actual material change
67
69
  // (because again, it's guaranteed to be memoized or a static reference to the empty object
68
70
  // so we know that the only changes for `parentContext` are material ones... i.e., why we
@@ -70,11 +72,13 @@ function useContextSystemBridge(_ref) {
70
72
  // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are
71
73
  // correctly warning when the `value` isn't being properly memoized. All of that to say
72
74
  // that this should be super safe to assume that `useMemo` will only run on actual
73
- // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!
75
+ // changes to the two dependencies, therefore saving us calls to `deepmerge()`!
74
76
 
75
77
  const config = (0, _element.useMemo)(() => {
76
78
  // Deep clone `parentContext` to avoid mutating it later.
77
- return (0, _lodash.merge)(JSON.parse(JSON.stringify(parentContext)), value);
79
+ return (0, _deepmerge.default)(parentContext !== null && parentContext !== void 0 ? parentContext : {}, value !== null && value !== void 0 ? value : {}, {
80
+ isMergeableObject: _isPlainObject.isPlainObject
81
+ });
78
82
  }, [parentContext, value]);
79
83
  return config;
80
84
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["ComponentsContext","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","JSON","stringify","config","parse","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAYA;;AAKA;;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAUA;AACA;AACA;AAGO,MAAMA,iBAAiB,GAAG;AAChC;AAAqC,EADL,CAA1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ourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { merge } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn merge( JSON.parse( JSON.stringify( parentContext ) ), value );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/context-system-provider.js"],"names":["ComponentsContext","useComponentsContext","useContextSystemBridge","value","parentContext","valueRef","current","JSON","stringify","config","isMergeableObject","isPlainObject","BaseContextSystemProvider","children","contextValue","ContextSystemProvider"],"mappings":";;;;;;;;;AAUA;;AAPA;;AACA;;AACA;;AAYA;;AAKA;;AAtBA;AACA;AACA;;AAKA;AACA;AACA;;AAUA;AACA;AACA;AAGO,MAAMA,iBAAiB,GAAG;AAChC;AAAqC,EADL,CAA1B;;;AAGA,MAAMC,oBAAoB,GAAG,MAAM,yBAAYD,iBAAZ,CAAnC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACA,SAASE,sBAAT,OAA6C;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AAC5C,QAAMC,aAAa,GAAGH,oBAAoB,EAA1C;AAEA,QAAMI,QAAQ,GAAG,qBAAQF,KAAR,CAAjB;AAEA,8BAAiB,MAAM;AACtB,SACC;AACA,qBAAeE,QAAQ,CAACC,OAAxB,EAAiCH,KAAjC,KACA;AACAE,IAAAA,QAAQ,CAACC,OAAT,KAAqBH,KAJtB,EAKE;AACD,qHAAO,gCAAgCI,IAAI,CAACC,SAAL,CAAgBL,KAAhB,CAAyB,EAAhE;AACA;AACD,GATD,EASG,CAAEA,KAAF,CATH,EAL4C,CAgB5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,QAAMM,MAAM,GAAG,sBAAS,MAAM;AAC7B;AACA,WAAO,wBAAWL,aAAX,aAAWA,aAAX,cAAWA,aAAX,GAA4B,EAA5B,EAAgCD,KAAhC,aAAgCA,KAAhC,cAAgCA,KAAhC,GAAyC,EAAzC,EAA6C;AACnDO,MAAAA,iBAAiB,EAAEC;AADgC,KAA7C,CAAP;AAGA,GALc,EAKZ,CAAEP,aAAF,EAAiBD,KAAjB,CALY,CAAf;AAOA,SAAOM,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMG,yBAAyB,GAAG,SAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYV,IAAAA;AAAZ,GAAyB;AAC5D,QAAMW,YAAY,GAAGZ,sBAAsB,CAAE;AAAEC,IAAAA;AAAF,GAAF,CAA3C;AAEA,SACC,4BAAC,iBAAD,CAAmB,QAAnB;AAA4B,IAAA,KAAK,EAAGW;AAApC,KACGD,QADH,CADD;AAKA,CARD;;AAUO,MAAME,qBAAqB,GAAG,mBAAMH,yBAAN,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport deepmerge from 'deepmerge';\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { isPlainObject } from 'is-plain-object';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreateContext,\n\tuseContext,\n\tuseRef,\n\tuseMemo,\n\tmemo,\n} from '@wordpress/element';\nimport warn from '@wordpress/warning';\n\n/**\n * Internal dependencies\n */\nimport { useUpdateEffect } from '../../utils';\n\nexport const ComponentsContext = createContext(\n\t/** @type {Record<string, any>} */ ( {} )\n);\nexport const useComponentsContext = () => useContext( ComponentsContext );\n\n/**\n * Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.\n *\n * Note: This function will warn if it detects an un-memoized `value`\n *\n * @param {Object} props\n * @param {Record<string, any>} props.value\n * @return {Record<string, any>} The consolidated value.\n */\nfunction useContextSystemBridge( { value } ) {\n\tconst parentContext = useComponentsContext();\n\n\tconst valueRef = useRef( value );\n\n\tuseUpdateEffect( () => {\n\t\tif (\n\t\t\t// Objects are equivalent.\n\t\t\tfastDeepEqual( valueRef.current, value ) &&\n\t\t\t// But not the same reference.\n\t\t\tvalueRef.current !== value\n\t\t) {\n\t\t\twarn( `Please memoize your context: ${ JSON.stringify( value ) }` );\n\t\t}\n\t}, [ value ] );\n\n\t// `parentContext` will always be memoized (i.e., the result of this hook itself)\n\t// or the default value from when the `ComponentsContext` was originally\n\t// initialized (which will never change, it's a static variable)\n\t// so this memoization will prevent `deepmerge()` from rerunning unless\n\t// the references to `value` change OR the `parentContext` has an actual material change\n\t// (because again, it's guaranteed to be memoized or a static reference to the empty object\n\t// so we know that the only changes for `parentContext` are material ones... i.e., why we\n\t// don't have to warn in the `useUpdateEffect` hook above for `parentContext` and we only\n\t// need to bother with the `value`). The `useUpdateEffect` above will ensure that we are\n\t// correctly warning when the `value` isn't being properly memoized. All of that to say\n\t// that this should be super safe to assume that `useMemo` will only run on actual\n\t// changes to the two dependencies, therefore saving us calls to `deepmerge()`!\n\tconst config = useMemo( () => {\n\t\t// Deep clone `parentContext` to avoid mutating it later.\n\t\treturn deepmerge( parentContext ?? {}, value ?? {}, {\n\t\t\tisMergeableObject: isPlainObject,\n\t\t} );\n\t}, [ parentContext, value ] );\n\n\treturn config;\n}\n\n/**\n * A Provider component that can modify props for connected components within\n * the Context system.\n *\n * @example\n * ```jsx\n * <ContextSystemProvider value={{ Button: { size: 'small' }}}>\n * <Button>...</Button>\n * </ContextSystemProvider>\n * ```\n *\n * @template {Record<string, any>} T\n * @param {Object} options\n * @param {import('react').ReactNode} options.children Children to render.\n * @param {T} options.value Props to render into connected components.\n * @return {JSX.Element} A Provider wrapped component.\n */\nconst BaseContextSystemProvider = ( { children, value } ) => {\n\tconst contextValue = useContextSystemBridge( { value } );\n\n\treturn (\n\t\t<ComponentsContext.Provider value={ contextValue }>\n\t\t\t{ children }\n\t\t</ComponentsContext.Provider>\n\t);\n};\n\nexport const ContextSystemProvider = memo( BaseContextSystemProvider );\n"]}
@@ -18,7 +18,7 @@ var _memize = _interopRequireDefault(require("memize"));
18
18
  /**
19
19
  * Generates the connected component CSS className based on the namespace.
20
20
  *
21
- * @param namespace The name of the connected component.
21
+ * @param namespace The name of the connected component.
22
22
  * @return The generated CSS className.
23
23
  */
24
24
  function getStyledClassName(namespace) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/context/get-styled-class-name-from-key.ts"],"names":["getStyledClassName","namespace","kebab","getStyledClassNameFromKey"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CAA6BC,SAA7B,EAAyD;AACxD,QAAMC,KAAK,GAAG,uBAAWD,SAAX,CAAd;AACA,SAAQ,cAAcC,KAAO,EAA7B;AACA;;AAEM,MAAMC,yBAAyB,GAAG,qBAASH,kBAAT,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/context/get-styled-class-name-from-key.ts"],"names":["getStyledClassName","namespace","kebab","getStyledClassNameFromKey"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,kBAAT,CAA6BC,SAA7B,EAAyD;AACxD,QAAMC,KAAK,GAAG,uBAAWD,SAAX,CAAd;AACA,SAAQ,cAAcC,KAAO,EAA7B;AACA;;AAEM,MAAMC,yBAAyB,GAAG,qBAASH,kBAAT,CAAlC","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport memoize from 'memize';\n\n/**\n * Generates the connected component CSS className based on the namespace.\n *\n * @param namespace The name of the connected component.\n * @return The generated CSS className.\n */\nfunction getStyledClassName( namespace: string ): string {\n\tconst kebab = kebabCase( namespace );\n\treturn `components-${ kebab }`;\n}\n\nexport const getStyledClassNameFromKey = memoize( getStyledClassName );\n"]}
@@ -18,7 +18,7 @@ var _element = require("@wordpress/element");
18
18
  /**
19
19
  * Gets a collection of available children elements from a React component's children prop.
20
20
  *
21
- * @param children
21
+ * @param children
22
22
  *
23
23
  * @return An array of available children.
24
24
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["getValidChildren","children","Children","toArray","filter","child"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,QADM,EAE8C;AACpD,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOC,kBAASC,OAAT,CAAkBF,QAAlB,EAA6BG,MAA7B,CAAuCC,KAAF,IAC3C,6BAAgBA,KAAhB,CADM,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactChild, ReactFragment, ReactPortal } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(\n\tchildren: ReactNode\n): Array< ReactChild | ReactFragment | ReactPortal > {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/get-valid-children.ts"],"names":["getValidChildren","children","Children","toArray","filter","child"],"mappings":";;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,QADM,EAE8C;AACpD,MAAK,OAAOA,QAAP,KAAoB,QAAzB,EAAoC,OAAO,CAAEA,QAAF,CAAP;AAEpC,SAAOC,kBAASC,OAAT,CAAkBF,QAAlB,EAA6BG,MAA7B,CAAuCC,KAAF,IAC3C,6BAAgBA,KAAhB,CADM,CAAP;AAGA","sourcesContent":["/**\n * External dependencies\n */\nimport type { ReactNode, ReactChild, ReactFragment, ReactPortal } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { Children, isValidElement } from '@wordpress/element';\n\n/**\n * Gets a collection of available children elements from a React component's children prop.\n *\n * @param children\n *\n * @return An array of available children.\n */\nexport function getValidChildren(\n\tchildren: ReactNode\n): Array< ReactChild | ReactFragment | ReactPortal > {\n\tif ( typeof children === 'string' ) return [ children ];\n\n\treturn Children.toArray( children ).filter( ( child ) =>\n\t\tisValidElement( child )\n\t);\n}\n"]}
@@ -24,7 +24,7 @@ const GRID_BASE = '4px';
24
24
  * When given a unit value or one of the named CSS values like `auto`,
25
25
  * it will simply return the value back.
26
26
  *
27
- * @param value A number, numeric string, or a unit value.
27
+ * @param value A number, numeric string, or a unit value.
28
28
  */
29
29
 
30
30
  function space(value) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/ui/utils/space.ts"],"names":["GRID_BASE","space","value","undefined","asInt","Number","window","CSS","supports","toString","isNaN"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAMA,SAAS,GAAG,KAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,KAAT,CAAgBC,KAAhB,EAAyD;AAAA;;AAC/D,MAAK,OAAOA,KAAP,KAAiB,WAAtB,EAAoC;AACnC,WAAOC,SAAP;AACA,GAH8D,CAK/D;;;AACA,MAAK,CAAED,KAAP,EAAe;AACd,WAAO,GAAP;AACA;;AAED,QAAME,KAAK,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCG,MAAM,CAAEH,KAAF,CAAxD,CAV+D,CAY/D;;AACA,MACG,OAAOI,MAAP,KAAkB,WAAlB,mBACDA,MAAM,CAACC,GADN,gEACD,YAAYC,QADX,iDACD,uCAAwB,QAAxB,EAAkCN,KAAK,CAACO,QAAN,EAAlC,CADD,IAEAJ,MAAM,CAACK,KAAP,CAAcN,KAAd,CAHD,EAIE;AACD,WAAOF,KAAK,CAACO,QAAN,EAAP;AACA;;AAED,SAAQ,QAAQT,SAAW,MAAME,KAAO,GAAxC;AACA","sourcesContent":["/**\n * The argument value for the `space()` utility function.\n *\n * When this is a number or a numeric string, it will be interpreted as a\n * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.\n *\n * Otherwise, it will be interpreted as a literal CSS length value. For example,\n * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.\n */\nexport type SpaceInput = number | string;\n\nconst GRID_BASE = '4px';\n\n/**\n * A function that handles numbers, numeric strings, and unit values.\n *\n * When given a number or a numeric string, it will return the grid-based\n * value as a factor of GRID_BASE, defined above.\n *\n * When given a unit value or one of the named CSS values like `auto`,\n * it will simply return the value back.\n *\n * @param value A number, numeric string, or a unit value.\n */\nexport function space( value?: SpaceInput ): string | undefined {\n\tif ( typeof value === 'undefined' ) {\n\t\treturn undefined;\n\t}\n\n\t// Handle empty strings, if it's the number 0 this still works.\n\tif ( ! value ) {\n\t\treturn '0';\n\t}\n\n\tconst asInt = typeof value === 'number' ? value : Number( value );\n\n\t// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.\n\tif (\n\t\t( typeof window !== 'undefined' &&\n\t\t\twindow.CSS?.supports?.( 'margin', value.toString() ) ) ||\n\t\tNumber.isNaN( asInt )\n\t) {\n\t\treturn value.toString();\n\t}\n\n\treturn `calc(${ GRID_BASE } * ${ value })`;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/ui/utils/space.ts"],"names":["GRID_BASE","space","value","undefined","asInt","Number","window","CSS","supports","toString","isNaN"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA,MAAMA,SAAS,GAAG,KAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,KAAT,CAAgBC,KAAhB,EAAyD;AAAA;;AAC/D,MAAK,OAAOA,KAAP,KAAiB,WAAtB,EAAoC;AACnC,WAAOC,SAAP;AACA,GAH8D,CAK/D;;;AACA,MAAK,CAAED,KAAP,EAAe;AACd,WAAO,GAAP;AACA;;AAED,QAAME,KAAK,GAAG,OAAOF,KAAP,KAAiB,QAAjB,GAA4BA,KAA5B,GAAoCG,MAAM,CAAEH,KAAF,CAAxD,CAV+D,CAY/D;;AACA,MACG,OAAOI,MAAP,KAAkB,WAAlB,mBACDA,MAAM,CAACC,GADN,gEACD,YAAYC,QADX,iDACD,uCAAwB,QAAxB,EAAkCN,KAAK,CAACO,QAAN,EAAlC,CADD,IAEAJ,MAAM,CAACK,KAAP,CAAcN,KAAd,CAHD,EAIE;AACD,WAAOF,KAAK,CAACO,QAAN,EAAP;AACA;;AAED,SAAQ,QAAQT,SAAW,MAAME,KAAO,GAAxC;AACA","sourcesContent":["/**\n * The argument value for the `space()` utility function.\n *\n * When this is a number or a numeric string, it will be interpreted as a\n * multiplier for the grid base value (4px). For example, `space( 2 )` will be 8px.\n *\n * Otherwise, it will be interpreted as a literal CSS length value. For example,\n * `space( 'auto' )` will be 'auto', and `space( '2px' )` will be 2px.\n */\nexport type SpaceInput = number | string;\n\nconst GRID_BASE = '4px';\n\n/**\n * A function that handles numbers, numeric strings, and unit values.\n *\n * When given a number or a numeric string, it will return the grid-based\n * value as a factor of GRID_BASE, defined above.\n *\n * When given a unit value or one of the named CSS values like `auto`,\n * it will simply return the value back.\n *\n * @param value A number, numeric string, or a unit value.\n */\nexport function space( value?: SpaceInput ): string | undefined {\n\tif ( typeof value === 'undefined' ) {\n\t\treturn undefined;\n\t}\n\n\t// Handle empty strings, if it's the number 0 this still works.\n\tif ( ! value ) {\n\t\treturn '0';\n\t}\n\n\tconst asInt = typeof value === 'number' ? value : Number( value );\n\n\t// Test if the input has a unit, was NaN, or was one of the named CSS values (like `auto`), in which case just use that value.\n\tif (\n\t\t( typeof window !== 'undefined' &&\n\t\t\twindow.CSS?.supports?.( 'margin', value.toString() ) ) ||\n\t\tNumber.isNaN( asInt )\n\t) {\n\t\treturn value.toString();\n\t}\n\n\treturn `calc(${ GRID_BASE } * ${ value })`;\n}\n"]}
@@ -173,8 +173,8 @@ function UnforwardedUnitControl(unitControlProps, forwardedRef) {
173
173
  * This allows us to tap into actions to transform the (next) state for
174
174
  * InputControl.
175
175
  *
176
- * @param state State from InputControl
177
- * @param action Action triggering state change
176
+ * @param state State from InputControl
177
+ * @param action Action triggering state change
178
178
  * @return The updated state to apply to InputControl
179
179
  */
180
180
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","stateReducerProp","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onBlur","onBlurProp","onFocus","onFocusProp","props","since","hint","version","nonNullValueProp","undefined","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","refParsedQuantity","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","mayUpdateUnit","event","isNaN","Number","currentTarget","current","validParsedQuantity","validParsedUnit","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","key","unitControlStateReducer","state","action","nextState","type","inputControlActionTypes","COMMIT","toString","stateReducer","baseState","inputSuffix","step","activeUnit","UnitControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA;;;;AANA;;AAKA;;AAEA;;AAMA;;AACA;;AACA;;AACA;;AAMA;;;;;;AA/BA;AACA;AACA;;AASA;AACA;AACA;AAsBA,SAASA,sBAAT,CACCC,gBADD,EAMCC,YAND,EAOE;AACD,QAAM;AACLC,IAAAA,sBAAsB,EAAEC,gBADnB;AAELC,IAAAA,YAAY,GAAG,KAFV;AAGL;AACAC,IAAAA,QAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,QAAQ,GAAG,KANN;AAOLC,IAAAA,YAAY,GAAG,KAPV;AAQLC,IAAAA,oBAAoB,GAAG,KARlB;AASLC,IAAAA,wBAAwB,GAAG,KATtB;AAULC,IAAAA,oBAAoB,GAAG,IAVlB;AAWLC,IAAAA,KAXK;AAYLC,IAAAA,QAAQ,EAAEC,YAZL;AAaLC,IAAAA,YAbK;AAcLC,IAAAA,IAAI,GAAG,SAdF;AAeLC,IAAAA,IAAI,EAAEC,QAfD;AAgBLC,IAAAA,KAAK,EAAEC,SAAS,GAAGC,gBAhBd;AAiBLC,IAAAA,KAAK,EAAEC,SAjBF;AAkBLC,IAAAA,MAAM,EAAEC,UAlBH;AAmBLC,IAAAA,OAAO,EAAEC,WAnBJ;AAoBL,OAAGC;AApBE,MAqBF5B,gBArBJ;;AAuBA,MAAK,UAAUA,gBAAf,EAAkC;AACjC,6BAAY,uBAAZ,EAAqC;AACpC6B,MAAAA,KAAK,EAAE,KAD6B;AAEpCC,MAAAA,IAAI,EAAE,sDAF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AG,MAAH,GAAY;AADxC,KAEMmB,KAFN;AAGC,IAAA,YAAY,EAAGxB,YAHhB;AAIC,IAAA,SAAS,EAAGqC,OAJb;AAKC,IAAA,QAAQ,EAAGlC,QALZ;AAMC,IAAA,YAAY,EAAC,MANd;AAOC,IAAA,oBAAoB,EAAGE,oBAPxB;AAQC,IAAA,KAAK,EAAGG,KART;AASC,IAAA,MAAM,EAAGoD,YATV;AAUC,IAAA,SAAS,EAAGC,eAVb;AAWC,IAAA,QAAQ,EAAGvB,sBAXZ;AAYC,IAAA,GAAG,EAAGzC,YAZP;AAaC,IAAA,IAAI,EAAGe,IAbR;AAcC,IAAA,MAAM,EAAG6D,WAdV;AAeC,IAAA,KAAK,EAAG3C,cAAH,aAAGA,cAAH,cAAGA,cAAH,GAAqB,EAf3B;AAgBC,IAAA,IAAI,EAAG4C,IAhBR;AAiBC,IAAA,sBAAsB,EAAGH,YAjB1B;AAkBC,IAAA,OAAO,EAAGhD;AAlBX,KADD;AAsBA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMqD,WAAW,GAAG,yBAAYjF,sBAAZ,CAApB;;eAGQiF,W","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tForwardedRef,\n\tSyntheticEvent,\n} from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonBlur: onBlurProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( nonNullValueProp, unitProp, unitsProp ),\n\t\t[ nonNullValueProp, unitProp, unitsProp ]\n\t);\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\t// Stores parsed value for hand-off in state reducer.\n\tconst refParsedQuantity = useRef< number | undefined >( undefined );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedQuantity.current = undefined;\n\t\t\treturn;\n\t\t}\n\t\tconst [ validParsedQuantity, validParsedUnit ] =\n\t\t\tgetValidParsedQuantityAndUnit(\n\t\t\t\tevent.currentTarget.value,\n\t\t\t\tunits,\n\t\t\t\tparsedQuantity,\n\t\t\t\tunit\n\t\t\t);\n\n\t\trefParsedQuantity.current = validParsedQuantity;\n\n\t\tif ( isPressEnterToChange && validParsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === validParsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\t// The `onChange` callback already gets called, no need to call it explicitly.\n\t\t\tonUnitChange?.( validParsedUnit, changeProps );\n\n\t\t\tsetUnit( validParsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = ( event ) => {\n\t\tmayUpdateUnit( event );\n\t\tonBlurProp?.( event );\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tif ( key === 'Enter' ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedQuantity.current !== undefined ) {\n\t\t\t\tnextState.value = (\n\t\t\t\t\trefParsedQuantity.current ?? ''\n\t\t\t\t).toString();\n\t\t\t\trefParsedQuantity.current = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn nextState;\n\t};\n\n\tlet stateReducer: StateReducer = unitControlStateReducer;\n\tif ( stateReducerProp ) {\n\t\tstateReducer = ( state, action ) => {\n\t\t\tconst baseState = unitControlStateReducer( state, action );\n\t\t\treturn stateReducerProp( baseState, action );\n\t\t};\n\t}\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonBlur={ onBlurProp }\n\t\t\tonFocus={ onFocusProp }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonBlur={ handleOnBlur }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\tonFocus={ onFocusProp }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/unit-control/index.tsx"],"names":["UnforwardedUnitControl","unitControlProps","forwardedRef","__unstableStateReducer","stateReducerProp","autoComplete","children","className","disabled","disableUnits","isPressEnterToChange","isResetValueOnUnitChange","isUnitSelectTabbable","label","onChange","onChangeProp","onUnitChange","size","unit","unitProp","units","unitsProp","CSS_UNITS","value","valueProp","onBlur","onBlurProp","onFocus","onFocusProp","props","since","hint","version","nonNullValueProp","undefined","parsedQuantity","parsedUnit","setUnit","length","initial","fallback","refParsedQuantity","classes","handleOnQuantityChange","nextQuantityValue","changeProps","onChangeValue","join","handleOnUnitChange","nextUnitValue","data","nextValue","default","mayUpdateUnit","event","isNaN","Number","currentTarget","current","validParsedQuantity","validParsedUnit","Array","isArray","find","option","handleOnBlur","handleOnKeyDown","key","unitControlStateReducer","state","action","nextState","type","inputControlActionTypes","COMMIT","toString","stateReducer","baseState","inputSuffix","step","activeUnit","UnitControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA;;;;AANA;;AAKA;;AAEA;;AAMA;;AACA;;AACA;;AACA;;AAMA;;;;;;AA/BA;AACA;AACA;;AASA;AACA;AACA;AAsBA,SAASA,sBAAT,CACCC,gBADD,EAMCC,YAND,EAOE;AACD,QAAM;AACLC,IAAAA,sBAAsB,EAAEC,gBADnB;AAELC,IAAAA,YAAY,GAAG,KAFV;AAGL;AACAC,IAAAA,QAJK;AAKLC,IAAAA,SALK;AAMLC,IAAAA,QAAQ,GAAG,KANN;AAOLC,IAAAA,YAAY,G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AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMqD,WAAW,GAAG,yBAAYjF,sBAAZ,CAApB;;eAGQiF,W","sourcesContent":["/**\n * External dependencies\n */\nimport type {\n\tFocusEventHandler,\n\tKeyboardEvent,\n\tForwardedRef,\n\tSyntheticEvent,\n} from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef, useMemo, useRef, useEffect } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { WordPressComponentProps } from '../ui/context';\nimport * as inputControlActionTypes from '../input-control/reducer/actions';\nimport { ValueInput } from './styles/unit-control-styles';\nimport UnitSelectControl from './unit-select-control';\nimport {\n\tCSS_UNITS,\n\tgetParsedQuantityAndUnit,\n\tgetUnitsWithCurrentUnit,\n\tgetValidParsedQuantityAndUnit,\n} from './utils';\nimport { useControlledState } from '../utils/hooks';\nimport type { UnitControlProps, UnitControlOnChangeCallback } from './types';\nimport type { StateReducer } from '../input-control/reducer/state';\n\nfunction UnforwardedUnitControl(\n\tunitControlProps: WordPressComponentProps<\n\t\tUnitControlProps,\n\t\t'input',\n\t\tfalse\n\t>,\n\tforwardedRef: ForwardedRef< any >\n) {\n\tconst {\n\t\t__unstableStateReducer: stateReducerProp,\n\t\tautoComplete = 'off',\n\t\t// @ts-expect-error Ensure that children is omitted from restProps\n\t\tchildren,\n\t\tclassName,\n\t\tdisabled = false,\n\t\tdisableUnits = false,\n\t\tisPressEnterToChange = false,\n\t\tisResetValueOnUnitChange = false,\n\t\tisUnitSelectTabbable = true,\n\t\tlabel,\n\t\tonChange: onChangeProp,\n\t\tonUnitChange,\n\t\tsize = 'default',\n\t\tunit: unitProp,\n\t\tunits: unitsProp = CSS_UNITS,\n\t\tvalue: valueProp,\n\t\tonBlur: onBlurProp,\n\t\tonFocus: onFocusProp,\n\t\t...props\n\t} = unitControlProps;\n\n\tif ( 'unit' in unitControlProps ) {\n\t\tdeprecated( 'UnitControl unit prop', {\n\t\t\tsince: '5.6',\n\t\t\thint: 'The unit should be provided within the `value` prop.',\n\t\t\tversion: '6.2',\n\t\t} );\n\t}\n\n\t// The `value` prop, in theory, should not be `null`, but the following line\n\t// ensures it fallback to `undefined` in case a consumer of `UnitControl`\n\t// still passes `null` as a `value`.\n\tconst nonNullValueProp = valueProp ?? undefined;\n\tconst units = useMemo(\n\t\t() => getUnitsWithCurrentUnit( nonNullValueProp, unitProp, unitsProp ),\n\t\t[ nonNullValueProp, unitProp, unitsProp ]\n\t);\n\tconst [ parsedQuantity, parsedUnit ] = getParsedQuantityAndUnit(\n\t\tnonNullValueProp,\n\t\tunitProp,\n\t\tunits\n\t);\n\n\tconst [ unit, setUnit ] = useControlledState< string | undefined >(\n\t\tunits.length === 1 ? units[ 0 ].value : unitProp,\n\t\t{\n\t\t\tinitial: parsedUnit,\n\t\t\tfallback: '',\n\t\t}\n\t);\n\n\tuseEffect( () => {\n\t\tif ( parsedUnit !== undefined ) {\n\t\t\tsetUnit( parsedUnit );\n\t\t}\n\t}, [ parsedUnit, setUnit ] );\n\n\t// Stores parsed value for hand-off in state reducer.\n\tconst refParsedQuantity = useRef< number | undefined >( undefined );\n\n\tconst classes = classnames(\n\t\t'components-unit-control',\n\t\t// This class is added for legacy purposes to maintain it on the outer\n\t\t// wrapper. See: https://github.com/WordPress/gutenberg/pull/45139\n\t\t'components-unit-control-wrapper',\n\t\tclassName\n\t);\n\n\tconst handleOnQuantityChange = (\n\t\tnextQuantityValue: number | string | undefined,\n\t\tchangeProps: {\n\t\t\tevent: SyntheticEvent;\n\t\t}\n\t) => {\n\t\tif (\n\t\t\tnextQuantityValue === '' ||\n\t\t\ttypeof nextQuantityValue === 'undefined' ||\n\t\t\tnextQuantityValue === null\n\t\t) {\n\t\t\tonChangeProp?.( '', changeProps );\n\t\t\treturn;\n\t\t}\n\n\t\t/*\n\t\t * Customizing the onChange callback.\n\t\t * This allows as to broadcast a combined value+unit to onChange.\n\t\t */\n\t\tconst onChangeValue = getValidParsedQuantityAndUnit(\n\t\t\tnextQuantityValue,\n\t\t\tunits,\n\t\t\tparsedQuantity,\n\t\t\tunit\n\t\t).join( '' );\n\n\t\tonChangeProp?.( onChangeValue, changeProps );\n\t};\n\n\tconst handleOnUnitChange: UnitControlOnChangeCallback = (\n\t\tnextUnitValue,\n\t\tchangeProps\n\t) => {\n\t\tconst { data } = changeProps;\n\n\t\tlet nextValue = `${ parsedQuantity ?? '' }${ nextUnitValue }`;\n\n\t\tif ( isResetValueOnUnitChange && data?.default !== undefined ) {\n\t\t\tnextValue = `${ data.default }${ nextUnitValue }`;\n\t\t}\n\n\t\tonChangeProp?.( nextValue, changeProps );\n\t\tonUnitChange?.( nextUnitValue, changeProps );\n\n\t\tsetUnit( nextUnitValue );\n\t};\n\n\tconst mayUpdateUnit = ( event: SyntheticEvent< HTMLInputElement > ) => {\n\t\tif ( ! isNaN( Number( event.currentTarget.value ) ) ) {\n\t\t\trefParsedQuantity.current = undefined;\n\t\t\treturn;\n\t\t}\n\t\tconst [ validParsedQuantity, validParsedUnit ] =\n\t\t\tgetValidParsedQuantityAndUnit(\n\t\t\t\tevent.currentTarget.value,\n\t\t\t\tunits,\n\t\t\t\tparsedQuantity,\n\t\t\t\tunit\n\t\t\t);\n\n\t\trefParsedQuantity.current = validParsedQuantity;\n\n\t\tif ( isPressEnterToChange && validParsedUnit !== unit ) {\n\t\t\tconst data = Array.isArray( units )\n\t\t\t\t? units.find( ( option ) => option.value === validParsedUnit )\n\t\t\t\t: undefined;\n\t\t\tconst changeProps = { event, data };\n\n\t\t\t// The `onChange` callback already gets called, no need to call it explicitly.\n\t\t\tonUnitChange?.( validParsedUnit, changeProps );\n\n\t\t\tsetUnit( validParsedUnit );\n\t\t}\n\t};\n\n\tconst handleOnBlur: FocusEventHandler< HTMLInputElement > = ( event ) => {\n\t\tmayUpdateUnit( event );\n\t\tonBlurProp?.( event );\n\t};\n\n\tconst handleOnKeyDown = ( event: KeyboardEvent< HTMLInputElement > ) => {\n\t\tconst { key } = event;\n\t\tif ( key === 'Enter' ) {\n\t\t\tmayUpdateUnit( event );\n\t\t}\n\t};\n\n\t/**\n\t * \"Middleware\" function that intercepts updates from InputControl.\n\t * This allows us to tap into actions to transform the (next) state for\n\t * InputControl.\n\t *\n\t * @param state State from InputControl\n\t * @param action Action triggering state change\n\t * @return The updated state to apply to InputControl\n\t */\n\tconst unitControlStateReducer: StateReducer = ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\t/*\n\t\t * On commits (when pressing ENTER and on blur if\n\t\t * isPressEnterToChange is true), if a parse has been performed\n\t\t * then use that result to update the state.\n\t\t */\n\t\tif ( action.type === inputControlActionTypes.COMMIT ) {\n\t\t\tif ( refParsedQuantity.current !== undefined ) {\n\t\t\t\tnextState.value = (\n\t\t\t\t\trefParsedQuantity.current ?? ''\n\t\t\t\t).toString();\n\t\t\t\trefParsedQuantity.current = undefined;\n\t\t\t}\n\t\t}\n\n\t\treturn nextState;\n\t};\n\n\tlet stateReducer: StateReducer = unitControlStateReducer;\n\tif ( stateReducerProp ) {\n\t\tstateReducer = ( state, action ) => {\n\t\t\tconst baseState = unitControlStateReducer( state, action );\n\t\t\treturn stateReducerProp( baseState, action );\n\t\t};\n\t}\n\n\tconst inputSuffix = ! disableUnits ? (\n\t\t<UnitSelectControl\n\t\t\taria-label={ __( 'Select unit' ) }\n\t\t\tdisabled={ disabled }\n\t\t\tisUnitSelectTabbable={ isUnitSelectTabbable }\n\t\t\tonChange={ handleOnUnitChange }\n\t\t\tsize={ size }\n\t\t\tunit={ unit }\n\t\t\tunits={ units }\n\t\t\tonBlur={ onBlurProp }\n\t\t\tonFocus={ onFocusProp }\n\t\t/>\n\t) : null;\n\n\tlet step = props.step;\n\n\t/*\n\t * If no step prop has been passed, lookup the active unit and\n\t * try to get step from `units`, or default to a value of `1`\n\t */\n\tif ( ! step && units ) {\n\t\tconst activeUnit = units.find( ( option ) => option.value === unit );\n\t\tstep = activeUnit?.step ?? 1;\n\t}\n\n\treturn (\n\t\t<ValueInput\n\t\t\ttype={ isPressEnterToChange ? 'text' : 'number' }\n\t\t\t{ ...props }\n\t\t\tautoComplete={ autoComplete }\n\t\t\tclassName={ classes }\n\t\t\tdisabled={ disabled }\n\t\t\tspinControls=\"none\"\n\t\t\tisPressEnterToChange={ isPressEnterToChange }\n\t\t\tlabel={ label }\n\t\t\tonBlur={ handleOnBlur }\n\t\t\tonKeyDown={ handleOnKeyDown }\n\t\t\tonChange={ handleOnQuantityChange }\n\t\t\tref={ forwardedRef }\n\t\t\tsize={ size }\n\t\t\tsuffix={ inputSuffix }\n\t\t\tvalue={ parsedQuantity ?? '' }\n\t\t\tstep={ step }\n\t\t\t__unstableStateReducer={ stateReducer }\n\t\t\tonFocus={ onFocusProp }\n\t\t/>\n\t);\n}\n\n/**\n * `UnitControl` allows the user to set a numeric quantity as well as a unit (e.g. `px`).\n *\n *\n * @example\n * ```jsx\n * import { __experimentalUnitControl as UnitControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * const [ value, setValue ] = useState( '10px' );\n *\n * return <UnitControl onChange={ setValue } value={ value } />;\n * };\n * ```\n */\nexport const UnitControl = forwardRef( UnforwardedUnitControl );\n\nexport { parseQuantityAndUnitFromRawValue, useCustomUnits } from './utils';\nexport default UnitControl;\n"]}
@@ -133,9 +133,9 @@ const DEFAULT_UNIT = allUnits.px;
133
133
  * Moving forward, ideally the value should be a string that contains both
134
134
  * the value and unit, example: '10px'
135
135
  *
136
- * @param rawValue The raw value as a string (may or may not contain the unit)
137
- * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
138
- * @param allowedUnits Units to derive from.
136
+ * @param rawValue The raw value as a string (may or may not contain the unit)
137
+ * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`
138
+ * @param allowedUnits Units to derive from.
139
139
  * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
140
140
  * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse
141
141
  * from the raw value could not be matched against the list of allowed units.
@@ -150,7 +150,7 @@ function getParsedQuantityAndUnit(rawValue, fallbackUnit, allowedUnits) {
150
150
  /**
151
151
  * Checks if units are defined.
152
152
  *
153
- * @param units List of units.
153
+ * @param units List of units.
154
154
  * @return Whether the list actually contains any units.
155
155
  */
156
156
 
@@ -165,8 +165,8 @@ function hasUnits(units) {
165
165
  * Parses a quantity and unit from a raw string value, given a list of allowed
166
166
  * units and otherwise falling back to the default unit.
167
167
  *
168
- * @param rawValue The raw value as a string (may or may not contain the unit)
169
- * @param allowedUnits Units to derive from.
168
+ * @param rawValue The raw value as a string (may or may not contain the unit)
169
+ * @param allowedUnits Units to derive from.
170
170
  * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
171
171
  * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed
172
172
  * from the raw value could not be matched against the list of allowed units.
@@ -203,10 +203,10 @@ function parseQuantityAndUnitFromRawValue(rawValue) {
203
203
  * Parses quantity and unit from a raw value. Validates parsed value, using fallback
204
204
  * value if invalid.
205
205
  *
206
- * @param rawValue The next value.
207
- * @param allowedUnits Units to derive from.
208
- * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
209
- * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
206
+ * @param rawValue The next value.
207
+ * @param allowedUnits Units to derive from.
208
+ * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.
209
+ * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.
210
210
  * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value
211
211
  * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The
212
212
  * unit can be `undefined` only if the unit parsed from the raw value could not be matched against
@@ -234,7 +234,7 @@ function getValidParsedQuantityAndUnit(rawValue, allowedUnits, fallbackQuantity,
234
234
  * Takes a unit value and finds the matching accessibility label for the
235
235
  * unit abbreviation.
236
236
  *
237
- * @param unit Unit value (example: `px`)
237
+ * @param unit Unit value (example: `px`)
238
238
  * @return a11y label for the unit abbreviation
239
239
  */
240
240
 
@@ -246,8 +246,8 @@ function getAccessibleLabelForUnit(unit) {
246
246
  /**
247
247
  * Filters available units based on values defined a list of allowed unit values.
248
248
  *
249
- * @param allowedUnitValues Collection of allowed unit value strings.
250
- * @param availableUnits Collection of available unit objects.
249
+ * @param allowedUnitValues Collection of allowed unit value strings.
250
+ * @param availableUnits Collection of available unit objects.
251
251
  * @return Filtered units.
252
252
  */
253
253
 
@@ -265,10 +265,10 @@ function filterUnitsWithSettings() {
265
265
  * TODO: ideally this hook shouldn't be needed
266
266
  * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
267
267
  *
268
- * @param args An object containing units, settingPath & defaultUnits.
269
- * @param args.units Collection of all potentially available units.
270
- * @param args.availableUnits Collection of unit value strings for filtering available units.
271
- * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
268
+ * @param args An object containing units, settingPath & defaultUnits.
269
+ * @param args.units Collection of all potentially available units.
270
+ * @param args.availableUnits Collection of unit value strings for filtering available units.
271
+ * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.
272
272
  *
273
273
  * @return Filtered list of units, with their default values updated following the `defaultValues`
274
274
  * argument's property.
@@ -302,9 +302,9 @@ const useCustomUnits = _ref => {
302
302
  * accurately displayed in the UI, even if the intention is to hide
303
303
  * the availability of that unit.
304
304
  *
305
- * @param rawValue Selected value to parse.
306
- * @param legacyUnit Legacy unit value, if rawValue needs it appended.
307
- * @param units List of available units.
305
+ * @param rawValue Selected value to parse.
306
+ * @param legacyUnit Legacy unit value, if rawValue needs it appended.
307
+ * @param units List of available units.
308
308
  *
309
309
  * @return A collection of units containing the unit for the current value.
310
310
  */