@wordpress/components 23.3.1 → 23.4.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 (896) hide show
  1. package/CHANGELOG.md +35 -0
  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/{base-field → angle-picker-control}/types.js +0 -0
  11. package/build/angle-picker-control/types.js.map +1 -0
  12. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  13. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  14. package/build/base-control/hooks.js +1 -1
  15. package/build/base-control/hooks.js.map +1 -1
  16. package/build/border-box-control/utils.js +1 -1
  17. package/build/border-box-control/utils.js.map +1 -1
  18. package/build/box-control/all-input-control.js +2 -2
  19. package/build/box-control/all-input-control.js.map +1 -1
  20. package/build/box-control/axial-input-controls.js +1 -1
  21. package/build/box-control/axial-input-controls.js.map +1 -1
  22. package/build/box-control/icon.js.map +1 -1
  23. package/build/box-control/index.js +32 -3
  24. package/build/box-control/index.js.map +1 -1
  25. package/build/box-control/input-controls.js +5 -5
  26. package/build/box-control/input-controls.js.map +1 -1
  27. package/build/box-control/linked-button.js.map +1 -1
  28. package/build/box-control/styles/box-control-icon-styles.js +28 -28
  29. package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
  30. package/build/box-control/styles/box-control-styles.js +23 -23
  31. package/build/box-control/styles/box-control-styles.js.map +1 -1
  32. package/build/box-control/styles/box-control-visualizer-styles.js +19 -19
  33. package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  34. package/build/box-control/types.js +6 -0
  35. package/build/box-control/types.js.map +1 -0
  36. package/build/box-control/unit-control.js.map +1 -1
  37. package/build/box-control/utils.js +23 -23
  38. package/build/box-control/utils.js.map +1 -1
  39. package/build/color-palette/index.js +15 -7
  40. package/build/color-palette/index.js.map +1 -1
  41. package/build/color-palette/utils.js +12 -4
  42. package/build/color-palette/utils.js.map +1 -1
  43. package/build/combobox-control/index.js +68 -12
  44. package/build/combobox-control/index.js.map +1 -1
  45. package/build/combobox-control/styles.js +2 -2
  46. package/build/combobox-control/styles.js.map +1 -1
  47. package/build/combobox-control/types.js +6 -0
  48. package/build/combobox-control/types.js.map +1 -0
  49. package/build/custom-gradient-picker/index.js +0 -1
  50. package/build/custom-gradient-picker/index.js.map +1 -1
  51. package/build/custom-select-control/index.js +7 -0
  52. package/build/custom-select-control/index.js.map +1 -1
  53. package/build/date-time/time/index.js +1 -1
  54. package/build/date-time/time/index.js.map +1 -1
  55. package/build/date-time/utils.js +1 -1
  56. package/build/date-time/utils.js.map +1 -1
  57. package/build/draggable/index.js +2 -2
  58. package/build/draggable/index.js.map +1 -1
  59. package/build/focal-point-picker/utils.js +3 -3
  60. package/build/focal-point-picker/utils.js.map +1 -1
  61. package/build/font-size-picker/utils.js +2 -2
  62. package/build/font-size-picker/utils.js.map +1 -1
  63. package/build/gradient-picker/index.js +9 -4
  64. package/build/gradient-picker/index.js.map +1 -1
  65. package/build/index.js +16 -10
  66. package/build/index.js.map +1 -1
  67. package/build/input-control/reducer/reducer.js +5 -5
  68. package/build/input-control/reducer/reducer.js.map +1 -1
  69. package/build/input-control/utils.js +1 -1
  70. package/build/input-control/utils.js.map +1 -1
  71. package/build/menu-items-choice/index.js +40 -3
  72. package/build/menu-items-choice/index.js.map +1 -1
  73. package/build/menu-items-choice/types.js +6 -0
  74. package/build/menu-items-choice/types.js.map +1 -0
  75. package/build/modal/index.js +41 -3
  76. package/build/modal/index.js.map +1 -1
  77. package/build/navigator/context.js +5 -1
  78. package/build/navigator/context.js.map +1 -1
  79. package/build/navigator/index.js +8 -0
  80. package/build/navigator/index.js.map +1 -1
  81. package/build/navigator/navigator-back-button/hook.js +11 -3
  82. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  83. package/build/navigator/navigator-provider/component.js +119 -11
  84. package/build/navigator/navigator-provider/component.js.map +1 -1
  85. package/build/navigator/navigator-screen/component.js +18 -7
  86. package/build/navigator/navigator-screen/component.js.map +1 -1
  87. package/build/navigator/navigator-to-parent-button/component.js +75 -0
  88. package/build/navigator/navigator-to-parent-button/component.js.map +1 -0
  89. package/build/navigator/navigator-to-parent-button/index.js +16 -0
  90. package/build/navigator/navigator-to-parent-button/index.js.map +1 -0
  91. package/build/navigator/use-navigator.js +6 -2
  92. package/build/navigator/use-navigator.js.map +1 -1
  93. package/build/navigator/utils/router.js +57 -0
  94. package/build/navigator/utils/router.js.map +1 -0
  95. package/build/palette-edit/index.js +4 -1
  96. package/build/palette-edit/index.js.map +1 -1
  97. package/build/panel/header.js +9 -0
  98. package/build/panel/header.js.map +1 -1
  99. package/build/panel/index.js +21 -3
  100. package/build/panel/index.js.map +1 -1
  101. package/build/panel/row.js +10 -4
  102. package/build/panel/row.js.map +1 -1
  103. package/build/panel/types.js +6 -0
  104. package/build/panel/types.js.map +1 -0
  105. package/build/popover/index.js +15 -3
  106. package/build/popover/index.js.map +1 -1
  107. package/build/popover/overlay-middlewares.js +46 -0
  108. package/build/popover/overlay-middlewares.js.map +1 -0
  109. package/build/popover/utils.js +45 -6
  110. package/build/popover/utils.js.map +1 -1
  111. package/build/private-apis.js +35 -0
  112. package/build/private-apis.js.map +1 -0
  113. package/build/query-controls/terms.js +1 -1
  114. package/build/query-controls/terms.js.map +1 -1
  115. package/build/range-control/utils.js +4 -4
  116. package/build/range-control/utils.js.map +1 -1
  117. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  118. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  119. package/build/resizable-box/resize-tooltip/utils.js +14 -14
  120. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  121. package/build/select-control/index.js +1 -1
  122. package/build/select-control/index.js.map +1 -1
  123. package/build/select-control/styles/select-control-styles.js +38 -25
  124. package/build/select-control/styles/select-control-styles.js.map +1 -1
  125. package/build/snackbar/index.js +2 -2
  126. package/build/snackbar/index.js.map +1 -1
  127. package/build/toolbar/toolbar/index.js +25 -14
  128. package/build/toolbar/toolbar/index.js.map +1 -1
  129. package/build/toolbar/toolbar/toolbar-container.js +5 -4
  130. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  131. package/build/toolbar/toolbar/types.js +6 -0
  132. package/build/toolbar/toolbar/types.js.map +1 -0
  133. package/build/toolbar/toolbar-button/index.js +2 -0
  134. package/build/toolbar/toolbar-button/index.js.map +1 -1
  135. package/build/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  136. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  137. package/build/toolbar/toolbar-context/index.js +2 -0
  138. package/build/toolbar/toolbar-context/index.js.map +1 -1
  139. package/build/toolbar/toolbar-dropdown-menu/index.js +2 -0
  140. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  141. package/build/toolbar/toolbar-group/index.js +2 -0
  142. package/build/toolbar/toolbar-group/index.js.map +1 -1
  143. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  144. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  145. package/build/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  146. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  147. package/build/toolbar/toolbar-item/index.js +2 -0
  148. package/build/toolbar/toolbar-item/index.js.map +1 -1
  149. package/build/tools-panel/tools-panel/component.js +61 -5
  150. package/build/tools-panel/tools-panel/component.js.map +1 -1
  151. package/build/tools-panel/tools-panel/hook.js +8 -6
  152. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  153. package/build/tools-panel/tools-panel-header/component.js +2 -1
  154. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  155. package/build/tools-panel/tools-panel-header/hook.js +2 -0
  156. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  157. package/build/tools-panel/tools-panel-item/component.js +5 -4
  158. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  159. package/build/tools-panel/tools-panel-item/hook.js +24 -13
  160. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  161. package/build/tree-grid/cell.js +15 -4
  162. package/build/tree-grid/cell.js.map +1 -1
  163. package/build/tree-grid/index.js +81 -19
  164. package/build/tree-grid/index.js.map +1 -1
  165. package/build/tree-grid/item.js +14 -3
  166. package/build/tree-grid/item.js.map +1 -1
  167. package/build/tree-grid/roving-tab-index-context.js +1 -1
  168. package/build/tree-grid/roving-tab-index-context.js.map +1 -1
  169. package/build/tree-grid/roving-tab-index-item.js +13 -6
  170. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  171. package/build/tree-grid/roving-tab-index.js +0 -3
  172. package/build/tree-grid/roving-tab-index.js.map +1 -1
  173. package/build/tree-grid/row.js +20 -18
  174. package/build/tree-grid/row.js.map +1 -1
  175. package/build/tree-grid/types.js +6 -0
  176. package/build/tree-grid/types.js.map +1 -0
  177. package/build/ui/context/context-connect.js +7 -7
  178. package/build/ui/context/context-connect.js.map +1 -1
  179. package/build/ui/context/get-styled-class-name-from-key.js +1 -1
  180. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  181. package/build/ui/utils/get-valid-children.js +1 -1
  182. package/build/ui/utils/get-valid-children.js.map +1 -1
  183. package/build/ui/utils/space.js +1 -1
  184. package/build/ui/utils/space.js.map +1 -1
  185. package/build/unit-control/index.js +2 -2
  186. package/build/unit-control/index.js.map +1 -1
  187. package/build/unit-control/utils.js +20 -20
  188. package/build/unit-control/utils.js.map +1 -1
  189. package/build/utils/events.js +4 -4
  190. package/build/utils/events.js.map +1 -1
  191. package/build/utils/hooks/use-controlled-state.js +2 -2
  192. package/build/utils/hooks/use-controlled-state.js.map +1 -1
  193. package/build/utils/hooks/use-controlled-value.js +4 -4
  194. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  195. package/build/utils/hooks/use-latest-ref.js +1 -1
  196. package/build/utils/hooks/use-latest-ref.js.map +1 -1
  197. package/build/utils/unit-values.js +3 -3
  198. package/build/utils/unit-values.js.map +1 -1
  199. package/build-module/alignment-matrix-control/utils.js +4 -4
  200. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  201. package/build-module/angle-picker-control/angle-circle.js +37 -29
  202. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  203. package/build-module/angle-picker-control/index.js +42 -8
  204. package/build-module/angle-picker-control/index.js.map +1 -1
  205. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  206. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  207. package/build-module/{base-field → angle-picker-control}/types.js +0 -0
  208. package/build-module/{base-field → angle-picker-control}/types.js.map +0 -0
  209. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  210. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  211. package/build-module/base-control/hooks.js +1 -1
  212. package/build-module/base-control/hooks.js.map +1 -1
  213. package/build-module/border-box-control/utils.js +1 -1
  214. package/build-module/border-box-control/utils.js.map +1 -1
  215. package/build-module/box-control/all-input-control.js +2 -2
  216. package/build-module/box-control/all-input-control.js.map +1 -1
  217. package/build-module/box-control/axial-input-controls.js +1 -1
  218. package/build-module/box-control/axial-input-controls.js.map +1 -1
  219. package/build-module/box-control/icon.js.map +1 -1
  220. package/build-module/box-control/index.js +31 -3
  221. package/build-module/box-control/index.js.map +1 -1
  222. package/build-module/box-control/input-controls.js +5 -5
  223. package/build-module/box-control/input-controls.js.map +1 -1
  224. package/build-module/box-control/linked-button.js.map +1 -1
  225. package/build-module/box-control/styles/box-control-icon-styles.js +28 -28
  226. package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
  227. package/build-module/box-control/styles/box-control-styles.js +23 -23
  228. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  229. package/build-module/box-control/styles/box-control-visualizer-styles.js +19 -19
  230. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  231. package/build-module/box-control/types.js +2 -0
  232. package/{build/base-field → build-module/box-control}/types.js.map +0 -0
  233. package/build-module/box-control/unit-control.js.map +1 -1
  234. package/build-module/box-control/utils.js +23 -23
  235. package/build-module/box-control/utils.js.map +1 -1
  236. package/build-module/color-palette/index.js +16 -8
  237. package/build-module/color-palette/index.js.map +1 -1
  238. package/build-module/color-palette/utils.js +12 -4
  239. package/build-module/color-palette/utils.js.map +1 -1
  240. package/build-module/combobox-control/index.js +68 -12
  241. package/build-module/combobox-control/index.js.map +1 -1
  242. package/build-module/combobox-control/styles.js +2 -2
  243. package/build-module/combobox-control/styles.js.map +1 -1
  244. package/build-module/combobox-control/types.js +2 -0
  245. package/build-module/{resizable-box/styles/resizable-box.styles.js.map → combobox-control/types.js.map} +0 -0
  246. package/build-module/custom-gradient-picker/index.js +0 -1
  247. package/build-module/custom-gradient-picker/index.js.map +1 -1
  248. package/build-module/custom-select-control/index.js +5 -0
  249. package/build-module/custom-select-control/index.js.map +1 -1
  250. package/build-module/date-time/time/index.js +1 -1
  251. package/build-module/date-time/time/index.js.map +1 -1
  252. package/build-module/date-time/utils.js +1 -1
  253. package/build-module/date-time/utils.js.map +1 -1
  254. package/build-module/draggable/index.js +2 -2
  255. package/build-module/draggable/index.js.map +1 -1
  256. package/build-module/focal-point-picker/utils.js +3 -3
  257. package/build-module/focal-point-picker/utils.js.map +1 -1
  258. package/build-module/font-size-picker/utils.js +2 -2
  259. package/build-module/font-size-picker/utils.js.map +1 -1
  260. package/build-module/gradient-picker/index.js +9 -4
  261. package/build-module/gradient-picker/index.js.map +1 -1
  262. package/build-module/index.js +5 -4
  263. package/build-module/index.js.map +1 -1
  264. package/build-module/input-control/reducer/reducer.js +5 -5
  265. package/build-module/input-control/reducer/reducer.js.map +1 -1
  266. package/build-module/input-control/utils.js +1 -1
  267. package/build-module/input-control/utils.js.map +1 -1
  268. package/build-module/menu-items-choice/index.js +40 -4
  269. package/build-module/menu-items-choice/index.js.map +1 -1
  270. package/build-module/menu-items-choice/types.js +2 -0
  271. package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/menu-items-choice/types.js.map} +0 -0
  272. package/build-module/modal/index.js +41 -4
  273. package/build-module/modal/index.js.map +1 -1
  274. package/build-module/navigator/context.js +5 -1
  275. package/build-module/navigator/context.js.map +1 -1
  276. package/build-module/navigator/index.js +1 -0
  277. package/build-module/navigator/index.js.map +1 -1
  278. package/build-module/navigator/navigator-back-button/hook.js +11 -3
  279. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  280. package/build-module/navigator/navigator-provider/component.js +117 -12
  281. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  282. package/build-module/navigator/navigator-screen/component.js +20 -9
  283. package/build-module/navigator/navigator-screen/component.js.map +1 -1
  284. package/build-module/navigator/navigator-to-parent-button/component.js +61 -0
  285. package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -0
  286. package/build-module/navigator/navigator-to-parent-button/index.js +2 -0
  287. package/build-module/navigator/navigator-to-parent-button/index.js.map +1 -0
  288. package/build-module/navigator/use-navigator.js +6 -2
  289. package/build-module/navigator/use-navigator.js.map +1 -1
  290. package/build-module/navigator/utils/router.js +51 -0
  291. package/build-module/navigator/utils/router.js.map +1 -0
  292. package/build-module/palette-edit/index.js +4 -1
  293. package/build-module/palette-edit/index.js.map +1 -1
  294. package/build-module/panel/header.js +9 -0
  295. package/build-module/panel/header.js.map +1 -1
  296. package/build-module/panel/index.js +20 -2
  297. package/build-module/panel/index.js.map +1 -1
  298. package/build-module/panel/row.js +9 -3
  299. package/build-module/panel/row.js.map +1 -1
  300. package/build-module/panel/types.js +2 -0
  301. package/build-module/panel/types.js.map +1 -0
  302. package/build-module/popover/index.js +14 -4
  303. package/build-module/popover/index.js.map +1 -1
  304. package/build-module/popover/overlay-middlewares.js +38 -0
  305. package/build-module/popover/overlay-middlewares.js.map +1 -0
  306. package/build-module/popover/utils.js +41 -5
  307. package/build-module/popover/utils.js.map +1 -1
  308. package/build-module/private-apis.js +20 -0
  309. package/build-module/private-apis.js.map +1 -0
  310. package/build-module/query-controls/terms.js +1 -1
  311. package/build-module/query-controls/terms.js.map +1 -1
  312. package/build-module/range-control/utils.js +4 -4
  313. package/build-module/range-control/utils.js.map +1 -1
  314. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  315. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  316. package/build-module/resizable-box/resize-tooltip/utils.js +14 -14
  317. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  318. package/build-module/select-control/index.js +1 -1
  319. package/build-module/select-control/index.js.map +1 -1
  320. package/build-module/select-control/styles/select-control-styles.js +38 -25
  321. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  322. package/build-module/snackbar/index.js +2 -2
  323. package/build-module/snackbar/index.js.map +1 -1
  324. package/build-module/toolbar/toolbar/index.js +25 -13
  325. package/build-module/toolbar/toolbar/index.js.map +1 -1
  326. package/build-module/toolbar/toolbar/toolbar-container.js +4 -3
  327. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  328. package/build-module/toolbar/toolbar/types.js +2 -0
  329. package/build-module/toolbar/toolbar/types.js.map +1 -0
  330. package/build-module/toolbar/toolbar-button/index.js +1 -0
  331. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  332. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  333. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  334. package/build-module/toolbar/toolbar-context/index.js +2 -0
  335. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  336. package/build-module/toolbar/toolbar-dropdown-menu/index.js +1 -0
  337. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  338. package/build-module/toolbar/toolbar-group/index.js +1 -0
  339. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  340. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +1 -0
  341. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  342. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  343. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  344. package/build-module/toolbar/toolbar-item/index.js +1 -0
  345. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  346. package/build-module/tools-panel/tools-panel/component.js +59 -4
  347. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  348. package/build-module/tools-panel/tools-panel/hook.js +8 -6
  349. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  350. package/build-module/tools-panel/tools-panel-header/component.js +2 -1
  351. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  352. package/build-module/tools-panel/tools-panel-header/hook.js +2 -0
  353. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  354. package/build-module/tools-panel/tools-panel-item/component.js +3 -3
  355. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  356. package/build-module/tools-panel/tools-panel-item/hook.js +25 -13
  357. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  358. package/build-module/tree-grid/cell.js +16 -4
  359. package/build-module/tree-grid/cell.js.map +1 -1
  360. package/build-module/tree-grid/index.js +81 -21
  361. package/build-module/tree-grid/index.js.map +1 -1
  362. package/build-module/tree-grid/item.js +14 -2
  363. package/build-module/tree-grid/item.js.map +1 -1
  364. package/build-module/tree-grid/roving-tab-index-context.js +1 -1
  365. package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
  366. package/build-module/tree-grid/roving-tab-index-item.js +11 -4
  367. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  368. package/build-module/tree-grid/roving-tab-index.js +0 -3
  369. package/build-module/tree-grid/roving-tab-index.js.map +1 -1
  370. package/build-module/tree-grid/row.js +22 -17
  371. package/build-module/tree-grid/row.js.map +1 -1
  372. package/build-module/tree-grid/types.js +2 -0
  373. package/build-module/tree-grid/types.js.map +1 -0
  374. package/build-module/ui/context/context-connect.js +7 -7
  375. package/build-module/ui/context/context-connect.js.map +1 -1
  376. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  377. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  378. package/build-module/ui/utils/get-valid-children.js +1 -1
  379. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  380. package/build-module/ui/utils/space.js +1 -1
  381. package/build-module/ui/utils/space.js.map +1 -1
  382. package/build-module/unit-control/index.js +2 -2
  383. package/build-module/unit-control/index.js.map +1 -1
  384. package/build-module/unit-control/utils.js +20 -20
  385. package/build-module/unit-control/utils.js.map +1 -1
  386. package/build-module/utils/events.js +4 -4
  387. package/build-module/utils/events.js.map +1 -1
  388. package/build-module/utils/hooks/use-controlled-state.js +2 -2
  389. package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
  390. package/build-module/utils/hooks/use-controlled-value.js +4 -4
  391. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  392. package/build-module/utils/hooks/use-latest-ref.js +1 -1
  393. package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
  394. package/build-module/utils/unit-values.js +3 -3
  395. package/build-module/utils/unit-values.js.map +1 -1
  396. package/build-style/style-rtl.css +5 -11
  397. package/build-style/style.css +5 -11
  398. package/build-types/alignment-matrix-control/utils.d.ts +4 -4
  399. package/build-types/angle-picker-control/angle-circle.d.ts +6 -0
  400. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -0
  401. package/build-types/angle-picker-control/index.d.ts +29 -0
  402. package/build-types/angle-picker-control/index.d.ts.map +1 -0
  403. package/build-types/angle-picker-control/stories/index.d.ts +15 -0
  404. package/build-types/angle-picker-control/stories/index.d.ts.map +1 -0
  405. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +20 -0
  406. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
  407. package/build-types/angle-picker-control/types.d.ts +26 -0
  408. package/build-types/angle-picker-control/types.d.ts.map +1 -0
  409. package/build-types/base-control/hooks.d.ts +2 -2
  410. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  411. package/build-types/border-box-control/border-box-control/hook.d.ts +3 -3
  412. package/build-types/border-box-control/border-box-control-linked-button/hook.d.ts +2 -2
  413. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  414. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +3 -3
  415. package/build-types/border-box-control/border-box-control-visualizer/hook.d.ts +2 -2
  416. package/build-types/border-box-control/stories/index.d.ts +1 -1
  417. package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -0
  418. package/build-types/border-box-control/test/index.d.ts.map +1 -0
  419. package/build-types/border-box-control/test/utils.d.ts +2 -0
  420. package/build-types/border-box-control/test/utils.d.ts.map +1 -0
  421. package/build-types/border-control/border-control/hook.d.ts +2 -2
  422. package/build-types/border-control/border-control-dropdown/hook.d.ts +2 -2
  423. package/build-types/border-control/border-control-style-picker/hook.d.ts +2 -2
  424. package/build-types/box-control/all-input-control.d.ts +4 -0
  425. package/build-types/box-control/all-input-control.d.ts.map +1 -0
  426. package/build-types/box-control/axial-input-controls.d.ts +4 -0
  427. package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
  428. package/build-types/box-control/icon.d.ts +8 -0
  429. package/build-types/box-control/icon.d.ts.map +1 -0
  430. package/build-types/box-control/index.d.ts +31 -0
  431. package/build-types/box-control/index.d.ts.map +1 -0
  432. package/build-types/box-control/input-controls.d.ts +4 -0
  433. package/build-types/box-control/input-controls.d.ts.map +1 -0
  434. package/build-types/box-control/linked-button.d.ts +9 -0
  435. package/build-types/box-control/linked-button.d.ts.map +1 -0
  436. package/build-types/box-control/styles/box-control-icon-styles.d.ts +42 -0
  437. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -0
  438. package/build-types/box-control/styles/box-control-styles.d.ts +42 -0
  439. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -0
  440. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
  441. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
  442. package/build-types/box-control/test/index.d.ts +2 -0
  443. package/build-types/box-control/test/index.d.ts.map +1 -0
  444. package/build-types/box-control/types.d.ts +99 -0
  445. package/build-types/box-control/types.d.ts.map +1 -0
  446. package/build-types/box-control/unit-control.d.ts +4 -0
  447. package/build-types/box-control/unit-control.d.ts.map +1 -0
  448. package/build-types/box-control/utils.d.ts +84 -0
  449. package/build-types/box-control/utils.d.ts.map +1 -0
  450. package/build-types/button/deprecated.d.ts +2 -2
  451. package/build-types/button/types.d.ts +3 -1
  452. package/build-types/button/types.d.ts.map +1 -1
  453. package/build-types/card/card/hook.d.ts +2 -2
  454. package/build-types/card/card-body/hook.d.ts +2 -2
  455. package/build-types/card/card-divider/hook.d.ts +2 -2
  456. package/build-types/card/card-footer/hook.d.ts +2 -2
  457. package/build-types/card/card-header/hook.d.ts +2 -2
  458. package/build-types/card/card-media/hook.d.ts +2 -2
  459. package/build-types/color-palette/index.d.ts +3 -1
  460. package/build-types/color-palette/index.d.ts.map +1 -1
  461. package/build-types/color-palette/stories/index.d.ts +6 -2
  462. package/build-types/color-palette/stories/index.d.ts.map +1 -1
  463. package/build-types/color-palette/styles.d.ts +1 -1
  464. package/build-types/color-palette/types.d.ts +8 -0
  465. package/build-types/color-palette/types.d.ts.map +1 -1
  466. package/build-types/color-palette/utils.d.ts +8 -5
  467. package/build-types/color-palette/utils.d.ts.map +1 -1
  468. package/build-types/color-picker/styles.d.ts +7 -7
  469. package/build-types/combobox-control/index.d.ts +51 -0
  470. package/build-types/combobox-control/index.d.ts.map +1 -0
  471. package/build-types/combobox-control/stories/index.d.ts +18 -0
  472. package/build-types/combobox-control/stories/index.d.ts.map +1 -0
  473. package/build-types/combobox-control/styles.d.ts +8 -0
  474. package/build-types/combobox-control/styles.d.ts.map +1 -0
  475. package/build-types/combobox-control/test/index.d.ts +2 -0
  476. package/build-types/combobox-control/test/index.d.ts.map +1 -0
  477. package/build-types/combobox-control/types.d.ts +62 -0
  478. package/build-types/combobox-control/types.d.ts.map +1 -0
  479. package/build-types/custom-select-control/index.d.ts +1 -0
  480. package/build-types/custom-select-control/index.d.ts.map +1 -1
  481. package/build-types/date-time/date/styles.d.ts +3 -3
  482. package/build-types/date-time/date-time/styles.d.ts +3 -3
  483. package/build-types/date-time/time/styles.d.ts +8 -8
  484. package/build-types/date-time/utils.d.ts +1 -1
  485. package/build-types/elevation/hook.d.ts +2 -2
  486. package/build-types/external-link/styles/external-link-styles.d.ts +1 -1
  487. package/build-types/flex/flex/hook.d.ts +2 -2
  488. package/build-types/flex/flex-block/hook.d.ts +2 -2
  489. package/build-types/flex/flex-item/hook.d.ts +2 -2
  490. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -2
  491. package/build-types/focal-point-picker/utils.d.ts +3 -3
  492. package/build-types/font-size-picker/utils.d.ts +2 -2
  493. package/build-types/form-token-field/styles.d.ts +1 -1
  494. package/build-types/grid/hook.d.ts +2 -2
  495. package/build-types/h-stack/component.d.ts +1 -1
  496. package/build-types/h-stack/hook.d.ts +2 -2
  497. package/build-types/heading/hook.d.ts +2 -2
  498. package/build-types/input-control/reducer/reducer.d.ts +3 -3
  499. package/build-types/input-control/styles/input-control-styles.d.ts +2 -2
  500. package/build-types/input-control/utils.d.ts +1 -1
  501. package/build-types/item-group/item/hook.d.ts +2 -2
  502. package/build-types/item-group/item-group/hook.d.ts +2 -2
  503. package/build-types/menu-items-choice/index.d.ts +38 -0
  504. package/build-types/menu-items-choice/index.d.ts.map +1 -0
  505. package/build-types/menu-items-choice/stories/index.d.ts +12 -0
  506. package/build-types/menu-items-choice/stories/index.d.ts.map +1 -0
  507. package/build-types/menu-items-choice/types.d.ts +53 -0
  508. package/build-types/menu-items-choice/types.d.ts.map +1 -0
  509. package/build-types/modal/index.d.ts.map +1 -1
  510. package/build-types/modal/types.d.ts +2 -0
  511. package/build-types/modal/types.d.ts.map +1 -1
  512. package/build-types/navigator/context.d.ts.map +1 -1
  513. package/build-types/navigator/index.d.ts +1 -0
  514. package/build-types/navigator/index.d.ts.map +1 -1
  515. package/build-types/navigator/navigator-back-button/component.d.ts +22 -3
  516. package/build-types/navigator/navigator-back-button/component.d.ts.map +1 -1
  517. package/build-types/navigator/navigator-back-button/hook.d.ts +24 -6
  518. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  519. package/build-types/navigator/navigator-button/component.d.ts +22 -3
  520. package/build-types/navigator/navigator-button/component.d.ts.map +1 -1
  521. package/build-types/navigator/navigator-button/hook.d.ts +22 -4
  522. package/build-types/navigator/navigator-button/hook.d.ts.map +1 -1
  523. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  524. package/build-types/navigator/navigator-screen/component.d.ts.map +1 -1
  525. package/build-types/navigator/navigator-to-parent-button/component.d.ts +27 -0
  526. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -0
  527. package/build-types/navigator/navigator-to-parent-button/index.d.ts +2 -0
  528. package/build-types/navigator/navigator-to-parent-button/index.d.ts.map +1 -0
  529. package/build-types/navigator/stories/index.d.ts +1 -0
  530. package/build-types/navigator/stories/index.d.ts.map +1 -1
  531. package/build-types/navigator/test/router.d.ts +2 -0
  532. package/build-types/navigator/test/router.d.ts.map +1 -0
  533. package/build-types/navigator/types.d.ts +25 -9
  534. package/build-types/navigator/types.d.ts.map +1 -1
  535. package/build-types/navigator/use-navigator.d.ts.map +1 -1
  536. package/build-types/navigator/utils/router.d.ts +10 -0
  537. package/build-types/navigator/utils/router.d.ts.map +1 -0
  538. package/build-types/number-control/index.d.ts +2 -2
  539. package/build-types/number-control/stories/index.d.ts +2 -2
  540. package/build-types/panel/header.d.ts +13 -0
  541. package/build-types/panel/header.d.ts.map +1 -0
  542. package/build-types/panel/index.d.ts +21 -0
  543. package/build-types/panel/index.d.ts.map +1 -0
  544. package/build-types/panel/row.d.ts +12 -0
  545. package/build-types/panel/row.d.ts.map +1 -0
  546. package/build-types/panel/test/header.d.ts +2 -0
  547. package/build-types/panel/test/header.d.ts.map +1 -0
  548. package/build-types/panel/test/index.d.ts +2 -0
  549. package/build-types/{base-field → panel}/test/index.d.ts.map +1 -1
  550. package/build-types/panel/test/row.d.ts +2 -0
  551. package/build-types/panel/test/row.d.ts.map +1 -0
  552. package/build-types/panel/types.d.ts +38 -0
  553. package/build-types/panel/types.d.ts.map +1 -0
  554. package/build-types/popover/index.d.ts +1 -1
  555. package/build-types/popover/index.d.ts.map +1 -1
  556. package/build-types/popover/overlay-middlewares.d.ts +9 -0
  557. package/build-types/popover/overlay-middlewares.d.ts.map +1 -0
  558. package/build-types/popover/stories/e2e/index.d.ts +1 -1
  559. package/build-types/popover/stories/index.d.ts.map +1 -1
  560. package/build-types/popover/types.d.ts +3 -2
  561. package/build-types/popover/types.d.ts.map +1 -1
  562. package/build-types/popover/utils.d.ts +12 -4
  563. package/build-types/popover/utils.d.ts.map +1 -1
  564. package/build-types/private-apis.d.ts +4 -0
  565. package/build-types/private-apis.d.ts.map +1 -0
  566. package/build-types/query-controls/terms.d.ts +1 -1
  567. package/build-types/range-control/index.d.ts +2 -2
  568. package/build-types/range-control/styles/range-control-styles.d.ts +2 -2
  569. package/build-types/range-control/utils.d.ts +4 -4
  570. package/build-types/resizable-box/index.d.ts +1 -1
  571. package/build-types/resizable-box/resize-tooltip/index.d.ts +1 -1
  572. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +5 -4
  573. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  574. package/build-types/resizable-box/resize-tooltip/utils.d.ts +6 -6
  575. package/build-types/resizable-box/stories/index.d.ts +2 -2
  576. package/build-types/scrollable/hook.d.ts +2 -2
  577. package/build-types/search-control/index.d.ts +1 -1
  578. package/build-types/search-control/stories/index.d.ts +2 -2
  579. package/build-types/select-control/index.d.ts.map +1 -1
  580. package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
  581. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  582. package/build-types/select-control/types.d.ts +3 -1
  583. package/build-types/select-control/types.d.ts.map +1 -1
  584. package/build-types/spacer/hook.d.ts +2 -2
  585. package/build-types/spinner/index.d.ts +1 -1
  586. package/build-types/surface/hook.d.ts +2 -2
  587. package/build-types/text/hook.d.ts +2 -2
  588. package/build-types/text-control/index.d.ts +3 -3
  589. package/build-types/toolbar/index.d.ts +7 -0
  590. package/build-types/toolbar/index.d.ts.map +1 -0
  591. package/build-types/toolbar/stories/index.d.ts +14 -0
  592. package/build-types/toolbar/stories/index.d.ts.map +1 -0
  593. package/build-types/toolbar/test/index.d.ts +2 -0
  594. package/build-types/toolbar/test/index.d.ts.map +1 -0
  595. package/build-types/toolbar/test/toolbar-group.d.ts +2 -0
  596. package/build-types/toolbar/test/toolbar-group.d.ts.map +1 -0
  597. package/build-types/toolbar/toolbar/index.d.ts +25 -0
  598. package/build-types/toolbar/toolbar/index.d.ts.map +1 -0
  599. package/build-types/toolbar/toolbar/toolbar-container.d.ts +5 -0
  600. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -0
  601. package/build-types/toolbar/toolbar/types.d.ts +15 -0
  602. package/build-types/toolbar/toolbar/types.d.ts.map +1 -0
  603. package/build-types/toolbar/toolbar-button/index.d.ts +12 -0
  604. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -0
  605. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +3 -0
  606. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -0
  607. package/build-types/toolbar/toolbar-context/index.d.ts +3 -0
  608. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -0
  609. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -0
  610. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -0
  611. package/build-types/toolbar/toolbar-group/index.d.ts +39 -0
  612. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -0
  613. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +7 -0
  614. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -0
  615. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -0
  616. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -0
  617. package/build-types/toolbar/toolbar-item/index.d.ts +7 -0
  618. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -0
  619. package/build-types/tools-panel/stories/index.d.ts +17 -0
  620. package/build-types/tools-panel/stories/index.d.ts.map +1 -0
  621. package/build-types/tools-panel/tools-panel/component.d.ts +54 -2
  622. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  623. package/build-types/tools-panel/tools-panel/hook.d.ts +4 -3
  624. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  625. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  626. package/build-types/tools-panel/tools-panel-header/hook.d.ts +4 -3
  627. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  628. package/build-types/tools-panel/tools-panel-item/component.d.ts +2 -2
  629. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  630. package/build-types/tools-panel/tools-panel-item/hook.d.ts +2 -2
  631. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  632. package/build-types/tools-panel/types.d.ts +42 -15
  633. package/build-types/tools-panel/types.d.ts.map +1 -1
  634. package/build-types/tree-grid/cell.d.ts +13 -0
  635. package/build-types/tree-grid/cell.d.ts.map +1 -0
  636. package/build-types/tree-grid/index.d.ts +70 -0
  637. package/build-types/tree-grid/index.d.ts.map +1 -0
  638. package/build-types/tree-grid/item.d.ts +12 -0
  639. package/build-types/tree-grid/item.d.ts.map +1 -0
  640. package/build-types/tree-grid/roving-tab-index-context.d.ts +10 -0
  641. package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -0
  642. package/build-types/tree-grid/roving-tab-index-item.d.ts +5 -0
  643. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -0
  644. package/build-types/tree-grid/roving-tab-index.d.ts +10 -0
  645. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -0
  646. package/build-types/tree-grid/row.d.ts +12 -0
  647. package/build-types/tree-grid/row.d.ts.map +1 -0
  648. package/build-types/tree-grid/stories/index.d.ts +13 -0
  649. package/build-types/tree-grid/stories/index.d.ts.map +1 -0
  650. package/build-types/tree-grid/test/cell.d.ts +2 -0
  651. package/build-types/tree-grid/test/cell.d.ts.map +1 -0
  652. package/build-types/tree-grid/test/index.d.ts +2 -0
  653. package/build-types/tree-grid/test/index.d.ts.map +1 -0
  654. package/build-types/tree-grid/test/roving-tab-index-item.d.ts +2 -0
  655. package/build-types/tree-grid/test/roving-tab-index-item.d.ts.map +1 -0
  656. package/build-types/tree-grid/test/roving-tab-index.d.ts +2 -0
  657. package/build-types/tree-grid/test/roving-tab-index.d.ts.map +1 -0
  658. package/build-types/tree-grid/test/row.d.ts +2 -0
  659. package/build-types/tree-grid/test/row.d.ts.map +1 -0
  660. package/build-types/tree-grid/types.d.ts +109 -0
  661. package/build-types/tree-grid/types.d.ts.map +1 -0
  662. package/build-types/truncate/hook.d.ts +2 -2
  663. package/build-types/ui/context/context-connect.d.ts +7 -7
  664. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -1
  665. package/build-types/ui/control-group/hook.d.ts +2 -2
  666. package/build-types/ui/control-label/hook.d.ts +2 -2
  667. package/build-types/ui/form-group/form-group.d.ts +2 -2
  668. package/build-types/ui/form-group/use-form-group.d.ts +2 -2
  669. package/build-types/ui/utils/get-valid-children.d.ts +1 -1
  670. package/build-types/ui/utils/space.d.ts +1 -1
  671. package/build-types/unit-control/index.d.ts +1 -1
  672. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -2
  673. package/build-types/unit-control/utils.d.ts +20 -20
  674. package/build-types/utils/events.d.ts +2 -2
  675. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  676. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  677. package/build-types/utils/hooks/use-controlled-value.d.ts +4 -4
  678. package/build-types/utils/hooks/use-latest-ref.d.ts +1 -1
  679. package/build-types/utils/unit-values.d.ts +3 -3
  680. package/build-types/v-stack/component.d.ts +2 -2
  681. package/build-types/v-stack/hook.d.ts +2 -2
  682. package/build-types/v-stack/stories/index.d.ts +2 -2
  683. package/package.json +20 -18
  684. package/src/alignment-matrix-control/utils.tsx +4 -4
  685. package/src/angle-picker-control/README.md +17 -14
  686. package/src/angle-picker-control/{angle-circle.js → angle-circle.tsx} +44 -12
  687. package/src/angle-picker-control/{index.js → index.tsx} +54 -10
  688. package/src/angle-picker-control/stories/index.tsx +57 -0
  689. package/src/angle-picker-control/styles/{angle-picker-control-styles.js → angle-picker-control-styles.tsx} +5 -1
  690. package/src/angle-picker-control/types.ts +29 -0
  691. package/src/autocomplete/autocompleter-ui.native.js +1 -0
  692. package/src/base-control/hooks.ts +1 -1
  693. package/src/border-box-control/test/{index.js → index.tsx} +76 -102
  694. package/src/border-box-control/test/{utils.js → utils.ts} +20 -0
  695. package/src/border-box-control/utils.ts +1 -1
  696. package/src/box-control/README.md +17 -26
  697. package/src/box-control/{all-input-control.js → all-input-control.tsx} +10 -6
  698. package/src/box-control/{axial-input-controls.js → axial-input-controls.tsx} +29 -24
  699. package/src/box-control/{icon.js → icon.tsx} +9 -4
  700. package/src/box-control/{index.js → index.tsx} +43 -8
  701. package/src/box-control/{input-controls.js → input-controls.tsx} +26 -16
  702. package/src/box-control/{linked-button.js → linked-button.tsx} +4 -1
  703. package/src/box-control/styles/{box-control-icon-styles.js → box-control-icon-styles.ts} +1 -1
  704. package/src/box-control/styles/{box-control-styles.js → box-control-styles.ts} +10 -2
  705. package/src/box-control/styles/{box-control-visualizer-styles.js → box-control-visualizer-styles.ts} +6 -2
  706. package/src/box-control/test/{index.js → index.tsx} +12 -9
  707. package/src/box-control/types.ts +121 -0
  708. package/src/box-control/{unit-control.js → unit-control.tsx} +9 -2
  709. package/src/box-control/{utils.js → utils.ts} +47 -38
  710. package/src/button/test/index.tsx +38 -30
  711. package/src/button/types.ts +5 -2
  712. package/src/color-palette/README.md +7 -0
  713. package/src/color-palette/index.tsx +19 -6
  714. package/src/color-palette/test/utils.ts +17 -1
  715. package/src/color-palette/types.ts +8 -0
  716. package/src/color-palette/utils.ts +12 -7
  717. package/src/combobox-control/README.md +8 -15
  718. package/src/combobox-control/{index.js → index.tsx} +91 -19
  719. package/src/combobox-control/stories/index.tsx +114 -0
  720. package/src/combobox-control/styles.ts +4 -1
  721. package/src/combobox-control/test/{index.js → index.tsx} +9 -7
  722. package/src/combobox-control/types.ts +69 -0
  723. package/src/custom-gradient-picker/index.js +0 -1
  724. package/src/custom-select-control/index.js +9 -0
  725. package/src/custom-select-control/stories/index.js +2 -2
  726. package/src/custom-select-control/test/index.js +2 -2
  727. package/src/date-time/time/index.tsx +1 -1
  728. package/src/date-time/utils.ts +1 -1
  729. package/src/dimension-control/test/__snapshots__/index.test.js.snap +4 -4
  730. package/src/draggable/index.tsx +2 -2
  731. package/src/dropdown-menu/test/index.js +3 -11
  732. package/src/focal-point-picker/utils.ts +3 -3
  733. package/src/font-size-picker/utils.ts +2 -2
  734. package/src/gradient-picker/README.md +8 -0
  735. package/src/gradient-picker/index.js +6 -1
  736. package/src/index.js +5 -2
  737. package/src/input-control/reducer/reducer.ts +5 -5
  738. package/src/input-control/utils.ts +1 -1
  739. package/src/menu-items-choice/index.tsx +83 -0
  740. package/src/menu-items-choice/stories/index.tsx +79 -0
  741. package/src/menu-items-choice/types.ts +54 -0
  742. package/src/modal/index.tsx +45 -1
  743. package/src/modal/style.scss +8 -0
  744. package/src/modal/types.ts +2 -0
  745. package/src/navigator/context.ts +4 -0
  746. package/src/navigator/index.ts +1 -0
  747. package/src/navigator/navigator-back-button/README.md +1 -17
  748. package/src/navigator/navigator-back-button/hook.ts +10 -5
  749. package/src/navigator/navigator-button/README.md +1 -1
  750. package/src/navigator/navigator-provider/README.md +25 -4
  751. package/src/navigator/navigator-provider/component.tsx +170 -14
  752. package/src/navigator/navigator-screen/component.tsx +22 -11
  753. package/src/navigator/navigator-to-parent-button/README.md +15 -0
  754. package/src/navigator/navigator-to-parent-button/component.tsx +65 -0
  755. package/src/navigator/navigator-to-parent-button/index.ts +1 -0
  756. package/src/navigator/stories/index.tsx +93 -3
  757. package/src/navigator/test/index.tsx +267 -23
  758. package/src/navigator/test/router.ts +122 -0
  759. package/src/navigator/types.ts +31 -12
  760. package/src/navigator/use-navigator.ts +4 -1
  761. package/src/navigator/utils/router.ts +49 -0
  762. package/src/palette-edit/index.js +4 -1
  763. package/src/panel/README.md +2 -2
  764. package/src/panel/header.tsx +20 -0
  765. package/src/panel/index.tsx +48 -0
  766. package/src/panel/row.tsx +37 -0
  767. package/src/panel/stories/index.js +22 -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/panel/test/{header.js → header.tsx} +1 -1
  772. package/src/panel/test/{index.js → index.tsx} +6 -4
  773. package/src/panel/test/{row.js → row.tsx} +4 -2
  774. package/src/panel/types.ts +38 -0
  775. package/src/popover/README.md +4 -1
  776. package/src/popover/index.tsx +17 -1
  777. package/src/popover/overlay-middlewares.tsx +29 -0
  778. package/src/popover/stories/index.tsx +7 -1
  779. package/src/popover/test/index.tsx +29 -21
  780. package/src/popover/types.ts +4 -2
  781. package/src/popover/utils.ts +39 -3
  782. package/src/private-apis.js +22 -0
  783. package/src/query-controls/terms.ts +1 -1
  784. package/src/range-control/utils.ts +4 -4
  785. package/src/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
  786. package/src/resizable-box/resize-tooltip/utils.ts +14 -14
  787. package/src/select-control/README.md +3 -1
  788. package/src/select-control/index.tsx +3 -1
  789. package/src/select-control/style.scss +0 -10
  790. package/src/select-control/styles/select-control-styles.ts +36 -22
  791. package/src/select-control/types.ts +3 -1
  792. package/src/snackbar/index.tsx +2 -2
  793. package/src/toolbar/stories/{index.js → index.tsx} +39 -26
  794. package/src/toolbar/test/{index.js → index.tsx} +0 -0
  795. package/src/toolbar/test/{toolbar-group.js → toolbar-group.tsx} +2 -2
  796. package/src/toolbar/toolbar/README.md +7 -2
  797. package/src/toolbar/toolbar/{index.js → index.tsx} +33 -12
  798. package/src/toolbar/toolbar/{toolbar-container.js → toolbar-container.tsx} +9 -2
  799. package/src/toolbar/toolbar/types.ts +15 -0
  800. package/src/toolbar/toolbar-button/index.js +2 -0
  801. package/src/toolbar/toolbar-button/toolbar-button-container.js +2 -0
  802. package/src/toolbar/toolbar-context/index.js +2 -0
  803. package/src/toolbar/toolbar-dropdown-menu/index.js +2 -0
  804. package/src/toolbar/toolbar-group/index.js +2 -0
  805. package/src/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  806. package/src/toolbar/toolbar-group/toolbar-group-container.js +2 -0
  807. package/src/toolbar/toolbar-item/index.js +2 -0
  808. package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
  809. package/src/tools-panel/test/index.js +71 -6
  810. package/src/tools-panel/tools-panel/README.md +12 -4
  811. package/src/tools-panel/tools-panel/component.tsx +57 -3
  812. package/src/tools-panel/tools-panel/hook.ts +8 -7
  813. package/src/tools-panel/tools-panel-header/README.md +7 -0
  814. package/src/tools-panel/tools-panel-header/component.tsx +2 -1
  815. package/src/tools-panel/tools-panel-header/hook.ts +6 -4
  816. package/src/tools-panel/tools-panel-item/README.md +6 -4
  817. package/src/tools-panel/tools-panel-item/component.tsx +4 -4
  818. package/src/tools-panel/tools-panel-item/hook.ts +28 -16
  819. package/src/tools-panel/types.ts +43 -15
  820. package/src/tree-grid/README.md +18 -58
  821. package/src/tree-grid/cell.tsx +41 -0
  822. package/src/tree-grid/{index.js → index.tsx} +111 -35
  823. package/src/tree-grid/item.tsx +32 -0
  824. package/src/tree-grid/{roving-tab-index-context.js → roving-tab-index-context.ts} +9 -1
  825. package/src/tree-grid/roving-tab-index-item.tsx +50 -0
  826. package/src/tree-grid/{roving-tab-index.js → roving-tab-index.tsx} +7 -5
  827. package/src/tree-grid/row.tsx +47 -0
  828. package/src/tree-grid/stories/index.tsx +144 -0
  829. package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.tsx.snap} +0 -0
  830. package/src/tree-grid/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  831. package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.js.snap → roving-tab-index-item.tsx.snap} +0 -0
  832. package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap} +0 -0
  833. package/src/tree-grid/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  834. package/src/tree-grid/test/{cell.js → cell.tsx} +7 -4
  835. package/src/tree-grid/test/{index.js → index.tsx} +13 -5
  836. package/src/tree-grid/test/{roving-tab-index-item.js → roving-tab-index-item.tsx} +7 -4
  837. package/src/tree-grid/test/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
  838. package/src/tree-grid/test/{row.js → row.tsx} +4 -4
  839. package/src/tree-grid/types.ts +116 -0
  840. package/src/ui/context/context-connect.ts +7 -7
  841. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  842. package/src/ui/utils/get-valid-children.ts +1 -1
  843. package/src/ui/utils/space.ts +1 -1
  844. package/src/unit-control/index.tsx +2 -2
  845. package/src/unit-control/utils.ts +20 -20
  846. package/src/utils/events.ts +4 -4
  847. package/src/utils/hooks/use-controlled-state.js +2 -2
  848. package/src/utils/hooks/use-controlled-value.ts +4 -4
  849. package/src/utils/hooks/use-latest-ref.ts +1 -1
  850. package/src/utils/unit-values.ts +3 -3
  851. package/tsconfig.json +6 -8
  852. package/tsconfig.tsbuildinfo +1 -1
  853. package/build/base-field/hook.js +0 -54
  854. package/build/base-field/hook.js.map +0 -1
  855. package/build/base-field/index.js +0 -14
  856. package/build/base-field/index.js.map +0 -1
  857. package/build/base-field/styles.js +0 -33
  858. package/build/base-field/styles.js.map +0 -1
  859. package/build/resizable-box/styles/resizable-box.styles.js +0 -2
  860. package/build-module/base-field/hook.js +0 -37
  861. package/build-module/base-field/hook.js.map +0 -1
  862. package/build-module/base-field/index.js +0 -2
  863. package/build-module/base-field/index.js.map +0 -1
  864. package/build-module/base-field/styles.js +0 -18
  865. package/build-module/base-field/styles.js.map +0 -1
  866. package/build-module/resizable-box/styles/resizable-box.styles.js +0 -2
  867. package/build-types/base-field/hook.d.ts +0 -270
  868. package/build-types/base-field/hook.d.ts.map +0 -1
  869. package/build-types/base-field/index.d.ts +0 -2
  870. package/build-types/base-field/index.d.ts.map +0 -1
  871. package/build-types/base-field/styles.d.ts +0 -6
  872. package/build-types/base-field/styles.d.ts.map +0 -1
  873. package/build-types/base-field/types.d.ts +0 -29
  874. package/build-types/base-field/types.d.ts.map +0 -1
  875. package/build-types/resizable-box/styles/resizable-box.styles.d.ts +0 -1
  876. package/build-types/resizable-box/styles/resizable-box.styles.d.ts.map +0 -1
  877. package/src/angle-picker-control/stories/index.js +0 -29
  878. package/src/base-field/README.md +0 -66
  879. package/src/base-field/hook.ts +0 -51
  880. package/src/base-field/index.ts +0 -1
  881. package/src/base-field/styles.ts +0 -86
  882. package/src/base-field/test/__snapshots__/index.tsx.snap +0 -141
  883. package/src/base-field/test/index.tsx +0 -84
  884. package/src/base-field/types.ts +0 -29
  885. package/src/combobox-control/stories/index.js +0 -339
  886. package/src/menu-items-choice/index.js +0 -43
  887. package/src/panel/header.js +0 -10
  888. package/src/panel/index.js +0 -26
  889. package/src/panel/row.js +0 -20
  890. package/src/resizable-box/styles/resizable-box.styles.js +0 -0
  891. package/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +0 -246
  892. package/src/tree-grid/cell.js +0 -24
  893. package/src/tree-grid/item.js +0 -20
  894. package/src/tree-grid/roving-tab-index-item.js +0 -33
  895. package/src/tree-grid/row.js +0 -31
  896. package/src/tree-grid/stories/index.js +0 -106
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/draggable/index.tsx"],"names":["dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;;;;;;;AASA;;AADA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASA,MAAMA,cAAc,GAAG,4CAAvB;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;AACA,MAAMC,YAAY,GAAG,CAArB;AACA,MAAMC,SAAS,GAAG,kCAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,SAAT,OAUa;AAAA,MAVO;AAC1BC,IAAAA,QAD0B;AAE1BC,IAAAA,WAF0B;AAG1BC,IAAAA,UAH0B;AAI1BC,IAAAA,SAJ0B;AAK1BC,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iBA;;AAED,0BACC,MAAM,MAAM;AACXzD,IAAAA,OAAO,CAACI,OAAR;AACA,GAHF,EAIC,EAJD;AAOA,SACC,qDACGhB,QAAQ,CAAE;AACX0E,IAAAA,gBAAgB,EAAEzD,KADP;AAEX0D,IAAAA,cAAc,EAAE9D;AAFL,GAAF,CADX,EAKGH,aAAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEkE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGjE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA;;eAEcX,S","sourcesContent":["/**\n * External dependencies\n */\nimport type { DragEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DraggableProps } from './types';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n}: DraggableProps ) {\n\tconst dragComponentRef = useRef< HTMLDivElement >( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction end( event: DragEvent ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction start( event: DragEvent ) {\n\t\tconst { ownerDocument } = event.target as HTMLElement;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = '0';\n\t\tcloneWrapper.style.left = '0';\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById(\n\t\t\t\telementId\n\t\t\t) as HTMLElement;\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = elementRect.top;\n\t\t\tconst elementLeftOffset = elementRect.left;\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true ) as HTMLElement;\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from< HTMLIFrameElement >(\n\t\t\t\tclone.querySelectorAll( 'iframe' )\n\t\t\t).forEach( ( child ) => child.parentNode?.removeChild( child ) );\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper?.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\tfunction over( e: DragEvent ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\tlet timerId: number | undefined;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Draggable;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/draggable/index.tsx"],"names":["dragImageClass","cloneWrapperClass","clonePadding","bodyClass","Draggable","children","onDragStart","onDragOver","onDragEnd","cloneClassname","elementId","transferData","__experimentalTransferDataType","transferDataType","__experimentalDragComponent","dragComponent","dragComponentRef","cleanup","end","event","preventDefault","current","start","ownerDocument","target","dataTransfer","setData","JSON","stringify","cloneWrapper","createElement","style","top","left","dragImage","setDragImage","classList","add","body","appendChild","x","y","clientX","clientY","transform","clonedDragComponent","innerHTML","element","getElementById","elementRect","getBoundingClientRect","elementWrapper","parentNode","elementTopOffset","elementLeftOffset","width","clone","cloneNode","id","Array","from","querySelectorAll","forEach","child","removeChild","cursorLeft","cursorTop","over","e","nextX","nextY","throttledDragOver","addEventListener","persist","timerId","setTimeout","remove","removeEventListener","clearTimeout","onDraggableStart","onDraggableEnd","display"],"mappings":";;;;;;;;AASA;;AADA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AASA,MAAMA,cAAc,GAAG,4CAAvB;AACA,MAAMC,iBAAiB,GAAG,6BAA1B;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uB,UAAb,CAAwBY,WAAxB,CAAqCnC,YAArC;AACA;;AAED,UAAKK,SAAS,IAAIA,SAAS,CAACkB,UAA5B,EAAyC;AACxClB,QAAAA,SAAS,CAACkB,UAAV,CAAqBY,WAArB,CAAkC9B,SAAlC;AACA,OARsB,CAUvB;;;AACAX,MAAAA,aAAa,CAACe,IAAd,CAAmBF,SAAnB,CAA6BwC,MAA7B,CAAqCzE,SAArC;AAEAoB,MAAAA,aAAa,CAACsD,mBAAd,CAAmC,UAAnC,EAA+CN,iBAA/C;AAEAO,MAAAA,YAAY,CAAEJ,OAAF,CAAZ;AACA,KAhBD;AAiBA;;AAED,0BACC,MAAM,MAAM;AACXzD,IAAAA,OAAO,CAACI,OAAR;AACA,GAHF,EAIC,EAJD;AAOA,SACC,qDACGhB,QAAQ,CAAE;AACX0E,IAAAA,gBAAgB,EAAEzD,KADP;AAEX0D,IAAAA,cAAc,EAAE9D;AAFL,GAAF,CADX,EAKGH,aAAa,IACd;AACC,IAAA,SAAS,EAAC,0CADX;AAEC,IAAA,KAAK,EAAG;AAAEkE,MAAAA,OAAO,EAAE;AAAX,KAFT;AAGC,IAAA,GAAG,EAAGjE;AAHP,KAKGD,aALH,CANF,CADD;AAiBA;;eAEcX,S","sourcesContent":["/**\n * External dependencies\n */\nimport type { DragEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { throttle } from '@wordpress/compose';\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { DraggableProps } from './types';\n\nconst dragImageClass = 'components-draggable__invisible-drag-image';\nconst cloneWrapperClass = 'components-draggable__clone';\nconst clonePadding = 0;\nconst bodyClass = 'is-dragging-components-draggable';\n\n/**\n * `Draggable` is a Component that provides a way to set up a cross-browser\n * (including IE) customizable drag image and the transfer data for the drag\n * event. It decouples the drag handle and the element to drag: use it by\n * wrapping the component that will become the drag handle and providing the DOM\n * ID of the element to drag.\n *\n * Note that the drag handle needs to declare the `draggable=\"true\"` property\n * and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event\n * handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable`\n * takes care of the logic to setup the drag image and the transfer data, but is\n * not concerned with creating an actual DOM element that is draggable.\n *\n * ```jsx\n * import { Draggable, Panel, PanelBody } from '@wordpress/components';\n * import { Icon, more } from '@wordpress/icons';\n *\n * const MyDraggable = () => (\n * <div id=\"draggable-panel\">\n * <Panel header=\"Draggable panel\">\n * <PanelBody>\n * <Draggable elementId=\"draggable-panel\" transferData={ {} }>\n * { ( { onDraggableStart, onDraggableEnd } ) => (\n * <div\n * className=\"example-drag-handle\"\n * draggable\n * onDragStart={ onDraggableStart }\n * onDragEnd={ onDraggableEnd }\n * >\n * <Icon icon={ more } />\n * </div>\n * ) }\n * </Draggable>\n * </PanelBody>\n * </Panel>\n * </div>\n * );\n * ```\n */\nexport function Draggable( {\n\tchildren,\n\tonDragStart,\n\tonDragOver,\n\tonDragEnd,\n\tcloneClassname,\n\telementId,\n\ttransferData,\n\t__experimentalTransferDataType: transferDataType = 'text',\n\t__experimentalDragComponent: dragComponent,\n}: DraggableProps ) {\n\tconst dragComponentRef = useRef< HTMLDivElement >( null );\n\tconst cleanup = useRef( () => {} );\n\n\t/**\n\t * Removes the element clone, resets cursor, and removes drag listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction end( event: DragEvent ) {\n\t\tevent.preventDefault();\n\t\tcleanup.current();\n\n\t\tif ( onDragEnd ) {\n\t\t\tonDragEnd( event );\n\t\t}\n\t}\n\n\t/**\n\t * This method does a couple of things:\n\t *\n\t * - Clones the current element and spawns clone over original element.\n\t * - Adds a fake temporary drag image to avoid browser defaults.\n\t * - Sets transfer data.\n\t * - Adds dragover listener.\n\t *\n\t * @param event The non-custom DragEvent.\n\t */\n\tfunction start( event: DragEvent ) {\n\t\tconst { ownerDocument } = event.target as HTMLElement;\n\n\t\tevent.dataTransfer.setData(\n\t\t\ttransferDataType,\n\t\t\tJSON.stringify( transferData )\n\t\t);\n\n\t\tconst cloneWrapper = ownerDocument.createElement( 'div' );\n\t\t// Reset position to 0,0. Natural stacking order will position this lower, even with a transform otherwise.\n\t\tcloneWrapper.style.top = '0';\n\t\tcloneWrapper.style.left = '0';\n\n\t\tconst dragImage = ownerDocument.createElement( 'div' );\n\n\t\t// Set a fake drag image to avoid browser defaults. Remove from DOM\n\t\t// right after. event.dataTransfer.setDragImage is not supported yet in\n\t\t// IE, we need to check for its existence first.\n\t\tif ( 'function' === typeof event.dataTransfer.setDragImage ) {\n\t\t\tdragImage.classList.add( dragImageClass );\n\t\t\townerDocument.body.appendChild( dragImage );\n\t\t\tevent.dataTransfer.setDragImage( dragImage, 0, 0 );\n\t\t}\n\n\t\tcloneWrapper.classList.add( cloneWrapperClass );\n\n\t\tif ( cloneClassname ) {\n\t\t\tcloneWrapper.classList.add( cloneClassname );\n\t\t}\n\n\t\tlet x = 0;\n\t\tlet y = 0;\n\t\t// If a dragComponent is defined, the following logic will clone the\n\t\t// HTML node and inject it into the cloneWrapper.\n\t\tif ( dragComponentRef.current ) {\n\t\t\t// Position dragComponent at the same position as the cursor.\n\t\t\tx = event.clientX;\n\t\t\ty = event.clientY;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\tconst clonedDragComponent = ownerDocument.createElement( 'div' );\n\t\t\tclonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;\n\t\t\tcloneWrapper.appendChild( clonedDragComponent );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\townerDocument.body.appendChild( cloneWrapper );\n\t\t} else {\n\t\t\tconst element = ownerDocument.getElementById(\n\t\t\t\telementId\n\t\t\t) as HTMLElement;\n\n\t\t\t// Prepare element clone and append to element wrapper.\n\t\t\tconst elementRect = element.getBoundingClientRect();\n\t\t\tconst elementWrapper = element.parentNode;\n\t\t\tconst elementTopOffset = elementRect.top;\n\t\t\tconst elementLeftOffset = elementRect.left;\n\n\t\t\tcloneWrapper.style.width = `${\n\t\t\t\telementRect.width + clonePadding * 2\n\t\t\t}px`;\n\n\t\t\tconst clone = element.cloneNode( true ) as HTMLElement;\n\t\t\tclone.id = `clone-${ elementId }`;\n\n\t\t\t// Position clone right over the original element (20px padding).\n\t\t\tx = elementLeftOffset - clonePadding;\n\t\t\ty = elementTopOffset - clonePadding;\n\t\t\tcloneWrapper.style.transform = `translate( ${ x }px, ${ y }px )`;\n\n\t\t\t// Hack: Remove iFrames as it's causing the embeds drag clone to freeze.\n\t\t\tArray.from< HTMLIFrameElement >(\n\t\t\t\tclone.querySelectorAll( 'iframe' )\n\t\t\t).forEach( ( child ) => child.parentNode?.removeChild( child ) );\n\n\t\t\tcloneWrapper.appendChild( clone );\n\n\t\t\t// Inject the cloneWrapper into the DOM.\n\t\t\telementWrapper?.appendChild( cloneWrapper );\n\t\t}\n\n\t\t// Mark the current cursor coordinates.\n\t\tlet cursorLeft = event.clientX;\n\t\tlet cursorTop = event.clientY;\n\n\t\tfunction over( e: DragEvent ) {\n\t\t\t// Skip doing any work if mouse has not moved.\n\t\t\tif ( cursorLeft === e.clientX && cursorTop === e.clientY ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst nextX = x + e.clientX - cursorLeft;\n\t\t\tconst nextY = y + e.clientY - cursorTop;\n\t\t\tcloneWrapper.style.transform = `translate( ${ nextX }px, ${ nextY }px )`;\n\t\t\tcursorLeft = e.clientX;\n\t\t\tcursorTop = e.clientY;\n\t\t\tx = nextX;\n\t\t\ty = nextY;\n\t\t\tif ( onDragOver ) {\n\t\t\t\tonDragOver( e );\n\t\t\t}\n\t\t}\n\n\t\t// Aim for 60fps (16 ms per frame) for now. We can potentially use requestAnimationFrame (raf) instead,\n\t\t// note that browsers may throttle raf below 60fps in certain conditions.\n\t\t// @ts-ignore\n\t\tconst throttledDragOver = throttle( over, 16 );\n\n\t\townerDocument.addEventListener( 'dragover', throttledDragOver );\n\n\t\t// Update cursor to 'grabbing', document wide.\n\t\townerDocument.body.classList.add( bodyClass );\n\n\t\t// Allow the Synthetic Event to be accessed from asynchronous code.\n\t\t// https://reactjs.org/docs/events.html#event-pooling\n\t\tevent.persist();\n\n\t\tlet timerId: number | undefined;\n\n\t\tif ( onDragStart ) {\n\t\t\ttimerId = setTimeout( () => onDragStart( event ) );\n\t\t}\n\n\t\tcleanup.current = () => {\n\t\t\t// Remove drag clone.\n\t\t\tif ( cloneWrapper && cloneWrapper.parentNode ) {\n\t\t\t\tcloneWrapper.parentNode.removeChild( cloneWrapper );\n\t\t\t}\n\n\t\t\tif ( dragImage && dragImage.parentNode ) {\n\t\t\t\tdragImage.parentNode.removeChild( dragImage );\n\t\t\t}\n\n\t\t\t// Reset cursor.\n\t\t\townerDocument.body.classList.remove( bodyClass );\n\n\t\t\townerDocument.removeEventListener( 'dragover', throttledDragOver );\n\n\t\t\tclearTimeout( timerId );\n\t\t};\n\t}\n\n\tuseEffect(\n\t\t() => () => {\n\t\t\tcleanup.current();\n\t\t},\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ children( {\n\t\t\t\tonDraggableStart: start,\n\t\t\t\tonDraggableEnd: end,\n\t\t\t} ) }\n\t\t\t{ dragComponent && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"components-draggable-drag-component-root\"\n\t\t\t\t\tstyle={ { display: 'none' } }\n\t\t\t\t\tref={ dragComponentRef }\n\t\t\t\t>\n\t\t\t\t\t{ dragComponent }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default Draggable;\n"]}
@@ -16,7 +16,7 @@ const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv
16
16
  /**
17
17
  * Gets the extension of a file name.
18
18
  *
19
- * @param filename The file name.
19
+ * @param filename The file name.
20
20
  * @return The extension of the file name.
21
21
  */
22
22
 
@@ -28,7 +28,7 @@ function getExtension() {
28
28
  /**
29
29
  * Checks if a file is a video.
30
30
  *
31
- * @param filename The file name.
31
+ * @param filename The file name.
32
32
  * @return Whether the file is a video.
33
33
  */
34
34
 
@@ -41,7 +41,7 @@ function isVideoType() {
41
41
  /**
42
42
  * Transforms a fraction value to a percentage value.
43
43
  *
44
- * @param fraction The fraction value.
44
+ * @param fraction The fraction value.
45
45
  * @return A percentage value.
46
46
  */
47
47
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/focal-point-picker/utils.ts"],"names":["INITIAL_BOUNDS","width","height","VIDEO_EXTENSIONS","getExtension","filename","parts","split","length","isVideoType","startsWith","includes","fractionToPercentage","fraction","Math","round"],"mappings":";;;;;;;;;AAAO,MAAMA,cAAc,GAAG;AAC7BC,EAAAA,KAAK,EAAE,GADsB;AAE7BC,EAAAA,MAAM,EAAE;AAFqB,CAAvB;;AAKP,MAAMC,gBAAgB,GAAG,CACxB,KADwB,EAExB,KAFwB,EAGxB,MAHwB,EAIxB,KAJwB,EAKxB,KALwB,EAMxB,KANwB,EAOxB,KAPwB,EAQxB,KARwB,EASxB,MATwB,EAUxB,KAVwB,CAAzB;AAaA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,YAAT,GAA+C;AAAA,MAAxBC,QAAwB,uEAAb,EAAa;AACrD,QAAMC,KAAK,GAAGD,QAAQ,CAACE,KAAT,CAAgB,GAAhB,CAAd;AACA,SAAOD,KAAK,CAAEA,KAAK,CAACE,MAAN,GAAe,CAAjB,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,GAAuD;AAAA,MAAjCJ,QAAiC,uEAAd,EAAc;AAC7D,MAAK,CAAEA,QAAP,EAAkB,OAAO,KAAP;AAClB,SACCA,QAAQ,CAACK,UAAT,CAAqB,aAArB,KACAP,gBAAgB,CAACQ,QAAjB,CAA2BP,YAAY,CAAEC,QAAF,CAAvC,CAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,oBAAT,CAA+BC,QAA/B,EAA0D;AAChE,SAAOC,IAAI,CAACC,KAAL,CAAYF,QAAQ,GAAG,GAAvB,CAAP;AACA","sourcesContent":["export const INITIAL_BOUNDS = {\n\twidth: 200,\n\theight: 170,\n};\n\nconst VIDEO_EXTENSIONS = [\n\t'avi',\n\t'mpg',\n\t'mpeg',\n\t'mov',\n\t'mp4',\n\t'm4v',\n\t'ogg',\n\t'ogv',\n\t'webm',\n\t'wmv',\n];\n\n/**\n * Gets the extension of a file name.\n *\n * @param filename The file name.\n * @return The extension of the file name.\n */\nexport function getExtension( filename = '' ): string {\n\tconst parts = filename.split( '.' );\n\treturn parts[ parts.length - 1 ];\n}\n\n/**\n * Checks if a file is a video.\n *\n * @param filename The file name.\n * @return Whether the file is a video.\n */\nexport function isVideoType( filename: string = '' ): boolean {\n\tif ( ! filename ) return false;\n\treturn (\n\t\tfilename.startsWith( 'data:video/' ) ||\n\t\tVIDEO_EXTENSIONS.includes( getExtension( filename ) )\n\t);\n}\n\n/**\n * Transforms a fraction value to a percentage value.\n *\n * @param fraction The fraction value.\n * @return A percentage value.\n */\nexport function fractionToPercentage( fraction: number ): number {\n\treturn Math.round( fraction * 100 );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/focal-point-picker/utils.ts"],"names":["INITIAL_BOUNDS","width","height","VIDEO_EXTENSIONS","getExtension","filename","parts","split","length","isVideoType","startsWith","includes","fractionToPercentage","fraction","Math","round"],"mappings":";;;;;;;;;AAAO,MAAMA,cAAc,GAAG;AAC7BC,EAAAA,KAAK,EAAE,GADsB;AAE7BC,EAAAA,MAAM,EAAE;AAFqB,CAAvB;;AAKP,MAAMC,gBAAgB,GAAG,CACxB,KADwB,EAExB,KAFwB,EAGxB,MAHwB,EAIxB,KAJwB,EAKxB,KALwB,EAMxB,KANwB,EAOxB,KAPwB,EAQxB,KARwB,EASxB,MATwB,EAUxB,KAVwB,CAAzB;AAaA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,YAAT,GAA+C;AAAA,MAAxBC,QAAwB,uEAAb,EAAa;AACrD,QAAMC,KAAK,GAAGD,QAAQ,CAACE,KAAT,CAAgB,GAAhB,CAAd;AACA,SAAOD,KAAK,CAAEA,KAAK,CAACE,MAAN,GAAe,CAAjB,CAAZ;AACA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,WAAT,GAAuD;AAAA,MAAjCJ,QAAiC,uEAAd,EAAc;AAC7D,MAAK,CAAEA,QAAP,EAAkB,OAAO,KAAP;AAClB,SACCA,QAAQ,CAACK,UAAT,CAAqB,aAArB,KACAP,gBAAgB,CAACQ,QAAjB,CAA2BP,YAAY,CAAEC,QAAF,CAAvC,CAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASO,oBAAT,CAA+BC,QAA/B,EAA0D;AAChE,SAAOC,IAAI,CAACC,KAAL,CAAYF,QAAQ,GAAG,GAAvB,CAAP;AACA","sourcesContent":["export const INITIAL_BOUNDS = {\n\twidth: 200,\n\theight: 170,\n};\n\nconst VIDEO_EXTENSIONS = [\n\t'avi',\n\t'mpg',\n\t'mpeg',\n\t'mov',\n\t'mp4',\n\t'm4v',\n\t'ogg',\n\t'ogv',\n\t'webm',\n\t'wmv',\n];\n\n/**\n * Gets the extension of a file name.\n *\n * @param filename The file name.\n * @return The extension of the file name.\n */\nexport function getExtension( filename = '' ): string {\n\tconst parts = filename.split( '.' );\n\treturn parts[ parts.length - 1 ];\n}\n\n/**\n * Checks if a file is a video.\n *\n * @param filename The file name.\n * @return Whether the file is a video.\n */\nexport function isVideoType( filename: string = '' ): boolean {\n\tif ( ! filename ) return false;\n\treturn (\n\t\tfilename.startsWith( 'data:video/' ) ||\n\t\tVIDEO_EXTENSIONS.includes( getExtension( filename ) )\n\t);\n}\n\n/**\n * Transforms a fraction value to a percentage value.\n *\n * @param fraction The fraction value.\n * @return A percentage value.\n */\nexport function fractionToPercentage( fraction: number ): number {\n\treturn Math.round( fraction * 100 );\n}\n"]}
@@ -20,7 +20,7 @@ var _unitControl = require("../unit-control");
20
20
  * Some themes use css vars for their font sizes, so until we
21
21
  * have the way of calculating them don't display them.
22
22
  *
23
- * @param value The value that is checked.
23
+ * @param value The value that is checked.
24
24
  * @return Whether the value is a simple css value.
25
25
  */
26
26
  function isSimpleCssValue(value) {
@@ -31,7 +31,7 @@ function isSimpleCssValue(value) {
31
31
  * If all of the given font sizes have the same unit (e.g. 'px'), return that
32
32
  * unit. Otherwise return null.
33
33
  *
34
- * @param fontSizes List of font sizes.
34
+ * @param fontSizes List of font sizes.
35
35
  * @return The common unit, or null.
36
36
  */
37
37
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/font-size-picker/utils.ts"],"names":["isSimpleCssValue","value","sizeRegex","test","String","getCommonSizeUnit","fontSizes","firstFontSize","otherFontSizes","firstUnit","size","areAllSizesSameUnit","every","fontSize","unit"],"mappings":";;;;;;;;AASA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,KADM,EAEL;AACD,QAAMC,SAAS,GAAG,gCAAlB;AACA,SAAOA,SAAS,CAACC,IAAV,CAAgBC,MAAM,CAAEH,KAAF,CAAtB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,iBAAT,CAA4BC,SAA5B,EAAoD;AAC1D,QAAM,CAAEC,aAAF,EAAiB,GAAGC,cAApB,IAAuCF,SAA7C;;AACA,MAAK,CAAEC,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AACD,QAAM,GAAIE,SAAJ,IAAkB,mDACvBF,aAAa,CAACG,IADS,CAAxB;AAGA,QAAMC,mBAAmB,GAAGH,cAAc,CAACI,KAAf,CAAwBC,QAAF,IAAgB;AACjE,UAAM,GAAIC,IAAJ,IAAa,mDAAkCD,QAAQ,CAACH,IAA3C,CAAnB;AACA,WAAOI,IAAI,KAAKL,SAAhB;AACA,GAH2B,CAA5B;AAIA,SAAOE,mBAAmB,GAAGF,SAAH,GAAe,IAAzC;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { FontSizePickerProps, FontSize } from './types';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control';\n\n/**\n * Some themes use css vars for their font sizes, so until we\n * have the way of calculating them don't display them.\n *\n * @param value The value that is checked.\n * @return Whether the value is a simple css value.\n */\nexport function isSimpleCssValue(\n\tvalue: NonNullable< FontSizePickerProps[ 'value' ] >\n) {\n\tconst sizeRegex = /^[\\d\\.]+(px|em|rem|vw|vh|%)?$/i;\n\treturn sizeRegex.test( String( value ) );\n}\n\n/**\n * If all of the given font sizes have the same unit (e.g. 'px'), return that\n * unit. Otherwise return null.\n *\n * @param fontSizes List of font sizes.\n * @return The common unit, or null.\n */\nexport function getCommonSizeUnit( fontSizes: FontSize[] ) {\n\tconst [ firstFontSize, ...otherFontSizes ] = fontSizes;\n\tif ( ! firstFontSize ) {\n\t\treturn null;\n\t}\n\tconst [ , firstUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tfirstFontSize.size\n\t);\n\tconst areAllSizesSameUnit = otherFontSizes.every( ( fontSize ) => {\n\t\tconst [ , unit ] = parseQuantityAndUnitFromRawValue( fontSize.size );\n\t\treturn unit === firstUnit;\n\t} );\n\treturn areAllSizesSameUnit ? firstUnit : null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/font-size-picker/utils.ts"],"names":["isSimpleCssValue","value","sizeRegex","test","String","getCommonSizeUnit","fontSizes","firstFontSize","otherFontSizes","firstUnit","size","areAllSizesSameUnit","every","fontSize","unit"],"mappings":";;;;;;;;AASA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAT,CACNC,KADM,EAEL;AACD,QAAMC,SAAS,GAAG,gCAAlB;AACA,SAAOA,SAAS,CAACC,IAAV,CAAgBC,MAAM,CAAEH,KAAF,CAAtB,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASI,iBAAT,CAA4BC,SAA5B,EAAoD;AAC1D,QAAM,CAAEC,aAAF,EAAiB,GAAGC,cAApB,IAAuCF,SAA7C;;AACA,MAAK,CAAEC,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AACD,QAAM,GAAIE,SAAJ,IAAkB,mDACvBF,aAAa,CAACG,IADS,CAAxB;AAGA,QAAMC,mBAAmB,GAAGH,cAAc,CAACI,KAAf,CAAwBC,QAAF,IAAgB;AACjE,UAAM,GAAIC,IAAJ,IAAa,mDAAkCD,QAAQ,CAACH,IAA3C,CAAnB;AACA,WAAOI,IAAI,KAAKL,SAAhB;AACA,GAH2B,CAA5B;AAIA,SAAOE,mBAAmB,GAAGF,SAAH,GAAe,IAAzC;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { FontSizePickerProps, FontSize } from './types';\nimport { parseQuantityAndUnitFromRawValue } from '../unit-control';\n\n/**\n * Some themes use css vars for their font sizes, so until we\n * have the way of calculating them don't display them.\n *\n * @param value The value that is checked.\n * @return Whether the value is a simple css value.\n */\nexport function isSimpleCssValue(\n\tvalue: NonNullable< FontSizePickerProps[ 'value' ] >\n) {\n\tconst sizeRegex = /^[\\d\\.]+(px|em|rem|vw|vh|%)?$/i;\n\treturn sizeRegex.test( String( value ) );\n}\n\n/**\n * If all of the given font sizes have the same unit (e.g. 'px'), return that\n * unit. Otherwise return null.\n *\n * @param fontSizes List of font sizes.\n * @return The common unit, or null.\n */\nexport function getCommonSizeUnit( fontSizes: FontSize[] ) {\n\tconst [ firstFontSize, ...otherFontSizes ] = fontSizes;\n\tif ( ! firstFontSize ) {\n\t\treturn null;\n\t}\n\tconst [ , firstUnit ] = parseQuantityAndUnitFromRawValue(\n\t\tfirstFontSize.size\n\t);\n\tconst areAllSizesSameUnit = otherFontSizes.every( ( fontSize ) => {\n\t\tconst [ , unit ] = parseQuantityAndUnitFromRawValue( fontSize.size );\n\t\treturn unit === firstUnit;\n\t} );\n\treturn areAllSizesSameUnit ? firstUnit : null;\n}\n"]}
@@ -86,7 +86,8 @@ function MultipleOrigin(_ref3) {
86
86
  gradients,
87
87
  onChange,
88
88
  value,
89
- actions
89
+ actions,
90
+ headingLevel
90
91
  } = _ref3;
91
92
  return (0, _element.createElement)(_vStack.VStack, {
92
93
  spacing: 3,
@@ -99,7 +100,9 @@ function MultipleOrigin(_ref3) {
99
100
  return (0, _element.createElement)(_vStack.VStack, {
100
101
  spacing: 2,
101
102
  key: index
102
- }, (0, _element.createElement)(_styles.ColorHeading, null, name), (0, _element.createElement)(SingleOrigin, (0, _extends2.default)({
103
+ }, (0, _element.createElement)(_styles.ColorHeading, {
104
+ level: headingLevel
105
+ }, name), (0, _element.createElement)(SingleOrigin, (0, _extends2.default)({
103
106
  clearGradient: clearGradient,
104
107
  gradients: gradientSet,
105
108
  onChange: gradient => onChange(gradient, index),
@@ -120,7 +123,8 @@ function GradientPicker(_ref5) {
120
123
  value,
121
124
  clearable = true,
122
125
  disableCustomGradients = false,
123
- __experimentalIsRenderedInSidebar
126
+ __experimentalIsRenderedInSidebar,
127
+ headingLevel = 2
124
128
  } = _ref5;
125
129
  const clearGradient = (0, _element.useCallback)(() => onChange(undefined), [onChange]);
126
130
  const Component = isMultipleOriginArray(gradients) ? MultipleOrigin : SingleOrigin;
@@ -156,7 +160,8 @@ function GradientPicker(_ref5) {
156
160
  value: value,
157
161
  actions: clearable && !disableCustomGradients && (0, _element.createElement)(_circularOptionPicker.default.ButtonAction, {
158
162
  onClick: clearGradient
159
- }, (0, _i18n.__)('Clear'))
163
+ }, (0, _i18n.__)('Clear')),
164
+ headingLevel: headingLevel
160
165
  })))
161
166
  );
162
167
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/gradient-picker/index.js"],"names":["isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","actions","gradientOptions","map","index","gradient","name","color","background","MultipleOrigin","gradientSet","GradientPicker","__nextHasNoMargin","clearable","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","Component","since","version","hint","deprecatedMarginSpacerProps","marginTop","marginBottom"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA;AACA;AACA,MAAMA,sBAAsB,GAAKC,GAAF,IAC9BC,KAAK,CAACC,OAAN,CAAeF,GAAG,CAACG,SAAnB,KAAkC,EAAI,cAAcH,GAAlB,CADnC;;AAGA,MAAMI,qBAAqB,GAAKC,GAAF,IAAW;AACxC,SACCA,GAAG,CAACC,MAAJ,GAAa,CAAb,IACAD,GAAG,CAACE,KAAJ,CAAaC,WAAF,IAAmBT,sBAAsB,CAAES,WAAF,CAApD,CAFD;AAIA,CALD;;AAOA,SAASC,YAAT,OAOI;AAAA,MAPmB;AACtBC,IAAAA,SADsB;AAEtBC,IAAAA,aAFsB;AAGtBR,IAAAA,SAHsB;AAItBS,IAAAA,QAJsB;AAKtBC,IAAAA,KALsB;AAMtBC,IAAAA;AANsB,GAOnB;AACH,QAAMC,eAAe,GAAG,sBAAS,MAAM;AACtC,WAAOZ,SAAS,CAACa,GAAV,CAAe,QAAsBC,KAAtB;AAAA,UAAE;AAAEC,QAAAA,QAAF;AAAYC,QAAAA;AAAZ,OAAF;AAAA,aACrB,4BAAC,6BAAD,CAAsB,MAAtB;AACC,QAAA,GAAG,EAAGD,QADP;AAEC,QAAA,KAAK,EAAGA,QAFT;AAGC,QAAA,UAAU,EAAGL,KAAK,KAAKK,QAHxB;AAIC,QAAA,WAAW,EACVC,IAAI,IACJ;AACA,2BAAS,cAAI,mBAAJ,CAAT,EAAoCD,QAApC,CAPF;AASC,QAAA,KAAK,EAAG;AAAEE,UAAAA,KAAK,EAAE,iBAAT;AAA4BC,UAA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OACG,CAAEqB,sBAAF,IACD,4BAAC,6BAAD;AACC,MAAA,iBAAiB,MADlB;AAEC,MAAA,iCAAiC,EAChCC,iCAHF;AAKC,MAAA,KAAK,EAAGf,KALT;AAMC,MAAA,QAAQ,EAAGD;AANZ,MAFF,EAWG,CAAE,CAAAT,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEG,MAAX,KAAqBoB,SAAvB,KACD,4BAAC,SAAD;AACC,MAAA,SAAS,EAAGhB,SADb;AAEC,MAAA,SAAS,EAAGgB,SAFb;AAGC,MAAA,aAAa,EAAGf,aAHjB;AAIC,MAAA,SAAS,EAAGR,SAJb;AAKC,MAAA,QAAQ,EAAGS,QALZ;AAMC,MAAA,KAAK,EAAGC,KANT;AAOC,MAAA,OAAO,EACNa,SAAS,IACT,CAAEC,sBADF,IAEC,4BAAC,6BAAD,CAAsB,YAAtB;AACC,QAAA,OAAO,EAAGhB;AADX,SAGG,cAAI,OAAJ,CAHH;AAVH,MAZF,CADD;AAFD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport { Spacer } from '../spacer';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = ( obj ) =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr ) => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ gradient }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading>{ name }</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t{ ...( gradients.length === index + 1\n\t\t\t\t\t\t\t\t? { actions }\n\t\t\t\t\t\t\t\t: {} ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport default function GradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tclassName,\n\tgradients,\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n} ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\tconst Component = isMultipleOriginArray( gradients )\n\t\t? MultipleOrigin\n\t\t: SingleOrigin;\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated( 'Outer margin styles for wp.components.GradientPicker', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.4',\n\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t} );\n\t}\n\n\tconst deprecatedMarginSpacerProps = ! __nextHasNoMargin\n\t\t? {\n\t\t\t\tmarginTop: ! gradients?.length ? 3 : undefined,\n\t\t\t\tmarginBottom: ! clearable ? 6 : 0,\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t// Outmost Spacer wrapper can be removed when deprecation period is over\n\t\t<Spacer marginBottom={ 0 } { ...deprecatedMarginSpacerProps }>\n\t\t\t<VStack spacing={ gradients?.length ? 4 : 0 }>\n\t\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( gradients?.length || clearable ) && (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</Spacer>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/gradient-picker/index.js"],"names":["isMultipleOriginObject","obj","Array","isArray","gradients","isMultipleOriginArray","arr","length","every","gradientObj","SingleOrigin","className","clearGradient","onChange","value","actions","gradientOptions","map","index","gradient","name","color","background","MultipleOrigin","headingLevel","gradientSet","GradientPicker","__nextHasNoMargin","clearable","disableCustomGradients","__experimentalIsRenderedInSidebar","undefined","Component","since","version","hint","deprecatedMarginSpacerProps","marginTop","marginBottom"],"mappings":";;;;;;;;;AAIA;;;;AADA;;AAEA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAdA;AACA;AACA;;AAKA;AACA;AACA;AAOA;AACA;AACA,MAAMA,sBAAsB,GAAKC,GAAF,IAC9BC,K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,KACD,4BAAC,SAAD;AACC,MAAA,SAAS,EAAGjB,SADb;AAEC,MAAA,SAAS,EAAGiB,SAFb;AAGC,MAAA,aAAa,EAAGhB,aAHjB;AAIC,MAAA,SAAS,EAAGR,SAJb;AAKC,MAAA,QAAQ,EAAGS,QALZ;AAMC,MAAA,KAAK,EAAGC,KANT;AAOC,MAAA,OAAO,EACNc,SAAS,IACT,CAAEC,sBADF,IAEC,4BAAC,6BAAD,CAAsB,YAAtB;AACC,QAAA,OAAO,EAAGjB;AADX,SAGG,cAAI,OAAJ,CAHH,CAVH;AAiBC,MAAA,YAAY,EAAGY;AAjBhB,MAZF,CADD;AAFD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport CircularOptionPicker from '../circular-option-picker';\nimport CustomGradientPicker from '../custom-gradient-picker';\nimport { VStack } from '../v-stack';\nimport { ColorHeading } from '../color-palette/styles';\nimport { Spacer } from '../spacer';\n\n// The Multiple Origin Gradients have a `gradients` property (an array of\n// gradient objects), while Single Origin ones have a `gradient` property.\nconst isMultipleOriginObject = ( obj ) =>\n\tArray.isArray( obj.gradients ) && ! ( 'gradient' in obj );\n\nconst isMultipleOriginArray = ( arr ) => {\n\treturn (\n\t\tarr.length > 0 &&\n\t\tarr.every( ( gradientObj ) => isMultipleOriginObject( gradientObj ) )\n\t);\n};\n\nfunction SingleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n} ) {\n\tconst gradientOptions = useMemo( () => {\n\t\treturn gradients.map( ( { gradient, name }, index ) => (\n\t\t\t<CircularOptionPicker.Option\n\t\t\t\tkey={ gradient }\n\t\t\t\tvalue={ gradient }\n\t\t\t\tisSelected={ value === gradient }\n\t\t\t\ttooltipText={\n\t\t\t\t\tname ||\n\t\t\t\t\t// translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\tsprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t\tstyle={ { color: 'rgba( 0,0,0,0 )', background: gradient } }\n\t\t\t\tonClick={\n\t\t\t\t\tvalue === gradient\n\t\t\t\t\t\t? clearGradient\n\t\t\t\t\t\t: () => onChange( gradient, index )\n\t\t\t\t}\n\t\t\t\taria-label={\n\t\t\t\t\tname\n\t\t\t\t\t\t? // translators: %s: The name of the gradient e.g: \"Angular red to blue\".\n\t\t\t\t\t\t sprintf( __( 'Gradient: %s' ), name )\n\t\t\t\t\t\t: // translators: %s: gradient code e.g: \"linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);\".\n\t\t\t\t\t\t sprintf( __( 'Gradient code: %s' ), gradient )\n\t\t\t\t}\n\t\t\t/>\n\t\t) );\n\t}, [ gradients, value, onChange, clearGradient ] );\n\treturn (\n\t\t<CircularOptionPicker\n\t\t\tclassName={ className }\n\t\t\toptions={ gradientOptions }\n\t\t\tactions={ actions }\n\t\t/>\n\t);\n}\n\nfunction MultipleOrigin( {\n\tclassName,\n\tclearGradient,\n\tgradients,\n\tonChange,\n\tvalue,\n\tactions,\n\theadingLevel,\n} ) {\n\treturn (\n\t\t<VStack spacing={ 3 } className={ className }>\n\t\t\t{ gradients.map( ( { name, gradients: gradientSet }, index ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<VStack spacing={ 2 } key={ index }>\n\t\t\t\t\t\t<ColorHeading level={ headingLevel }>\n\t\t\t\t\t\t\t{ name }\n\t\t\t\t\t\t</ColorHeading>\n\t\t\t\t\t\t<SingleOrigin\n\t\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\t\tgradients={ gradientSet }\n\t\t\t\t\t\t\tonChange={ ( gradient ) =>\n\t\t\t\t\t\t\t\tonChange( gradient, index )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\t\t{ ...( gradients.length === index + 1\n\t\t\t\t\t\t\t\t? { actions }\n\t\t\t\t\t\t\t\t: {} ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</VStack>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</VStack>\n\t);\n}\n\nexport default function GradientPicker( {\n\t/** Start opting into the new margin-free styles that will become the default in a future version. */\n\t__nextHasNoMargin = false,\n\tclassName,\n\tgradients,\n\tonChange,\n\tvalue,\n\tclearable = true,\n\tdisableCustomGradients = false,\n\t__experimentalIsRenderedInSidebar,\n\theadingLevel = 2,\n} ) {\n\tconst clearGradient = useCallback(\n\t\t() => onChange( undefined ),\n\t\t[ onChange ]\n\t);\n\tconst Component = isMultipleOriginArray( gradients )\n\t\t? MultipleOrigin\n\t\t: SingleOrigin;\n\n\tif ( ! __nextHasNoMargin ) {\n\t\tdeprecated( 'Outer margin styles for wp.components.GradientPicker', {\n\t\t\tsince: '6.1',\n\t\t\tversion: '6.4',\n\t\t\thint: 'Set the `__nextHasNoMargin` prop to true to start opting into the new styles, which will become the default in a future version',\n\t\t} );\n\t}\n\n\tconst deprecatedMarginSpacerProps = ! __nextHasNoMargin\n\t\t? {\n\t\t\t\tmarginTop: ! gradients?.length ? 3 : undefined,\n\t\t\t\tmarginBottom: ! clearable ? 6 : 0,\n\t\t }\n\t\t: {};\n\n\treturn (\n\t\t// Outmost Spacer wrapper can be removed when deprecation period is over\n\t\t<Spacer marginBottom={ 0 } { ...deprecatedMarginSpacerProps }>\n\t\t\t<VStack spacing={ gradients?.length ? 4 : 0 }>\n\t\t\t\t{ ! disableCustomGradients && (\n\t\t\t\t\t<CustomGradientPicker\n\t\t\t\t\t\t__nextHasNoMargin\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={\n\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ( gradients?.length || clearable ) && (\n\t\t\t\t\t<Component\n\t\t\t\t\t\tclassName={ className }\n\t\t\t\t\t\tclearable={ clearable }\n\t\t\t\t\t\tclearGradient={ clearGradient }\n\t\t\t\t\t\tgradients={ gradients }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tactions={\n\t\t\t\t\t\t\tclearable &&\n\t\t\t\t\t\t\t! disableCustomGradients && (\n\t\t\t\t\t\t\t\t<CircularOptionPicker.ButtonAction\n\t\t\t\t\t\t\t\t\tonClick={ clearGradient }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Clear' ) }\n\t\t\t\t\t\t\t\t</CircularOptionPicker.ButtonAction>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\theadingLevel={ headingLevel }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</Spacer>\n\t);\n}\n"]}
package/build/index.js CHANGED
@@ -134,7 +134,7 @@ Object.defineProperty(exports, "CustomGradientPicker", {
134
134
  Object.defineProperty(exports, "CustomSelectControl", {
135
135
  enumerable: true,
136
136
  get: function () {
137
- return _customSelectControl.default;
137
+ return _customSelectControl.StableCustomSelectControl;
138
138
  }
139
139
  });
140
140
  Object.defineProperty(exports, "Dashicon", {
@@ -797,6 +797,12 @@ Object.defineProperty(exports, "__experimentalNavigatorScreen", {
797
797
  return _navigator.NavigatorScreen;
798
798
  }
799
799
  });
800
+ Object.defineProperty(exports, "__experimentalNavigatorToParentButton", {
801
+ enumerable: true,
802
+ get: function () {
803
+ return _navigator.NavigatorToParentButton;
804
+ }
805
+ });
800
806
  Object.defineProperty(exports, "__experimentalNumberControl", {
801
807
  enumerable: true,
802
808
  get: function () {
@@ -815,12 +821,6 @@ Object.defineProperty(exports, "__experimentalParseQuantityAndUnitFromRawValue",
815
821
  return _unitControl.parseQuantityAndUnitFromRawValue;
816
822
  }
817
823
  });
818
- Object.defineProperty(exports, "__experimentalPopoverPositionToPlacement", {
819
- enumerable: true,
820
- get: function () {
821
- return _utils.positionToPlacement;
822
- }
823
- });
824
824
  Object.defineProperty(exports, "__experimentalRadio", {
825
825
  enumerable: true,
826
826
  get: function () {
@@ -1055,6 +1055,12 @@ Object.defineProperty(exports, "navigateRegions", {
1055
1055
  return _navigateRegions.default;
1056
1056
  }
1057
1057
  });
1058
+ Object.defineProperty(exports, "privateApis", {
1059
+ enumerable: true,
1060
+ get: function () {
1061
+ return _privateApis.privateApis;
1062
+ }
1063
+ });
1058
1064
  Object.defineProperty(exports, "useBaseControlProps", {
1059
1065
  enumerable: true,
1060
1066
  get: function () {
@@ -1148,7 +1154,7 @@ var _composite = require("./composite");
1148
1154
 
1149
1155
  var _confirmDialog = require("./confirm-dialog");
1150
1156
 
1151
- var _customSelectControl = _interopRequireDefault(require("./custom-select-control"));
1157
+ var _customSelectControl = require("./custom-select-control");
1152
1158
 
1153
1159
  var _dashicon = _interopRequireDefault(require("./dashicon"));
1154
1160
 
@@ -1264,8 +1270,6 @@ var _placeholder = _interopRequireDefault(require("./placeholder"));
1264
1270
 
1265
1271
  var _popover = _interopRequireDefault(require("./popover"));
1266
1272
 
1267
- var _utils = require("./popover/utils");
1268
-
1269
1273
  var _queryControls = _interopRequireDefault(require("./query-controls"));
1270
1274
 
1271
1275
  var _radio = _interopRequireDefault(require("./radio-group/radio"));
@@ -1358,6 +1362,8 @@ var _withNotices = _interopRequireDefault(require("./higher-order/with-notices")
1358
1362
 
1359
1363
  var _withSpokenMessages = _interopRequireDefault(require("./higher-order/with-spoken-messages"));
1360
1364
 
1365
+ var _privateApis = require("./private-apis");
1366
+
1361
1367
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
1362
1368
 
1363
1369
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA","sourcesContent":["// Primitives.\nexport {\n\tSVG,\n\tPath,\n\tCircle,\n\tPolygon,\n\tRect,\n\tG,\n\tLine,\n\tHorizontalRule,\n\tBlockQuotation,\n} from '@wordpress/primitives';\n\n// Components.\nexport { default as __experimentalAlignmentMatrixControl } from './alignment-matrix-control';\nexport {\n\tdefault as Animate,\n\tgetAnimateClassName as __unstableGetAnimateClassName,\n} from './animate';\nexport { __unstableMotion, __unstableAnimatePresence } from './animation';\nexport { default as AnglePickerControl } from './angle-picker-control';\nexport {\n\tdefault as Autocomplete,\n\tuseAutocompleteProps as __unstableUseAutocompleteProps,\n} from './autocomplete';\nexport { default as BaseControl, useBaseControlProps } from './base-control';\nexport {\n\tBorderBoxControl as __experimentalBorderBoxControl,\n\thasSplitBorders as __experimentalHasSplitBorders,\n\tisDefinedBorder as __experimentalIsDefinedBorder,\n\tisEmptyBorder as __experimentalIsEmptyBorder,\n} from './border-box-control';\nexport { BorderControl as __experimentalBorderControl } from './border-control';\nexport {\n\tdefault as __experimentalBoxControl,\n\tapplyValueToSides as __experimentalApplyValueToSides,\n} from './box-control';\nexport { default as Button } from './button';\nexport { default as ButtonGroup } from './button-group';\nexport {\n\tCard,\n\tCardBody,\n\tCardDivider,\n\tCardFooter,\n\tCardHeader,\n\tCardMedia,\n} from './card';\nexport { default as CheckboxControl } from './checkbox-control';\nexport { default as ClipboardButton } from './clipboard-button';\nexport { default as __experimentalPaletteEdit } from './palette-edit';\nexport { default as ColorIndicator } from './color-indicator';\nexport { default as ColorPalette } from './color-palette';\nexport { ColorPicker } from './color-picker';\nexport { default as ComboboxControl } from './combobox-control';\nexport {\n\tComposite as __unstableComposite,\n\tCompositeGroup as __unstableCompositeGroup,\n\tCompositeItem as __unstableCompositeItem,\n\tuseCompositeState as __unstableUseCompositeState,\n} from './composite';\nexport { ConfirmDialog as __experimentalConfirmDialog } from './confirm-dialog';\nexport { default as CustomSelectControl } from './custom-select-control';\nexport { default as Dashicon } from './dashicon';\nexport { default as DateTimePicker, DatePicker, TimePicker } from './date-time';\nexport { default as __experimentalDimensionControl } from './dimension-control';\nexport { default as Disabled } from './disabled';\nexport { DisclosureContent as __unstableDisclosureContent } from './disclosure';\nexport { Divider as __experimentalDivider } from './divider';\nexport { default as Draggable } from './draggable';\nexport { default as DropZone } from './drop-zone';\nexport { default as DropZoneProvider } from './drop-zone/provider';\nexport { default as Dropdown } from './dropdown';\nexport { default as __experimentalDropdownContentWrapper } from './dropdown/dropdown-content-wrapper';\nexport { default as DropdownMenu } from './dropdown-menu';\nexport { DuotoneSwatch, DuotonePicker } from './duotone-picker';\nexport { Elevation as __experimentalElevation } from './elevation';\nexport { default as ExternalLink } from './external-link';\nexport { Flex, FlexBlock, FlexItem } from './flex';\nexport { default as FocalPointPicker } from './focal-point-picker';\nexport { default as FocusableIframe } from './focusable-iframe';\nexport { default as FontSizePicker } from './font-size-picker';\nexport { default as FormFileUpload } from './form-file-upload';\nexport { default as FormToggle } from './form-toggle';\nexport { default as FormTokenField } from './form-token-field';\nexport { default as GradientPicker } from './gradient-picker';\nexport { default as CustomGradientPicker } from './custom-gradient-picker';\nexport { Grid as __experimentalGrid } from './grid';\nexport { default as Guide } from './guide';\nexport { default as GuidePage } from './guide/page';\nexport { Heading as __experimentalHeading } from './heading';\nexport { HStack as __experimentalHStack } from './h-stack';\nexport { default as Icon } from './icon';\nexport { default as IconButton } from './button/deprecated';\nexport {\n\tItemGroup as __experimentalItemGroup,\n\tItem as __experimentalItem,\n} from './item-group';\nexport { default as __experimentalInputControl } from './input-control';\nexport { default as __experimentalInputControlPrefixWrapper } from './input-control/input-prefix-wrapper';\nexport { default as __experimentalInputControlSuffixWrapper } from './input-control/input-suffix-wrapper';\nexport { default as KeyboardShortcuts } from './keyboard-shortcuts';\nexport { default as MenuGroup } from './menu-group';\nexport { default as MenuItem } from './menu-item';\nexport { default as MenuItemsChoice } from './menu-items-choice';\nexport { default as Modal } from './modal';\nexport { default as ScrollLock } from './scroll-lock';\nexport { NavigableMenu, TabbableContainer } from './navigable-container';\nexport { default as __experimentalNavigation } from './navigation';\nexport { default as __experimentalNavigationBackButton } from './navigation/back-button';\nexport { default as __experimentalNavigationGroup } from './navigation/group';\nexport { default as __experimentalNavigationItem } from './navigation/item';\nexport { default as __experimentalNavigationMenu } from './navigation/menu';\nexport {\n\tNavigatorProvider as __experimentalNavigatorProvider,\n\tNavigatorScreen as __experimentalNavigatorScreen,\n\tNavigatorButton as __experimentalNavigatorButton,\n\tNavigatorBackButton as __experimentalNavigatorBackButton,\n\tuseNavigator as __experimentalUseNavigator,\n} from './navigator';\nexport { default as Notice } from './notice';\nexport { default as __experimentalNumberControl } from './number-control';\nexport { default as NoticeList } from './notice/list';\nexport { default as Panel } from './panel';\nexport { default as PanelBody } from './panel/body';\nexport { default as PanelHeader } from './panel/header';\nexport { default as PanelRow } from './panel/row';\nexport { default as Placeholder } from './placeholder';\nexport { default as Popover } from './popover';\nexport { positionToPlacement as __experimentalPopoverPositionToPlacement } from './popover/utils';\nexport { default as QueryControls } from './query-controls';\nexport { default as __experimentalRadio } from './radio-group/radio';\nexport { default as __experimentalRadioGroup } from './radio-group';\nexport { default as RadioControl } from './radio-control';\nexport { default as RangeControl } from './range-control';\nexport { default as ResizableBox } from './resizable-box';\nexport { default as ResponsiveWrapper } from './responsive-wrapper';\nexport { default as SandBox } from './sandbox';\nexport { default as SearchControl } from './search-control';\nexport { default as SelectControl } from './select-control';\nexport { default as Snackbar } from './snackbar';\nexport { default as SnackbarList } from './snackbar/list';\nexport { Spacer as __experimentalSpacer } from './spacer';\nexport { Scrollable as __experimentalScrollable } from './scrollable';\nexport { default as Spinner } from './spinner';\nexport { Surface as __experimentalSurface } from './surface';\nexport { default as TabPanel } from './tab-panel';\nexport { Text as __experimentalText } from './text';\nexport { default as TextControl } from './text-control';\nexport { default as TextareaControl } from './textarea-control';\nexport { default as TextHighlight } from './text-highlight';\nexport { default as Tip } from './tip';\nexport { default as ToggleControl } from './toggle-control';\nexport {\n\tToggleGroupControl as __experimentalToggleGroupControl,\n\tToggleGroupControlOption as __experimentalToggleGroupControlOption,\n\tToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,\n} from './toggle-group-control';\nexport {\n\tToolbar,\n\tToolbarButton,\n\tToolbarContext as __experimentalToolbarContext,\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tToolbarItem,\n} from './toolbar';\nexport {\n\tToolsPanel as __experimentalToolsPanel,\n\tToolsPanelItem as __experimentalToolsPanelItem,\n\tToolsPanelContext as __experimentalToolsPanelContext,\n} from './tools-panel';\nexport { default as Tooltip } from './tooltip';\nexport {\n\tdefault as __experimentalTreeGrid,\n\tTreeGridRow as __experimentalTreeGridRow,\n\tTreeGridCell as __experimentalTreeGridCell,\n\tTreeGridItem as __experimentalTreeGridItem,\n} from './tree-grid';\nexport { default as TreeSelect } from './tree-select';\nexport { Truncate as __experimentalTruncate } from './truncate';\nexport {\n\tdefault as __experimentalUnitControl,\n\tuseCustomUnits as __experimentalUseCustomUnits,\n\tparseQuantityAndUnitFromRawValue as __experimentalParseQuantityAndUnitFromRawValue,\n} from './unit-control';\nexport { View as __experimentalView } from './view';\nexport { VisuallyHidden } from './visually-hidden';\nexport { VStack as __experimentalVStack } from './v-stack';\nexport { default as IsolatedEventContainer } from './isolated-event-container';\nexport {\n\tcreateSlotFill,\n\tSlot,\n\tFill,\n\tProvider as SlotFillProvider,\n\tuseSlot as __experimentalUseSlot,\n\tuseSlotFills as __experimentalUseSlotFills,\n} from './slot-fill';\nexport { default as __experimentalStyleProvider } from './style-provider';\nexport { ZStack as __experimentalZStack } from './z-stack';\n\n// Higher-Order Components.\nexport {\n\tdefault as navigateRegions,\n\tuseNavigateRegions as __unstableUseNavigateRegions,\n} from './higher-order/navigate-regions';\nexport { default as withConstrainedTabbing } from './higher-order/with-constrained-tabbing';\nexport { default as withFallbackStyles } from './higher-order/with-fallback-styles';\nexport { default as withFilters } from './higher-order/with-filters';\nexport { default as withFocusOutside } from './higher-order/with-focus-outside';\nexport {\n\tdefault as withFocusReturn,\n\tProvider as FocusReturnProvider,\n} from './higher-order/with-focus-return';\nexport { default as withNotices } from './higher-order/with-notices';\nexport { default as withSpokenMessages } from './higher-order/with-spoken-messages';\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAaA;;AACA;;AAIA;;AACA;;AACA;;AAIA;;AACA;;AAMA;;AACA;;AAIA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAQA;;AAKA;;AACA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAQA;;AACA;;AAGA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AAGA","sourcesContent":["// Primitives.\nexport {\n\tSVG,\n\tPath,\n\tCircle,\n\tPolygon,\n\tRect,\n\tG,\n\tLine,\n\tHorizontalRule,\n\tBlockQuotation,\n} from '@wordpress/primitives';\n\n// Components.\nexport { default as __experimentalAlignmentMatrixControl } from './alignment-matrix-control';\nexport {\n\tdefault as Animate,\n\tgetAnimateClassName as __unstableGetAnimateClassName,\n} from './animate';\nexport { __unstableMotion, __unstableAnimatePresence } from './animation';\nexport { default as AnglePickerControl } from './angle-picker-control';\nexport {\n\tdefault as Autocomplete,\n\tuseAutocompleteProps as __unstableUseAutocompleteProps,\n} from './autocomplete';\nexport { default as BaseControl, useBaseControlProps } from './base-control';\nexport {\n\tBorderBoxControl as __experimentalBorderBoxControl,\n\thasSplitBorders as __experimentalHasSplitBorders,\n\tisDefinedBorder as __experimentalIsDefinedBorder,\n\tisEmptyBorder as __experimentalIsEmptyBorder,\n} from './border-box-control';\nexport { BorderControl as __experimentalBorderControl } from './border-control';\nexport {\n\tdefault as __experimentalBoxControl,\n\tapplyValueToSides as __experimentalApplyValueToSides,\n} from './box-control';\nexport { default as Button } from './button';\nexport { default as ButtonGroup } from './button-group';\nexport {\n\tCard,\n\tCardBody,\n\tCardDivider,\n\tCardFooter,\n\tCardHeader,\n\tCardMedia,\n} from './card';\nexport { default as CheckboxControl } from './checkbox-control';\nexport { default as ClipboardButton } from './clipboard-button';\nexport { default as __experimentalPaletteEdit } from './palette-edit';\nexport { default as ColorIndicator } from './color-indicator';\nexport { default as ColorPalette } from './color-palette';\nexport { ColorPicker } from './color-picker';\nexport { default as ComboboxControl } from './combobox-control';\nexport {\n\tComposite as __unstableComposite,\n\tCompositeGroup as __unstableCompositeGroup,\n\tCompositeItem as __unstableCompositeItem,\n\tuseCompositeState as __unstableUseCompositeState,\n} from './composite';\nexport { ConfirmDialog as __experimentalConfirmDialog } from './confirm-dialog';\nexport { StableCustomSelectControl as CustomSelectControl } from './custom-select-control';\nexport { default as Dashicon } from './dashicon';\nexport { default as DateTimePicker, DatePicker, TimePicker } from './date-time';\nexport { default as __experimentalDimensionControl } from './dimension-control';\nexport { default as Disabled } from './disabled';\nexport { DisclosureContent as __unstableDisclosureContent } from './disclosure';\nexport { Divider as __experimentalDivider } from './divider';\nexport { default as Draggable } from './draggable';\nexport { default as DropZone } from './drop-zone';\nexport { default as DropZoneProvider } from './drop-zone/provider';\nexport { default as Dropdown } from './dropdown';\nexport { default as __experimentalDropdownContentWrapper } from './dropdown/dropdown-content-wrapper';\nexport { default as DropdownMenu } from './dropdown-menu';\nexport { DuotoneSwatch, DuotonePicker } from './duotone-picker';\nexport { Elevation as __experimentalElevation } from './elevation';\nexport { default as ExternalLink } from './external-link';\nexport { Flex, FlexBlock, FlexItem } from './flex';\nexport { default as FocalPointPicker } from './focal-point-picker';\nexport { default as FocusableIframe } from './focusable-iframe';\nexport { default as FontSizePicker } from './font-size-picker';\nexport { default as FormFileUpload } from './form-file-upload';\nexport { default as FormToggle } from './form-toggle';\nexport { default as FormTokenField } from './form-token-field';\nexport { default as GradientPicker } from './gradient-picker';\nexport { default as CustomGradientPicker } from './custom-gradient-picker';\nexport { Grid as __experimentalGrid } from './grid';\nexport { default as Guide } from './guide';\nexport { default as GuidePage } from './guide/page';\nexport { Heading as __experimentalHeading } from './heading';\nexport { HStack as __experimentalHStack } from './h-stack';\nexport { default as Icon } from './icon';\nexport { default as IconButton } from './button/deprecated';\nexport {\n\tItemGroup as __experimentalItemGroup,\n\tItem as __experimentalItem,\n} from './item-group';\nexport { default as __experimentalInputControl } from './input-control';\nexport { default as __experimentalInputControlPrefixWrapper } from './input-control/input-prefix-wrapper';\nexport { default as __experimentalInputControlSuffixWrapper } from './input-control/input-suffix-wrapper';\nexport { default as KeyboardShortcuts } from './keyboard-shortcuts';\nexport { default as MenuGroup } from './menu-group';\nexport { default as MenuItem } from './menu-item';\nexport { default as MenuItemsChoice } from './menu-items-choice';\nexport { default as Modal } from './modal';\nexport { default as ScrollLock } from './scroll-lock';\nexport { NavigableMenu, TabbableContainer } from './navigable-container';\nexport { default as __experimentalNavigation } from './navigation';\nexport { default as __experimentalNavigationBackButton } from './navigation/back-button';\nexport { default as __experimentalNavigationGroup } from './navigation/group';\nexport { default as __experimentalNavigationItem } from './navigation/item';\nexport { default as __experimentalNavigationMenu } from './navigation/menu';\nexport {\n\tNavigatorProvider as __experimentalNavigatorProvider,\n\tNavigatorScreen as __experimentalNavigatorScreen,\n\tNavigatorButton as __experimentalNavigatorButton,\n\tNavigatorBackButton as __experimentalNavigatorBackButton,\n\tNavigatorToParentButton as __experimentalNavigatorToParentButton,\n\tuseNavigator as __experimentalUseNavigator,\n} from './navigator';\nexport { default as Notice } from './notice';\nexport { default as __experimentalNumberControl } from './number-control';\nexport { default as NoticeList } from './notice/list';\nexport { default as Panel } from './panel';\nexport { default as PanelBody } from './panel/body';\nexport { default as PanelHeader } from './panel/header';\nexport { default as PanelRow } from './panel/row';\nexport { default as Placeholder } from './placeholder';\nexport { default as Popover } from './popover';\nexport { default as QueryControls } from './query-controls';\nexport { default as __experimentalRadio } from './radio-group/radio';\nexport { default as __experimentalRadioGroup } from './radio-group';\nexport { default as RadioControl } from './radio-control';\nexport { default as RangeControl } from './range-control';\nexport { default as ResizableBox } from './resizable-box';\nexport { default as ResponsiveWrapper } from './responsive-wrapper';\nexport { default as SandBox } from './sandbox';\nexport { default as SearchControl } from './search-control';\nexport { default as SelectControl } from './select-control';\nexport { default as Snackbar } from './snackbar';\nexport { default as SnackbarList } from './snackbar/list';\nexport { Spacer as __experimentalSpacer } from './spacer';\nexport { Scrollable as __experimentalScrollable } from './scrollable';\nexport { default as Spinner } from './spinner';\nexport { Surface as __experimentalSurface } from './surface';\nexport { default as TabPanel } from './tab-panel';\nexport { Text as __experimentalText } from './text';\nexport { default as TextControl } from './text-control';\nexport { default as TextareaControl } from './textarea-control';\nexport { default as TextHighlight } from './text-highlight';\nexport { default as Tip } from './tip';\nexport { default as ToggleControl } from './toggle-control';\nexport {\n\tToggleGroupControl as __experimentalToggleGroupControl,\n\tToggleGroupControlOption as __experimentalToggleGroupControlOption,\n\tToggleGroupControlOptionIcon as __experimentalToggleGroupControlOptionIcon,\n} from './toggle-group-control';\nexport {\n\tToolbar,\n\tToolbarButton,\n\tToolbarContext as __experimentalToolbarContext,\n\tToolbarDropdownMenu,\n\tToolbarGroup,\n\tToolbarItem,\n} from './toolbar';\nexport {\n\tToolsPanel as __experimentalToolsPanel,\n\tToolsPanelItem as __experimentalToolsPanelItem,\n\tToolsPanelContext as __experimentalToolsPanelContext,\n} from './tools-panel';\nexport { default as Tooltip } from './tooltip';\nexport {\n\tdefault as __experimentalTreeGrid,\n\tTreeGridRow as __experimentalTreeGridRow,\n\tTreeGridCell as __experimentalTreeGridCell,\n\tTreeGridItem as __experimentalTreeGridItem,\n} from './tree-grid';\nexport { default as TreeSelect } from './tree-select';\nexport { Truncate as __experimentalTruncate } from './truncate';\nexport {\n\tdefault as __experimentalUnitControl,\n\tuseCustomUnits as __experimentalUseCustomUnits,\n\tparseQuantityAndUnitFromRawValue as __experimentalParseQuantityAndUnitFromRawValue,\n} from './unit-control';\nexport { View as __experimentalView } from './view';\nexport { VisuallyHidden } from './visually-hidden';\nexport { VStack as __experimentalVStack } from './v-stack';\nexport { default as IsolatedEventContainer } from './isolated-event-container';\nexport {\n\tcreateSlotFill,\n\tSlot,\n\tFill,\n\tProvider as SlotFillProvider,\n\tuseSlot as __experimentalUseSlot,\n\tuseSlotFills as __experimentalUseSlotFills,\n} from './slot-fill';\nexport { default as __experimentalStyleProvider } from './style-provider';\nexport { ZStack as __experimentalZStack } from './z-stack';\n\n// Higher-Order Components.\nexport {\n\tdefault as navigateRegions,\n\tuseNavigateRegions as __unstableUseNavigateRegions,\n} from './higher-order/navigate-regions';\nexport { default as withConstrainedTabbing } from './higher-order/with-constrained-tabbing';\nexport { default as withFallbackStyles } from './higher-order/with-fallback-styles';\nexport { default as withFilters } from './higher-order/with-filters';\nexport { default as withFocusOutside } from './higher-order/with-focus-outside';\nexport {\n\tdefault as withFocusReturn,\n\tProvider as FocusReturnProvider,\n} from './higher-order/with-focus-return';\nexport { default as withNotices } from './higher-order/with-notices';\nexport { default as withSpokenMessages } from './higher-order/with-spoken-messages';\n\n// Private APIs.\nexport { privateApis } from './private-apis';\n"]}
@@ -30,7 +30,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
30
30
  /**
31
31
  * Prepares initialState for the reducer.
32
32
  *
33
- * @param initialState The initial state.
33
+ * @param initialState The initial state.
34
34
  * @return Prepared initialState for the reducer
35
35
  */
36
36
  function mergeInitialState() {
@@ -50,7 +50,7 @@ function mergeInitialState() {
50
50
  * exception for CONTROL actions is because they represent controlled updates
51
51
  * from props and no case has yet presented for their specialization.
52
52
  *
53
- * @param composedStateReducers A reducer to specialize state changes.
53
+ * @param composedStateReducers A reducer to specialize state changes.
54
54
  * @return The reducer.
55
55
  */
56
56
 
@@ -149,9 +149,9 @@ function inputControlStateReducer(composedStateReducers) {
149
149
  * This technique uses the "stateReducer" design pattern:
150
150
  * https://kentcdodds.com/blog/the-state-reducer-pattern/
151
151
  *
152
- * @param stateReducer An external state reducer.
153
- * @param initialState The initial state for the reducer.
154
- * @param onChangeHandler A handler for the onChange event.
152
+ * @param stateReducer An external state reducer.
153
+ * @param initialState The initial state for the reducer.
154
+ * @param onChangeHandler A handler for the onChange event.
155
155
  * @return State, dispatch, and a collection of actions.
156
156
  */
157
157
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/input-control/reducer/reducer.ts"],"names":["mergeInitialState","initialState","initialInputControlState","value","initialValue","inputControlStateReducer","composedStateReducers","state","action","nextState","type","actions","CONTROL","payload","isDirty","_event","undefined","PRESS_UP","PRESS_DOWN","DRAG_START","isDragging","DRAG_END","CHANGE","error","isPressEnterToChange","COMMIT","RESET","INVALIDATE","event","useInputControlStateReducer","stateReducer","initialStateReducer","onChangeHandler","dispatch","createChangeEvent","nextValue","createKeyEvent","createDragEvent","change","invalidate","reset","commit","dragStart","drag","DRAG","dragEnd","pressUp","pressDown","pressEnter","PRESS_ENTER","currentState","refProps","current"],"mappings":";;;;;;;AAQA;;AAKA;;AAMA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,GAEc;AAAA,MADbC,YACa,uEADyBC,+BACzB;AACb,QAAM;AAAEC,IAAAA;AAAF,MAAYF,YAAlB;AAEA,SAAO,EACN,GAAGC,+BADG;AAEN,OAAGD,YAFG;AAGNG,IAAAA,YAAY,EAAED;AAHR,GAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,wBAAT,CACCC,qBADD,EAEyC;AACxC,SAAO,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAC3B,UAAMC,SAAS,GAAG,EAAE,GAAGF;AAAL,KAAlB;;AAEA,YAASC,MAAM,CAACE,IAAhB;AACC;AACH;AACA;AACG,WAAKC,OAAO,CAACC,OAAb;AACCH,QAAAA,SAAS,CAACN,KAAV,GAAkBK,MAAM,CAACK,OAAP,CAAeV,KAAjC;AACAM,QAAAA,SAAS,CAACK,OAAV,GAAoB,KAApB;AACAL,QAAAA,SAAS,CAACM,MAAV,GAAmBC,SAAnB,CAHD,CAIC;;AACA,eAAOP,SAAP;;AAED;AACH;AACA;;AACG,WAAKE,OAAO,CAACM,QAAb;AACCR,QAAAA,SAAS,CAACK,OAAV,GAAoB,KAApB;AACA;;AAED,WAAKH,OAAO,CAACO,UAAb;AACCT,QAAAA,SAAS,CAACK,OAAV,GAAoB,KAApB;AACA;;AAED;AACH;AACA;;AACG,WAAKH,OAAO,CAACQ,UAAb;AACCV,QAAAA,SAAS,CAACW,UAAV,GAAuB,IAAvB;AACA;;AAED,WAAKT,OAAO,CAACU,QAAb;AACCZ,QAAAA,SAAS,CAACW,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AAqBtC,OAFxB,EAGE;AAAA;;AACDmB,MAAAA,QAAQ,CAAE;AACTvB,QAAAA,IAAI,EAAEC,OAAO,CAACC,OADL;AAETC,QAAAA,OAAO,EAAE;AAAEV,UAAAA,KAAK,yBAAEF,YAAY,CAACE,KAAf,qEAAwB;AAA/B;AAFA,OAAF,CAAR;AAIA;AACD,GAVD,EAUG,CAAEF,YAAY,CAACE,KAAf,CAVH;AAYA,SAAO;AACNmC,IAAAA,MADM;AAENG,IAAAA,MAFM;AAGNR,IAAAA,QAHM;AAINU,IAAAA,IAJM;AAKNE,IAAAA,OALM;AAMNH,IAAAA,SANM;AAONH,IAAAA,UAPM;AAQNQ,IAAAA,SARM;AASNC,IAAAA,UATM;AAUNF,IAAAA,OAVM;AAWNN,IAAAA,KAXM;AAYNjC,IAAAA;AAZM,GAAP;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport type { SyntheticEvent, ChangeEvent, PointerEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useReducer, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInputState,\n\tStateReducer,\n\tinitialInputControlState,\n\tinitialStateReducer,\n} from './state';\nimport * as actions from './actions';\nimport type { InputChangeCallback } from '../types';\n\n/**\n * Prepares initialState for the reducer.\n *\n * @param initialState The initial state.\n * @return Prepared initialState for the reducer\n */\nfunction mergeInitialState(\n\tinitialState: Partial< InputState > = initialInputControlState\n): InputState {\n\tconst { value } = initialState;\n\n\treturn {\n\t\t...initialInputControlState,\n\t\t...initialState,\n\t\tinitialValue: value,\n\t} as InputState;\n}\n\n/**\n * Creates the base reducer which may be coupled to a specializing reducer.\n * As its final step, for all actions other than CONTROL, the base reducer\n * passes the state and action on through the specializing reducer. The\n * exception for CONTROL actions is because they represent controlled updates\n * from props and no case has yet presented for their specialization.\n *\n * @param composedStateReducers A reducer to specialize state changes.\n * @return The reducer.\n */\nfunction inputControlStateReducer(\n\tcomposedStateReducers: StateReducer\n): StateReducer< actions.ControlAction > {\n\treturn ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\tswitch ( action.type ) {\n\t\t\t/*\n\t\t\t * Controlled updates\n\t\t\t */\n\t\t\tcase actions.CONTROL:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState._event = undefined;\n\t\t\t\t// Returns immediately to avoid invoking additional reducers.\n\t\t\t\treturn nextState;\n\n\t\t\t/**\n\t\t\t * Keyboard events\n\t\t\t */\n\t\t\tcase actions.PRESS_UP:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.PRESS_DOWN:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Drag events\n\t\t\t */\n\t\t\tcase actions.DRAG_START:\n\t\t\t\tnextState.isDragging = true;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.DRAG_END:\n\t\t\t\tnextState.isDragging = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Input events\n\t\t\t */\n\t\t\tcase actions.CHANGE:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.value = action.payload.value;\n\n\t\t\t\tif ( state.isPressEnterToChange ) {\n\t\t\t\t\tnextState.isDirty = true;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase actions.COMMIT:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.RESET:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState.value = action.payload.value || state.initialValue;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Validation\n\t\t\t */\n\t\t\tcase actions.INVALIDATE:\n\t\t\t\tnextState.error = action.payload.error;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tnextState._event = action.payload.event;\n\n\t\t/**\n\t\t * Send the nextState + action to the composedReducers via\n\t\t * this \"bridge\" mechanism. This allows external stateReducers\n\t\t * to hook into actions, and modify state if needed.\n\t\t */\n\t\treturn composedStateReducers( nextState, action );\n\t};\n}\n\n/**\n * A custom hook that connects and external stateReducer with an internal\n * reducer. This hook manages the internal state of InputControl.\n * However, by connecting an external stateReducer function, other\n * components can react to actions as well as modify state before it is\n * applied.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param stateReducer An external state reducer.\n * @param initialState The initial state for the reducer.\n * @param onChangeHandler A handler for the onChange event.\n * @return State, dispatch, and a collection of actions.\n */\nexport function useInputControlStateReducer(\n\tstateReducer: StateReducer = initialStateReducer,\n\tinitialState: Partial< InputState > = initialInputControlState,\n\tonChangeHandler: InputChangeCallback\n) {\n\tconst [ state, dispatch ] = useReducer(\n\t\tinputControlStateReducer( stateReducer ),\n\t\tmergeInitialState( initialState )\n\t);\n\n\tconst createChangeEvent =\n\t\t( type: actions.ChangeEventAction[ 'type' ] ) =>\n\t\t(\n\t\t\tnextValue: actions.ChangeEventAction[ 'payload' ][ 'value' ],\n\t\t\tevent: actions.ChangeEventAction[ 'payload' ][ 'event' ]\n\t\t) => {\n\t\t\tdispatch( {\n\t\t\t\ttype,\n\t\t\t\tpayload: { value: nextValue, event },\n\t\t\t} as actions.InputAction );\n\t\t};\n\n\tconst createKeyEvent =\n\t\t( type: actions.KeyEventAction[ 'type' ] ) =>\n\t\t( event: actions.KeyEventAction[ 'payload' ][ 'event' ] ) => {\n\t\t\tdispatch( { type, payload: { event } } );\n\t\t};\n\n\tconst createDragEvent =\n\t\t( type: actions.DragEventAction[ 'type' ] ) =>\n\t\t( payload: actions.DragEventAction[ 'payload' ] ) => {\n\t\t\tdispatch( { type, payload } );\n\t\t};\n\n\t/**\n\t * Actions for the reducer\n\t */\n\tconst change = createChangeEvent( actions.CHANGE );\n\tconst invalidate = ( error: unknown, event: SyntheticEvent ) =>\n\t\tdispatch( { type: actions.INVALIDATE, payload: { error, event } } );\n\tconst reset = createChangeEvent( actions.RESET );\n\tconst commit = createChangeEvent( actions.COMMIT );\n\n\tconst dragStart = createDragEvent( actions.DRAG_START );\n\tconst drag = createDragEvent( actions.DRAG );\n\tconst dragEnd = createDragEvent( actions.DRAG_END );\n\n\tconst pressUp = createKeyEvent( actions.PRESS_UP );\n\tconst pressDown = createKeyEvent( actions.PRESS_DOWN );\n\tconst pressEnter = createKeyEvent( actions.PRESS_ENTER );\n\n\tconst currentState = useRef( state );\n\tconst refProps = useRef( { value: initialState.value, onChangeHandler } );\n\n\t// Freshens refs to props and state so that subsequent effects have access\n\t// to their latest values without their changes causing effect runs.\n\tuseLayoutEffect( () => {\n\t\tcurrentState.current = state;\n\t\trefProps.current = { value: initialState.value, onChangeHandler };\n\t} );\n\n\t// Propagates the latest state through onChange.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tcurrentState.current._event !== undefined &&\n\t\t\tstate.value !== refProps.current.value &&\n\t\t\t! state.isDirty\n\t\t) {\n\t\t\trefProps.current.onChangeHandler( state.value ?? '', {\n\t\t\t\tevent: currentState.current._event as\n\t\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t\t| PointerEvent< HTMLInputElement >,\n\t\t\t} );\n\t\t}\n\t}, [ state.value, state.isDirty ] );\n\n\t// Updates the state from props.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tinitialState.value !== currentState.current.value &&\n\t\t\t! currentState.current.isDirty\n\t\t) {\n\t\t\tdispatch( {\n\t\t\t\ttype: actions.CONTROL,\n\t\t\t\tpayload: { value: initialState.value ?? '' },\n\t\t\t} );\n\t\t}\n\t}, [ initialState.value ] );\n\n\treturn {\n\t\tchange,\n\t\tcommit,\n\t\tdispatch,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t\tstate,\n\t} as const;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/input-control/reducer/reducer.ts"],"names":["mergeInitialState","initialState","initialInputControlState","value","initialValue","inputControlStateReducer","composedStateReducers","state","action","nextState","type","actions","CONTROL","payload","isDirty","_event","undefined","PRESS_UP","PRESS_DOWN","DRAG_START","isDragging","DRAG_END","CHANGE","error","isPressEnterToChange","COMMIT","RESET","INVALIDATE","event","useInputControlStateReducer","stateReducer","initialStateReducer","onChangeHandler","dispatch","createChangeEvent","nextValue","createKeyEvent","createDragEvent","change","invalidate","reset","commit","dragStart","drag","DRAG","dragEnd","pressUp","pressDown","pressEnter","PRESS_ENTER","currentState","refProps","current"],"mappings":";;;;;;;AAQA;;AAKA;;AAMA;;;;;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,iBAAT,GAEc;AAAA,MADbC,YACa,uEADyBC,+BACzB;AACb,QAAM;AAAEC,IAAAA;AAAF,MAAYF,YAAlB;AAEA,SAAO,EACN,GAAGC,+BADG;AAEN,OAAGD,YAFG;AAGNG,IAAAA,YAAY,EAAED;AAHR,GAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,wBAAT,CACCC,qBADD,EAEyC;AACxC,SAAO,CAAEC,KAAF,EAASC,MAAT,KAAqB;AAC3B,UAAMC,SAAS,GAAG,EAAE,GAAGF;AAAL,KAAlB;;AAEA,YAASC,MAAM,CAACE,IAAhB;AACC;AACH;AACA;AACG,WAAKC,OAAO,CAACC,OAAb;AACCH,QAAAA,SAAS,CAACN,KAAV,GAAkBK,MAAM,CAACK,OAAP,CAAeV,KAAjC;AACAM,QAAAA,SAAS,CAACK,OAAV,GAAoB,KAApB;AACAL,QAAAA,SAAS,CAACM,MAAV,GAAmBC,SAAnB,CAHD,CAIC;;AACA,eAAOP,SAAP;;AAED;AACH;AACA;;AACG,WAAKE,OAAO,CAACM,QAAb;AACCR,Q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AAA,KAAK,EAAEsB,YAAY,CAACE,OAAb,CAAqBrC;AADwB,OAArD;AAKA;AACD,GAZD,EAYG,CAAER,KAAK,CAACJ,KAAR,EAAeI,KAAK,CAACO,OAArB,CAZH,EA1DC,CAwED;;AACA,gCAAiB,MAAM;AACtB,QACCb,YAAY,CAACE,KAAb,KAAuB+C,YAAY,CAACE,OAAb,CAAqBjD,KAA5C,IACA,CAAE+C,YAAY,CAACE,OAAb,CAAqBtC,OAFxB,EAGE;AAAA;;AACDmB,MAAAA,QAAQ,CAAE;AACTvB,QAAAA,IAAI,EAAEC,OAAO,CAACC,OADL;AAETC,QAAAA,OAAO,EAAE;AAAEV,UAAAA,KAAK,yBAAEF,YAAY,CAACE,KAAf,qEAAwB;AAA/B;AAFA,OAAF,CAAR;AAIA;AACD,GAVD,EAUG,CAAEF,YAAY,CAACE,KAAf,CAVH;AAYA,SAAO;AACNmC,IAAAA,MADM;AAENG,IAAAA,MAFM;AAGNR,IAAAA,QAHM;AAINU,IAAAA,IAJM;AAKNE,IAAAA,OALM;AAMNH,IAAAA,SANM;AAONH,IAAAA,UAPM;AAQNQ,IAAAA,SARM;AASNC,IAAAA,UATM;AAUNF,IAAAA,OAVM;AAWNN,IAAAA,KAXM;AAYNjC,IAAAA;AAZM,GAAP;AAcA","sourcesContent":["/**\n * External dependencies\n */\nimport type { SyntheticEvent, ChangeEvent, PointerEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { useReducer, useLayoutEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tInputState,\n\tStateReducer,\n\tinitialInputControlState,\n\tinitialStateReducer,\n} from './state';\nimport * as actions from './actions';\nimport type { InputChangeCallback } from '../types';\n\n/**\n * Prepares initialState for the reducer.\n *\n * @param initialState The initial state.\n * @return Prepared initialState for the reducer\n */\nfunction mergeInitialState(\n\tinitialState: Partial< InputState > = initialInputControlState\n): InputState {\n\tconst { value } = initialState;\n\n\treturn {\n\t\t...initialInputControlState,\n\t\t...initialState,\n\t\tinitialValue: value,\n\t} as InputState;\n}\n\n/**\n * Creates the base reducer which may be coupled to a specializing reducer.\n * As its final step, for all actions other than CONTROL, the base reducer\n * passes the state and action on through the specializing reducer. The\n * exception for CONTROL actions is because they represent controlled updates\n * from props and no case has yet presented for their specialization.\n *\n * @param composedStateReducers A reducer to specialize state changes.\n * @return The reducer.\n */\nfunction inputControlStateReducer(\n\tcomposedStateReducers: StateReducer\n): StateReducer< actions.ControlAction > {\n\treturn ( state, action ) => {\n\t\tconst nextState = { ...state };\n\n\t\tswitch ( action.type ) {\n\t\t\t/*\n\t\t\t * Controlled updates\n\t\t\t */\n\t\t\tcase actions.CONTROL:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState._event = undefined;\n\t\t\t\t// Returns immediately to avoid invoking additional reducers.\n\t\t\t\treturn nextState;\n\n\t\t\t/**\n\t\t\t * Keyboard events\n\t\t\t */\n\t\t\tcase actions.PRESS_UP:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.PRESS_DOWN:\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Drag events\n\t\t\t */\n\t\t\tcase actions.DRAG_START:\n\t\t\t\tnextState.isDragging = true;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.DRAG_END:\n\t\t\t\tnextState.isDragging = false;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Input events\n\t\t\t */\n\t\t\tcase actions.CHANGE:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.value = action.payload.value;\n\n\t\t\t\tif ( state.isPressEnterToChange ) {\n\t\t\t\t\tnextState.isDirty = true;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase actions.COMMIT:\n\t\t\t\tnextState.value = action.payload.value;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tbreak;\n\n\t\t\tcase actions.RESET:\n\t\t\t\tnextState.error = null;\n\t\t\t\tnextState.isDirty = false;\n\t\t\t\tnextState.value = action.payload.value || state.initialValue;\n\t\t\t\tbreak;\n\n\t\t\t/**\n\t\t\t * Validation\n\t\t\t */\n\t\t\tcase actions.INVALIDATE:\n\t\t\t\tnextState.error = action.payload.error;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tnextState._event = action.payload.event;\n\n\t\t/**\n\t\t * Send the nextState + action to the composedReducers via\n\t\t * this \"bridge\" mechanism. This allows external stateReducers\n\t\t * to hook into actions, and modify state if needed.\n\t\t */\n\t\treturn composedStateReducers( nextState, action );\n\t};\n}\n\n/**\n * A custom hook that connects and external stateReducer with an internal\n * reducer. This hook manages the internal state of InputControl.\n * However, by connecting an external stateReducer function, other\n * components can react to actions as well as modify state before it is\n * applied.\n *\n * This technique uses the \"stateReducer\" design pattern:\n * https://kentcdodds.com/blog/the-state-reducer-pattern/\n *\n * @param stateReducer An external state reducer.\n * @param initialState The initial state for the reducer.\n * @param onChangeHandler A handler for the onChange event.\n * @return State, dispatch, and a collection of actions.\n */\nexport function useInputControlStateReducer(\n\tstateReducer: StateReducer = initialStateReducer,\n\tinitialState: Partial< InputState > = initialInputControlState,\n\tonChangeHandler: InputChangeCallback\n) {\n\tconst [ state, dispatch ] = useReducer(\n\t\tinputControlStateReducer( stateReducer ),\n\t\tmergeInitialState( initialState )\n\t);\n\n\tconst createChangeEvent =\n\t\t( type: actions.ChangeEventAction[ 'type' ] ) =>\n\t\t(\n\t\t\tnextValue: actions.ChangeEventAction[ 'payload' ][ 'value' ],\n\t\t\tevent: actions.ChangeEventAction[ 'payload' ][ 'event' ]\n\t\t) => {\n\t\t\tdispatch( {\n\t\t\t\ttype,\n\t\t\t\tpayload: { value: nextValue, event },\n\t\t\t} as actions.InputAction );\n\t\t};\n\n\tconst createKeyEvent =\n\t\t( type: actions.KeyEventAction[ 'type' ] ) =>\n\t\t( event: actions.KeyEventAction[ 'payload' ][ 'event' ] ) => {\n\t\t\tdispatch( { type, payload: { event } } );\n\t\t};\n\n\tconst createDragEvent =\n\t\t( type: actions.DragEventAction[ 'type' ] ) =>\n\t\t( payload: actions.DragEventAction[ 'payload' ] ) => {\n\t\t\tdispatch( { type, payload } );\n\t\t};\n\n\t/**\n\t * Actions for the reducer\n\t */\n\tconst change = createChangeEvent( actions.CHANGE );\n\tconst invalidate = ( error: unknown, event: SyntheticEvent ) =>\n\t\tdispatch( { type: actions.INVALIDATE, payload: { error, event } } );\n\tconst reset = createChangeEvent( actions.RESET );\n\tconst commit = createChangeEvent( actions.COMMIT );\n\n\tconst dragStart = createDragEvent( actions.DRAG_START );\n\tconst drag = createDragEvent( actions.DRAG );\n\tconst dragEnd = createDragEvent( actions.DRAG_END );\n\n\tconst pressUp = createKeyEvent( actions.PRESS_UP );\n\tconst pressDown = createKeyEvent( actions.PRESS_DOWN );\n\tconst pressEnter = createKeyEvent( actions.PRESS_ENTER );\n\n\tconst currentState = useRef( state );\n\tconst refProps = useRef( { value: initialState.value, onChangeHandler } );\n\n\t// Freshens refs to props and state so that subsequent effects have access\n\t// to their latest values without their changes causing effect runs.\n\tuseLayoutEffect( () => {\n\t\tcurrentState.current = state;\n\t\trefProps.current = { value: initialState.value, onChangeHandler };\n\t} );\n\n\t// Propagates the latest state through onChange.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tcurrentState.current._event !== undefined &&\n\t\t\tstate.value !== refProps.current.value &&\n\t\t\t! state.isDirty\n\t\t) {\n\t\t\trefProps.current.onChangeHandler( state.value ?? '', {\n\t\t\t\tevent: currentState.current._event as\n\t\t\t\t\t| ChangeEvent< HTMLInputElement >\n\t\t\t\t\t| PointerEvent< HTMLInputElement >,\n\t\t\t} );\n\t\t}\n\t}, [ state.value, state.isDirty ] );\n\n\t// Updates the state from props.\n\tuseLayoutEffect( () => {\n\t\tif (\n\t\t\tinitialState.value !== currentState.current.value &&\n\t\t\t! currentState.current.isDirty\n\t\t) {\n\t\t\tdispatch( {\n\t\t\t\ttype: actions.CONTROL,\n\t\t\t\tpayload: { value: initialState.value ?? '' },\n\t\t\t} );\n\t\t}\n\t}, [ initialState.value ] );\n\n\treturn {\n\t\tchange,\n\t\tcommit,\n\t\tdispatch,\n\t\tdrag,\n\t\tdragEnd,\n\t\tdragStart,\n\t\tinvalidate,\n\t\tpressDown,\n\t\tpressEnter,\n\t\tpressUp,\n\t\treset,\n\t\tstate,\n\t} as const;\n}\n"]}
@@ -20,7 +20,7 @@ var _element = require("@wordpress/element");
20
20
  /**
21
21
  * Gets a CSS cursor value based on a drag direction.
22
22
  *
23
- * @param dragDirection The drag direction.
23
+ * @param dragDirection The drag direction.
24
24
  * @return The CSS cursor value.
25
25
  */
26
26
  function getDragCursor(dragDirection) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/input-control/utils.ts"],"names":["getDragCursor","dragDirection","dragCursor","useDragCursor","isDragging","document","documentElement","style","cursor","useDraft","props","refPreviousValue","value","draft","setDraft","undefined","current","previousValue","isStale","onChange","nextValue","extra","Object","assign","onBlur","event"],"mappings":";;;;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,aAAxB,EAAwD;AAC9D,MAAIC,UAAU,GAAG,WAAjB;;AAEA,UAASD,aAAT;AACC,SAAK,GAAL;AACA,SAAK,GAAL;AACCC,MAAAA,UAAU,GAAG,WAAb;AACA;;AAED,SAAK,GAAL;AACA,SAAK,GAAL;AACCA,MAAAA,UAAU,GAAG,WAAb;AACA;AATF;;AAYA,SAAOA,UAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,aAAT,CACNC,UADM,EAENH,aAFM,EAGG;AACT,QAAMC,UAAU,GAAGF,aAAa,CAAEC,aAAF,CAAhC;AAEA,0BAAW,MAAM;AAChB,QAAKG,UAAL,EAAkB;AACjBC,MAAAA,QAAQ,CAACC,eAAT,CAAy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,CAAR;AAGAR,IAAAA,KAAK,CAACS,QAAN,CAAgBC,SAAhB,EAA2BC,KAA3B;AACA,GAND;;AAOA,QAAMG,MAAyB,GAAKC,KAAF,IAAa;AAAA;;AAC9CX,IAAAA,QAAQ,CAAE,EAAF,CAAR;AACA,qBAAAJ,KAAK,CAACc,MAAN,qEAAAd,KAAK,EAAWe,KAAX,CAAL;AACA,GAHD;;AAKA,SAAO;AAAEb,IAAAA,KAAF;AAASY,IAAAA,MAAT;AAAiBL,IAAAA;AAAjB,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { FocusEventHandler } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { InputChangeCallback } from './types';\n\n/**\n * Gets a CSS cursor value based on a drag direction.\n *\n * @param dragDirection The drag direction.\n * @return The CSS cursor value.\n */\nexport function getDragCursor( dragDirection: string ): string {\n\tlet dragCursor = 'ns-resize';\n\n\tswitch ( dragDirection ) {\n\t\tcase 'n':\n\t\tcase 's':\n\t\t\tdragCursor = 'ns-resize';\n\t\t\tbreak;\n\n\t\tcase 'e':\n\t\tcase 'w':\n\t\t\tdragCursor = 'ew-resize';\n\t\t\tbreak;\n\t}\n\n\treturn dragCursor;\n}\n\n/**\n * Custom hook that renders a drag cursor when dragging.\n *\n * @param {boolean} isDragging The dragging state.\n * @param {string} dragDirection The drag direction.\n *\n * @return {string} The CSS cursor value.\n */\nexport function useDragCursor(\n\tisDragging: boolean,\n\tdragDirection: string\n): string {\n\tconst dragCursor = getDragCursor( dragDirection );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tdocument.documentElement.style.cursor = dragCursor;\n\t\t} else {\n\t\t\t// @ts-expect-error\n\t\t\tdocument.documentElement.style.cursor = null;\n\t\t}\n\t}, [ isDragging, dragCursor ] );\n\n\treturn dragCursor;\n}\n\nexport function useDraft( props: {\n\tvalue: string | undefined;\n\tonBlur?: FocusEventHandler;\n\tonChange: InputChangeCallback;\n} ) {\n\tconst refPreviousValue = useRef( props.value );\n\tconst [ draft, setDraft ] = useState< {\n\t\tvalue?: string;\n\t\tisStale?: boolean;\n\t} >( {} );\n\tconst value = draft.value !== undefined ? draft.value : props.value;\n\n\t// Determines when to discard the draft value to restore controlled status.\n\t// To do so, it tracks the previous value and marks the draft value as stale\n\t// after each render.\n\tuseLayoutEffect( () => {\n\t\tconst { current: previousValue } = refPreviousValue;\n\t\trefPreviousValue.current = props.value;\n\t\tif ( draft.value !== undefined && ! draft.isStale )\n\t\t\tsetDraft( { ...draft, isStale: true } );\n\t\telse if ( draft.isStale && props.value !== previousValue )\n\t\t\tsetDraft( {} );\n\t}, [ props.value, draft ] );\n\n\tconst onChange: InputChangeCallback = ( nextValue, extra ) => {\n\t\t// Mutates the draft value to avoid an extra effect run.\n\t\tsetDraft( ( current ) =>\n\t\t\tObject.assign( current, { value: nextValue, isStale: false } )\n\t\t);\n\t\tprops.onChange( nextValue, extra );\n\t};\n\tconst onBlur: FocusEventHandler = ( event ) => {\n\t\tsetDraft( {} );\n\t\tprops.onBlur?.( event );\n\t};\n\n\treturn { value, onBlur, onChange };\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/input-control/utils.ts"],"names":["getDragCursor","dragDirection","dragCursor","useDragCursor","isDragging","document","documentElement","style","cursor","useDraft","props","refPreviousValue","value","draft","setDraft","undefined","current","previousValue","isStale","onChange","nextValue","extra","Object","assign","onBlur","event"],"mappings":";;;;;;;;;AAQA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAT,CAAwBC,aAAxB,EAAwD;AAC9D,MAAIC,UAAU,GAAG,WAAjB;;AAEA,UAASD,aAAT;AACC,SAAK,GAAL;AACA,SAAK,GAAL;AACCC,MAAAA,UAAU,GAAG,WAAb;AACA;;AAED,SAAK,GAAL;AACA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EAAF,CAAR;AACD,GAPD,EAOG,CAAEJ,KAAK,CAACE,KAAR,EAAeC,KAAf,CAPH;;AASA,QAAMM,QAA6B,GAAG,CAAEC,SAAF,EAAaC,KAAb,KAAwB;AAC7D;AACAP,IAAAA,QAAQ,CAAIE,OAAF,IACTM,MAAM,CAACC,MAAP,CAAeP,OAAf,EAAwB;AAAEJ,MAAAA,KAAK,EAAEQ,SAAT;AAAoBF,MAAAA,OAAO,EAAE;AAA7B,KAAxB,CADO,CAAR;AAGAR,IAAAA,KAAK,CAACS,QAAN,CAAgBC,SAAhB,EAA2BC,KAA3B;AACA,GAND;;AAOA,QAAMG,MAAyB,GAAKC,KAAF,IAAa;AAAA;;AAC9CX,IAAAA,QAAQ,CAAE,EAAF,CAAR;AACA,qBAAAJ,KAAK,CAACc,MAAN,qEAAAd,KAAK,EAAWe,KAAX,CAAL;AACA,GAHD;;AAKA,SAAO;AAAEb,IAAAA,KAAF;AAASY,IAAAA,MAAT;AAAiBL,IAAAA;AAAjB,GAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport type { FocusEventHandler } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseEffect,\n\tuseLayoutEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { InputChangeCallback } from './types';\n\n/**\n * Gets a CSS cursor value based on a drag direction.\n *\n * @param dragDirection The drag direction.\n * @return The CSS cursor value.\n */\nexport function getDragCursor( dragDirection: string ): string {\n\tlet dragCursor = 'ns-resize';\n\n\tswitch ( dragDirection ) {\n\t\tcase 'n':\n\t\tcase 's':\n\t\t\tdragCursor = 'ns-resize';\n\t\t\tbreak;\n\n\t\tcase 'e':\n\t\tcase 'w':\n\t\t\tdragCursor = 'ew-resize';\n\t\t\tbreak;\n\t}\n\n\treturn dragCursor;\n}\n\n/**\n * Custom hook that renders a drag cursor when dragging.\n *\n * @param {boolean} isDragging The dragging state.\n * @param {string} dragDirection The drag direction.\n *\n * @return {string} The CSS cursor value.\n */\nexport function useDragCursor(\n\tisDragging: boolean,\n\tdragDirection: string\n): string {\n\tconst dragCursor = getDragCursor( dragDirection );\n\n\tuseEffect( () => {\n\t\tif ( isDragging ) {\n\t\t\tdocument.documentElement.style.cursor = dragCursor;\n\t\t} else {\n\t\t\t// @ts-expect-error\n\t\t\tdocument.documentElement.style.cursor = null;\n\t\t}\n\t}, [ isDragging, dragCursor ] );\n\n\treturn dragCursor;\n}\n\nexport function useDraft( props: {\n\tvalue: string | undefined;\n\tonBlur?: FocusEventHandler;\n\tonChange: InputChangeCallback;\n} ) {\n\tconst refPreviousValue = useRef( props.value );\n\tconst [ draft, setDraft ] = useState< {\n\t\tvalue?: string;\n\t\tisStale?: boolean;\n\t} >( {} );\n\tconst value = draft.value !== undefined ? draft.value : props.value;\n\n\t// Determines when to discard the draft value to restore controlled status.\n\t// To do so, it tracks the previous value and marks the draft value as stale\n\t// after each render.\n\tuseLayoutEffect( () => {\n\t\tconst { current: previousValue } = refPreviousValue;\n\t\trefPreviousValue.current = props.value;\n\t\tif ( draft.value !== undefined && ! draft.isStale )\n\t\t\tsetDraft( { ...draft, isStale: true } );\n\t\telse if ( draft.isStale && props.value !== previousValue )\n\t\t\tsetDraft( {} );\n\t}, [ props.value, draft ] );\n\n\tconst onChange: InputChangeCallback = ( nextValue, extra ) => {\n\t\t// Mutates the draft value to avoid an extra effect run.\n\t\tsetDraft( ( current ) =>\n\t\t\tObject.assign( current, { value: nextValue, isStale: false } )\n\t\t);\n\t\tprops.onChange( nextValue, extra );\n\t};\n\tconst onBlur: FocusEventHandler = ( event ) => {\n\t\tsetDraft( {} );\n\t\tprops.onBlur?.( event );\n\t};\n\n\treturn { value, onBlur, onChange };\n}\n"]}
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = MenuItemsChoice;
8
+ exports.default = void 0;
9
9
 
10
10
  var _element = require("@wordpress/element");
11
11
 
@@ -21,6 +21,40 @@ var _menuItem = _interopRequireDefault(require("../menu-item"));
21
21
  * Internal dependencies
22
22
  */
23
23
  const noop = () => {};
24
+ /**
25
+ * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.
26
+ *
27
+ *
28
+ * ```jsx
29
+ * import { MenuGroup, MenuItemsChoice } from '@wordpress/components';
30
+ * import { useState } from '@wordpress/element';
31
+ *
32
+ * const MyMenuItemsChoice = () => {
33
+ * const [ mode, setMode ] = useState( 'visual' );
34
+ * const choices = [
35
+ * {
36
+ * value: 'visual',
37
+ * label: 'Visual editor',
38
+ * },
39
+ * {
40
+ * value: 'text',
41
+ * label: 'Code editor',
42
+ * },
43
+ * ];
44
+ *
45
+ * return (
46
+ * <MenuGroup label="Editor">
47
+ * <MenuItemsChoice
48
+ * choices={ choices }
49
+ * value={ mode }
50
+ * onSelect={ ( newMode ) => setMode( newMode ) }
51
+ * />
52
+ * </MenuGroup>
53
+ * );
54
+ * };
55
+ * ```
56
+ */
57
+
24
58
 
25
59
  function MenuItemsChoice(_ref) {
26
60
  let {
@@ -29,7 +63,7 @@ function MenuItemsChoice(_ref) {
29
63
  onSelect,
30
64
  value
31
65
  } = _ref;
32
- return choices.map(item => {
66
+ return (0, _element.createElement)(_element.Fragment, null, choices.map(item => {
33
67
  const isSelected = value === item.value;
34
68
  return (0, _element.createElement)(_menuItem.default, {
35
69
  key: item.value,
@@ -48,6 +82,9 @@ function MenuItemsChoice(_ref) {
48
82
  onMouseLeave: () => onHover(null),
49
83
  "aria-label": item['aria-label']
50
84
  }, item.label);
51
- });
85
+ }));
52
86
  }
87
+
88
+ var _default = MenuItemsChoice;
89
+ exports.default = _default;
53
90
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/menu-items-choice/index.js"],"names":["noop","MenuItemsChoice","choices","onHover","onSelect","value","map","item","isSelected","check","info","shortcut","label"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAGA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEe,SAASC,eAAT,OAKX;AAAA,MALqC;AACxCC,IAAAA,OAAO,GAAG,EAD8B;AAExCC,IAAAA,OAAO,GAAGH,IAF8B;AAGxCI,IAAAA,QAHwC;AAIxCC,IAAAA;AAJwC,GAKrC;AACH,SAAOH,OAAO,CAACI,GAAR,CAAeC,IAAF,IAAY;AAC/B,UAAMC,UAAU,GAAGH,KAAK,KAAKE,IAAI,CAACF,KAAlC;AACA,WACC,4BAAC,iBAAD;AACC,MAAA,GAAG,EAAGE,IAAI,CAACF,KADZ;AAEC,MAAA,IAAI,EAAC,eAFN;AAGC,MAAA,IAAI,EAAGG,UAAU,IAAIC,YAHtB;AAIC,MAAA,IAAI,EAAGF,IAAI,CAACG,IAJb;AAKC,MAAA,UAAU,EAAGF,UALd;AAMC,MAAA,QAAQ,EAAGD,IAAI,CAACI,QANjB;AAOC,MAAA,SAAS,EAAC,8BAPX;AAQC,MAAA,OAAO,EAAG,MAAM;AACf,YAAK,CAAEH,UAAP,EAAoB;AACnBJ,UAAAA,QAAQ,CAAEG,IAAI,CAACF,KAAP,CAAR;AACA;AACD,OAZF;AAaC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAEI,IAAI,CAACF,KAAP,CAb7B;AAcC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAE,IAAF,CAd7B;AAeC,oBAAaI,IAAI,CAAE,YAAF;AAflB,OAiBGA,IAAI,CAACK,KAjBR,CADD;AAqBA,GAvBM,CAAP;AAwBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MenuItem from '../menu-item';\n\nconst noop = () => {};\n\nexport default function MenuItemsChoice( {\n\tchoices = [],\n\tonHover = noop,\n\tonSelect,\n\tvalue,\n} ) {\n\treturn choices.map( ( item ) => {\n\t\tconst isSelected = value === item.value;\n\t\treturn (\n\t\t\t<MenuItem\n\t\t\t\tkey={ item.value }\n\t\t\t\trole=\"menuitemradio\"\n\t\t\t\ticon={ isSelected && check }\n\t\t\t\tinfo={ item.info }\n\t\t\t\tisSelected={ isSelected }\n\t\t\t\tshortcut={ item.shortcut }\n\t\t\t\tclassName=\"components-menu-items-choice\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\t\tonSelect( item.value );\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tonMouseEnter={ () => onHover( item.value ) }\n\t\t\t\tonMouseLeave={ () => onHover( null ) }\n\t\t\t\taria-label={ item[ 'aria-label' ] }\n\t\t\t>\n\t\t\t\t{ item.label }\n\t\t\t</MenuItem>\n\t\t);\n\t} );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/menu-items-choice/index.tsx"],"names":["noop","MenuItemsChoice","choices","onHover","onSelect","value","map","item","isSelected","check","info","shortcut","label"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;AAIA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,eAAT,OAK0B;AAAA,MALA;AACzBC,IAAAA,OAAO,GAAG,EADe;AAEzBC,IAAAA,OAAO,GAAGH,IAFe;AAGzBI,IAAAA,QAHyB;AAIzBC,IAAAA;AAJyB,GAKA;AACzB,SACC,qDACGH,OAAO,CAACI,GAAR,CAAeC,IAAF,IAAY;AAC1B,UAAMC,UAAU,GAAGH,KAAK,KAAKE,IAAI,CAACF,KAAlC;AACA,WACC,4BAAC,iBAAD;AACC,MAAA,GAAG,EAAGE,IAAI,CAACF,KADZ;AAEC,MAAA,IAAI,EAAC,eAFN;AAGC,MAAA,IAAI,EAAGG,UAAU,IAAIC,YAHtB;AAIC,MAAA,IAAI,EAAGF,IAAI,CAACG,IAJb;AAKC,MAAA,UAAU,EAAGF,UALd;AAMC,MAAA,QAAQ,EAAGD,IAAI,CAACI,QANjB;AAOC,MAAA,SAAS,EAAC,8BAPX;AAQC,MAAA,OAAO,EAAG,MAAM;AACf,YAAK,CAAEH,UAAP,EAAoB;AACnBJ,UAAAA,QAAQ,CAAEG,IAAI,CAACF,KAAP,CAAR;AACA;AACD,OAZF;AAaC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAEI,IAAI,CAACF,KAAP,CAb7B;AAcC,MAAA,YAAY,EAAG,MAAMF,OAAO,CAAE,IAAF,CAd7B;AAeC,oBAAaI,IAAI,CAAE,YAAF;AAflB,OAiBGA,IAAI,CAACK,KAjBR,CADD;AAqBA,GAvBC,CADH,CADD;AA4BA;;eAEcX,e","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport MenuItem from '../menu-item';\nimport type { MenuItemsChoiceProps } from './types';\n\nconst noop = () => {};\n\n/**\n * `MenuItemsChoice` functions similarly to a set of `MenuItem`s, but allows the user to select one option from a set of multiple choices.\n *\n *\n * ```jsx\n * import { MenuGroup, MenuItemsChoice } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyMenuItemsChoice = () => {\n * \tconst [ mode, setMode ] = useState( 'visual' );\n * \tconst choices = [\n * \t\t{\n * \t\t\tvalue: 'visual',\n * \t\t\tlabel: 'Visual editor',\n * \t\t},\n * \t\t{\n * \t\t\tvalue: 'text',\n * \t\t\tlabel: 'Code editor',\n * \t\t},\n * \t];\n *\n * \treturn (\n * \t\t<MenuGroup label=\"Editor\">\n * \t\t\t<MenuItemsChoice\n * \t\t\t\tchoices={ choices }\n * \t\t\t\tvalue={ mode }\n * \t\t\t\tonSelect={ ( newMode ) => setMode( newMode ) }\n * \t\t\t/>\n * \t\t</MenuGroup>\n * \t);\n * };\n * ```\n */\nfunction MenuItemsChoice( {\n\tchoices = [],\n\tonHover = noop,\n\tonSelect,\n\tvalue,\n}: MenuItemsChoiceProps ) {\n\treturn (\n\t\t<>\n\t\t\t{ choices.map( ( item ) => {\n\t\t\t\tconst isSelected = value === item.value;\n\t\t\t\treturn (\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tkey={ item.value }\n\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\ticon={ isSelected && check }\n\t\t\t\t\t\tinfo={ item.info }\n\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\tshortcut={ item.shortcut }\n\t\t\t\t\t\tclassName=\"components-menu-items-choice\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tif ( ! isSelected ) {\n\t\t\t\t\t\t\t\tonSelect( item.value );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonMouseEnter={ () => onHover( item.value ) }\n\t\t\t\t\t\tonMouseLeave={ () => onHover( null ) }\n\t\t\t\t\t\taria-label={ item[ 'aria-label' ] }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</>\n\t);\n}\n\nexport default MenuItemsChoice;\n"]}