@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/unit-control/utils.ts"],"names":["isWeb","Platform","OS","allUnits","px","value","label","a11yLabel","step","em","rem","vw","vh","vmin","vmax","ch","ex","cm","mm","in","pc","pt","ALL_CSS_UNITS","Object","values","CSS_UNITS","DEFAULT_UNIT","getParsedQuantityAndUnit","rawValue","fallbackUnit","allowedUnits","initialValue","parseQuantityAndUnitFromRawValue","hasUnits","units","Array","isArray","length","trimmedValue","quantityToReturn","trim","parsedQuantity","parseFloat","isFinite","undefined","unitMatch","match","matchedUnit","toLowerCase","unitToReturn","find","item","getValidParsedQuantityAndUnit","fallbackQuantity","parsedUnit","getAccessibleLabelForUnit","unit","filterUnitsWithSettings","allowedUnitValues","availableUnits","filter","includes","useCustomUnits","defaultValues","customUnitsToReturn","forEach","i","parsedDefaultValue","default","getUnitsWithCurrentUnit","legacyUnit","unitsToReturn","currentUnit","some","unshift"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AASA,MAAMA,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AAEA,MAAMC,QAA6C,GAAG;AACrDC,EAAAA,EAAE,EAAE;AACHC,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEN,KAAK,GAAG,IAAH,GAAU,cAAI,aAAJ,CAFnB;AAGHO,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAHR;AAIHC,IAAAA,IAAI,EAAE;AAJH,GADiD;AAOrD,OAAK;AACJH,IAAAA,KAAK,EAAE,GADH;AAEJC,IAAAA,KAAK,EAAEN,KAAK,GAAG,GAAH,GAAS,cAAI,gBAAJ,CAFjB;AAGJO,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAHP;AAIJC,IAAAA,IAAI,EAAE;AAJF,GAPgD;AAarDC,EAAAA,EAAE,EAAE;A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port { __, _x } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WPUnitControlUnit } from './types';\n\nconst isWeb = Platform.OS === 'web';\n\nconst allUnits: Record< string, WPUnitControlUnit > = {\n\tpx: {\n\t\tvalue: 'px',\n\t\tlabel: isWeb ? 'px' : __( 'Pixels (px)' ),\n\t\ta11yLabel: __( 'Pixels (px)' ),\n\t\tstep: 1,\n\t},\n\t'%': {\n\t\tvalue: '%',\n\t\tlabel: isWeb ? '%' : __( 'Percentage (%)' ),\n\t\ta11yLabel: __( 'Percent (%)' ),\n\t\tstep: 0.1,\n\t},\n\tem: {\n\t\tvalue: 'em',\n\t\tlabel: isWeb ? 'em' : __( 'Relative to parent font size (em)' ),\n\t\ta11yLabel: _x( 'ems', 'Relative to parent font size (em)' ),\n\t\tstep: 0.01,\n\t},\n\trem: {\n\t\tvalue: 'rem',\n\t\tlabel: isWeb ? 'rem' : __( 'Relative to root font size (rem)' ),\n\t\ta11yLabel: _x( 'rems', 'Relative to root font size (rem)' ),\n\t\tstep: 0.01,\n\t},\n\tvw: {\n\t\tvalue: 'vw',\n\t\tlabel: isWeb ? 'vw' : __( 'Viewport width (vw)' ),\n\t\ta11yLabel: __( 'Viewport width (vw)' ),\n\t\tstep: 0.1,\n\t},\n\tvh: {\n\t\tvalue: 'vh',\n\t\tlabel: isWeb ? 'vh' : __( 'Viewport height (vh)' ),\n\t\ta11yLabel: __( 'Viewport height (vh)' ),\n\t\tstep: 0.1,\n\t},\n\tvmin: {\n\t\tvalue: 'vmin',\n\t\tlabel: isWeb ? 'vmin' : __( 'Viewport smallest dimension (vmin)' ),\n\t\ta11yLabel: __( 'Viewport smallest dimension (vmin)' ),\n\t\tstep: 0.1,\n\t},\n\tvmax: {\n\t\tvalue: 'vmax',\n\t\tlabel: isWeb ? 'vmax' : __( 'Viewport largest dimension (vmax)' ),\n\t\ta11yLabel: __( 'Viewport largest dimension (vmax)' ),\n\t\tstep: 0.1,\n\t},\n\tch: {\n\t\tvalue: 'ch',\n\t\tlabel: isWeb ? 'ch' : __( 'Width of the zero (0) character (ch)' ),\n\t\ta11yLabel: __( 'Width of the zero (0) character (ch)' ),\n\t\tstep: 0.01,\n\t},\n\tex: {\n\t\tvalue: 'ex',\n\t\tlabel: isWeb ? 'ex' : __( 'x-height of the font (ex)' ),\n\t\ta11yLabel: __( 'x-height of the font (ex)' ),\n\t\tstep: 0.01,\n\t},\n\tcm: {\n\t\tvalue: 'cm',\n\t\tlabel: isWeb ? 'cm' : __( 'Centimeters (cm)' ),\n\t\ta11yLabel: __( 'Centimeters (cm)' ),\n\t\tstep: 0.001,\n\t},\n\tmm: {\n\t\tvalue: 'mm',\n\t\tlabel: isWeb ? 'mm' : __( 'Millimeters (mm)' ),\n\t\ta11yLabel: __( 'Millimeters (mm)' ),\n\t\tstep: 0.1,\n\t},\n\tin: {\n\t\tvalue: 'in',\n\t\tlabel: isWeb ? 'in' : __( 'Inches (in)' ),\n\t\ta11yLabel: __( 'Inches (in)' ),\n\t\tstep: 0.001,\n\t},\n\tpc: {\n\t\tvalue: 'pc',\n\t\tlabel: isWeb ? 'pc' : __( 'Picas (pc)' ),\n\t\ta11yLabel: __( 'Picas (pc)' ),\n\t\tstep: 1,\n\t},\n\tpt: {\n\t\tvalue: 'pt',\n\t\tlabel: isWeb ? 'pt' : __( 'Points (pt)' ),\n\t\ta11yLabel: __( 'Points (pt)' ),\n\t\tstep: 1,\n\t},\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values( allUnits );\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [\n\tallUnits.px,\n\tallUnits[ '%' ],\n\tallUnits.em,\n\tallUnits.rem,\n\tallUnits.vw,\n\tallUnits.vh,\n];\n\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(\n\trawValue?: string | number,\n\tfallbackUnit?: string,\n\tallowedUnits?: WPUnitControlUnit[]\n): [ number | undefined, string | undefined ] {\n\tconst initialValue = fallbackUnit\n\t\t? `${ rawValue ?? '' }${ fallbackUnit }`\n\t\t: rawValue;\n\n\treturn parseQuantityAndUnitFromRawValue( initialValue, allowedUnits );\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits(\n\tunits?: WPUnitControlUnit[]\n): units is WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( units ) && !! units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(\n\trawValue?: string | number,\n\tallowedUnits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): [ number | undefined, string | undefined ] {\n\tlet trimmedValue;\n\tlet quantityToReturn;\n\n\tif ( typeof rawValue !== 'undefined' || rawValue === null ) {\n\t\ttrimmedValue = `${ rawValue }`.trim();\n\t\tconst parsedQuantity = parseFloat( trimmedValue );\n\t\tquantityToReturn = ! isFinite( parsedQuantity )\n\t\t\t? undefined\n\t\t\t: parsedQuantity;\n\t}\n\n\tconst unitMatch = trimmedValue?.match( /[\\d.\\-\\+]*\\s*(.*)/ );\n\tconst matchedUnit = unitMatch?.[ 1 ]?.toLowerCase();\n\tlet unitToReturn: string | undefined;\n\tif ( hasUnits( allowedUnits ) ) {\n\t\tconst match = allowedUnits.find(\n\t\t\t( item ) => item.value === matchedUnit\n\t\t);\n\t\tunitToReturn = match?.value;\n\t} else {\n\t\tunitToReturn = DEFAULT_UNIT.value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(\n\trawValue: string | number,\n\tallowedUnits?: WPUnitControlUnit[],\n\tfallbackQuantity?: number,\n\tfallbackUnit?: string\n): [ number | undefined, string | undefined ] {\n\tconst [ parsedQuantity, parsedUnit ] = parseQuantityAndUnitFromRawValue(\n\t\trawValue,\n\t\tallowedUnits\n\t);\n\n\t// The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n\t// either a real number or undefined. If undefined, use the fallback value.\n\tconst quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n\t// If no unit is parsed from the raw value, or if the fallback unit is not\n\t// defined, use the first value from the list of allowed units as fallback.\n\tlet unitToReturn = parsedUnit || fallbackUnit;\n\n\tif ( ! unitToReturn && hasUnits( allowedUnits ) ) {\n\t\tunitToReturn = allowedUnits[ 0 ].value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: `px`)\n * @return a11y label for the unit abbreviation\n */\nexport function getAccessibleLabelForUnit( unit: string ): string | undefined {\n\tconst match = ALL_CSS_UNITS.find( ( item ) => item.value === unit );\n\treturn match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(\n\tallowedUnitValues: string[] = [],\n\tavailableUnits: WPUnitControlUnit[]\n): WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( availableUnits )\n\t\t? availableUnits.filter( ( unit ) =>\n\t\t\t\tallowedUnitValues.includes( unit.value )\n\t\t )\n\t\t: [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ( {\n\tunits = ALL_CSS_UNITS,\n\tavailableUnits = [],\n\tdefaultValues,\n}: {\n\tunits?: WPUnitControlUnit[];\n\tavailableUnits?: string[];\n\tdefaultValues?: Record< string, number >;\n} ): WPUnitControlUnit[] => {\n\tconst customUnitsToReturn = filterUnitsWithSettings(\n\t\tavailableUnits,\n\t\tunits\n\t);\n\n\tif ( defaultValues ) {\n\t\tcustomUnitsToReturn.forEach( ( unit, i ) => {\n\t\t\tif ( defaultValues[ unit.value ] ) {\n\t\t\t\tconst [ parsedDefaultValue ] = parseQuantityAndUnitFromRawValue(\n\t\t\t\t\tdefaultValues[ unit.value ]\n\t\t\t\t);\n\n\t\t\t\tcustomUnitsToReturn[ i ].default = parsedDefaultValue;\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn customUnitsToReturn;\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(\n\trawValue?: string | number,\n\tlegacyUnit?: string,\n\tunits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): WPUnitControlUnit[] {\n\tconst unitsToReturn = Array.isArray( units ) ? [ ...units ] : [];\n\tconst [ , currentUnit ] = getParsedQuantityAndUnit(\n\t\trawValue,\n\t\tlegacyUnit,\n\t\tALL_CSS_UNITS\n\t);\n\n\tif (\n\t\tcurrentUnit &&\n\t\t! unitsToReturn.some( ( unit ) => unit.value === currentUnit )\n\t) {\n\t\tif ( allUnits[ currentUnit ] ) {\n\t\t\tunitsToReturn.unshift( allUnits[ currentUnit ] );\n\t\t}\n\t}\n\n\treturn unitsToReturn;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/unit-control/utils.ts"],"names":["isWeb","Platform","OS","allUnits","px","value","label","a11yLabel","step","em","rem","vw","vh","vmin","vmax","ch","ex","cm","mm","in","pc","pt","ALL_CSS_UNITS","Object","values","CSS_UNITS","DEFAULT_UNIT","getParsedQuantityAndUnit","rawValue","fallbackUnit","allowedUnits","initialValue","parseQuantityAndUnitFromRawValue","hasUnits","units","Array","isArray","length","trimmedValue","quantityToReturn","trim","parsedQuantity","parseFloat","isFinite","undefined","unitMatch","match","matchedUnit","toLowerCase","unitToReturn","find","item","getValidParsedQuantityAndUnit","fallbackQuantity","parsedUnit","getAccessibleLabelForUnit","unit","filterUnitsWithSettings","allowedUnitValues","availableUnits","filter","includes","useCustomUnits","defaultValues","customUnitsToReturn","forEach","i","parsedDefaultValue","default","getUnitsWithCurrentUnit","legacyUnit","unitsToReturn","currentUnit","some","unshift"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AASA,MAAMA,KAAK,GAAGC,kBAASC,EAAT,KAAgB,KAA9B;AAEA,MAAMC,QAA6C,GAAG;AACrDC,EAAAA,EAAE,EAAE;AACHC,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEN,KAAK,GAAG,IAAH,GAAU,cAAI,aAAJ,CAFnB;AAGHO,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAHR;AAIHC,IAAAA,IAAI,EAAE;AAJH,GADiD;AAOrD,OAAK;AACJH,IAAAA,KAAK,EAAE,GADH;AAEJC,IAAAA,KAAK,EAAEN,KAAK,GAAG,GAAH,GAAS,cAAI,gBAAJ,CAFjB;AAGJO,IAAAA,SAAS,EAAE,cAAI,aAAJ,CAHP;AAIJC,IAAAA,IAAI,EAAE;AAJF,GAPgD;AAarDC,EAAAA,EAAE,EAAE;AACHJ,IAAAA,KAAK,EAAE,IADJ;AAEHC,IAAAA,KAAK,EAAEN,KAAK,GAAG,IAAH,GAAU,cAAI,mCAAJ,CAFnB;AAGHO,IAAAA,SAAS,EAAE,cAAI,KAAJ,EAAW,mCAAX,CAHR;AAIHC,IAAAA,IAAI,EAAE;AAJH,GAbiD;AAmBrDE,EAAAA,GAAG,EAAE;AACJL,IAAAA,KAAK,EAAE,KADH;AAEJC,IAAAA,KAAK,EAAEN,KAAK,GAAG,KAAH,GAAW,cAAI,kCAAJ,CAFnB;AAGJO,IAAAA,SAAS,EAAE,cAAI,MAAJ,EAAY,kCAAZ,CAHP;AAIJC,IAAAA,IAAI,EAAE;AAJF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A/D;AAIA2D,QAAAA,mBAAmB,CAAEE,CAAF,CAAnB,CAAyBE,OAAzB,GAAmCD,kBAAnC;AACA;AACD,KARD;AASA;;AAED,SAAOH,mBAAP;AACA,CA3BM;AA6BP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASK,uBAAT,CACNzC,QADM,EAEN0C,UAFM,EAIgB;AAAA,MADtBpC,KACsB,uEADOZ,aACP;AACtB,QAAMiD,aAAa,GAAGpC,KAAK,CAACC,OAAN,CAAeF,KAAf,IAAyB,CAAE,GAAGA,KAAL,CAAzB,GAAwC,EAA9D;AACA,QAAM,GAAIsC,WAAJ,IAAoB7C,wBAAwB,CACjDC,QADiD,EAEjD0C,UAFiD,EAGjDhD,aAHiD,CAAlD;;AAMA,MACCkD,WAAW,IACX,CAAED,aAAa,CAACE,IAAd,CAAsBjB,IAAF,IAAYA,IAAI,CAACnD,KAAL,KAAemE,WAA/C,CAFH,EAGE;AACD,QAAKrE,QAAQ,CAAEqE,WAAF,CAAb,EAA+B;AAC9BD,MAAAA,aAAa,CAACG,OAAd,CAAuBvE,QAAQ,CAAEqE,WAAF,CAA/B;AACA;AACD;;AAED,SAAOD,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { WPUnitControlUnit } from './types';\n\nconst isWeb = Platform.OS === 'web';\n\nconst allUnits: Record< string, WPUnitControlUnit > = {\n\tpx: {\n\t\tvalue: 'px',\n\t\tlabel: isWeb ? 'px' : __( 'Pixels (px)' ),\n\t\ta11yLabel: __( 'Pixels (px)' ),\n\t\tstep: 1,\n\t},\n\t'%': {\n\t\tvalue: '%',\n\t\tlabel: isWeb ? '%' : __( 'Percentage (%)' ),\n\t\ta11yLabel: __( 'Percent (%)' ),\n\t\tstep: 0.1,\n\t},\n\tem: {\n\t\tvalue: 'em',\n\t\tlabel: isWeb ? 'em' : __( 'Relative to parent font size (em)' ),\n\t\ta11yLabel: _x( 'ems', 'Relative to parent font size (em)' ),\n\t\tstep: 0.01,\n\t},\n\trem: {\n\t\tvalue: 'rem',\n\t\tlabel: isWeb ? 'rem' : __( 'Relative to root font size (rem)' ),\n\t\ta11yLabel: _x( 'rems', 'Relative to root font size (rem)' ),\n\t\tstep: 0.01,\n\t},\n\tvw: {\n\t\tvalue: 'vw',\n\t\tlabel: isWeb ? 'vw' : __( 'Viewport width (vw)' ),\n\t\ta11yLabel: __( 'Viewport width (vw)' ),\n\t\tstep: 0.1,\n\t},\n\tvh: {\n\t\tvalue: 'vh',\n\t\tlabel: isWeb ? 'vh' : __( 'Viewport height (vh)' ),\n\t\ta11yLabel: __( 'Viewport height (vh)' ),\n\t\tstep: 0.1,\n\t},\n\tvmin: {\n\t\tvalue: 'vmin',\n\t\tlabel: isWeb ? 'vmin' : __( 'Viewport smallest dimension (vmin)' ),\n\t\ta11yLabel: __( 'Viewport smallest dimension (vmin)' ),\n\t\tstep: 0.1,\n\t},\n\tvmax: {\n\t\tvalue: 'vmax',\n\t\tlabel: isWeb ? 'vmax' : __( 'Viewport largest dimension (vmax)' ),\n\t\ta11yLabel: __( 'Viewport largest dimension (vmax)' ),\n\t\tstep: 0.1,\n\t},\n\tch: {\n\t\tvalue: 'ch',\n\t\tlabel: isWeb ? 'ch' : __( 'Width of the zero (0) character (ch)' ),\n\t\ta11yLabel: __( 'Width of the zero (0) character (ch)' ),\n\t\tstep: 0.01,\n\t},\n\tex: {\n\t\tvalue: 'ex',\n\t\tlabel: isWeb ? 'ex' : __( 'x-height of the font (ex)' ),\n\t\ta11yLabel: __( 'x-height of the font (ex)' ),\n\t\tstep: 0.01,\n\t},\n\tcm: {\n\t\tvalue: 'cm',\n\t\tlabel: isWeb ? 'cm' : __( 'Centimeters (cm)' ),\n\t\ta11yLabel: __( 'Centimeters (cm)' ),\n\t\tstep: 0.001,\n\t},\n\tmm: {\n\t\tvalue: 'mm',\n\t\tlabel: isWeb ? 'mm' : __( 'Millimeters (mm)' ),\n\t\ta11yLabel: __( 'Millimeters (mm)' ),\n\t\tstep: 0.1,\n\t},\n\tin: {\n\t\tvalue: 'in',\n\t\tlabel: isWeb ? 'in' : __( 'Inches (in)' ),\n\t\ta11yLabel: __( 'Inches (in)' ),\n\t\tstep: 0.001,\n\t},\n\tpc: {\n\t\tvalue: 'pc',\n\t\tlabel: isWeb ? 'pc' : __( 'Picas (pc)' ),\n\t\ta11yLabel: __( 'Picas (pc)' ),\n\t\tstep: 1,\n\t},\n\tpt: {\n\t\tvalue: 'pt',\n\t\tlabel: isWeb ? 'pt' : __( 'Points (pt)' ),\n\t\ta11yLabel: __( 'Points (pt)' ),\n\t\tstep: 1,\n\t},\n};\n\n/**\n * An array of all available CSS length units.\n */\nexport const ALL_CSS_UNITS = Object.values( allUnits );\n\n/**\n * Units of measurements. `a11yLabel` is used by screenreaders.\n */\nexport const CSS_UNITS = [\n\tallUnits.px,\n\tallUnits[ '%' ],\n\tallUnits.em,\n\tallUnits.rem,\n\tallUnits.vw,\n\tallUnits.vh,\n];\n\nexport const DEFAULT_UNIT = allUnits.px;\n\n/**\n * Handles legacy value + unit handling.\n * This component use to manage both incoming value and units separately.\n *\n * Moving forward, ideally the value should be a string that contains both\n * the value and unit, example: '10px'\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param fallbackUnit The unit used as a fallback, if not unit is detected in the `value`\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parse\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function getParsedQuantityAndUnit(\n\trawValue?: string | number,\n\tfallbackUnit?: string,\n\tallowedUnits?: WPUnitControlUnit[]\n): [ number | undefined, string | undefined ] {\n\tconst initialValue = fallbackUnit\n\t\t? `${ rawValue ?? '' }${ fallbackUnit }`\n\t\t: rawValue;\n\n\treturn parseQuantityAndUnitFromRawValue( initialValue, allowedUnits );\n}\n\n/**\n * Checks if units are defined.\n *\n * @param units List of units.\n * @return Whether the list actually contains any units.\n */\nexport function hasUnits(\n\tunits?: WPUnitControlUnit[]\n): units is WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( units ) && !! units.length;\n}\n\n/**\n * Parses a quantity and unit from a raw string value, given a list of allowed\n * units and otherwise falling back to the default unit.\n *\n * @param rawValue The raw value as a string (may or may not contain the unit)\n * @param allowedUnits Units to derive from.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly. The unit can be `undefined` in case the unit parsed\n * from the raw value could not be matched against the list of allowed units.\n */\nexport function parseQuantityAndUnitFromRawValue(\n\trawValue?: string | number,\n\tallowedUnits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): [ number | undefined, string | undefined ] {\n\tlet trimmedValue;\n\tlet quantityToReturn;\n\n\tif ( typeof rawValue !== 'undefined' || rawValue === null ) {\n\t\ttrimmedValue = `${ rawValue }`.trim();\n\t\tconst parsedQuantity = parseFloat( trimmedValue );\n\t\tquantityToReturn = ! isFinite( parsedQuantity )\n\t\t\t? undefined\n\t\t\t: parsedQuantity;\n\t}\n\n\tconst unitMatch = trimmedValue?.match( /[\\d.\\-\\+]*\\s*(.*)/ );\n\tconst matchedUnit = unitMatch?.[ 1 ]?.toLowerCase();\n\tlet unitToReturn: string | undefined;\n\tif ( hasUnits( allowedUnits ) ) {\n\t\tconst match = allowedUnits.find(\n\t\t\t( item ) => item.value === matchedUnit\n\t\t);\n\t\tunitToReturn = match?.value;\n\t} else {\n\t\tunitToReturn = DEFAULT_UNIT.value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Parses quantity and unit from a raw value. Validates parsed value, using fallback\n * value if invalid.\n *\n * @param rawValue The next value.\n * @param allowedUnits Units to derive from.\n * @param fallbackQuantity The fallback quantity, used in case it's not possible to parse a valid quantity from the raw value.\n * @param fallbackUnit The fallback unit, used in case it's not possible to parse a valid unit from the raw value.\n * @return The extracted quantity and unit. The quantity can be `undefined` in case the raw value\n * could not be parsed to a number correctly, and the `fallbackQuantity` was also `undefined`. The\n * unit can be `undefined` only if the unit parsed from the raw value could not be matched against\n * the list of allowed units, the `fallbackQuantity` is also `undefined` and the list of\n * `allowedUnits` is passed empty.\n */\nexport function getValidParsedQuantityAndUnit(\n\trawValue: string | number,\n\tallowedUnits?: WPUnitControlUnit[],\n\tfallbackQuantity?: number,\n\tfallbackUnit?: string\n): [ number | undefined, string | undefined ] {\n\tconst [ parsedQuantity, parsedUnit ] = parseQuantityAndUnitFromRawValue(\n\t\trawValue,\n\t\tallowedUnits\n\t);\n\n\t// The parsed value from `parseQuantityAndUnitFromRawValue` should now be\n\t// either a real number or undefined. If undefined, use the fallback value.\n\tconst quantityToReturn = parsedQuantity ?? fallbackQuantity;\n\n\t// If no unit is parsed from the raw value, or if the fallback unit is not\n\t// defined, use the first value from the list of allowed units as fallback.\n\tlet unitToReturn = parsedUnit || fallbackUnit;\n\n\tif ( ! unitToReturn && hasUnits( allowedUnits ) ) {\n\t\tunitToReturn = allowedUnits[ 0 ].value;\n\t}\n\n\treturn [ quantityToReturn, unitToReturn ];\n}\n\n/**\n * Takes a unit value and finds the matching accessibility label for the\n * unit abbreviation.\n *\n * @param unit Unit value (example: `px`)\n * @return a11y label for the unit abbreviation\n */\nexport function getAccessibleLabelForUnit( unit: string ): string | undefined {\n\tconst match = ALL_CSS_UNITS.find( ( item ) => item.value === unit );\n\treturn match?.a11yLabel ? match?.a11yLabel : match?.value;\n}\n\n/**\n * Filters available units based on values defined a list of allowed unit values.\n *\n * @param allowedUnitValues Collection of allowed unit value strings.\n * @param availableUnits Collection of available unit objects.\n * @return Filtered units.\n */\nexport function filterUnitsWithSettings(\n\tallowedUnitValues: string[] = [],\n\tavailableUnits: WPUnitControlUnit[]\n): WPUnitControlUnit[] {\n\t// Although the `isArray` check shouldn't be necessary (given the signature of\n\t// this typed function), it's better to stay on the side of caution, since\n\t// this function may be called from un-typed environments.\n\treturn Array.isArray( availableUnits )\n\t\t? availableUnits.filter( ( unit ) =>\n\t\t\t\tallowedUnitValues.includes( unit.value )\n\t\t )\n\t\t: [];\n}\n\n/**\n * Custom hook to retrieve and consolidate units setting from add_theme_support().\n * TODO: ideally this hook shouldn't be needed\n * https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823\n *\n * @param args An object containing units, settingPath & defaultUnits.\n * @param args.units Collection of all potentially available units.\n * @param args.availableUnits Collection of unit value strings for filtering available units.\n * @param args.defaultValues Collection of default values for defined units. Example: `{ px: 350, em: 15 }`.\n *\n * @return Filtered list of units, with their default values updated following the `defaultValues`\n * argument's property.\n */\nexport const useCustomUnits = ( {\n\tunits = ALL_CSS_UNITS,\n\tavailableUnits = [],\n\tdefaultValues,\n}: {\n\tunits?: WPUnitControlUnit[];\n\tavailableUnits?: string[];\n\tdefaultValues?: Record< string, number >;\n} ): WPUnitControlUnit[] => {\n\tconst customUnitsToReturn = filterUnitsWithSettings(\n\t\tavailableUnits,\n\t\tunits\n\t);\n\n\tif ( defaultValues ) {\n\t\tcustomUnitsToReturn.forEach( ( unit, i ) => {\n\t\t\tif ( defaultValues[ unit.value ] ) {\n\t\t\t\tconst [ parsedDefaultValue ] = parseQuantityAndUnitFromRawValue(\n\t\t\t\t\tdefaultValues[ unit.value ]\n\t\t\t\t);\n\n\t\t\t\tcustomUnitsToReturn[ i ].default = parsedDefaultValue;\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn customUnitsToReturn;\n};\n\n/**\n * Get available units with the unit for the currently selected value\n * prepended if it is not available in the list of units.\n *\n * This is useful to ensure that the current value's unit is always\n * accurately displayed in the UI, even if the intention is to hide\n * the availability of that unit.\n *\n * @param rawValue Selected value to parse.\n * @param legacyUnit Legacy unit value, if rawValue needs it appended.\n * @param units List of available units.\n *\n * @return A collection of units containing the unit for the current value.\n */\nexport function getUnitsWithCurrentUnit(\n\trawValue?: string | number,\n\tlegacyUnit?: string,\n\tunits: WPUnitControlUnit[] = ALL_CSS_UNITS\n): WPUnitControlUnit[] {\n\tconst unitsToReturn = Array.isArray( units ) ? [ ...units ] : [];\n\tconst [ , currentUnit ] = getParsedQuantityAndUnit(\n\t\trawValue,\n\t\tlegacyUnit,\n\t\tALL_CSS_UNITS\n\t);\n\n\tif (\n\t\tcurrentUnit &&\n\t\t! unitsToReturn.some( ( unit ) => unit.value === currentUnit )\n\t) {\n\t\tif ( allUnits[ currentUnit ] ) {\n\t\t\tunitsToReturn.unshift( allUnits[ currentUnit ] );\n\t\t}\n\t}\n\n\treturn unitsToReturn;\n}\n"]}
@@ -9,8 +9,8 @@ exports.mergeEventHandlers = mergeEventHandlers;
9
9
  * Merges event handlers together.
10
10
  *
11
11
  * @template TEvent
12
- * @param handler
13
- * @param otherHandler
12
+ * @param handler
13
+ * @param otherHandler
14
14
  */
15
15
  function mergeEvent(handler, otherHandler) {
16
16
  return event => {
@@ -27,8 +27,8 @@ function mergeEvent(handler, otherHandler) {
27
27
  * Merges two sets of event handlers together.
28
28
  *
29
29
  * @template TEvent
30
- * @param handlers
31
- * @param extraHandlers
30
+ * @param handlers
31
+ * @param extraHandlers
32
32
  */
33
33
 
34
34
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/events.ts"],"names":["mergeEvent","handler","otherHandler","event","mergeEventHandlers","handlers","extraHandlers","mergedHandlers","key","Object","entries"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAT,CACCC,OADD,EAECC,YAFD,EAG0B;AACzB,SAASC,KAAF,IAAqB;AAC3B,QAAK,OAAOF,OAAP,KAAmB,UAAxB,EAAqC;AACpCA,MAAAA,OAAO,CAAEE,KAAF,CAAP;AACA;;AACD,QAAK,OAAOD,YAAP,KAAwB,UAA7B,EAA0C;AACzCA,MAAAA,YAAY,CAAEC,KAAF,CAAZ;AACA;AACD,GAPD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAIJC,QAJI,EAIaC,aAJb,EAIqD;AAC3D;AACA,QAAMC,cAA8B,GAAG,EACtC,GAAGF;AADmC,GAAvC;;AAIA,OAAM,MAAM,CAAEG,GAAF,EAAOP,OAAP,CAAZ,IAAgCQ,MAAM,CAACC,OAAP,CAAgBJ,aAAhB,CAAhC,EAAkE;AACjE;AACAC,IAAAA,cAAc,CAAEC,GAAF,CAAd,GACCA,GAAG,IAAID,cAAP,GACGP,UAAU,CAAEO,cAAc,CAAEC,GAAF,CAAhB,EAAyBP,OAAzB,CADb,GAEGA,OAHJ;AAIA;;AAED,SAAOM,cAAP;AACA","sourcesContent":["type EventHandler< T extends Event > = ( event: T ) => void;\n\n/**\n * Merges event handlers together.\n *\n * @template TEvent\n * @param handler\n * @param otherHandler\n */\nfunction mergeEvent< TEvent extends Event >(\n\thandler: EventHandler< TEvent >,\n\totherHandler: EventHandler< TEvent >\n): EventHandler< TEvent > {\n\treturn ( event: TEvent ) => {\n\t\tif ( typeof handler === 'function' ) {\n\t\t\thandler( event );\n\t\t}\n\t\tif ( typeof otherHandler === 'function' ) {\n\t\t\totherHandler( event );\n\t\t}\n\t};\n}\n\n/**\n * Merges two sets of event handlers together.\n *\n * @template TEvent\n * @param handlers\n * @param extraHandlers\n */\nexport function mergeEventHandlers<\n\tTEvent extends Event,\n\tTLeft extends Record< string, EventHandler< TEvent > >,\n\tTRight extends Record< string, EventHandler< TEvent > >\n>( handlers: TLeft, extraHandlers: TRight ): TLeft & TRight {\n\t// @ts-ignore We'll fill in all the properties below\n\tconst mergedHandlers: TLeft & TRight = {\n\t\t...handlers,\n\t};\n\n\tfor ( const [ key, handler ] of Object.entries( extraHandlers ) ) {\n\t\t// @ts-ignore\n\t\tmergedHandlers[ key as keyof typeof mergedHandlers ] =\n\t\t\tkey in mergedHandlers\n\t\t\t\t? mergeEvent( mergedHandlers[ key ], handler )\n\t\t\t\t: handler;\n\t}\n\n\treturn mergedHandlers;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/events.ts"],"names":["mergeEvent","handler","otherHandler","event","mergeEventHandlers","handlers","extraHandlers","mergedHandlers","key","Object","entries"],"mappings":";;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAT,CACCC,OADD,EAECC,YAFD,EAG0B;AACzB,SAASC,KAAF,IAAqB;AAC3B,QAAK,OAAOF,OAAP,KAAmB,UAAxB,EAAqC;AACpCA,MAAAA,OAAO,CAAEE,KAAF,CAAP;AACA;;AACD,QAAK,OAAOD,YAAP,KAAwB,UAA7B,EAA0C;AACzCA,MAAAA,YAAY,CAAEC,KAAF,CAAZ;AACA;AACD,GAPD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAIJC,QAJI,EAIaC,aAJb,EAIqD;AAC3D;AACA,QAAMC,cAA8B,GAAG,EACtC,GAAGF;AADmC,GAAvC;;AAIA,OAAM,MAAM,CAAEG,GAAF,EAAOP,OAAP,CAAZ,IAAgCQ,MAAM,CAACC,OAAP,CAAgBJ,aAAhB,CAAhC,EAAkE;AACjE;AACAC,IAAAA,cAAc,CAAEC,GAAF,CAAd,GACCA,GAAG,IAAID,cAAP,GACGP,UAAU,CAAEO,cAAc,CAAEC,GAAF,CAAhB,EAAyBP,OAAzB,CADb,GAEGA,OAHJ;AAIA;;AAED,SAAOM,cAAP;AACA","sourcesContent":["type EventHandler< T extends Event > = ( event: T ) => void;\n\n/**\n * Merges event handlers together.\n *\n * @template TEvent\n * @param handler\n * @param otherHandler\n */\nfunction mergeEvent< TEvent extends Event >(\n\thandler: EventHandler< TEvent >,\n\totherHandler: EventHandler< TEvent >\n): EventHandler< TEvent > {\n\treturn ( event: TEvent ) => {\n\t\tif ( typeof handler === 'function' ) {\n\t\t\thandler( event );\n\t\t}\n\t\tif ( typeof otherHandler === 'function' ) {\n\t\t\totherHandler( event );\n\t\t}\n\t};\n}\n\n/**\n * Merges two sets of event handlers together.\n *\n * @template TEvent\n * @param handlers\n * @param extraHandlers\n */\nexport function mergeEventHandlers<\n\tTEvent extends Event,\n\tTLeft extends Record< string, EventHandler< TEvent > >,\n\tTRight extends Record< string, EventHandler< TEvent > >\n>( handlers: TLeft, extraHandlers: TRight ): TLeft & TRight {\n\t// @ts-ignore We'll fill in all the properties below\n\tconst mergedHandlers: TLeft & TRight = {\n\t\t...handlers,\n\t};\n\n\tfor ( const [ key, handler ] of Object.entries( extraHandlers ) ) {\n\t\t// @ts-ignore\n\t\tmergedHandlers[ key as keyof typeof mergedHandlers ] =\n\t\t\tkey in mergedHandlers\n\t\t\t\t? mergeEvent( mergedHandlers[ key ], handler )\n\t\t\t\t: handler;\n\t}\n\n\treturn mergedHandlers;\n}\n"]}
@@ -20,8 +20,8 @@ var _values = require("../values");
20
20
  /**
21
21
  * @template T
22
22
  * @typedef Options
23
- * @property {T | undefined} initial Initial value
24
- * @property {T | ""} fallback Fallback value
23
+ * @property {T} [initial] Initial value
24
+ * @property {T | ""} fallback Fallback value
25
25
  */
26
26
 
27
27
  /** @type {Readonly<{ initial: undefined, fallback: '' }>} */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-controlled-state.js"],"names":["defaultOptions","initial","undefined","fallback","useControlledState","currentState","options","internalState","setInternalState","hasCurrentState","state","setState","nextState"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,cAAc,GAAG;AACtBC,EAAAA,OAAO,EAAEC,SADa;;AAEtB;AACD;AACA;AACA;AACCC,EAAAA,QAAQ,EAAE;AANY,CAAvB;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,YAA7B,EAAsE;AAAA,MAA3BC,OAA2B,uEAAjBN,cAAiB;AACrE,QAAM;AAAEC,IAAAA,OAAF;AAAWE,IAAAA;AAAX,MAAwB,EAAE,GAAGH,cAAL;AAAqB,OAAGM;AAAxB,GAA9B;AAEA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAUH,YAAV,CAA5C;AACA,QAAMI,eAAe,GAAG,4BAAgBJ,YAAhB,CAAxB;AAEA;AACD;AACA;;AACC,0BAAW,MAAM;AAChB,QAAKI,eAAe,IAAIF,aAAxB,EAAwC;AACvCC,MAAAA,gBAAgB,CAAEN,SAAF,CAAhB;AACA;AACD,GAJD,EAIG,CAAEO,eAAF,EAAmBF,aAAnB,CAJH;AAMA,QAAMG,KAAK,GAAG,6BACb,CAAEL,YAAF,EAAgBE,aAAhB,EAA+BN,OAA/B,CADa,EAEbE,QAFa,CAAd;AAKA;;AACA;;AACA,QAAMQ,QAAQ,GAAG,0BACdC,SAAF,IAAiB;AAChB,QAAK,CAAEH,eAAP,EAAyB;AACxBD,MAAAA,gBAAgB,CAAEI,SAAF,CAAhB;AACA;AACD,GALe,EAMhB,CAAEH,eAAF,CANgB,CAAjB;AAQA;;AAEA,SAAO,CAAEC,KAAF,EAASC,QAAT,CAAP;AACA;;eAEcP,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { isValueDefined, getDefinedValue } from '../values';\n\n/**\n * @template T\n * @typedef Options\n * @property {T | undefined} initial Initial value\n * @property {T | \"\"} fallback Fallback value\n */\n\n/** @type {Readonly<{ initial: undefined, fallback: '' }>} */\nconst defaultOptions = {\n\tinitial: undefined,\n\t/**\n\t * Defaults to empty string, as that is preferred for usage with\n\t * <input />, <textarea />, and <select /> form elements.\n\t */\n\tfallback: '',\n};\n\n/**\n * Custom hooks for \"controlled\" components to track and consolidate internal\n * state and incoming values. This is useful for components that render\n * `input`, `textarea`, or `select` HTML elements.\n *\n * https://reactjs.org/docs/forms.html#controlled-components\n *\n * At first, a component using useControlledState receives an initial prop\n * value, which is used as initial internal state.\n *\n * This internal state can be maintained and updated without\n * relying on new incoming prop values.\n *\n * Unlike the basic useState hook, useControlledState's state can\n * be updated if a new incoming prop value is changed.\n *\n * @template T\n *\n * @param {T | undefined} currentState The current value.\n * @param {Options<T>} [options=defaultOptions] Additional options for the hook.\n *\n * @return {[T | \"\", (nextState: T) => void]} The controlled value and the value setter.\n */\nfunction useControlledState( currentState, options = defaultOptions ) {\n\tconst { initial, fallback } = { ...defaultOptions, ...options };\n\n\tconst [ internalState, setInternalState ] = useState( currentState );\n\tconst hasCurrentState = isValueDefined( currentState );\n\n\t/*\n\t * Resets internal state if value every changes from uncontrolled <-> controlled.\n\t */\n\tuseEffect( () => {\n\t\tif ( hasCurrentState && internalState ) {\n\t\t\tsetInternalState( undefined );\n\t\t}\n\t}, [ hasCurrentState, internalState ] );\n\n\tconst state = getDefinedValue(\n\t\t[ currentState, internalState, initial ],\n\t\tfallback\n\t);\n\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {(nextState: T) => void} */\n\tconst setState = useCallback(\n\t\t( nextState ) => {\n\t\t\tif ( ! hasCurrentState ) {\n\t\t\t\tsetInternalState( nextState );\n\t\t\t}\n\t\t},\n\t\t[ hasCurrentState ]\n\t);\n\t/* eslint-enable jsdoc/no-undefined-types */\n\n\treturn [ state, setState ];\n}\n\nexport default useControlledState;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-controlled-state.js"],"names":["defaultOptions","initial","undefined","fallback","useControlledState","currentState","options","internalState","setInternalState","hasCurrentState","state","setState","nextState"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAMA,cAAc,GAAG;AACtBC,EAAAA,OAAO,EAAEC,SADa;;AAEtB;AACD;AACA;AACA;AACCC,EAAAA,QAAQ,EAAE;AANY,CAAvB;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,YAA7B,EAAsE;AAAA,MAA3BC,OAA2B,uEAAjBN,cAAiB;AACrE,QAAM;AAAEC,IAAAA,OAAF;AAAWE,IAAAA;AAAX,MAAwB,EAAE,GAAGH,cAAL;AAAqB,OAAGM;AAAxB,GAA9B;AAEA,QAAM,CAAEC,aAAF,EAAiBC,gBAAjB,IAAsC,uBAAUH,YAAV,CAA5C;AACA,QAAMI,eAAe,GAAG,4BAAgBJ,YAAhB,CAAxB;AAEA;AACD;AACA;;AACC,0BAAW,MAAM;AAChB,QAAKI,eAAe,IAAIF,aAAxB,EAAwC;AACvCC,MAAAA,gBAAgB,CAAEN,SAAF,CAAhB;AACA;AACD,GAJD,EAIG,CAAEO,eAAF,EAAmBF,aAAnB,CAJH;AAMA,QAAMG,KAAK,GAAG,6BACb,CAAEL,YAAF,EAAgBE,aAAhB,EAA+BN,OAA/B,CADa,EAEbE,QAFa,CAAd;AAKA;;AACA;;AACA,QAAMQ,QAAQ,GAAG,0BACdC,SAAF,IAAiB;AAChB,QAAK,CAAEH,eAAP,EAAyB;AACxBD,MAAAA,gBAAgB,CAAEI,SAAF,CAAhB;AACA;AACD,GALe,EAMhB,CAAEH,eAAF,CANgB,CAAjB;AAQA;;AAEA,SAAO,CAAEC,KAAF,EAASC,QAAT,CAAP;AACA;;eAEcP,kB","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { isValueDefined, getDefinedValue } from '../values';\n\n/**\n * @template T\n * @typedef Options\n * @property {T} [initial] Initial value\n * @property {T | \"\"} fallback Fallback value\n */\n\n/** @type {Readonly<{ initial: undefined, fallback: '' }>} */\nconst defaultOptions = {\n\tinitial: undefined,\n\t/**\n\t * Defaults to empty string, as that is preferred for usage with\n\t * <input />, <textarea />, and <select /> form elements.\n\t */\n\tfallback: '',\n};\n\n/**\n * Custom hooks for \"controlled\" components to track and consolidate internal\n * state and incoming values. This is useful for components that render\n * `input`, `textarea`, or `select` HTML elements.\n *\n * https://reactjs.org/docs/forms.html#controlled-components\n *\n * At first, a component using useControlledState receives an initial prop\n * value, which is used as initial internal state.\n *\n * This internal state can be maintained and updated without\n * relying on new incoming prop values.\n *\n * Unlike the basic useState hook, useControlledState's state can\n * be updated if a new incoming prop value is changed.\n *\n * @template T\n *\n * @param {T | undefined} currentState The current value.\n * @param {Options<T>} [options=defaultOptions] Additional options for the hook.\n *\n * @return {[T | \"\", (nextState: T) => void]} The controlled value and the value setter.\n */\nfunction useControlledState( currentState, options = defaultOptions ) {\n\tconst { initial, fallback } = { ...defaultOptions, ...options };\n\n\tconst [ internalState, setInternalState ] = useState( currentState );\n\tconst hasCurrentState = isValueDefined( currentState );\n\n\t/*\n\t * Resets internal state if value every changes from uncontrolled <-> controlled.\n\t */\n\tuseEffect( () => {\n\t\tif ( hasCurrentState && internalState ) {\n\t\t\tsetInternalState( undefined );\n\t\t}\n\t}, [ hasCurrentState, internalState ] );\n\n\tconst state = getDefinedValue(\n\t\t[ currentState, internalState, initial ],\n\t\tfallback\n\t);\n\n\t/* eslint-disable jsdoc/no-undefined-types */\n\t/** @type {(nextState: T) => void} */\n\tconst setState = useCallback(\n\t\t( nextState ) => {\n\t\t\tif ( ! hasCurrentState ) {\n\t\t\t\tsetInternalState( nextState );\n\t\t\t}\n\t\t},\n\t\t[ hasCurrentState ]\n\t);\n\t/* eslint-enable jsdoc/no-undefined-types */\n\n\treturn [ state, setState ];\n}\n\nexport default useControlledState;\n"]}
@@ -14,10 +14,10 @@ var _element = require("@wordpress/element");
14
14
  /**
15
15
  * Simplified and improved implementation of useControlledState.
16
16
  *
17
- * @param props
18
- * @param props.defaultValue
19
- * @param props.value
20
- * @param props.onChange
17
+ * @param props
18
+ * @param props.defaultValue
19
+ * @param props.value
20
+ * @param props.onChange
21
21
  * @return The controlled value and the value setter.
22
22
  */
23
23
  function useControlledValue(_ref) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-controlled-value.ts"],"names":["useControlledValue","defaultValue","onChange","value","valueProp","hasValue","initialValue","state","setState","setValue","nextValue"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,OAIS;AAAA,MAJyB;AACxCC,IAAAA,YADwC;AAExCC,IAAAA,QAFwC;AAGxCC,IAAAA,KAAK,EAAEC;AAHiC,GAIzB;AACf,QAAMC,QAAQ,GAAG,OAAOD,SAAP,KAAqB,WAAtC;AACA,QAAME,YAAY,GAAGD,QAAQ,GAAGD,SAAH,GAAeH,YAA5C;AACA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsB,uBAAUF,YAAV,CAA5B;AACA,QAAMH,KAAK,GAAGE,QAAQ,GAAGD,SAAH,GAAeG,KAArC;AAEA,MAAIE,QAAJ;;AACA,MAAKJ,QAAQ,IAAI,OAAOH,QAAP,KAAoB,UAArC,EAAkD;AACjDO,IAAAA,QAAQ,GAAGP,QAAX;AACA,GAFD,MAEO,IAAK,CAAEG,QAAF,IAAc,OAAOH,QAAP,KAAoB,UAAvC,EAAoD;AAC1DO,IAAAA,QAAQ,GAAKC,SAAF,IAAiB;AAC3BR,MAAAA,QAAQ,CAAEQ,SAAF,CAAR;AACAF,MAAAA,QAAQ,CAAEE,SAAF,CAAR;AACA,KAHD;AAIA,GALM,MAKA;AACND,IAAAA,QAAQ,GAAGD,QAAX;AACA;;AAED,SAAO,CAAEL,KAAF,EAASM,QAAT,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\ntype Props< T > = {\n\tdefaultValue?: T;\n\tvalue?: T;\n\tonChange?: ( value: T ) => void;\n};\n\n/**\n * Simplified and improved implementation of useControlledState.\n *\n * @param props\n * @param props.defaultValue\n * @param props.value\n * @param props.onChange\n * @return The controlled value and the value setter.\n */\nexport function useControlledValue< T >( {\n\tdefaultValue,\n\tonChange,\n\tvalue: valueProp,\n}: Props< T > ) {\n\tconst hasValue = typeof valueProp !== 'undefined';\n\tconst initialValue = hasValue ? valueProp : defaultValue;\n\tconst [ state, setState ] = useState( initialValue );\n\tconst value = hasValue ? valueProp : state;\n\n\tlet setValue: ( nextValue: T ) => void;\n\tif ( hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = onChange;\n\t} else if ( ! hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = ( nextValue ) => {\n\t\t\tonChange( nextValue );\n\t\t\tsetState( nextValue );\n\t\t};\n\t} else {\n\t\tsetValue = setState;\n\t}\n\n\treturn [ value, setValue as typeof setState ] as const;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-controlled-value.ts"],"names":["useControlledValue","defaultValue","onChange","value","valueProp","hasValue","initialValue","state","setState","setValue","nextValue"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,kBAAT,OAIS;AAAA,MAJyB;AACxCC,IAAAA,YADwC;AAExCC,IAAAA,QAFwC;AAGxCC,IAAAA,KAAK,EAAEC;AAHiC,GAIzB;AACf,QAAMC,QAAQ,GAAG,OAAOD,SAAP,KAAqB,WAAtC;AACA,QAAME,YAAY,GAAGD,QAAQ,GAAGD,SAAH,GAAeH,YAA5C;AACA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsB,uBAAUF,YAAV,CAA5B;AACA,QAAMH,KAAK,GAAGE,QAAQ,GAAGD,SAAH,GAAeG,KAArC;AAEA,MAAIE,QAAJ;;AACA,MAAKJ,QAAQ,IAAI,OAAOH,QAAP,KAAoB,UAArC,EAAkD;AACjDO,IAAAA,QAAQ,GAAGP,QAAX;AACA,GAFD,MAEO,IAAK,CAAEG,QAAF,IAAc,OAAOH,QAAP,KAAoB,UAAvC,EAAoD;AAC1DO,IAAAA,QAAQ,GAAKC,SAAF,IAAiB;AAC3BR,MAAAA,QAAQ,CAAEQ,SAAF,CAAR;AACAF,MAAAA,QAAQ,CAAEE,SAAF,CAAR;AACA,KAHD;AAIA,GALM,MAKA;AACND,IAAAA,QAAQ,GAAGD,QAAX;AACA;;AAED,SAAO,CAAEL,KAAF,EAASM,QAAT,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\n\ntype Props< T > = {\n\tdefaultValue?: T;\n\tvalue?: T;\n\tonChange?: ( value: T ) => void;\n};\n\n/**\n * Simplified and improved implementation of useControlledState.\n *\n * @param props\n * @param props.defaultValue\n * @param props.value\n * @param props.onChange\n * @return The controlled value and the value setter.\n */\nexport function useControlledValue< T >( {\n\tdefaultValue,\n\tonChange,\n\tvalue: valueProp,\n}: Props< T > ) {\n\tconst hasValue = typeof valueProp !== 'undefined';\n\tconst initialValue = hasValue ? valueProp : defaultValue;\n\tconst [ state, setState ] = useState( initialValue );\n\tconst value = hasValue ? valueProp : state;\n\n\tlet setValue: ( nextValue: T ) => void;\n\tif ( hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = onChange;\n\t} else if ( ! hasValue && typeof onChange === 'function' ) {\n\t\tsetValue = ( nextValue ) => {\n\t\t\tonChange( nextValue );\n\t\t\tsetState( nextValue );\n\t\t};\n\t} else {\n\t\tsetValue = setState;\n\t}\n\n\treturn [ value, setValue as typeof setState ] as const;\n}\n"]}
@@ -23,7 +23,7 @@ var _compose = require("@wordpress/compose");
23
23
  *
24
24
  * @see https://codesandbox.io/s/uselatestref-mlj3i?file=/src/App.tsx
25
25
  *
26
- * @param value The value to reference
26
+ * @param value The value to reference
27
27
  * @return The prop reference.
28
28
  */
29
29
  function useLatestRef(value) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-latest-ref.ts"],"names":["useLatestRef","value","ref","current"],"mappings":";;;;;;;AAQA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAA4BC,KAA5B,EAAuD;AAC7D,QAAMC,GAAG,GAAG,qBAAQD,KAAR,CAAZ;AAEA,0CAA2B,MAAM;AAChCC,IAAAA,GAAG,CAACC,OAAJ,GAAcF,KAAd;AACA,GAFD;AAIA,SAAOC,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useIsomorphicLayoutEffect } from '@wordpress/compose';\n\n/**\n * Creates a reference for a prop. This is useful for preserving dependency\n * memoization for hooks like useCallback.\n *\n * @see https://codesandbox.io/s/uselatestref-mlj3i?file=/src/App.tsx\n *\n * @param value The value to reference\n * @return The prop reference.\n */\nexport function useLatestRef< T >( value: T ): RefObject< T > {\n\tconst ref = useRef( value );\n\n\tuseIsomorphicLayoutEffect( () => {\n\t\tref.current = value;\n\t} );\n\n\treturn ref;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/hooks/use-latest-ref.ts"],"names":["useLatestRef","value","ref","current"],"mappings":";;;;;;;AAQA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAA4BC,KAA5B,EAAuD;AAC7D,QAAMC,GAAG,GAAG,qBAAQD,KAAR,CAAZ;AAEA,0CAA2B,MAAM;AAChCC,IAAAA,GAAG,CAACC,OAAJ,GAAcF,KAAd;AACA,GAFD;AAIA,SAAOC,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { RefObject } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useRef } from '@wordpress/element';\nimport { useIsomorphicLayoutEffect } from '@wordpress/compose';\n\n/**\n * Creates a reference for a prop. This is useful for preserving dependency\n * memoization for hooks like useCallback.\n *\n * @see https://codesandbox.io/s/uselatestref-mlj3i?file=/src/App.tsx\n *\n * @param value The value to reference\n * @return The prop reference.\n */\nexport function useLatestRef< T >( value: T ): RefObject< T > {\n\tconst ref = useRef( value );\n\n\tuseIsomorphicLayoutEffect( () => {\n\t\tref.current = value;\n\t} );\n\n\treturn ref;\n}\n"]}
@@ -9,7 +9,7 @@ const UNITED_VALUE_REGEX = /^([\d.\-+]*)\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|
9
9
  /**
10
10
  * Parses a number and unit from a value.
11
11
  *
12
- * @param toParse Value to parse
12
+ * @param toParse Value to parse
13
13
  *
14
14
  * @return The extracted number and unit.
15
15
  */
@@ -30,8 +30,8 @@ function parseCSSUnitValue(toParse) {
30
30
  /**
31
31
  * Combines a value and a unit into a unit value.
32
32
  *
33
- * @param value
34
- * @param unit
33
+ * @param value
34
+ * @param unit
35
35
  *
36
36
  * @return The unit value.
37
37
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/utils/unit-values.ts"],"names":["UNITED_VALUE_REGEX","parseCSSUnitValue","toParse","value","trim","matched","match","undefined","num","unit","numParsed","parseFloat","Number","isNaN","createCSSUnitValue"],"mappings":";;;;;;;AAAA,MAAMA,kBAAkB,GACvB,0IADD;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,iBAAT,CACNC,OADM,EAEuC;AAC7C,QAAMC,KAAK,GAAGD,OAAO,CAACE,IAAR,EAAd;AAEA,QAAMC,OAAO,GAAGF,KAAK,CAACG,KAAN,CAAaN,kBAAb,CAAhB;;AACA,MAAK,CAAEK,OAAP,EAAiB;AAChB,WAAO,CAAEE,SAAF,EAAaA,SAAb,CAAP;AACA;;AACD,QAAM,GAAIC,GAAJ,EAASC,IAAT,IAAkBJ,OAAxB;AACA,MAAIK,SAA6B,GAAGC,UAAU,CAAEH,GAAF,CAA9C;AACAE,EAAAA,SAAS,GAAGE,MAAM,CAACC,KAAP,CAAcH,SAAd,IAA4BH,SAA5B,GAAwCG,SAApD;AAEA,SAAO,CAAEA,SAAF,EAAaD,IAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,kBAAT,CACNX,KADM,EAENM,IAFM,EAGG;AACT,SAAQ,GAAGN,KAAO,GAAGM,IAAM,EAA3B;AACA","sourcesContent":["const UNITED_VALUE_REGEX =\n\t/^([\\d.\\-+]*)\\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?$/;\n\n/**\n * Parses a number and unit from a value.\n *\n * @param toParse Value to parse\n *\n * @return The extracted number and unit.\n */\nexport function parseCSSUnitValue(\n\ttoParse: string\n): [ number | undefined, string | undefined ] {\n\tconst value = toParse.trim();\n\n\tconst matched = value.match( UNITED_VALUE_REGEX );\n\tif ( ! matched ) {\n\t\treturn [ undefined, undefined ];\n\t}\n\tconst [ , num, unit ] = matched;\n\tlet numParsed: number | undefined = parseFloat( num );\n\tnumParsed = Number.isNaN( numParsed ) ? undefined : numParsed;\n\n\treturn [ numParsed, unit ];\n}\n\n/**\n * Combines a value and a unit into a unit value.\n *\n * @param value\n * @param unit\n *\n * @return The unit value.\n */\nexport function createCSSUnitValue(\n\tvalue: string | number,\n\tunit: string\n): string {\n\treturn `${ value }${ unit }`;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/utils/unit-values.ts"],"names":["UNITED_VALUE_REGEX","parseCSSUnitValue","toParse","value","trim","matched","match","undefined","num","unit","numParsed","parseFloat","Number","isNaN","createCSSUnitValue"],"mappings":";;;;;;;AAAA,MAAMA,kBAAkB,GACvB,0IADD;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,iBAAT,CACNC,OADM,EAEuC;AAC7C,QAAMC,KAAK,GAAGD,OAAO,CAACE,IAAR,EAAd;AAEA,QAAMC,OAAO,GAAGF,KAAK,CAACG,KAAN,CAAaN,kBAAb,CAAhB;;AACA,MAAK,CAAEK,OAAP,EAAiB;AAChB,WAAO,CAAEE,SAAF,EAAaA,SAAb,CAAP;AACA;;AACD,QAAM,GAAIC,GAAJ,EAASC,IAAT,IAAkBJ,OAAxB;AACA,MAAIK,SAA6B,GAAGC,UAAU,CAAEH,GAAF,CAA9C;AACAE,EAAAA,SAAS,GAAGE,MAAM,CAACC,KAAP,CAAcH,SAAd,IAA4BH,SAA5B,GAAwCG,SAApD;AAEA,SAAO,CAAEA,SAAF,EAAaD,IAAb,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,kBAAT,CACNX,KADM,EAENM,IAFM,EAGG;AACT,SAAQ,GAAGN,KAAO,GAAGM,IAAM,EAA3B;AACA","sourcesContent":["const UNITED_VALUE_REGEX =\n\t/^([\\d.\\-+]*)\\s*(fr|cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%|cap|ic|rlh|vi|vb|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?$/;\n\n/**\n * Parses a number and unit from a value.\n *\n * @param toParse Value to parse\n *\n * @return The extracted number and unit.\n */\nexport function parseCSSUnitValue(\n\ttoParse: string\n): [ number | undefined, string | undefined ] {\n\tconst value = toParse.trim();\n\n\tconst matched = value.match( UNITED_VALUE_REGEX );\n\tif ( ! matched ) {\n\t\treturn [ undefined, undefined ];\n\t}\n\tconst [ , num, unit ] = matched;\n\tlet numParsed: number | undefined = parseFloat( num );\n\tnumParsed = Number.isNaN( numParsed ) ? undefined : numParsed;\n\n\treturn [ numParsed, unit ];\n}\n\n/**\n * Combines a value and a unit into a unit value.\n *\n * @param value\n * @param unit\n *\n * @return The unit value.\n */\nexport function createCSSUnitValue(\n\tvalue: string | number,\n\tunit: string\n): string {\n\treturn `${ value }${ unit }`;\n}\n"]}
@@ -25,7 +25,7 @@ export const ALIGNMENTS = GRID.flat();
25
25
  /**
26
26
  * Parses and transforms an incoming value to better match the alignment values
27
27
  *
28
- * @param value An alignment value to parse.
28
+ * @param value An alignment value to parse.
29
29
  *
30
30
  * @return The parsed value.
31
31
  */
@@ -37,8 +37,8 @@ export function transformValue(value) {
37
37
  /**
38
38
  * Creates an item ID based on a prefix ID and an alignment value.
39
39
  *
40
- * @param prefixId An ID to prefix.
41
- * @param value An alignment value.
40
+ * @param prefixId An ID to prefix.
41
+ * @param value An alignment value.
42
42
  *
43
43
  * @return The item id.
44
44
  */
@@ -50,7 +50,7 @@ export function getItemId(prefixId, value) {
50
50
  /**
51
51
  * Retrieves the alignment index from a value.
52
52
  *
53
- * @param alignment Value to check.
53
+ * @param alignment Value to check.
54
54
  *
55
55
  * @return The index of a matching alignment.
56
56
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/alignment-matrix-control/utils.tsx"],"names":["__","GRID","ALIGNMENT_LABEL","center","ALIGNMENTS","flat","transformValue","value","nextValue","replace","getItemId","prefixId","valueId","getAlignmentIndex","alignment","item","index","indexOf","undefined"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA;AACA;AACA;;AAGA,OAAO,MAAMC,IAAqC,GAAG,CACpD,CAAE,UAAF,EAAc,YAAd,EAA4B,WAA5B,CADoD,EAEpD,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CAFoD,EAGpD,CAAE,aAAF,EAAiB,eAAjB,EAAkC,cAAlC,CAHoD,CAA9C,C,CAMP;;AACA,OAAO,MAAMC,eAA8D,GAAG;AAC7E,cAAYF,EAAE,CAAE,UAAF,CAD+D;AAE7E,gBAAcA,EAAE,CAAE,YAAF,CAF6D;AAG7E,eAAaA,EAAE,CAAE,WAAF,CAH8D;AAI7E,iBAAeA,EAAE,CAAE,aAAF,CAJ4D;AAK7E,mBAAiBA,EAAE,CAAE,QAAF,CAL0D;AAM7EG,EAAAA,MAAM,EAAEH,EAAE,CAAE,QAAF,CANmE;AAO7E,kBAAgBA,EAAE,CAAE,cAAF,CAP2D;AAQ7E,iBAAeA,EAAE,CAAE,aAAF,CAR4D;AAS7E,mBAAiBA,EAAE,CAAE,eAAF,CAT0D;AAU7E,kBAAgBA,EAAE,CAAE,cAAF;AAV2D,CAAvE,C,CAaP;;AACA,OAAO,MAAMI,UAAU,GAAGH,IAAI,CAACI,IAAL,EAAnB;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAyBC,KAAzB,EAA8D;AACpE,QAAMC,SAAS,GAAGD,KAAK,KAAK,QAAV,GAAqB,eAArB,GAAuCA,KAAzD;AAEA,SAAOC,SAAS,CAACC,OAAV,CAAmB,GAAnB,EAAwB,GAAxB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CACNC,QADM,EAENJ,KAFM,EAGL;AACD,QAAMK,OAAO,GAAGN,cAAc,CAAEC,KAAF,CAAd,CAAwBE,OAAxB,CAAiC,GAAjC,EAAsC,GAAtC,CAAhB;AAEA,SAAQ,GAAGE,QAAU,IAAIC,OAAS,EAAlC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,GAEL;AAAA,MADDC,SACC,uEADwC,QACxC;AACD,QAAMC,IAAI,GAAGT,cAAc,CAAEQ,SAAF,CAA3B;AACA,QAAME,KAAK,GAAGZ,UAAU,CAACa,OAAX,CAAoBF,IAApB,CAAd;AAEA,SAAOC,KAAK,GAAG,CAAC,CAAT,GAAaA,KAAb,GAAqBE,SAA5B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport type { AlignmentMatrixControlValue } from './types';\n\nexport const GRID: AlignmentMatrixControlValue[][] = [\n\t[ 'top left', 'top center', 'top right' ],\n\t[ 'center left', 'center center', 'center right' ],\n\t[ 'bottom left', 'bottom center', 'bottom right' ],\n];\n\n// Stored as map as i18n __() only accepts strings (not variables)\nexport const ALIGNMENT_LABEL: Record< AlignmentMatrixControlValue, string > = {\n\t'top left': __( 'Top Left' ),\n\t'top center': __( 'Top Center' ),\n\t'top right': __( 'Top Right' ),\n\t'center left': __( 'Center Left' ),\n\t'center center': __( 'Center' ),\n\tcenter: __( 'Center' ),\n\t'center right': __( 'Center Right' ),\n\t'bottom left': __( 'Bottom Left' ),\n\t'bottom center': __( 'Bottom Center' ),\n\t'bottom right': __( 'Bottom Right' ),\n};\n\n// Transforms GRID into a flat Array of values.\nexport const ALIGNMENTS = GRID.flat();\n\n/**\n * Parses and transforms an incoming value to better match the alignment values\n *\n * @param value An alignment value to parse.\n *\n * @return The parsed value.\n */\nexport function transformValue( value: AlignmentMatrixControlValue ) {\n\tconst nextValue = value === 'center' ? 'center center' : value;\n\n\treturn nextValue.replace( '-', ' ' ) as AlignmentMatrixControlValue;\n}\n\n/**\n * Creates an item ID based on a prefix ID and an alignment value.\n *\n * @param prefixId An ID to prefix.\n * @param value An alignment value.\n *\n * @return The item id.\n */\nexport function getItemId(\n\tprefixId: string,\n\tvalue: AlignmentMatrixControlValue\n) {\n\tconst valueId = transformValue( value ).replace( ' ', '-' );\n\n\treturn `${ prefixId }-${ valueId }`;\n}\n\n/**\n * Retrieves the alignment index from a value.\n *\n * @param alignment Value to check.\n *\n * @return The index of a matching alignment.\n */\nexport function getAlignmentIndex(\n\talignment: AlignmentMatrixControlValue = 'center'\n) {\n\tconst item = transformValue( alignment );\n\tconst index = ALIGNMENTS.indexOf( item );\n\n\treturn index > -1 ? index : undefined;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/alignment-matrix-control/utils.tsx"],"names":["__","GRID","ALIGNMENT_LABEL","center","ALIGNMENTS","flat","transformValue","value","nextValue","replace","getItemId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BE,OAAxB,CAAiC,GAAjC,EAAsC,GAAtC,CAAhB;AAEA,SAAQ,GAAGE,QAAU,IAAIC,OAAS,EAAlC;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,GAEL;AAAA,MADDC,SACC,uEADwC,QACxC;AACD,QAAMC,IAAI,GAAGT,cAAc,CAAEQ,SAAF,CAA3B;AACA,QAAME,KAAK,GAAGZ,UAAU,CAACa,OAAX,CAAoBF,IAApB,CAAd;AAEA,SAAOC,KAAK,GAAG,CAAC,CAAT,GAAaA,KAAb,GAAqBE,SAA5B;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport type { AlignmentMatrixControlValue } from './types';\n\nexport const GRID: AlignmentMatrixControlValue[][] = [\n\t[ 'top left', 'top center', 'top right' ],\n\t[ 'center left', 'center center', 'center right' ],\n\t[ 'bottom left', 'bottom center', 'bottom right' ],\n];\n\n// Stored as map as i18n __() only accepts strings (not variables)\nexport const ALIGNMENT_LABEL: Record< AlignmentMatrixControlValue, string > = {\n\t'top left': __( 'Top Left' ),\n\t'top center': __( 'Top Center' ),\n\t'top right': __( 'Top Right' ),\n\t'center left': __( 'Center Left' ),\n\t'center center': __( 'Center' ),\n\tcenter: __( 'Center' ),\n\t'center right': __( 'Center Right' ),\n\t'bottom left': __( 'Bottom Left' ),\n\t'bottom center': __( 'Bottom Center' ),\n\t'bottom right': __( 'Bottom Right' ),\n};\n\n// Transforms GRID into a flat Array of values.\nexport const ALIGNMENTS = GRID.flat();\n\n/**\n * Parses and transforms an incoming value to better match the alignment values\n *\n * @param value An alignment value to parse.\n *\n * @return The parsed value.\n */\nexport function transformValue( value: AlignmentMatrixControlValue ) {\n\tconst nextValue = value === 'center' ? 'center center' : value;\n\n\treturn nextValue.replace( '-', ' ' ) as AlignmentMatrixControlValue;\n}\n\n/**\n * Creates an item ID based on a prefix ID and an alignment value.\n *\n * @param prefixId An ID to prefix.\n * @param value An alignment value.\n *\n * @return The item id.\n */\nexport function getItemId(\n\tprefixId: string,\n\tvalue: AlignmentMatrixControlValue\n) {\n\tconst valueId = transformValue( value ).replace( ' ', '-' );\n\n\treturn `${ prefixId }-${ valueId }`;\n}\n\n/**\n * Retrieves the alignment index from a value.\n *\n * @param alignment Value to check.\n *\n * @return The index of a matching alignment.\n */\nexport function getAlignmentIndex(\n\talignment: AlignmentMatrixControlValue = 'center'\n) {\n\tconst item = transformValue( alignment );\n\tconst index = ALIGNMENTS.indexOf( item );\n\n\treturn index > -1 ? index : undefined;\n}\n"]}
@@ -18,11 +18,15 @@ function AngleCircle(_ref) {
18
18
  onChange,
19
19
  ...props
20
20
  } = _ref;
21
- const angleCircleRef = useRef();
21
+ const angleCircleRef = useRef(null);
22
22
  const angleCircleCenter = useRef();
23
23
  const previousCursorValue = useRef();
24
24
 
25
25
  const setAngleCircleCenter = () => {
26
+ if (angleCircleRef.current === null) {
27
+ return;
28
+ }
29
+
26
30
  const rect = angleCircleRef.current.getBoundingClientRect();
27
31
  angleCircleCenter.current = {
28
32
  x: rect.x + rect.width / 2,
@@ -31,16 +35,25 @@ function AngleCircle(_ref) {
31
35
  };
32
36
 
33
37
  const changeAngleToPosition = event => {
34
- const {
35
- x: centerX,
36
- y: centerY
37
- } = angleCircleCenter.current; // Prevent (drag) mouse events from selecting and accidentally
38
+ var _event$target;
39
+
40
+ if (event === undefined) {
41
+ return;
42
+ } // Prevent (drag) mouse events from selecting and accidentally
38
43
  // triggering actions from other elements.
39
44
 
45
+
40
46
  event.preventDefault(); // Input control needs to lose focus and by preventDefault above, it doesn't.
41
47
 
42
- event.target.focus();
43
- onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
48
+ (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.focus();
49
+
50
+ if (angleCircleCenter.current !== undefined && onChange !== undefined) {
51
+ const {
52
+ x: centerX,
53
+ y: centerY
54
+ } = angleCircleCenter.current;
55
+ onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
56
+ }
44
57
  };
45
58
 
46
59
  const {
@@ -62,31 +75,26 @@ function AngleCircle(_ref) {
62
75
 
63
76
  document.body.style.cursor = 'grabbing';
64
77
  } else {
65
- document.body.style.cursor = previousCursorValue.current || null;
78
+ document.body.style.cursor = previousCursorValue.current || '';
66
79
  previousCursorValue.current = undefined;
67
80
  }
68
81
  }, [isDragging]);
69
- return (
70
- /* eslint-disable jsx-a11y/no-static-element-interactions */
71
- createElement(CircleRoot, _extends({
72
- ref: angleCircleRef,
73
- onMouseDown: startDrag,
74
- className: "components-angle-picker-control__angle-circle",
75
- style: isDragging ? {
76
- cursor: 'grabbing'
77
- } : undefined
78
- }, props), createElement(CircleIndicatorWrapper, {
79
- style: value ? {
80
- transform: `rotate(${value}deg)`
81
- } : undefined,
82
- className: "components-angle-picker-control__angle-circle-indicator-wrapper",
83
- tabIndex: -1
84
- }, createElement(CircleIndicator, {
85
- className: "components-angle-picker-control__angle-circle-indicator"
86
- })))
87
- /* eslint-enable jsx-a11y/no-static-element-interactions */
88
-
89
- );
82
+ return createElement(CircleRoot, _extends({
83
+ ref: angleCircleRef,
84
+ onMouseDown: startDrag,
85
+ className: "components-angle-picker-control__angle-circle",
86
+ style: isDragging ? {
87
+ cursor: 'grabbing'
88
+ } : undefined
89
+ }, props), createElement(CircleIndicatorWrapper, {
90
+ style: value ? {
91
+ transform: `rotate(${value}deg)`
92
+ } : undefined,
93
+ className: "components-angle-picker-control__angle-circle-indicator-wrapper",
94
+ tabIndex: -1
95
+ }, createElement(CircleIndicator, {
96
+ className: "components-angle-picker-control__angle-circle-indicator"
97
+ })));
90
98
  }
91
99
 
92
100
  function getAngle(centerX, centerY, pointX, pointY) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/angle-picker-control/angle-circle.js"],"names":["useEffect","useRef","__experimentalUseDragging","useDragging","CircleRoot","CircleIndicatorWrapper","CircleIndicator","AngleCircle","value","onChange","props","angleCircleRef","angleCircleCenter","previousCursorValue","setAngleCircleCenter","rect","current","getBoundingClientRect","x","width","y","height","changeAngleToPosition","event","centerX","centerY","preventDefault","target","focus","getAngle","clientX","clientY","startDrag","isDragging","onDragStart","onDragMove","onDragEnd","undefined","document","body","style","cursor","transform","pointX","pointY","angleInRadians","Math","atan2","angleInDeg","round","PI"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,yBAAyB,IAAIC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SACCC,UADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,sCAJP;;AAMA,SAASC,WAAT,OAAsD;AAAA,MAAhC;AAAEC,IAAAA,KAAF;AAASC,IAAAA,QAAT;AAAmB,OAAGC;AAAtB,GAAgC;AACrD,QAAMC,cAAc,GAAGV,MAAM,EAA7B;AACA,QAAMW,iBAAiB,GAAGX,MAAM,EAAhC;AACA,QAAMY,mBAAmB,GAAGZ,MAAM,EAAlC;;AAEA,QAAMa,oBAAoB,GAAG,MAAM;AAClC,UAAMC,IAAI,GAAGJ,cAAc,CAACK,OAAf,CAAuBC,qBAAvB,EAAb;AACAL,IAAAA,iBAAiB,CAACI,OAAlB,GAA4B;AAC3BE,MAAAA,CAAC,EAAEH,IAAI,CAACG,CAAL,GAASH,IAAI,CAACI,KAAL,GAAa,CADE;AAE3BC,MAAAA,CAAC,EAAEL,IAAI,CAACK,CAAL,GAASL,IAAI,CAACM,MAAL,GAAc;AAFC,KAA5B;AAIA,GAND;;AAQA,QAAMC,qBAAqB,GAAKC,KAAF,IAAa;AAC1C,UAAM;AAAEL,MAAAA,CAAC,EAAEM,OAAL;AAAcJ,MAAAA,CAAC,EAAEK;AAAjB,QAA6Bb,iBAAiB,CAACI,OAArD,CAD0C,CAE1C;AACA;;AACAO,IAAAA,KAAK,CAACG,cAAN,GAJ0C,CAK1C;;AACAH,IAAAA,KAAK,CAACI,MAAN,CAAaC,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EkC,QAAAA,SAAS,EAAG,UAAUlC,KAAO;AAA/B,OAAH,GAA4C6B,SAFnD;AAIC,MAAA,SAAS,EAAC,iEAJX;AAKC,MAAA,QAAQ,EAAG,CAAC;AALb,OAOC,cAAC,eAAD;AAAiB,MAAA,SAAS,EAAC;AAA3B,MAPD,CAPD;AAiBA;;AAnBD;AAqBA;;AAED,SAASR,QAAT,CAAmBL,OAAnB,EAA4BC,OAA5B,EAAqCkB,MAArC,EAA6CC,MAA7C,EAAsD;AACrD,QAAMxB,CAAC,GAAGwB,MAAM,GAAGnB,OAAnB;AACA,QAAMP,CAAC,GAAGyB,MAAM,GAAGnB,OAAnB;AAEA,QAAMqB,cAAc,GAAGC,IAAI,CAACC,KAAL,CAAY3B,CAAZ,EAAeF,CAAf,CAAvB;AACA,QAAM8B,UAAU,GAAGF,IAAI,CAACG,KAAL,CAAYJ,cAAc,IAAK,MAAMC,IAAI,CAACI,EAAhB,CAA1B,IAAmD,EAAtE;;AACA,MAAKF,UAAU,GAAG,CAAlB,EAAsB;AACrB,WAAO,MAAMA,UAAb;AACA;;AACD,SAAOA,UAAP;AACA;;AAED,eAAezC,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCircleRoot,\n\tCircleIndicatorWrapper,\n\tCircleIndicator,\n} from './styles/angle-picker-control-styles';\n\nfunction AngleCircle( { value, onChange, ...props } ) {\n\tconst angleCircleRef = useRef();\n\tconst angleCircleCenter = useRef();\n\tconst previousCursorValue = useRef();\n\n\tconst setAngleCircleCenter = () => {\n\t\tconst rect = angleCircleRef.current.getBoundingClientRect();\n\t\tangleCircleCenter.current = {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t};\n\t};\n\n\tconst changeAngleToPosition = ( event ) => {\n\t\tconst { x: centerX, y: centerY } = angleCircleCenter.current;\n\t\t// Prevent (drag) mouse events from selecting and accidentally\n\t\t// triggering actions from other elements.\n\t\tevent.preventDefault();\n\t\t// Input control needs to lose focus and by preventDefault above, it doesn't.\n\t\tevent.target.focus();\n\t\tonChange( getAngle( centerX, centerY, event.clientX, event.clientY ) );\n\t};\n\n\tconst { startDrag, isDragging } = useDragging( {\n\t\tonDragStart: ( event ) => {\n\t\t\tsetAngleCircleCenter();\n\t\t\tchangeAngleToPosition( event );\n\t\t},\n\t\tonDragMove: changeAngleToPosition,\n\t\tonDragEnd: changeAngleToPosition,\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tif ( previousCursorValue.current === undefined ) {\n\t\t\t\tpreviousCursorValue.current = document.body.style.cursor;\n\t\t\t}\n\t\t\tdocument.body.style.cursor = 'grabbing';\n\t\t} else {\n\t\t\tdocument.body.style.cursor = previousCursorValue.current || null;\n\t\t\tpreviousCursorValue.current = undefined;\n\t\t}\n\t}, [ isDragging ] );\n\n\treturn (\n\t\t/* eslint-disable jsx-a11y/no-static-element-interactions */\n\t\t<CircleRoot\n\t\t\tref={ angleCircleRef }\n\t\t\tonMouseDown={ startDrag }\n\t\t\tclassName=\"components-angle-picker-control__angle-circle\"\n\t\t\tstyle={ isDragging ? { cursor: 'grabbing' } : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<CircleIndicatorWrapper\n\t\t\t\tstyle={\n\t\t\t\t\tvalue ? { transform: `rotate(${ value }deg)` } : undefined\n\t\t\t\t}\n\t\t\t\tclassName=\"components-angle-picker-control__angle-circle-indicator-wrapper\"\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t<CircleIndicator className=\"components-angle-picker-control__angle-circle-indicator\" />\n\t\t\t</CircleIndicatorWrapper>\n\t\t</CircleRoot>\n\t\t/* eslint-enable jsx-a11y/no-static-element-interactions */\n\t);\n}\n\nfunction getAngle( centerX, centerY, pointX, pointY ) {\n\tconst y = pointY - centerY;\n\tconst x = pointX - centerX;\n\n\tconst angleInRadians = Math.atan2( y, x );\n\tconst angleInDeg = Math.round( angleInRadians * ( 180 / Math.PI ) ) + 90;\n\tif ( angleInDeg < 0 ) {\n\t\treturn 360 + angleInDeg;\n\t}\n\treturn angleInDeg;\n}\n\nexport default AngleCircle;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/angle-picker-control/angle-circle.tsx"],"names":["useEffect","useRef","__experimentalUseDragging","useDragging","CircleRoot","CircleIndicatorWrapper","CircleIndicator","AngleCircle","value","onChange","props","angleCircleRef","angleCircleCenter","previousCursorValue","setAngleCircleCenter","current","rect","getBoundingClientRect","x","width","y","height","changeAngleToPosition","event","undefined","preventDefault","target","focus","centerX","centerY","getAngle","clientX","clientY","startDrag","isDragging","onDragStart","onDragMove","onDragEnd","document","body","style","cursor","transform","pointX","pointY","angleInRadians","Math","atan2","angleInDeg","round","PI"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,MAApB,QAAkC,oBAAlC;AACA,SAASC,yBAAyB,IAAIC,WAAtC,QAAyD,oBAAzD;AAEA;AACA;AACA;;AACA,SACCC,UADD,EAECC,sBAFD,EAGCC,eAHD,QAIO,sCAJP;;AAeA,SAASC,WAAT,OAIwD;AAAA,MAJlC;AACrBC,IAAAA,KADqB;AAErBC,IAAAA,QAFqB;AAGrB,OAAGC;AAHkB,GAIkC;AACvD,QAAMC,cAAc,GAAGV,MAAM,CAA2B,IAA3B,CAA7B;AACA,QAAMW,iBAAiB,GAAGX,MAAM,EAAhC;AACA,QAAMY,mBAAmB,GAAGZ,MAAM,EAAlC;;AAEA,QAAMa,oBAAoB,GAAG,MAAM;AAClC,QAAKH,cAAc,CAACI,OAAf,KAA2B,IAAhC,EAAuC;AACtC;AACA;;AAED,UAAMC,IAAI,GAAGL,cAAc,CAACI,OAAf,CAAuBE,qBAAvB,EAAb;AACAL,IAAAA,iBAAiB,CAACG,OAAlB,GAA4B;AAC3BG,MAAAA,CAAC,EAAEF,IAA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WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { __experimentalUseDragging as useDragging } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport {\n\tCircleRoot,\n\tCircleIndicatorWrapper,\n\tCircleIndicator,\n} from './styles/angle-picker-control-styles';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AngleCircleProps } from './types';\n\ntype UseDraggingArgumentType = Parameters< typeof useDragging >[ 0 ];\ntype UseDraggingCallbackEvent =\n\t| Parameters< UseDraggingArgumentType[ 'onDragStart' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragMove' ] >[ 0 ]\n\t| Parameters< UseDraggingArgumentType[ 'onDragEnd' ] >[ 0 ];\n\nfunction AngleCircle( {\n\tvalue,\n\tonChange,\n\t...props\n}: WordPressComponentProps< AngleCircleProps, 'div' > ) {\n\tconst angleCircleRef = useRef< HTMLDivElement | null >( null );\n\tconst angleCircleCenter = useRef< { x: number; y: number } | undefined >();\n\tconst previousCursorValue = useRef< CSSStyleDeclaration[ 'cursor' ] >();\n\n\tconst setAngleCircleCenter = () => {\n\t\tif ( angleCircleRef.current === null ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst rect = angleCircleRef.current.getBoundingClientRect();\n\t\tangleCircleCenter.current = {\n\t\t\tx: rect.x + rect.width / 2,\n\t\t\ty: rect.y + rect.height / 2,\n\t\t};\n\t};\n\n\tconst changeAngleToPosition = ( event: UseDraggingCallbackEvent ) => {\n\t\tif ( event === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Prevent (drag) mouse events from selecting and accidentally\n\t\t// triggering actions from other elements.\n\t\tevent.preventDefault();\n\t\t// Input control needs to lose focus and by preventDefault above, it doesn't.\n\t\t( event.target as HTMLDivElement | null )?.focus();\n\n\t\tif (\n\t\t\tangleCircleCenter.current !== undefined &&\n\t\t\tonChange !== undefined\n\t\t) {\n\t\t\tconst { x: centerX, y: centerY } = angleCircleCenter.current;\n\t\t\tonChange(\n\t\t\t\tgetAngle( centerX, centerY, event.clientX, event.clientY )\n\t\t\t);\n\t\t}\n\t};\n\n\tconst { startDrag, isDragging } = useDragging( {\n\t\tonDragStart: ( event ) => {\n\t\t\tsetAngleCircleCenter();\n\t\t\tchangeAngleToPosition( event );\n\t\t},\n\t\tonDragMove: changeAngleToPosition,\n\t\tonDragEnd: changeAngleToPosition,\n\t} );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tif ( previousCursorValue.current === undefined ) {\n\t\t\t\tpreviousCursorValue.current = document.body.style.cursor;\n\t\t\t}\n\t\t\tdocument.body.style.cursor = 'grabbing';\n\t\t} else {\n\t\t\tdocument.body.style.cursor = previousCursorValue.current || '';\n\t\t\tpreviousCursorValue.current = undefined;\n\t\t}\n\t}, [ isDragging ] );\n\n\treturn (\n\t\t<CircleRoot\n\t\t\tref={ angleCircleRef }\n\t\t\tonMouseDown={ startDrag }\n\t\t\tclassName=\"components-angle-picker-control__angle-circle\"\n\t\t\tstyle={ isDragging ? { cursor: 'grabbing' } : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<CircleIndicatorWrapper\n\t\t\t\tstyle={\n\t\t\t\t\tvalue ? { transform: `rotate(${ value }deg)` } : undefined\n\t\t\t\t}\n\t\t\t\tclassName=\"components-angle-picker-control__angle-circle-indicator-wrapper\"\n\t\t\t\ttabIndex={ -1 }\n\t\t\t>\n\t\t\t\t<CircleIndicator className=\"components-angle-picker-control__angle-circle-indicator\" />\n\t\t\t</CircleIndicatorWrapper>\n\t\t</CircleRoot>\n\t);\n}\n\nfunction getAngle(\n\tcenterX: number,\n\tcenterY: number,\n\tpointX: number,\n\tpointY: number\n) {\n\tconst y = pointY - centerY;\n\tconst x = pointX - centerX;\n\n\tconst angleInRadians = Math.atan2( y, x );\n\tconst angleInDeg = Math.round( angleInRadians * ( 180 / Math.PI ) ) + 90;\n\tif ( angleInDeg < 0 ) {\n\t\treturn 360 + angleInDeg;\n\t}\n\treturn angleInDeg;\n}\n\nexport default AngleCircle;\n"]}
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createElement } from "@wordpress/element";
2
3
 
3
4
  /**
@@ -9,6 +10,7 @@ import classnames from 'classnames';
9
10
  */
10
11
 
11
12
  import deprecated from '@wordpress/deprecated';
13
+ import { forwardRef } from '@wordpress/element';
12
14
  import { __ } from '@wordpress/i18n';
13
15
  /**
14
16
  * Internal dependencies
@@ -22,15 +24,16 @@ import { space } from '../ui/utils/space';
22
24
  import { Text } from '../text';
23
25
  import { Spacer } from '../spacer';
24
26
  import { COLORS } from '../utils/colors-values';
25
- export default function AnglePickerControl(_ref) {
26
- let {
27
- /** Start opting into the new margin-free styles that will become the default in a future version. */
27
+
28
+ function UnforwardedAnglePickerControl(props, ref) {
29
+ const {
28
30
  __nextHasNoMarginBottom = false,
29
31
  className,
30
32
  label = __('Angle'),
31
33
  onChange,
32
- value
33
- } = _ref;
34
+ value,
35
+ ...restProps
36
+ } = props;
34
37
 
35
38
  if (!__nextHasNoMarginBottom) {
36
39
  deprecated('Bottom margin styles for wp.components.AnglePickerControl', {
@@ -41,16 +44,21 @@ export default function AnglePickerControl(_ref) {
41
44
  }
42
45
 
43
46
  const handleOnNumberChange = unprocessedValue => {
44
- const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
47
+ if (onChange === undefined) {
48
+ return;
49
+ }
50
+
51
+ const inputValue = unprocessedValue !== undefined && unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
45
52
  onChange(inputValue);
46
53
  };
47
54
 
48
55
  const classes = classnames('components-angle-picker-control', className);
49
- return createElement(Root, {
56
+ return createElement(Root, _extends({}, restProps, {
57
+ ref: ref,
50
58
  __nextHasNoMarginBottom: __nextHasNoMarginBottom,
51
59
  className: classes,
52
60
  gap: 4
53
- }, createElement(FlexBlock, null, createElement(NumberControl, {
61
+ }), createElement(FlexBlock, null, createElement(NumberControl, {
54
62
  label: label,
55
63
  className: "components-angle-picker-control__input-field",
56
64
  max: 360,
@@ -79,4 +87,30 @@ export default function AnglePickerControl(_ref) {
79
87
  onChange: onChange
80
88
  })));
81
89
  }
90
+ /**
91
+ * `AnglePickerControl` is a React component to render a UI that allows users to
92
+ * pick an angle. Users can choose an angle in a visual UI with the mouse by
93
+ * dragging an angle indicator inside a circle or by directly inserting the
94
+ * desired angle in a text field.
95
+ *
96
+ * ```jsx
97
+ * import { useState } from '@wordpress/element';
98
+ * import { AnglePickerControl } from '@wordpress/components';
99
+ *
100
+ * function Example() {
101
+ * const [ angle, setAngle ] = useState( 0 );
102
+ * return (
103
+ * <AnglePickerControl
104
+ * value={ angle }
105
+ * onChange={ setAngle }
106
+ * __nextHasNoMarginBottom
107
+ * </>
108
+ * );
109
+ * }
110
+ * ```
111
+ */
112
+
113
+
114
+ export const AnglePickerControl = forwardRef(UnforwardedAnglePickerControl);
115
+ export default AnglePickerControl;
82
116
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/angle-picker-control/index.js"],"names":["classnames","deprecated","__","FlexBlock","FlexItem","NumberControl","AngleCircle","Root","space","Text","Spacer","COLORS","AnglePickerControl","__nextHasNoMarginBottom","className","label","onChange","value","since","version","hint","handleOnNumberChange","unprocessedValue","inputValue","parseInt","classes","color","ui","theme","marginBottom","marginTop"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,SAApC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,IAAT,QAAqB,sCAArB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,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MAAA,YAAY,EAAG,CAFhB;AAGC,MAAA,WAAW,EAAGD,KAAK,CAAE,CAAF,CAHpB;AAIC,MAAA,KAAK,EAAG;AACPkB,QAAAA,KAAK,EAAEf,MAAM,CAACgB,EAAP,CAAUC;AADV;AAJT;AAXF,IADD,CALD,EA8BC,cAAC,QAAD;AACC,IAAA,KAAK,EAAG;AACPC,MAAAA,YAAY,EAAErB,KAAK,CAAE,CAAF,CADZ;AAEPsB,MAAAA,SAAS,EAAE;AAFJ;AADT,KAMC,cAAC,WAAD;AACC,mBAAY,MADb;AAEC,IAAA,KAAK,EAAGb,KAFT;AAGC,IAAA,QAAQ,EAAGD;AAHZ,IAND,CA9BD,CADD;AA6CA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock, FlexItem } from '../flex';\nimport NumberControl from '../number-control';\nimport AngleCircle from './angle-circle';\nimport { Root } from './styles/angle-picker-control-styles';\nimport { space } from '../ui/utils/space';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { COLORS } from '../utils/colors-values';\n\nexport default function AnglePickerControl( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMarginBottom = false,\n\tclassName,\n\tlabel = __( 'Angle' ),\n\tonChange,\n\tvalue,\n} ) {\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.components.AnglePickerControl',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst handleOnNumberChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== '' ? parseInt( unprocessedValue, 10 ) : 0;\n\t\tonChange( inputValue );\n\t};\n\n\tconst classes = classnames( 'components-angle-picker-control', className );\n\n\treturn (\n\t\t<Root\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tgap={ 4 }\n\t\t>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tclassName=\"components-angle-picker-control__input-field\"\n\t\t\t\t\tmax={ 360 }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ handleOnNumberChange }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tstep=\"1\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tspinControls=\"none\"\n\t\t\t\t\tsuffix={\n\t\t\t\t\t\t<Spacer\n\t\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\t\tmarginBottom={ 0 }\n\t\t\t\t\t\t\tmarginRight={ space( 3 ) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tcolor: COLORS.ui.theme,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t°\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t\t<FlexItem\n\t\t\t\tstyle={ {\n\t\t\t\t\tmarginBottom: space( 1 ),\n\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<AngleCircle\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</FlexItem>\n\t\t</Root>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/angle-picker-control/index.tsx"],"names":["classnames","deprecated","forwardRef","__","FlexBlock","FlexItem","NumberControl","AngleCircle","Root","space","Text","Spacer","COLORS","UnforwardedAnglePickerControl","props","ref","__nextHasNoMarginBottom","className","label","onChange","value","restProps","since","version","hint","handleOnNumberChange","unprocessedValue","undefined","inputValue","parseInt","classes","color","ui","theme","marginBottom","marginTop","AnglePickerControl"],"mappings":";;;AAAA;AACA;AACA;AAEA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,SAApC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,WAAP,MAAwB,gBAAxB;AACA,SAASC,IAAT,QAAqB,sCAArB;AACA,SAASC,KAAT,QAAsB,mBAAtB;AACA,SAASC,IAAT,QAAqB,SAArB;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,MAAT,QAAuB,wBAAvB;;AAKA,SAASC,6BAAT,CACCC,KADD,EAECC,GAFD,EAGE;AACD,QAAM;AACLC,IAAAA,uBAAuB,GAAG,KADrB;AAELC,IAAAA,SAFK;AAGLC,IAAAA,KAAK,GAAGf,EAAE,CAAE,OAAF,CAHL;AAILgB,IAAAA,QAJK;AAKLC,IAAAA,KALK;AAML,OAAGC;AANE,MAOFP,KAPJ;;AASA,MAAK,CAAEE,uBAAP,EAAiC;AAChCf,IAAAA,UAAU,CACT,2DADS,EAET;AACCqB,MAAAA,KAAK,EAAE,KADR;AAECC,MAAAA,OAAO,EAAE,KAFV;AAGCC,MAAAA,IAAI,EAAE;AAHP,KAFS,CAAV;AAQA;;AAED,QAAMC,oBAAoB,GAAKC,gBAAF,IAA4C;AACxE,QAAKP,QAAQ,KAAKQ,SAAlB,EAA8B;AAC7B;AACA;;AAED,UAAMC,UAAU,GACfF,gBAAgB,KAAKC,SAArB,IAAkCD,gBAAgB,KAAK,EAAvD,GACGG,QAAQ,CAAEH,gBAAF,EAAoB,EAApB,CADX,GAEG,CAHJ;AAIA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AGlC,UAAU,CAAEW,6BAAF,CAArC;AAEP,eAAeuB,kBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport type { ForwardedRef } from 'react';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { forwardRef } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { FlexBlock, FlexItem } from '../flex';\nimport NumberControl from '../number-control';\nimport AngleCircle from './angle-circle';\nimport { Root } from './styles/angle-picker-control-styles';\nimport { space } from '../ui/utils/space';\nimport { Text } from '../text';\nimport { Spacer } from '../spacer';\nimport { COLORS } from '../utils/colors-values';\n\nimport type { WordPressComponentProps } from '../ui/context';\nimport type { AnglePickerControlProps } from './types';\n\nfunction UnforwardedAnglePickerControl(\n\tprops: WordPressComponentProps< AnglePickerControlProps, 'div' >,\n\tref: ForwardedRef< any >\n) {\n\tconst {\n\t\t__nextHasNoMarginBottom = false,\n\t\tclassName,\n\t\tlabel = __( 'Angle' ),\n\t\tonChange,\n\t\tvalue,\n\t\t...restProps\n\t} = props;\n\n\tif ( ! __nextHasNoMarginBottom ) {\n\t\tdeprecated(\n\t\t\t'Bottom margin styles for wp.components.AnglePickerControl',\n\t\t\t{\n\t\t\t\tsince: '6.1',\n\t\t\t\tversion: '6.4',\n\t\t\t\thint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',\n\t\t\t}\n\t\t);\n\t}\n\n\tconst handleOnNumberChange = ( unprocessedValue: string | undefined ) => {\n\t\tif ( onChange === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== undefined && unprocessedValue !== ''\n\t\t\t\t? parseInt( unprocessedValue, 10 )\n\t\t\t\t: 0;\n\t\tonChange( inputValue );\n\t};\n\n\tconst classes = classnames( 'components-angle-picker-control', className );\n\n\treturn (\n\t\t<Root\n\t\t\t{ ...restProps }\n\t\t\tref={ ref }\n\t\t\t__nextHasNoMarginBottom={ __nextHasNoMarginBottom }\n\t\t\tclassName={ classes }\n\t\t\tgap={ 4 }\n\t\t>\n\t\t\t<FlexBlock>\n\t\t\t\t<NumberControl\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\tclassName=\"components-angle-picker-control__input-field\"\n\t\t\t\t\tmax={ 360 }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tonChange={ handleOnNumberChange }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tstep=\"1\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tspinControls=\"none\"\n\t\t\t\t\tsuffix={\n\t\t\t\t\t\t<Spacer\n\t\t\t\t\t\t\tas={ Text }\n\t\t\t\t\t\t\tmarginBottom={ 0 }\n\t\t\t\t\t\t\tmarginRight={ space( 3 ) }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tcolor: COLORS.ui.theme,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t°\n\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</FlexBlock>\n\t\t\t<FlexItem\n\t\t\t\tstyle={ {\n\t\t\t\t\tmarginBottom: space( 1 ),\n\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<AngleCircle\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</FlexItem>\n\t\t</Root>\n\t);\n}\n\n/**\n * `AnglePickerControl` is a React component to render a UI that allows users to\n * pick an angle. Users can choose an angle in a visual UI with the mouse by\n * dragging an angle indicator inside a circle or by directly inserting the\n * desired angle in a text field.\n *\n * ```jsx\n * import { useState } from '@wordpress/element';\n * import { AnglePickerControl } from '@wordpress/components';\n *\n * function Example() {\n * const [ angle, setAngle ] = useState( 0 );\n * return (\n * <AnglePickerControl\n * value={ angle }\n * onChange={ setAngle }\n * __nextHasNoMarginBottom\n * </>\n * );\n * }\n * ```\n */\nexport const AnglePickerControl = forwardRef( UnforwardedAnglePickerControl );\n\nexport default AnglePickerControl;\n"]}