@wordpress/components 23.3.5 → 23.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (777) hide show
  1. package/CHANGELOG.md +35 -5
  2. package/build/alignment-matrix-control/utils.js +4 -4
  3. package/build/alignment-matrix-control/utils.js.map +1 -1
  4. package/build/angle-picker-control/angle-circle.js +37 -29
  5. package/build/angle-picker-control/angle-circle.js.map +1 -1
  6. package/build/angle-picker-control/index.js +44 -9
  7. package/build/angle-picker-control/index.js.map +1 -1
  8. package/build/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  9. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  10. package/build/angle-picker-control/types.js.map +1 -0
  11. package/build/autocomplete/autocompleter-ui.js +41 -17
  12. package/build/autocomplete/autocompleter-ui.js.map +1 -1
  13. package/build/autocomplete/autocompleter-ui.native.js +1 -0
  14. package/build/autocomplete/autocompleter-ui.native.js.map +1 -1
  15. package/build/autocomplete/index.js +31 -33
  16. package/build/autocomplete/index.js.map +1 -1
  17. package/build/base-control/hooks.js +1 -1
  18. package/build/base-control/hooks.js.map +1 -1
  19. package/build/border-box-control/utils.js +1 -1
  20. package/build/border-box-control/utils.js.map +1 -1
  21. package/build/box-control/all-input-control.js +2 -2
  22. package/build/box-control/all-input-control.js.map +1 -1
  23. package/build/box-control/axial-input-controls.js +1 -1
  24. package/build/box-control/axial-input-controls.js.map +1 -1
  25. package/build/box-control/icon.js.map +1 -1
  26. package/build/box-control/index.js +32 -3
  27. package/build/box-control/index.js.map +1 -1
  28. package/build/box-control/input-controls.js +5 -5
  29. package/build/box-control/input-controls.js.map +1 -1
  30. package/build/box-control/linked-button.js.map +1 -1
  31. package/build/box-control/styles/box-control-icon-styles.js +28 -28
  32. package/build/box-control/styles/box-control-icon-styles.js.map +1 -1
  33. package/build/box-control/styles/box-control-styles.js +23 -23
  34. package/build/box-control/styles/box-control-styles.js.map +1 -1
  35. package/build/box-control/styles/box-control-visualizer-styles.js +19 -19
  36. package/build/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  37. package/build/box-control/types.js +6 -0
  38. package/build/box-control/types.js.map +1 -0
  39. package/build/box-control/unit-control.js.map +1 -1
  40. package/build/box-control/utils.js +23 -23
  41. package/build/box-control/utils.js.map +1 -1
  42. package/build/circular-option-picker/index.js +63 -14
  43. package/build/circular-option-picker/index.js.map +1 -1
  44. package/build/circular-option-picker/types.js +6 -0
  45. package/build/circular-option-picker/types.js.map +1 -0
  46. package/build/color-palette/index.js +8 -3
  47. package/build/color-palette/index.js.map +1 -1
  48. package/build/combobox-control/index.js +68 -12
  49. package/build/combobox-control/index.js.map +1 -1
  50. package/build/combobox-control/styles.js +2 -2
  51. package/build/combobox-control/styles.js.map +1 -1
  52. package/build/combobox-control/types.js +6 -0
  53. package/build/combobox-control/types.js.map +1 -0
  54. package/build/custom-gradient-picker/index.js +0 -1
  55. package/build/custom-gradient-picker/index.js.map +1 -1
  56. package/build/date-time/time/index.js +1 -1
  57. package/build/date-time/time/index.js.map +1 -1
  58. package/build/date-time/utils.js +1 -1
  59. package/build/date-time/utils.js.map +1 -1
  60. package/build/draggable/index.js +2 -2
  61. package/build/draggable/index.js.map +1 -1
  62. package/build/focal-point-picker/utils.js +3 -3
  63. package/build/focal-point-picker/utils.js.map +1 -1
  64. package/build/font-size-picker/utils.js +2 -2
  65. package/build/font-size-picker/utils.js.map +1 -1
  66. package/build/gradient-picker/index.js +9 -4
  67. package/build/gradient-picker/index.js.map +1 -1
  68. package/build/higher-order/with-constrained-tabbing/index.js +9 -0
  69. package/build/higher-order/with-constrained-tabbing/index.js.map +1 -1
  70. package/build/input-control/reducer/reducer.js +5 -5
  71. package/build/input-control/reducer/reducer.js.map +1 -1
  72. package/build/input-control/utils.js +1 -1
  73. package/build/input-control/utils.js.map +1 -1
  74. package/build/menu-items-choice/index.js +40 -3
  75. package/build/menu-items-choice/index.js.map +1 -1
  76. package/build/menu-items-choice/types.js +6 -0
  77. package/build/menu-items-choice/types.js.map +1 -0
  78. package/build/mobile/global-styles-context/utils.native.js +2 -1
  79. package/build/mobile/global-styles-context/utils.native.js.map +1 -1
  80. package/build/modal/index.js +41 -3
  81. package/build/modal/index.js.map +1 -1
  82. package/build/palette-edit/index.js +4 -1
  83. package/build/palette-edit/index.js.map +1 -1
  84. package/build/panel/header.js +9 -0
  85. package/build/panel/header.js.map +1 -1
  86. package/build/panel/index.js +21 -3
  87. package/build/panel/index.js.map +1 -1
  88. package/build/panel/row.js +10 -4
  89. package/build/panel/row.js.map +1 -1
  90. package/build/panel/types.js +6 -0
  91. package/build/panel/types.js.map +1 -0
  92. package/build/popover/index.js +15 -3
  93. package/build/popover/index.js.map +1 -1
  94. package/build/popover/overlay-middlewares.js +46 -0
  95. package/build/popover/overlay-middlewares.js.map +1 -0
  96. package/build/popover/utils.js +45 -6
  97. package/build/popover/utils.js.map +1 -1
  98. package/build/query-controls/terms.js +1 -1
  99. package/build/query-controls/terms.js.map +1 -1
  100. package/build/range-control/utils.js +4 -4
  101. package/build/range-control/utils.js.map +1 -1
  102. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  103. package/build/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  104. package/build/resizable-box/resize-tooltip/utils.js +14 -14
  105. package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
  106. package/build/snackbar/index.js +2 -2
  107. package/build/snackbar/index.js.map +1 -1
  108. package/build/toolbar/toolbar/index.js +25 -14
  109. package/build/toolbar/toolbar/index.js.map +1 -1
  110. package/build/toolbar/toolbar/toolbar-container.js +5 -4
  111. package/build/toolbar/toolbar/toolbar-container.js.map +1 -1
  112. package/build/toolbar/toolbar/types.js +6 -0
  113. package/build/toolbar/toolbar/types.js.map +1 -0
  114. package/build/toolbar/toolbar-button/index.js +2 -0
  115. package/build/toolbar/toolbar-button/index.js.map +1 -1
  116. package/build/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  117. package/build/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  118. package/build/toolbar/toolbar-context/index.js +2 -0
  119. package/build/toolbar/toolbar-context/index.js.map +1 -1
  120. package/build/toolbar/toolbar-dropdown-menu/index.js +2 -0
  121. package/build/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  122. package/build/toolbar/toolbar-group/index.js +2 -0
  123. package/build/toolbar/toolbar-group/index.js.map +1 -1
  124. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  125. package/build/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  126. package/build/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  127. package/build/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  128. package/build/toolbar/toolbar-item/index.js +2 -0
  129. package/build/toolbar/toolbar-item/index.js.map +1 -1
  130. package/build/tools-panel/context.js +2 -0
  131. package/build/tools-panel/context.js.map +1 -1
  132. package/build/tools-panel/tools-panel/component.js +61 -5
  133. package/build/tools-panel/tools-panel/component.js.map +1 -1
  134. package/build/tools-panel/tools-panel/hook.js +22 -14
  135. package/build/tools-panel/tools-panel/hook.js.map +1 -1
  136. package/build/tools-panel/tools-panel-header/component.js +2 -1
  137. package/build/tools-panel/tools-panel-header/component.js.map +1 -1
  138. package/build/tools-panel/tools-panel-header/hook.js +2 -0
  139. package/build/tools-panel/tools-panel-header/hook.js.map +1 -1
  140. package/build/tools-panel/tools-panel-item/component.js +5 -4
  141. package/build/tools-panel/tools-panel-item/component.js.map +1 -1
  142. package/build/tools-panel/tools-panel-item/hook.js +18 -4
  143. package/build/tools-panel/tools-panel-item/hook.js.map +1 -1
  144. package/build/tree-grid/cell.js +15 -4
  145. package/build/tree-grid/cell.js.map +1 -1
  146. package/build/tree-grid/index.js +81 -19
  147. package/build/tree-grid/index.js.map +1 -1
  148. package/build/tree-grid/item.js +14 -3
  149. package/build/tree-grid/item.js.map +1 -1
  150. package/build/tree-grid/roving-tab-index-context.js +1 -1
  151. package/build/tree-grid/roving-tab-index-context.js.map +1 -1
  152. package/build/tree-grid/roving-tab-index-item.js +13 -6
  153. package/build/tree-grid/roving-tab-index-item.js.map +1 -1
  154. package/build/tree-grid/roving-tab-index.js +0 -3
  155. package/build/tree-grid/roving-tab-index.js.map +1 -1
  156. package/build/tree-grid/row.js +20 -18
  157. package/build/tree-grid/row.js.map +1 -1
  158. package/build/tree-grid/types.js +6 -0
  159. package/build/tree-grid/types.js.map +1 -0
  160. package/build/ui/context/context-connect.js +7 -7
  161. package/build/ui/context/context-connect.js.map +1 -1
  162. package/build/ui/context/context-system-provider.js +8 -4
  163. package/build/ui/context/context-system-provider.js.map +1 -1
  164. package/build/ui/context/get-styled-class-name-from-key.js +1 -1
  165. package/build/ui/context/get-styled-class-name-from-key.js.map +1 -1
  166. package/build/ui/utils/get-valid-children.js +1 -1
  167. package/build/ui/utils/get-valid-children.js.map +1 -1
  168. package/build/ui/utils/space.js +1 -1
  169. package/build/ui/utils/space.js.map +1 -1
  170. package/build/unit-control/index.js +2 -2
  171. package/build/unit-control/index.js.map +1 -1
  172. package/build/unit-control/utils.js +20 -20
  173. package/build/unit-control/utils.js.map +1 -1
  174. package/build/utils/events.js +4 -4
  175. package/build/utils/events.js.map +1 -1
  176. package/build/utils/hooks/use-controlled-state.js +2 -2
  177. package/build/utils/hooks/use-controlled-state.js.map +1 -1
  178. package/build/utils/hooks/use-controlled-value.js +4 -4
  179. package/build/utils/hooks/use-controlled-value.js.map +1 -1
  180. package/build/utils/hooks/use-latest-ref.js +1 -1
  181. package/build/utils/hooks/use-latest-ref.js.map +1 -1
  182. package/build/utils/unit-values.js +3 -3
  183. package/build/utils/unit-values.js.map +1 -1
  184. package/build-module/alignment-matrix-control/utils.js +4 -4
  185. package/build-module/alignment-matrix-control/utils.js.map +1 -1
  186. package/build-module/angle-picker-control/angle-circle.js +37 -29
  187. package/build-module/angle-picker-control/angle-circle.js.map +1 -1
  188. package/build-module/angle-picker-control/index.js +42 -8
  189. package/build-module/angle-picker-control/index.js.map +1 -1
  190. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +13 -13
  191. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  192. package/build-module/autocomplete/autocompleter-ui.js +40 -19
  193. package/build-module/autocomplete/autocompleter-ui.js.map +1 -1
  194. package/build-module/autocomplete/autocompleter-ui.native.js +1 -0
  195. package/build-module/autocomplete/autocompleter-ui.native.js.map +1 -1
  196. package/build-module/autocomplete/index.js +30 -32
  197. package/build-module/autocomplete/index.js.map +1 -1
  198. package/build-module/base-control/hooks.js +1 -1
  199. package/build-module/base-control/hooks.js.map +1 -1
  200. package/build-module/border-box-control/utils.js +1 -1
  201. package/build-module/border-box-control/utils.js.map +1 -1
  202. package/build-module/box-control/all-input-control.js +2 -2
  203. package/build-module/box-control/all-input-control.js.map +1 -1
  204. package/build-module/box-control/axial-input-controls.js +1 -1
  205. package/build-module/box-control/axial-input-controls.js.map +1 -1
  206. package/build-module/box-control/icon.js.map +1 -1
  207. package/build-module/box-control/index.js +31 -3
  208. package/build-module/box-control/index.js.map +1 -1
  209. package/build-module/box-control/input-controls.js +5 -5
  210. package/build-module/box-control/input-controls.js.map +1 -1
  211. package/build-module/box-control/linked-button.js.map +1 -1
  212. package/build-module/box-control/styles/box-control-icon-styles.js +28 -28
  213. package/build-module/box-control/styles/box-control-icon-styles.js.map +1 -1
  214. package/build-module/box-control/styles/box-control-styles.js +23 -23
  215. package/build-module/box-control/styles/box-control-styles.js.map +1 -1
  216. package/build-module/box-control/styles/box-control-visualizer-styles.js +19 -19
  217. package/build-module/box-control/styles/box-control-visualizer-styles.js.map +1 -1
  218. package/build-module/box-control/types.js +2 -0
  219. package/build-module/box-control/unit-control.js.map +1 -1
  220. package/build-module/box-control/utils.js +23 -23
  221. package/build-module/box-control/utils.js.map +1 -1
  222. package/build-module/circular-option-picker/index.js +59 -16
  223. package/build-module/circular-option-picker/index.js.map +1 -1
  224. package/build-module/circular-option-picker/types.js +2 -0
  225. package/build-module/color-palette/index.js +8 -3
  226. package/build-module/color-palette/index.js.map +1 -1
  227. package/build-module/combobox-control/index.js +68 -12
  228. package/build-module/combobox-control/index.js.map +1 -1
  229. package/build-module/combobox-control/styles.js +2 -2
  230. package/build-module/combobox-control/styles.js.map +1 -1
  231. package/build-module/combobox-control/types.js +2 -0
  232. package/build-module/custom-gradient-picker/index.js +0 -1
  233. package/build-module/custom-gradient-picker/index.js.map +1 -1
  234. package/build-module/date-time/time/index.js +1 -1
  235. package/build-module/date-time/time/index.js.map +1 -1
  236. package/build-module/date-time/utils.js +1 -1
  237. package/build-module/date-time/utils.js.map +1 -1
  238. package/build-module/draggable/index.js +2 -2
  239. package/build-module/draggable/index.js.map +1 -1
  240. package/build-module/focal-point-picker/utils.js +3 -3
  241. package/build-module/focal-point-picker/utils.js.map +1 -1
  242. package/build-module/font-size-picker/utils.js +2 -2
  243. package/build-module/font-size-picker/utils.js.map +1 -1
  244. package/build-module/gradient-picker/index.js +9 -4
  245. package/build-module/gradient-picker/index.js.map +1 -1
  246. package/build-module/higher-order/with-constrained-tabbing/index.js +9 -0
  247. package/build-module/higher-order/with-constrained-tabbing/index.js.map +1 -1
  248. package/build-module/input-control/reducer/reducer.js +5 -5
  249. package/build-module/input-control/reducer/reducer.js.map +1 -1
  250. package/build-module/input-control/utils.js +1 -1
  251. package/build-module/input-control/utils.js.map +1 -1
  252. package/build-module/menu-items-choice/index.js +40 -4
  253. package/build-module/menu-items-choice/index.js.map +1 -1
  254. package/build-module/menu-items-choice/types.js +2 -0
  255. package/build-module/menu-items-choice/types.js.map +1 -0
  256. package/build-module/mobile/global-styles-context/utils.native.js +2 -1
  257. package/build-module/mobile/global-styles-context/utils.native.js.map +1 -1
  258. package/build-module/modal/index.js +41 -4
  259. package/build-module/modal/index.js.map +1 -1
  260. package/build-module/palette-edit/index.js +4 -1
  261. package/build-module/palette-edit/index.js.map +1 -1
  262. package/build-module/panel/header.js +9 -0
  263. package/build-module/panel/header.js.map +1 -1
  264. package/build-module/panel/index.js +20 -2
  265. package/build-module/panel/index.js.map +1 -1
  266. package/build-module/panel/row.js +9 -3
  267. package/build-module/panel/row.js.map +1 -1
  268. package/build-module/panel/types.js +2 -0
  269. package/build-module/panel/types.js.map +1 -0
  270. package/build-module/popover/index.js +14 -4
  271. package/build-module/popover/index.js.map +1 -1
  272. package/build-module/popover/overlay-middlewares.js +38 -0
  273. package/build-module/popover/overlay-middlewares.js.map +1 -0
  274. package/build-module/popover/utils.js +41 -5
  275. package/build-module/popover/utils.js.map +1 -1
  276. package/build-module/query-controls/terms.js +1 -1
  277. package/build-module/query-controls/terms.js.map +1 -1
  278. package/build-module/range-control/utils.js +4 -4
  279. package/build-module/range-control/utils.js.map +1 -1
  280. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js +12 -12
  281. package/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js.map +1 -1
  282. package/build-module/resizable-box/resize-tooltip/utils.js +14 -14
  283. package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
  284. package/build-module/snackbar/index.js +2 -2
  285. package/build-module/snackbar/index.js.map +1 -1
  286. package/build-module/toolbar/toolbar/index.js +25 -13
  287. package/build-module/toolbar/toolbar/index.js.map +1 -1
  288. package/build-module/toolbar/toolbar/toolbar-container.js +4 -3
  289. package/build-module/toolbar/toolbar/toolbar-container.js.map +1 -1
  290. package/build-module/toolbar/toolbar/types.js +2 -0
  291. package/build-module/toolbar/toolbar/types.js.map +1 -0
  292. package/build-module/toolbar/toolbar-button/index.js +1 -0
  293. package/build-module/toolbar/toolbar-button/index.js.map +1 -1
  294. package/build-module/toolbar/toolbar-button/toolbar-button-container.js +1 -0
  295. package/build-module/toolbar/toolbar-button/toolbar-button-container.js.map +1 -1
  296. package/build-module/toolbar/toolbar-context/index.js +2 -0
  297. package/build-module/toolbar/toolbar-context/index.js.map +1 -1
  298. package/build-module/toolbar/toolbar-dropdown-menu/index.js +1 -0
  299. package/build-module/toolbar/toolbar-dropdown-menu/index.js.map +1 -1
  300. package/build-module/toolbar/toolbar-group/index.js +1 -0
  301. package/build-module/toolbar/toolbar-group/index.js.map +1 -1
  302. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js +1 -0
  303. package/build-module/toolbar/toolbar-group/toolbar-group-collapsed.js.map +1 -1
  304. package/build-module/toolbar/toolbar-group/toolbar-group-container.js +1 -0
  305. package/build-module/toolbar/toolbar-group/toolbar-group-container.js.map +1 -1
  306. package/build-module/toolbar/toolbar-item/index.js +1 -0
  307. package/build-module/toolbar/toolbar-item/index.js.map +1 -1
  308. package/build-module/tools-panel/context.js +2 -0
  309. package/build-module/tools-panel/context.js.map +1 -1
  310. package/build-module/tools-panel/tools-panel/component.js +59 -4
  311. package/build-module/tools-panel/tools-panel/component.js.map +1 -1
  312. package/build-module/tools-panel/tools-panel/hook.js +22 -14
  313. package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
  314. package/build-module/tools-panel/tools-panel-header/component.js +2 -1
  315. package/build-module/tools-panel/tools-panel-header/component.js.map +1 -1
  316. package/build-module/tools-panel/tools-panel-header/hook.js +2 -0
  317. package/build-module/tools-panel/tools-panel-header/hook.js.map +1 -1
  318. package/build-module/tools-panel/tools-panel-item/component.js +3 -3
  319. package/build-module/tools-panel/tools-panel-item/component.js.map +1 -1
  320. package/build-module/tools-panel/tools-panel-item/hook.js +19 -4
  321. package/build-module/tools-panel/tools-panel-item/hook.js.map +1 -1
  322. package/build-module/tree-grid/cell.js +16 -4
  323. package/build-module/tree-grid/cell.js.map +1 -1
  324. package/build-module/tree-grid/index.js +81 -21
  325. package/build-module/tree-grid/index.js.map +1 -1
  326. package/build-module/tree-grid/item.js +14 -2
  327. package/build-module/tree-grid/item.js.map +1 -1
  328. package/build-module/tree-grid/roving-tab-index-context.js +1 -1
  329. package/build-module/tree-grid/roving-tab-index-context.js.map +1 -1
  330. package/build-module/tree-grid/roving-tab-index-item.js +11 -4
  331. package/build-module/tree-grid/roving-tab-index-item.js.map +1 -1
  332. package/build-module/tree-grid/roving-tab-index.js +0 -3
  333. package/build-module/tree-grid/roving-tab-index.js.map +1 -1
  334. package/build-module/tree-grid/row.js +22 -17
  335. package/build-module/tree-grid/row.js.map +1 -1
  336. package/build-module/tree-grid/types.js +2 -0
  337. package/build-module/tree-grid/types.js.map +1 -0
  338. package/build-module/ui/context/context-connect.js +7 -7
  339. package/build-module/ui/context/context-connect.js.map +1 -1
  340. package/build-module/ui/context/context-system-provider.js +7 -4
  341. package/build-module/ui/context/context-system-provider.js.map +1 -1
  342. package/build-module/ui/context/get-styled-class-name-from-key.js +1 -1
  343. package/build-module/ui/context/get-styled-class-name-from-key.js.map +1 -1
  344. package/build-module/ui/utils/get-valid-children.js +1 -1
  345. package/build-module/ui/utils/get-valid-children.js.map +1 -1
  346. package/build-module/ui/utils/space.js +1 -1
  347. package/build-module/ui/utils/space.js.map +1 -1
  348. package/build-module/unit-control/index.js +2 -2
  349. package/build-module/unit-control/index.js.map +1 -1
  350. package/build-module/unit-control/utils.js +20 -20
  351. package/build-module/unit-control/utils.js.map +1 -1
  352. package/build-module/utils/events.js +4 -4
  353. package/build-module/utils/events.js.map +1 -1
  354. package/build-module/utils/hooks/use-controlled-state.js +2 -2
  355. package/build-module/utils/hooks/use-controlled-state.js.map +1 -1
  356. package/build-module/utils/hooks/use-controlled-value.js +4 -4
  357. package/build-module/utils/hooks/use-controlled-value.js.map +1 -1
  358. package/build-module/utils/hooks/use-latest-ref.js +1 -1
  359. package/build-module/utils/hooks/use-latest-ref.js.map +1 -1
  360. package/build-module/utils/unit-values.js +3 -3
  361. package/build-module/utils/unit-values.js.map +1 -1
  362. package/build-style/style-rtl.css +5 -0
  363. package/build-style/style.css +5 -0
  364. package/build-types/alignment-matrix-control/utils.d.ts +4 -4
  365. package/build-types/angle-picker-control/angle-circle.d.ts +6 -0
  366. package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -0
  367. package/build-types/angle-picker-control/index.d.ts +29 -0
  368. package/build-types/angle-picker-control/index.d.ts.map +1 -0
  369. package/build-types/angle-picker-control/stories/index.d.ts +15 -0
  370. package/build-types/angle-picker-control/stories/index.d.ts.map +1 -0
  371. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +20 -0
  372. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -0
  373. package/build-types/angle-picker-control/types.d.ts +26 -0
  374. package/build-types/angle-picker-control/types.d.ts.map +1 -0
  375. package/build-types/base-control/hooks.d.ts +1 -1
  376. package/build-types/border-box-control/border-box-control/component.d.ts +1 -1
  377. package/build-types/border-box-control/border-box-control/hook.d.ts +1 -1
  378. package/build-types/border-box-control/border-box-control-split-controls/component.d.ts +1 -1
  379. package/build-types/border-box-control/border-box-control-split-controls/hook.d.ts +1 -1
  380. package/build-types/border-box-control/stories/index.d.ts +1 -1
  381. package/build-types/border-box-control/test/index.d.ts.map +1 -0
  382. package/build-types/border-box-control/test/utils.d.ts +2 -0
  383. package/build-types/border-box-control/test/utils.d.ts.map +1 -0
  384. package/build-types/box-control/all-input-control.d.ts +4 -0
  385. package/build-types/box-control/all-input-control.d.ts.map +1 -0
  386. package/build-types/box-control/axial-input-controls.d.ts +4 -0
  387. package/build-types/box-control/axial-input-controls.d.ts.map +1 -0
  388. package/build-types/box-control/icon.d.ts +8 -0
  389. package/build-types/box-control/icon.d.ts.map +1 -0
  390. package/build-types/box-control/index.d.ts +31 -0
  391. package/build-types/box-control/index.d.ts.map +1 -0
  392. package/build-types/box-control/input-controls.d.ts +4 -0
  393. package/build-types/box-control/input-controls.d.ts.map +1 -0
  394. package/build-types/box-control/linked-button.d.ts +9 -0
  395. package/build-types/box-control/linked-button.d.ts.map +1 -0
  396. package/build-types/box-control/styles/box-control-icon-styles.d.ts +42 -0
  397. package/build-types/box-control/styles/box-control-icon-styles.d.ts.map +1 -0
  398. package/build-types/box-control/styles/box-control-styles.d.ts +42 -0
  399. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -0
  400. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts +46 -0
  401. package/build-types/box-control/styles/box-control-visualizer-styles.d.ts.map +1 -0
  402. package/build-types/box-control/test/index.d.ts +2 -0
  403. package/build-types/box-control/test/index.d.ts.map +1 -0
  404. package/build-types/box-control/types.d.ts +99 -0
  405. package/build-types/box-control/types.d.ts.map +1 -0
  406. package/build-types/box-control/unit-control.d.ts +4 -0
  407. package/build-types/box-control/unit-control.d.ts.map +1 -0
  408. package/build-types/box-control/utils.d.ts +84 -0
  409. package/build-types/box-control/utils.d.ts.map +1 -0
  410. package/build-types/circular-option-picker/index.d.ts +56 -7
  411. package/build-types/circular-option-picker/index.d.ts.map +1 -1
  412. package/build-types/circular-option-picker/stories/index.d.ts +14 -0
  413. package/build-types/circular-option-picker/stories/index.d.ts.map +1 -0
  414. package/build-types/circular-option-picker/types.d.ts +49 -0
  415. package/build-types/circular-option-picker/types.d.ts.map +1 -0
  416. package/build-types/color-palette/index.d.ts +3 -1
  417. package/build-types/color-palette/index.d.ts.map +1 -1
  418. package/build-types/color-palette/stories/index.d.ts +6 -2
  419. package/build-types/color-palette/stories/index.d.ts.map +1 -1
  420. package/build-types/color-palette/types.d.ts +8 -0
  421. package/build-types/color-palette/types.d.ts.map +1 -1
  422. package/build-types/combobox-control/index.d.ts +51 -0
  423. package/build-types/combobox-control/index.d.ts.map +1 -0
  424. package/build-types/combobox-control/stories/index.d.ts +18 -0
  425. package/build-types/combobox-control/stories/index.d.ts.map +1 -0
  426. package/build-types/combobox-control/styles.d.ts +8 -0
  427. package/build-types/combobox-control/styles.d.ts.map +1 -0
  428. package/build-types/combobox-control/test/index.d.ts +2 -0
  429. package/build-types/combobox-control/test/index.d.ts.map +1 -0
  430. package/build-types/combobox-control/types.d.ts +62 -0
  431. package/build-types/combobox-control/types.d.ts.map +1 -0
  432. package/build-types/date-time/utils.d.ts +1 -1
  433. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +1 -1
  434. package/build-types/focal-point-picker/utils.d.ts +3 -3
  435. package/build-types/font-size-picker/utils.d.ts +2 -2
  436. package/build-types/h-stack/stories/e2e/index.d.ts +9 -0
  437. package/build-types/h-stack/stories/e2e/index.d.ts.map +1 -0
  438. package/build-types/higher-order/with-constrained-tabbing/index.d.ts +10 -1
  439. package/build-types/higher-order/with-constrained-tabbing/index.d.ts.map +1 -1
  440. package/build-types/input-control/reducer/reducer.d.ts +3 -3
  441. package/build-types/input-control/utils.d.ts +1 -1
  442. package/build-types/menu-items-choice/index.d.ts +38 -0
  443. package/build-types/menu-items-choice/index.d.ts.map +1 -0
  444. package/build-types/menu-items-choice/stories/index.d.ts +12 -0
  445. package/build-types/menu-items-choice/stories/index.d.ts.map +1 -0
  446. package/build-types/menu-items-choice/types.d.ts +53 -0
  447. package/build-types/menu-items-choice/types.d.ts.map +1 -0
  448. package/build-types/modal/index.d.ts.map +1 -1
  449. package/build-types/modal/types.d.ts +2 -0
  450. package/build-types/modal/types.d.ts.map +1 -1
  451. package/build-types/panel/header.d.ts +13 -0
  452. package/build-types/panel/header.d.ts.map +1 -0
  453. package/build-types/panel/index.d.ts +21 -0
  454. package/build-types/panel/index.d.ts.map +1 -0
  455. package/build-types/panel/row.d.ts +12 -0
  456. package/build-types/panel/row.d.ts.map +1 -0
  457. package/build-types/panel/test/header.d.ts +2 -0
  458. package/build-types/panel/test/header.d.ts.map +1 -0
  459. package/build-types/panel/test/index.d.ts +2 -0
  460. package/build-types/{base-field → panel}/test/index.d.ts.map +1 -1
  461. package/build-types/panel/test/row.d.ts +2 -0
  462. package/build-types/panel/test/row.d.ts.map +1 -0
  463. package/build-types/panel/types.d.ts +38 -0
  464. package/build-types/panel/types.d.ts.map +1 -0
  465. package/build-types/popover/index.d.ts.map +1 -1
  466. package/build-types/popover/overlay-middlewares.d.ts +9 -0
  467. package/build-types/popover/overlay-middlewares.d.ts.map +1 -0
  468. package/build-types/popover/stories/index.d.ts.map +1 -1
  469. package/build-types/popover/types.d.ts +3 -2
  470. package/build-types/popover/types.d.ts.map +1 -1
  471. package/build-types/popover/utils.d.ts +12 -4
  472. package/build-types/popover/utils.d.ts.map +1 -1
  473. package/build-types/query-controls/terms.d.ts +1 -1
  474. package/build-types/range-control/utils.d.ts +4 -4
  475. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts +5 -4
  476. package/build-types/resizable-box/resize-tooltip/styles/resize-tooltip.styles.d.ts.map +1 -1
  477. package/build-types/resizable-box/resize-tooltip/utils.d.ts +6 -6
  478. package/build-types/tab-panel/stories/index.d.ts +1 -0
  479. package/build-types/tab-panel/stories/index.d.ts.map +1 -1
  480. package/build-types/toolbar/index.d.ts +7 -0
  481. package/build-types/toolbar/index.d.ts.map +1 -0
  482. package/build-types/toolbar/stories/index.d.ts +14 -0
  483. package/build-types/toolbar/stories/index.d.ts.map +1 -0
  484. package/build-types/toolbar/test/index.d.ts +2 -0
  485. package/build-types/toolbar/test/index.d.ts.map +1 -0
  486. package/build-types/toolbar/test/toolbar-group.d.ts +2 -0
  487. package/build-types/toolbar/test/toolbar-group.d.ts.map +1 -0
  488. package/build-types/toolbar/toolbar/index.d.ts +25 -0
  489. package/build-types/toolbar/toolbar/index.d.ts.map +1 -0
  490. package/build-types/toolbar/toolbar/toolbar-container.d.ts +5 -0
  491. package/build-types/toolbar/toolbar/toolbar-container.d.ts.map +1 -0
  492. package/build-types/toolbar/toolbar/types.d.ts +15 -0
  493. package/build-types/toolbar/toolbar/types.d.ts.map +1 -0
  494. package/build-types/toolbar/toolbar-button/index.d.ts +12 -0
  495. package/build-types/toolbar/toolbar-button/index.d.ts.map +1 -0
  496. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts +3 -0
  497. package/build-types/toolbar/toolbar-button/toolbar-button-container.d.ts.map +1 -0
  498. package/build-types/toolbar/toolbar-context/index.d.ts +3 -0
  499. package/build-types/toolbar/toolbar-context/index.d.ts.map +1 -0
  500. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts +3 -0
  501. package/build-types/toolbar/toolbar-dropdown-menu/index.d.ts.map +1 -0
  502. package/build-types/toolbar/toolbar-group/index.d.ts +39 -0
  503. package/build-types/toolbar/toolbar-group/index.d.ts.map +1 -0
  504. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts +7 -0
  505. package/build-types/toolbar/toolbar-group/toolbar-group-collapsed.d.ts.map +1 -0
  506. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts +7 -0
  507. package/build-types/toolbar/toolbar-group/toolbar-group-container.d.ts.map +1 -0
  508. package/build-types/toolbar/toolbar-item/index.d.ts +7 -0
  509. package/build-types/toolbar/toolbar-item/index.d.ts.map +1 -0
  510. package/build-types/tools-panel/context.d.ts.map +1 -1
  511. package/build-types/tools-panel/stories/index.d.ts +17 -0
  512. package/build-types/tools-panel/stories/index.d.ts.map +1 -0
  513. package/build-types/tools-panel/test/index.d.ts +2 -0
  514. package/build-types/tools-panel/test/index.d.ts.map +1 -0
  515. package/build-types/tools-panel/tools-panel/component.d.ts +54 -2
  516. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  517. package/build-types/tools-panel/tools-panel/hook.d.ts +5 -2
  518. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  519. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  520. package/build-types/tools-panel/tools-panel-header/hook.d.ts +2 -1
  521. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  522. package/build-types/tools-panel/tools-panel-item/component.d.ts +3 -2
  523. package/build-types/tools-panel/tools-panel-item/component.d.ts.map +1 -1
  524. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  525. package/build-types/tools-panel/types.d.ts +49 -20
  526. package/build-types/tools-panel/types.d.ts.map +1 -1
  527. package/build-types/tree-grid/cell.d.ts +13 -0
  528. package/build-types/tree-grid/cell.d.ts.map +1 -0
  529. package/build-types/tree-grid/index.d.ts +70 -0
  530. package/build-types/tree-grid/index.d.ts.map +1 -0
  531. package/build-types/tree-grid/item.d.ts +12 -0
  532. package/build-types/tree-grid/item.d.ts.map +1 -0
  533. package/build-types/tree-grid/roving-tab-index-context.d.ts +10 -0
  534. package/build-types/tree-grid/roving-tab-index-context.d.ts.map +1 -0
  535. package/build-types/tree-grid/roving-tab-index-item.d.ts +5 -0
  536. package/build-types/tree-grid/roving-tab-index-item.d.ts.map +1 -0
  537. package/build-types/tree-grid/roving-tab-index.d.ts +10 -0
  538. package/build-types/tree-grid/roving-tab-index.d.ts.map +1 -0
  539. package/build-types/tree-grid/row.d.ts +12 -0
  540. package/build-types/tree-grid/row.d.ts.map +1 -0
  541. package/build-types/tree-grid/stories/index.d.ts +13 -0
  542. package/build-types/tree-grid/stories/index.d.ts.map +1 -0
  543. package/build-types/tree-grid/test/cell.d.ts +2 -0
  544. package/build-types/tree-grid/test/cell.d.ts.map +1 -0
  545. package/build-types/tree-grid/test/index.d.ts +2 -0
  546. package/build-types/tree-grid/test/index.d.ts.map +1 -0
  547. package/build-types/tree-grid/test/roving-tab-index-item.d.ts +2 -0
  548. package/build-types/tree-grid/test/roving-tab-index-item.d.ts.map +1 -0
  549. package/build-types/tree-grid/test/roving-tab-index.d.ts +2 -0
  550. package/build-types/tree-grid/test/roving-tab-index.d.ts.map +1 -0
  551. package/build-types/tree-grid/test/row.d.ts +2 -0
  552. package/build-types/tree-grid/test/row.d.ts.map +1 -0
  553. package/build-types/tree-grid/types.d.ts +109 -0
  554. package/build-types/tree-grid/types.d.ts.map +1 -0
  555. package/build-types/ui/context/context-connect.d.ts +7 -7
  556. package/build-types/ui/context/context-system-provider.d.ts.map +1 -1
  557. package/build-types/ui/context/get-styled-class-name-from-key.d.ts +1 -1
  558. package/build-types/ui/utils/get-valid-children.d.ts +1 -1
  559. package/build-types/ui/utils/space.d.ts +1 -1
  560. package/build-types/unit-control/index.d.ts +1 -1
  561. package/build-types/unit-control/utils.d.ts +20 -20
  562. package/build-types/utils/events.d.ts +2 -2
  563. package/build-types/utils/hooks/use-controlled-state.d.ts +1 -1
  564. package/build-types/utils/hooks/use-controlled-state.d.ts.map +1 -1
  565. package/build-types/utils/hooks/use-controlled-value.d.ts +4 -4
  566. package/build-types/utils/hooks/use-latest-ref.d.ts +1 -1
  567. package/build-types/utils/unit-values.d.ts +3 -3
  568. package/build-types/v-stack/stories/e2e/index.d.ts +9 -0
  569. package/build-types/v-stack/stories/e2e/index.d.ts.map +1 -0
  570. package/package.json +21 -19
  571. package/src/alignment-matrix-control/utils.tsx +4 -4
  572. package/src/angle-picker-control/README.md +17 -14
  573. package/src/angle-picker-control/{angle-circle.js → angle-circle.tsx} +44 -12
  574. package/src/angle-picker-control/{index.js → index.tsx} +54 -10
  575. package/src/angle-picker-control/stories/index.tsx +57 -0
  576. package/src/angle-picker-control/styles/{angle-picker-control-styles.js → angle-picker-control-styles.tsx} +5 -1
  577. package/src/angle-picker-control/types.ts +29 -0
  578. package/src/autocomplete/autocompleter-ui.js +72 -34
  579. package/src/autocomplete/autocompleter-ui.native.js +1 -0
  580. package/src/autocomplete/index.js +36 -36
  581. package/src/base-control/hooks.ts +1 -1
  582. package/src/border-box-control/test/{index.js → index.tsx} +76 -102
  583. package/src/border-box-control/test/{utils.js → utils.ts} +20 -0
  584. package/src/border-box-control/utils.ts +1 -1
  585. package/src/box-control/README.md +17 -26
  586. package/src/box-control/{all-input-control.js → all-input-control.tsx} +10 -6
  587. package/src/box-control/{axial-input-controls.js → axial-input-controls.tsx} +29 -24
  588. package/src/box-control/{icon.js → icon.tsx} +9 -4
  589. package/src/box-control/{index.js → index.tsx} +43 -8
  590. package/src/box-control/{input-controls.js → input-controls.tsx} +26 -16
  591. package/src/box-control/{linked-button.js → linked-button.tsx} +4 -1
  592. package/src/box-control/styles/{box-control-icon-styles.js → box-control-icon-styles.ts} +1 -1
  593. package/src/box-control/styles/{box-control-styles.js → box-control-styles.ts} +10 -2
  594. package/src/box-control/styles/{box-control-visualizer-styles.js → box-control-visualizer-styles.ts} +6 -2
  595. package/src/box-control/test/{index.js → index.tsx} +12 -9
  596. package/src/box-control/types.ts +121 -0
  597. package/src/box-control/{unit-control.js → unit-control.tsx} +9 -2
  598. package/src/box-control/{utils.js → utils.ts} +47 -38
  599. package/src/button/test/index.tsx +38 -30
  600. package/src/circular-option-picker/README.md +141 -0
  601. package/src/circular-option-picker/{index.js → index.tsx} +74 -14
  602. package/src/circular-option-picker/stories/index.tsx +134 -0
  603. package/src/circular-option-picker/types.ts +69 -0
  604. package/src/color-palette/README.md +7 -0
  605. package/src/color-palette/index.tsx +6 -1
  606. package/src/color-palette/test/__snapshots__/index.tsx.snap +1 -1
  607. package/src/color-palette/types.ts +8 -0
  608. package/src/combobox-control/README.md +8 -15
  609. package/src/combobox-control/{index.js → index.tsx} +91 -19
  610. package/src/combobox-control/stories/index.tsx +114 -0
  611. package/src/combobox-control/styles.ts +4 -1
  612. package/src/combobox-control/test/{index.js → index.tsx} +9 -7
  613. package/src/combobox-control/types.ts +69 -0
  614. package/src/custom-gradient-picker/index.js +0 -1
  615. package/src/custom-select-control/stories/index.js +1 -1
  616. package/src/date-time/time/index.tsx +1 -1
  617. package/src/date-time/utils.ts +1 -1
  618. package/src/draggable/index.tsx +2 -2
  619. package/src/dropdown-menu/test/index.js +3 -11
  620. package/src/focal-point-picker/utils.ts +3 -3
  621. package/src/font-size-picker/utils.ts +2 -2
  622. package/src/gradient-picker/README.md +8 -0
  623. package/src/gradient-picker/index.js +6 -1
  624. package/src/h-stack/stories/e2e/index.tsx +36 -0
  625. package/src/higher-order/with-constrained-tabbing/index.tsx +30 -0
  626. package/src/input-control/reducer/reducer.ts +5 -5
  627. package/src/input-control/utils.ts +1 -1
  628. package/src/menu-items-choice/index.tsx +83 -0
  629. package/src/menu-items-choice/stories/index.tsx +79 -0
  630. package/src/menu-items-choice/types.ts +54 -0
  631. package/src/mobile/global-styles-context/utils.native.js +1 -0
  632. package/src/modal/index.tsx +45 -1
  633. package/src/modal/style.scss +8 -0
  634. package/src/modal/types.ts +2 -0
  635. package/src/palette-edit/index.js +4 -1
  636. package/src/panel/README.md +2 -2
  637. package/src/panel/header.tsx +20 -0
  638. package/src/panel/index.tsx +48 -0
  639. package/src/panel/row.tsx +37 -0
  640. package/src/panel/stories/index.js +22 -0
  641. package/src/panel/test/{header.js → header.tsx} +1 -1
  642. package/src/panel/test/{index.js → index.tsx} +6 -4
  643. package/src/panel/test/{row.js → row.tsx} +4 -2
  644. package/src/panel/types.ts +38 -0
  645. package/src/popover/README.md +4 -1
  646. package/src/popover/index.tsx +17 -1
  647. package/src/popover/overlay-middlewares.tsx +29 -0
  648. package/src/popover/stories/index.tsx +7 -1
  649. package/src/popover/test/index.tsx +29 -21
  650. package/src/popover/types.ts +4 -2
  651. package/src/popover/utils.ts +39 -3
  652. package/src/query-controls/terms.ts +1 -1
  653. package/src/range-control/utils.ts +4 -4
  654. package/src/resizable-box/resize-tooltip/utils.ts +14 -14
  655. package/src/snackbar/index.tsx +2 -2
  656. package/src/tab-panel/stories/index.tsx +41 -0
  657. package/src/tab-panel/test/index.tsx +794 -262
  658. package/src/toolbar/stories/{index.js → index.tsx} +39 -26
  659. package/src/toolbar/test/{toolbar-group.js → toolbar-group.tsx} +2 -2
  660. package/src/toolbar/toolbar/README.md +7 -2
  661. package/src/toolbar/toolbar/{index.js → index.tsx} +33 -12
  662. package/src/toolbar/toolbar/{toolbar-container.js → toolbar-container.tsx} +9 -2
  663. package/src/toolbar/toolbar/types.ts +15 -0
  664. package/src/toolbar/toolbar-button/index.js +2 -0
  665. package/src/toolbar/toolbar-button/toolbar-button-container.js +2 -0
  666. package/src/toolbar/toolbar-context/index.js +2 -0
  667. package/src/toolbar/toolbar-dropdown-menu/index.js +2 -0
  668. package/src/toolbar/toolbar-group/index.js +2 -0
  669. package/src/toolbar/toolbar-group/toolbar-group-collapsed.js +2 -0
  670. package/src/toolbar/toolbar-group/toolbar-group-container.js +2 -0
  671. package/src/toolbar/toolbar-item/index.js +2 -0
  672. package/src/tools-panel/context.ts +2 -0
  673. package/src/tools-panel/stories/{index.js → index.tsx} +196 -95
  674. package/src/tools-panel/test/{index.js → index.tsx} +177 -67
  675. package/src/tools-panel/tools-panel/README.md +12 -4
  676. package/src/tools-panel/tools-panel/component.tsx +57 -3
  677. package/src/tools-panel/tools-panel/hook.ts +34 -13
  678. package/src/tools-panel/tools-panel-header/README.md +7 -0
  679. package/src/tools-panel/tools-panel-header/component.tsx +2 -1
  680. package/src/tools-panel/tools-panel-header/hook.ts +6 -4
  681. package/src/tools-panel/tools-panel-item/README.md +6 -4
  682. package/src/tools-panel/tools-panel-item/component.tsx +4 -4
  683. package/src/tools-panel/tools-panel-item/hook.ts +22 -4
  684. package/src/tools-panel/types.ts +51 -20
  685. package/src/tree-grid/README.md +18 -58
  686. package/src/tree-grid/cell.tsx +41 -0
  687. package/src/tree-grid/{index.js → index.tsx} +111 -35
  688. package/src/tree-grid/item.tsx +32 -0
  689. package/src/tree-grid/{roving-tab-index-context.js → roving-tab-index-context.ts} +9 -1
  690. package/src/tree-grid/roving-tab-index-item.tsx +50 -0
  691. package/src/tree-grid/{roving-tab-index.js → roving-tab-index.tsx} +7 -5
  692. package/src/tree-grid/row.tsx +47 -0
  693. package/src/tree-grid/stories/index.tsx +144 -0
  694. package/src/tree-grid/test/__snapshots__/index.tsx.snap +3 -0
  695. package/src/tree-grid/test/{cell.js → cell.tsx} +7 -4
  696. package/src/tree-grid/test/{index.js → index.tsx} +13 -5
  697. package/src/tree-grid/test/{roving-tab-index-item.js → roving-tab-index-item.tsx} +7 -4
  698. package/src/tree-grid/test/{row.js → row.tsx} +4 -4
  699. package/src/tree-grid/types.ts +116 -0
  700. package/src/ui/context/context-connect.ts +7 -7
  701. package/src/ui/context/context-system-provider.js +7 -4
  702. package/src/ui/context/get-styled-class-name-from-key.ts +1 -1
  703. package/src/ui/utils/get-valid-children.ts +1 -1
  704. package/src/ui/utils/space.ts +1 -1
  705. package/src/unit-control/index.tsx +2 -2
  706. package/src/unit-control/utils.ts +20 -20
  707. package/src/utils/events.ts +4 -4
  708. package/src/utils/hooks/use-controlled-state.js +2 -2
  709. package/src/utils/hooks/use-controlled-value.ts +4 -4
  710. package/src/utils/hooks/use-latest-ref.ts +1 -1
  711. package/src/utils/unit-values.ts +3 -3
  712. package/src/v-stack/stories/e2e/index.tsx +36 -0
  713. package/tsconfig.json +1 -7
  714. package/tsconfig.tsbuildinfo +1 -1
  715. package/build/base-field/hook.js +0 -54
  716. package/build/base-field/hook.js.map +0 -1
  717. package/build/base-field/index.js +0 -14
  718. package/build/base-field/index.js.map +0 -1
  719. package/build/base-field/styles.js +0 -33
  720. package/build/base-field/styles.js.map +0 -1
  721. package/build/resizable-box/styles/resizable-box.styles.js +0 -2
  722. package/build-module/base-field/hook.js +0 -37
  723. package/build-module/base-field/hook.js.map +0 -1
  724. package/build-module/base-field/index.js +0 -2
  725. package/build-module/base-field/index.js.map +0 -1
  726. package/build-module/base-field/styles.js +0 -18
  727. package/build-module/base-field/styles.js.map +0 -1
  728. package/build-module/resizable-box/styles/resizable-box.styles.js +0 -2
  729. package/build-types/base-field/hook.d.ts +0 -270
  730. package/build-types/base-field/hook.d.ts.map +0 -1
  731. package/build-types/base-field/index.d.ts +0 -2
  732. package/build-types/base-field/index.d.ts.map +0 -1
  733. package/build-types/base-field/styles.d.ts +0 -6
  734. package/build-types/base-field/styles.d.ts.map +0 -1
  735. package/build-types/base-field/types.d.ts +0 -29
  736. package/build-types/base-field/types.d.ts.map +0 -1
  737. package/build-types/resizable-box/styles/resizable-box.styles.d.ts +0 -1
  738. package/build-types/resizable-box/styles/resizable-box.styles.d.ts.map +0 -1
  739. package/src/angle-picker-control/stories/index.js +0 -29
  740. package/src/base-field/README.md +0 -66
  741. package/src/base-field/hook.ts +0 -51
  742. package/src/base-field/index.ts +0 -1
  743. package/src/base-field/styles.ts +0 -86
  744. package/src/base-field/test/__snapshots__/index.tsx.snap +0 -141
  745. package/src/base-field/test/index.tsx +0 -84
  746. package/src/base-field/types.ts +0 -29
  747. package/src/combobox-control/stories/index.js +0 -339
  748. package/src/higher-order/with-constrained-tabbing/index.js +0 -22
  749. package/src/menu-items-choice/index.js +0 -43
  750. package/src/panel/header.js +0 -10
  751. package/src/panel/index.js +0 -26
  752. package/src/panel/row.js +0 -20
  753. package/src/resizable-box/styles/resizable-box.styles.js +0 -0
  754. package/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +0 -246
  755. package/src/tree-grid/cell.js +0 -24
  756. package/src/tree-grid/item.js +0 -20
  757. package/src/tree-grid/roving-tab-index-item.js +0 -33
  758. package/src/tree-grid/row.js +0 -31
  759. package/src/tree-grid/stories/index.js +0 -106
  760. package/src/tree-grid/test/__snapshots__/index.js.snap +0 -3
  761. /package/build/{base-field → angle-picker-control}/types.js +0 -0
  762. /package/build-module/{base-field → angle-picker-control}/types.js +0 -0
  763. /package/build-module/{base-field → angle-picker-control}/types.js.map +0 -0
  764. /package/{build/base-field → build-module/box-control}/types.js.map +0 -0
  765. /package/build-module/{resizable-box/styles/resizable-box.styles.js.map → circular-option-picker/types.js.map} +0 -0
  766. /package/{build/resizable-box/styles/resizable-box.styles.js.map → build-module/combobox-control/types.js.map} +0 -0
  767. /package/build-types/{base-field → border-box-control}/test/index.d.ts +0 -0
  768. /package/src/panel/test/__snapshots__/{header.js.snap → header.tsx.snap} +0 -0
  769. /package/src/panel/test/__snapshots__/{index.js.snap → index.tsx.snap} +0 -0
  770. /package/src/panel/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  771. /package/src/resizable-box/resize-tooltip/styles/{resize-tooltip.styles.js → resize-tooltip.styles.ts} +0 -0
  772. /package/src/toolbar/test/{index.js → index.tsx} +0 -0
  773. /package/src/tree-grid/test/__snapshots__/{cell.js.snap → cell.tsx.snap} +0 -0
  774. /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.js.snap → roving-tab-index-item.tsx.snap} +0 -0
  775. /package/src/tree-grid/test/__snapshots__/{roving-tab-index.js.snap → roving-tab-index.tsx.snap} +0 -0
  776. /package/src/tree-grid/test/__snapshots__/{row.js.snap → row.tsx.snap} +0 -0
  777. /package/src/tree-grid/test/{roving-tab-index.js → roving-tab-index.tsx} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/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,GAAmB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,CAACC,OAAT,CAAiBpB,eAAjB,iBAAkCzB,KAAK,CAACJ,KAAxC,uDAAiD,EAAjD,EAAqD;AACpDyB,QAAAA,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"]}
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;AAC3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Event } 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;AAC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AACK,OAAN,IAAiBR,KAAK,CAACE,KAAN,KAAgBK,aAAtC,EACJH,QAAQ,CAAE,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"]}
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,CAAyBC,KAAzB,CAA+BC,MAA/B,GAAwCN,UAAxC;AACA,KAFD,MAEO;AACN;AACAG,MAAAA,QAAQ,CAACC,eAAT,CAAyBC,KAAzB,CAA+BC,MAA/B,GAAwC,IAAxC;AACA;AACD,GAPD,EAOG,CAAEJ,UAAF,EAAcF,UAAd,CAPH;AASA,SAAOA,UAAP;AACA;;AAEM,SAASO,QAAT,CAAmBC,KAAnB,EAIH;AACH,QAAMC,gBAAgB,GAAG,qBAAQD,KAAK,CAACE,KAAd,CAAzB;AACA,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsB,uBAGvB,EAHuB,CAA5B;AAIA,QAAMF,KAAK,GAAGC,KAAK,CAACD,KAAN,KAAgBG,SAAhB,GAA4BF,KAAK,CAACD,KAAlC,GAA0CF,KAAK,CAACE,KAA9D,CANG,CAQH;AACA;AACA;;AACA,gCAAiB,MAAM;AACtB,UAAM;AAAEI,MAAAA,OAAO,EAAEC;AAAX,QAA6BN,gBAAnC;AACAA,IAAAA,gBAAgB,CAACK,OAAjB,GAA2BN,KAAK,CAACE,KAAjC;AACA,QAAKC,KAAK,CAACD,KAAN,KAAgBG,SAAhB,IAA6B,CAAEF,KAAK,CAACK,OAA1C,EACCJ,QAAQ,CAAE,EAAE,GAAGD,KAAL;AAAYK,MAAAA,OAAO,EAAE;AAArB,KAAF,CAAR,CADD,KAEK,IAAKL,KAAK,CAACK,OAAN,IAAiBR,KAAK,CAACE,KAAN,KAAgBK,aAAtC,EACJH,QAAQ,CAAE,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"]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
@@ -396,7 +396,8 @@ function getGlobalStyles(rawStyles, rawFeatures) {
396
396
  typography: {
397
397
  fontSizes,
398
398
  customLineHeight: features === null || features === void 0 ? void 0 : (_features$custom = features.custom) === null || _features$custom === void 0 ? void 0 : _features$custom['line-height']
399
- }
399
+ },
400
+ spacing: features === null || features === void 0 ? void 0 : features.spacing
400
401
  },
401
402
  __experimentalGlobalStylesBaseStyles: globalStyles
402
403
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/mobile/global-styles-context/utils.native.js"],"names":["BLOCK_STYLE_ATTRIBUTES","BLOCK_STYLE_ATTRIBUTES_MAPPING","textColor","text","background","link","placeholder","PADDING","UNKNOWN_VALUE","DEFAULT_FONT_SIZE","getBlockPaddings","mergedStyle","wrapperPropsStyle","blockStyleAttributes","blockColors","blockPaddings","padding","backgroundColor","undefined","getBlockColors","defaultColors","blockName","baseGlobalStyles","blockStyles","customBlockStyles","style","color","blockGlobalStyles","blocks","Object","entries","forEach","key","value","styleKey","styles","elements","linkColor","isCustomColor","startsWith","mappedColor","values","find","slug","getBlockTypography","fontSizes","typographyStyles","typography","parsedFontSizes","fontSize","lineHeight","parseInt","mappedFontSize","size","parseStylesVariables","mappedValues","customValues","stylesBase","variables","variable","regex","RegExp","varRegex","fontSizeRegex","replace","_$1","$2","path","split","mappedPresetValue","matchedValue","customValuesData","JSON","parse","reduce","prev","curr","slice","length","width","height","Dimensions","get","parsedFontSize","getMappedValues","features","palette","colors","theme","custom","default","normalizeFontSizes","normalizedFontSizes","dimensions","map","fontSizeObject","sizePx","useMobileGlobalStylesColors","type","colorGradientSettings","availableThemeColors","origin","concat","colorPalette","editorDefaultPalette","getColorsAndGradients","defaultEditorColors","defaultEditorGradients","rawFeatures","__experimentalGlobalStylesBaseStyles","__experimentalFeatures","gradients","defaultPalette","defaultGradients","getGlobalStyles","rawStyles","stringify","globalStyles","customLineHeight"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAOO,MAAMA,sBAAsB,GAAG,CACrC,WADqC,EAErC,iBAFqC,EAGrC,OAHqC,EAIrC,OAJqC,EAKrC,UALqC,CAA/B,C,CAQP;;;AACA,MAAMC,8BAA8B,GAAG;AACtCC,EAAAA,SAAS,EAAE,OAD2B;AAEtCC,EAAAA,IAAI,EAAE,OAFgC;AAGtCC,EAAAA,UAAU,EAAE,iBAH0B;AAItCC,EAAAA,IAAI,EAAE,WAJgC;AAKtCC,EAAAA,WAAW,EAAE;AALyB,CAAvC;AAQA,MAAMC,OAAO,GAAG,EAAhB,C,CAAoB;;AACpB,MAAMC,aAAa,GAAG,WAAtB;AACA,MAAMC,iBAAiB,GAAG,EAA1B;;AAEO,SAASC,gBAAT,CACNC,WADM,EAENC,iBAFM,EAGNC,oBAHM,EAINC,WAJM,EAKL;AACD,QAAMC,aAAa,GAAG,EAAtB;;AAEA,MACC,CAAEJ,WAAW,CAACK,OAAd,KACEJ,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,IAAAA,iBAAiB,CAAEK,eAAnB,IACDJ,oBADC,aACDA,oBADC,eACDA,oBAAoB,CAAEI,eADrB,IAEDH,WAFC,aAEDA,WAFC,eAEDA,WAAW,CAAEG,eAHd,CADD,EAKE;AACDF,IAAAA,aAAa,CAACC,OAAd,GAAwBT,OAAxB;AACA,WAAOQ,aAAP;AACA,GAXA,CAaD;;;AACA,MACCJ,WAAW,SAAX,IAAAA,WAAW,WAAX,IAAAA,WAAW,CAAEK,OAAb,IACA,EAAEJ,iBAAF,aAAEA,iBAAF,eAAEA,iBAAiB,CAAEK,eAArB,CADA,IAEA,EAAEJ,oBAAF,a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,QAAAA,OAAO,EAAEC,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAED,OADX;AAENyB,QAAAA,SAFM;AAGN5G,QAAAA,IAAI,0BAAEkF,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBvB,IAAnB,uEAA2B,IAHzB;AAINC,QAAAA,UAAU,2BAAEiF,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBtB,UAAnB,yEAAiC,IAJrC;AAKN4G,QAAAA,cAAc,2BAAE3B,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBsF,cAAnB,yEAAqC,IAL7C;AAMNC,QAAAA,gBAAgB,4BAAE5B,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBuF,gBAAnB,2EAAuC;AANjD,OADgB;AASvBlE,MAAAA,UAAU,EAAE;AACXF,QAAAA,SADW;AAEXyE,QAAAA,gBAAgB,EAAEjC,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAEI,MAAZ,qDAAE,iBAAoB,aAApB;AAFP;AATW,KADlB;AAeNoB,IAAAA,oCAAoC,EAAEQ;AAfhC,GAAP;AAiBA","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\nimport { get } from 'lodash';\nimport { Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetPxFromCssUnit,\n\tuseSetting,\n\tuseMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\n\nexport const BLOCK_STYLE_ATTRIBUTES = [\n\t'textColor',\n\t'backgroundColor',\n\t'style',\n\t'color',\n\t'fontSize',\n];\n\n// Mapping style properties name to native.\nconst BLOCK_STYLE_ATTRIBUTES_MAPPING = {\n\ttextColor: 'color',\n\ttext: 'color',\n\tbackground: 'backgroundColor',\n\tlink: 'linkColor',\n\tplaceholder: 'placeholderColor',\n};\n\nconst PADDING = 12; // $solid-border-space\nconst UNKNOWN_VALUE = 'undefined';\nconst DEFAULT_FONT_SIZE = 16;\n\nexport function getBlockPaddings(\n\tmergedStyle,\n\twrapperPropsStyle,\n\tblockStyleAttributes,\n\tblockColors\n) {\n\tconst blockPaddings = {};\n\n\tif (\n\t\t! mergedStyle.padding &&\n\t\t( wrapperPropsStyle?.backgroundColor ||\n\t\t\tblockStyleAttributes?.backgroundColor ||\n\t\t\tblockColors?.backgroundColor )\n\t) {\n\t\tblockPaddings.padding = PADDING;\n\t\treturn blockPaddings;\n\t}\n\n\t// Prevent adding extra paddings to inner blocks without background colors.\n\tif (\n\t\tmergedStyle?.padding &&\n\t\t! wrapperPropsStyle?.backgroundColor &&\n\t\t! blockStyleAttributes?.backgroundColor &&\n\t\t! blockColors?.backgroundColor\n\t) {\n\t\tblockPaddings.padding = undefined;\n\t}\n\n\treturn blockPaddings;\n}\n\nexport function getBlockColors(\n\tblockStyleAttributes,\n\tdefaultColors,\n\tblockName,\n\tbaseGlobalStyles\n) {\n\tconst blockStyles = {};\n\tconst customBlockStyles = blockStyleAttributes?.style?.color || {};\n\tconst blockGlobalStyles = baseGlobalStyles?.blocks?.[ blockName ];\n\n\t// Global styles colors.\n\tif ( blockGlobalStyles?.color ) {\n\t\tObject.entries( blockGlobalStyles.color ).forEach(\n\t\t\t( [ key, value ] ) => {\n\t\t\t\tconst styleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING[ key ];\n\n\t\t\t\tif ( styleKey && value !== UNKNOWN_VALUE ) {\n\t\t\t\t\tconst color = customBlockStyles[ key ] ?? value;\n\t\t\t\t\tblockStyles[ styleKey ] = color;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t} else if ( baseGlobalStyles?.styles?.color?.text ) {\n\t\tblockStyles[ BLOCK_STYLE_ATTRIBUTES_MAPPING.text ] =\n\t\t\tbaseGlobalStyles?.styles?.color?.text;\n\t}\n\n\t// Global styles elements.\n\tif ( blockGlobalStyles?.elements ) {\n\t\tconst linkColor = blockGlobalStyles.elements?.link?.color?.text;\n\t\tconst styleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING.link;\n\n\t\tif ( styleKey && linkColor && linkColor !== UNKNOWN_VALUE ) {\n\t\t\tblockStyles[ styleKey ] = linkColor;\n\t\t}\n\t}\n\n\t// Custom colors.\n\tObject.entries( blockStyleAttributes ).forEach( ( [ key, value ] ) => {\n\t\tconst isCustomColor = value?.startsWith?.( '#' );\n\t\tlet styleKey = key;\n\n\t\tif ( BLOCK_STYLE_ATTRIBUTES_MAPPING[ styleKey ] ) {\n\t\t\tstyleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING[ styleKey ];\n\t\t}\n\n\t\tif ( ! isCustomColor ) {\n\t\t\tconst mappedColor = Object.values( defaultColors ?? {} ).find(\n\t\t\t\t( { slug } ) => slug === value\n\t\t\t);\n\n\t\t\tif ( mappedColor ) {\n\t\t\t\tblockStyles[ styleKey ] = mappedColor.color;\n\t\t\t}\n\t\t} else {\n\t\t\tblockStyles[ styleKey ] = value;\n\t\t}\n\t} );\n\n\t// Color placeholder.\n\tif ( blockStyles?.color ) {\n\t\tblockStyles[ BLOCK_STYLE_ATTRIBUTES_MAPPING.placeholder ] =\n\t\t\tblockStyles.color;\n\t}\n\n\treturn blockStyles;\n}\n\nexport function getBlockTypography(\n\tblockStyleAttributes,\n\tfontSizes,\n\tblockName,\n\tbaseGlobalStyles\n) {\n\tconst typographyStyles = {};\n\tconst customBlockStyles = blockStyleAttributes?.style?.typography || {};\n\tconst blockGlobalStyles = baseGlobalStyles?.blocks?.[ blockName ];\n\tconst parsedFontSizes = Object.values( fontSizes ?? {} );\n\n\t// Global styles.\n\tif ( blockGlobalStyles?.typography ) {\n\t\tconst fontSize = blockGlobalStyles?.typography?.fontSize;\n\t\tconst lineHeight = blockGlobalStyles?.typography?.lineHeight;\n\n\t\tif ( fontSize ) {\n\t\t\tif ( parseInt( fontSize, 10 ) ) {\n\t\t\t\ttypographyStyles.fontSize = fontSize;\n\t\t\t} else {\n\t\t\t\tconst mappedFontSize = parsedFontSizes.find(\n\t\t\t\t\t( { slug } ) => slug === fontSize\n\t\t\t\t);\n\n\t\t\t\tif ( mappedFontSize ) {\n\t\t\t\t\ttypographyStyles.fontSize = mappedFontSize?.size;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( lineHeight ) {\n\t\t\ttypographyStyles.lineHeight = lineHeight;\n\t\t}\n\t}\n\n\tif ( blockStyleAttributes?.fontSize && baseGlobalStyles ) {\n\t\tconst mappedFontSize = parsedFontSizes.find(\n\t\t\t( { slug } ) => slug === blockStyleAttributes?.fontSize\n\t\t);\n\n\t\tif ( mappedFontSize ) {\n\t\t\ttypographyStyles.fontSize = mappedFontSize?.size;\n\t\t}\n\t}\n\n\t// Custom styles.\n\tif ( customBlockStyles?.fontSize ) {\n\t\ttypographyStyles.fontSize = customBlockStyles?.fontSize;\n\t}\n\n\tif ( customBlockStyles?.lineHeight ) {\n\t\ttypographyStyles.lineHeight = customBlockStyles?.lineHeight;\n\t}\n\n\treturn typographyStyles;\n}\n\nexport function parseStylesVariables( styles, mappedValues, customValues ) {\n\tlet stylesBase = styles;\n\tconst variables = [ 'preset', 'custom', 'var', 'fontSize' ];\n\n\tif ( ! stylesBase ) {\n\t\treturn styles;\n\t}\n\n\tvariables.forEach( ( variable ) => {\n\t\t// Examples\n\t\t// var(--wp--preset--color--gray)\n\t\t// var(--wp--custom--body--typography--font-family)\n\t\t// var:preset|color|custom-color-2\n\t\tconst regex = new RegExp( `var\\\\(--wp--${ variable }--(.*?)\\\\)`, 'g' );\n\t\tconst varRegex = /\\\"var:preset\\|color\\|(.*?)\\\"/gm;\n\t\tconst fontSizeRegex = /\"fontSize\":\"(.*?)\"/gm;\n\n\t\tif ( variable === 'preset' ) {\n\t\t\tstylesBase = stylesBase.replace( regex, ( _$1, $2 ) => {\n\t\t\t\tconst path = $2.split( '--' );\n\t\t\t\tconst mappedPresetValue = mappedValues[ path[ 0 ] ];\n\t\t\t\tif ( mappedPresetValue && mappedPresetValue.slug ) {\n\t\t\t\t\tconst matchedValue = Object.values(\n\t\t\t\t\t\tmappedPresetValue.values ?? {}\n\t\t\t\t\t).find( ( { slug } ) => slug === path[ 1 ] );\n\t\t\t\t\treturn matchedValue?.[ mappedPresetValue.slug ];\n\t\t\t\t}\n\t\t\t\treturn UNKNOWN_VALUE;\n\t\t\t} );\n\t\t}\n\t\tif ( variable === 'custom' ) {\n\t\t\tconst customValuesData = customValues ?? JSON.parse( stylesBase );\n\t\t\tstylesBase = stylesBase.replace( regex, ( _$1, $2 ) => {\n\t\t\t\tconst path = $2.split( '--' );\n\t\t\t\tif (\n\t\t\t\t\tpath.reduce(\n\t\t\t\t\t\t( prev, curr ) => prev && prev[ curr ],\n\t\t\t\t\t\tcustomValuesData\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn get( customValuesData, path );\n\t\t\t\t}\n\n\t\t\t\t// Check for camelcase properties.\n\t\t\t\treturn get( customValuesData, [\n\t\t\t\t\t...path.slice( 0, path.length - 1 ),\n\t\t\t\t\tcamelCase( path[ path.length - 1 ] ),\n\t\t\t\t] );\n\t\t\t} );\n\t\t}\n\n\t\tif ( variable === 'var' ) {\n\t\t\tstylesBase = stylesBase.replace( varRegex, ( _$1, $2 ) => {\n\t\t\t\tif ( mappedValues?.color ) {\n\t\t\t\t\tconst matchedValue = mappedValues.color?.values?.find(\n\t\t\t\t\t\t( { slug } ) => slug === $2\n\t\t\t\t\t);\n\t\t\t\t\treturn `\"${ matchedValue?.color }\"`;\n\t\t\t\t}\n\t\t\t\treturn UNKNOWN_VALUE;\n\t\t\t} );\n\t\t}\n\n\t\tif ( variable === 'fontSize' ) {\n\t\t\tconst { width, height } = Dimensions.get( 'window' );\n\n\t\t\tstylesBase = stylesBase.replace( fontSizeRegex, ( _$1, $2 ) => {\n\t\t\t\tconst parsedFontSize =\n\t\t\t\t\tgetPxFromCssUnit( $2, {\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\tfontSize: DEFAULT_FONT_SIZE,\n\t\t\t\t\t} ) || `${ DEFAULT_FONT_SIZE }px`;\n\n\t\t\t\treturn `\"fontSize\":\"${ parsedFontSize }\"`;\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn JSON.parse( stylesBase );\n}\n\nexport function getMappedValues( features, palette ) {\n\tconst typography = features?.typography;\n\tconst colors = [\n\t\t...( palette?.theme || [] ),\n\t\t...( palette?.custom || [] ),\n\t\t...( palette?.default || [] ),\n\t];\n\n\tconst fontSizes = {\n\t\t...typography?.fontSizes?.theme,\n\t\t...typography?.fontSizes?.custom,\n\t};\n\tconst mappedValues = {\n\t\tcolor: {\n\t\t\tvalues: colors,\n\t\t\tslug: 'color',\n\t\t},\n\t\t'font-size': {\n\t\t\tvalues: fontSizes,\n\t\t\tslug: 'size',\n\t\t},\n\t};\n\treturn mappedValues;\n}\n\n/**\n * Returns the normalized fontSizes to include the sizePx value for each of the different sizes.\n *\n * @param {Object} fontSizes found in global styles.\n * @return {Object} normalized sizes.\n */\nfunction normalizeFontSizes( fontSizes ) {\n\t// Adds normalized PX values for each of the different keys.\n\tif ( ! fontSizes ) {\n\t\treturn fontSizes;\n\t}\n\tconst normalizedFontSizes = {};\n\tconst dimensions = Dimensions.get( 'window' );\n\n\t[ 'default', 'theme', 'custom' ].forEach( ( key ) => {\n\t\tif ( fontSizes[ key ] ) {\n\t\t\tnormalizedFontSizes[ key ] = fontSizes[ key ]?.map(\n\t\t\t\t( fontSizeObject ) => {\n\t\t\t\t\tfontSizeObject.sizePx = getPxFromCssUnit(\n\t\t\t\t\t\tfontSizeObject.size,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth: dimensions.width,\n\t\t\t\t\t\t\theight: dimensions.height,\n\t\t\t\t\t\t\tfontSize: DEFAULT_FONT_SIZE,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\treturn fontSizeObject;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn normalizedFontSizes;\n}\n\nexport function useMobileGlobalStylesColors( type = 'colors' ) {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst availableThemeColors = colorGradientSettings?.[ type ]?.reduce(\n\t\t( colors, origin ) => colors.concat( origin?.[ type ] ),\n\t\t[]\n\t);\n\t// Default editor colors/gradients if it's not a block-based theme.\n\tconst colorPalette =\n\t\ttype === 'colors' ? 'color.palette' : 'color.gradients';\n\tconst editorDefaultPalette = useSetting( colorPalette );\n\n\treturn availableThemeColors.length >= 1\n\t\t? availableThemeColors\n\t\t: editorDefaultPalette;\n}\n\nexport function getColorsAndGradients(\n\tdefaultEditorColors = [],\n\tdefaultEditorGradients = [],\n\trawFeatures\n) {\n\tconst features = rawFeatures ? JSON.parse( rawFeatures ) : {};\n\n\treturn {\n\t\t__experimentalGlobalStylesBaseStyles: null,\n\t\t__experimentalFeatures: {\n\t\t\tcolor: {\n\t\t\t\t...( ! features?.color\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: true,\n\t\t\t\t\t\t\tbackground: true,\n\t\t\t\t\t\t\tpalette: {\n\t\t\t\t\t\t\t\tdefault: defaultEditorColors,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgradients: {\n\t\t\t\t\t\t\t\tdefault: defaultEditorGradients,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: features?.color ),\n\t\t\t\tdefaultPalette: defaultEditorColors?.length > 0,\n\t\t\t\tdefaultGradients: defaultEditorGradients?.length > 0,\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport function getGlobalStyles( rawStyles, rawFeatures ) {\n\tconst features = rawFeatures ? JSON.parse( rawFeatures ) : {};\n\tconst mappedValues = getMappedValues( features, features?.color?.palette );\n\tconst colors = parseStylesVariables(\n\t\tJSON.stringify( features?.color ),\n\t\tmappedValues\n\t);\n\tconst gradients = parseStylesVariables(\n\t\tJSON.stringify( features?.color?.gradients ),\n\t\tmappedValues\n\t);\n\tconst customValues = parseStylesVariables(\n\t\tJSON.stringify( features?.custom ),\n\t\tmappedValues\n\t);\n\tconst globalStyles = parseStylesVariables(\n\t\trawStyles,\n\t\tmappedValues,\n\t\tcustomValues\n\t);\n\n\tconst fontSizes = normalizeFontSizes( features?.typography?.fontSizes );\n\n\treturn {\n\t\t__experimentalFeatures: {\n\t\t\tcolor: {\n\t\t\t\tpalette: colors?.palette,\n\t\t\t\tgradients,\n\t\t\t\ttext: features?.color?.text ?? true,\n\t\t\t\tbackground: features?.color?.background ?? true,\n\t\t\t\tdefaultPalette: features?.color?.defaultPalette ?? true,\n\t\t\t\tdefaultGradients: features?.color?.defaultGradients ?? true,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontSizes,\n\t\t\t\tcustomLineHeight: features?.custom?.[ 'line-height' ],\n\t\t\t},\n\t\t},\n\t\t__experimentalGlobalStylesBaseStyles: globalStyles,\n\t};\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/mobile/global-styles-context/utils.native.js"],"names":["BLOCK_STYLE_ATTRIBUTES","BLOCK_STYLE_ATTRIBUTES_MAPPING","textColor","text","background","link","placeholder","PADDING","UNKNOWN_VALUE","DEFAULT_FONT_SIZE","getBlockPaddings","mergedStyle","wrapperPropsStyle","blockStyleAttributes","blockColors","blockPaddings","padding","backgroundColor","undefined","getBlockColors","defaultColors","blockName","baseGlobalStyles","blockStyles","customBlockStyles","style","color","blockGlobalStyles","blocks","Object","entries","forEach","key","value","styleKey","styles","elements","linkColor","isCustomColor","startsWith","mappedColor","values","find","slug","getBlockTypography","fontSizes","typographyStyles","typography","parsedFontSizes","fontSize","lineHeight","parseInt","mappedFontSize","size","parseStylesVariables","mappedValues","customValues","stylesBase","variables","variable","regex","RegExp","varRegex","fontSizeRegex","replace","_$1","$2","path","split","mappedPresetValue","matchedValue","customValuesData","JSON","parse","reduce","prev","curr","slice","length","width","height","Dimensions","get","parsedFontSize","getMappedValues","features","palette","colors","theme","custom","default","normalizeFontSizes","normalizedFontSizes","dimensions","map","fontSizeObject","sizePx","useMobileGlobalStylesColors","type","colorGradientSettings","availableThemeColors","origin","concat","colorPalette","editorDefaultPalette","getColorsAndGradients","defaultEditorColors","defaultEditorGradients","rawFeatures","__experimentalGlobalStylesBaseStyles","__experimentalFeatures","gradients","defaultPalette","defaultGradients","getGlobalStyles","rawStyles","stringify","globalStyles","customLineHeight","spacing"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;AAOO,MAAMA,sBAAsB,GAAG,CACrC,WADqC,EAErC,iBAFqC,EAGrC,OAHqC,EAIrC,OAJqC,EAKrC,UALqC,CAA/B,C,CAQP;;;AACA,MAAMC,8BAA8B,GAAG;AACtCC,EAAAA,SAAS,EAAE,OAD2B;AAEtCC,EAAAA,IAAI,EAAE,OAFgC;AAGtCC,EAAAA,UAAU,EAAE,iBAH0B;AAItCC,EAAAA,IAAI,EAAE,WAJgC;AAKtCC,EAAAA,WAAW,EAAE;AALyB,CAAvC;AAQA,MAAMC,OAAO,GAAG,EAAhB,C,CAAoB;;AACpB,MAAMC,aAAa,GAAG,WAAtB;AACA,MAAMC,iBAAiB,GAAG,EAA1B;;AAEO,SAASC,gBAAT,CACNC,WADM,EAENC,iBAFM,EAGNC,oBAHM,EAINC,WAJM,EAKL;AACD,QAAMC,aAAa,GAAG,EAAtB;;AAEA,MACC,CAAEJ,WAAW,CAACK,OAAd,KACEJ,iBAAiB,SAAjB,IAAAA,iBAAiB,WAAjB,IAAAA,iBAAiB,CAAEK,eAAnB,IACDJ,oBADC,aACDA,oBADC,eACDA,oBAAoB,CAAEI,eADrB,IAEDH,WAFC,aAEDA,WAFC,eAEDA,WAAW,CAAEG,eAHd,CADD,EAKE;AACDF,IAAAA,aAAa,CAACC,OAAd,GAAwBT,OAAxB;AACA,WAAOQ,aAAP;AACA,GAXA,CAaD;;;AACA,MACCJ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F,aAAEA,QAAF,+CAAEA,QAAQ,CAAEtC,UAAZ,yDAAE,qBAAsBF,SAAxB,CAApC;AAEA,SAAO;AACNiE,IAAAA,sBAAsB,EAAE;AACvBpF,MAAAA,KAAK,EAAE;AACN4D,QAAAA,OAAO,EAAEC,MAAF,aAAEA,MAAF,uBAAEA,MAAM,CAAED,OADX;AAENyB,QAAAA,SAFM;AAGN5G,QAAAA,IAAI,0BAAEkF,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBvB,IAAnB,uEAA2B,IAHzB;AAINC,QAAAA,UAAU,2BAAEiF,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBtB,UAAnB,yEAAiC,IAJrC;AAKN4G,QAAAA,cAAc,2BAAE3B,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBsF,cAAnB,yEAAqC,IAL7C;AAMNC,QAAAA,gBAAgB,4BAAE5B,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAE3D,KAAZ,qDAAE,iBAAiBuF,gBAAnB,2EAAuC;AANjD,OADgB;AASvBlE,MAAAA,UAAU,EAAE;AACXF,QAAAA,SADW;AAEXyE,QAAAA,gBAAgB,EAAEjC,QAAF,aAAEA,QAAF,2CAAEA,QAAQ,CAAEI,MAAZ,qDAAE,iBAAoB,aAApB;AAFP,OATW;AAavB8B,MAAAA,OAAO,EAAElC,QAAF,aAAEA,QAAF,uBAAEA,QAAQ,CAAEkC;AAbI,KADlB;AAgBNV,IAAAA,oCAAoC,EAAEQ;AAhBhC,GAAP;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { camelCase } from 'change-case';\nimport { get } from 'lodash';\nimport { Dimensions } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetPxFromCssUnit,\n\tuseSetting,\n\tuseMultipleOriginColorsAndGradients,\n} from '@wordpress/block-editor';\n\nexport const BLOCK_STYLE_ATTRIBUTES = [\n\t'textColor',\n\t'backgroundColor',\n\t'style',\n\t'color',\n\t'fontSize',\n];\n\n// Mapping style properties name to native.\nconst BLOCK_STYLE_ATTRIBUTES_MAPPING = {\n\ttextColor: 'color',\n\ttext: 'color',\n\tbackground: 'backgroundColor',\n\tlink: 'linkColor',\n\tplaceholder: 'placeholderColor',\n};\n\nconst PADDING = 12; // $solid-border-space\nconst UNKNOWN_VALUE = 'undefined';\nconst DEFAULT_FONT_SIZE = 16;\n\nexport function getBlockPaddings(\n\tmergedStyle,\n\twrapperPropsStyle,\n\tblockStyleAttributes,\n\tblockColors\n) {\n\tconst blockPaddings = {};\n\n\tif (\n\t\t! mergedStyle.padding &&\n\t\t( wrapperPropsStyle?.backgroundColor ||\n\t\t\tblockStyleAttributes?.backgroundColor ||\n\t\t\tblockColors?.backgroundColor )\n\t) {\n\t\tblockPaddings.padding = PADDING;\n\t\treturn blockPaddings;\n\t}\n\n\t// Prevent adding extra paddings to inner blocks without background colors.\n\tif (\n\t\tmergedStyle?.padding &&\n\t\t! wrapperPropsStyle?.backgroundColor &&\n\t\t! blockStyleAttributes?.backgroundColor &&\n\t\t! blockColors?.backgroundColor\n\t) {\n\t\tblockPaddings.padding = undefined;\n\t}\n\n\treturn blockPaddings;\n}\n\nexport function getBlockColors(\n\tblockStyleAttributes,\n\tdefaultColors,\n\tblockName,\n\tbaseGlobalStyles\n) {\n\tconst blockStyles = {};\n\tconst customBlockStyles = blockStyleAttributes?.style?.color || {};\n\tconst blockGlobalStyles = baseGlobalStyles?.blocks?.[ blockName ];\n\n\t// Global styles colors.\n\tif ( blockGlobalStyles?.color ) {\n\t\tObject.entries( blockGlobalStyles.color ).forEach(\n\t\t\t( [ key, value ] ) => {\n\t\t\t\tconst styleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING[ key ];\n\n\t\t\t\tif ( styleKey && value !== UNKNOWN_VALUE ) {\n\t\t\t\t\tconst color = customBlockStyles[ key ] ?? value;\n\t\t\t\t\tblockStyles[ styleKey ] = color;\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t} else if ( baseGlobalStyles?.styles?.color?.text ) {\n\t\tblockStyles[ BLOCK_STYLE_ATTRIBUTES_MAPPING.text ] =\n\t\t\tbaseGlobalStyles?.styles?.color?.text;\n\t}\n\n\t// Global styles elements.\n\tif ( blockGlobalStyles?.elements ) {\n\t\tconst linkColor = blockGlobalStyles.elements?.link?.color?.text;\n\t\tconst styleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING.link;\n\n\t\tif ( styleKey && linkColor && linkColor !== UNKNOWN_VALUE ) {\n\t\t\tblockStyles[ styleKey ] = linkColor;\n\t\t}\n\t}\n\n\t// Custom colors.\n\tObject.entries( blockStyleAttributes ).forEach( ( [ key, value ] ) => {\n\t\tconst isCustomColor = value?.startsWith?.( '#' );\n\t\tlet styleKey = key;\n\n\t\tif ( BLOCK_STYLE_ATTRIBUTES_MAPPING[ styleKey ] ) {\n\t\t\tstyleKey = BLOCK_STYLE_ATTRIBUTES_MAPPING[ styleKey ];\n\t\t}\n\n\t\tif ( ! isCustomColor ) {\n\t\t\tconst mappedColor = Object.values( defaultColors ?? {} ).find(\n\t\t\t\t( { slug } ) => slug === value\n\t\t\t);\n\n\t\t\tif ( mappedColor ) {\n\t\t\t\tblockStyles[ styleKey ] = mappedColor.color;\n\t\t\t}\n\t\t} else {\n\t\t\tblockStyles[ styleKey ] = value;\n\t\t}\n\t} );\n\n\t// Color placeholder.\n\tif ( blockStyles?.color ) {\n\t\tblockStyles[ BLOCK_STYLE_ATTRIBUTES_MAPPING.placeholder ] =\n\t\t\tblockStyles.color;\n\t}\n\n\treturn blockStyles;\n}\n\nexport function getBlockTypography(\n\tblockStyleAttributes,\n\tfontSizes,\n\tblockName,\n\tbaseGlobalStyles\n) {\n\tconst typographyStyles = {};\n\tconst customBlockStyles = blockStyleAttributes?.style?.typography || {};\n\tconst blockGlobalStyles = baseGlobalStyles?.blocks?.[ blockName ];\n\tconst parsedFontSizes = Object.values( fontSizes ?? {} );\n\n\t// Global styles.\n\tif ( blockGlobalStyles?.typography ) {\n\t\tconst fontSize = blockGlobalStyles?.typography?.fontSize;\n\t\tconst lineHeight = blockGlobalStyles?.typography?.lineHeight;\n\n\t\tif ( fontSize ) {\n\t\t\tif ( parseInt( fontSize, 10 ) ) {\n\t\t\t\ttypographyStyles.fontSize = fontSize;\n\t\t\t} else {\n\t\t\t\tconst mappedFontSize = parsedFontSizes.find(\n\t\t\t\t\t( { slug } ) => slug === fontSize\n\t\t\t\t);\n\n\t\t\t\tif ( mappedFontSize ) {\n\t\t\t\t\ttypographyStyles.fontSize = mappedFontSize?.size;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( lineHeight ) {\n\t\t\ttypographyStyles.lineHeight = lineHeight;\n\t\t}\n\t}\n\n\tif ( blockStyleAttributes?.fontSize && baseGlobalStyles ) {\n\t\tconst mappedFontSize = parsedFontSizes.find(\n\t\t\t( { slug } ) => slug === blockStyleAttributes?.fontSize\n\t\t);\n\n\t\tif ( mappedFontSize ) {\n\t\t\ttypographyStyles.fontSize = mappedFontSize?.size;\n\t\t}\n\t}\n\n\t// Custom styles.\n\tif ( customBlockStyles?.fontSize ) {\n\t\ttypographyStyles.fontSize = customBlockStyles?.fontSize;\n\t}\n\n\tif ( customBlockStyles?.lineHeight ) {\n\t\ttypographyStyles.lineHeight = customBlockStyles?.lineHeight;\n\t}\n\n\treturn typographyStyles;\n}\n\nexport function parseStylesVariables( styles, mappedValues, customValues ) {\n\tlet stylesBase = styles;\n\tconst variables = [ 'preset', 'custom', 'var', 'fontSize' ];\n\n\tif ( ! stylesBase ) {\n\t\treturn styles;\n\t}\n\n\tvariables.forEach( ( variable ) => {\n\t\t// Examples\n\t\t// var(--wp--preset--color--gray)\n\t\t// var(--wp--custom--body--typography--font-family)\n\t\t// var:preset|color|custom-color-2\n\t\tconst regex = new RegExp( `var\\\\(--wp--${ variable }--(.*?)\\\\)`, 'g' );\n\t\tconst varRegex = /\\\"var:preset\\|color\\|(.*?)\\\"/gm;\n\t\tconst fontSizeRegex = /\"fontSize\":\"(.*?)\"/gm;\n\n\t\tif ( variable === 'preset' ) {\n\t\t\tstylesBase = stylesBase.replace( regex, ( _$1, $2 ) => {\n\t\t\t\tconst path = $2.split( '--' );\n\t\t\t\tconst mappedPresetValue = mappedValues[ path[ 0 ] ];\n\t\t\t\tif ( mappedPresetValue && mappedPresetValue.slug ) {\n\t\t\t\t\tconst matchedValue = Object.values(\n\t\t\t\t\t\tmappedPresetValue.values ?? {}\n\t\t\t\t\t).find( ( { slug } ) => slug === path[ 1 ] );\n\t\t\t\t\treturn matchedValue?.[ mappedPresetValue.slug ];\n\t\t\t\t}\n\t\t\t\treturn UNKNOWN_VALUE;\n\t\t\t} );\n\t\t}\n\t\tif ( variable === 'custom' ) {\n\t\t\tconst customValuesData = customValues ?? JSON.parse( stylesBase );\n\t\t\tstylesBase = stylesBase.replace( regex, ( _$1, $2 ) => {\n\t\t\t\tconst path = $2.split( '--' );\n\t\t\t\tif (\n\t\t\t\t\tpath.reduce(\n\t\t\t\t\t\t( prev, curr ) => prev && prev[ curr ],\n\t\t\t\t\t\tcustomValuesData\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\treturn get( customValuesData, path );\n\t\t\t\t}\n\n\t\t\t\t// Check for camelcase properties.\n\t\t\t\treturn get( customValuesData, [\n\t\t\t\t\t...path.slice( 0, path.length - 1 ),\n\t\t\t\t\tcamelCase( path[ path.length - 1 ] ),\n\t\t\t\t] );\n\t\t\t} );\n\t\t}\n\n\t\tif ( variable === 'var' ) {\n\t\t\tstylesBase = stylesBase.replace( varRegex, ( _$1, $2 ) => {\n\t\t\t\tif ( mappedValues?.color ) {\n\t\t\t\t\tconst matchedValue = mappedValues.color?.values?.find(\n\t\t\t\t\t\t( { slug } ) => slug === $2\n\t\t\t\t\t);\n\t\t\t\t\treturn `\"${ matchedValue?.color }\"`;\n\t\t\t\t}\n\t\t\t\treturn UNKNOWN_VALUE;\n\t\t\t} );\n\t\t}\n\n\t\tif ( variable === 'fontSize' ) {\n\t\t\tconst { width, height } = Dimensions.get( 'window' );\n\n\t\t\tstylesBase = stylesBase.replace( fontSizeRegex, ( _$1, $2 ) => {\n\t\t\t\tconst parsedFontSize =\n\t\t\t\t\tgetPxFromCssUnit( $2, {\n\t\t\t\t\t\twidth,\n\t\t\t\t\t\theight,\n\t\t\t\t\t\tfontSize: DEFAULT_FONT_SIZE,\n\t\t\t\t\t} ) || `${ DEFAULT_FONT_SIZE }px`;\n\n\t\t\t\treturn `\"fontSize\":\"${ parsedFontSize }\"`;\n\t\t\t} );\n\t\t}\n\t} );\n\n\treturn JSON.parse( stylesBase );\n}\n\nexport function getMappedValues( features, palette ) {\n\tconst typography = features?.typography;\n\tconst colors = [\n\t\t...( palette?.theme || [] ),\n\t\t...( palette?.custom || [] ),\n\t\t...( palette?.default || [] ),\n\t];\n\n\tconst fontSizes = {\n\t\t...typography?.fontSizes?.theme,\n\t\t...typography?.fontSizes?.custom,\n\t};\n\tconst mappedValues = {\n\t\tcolor: {\n\t\t\tvalues: colors,\n\t\t\tslug: 'color',\n\t\t},\n\t\t'font-size': {\n\t\t\tvalues: fontSizes,\n\t\t\tslug: 'size',\n\t\t},\n\t};\n\treturn mappedValues;\n}\n\n/**\n * Returns the normalized fontSizes to include the sizePx value for each of the different sizes.\n *\n * @param {Object} fontSizes found in global styles.\n * @return {Object} normalized sizes.\n */\nfunction normalizeFontSizes( fontSizes ) {\n\t// Adds normalized PX values for each of the different keys.\n\tif ( ! fontSizes ) {\n\t\treturn fontSizes;\n\t}\n\tconst normalizedFontSizes = {};\n\tconst dimensions = Dimensions.get( 'window' );\n\n\t[ 'default', 'theme', 'custom' ].forEach( ( key ) => {\n\t\tif ( fontSizes[ key ] ) {\n\t\t\tnormalizedFontSizes[ key ] = fontSizes[ key ]?.map(\n\t\t\t\t( fontSizeObject ) => {\n\t\t\t\t\tfontSizeObject.sizePx = getPxFromCssUnit(\n\t\t\t\t\t\tfontSizeObject.size,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twidth: dimensions.width,\n\t\t\t\t\t\t\theight: dimensions.height,\n\t\t\t\t\t\t\tfontSize: DEFAULT_FONT_SIZE,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\treturn fontSizeObject;\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t} );\n\n\treturn normalizedFontSizes;\n}\n\nexport function useMobileGlobalStylesColors( type = 'colors' ) {\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\tconst availableThemeColors = colorGradientSettings?.[ type ]?.reduce(\n\t\t( colors, origin ) => colors.concat( origin?.[ type ] ),\n\t\t[]\n\t);\n\t// Default editor colors/gradients if it's not a block-based theme.\n\tconst colorPalette =\n\t\ttype === 'colors' ? 'color.palette' : 'color.gradients';\n\tconst editorDefaultPalette = useSetting( colorPalette );\n\n\treturn availableThemeColors.length >= 1\n\t\t? availableThemeColors\n\t\t: editorDefaultPalette;\n}\n\nexport function getColorsAndGradients(\n\tdefaultEditorColors = [],\n\tdefaultEditorGradients = [],\n\trawFeatures\n) {\n\tconst features = rawFeatures ? JSON.parse( rawFeatures ) : {};\n\n\treturn {\n\t\t__experimentalGlobalStylesBaseStyles: null,\n\t\t__experimentalFeatures: {\n\t\t\tcolor: {\n\t\t\t\t...( ! features?.color\n\t\t\t\t\t? {\n\t\t\t\t\t\t\ttext: true,\n\t\t\t\t\t\t\tbackground: true,\n\t\t\t\t\t\t\tpalette: {\n\t\t\t\t\t\t\t\tdefault: defaultEditorColors,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tgradients: {\n\t\t\t\t\t\t\t\tdefault: defaultEditorGradients,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: features?.color ),\n\t\t\t\tdefaultPalette: defaultEditorColors?.length > 0,\n\t\t\t\tdefaultGradients: defaultEditorGradients?.length > 0,\n\t\t\t},\n\t\t},\n\t};\n}\n\nexport function getGlobalStyles( rawStyles, rawFeatures ) {\n\tconst features = rawFeatures ? JSON.parse( rawFeatures ) : {};\n\tconst mappedValues = getMappedValues( features, features?.color?.palette );\n\tconst colors = parseStylesVariables(\n\t\tJSON.stringify( features?.color ),\n\t\tmappedValues\n\t);\n\tconst gradients = parseStylesVariables(\n\t\tJSON.stringify( features?.color?.gradients ),\n\t\tmappedValues\n\t);\n\tconst customValues = parseStylesVariables(\n\t\tJSON.stringify( features?.custom ),\n\t\tmappedValues\n\t);\n\tconst globalStyles = parseStylesVariables(\n\t\trawStyles,\n\t\tmappedValues,\n\t\tcustomValues\n\t);\n\n\tconst fontSizes = normalizeFontSizes( features?.typography?.fontSizes );\n\n\treturn {\n\t\t__experimentalFeatures: {\n\t\t\tcolor: {\n\t\t\t\tpalette: colors?.palette,\n\t\t\t\tgradients,\n\t\t\t\ttext: features?.color?.text ?? true,\n\t\t\t\tbackground: features?.color?.background ?? true,\n\t\t\t\tdefaultPalette: features?.color?.defaultPalette ?? true,\n\t\t\t\tdefaultGradients: features?.color?.defaultGradients ?? true,\n\t\t\t},\n\t\t\ttypography: {\n\t\t\t\tfontSizes,\n\t\t\t\tcustomLineHeight: features?.custom?.[ 'line-height' ],\n\t\t\t},\n\t\t\tspacing: features?.spacing,\n\t\t},\n\t\t__experimentalGlobalStylesBaseStyles: globalStyles,\n\t};\n}\n"]}
@@ -19,6 +19,8 @@ var _i18n = require("@wordpress/i18n");
19
19
 
20
20
  var _icons = require("@wordpress/icons");
21
21
 
22
+ var _dom = require("@wordpress/dom");
23
+
22
24
  var ariaHelper = _interopRequireWildcard(require("./aria-helper"));
23
25
 
24
26
  var _button = _interopRequireDefault(require("../button"));
@@ -77,7 +79,24 @@ function UnforwardedModal(props, forwardedRef) {
77
79
  const constrainedTabbingRef = (0, _compose.useConstrainedTabbing)();
78
80
  const focusReturnRef = (0, _compose.useFocusReturn)();
79
81
  const focusOutsideProps = (0, _compose.__experimentalUseFocusOutside)(onRequestClose);
82
+ const contentRef = (0, _element.useRef)(null);
83
+ const childrenContainerRef = (0, _element.useRef)(null);
80
84
  const [hasScrolledContent, setHasScrolledContent] = (0, _element.useState)(false);
85
+ const [hasScrollableContent, setHasScrollableContent] = (0, _element.useState)(false); // Determines whether the Modal content is scrollable and updates the state.
86
+
87
+ const isContentScrollable = (0, _element.useCallback)(() => {
88
+ if (!contentRef.current) {
89
+ return;
90
+ }
91
+
92
+ const closestScrollContainer = (0, _dom.getScrollContainer)(contentRef.current);
93
+
94
+ if (contentRef.current === closestScrollContainer) {
95
+ setHasScrollableContent(true);
96
+ } else {
97
+ setHasScrollableContent(false);
98
+ }
99
+ }, [contentRef]);
81
100
  (0, _element.useEffect)(() => {
82
101
  openModalCount++;
83
102
 
@@ -94,7 +113,20 @@ function UnforwardedModal(props, forwardedRef) {
94
113
  ariaHelper.showApp();
95
114
  }
96
115
  };
97
- }, [bodyOpenClassName]);
116
+ }, [bodyOpenClassName]); // Calls the isContentScrollable callback when the Modal children container resizes.
117
+
118
+ (0, _element.useLayoutEffect)(() => {
119
+ if (!window.ResizeObserver || !childrenContainerRef.current) {
120
+ return;
121
+ }
122
+
123
+ const resizeObserver = new ResizeObserver(isContentScrollable);
124
+ resizeObserver.observe(childrenContainerRef.current);
125
+ isContentScrollable();
126
+ return () => {
127
+ resizeObserver.disconnect();
128
+ };
129
+ }, [isContentScrollable, childrenContainerRef]);
98
130
 
99
131
  function handleEscapeKeyDown(event) {
100
132
  if ( // Ignore keydowns from IMEs
@@ -148,10 +180,14 @@ function UnforwardedModal(props, forwardedRef) {
148
180
  }), (0, _element.createElement)("div", {
149
181
  className: (0, _classnames.default)('components-modal__content', {
150
182
  'hide-header': __experimentalHideHeader,
183
+ 'is-scrollable': hasScrollableContent,
151
184
  'has-scrolled-content': hasScrolledContent
152
185
  }),
153
186
  role: "document",
154
- onScroll: onContentContainerScroll
187
+ onScroll: onContentContainerScroll,
188
+ ref: contentRef,
189
+ "aria-label": hasScrollableContent ? (0, _i18n.__)('Scrollable section') : undefined,
190
+ tabIndex: hasScrollableContent ? 0 : undefined
155
191
  }, !__experimentalHideHeader && (0, _element.createElement)("div", {
156
192
  className: "components-modal__header"
157
193
  }, (0, _element.createElement)("div", {
@@ -166,7 +202,9 @@ function UnforwardedModal(props, forwardedRef) {
166
202
  onClick: onRequestClose,
167
203
  icon: _icons.close,
168
204
  label: closeButtonLabel || (0, _i18n.__)('Close')
169
- })), children)))), document.body);
205
+ })), (0, _element.createElement)("div", {
206
+ ref: childrenContainerRef
207
+ }, children))))), document.body);
170
208
  }
171
209
  /**
172
210
  * Modals give users information and choices related to a task they’re trying to
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/components/src/modal/index.tsx"],"names":["openModalCount","UnforwardedModal","props","forwardedRef","bodyOpenClassName","role","title","focusOnMount","shouldCloseOnEsc","shouldCloseOnClickOutside","isDismissible","aria","labelledby","undefined","describedby","onRequestClose","icon","closeButtonLabel","children","style","overlayClassName","className","contentLabel","onKeyDown","isFullScreen","__experimentalHideHeader","ref","instanceId","Modal","headingId","focusOnMountRef","constrainedTabbingRef","focusReturnRef","focusOutsideProps","hasScrolledContent","setHasScrolledContent","ariaHelper","hideApp","current","document","body","classList","add","remove","showApp","handleEscapeKeyDown","event","nativeEvent","isComposing","keyCode","code","defaultPrevented","preventDefault","onContentContainerScroll","e","scrollY","currentTarget","scrollTop","close"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAcA;;AAQA;;AACA;;AAKA;;AACA;;AACA;;;;;;AAjCA;AACA;AACA;;AAIA;AACA;AACA;;AAoBA;AACA;AACA;AAMA;AACA,IAAIA,cAAc,GAAG,CAArB;;AAEA,SAASC,gBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,iBAAiB,GAAG,YADf;AAELC,IAAAA,IAAI,GAAG,QAFF;AAGLC,IAAAA,KAAK,GAAG,IAHH;AAILC,IAAAA,YAAY,GAAG,IAJV;AAKLC,IAAAA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMZ,KAAK,GAAG,yBAAY3B,gBAAZ,CAAd;;eAEQ2B,K","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, UIEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tforwardRef,\n} from '@wordpress/element';\nimport {\n\tuseInstanceId,\n\tuseFocusReturn,\n\tuseFocusOnMount,\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseConstrainedTabbing,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport type { ModalProps } from './types';\n\n// Used to count the number of open modals.\nlet openModalCount = 0;\n\nfunction UnforwardedModal(\n\tprops: ModalProps,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst {\n\t\tbodyOpenClassName = 'modal-open',\n\t\trole = 'dialog',\n\t\ttitle = null,\n\t\tfocusOnMount = true,\n\t\tshouldCloseOnEsc = true,\n\t\tshouldCloseOnClickOutside = true,\n\t\tisDismissible = true,\n\t\t/* Accessibility. */\n\t\taria = {\n\t\t\tlabelledby: undefined,\n\t\t\tdescribedby: undefined,\n\t\t},\n\t\tonRequestClose,\n\t\ticon,\n\t\tcloseButtonLabel,\n\t\tchildren,\n\t\tstyle,\n\t\toverlayClassName,\n\t\tclassName,\n\t\tcontentLabel,\n\t\tonKeyDown,\n\t\tisFullScreen = false,\n\t\t__experimentalHideHeader = false,\n\t} = props;\n\n\tconst ref = useRef< HTMLDivElement >();\n\tconst instanceId = useInstanceId( Modal );\n\tconst headingId = title\n\t\t? `components-modal-header-${ instanceId }`\n\t\t: aria.labelledby;\n\tconst focusOnMountRef = useFocusOnMount( focusOnMount );\n\tconst constrainedTabbingRef = useConstrainedTabbing();\n\tconst focusReturnRef = useFocusReturn();\n\tconst focusOutsideProps = useFocusOutside( onRequestClose );\n\n\tconst [ hasScrolledContent, setHasScrolledContent ] = useState( false );\n\n\tuseEffect( () => {\n\t\topenModalCount++;\n\n\t\tif ( openModalCount === 1 ) {\n\t\t\tariaHelper.hideApp( ref.current );\n\t\t\tdocument.body.classList.add( bodyOpenClassName );\n\t\t}\n\n\t\treturn () => {\n\t\t\topenModalCount--;\n\n\t\t\tif ( openModalCount === 0 ) {\n\t\t\t\tdocument.body.classList.remove( bodyOpenClassName );\n\t\t\t\tariaHelper.showApp();\n\t\t\t}\n\t\t};\n\t}, [ bodyOpenClassName ] );\n\n\tfunction handleEscapeKeyDown( event: KeyboardEvent< HTMLDivElement > ) {\n\t\tif (\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.nativeEvent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tshouldCloseOnEsc &&\n\t\t\tevent.code === 'Escape' &&\n\t\t\t! event.defaultPrevented\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tif ( onRequestClose ) {\n\t\t\t\tonRequestClose( event );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst onContentContainerScroll = useCallback(\n\t\t( e: UIEvent< HTMLDivElement > ) => {\n\t\t\tconst scrollY = e?.currentTarget?.scrollTop ?? -1;\n\n\t\t\tif ( ! hasScrolledContent && scrollY > 0 ) {\n\t\t\t\tsetHasScrolledContent( true );\n\t\t\t} else if ( hasScrolledContent && scrollY <= 0 ) {\n\t\t\t\tsetHasScrolledContent( false );\n\t\t\t}\n\t\t},\n\t\t[ hasScrolledContent ]\n\t);\n\n\treturn createPortal(\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-modal__screen-overlay',\n\t\t\t\toverlayClassName\n\t\t\t) }\n\t\t\tonKeyDown={ handleEscapeKeyDown }\n\t\t>\n\t\t\t<StyleProvider document={ document }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-modal__frame',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-full-screen': isFullScreen,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t\tconstrainedTabbingRef,\n\t\t\t\t\t\tfocusReturnRef,\n\t\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\t] ) }\n\t\t\t\t\trole={ role }\n\t\t\t\t\taria-label={ contentLabel }\n\t\t\t\t\taria-labelledby={ contentLabel ? undefined : headingId }\n\t\t\t\t\taria-describedby={ aria.describedby }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t{ ...( shouldCloseOnClickOutside\n\t\t\t\t\t\t? focusOutsideProps\n\t\t\t\t\t\t: {} ) }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'components-modal__content', {\n\t\t\t\t\t\t\t'hide-header': __experimentalHideHeader,\n\t\t\t\t\t\t\t'has-scrolled-content': hasScrolledContent,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\trole=\"document\"\n\t\t\t\t\t\tonScroll={ onContentContainerScroll }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! __experimentalHideHeader && (\n\t\t\t\t\t\t\t<div className=\"components-modal__header\">\n\t\t\t\t\t\t\t\t<div className=\"components-modal__header-heading-container\">\n\t\t\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__icon-container\"\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ icon }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ title && (\n\t\t\t\t\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\t\t\t\t\tid={ headingId }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__header-heading\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{ isDismissible && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tonClick={ onRequestClose }\n\t\t\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tcloseButtonLabel || __( 'Close' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ children }\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</StyleProvider>\n\t\t</div>,\n\t\tdocument.body\n\t);\n}\n\n/**\n * Modals give users information and choices related to a task they’re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef( UnforwardedModal );\n\nexport default Modal;\n"]}
1
+ {"version":3,"sources":["@wordpress/components/src/modal/index.tsx"],"names":["openModalCount","UnforwardedModal","props","forwardedRef","bodyOpenClassName","role","title","focusOnMount","shouldCloseOnEsc","shouldCloseOnClickOutside","isDismissible","aria","labelledby","undefined","describedby","onRequestClose","icon","closeButtonLabel","children","style","overlayClassName","className","contentLabel","onKeyDown","isFullScreen","__experimentalHideHeader","ref","instanceId","Modal","headingId","focusOnMountRef","constrainedTabbingRef","focusReturnRef","focusOutsideProps","contentRef","childrenContainerRef","hasScrolledContent","setHasScrolledContent","hasScrollableContent","setHasScrollableContent","isContentScrollable","current","closestScrollContainer","ariaHelper","hideApp","document","body","classList","add","remove","showApp","window","ResizeObserver","resizeObserver","observe","disconnect","handleEscapeKeyDown","event","nativeEvent","isComposing","keyCode","code","defaultPrevented","preventDefault","onContentContainerScroll","e","scrollY","currentTarget","scrollTop","close"],"mappings":";;;;;;;;;AASA;;;;AANA;;AAeA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;;;;;AAnCA;AACA;AACA;;AAIA;AACA;AACA;;AAsBA;AACA;AACA;AAMA;AACA,IAAIA,cAAc,GAAG,CAArB;;AAEA,SAASC,gBAAT,CACCC,KADD,EAECC,YAFD,EAGE;AACD,QAAM;AACLC,IAAAA,iBAAiB,GAAG,YADf;AAELC,IAAAA,IAAI,GAAG,QAFF;AAGLC,IAAAA,KAAK,GAAG,IAHH;AAILC,IAAAA,YAAY,GAAG,IAJV;AAKLC,IAAAA,gBAAgB,GAAG,IALd;AAMLC,IAAAA,yBAAyB,GAAG,IAN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gBAAZ,CAAd;;eAEQ2B,K","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport type { ForwardedRef, KeyboardEvent, UIEvent } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tforwardRef,\n\tuseLayoutEffect,\n} from '@wordpress/element';\nimport {\n\tuseInstanceId,\n\tuseFocusReturn,\n\tuseFocusOnMount,\n\t__experimentalUseFocusOutside as useFocusOutside,\n\tuseConstrainedTabbing,\n\tuseMergeRefs,\n} from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { close } from '@wordpress/icons';\nimport { getScrollContainer } from '@wordpress/dom';\n\n/**\n * Internal dependencies\n */\nimport * as ariaHelper from './aria-helper';\nimport Button from '../button';\nimport StyleProvider from '../style-provider';\nimport type { ModalProps } from './types';\n\n// Used to count the number of open modals.\nlet openModalCount = 0;\n\nfunction UnforwardedModal(\n\tprops: ModalProps,\n\tforwardedRef: ForwardedRef< HTMLDivElement >\n) {\n\tconst {\n\t\tbodyOpenClassName = 'modal-open',\n\t\trole = 'dialog',\n\t\ttitle = null,\n\t\tfocusOnMount = true,\n\t\tshouldCloseOnEsc = true,\n\t\tshouldCloseOnClickOutside = true,\n\t\tisDismissible = true,\n\t\t/* Accessibility. */\n\t\taria = {\n\t\t\tlabelledby: undefined,\n\t\t\tdescribedby: undefined,\n\t\t},\n\t\tonRequestClose,\n\t\ticon,\n\t\tcloseButtonLabel,\n\t\tchildren,\n\t\tstyle,\n\t\toverlayClassName,\n\t\tclassName,\n\t\tcontentLabel,\n\t\tonKeyDown,\n\t\tisFullScreen = false,\n\t\t__experimentalHideHeader = false,\n\t} = props;\n\n\tconst ref = useRef< HTMLDivElement >();\n\tconst instanceId = useInstanceId( Modal );\n\tconst headingId = title\n\t\t? `components-modal-header-${ instanceId }`\n\t\t: aria.labelledby;\n\tconst focusOnMountRef = useFocusOnMount( focusOnMount );\n\tconst constrainedTabbingRef = useConstrainedTabbing();\n\tconst focusReturnRef = useFocusReturn();\n\tconst focusOutsideProps = useFocusOutside( onRequestClose );\n\tconst contentRef = useRef< HTMLDivElement >( null );\n\tconst childrenContainerRef = useRef< HTMLDivElement >( null );\n\n\tconst [ hasScrolledContent, setHasScrolledContent ] = useState( false );\n\tconst [ hasScrollableContent, setHasScrollableContent ] = useState( false );\n\n\t// Determines whether the Modal content is scrollable and updates the state.\n\tconst isContentScrollable = useCallback( () => {\n\t\tif ( ! contentRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst closestScrollContainer = getScrollContainer( contentRef.current );\n\n\t\tif ( contentRef.current === closestScrollContainer ) {\n\t\t\tsetHasScrollableContent( true );\n\t\t} else {\n\t\t\tsetHasScrollableContent( false );\n\t\t}\n\t}, [ contentRef ] );\n\n\tuseEffect( () => {\n\t\topenModalCount++;\n\n\t\tif ( openModalCount === 1 ) {\n\t\t\tariaHelper.hideApp( ref.current );\n\t\t\tdocument.body.classList.add( bodyOpenClassName );\n\t\t}\n\n\t\treturn () => {\n\t\t\topenModalCount--;\n\n\t\t\tif ( openModalCount === 0 ) {\n\t\t\t\tdocument.body.classList.remove( bodyOpenClassName );\n\t\t\t\tariaHelper.showApp();\n\t\t\t}\n\t\t};\n\t}, [ bodyOpenClassName ] );\n\n\t// Calls the isContentScrollable callback when the Modal children container resizes.\n\tuseLayoutEffect( () => {\n\t\tif ( ! window.ResizeObserver || ! childrenContainerRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst resizeObserver = new ResizeObserver( isContentScrollable );\n\t\tresizeObserver.observe( childrenContainerRef.current );\n\n\t\tisContentScrollable();\n\n\t\treturn () => {\n\t\t\tresizeObserver.disconnect();\n\t\t};\n\t}, [ isContentScrollable, childrenContainerRef ] );\n\n\tfunction handleEscapeKeyDown( event: KeyboardEvent< HTMLDivElement > ) {\n\t\tif (\n\t\t\t// Ignore keydowns from IMEs\n\t\t\tevent.nativeEvent.isComposing ||\n\t\t\t// Workaround for Mac Safari where the final Enter/Backspace of an IME composition\n\t\t\t// is `isComposing=false`, even though it's technically still part of the composition.\n\t\t\t// These can only be detected by keyCode.\n\t\t\tevent.keyCode === 229\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tshouldCloseOnEsc &&\n\t\t\tevent.code === 'Escape' &&\n\t\t\t! event.defaultPrevented\n\t\t) {\n\t\t\tevent.preventDefault();\n\t\t\tif ( onRequestClose ) {\n\t\t\t\tonRequestClose( event );\n\t\t\t}\n\t\t}\n\t}\n\n\tconst onContentContainerScroll = useCallback(\n\t\t( e: UIEvent< HTMLDivElement > ) => {\n\t\t\tconst scrollY = e?.currentTarget?.scrollTop ?? -1;\n\n\t\t\tif ( ! hasScrolledContent && scrollY > 0 ) {\n\t\t\t\tsetHasScrolledContent( true );\n\t\t\t} else if ( hasScrolledContent && scrollY <= 0 ) {\n\t\t\t\tsetHasScrolledContent( false );\n\t\t\t}\n\t\t},\n\t\t[ hasScrolledContent ]\n\t);\n\n\treturn createPortal(\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\tref={ useMergeRefs( [ ref, forwardedRef ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\t'components-modal__screen-overlay',\n\t\t\t\toverlayClassName\n\t\t\t) }\n\t\t\tonKeyDown={ handleEscapeKeyDown }\n\t\t>\n\t\t\t<StyleProvider document={ document }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'components-modal__frame',\n\t\t\t\t\t\tclassName,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'is-full-screen': isFullScreen,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ style }\n\t\t\t\t\tref={ useMergeRefs( [\n\t\t\t\t\t\tconstrainedTabbingRef,\n\t\t\t\t\t\tfocusReturnRef,\n\t\t\t\t\t\tfocusOnMountRef,\n\t\t\t\t\t] ) }\n\t\t\t\t\trole={ role }\n\t\t\t\t\taria-label={ contentLabel }\n\t\t\t\t\taria-labelledby={ contentLabel ? undefined : headingId }\n\t\t\t\t\taria-describedby={ aria.describedby }\n\t\t\t\t\ttabIndex={ -1 }\n\t\t\t\t\t{ ...( shouldCloseOnClickOutside\n\t\t\t\t\t\t? focusOutsideProps\n\t\t\t\t\t\t: {} ) }\n\t\t\t\t\tonKeyDown={ onKeyDown }\n\t\t\t\t>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'components-modal__content', {\n\t\t\t\t\t\t\t'hide-header': __experimentalHideHeader,\n\t\t\t\t\t\t\t'is-scrollable': hasScrollableContent,\n\t\t\t\t\t\t\t'has-scrolled-content': hasScrolledContent,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\trole=\"document\"\n\t\t\t\t\t\tonScroll={ onContentContainerScroll }\n\t\t\t\t\t\tref={ contentRef }\n\t\t\t\t\t\taria-label={\n\t\t\t\t\t\t\thasScrollableContent\n\t\t\t\t\t\t\t\t? __( 'Scrollable section' )\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabIndex={ hasScrollableContent ? 0 : undefined }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ! __experimentalHideHeader && (\n\t\t\t\t\t\t\t<div className=\"components-modal__header\">\n\t\t\t\t\t\t\t\t<div className=\"components-modal__header-heading-container\">\n\t\t\t\t\t\t\t\t\t{ icon && (\n\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__icon-container\"\n\t\t\t\t\t\t\t\t\t\t\taria-hidden\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ icon }\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ title && (\n\t\t\t\t\t\t\t\t\t\t<h1\n\t\t\t\t\t\t\t\t\t\t\tid={ headingId }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"components-modal__header-heading\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</h1>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t{ isDismissible && (\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tonClick={ onRequestClose }\n\t\t\t\t\t\t\t\t\t\ticon={ close }\n\t\t\t\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\t\t\t\tcloseButtonLabel || __( 'Close' )\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<div ref={ childrenContainerRef }>{ children }</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</StyleProvider>\n\t\t</div>,\n\t\tdocument.body\n\t);\n}\n\n/**\n * Modals give users information and choices related to a task they’re trying to\n * accomplish. They can contain critical information, require decisions, or\n * involve multiple tasks.\n *\n * ```jsx\n * import { Button, Modal } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const MyModal = () => {\n * const [ isOpen, setOpen ] = useState( false );\n * const openModal = () => setOpen( true );\n * const closeModal = () => setOpen( false );\n *\n * return (\n * <>\n * <Button variant=\"secondary\" onClick={ openModal }>\n * Open Modal\n * </Button>\n * { isOpen && (\n * <Modal title=\"This is my modal\" onRequestClose={ closeModal }>\n * <Button variant=\"secondary\" onClick={ closeModal }>\n * My custom close button\n * </Button>\n * </Modal>\n * ) }\n * </>\n * );\n * };\n * ```\n */\nexport const Modal = forwardRef( UnforwardedModal );\n\nexport default Modal;\n"]}
@@ -276,6 +276,7 @@ function PaletteEdit(_ref6) {
276
276
  colors = EMPTY_ARRAY,
277
277
  onChange,
278
278
  paletteLabel,
279
+ paletteLabelHeadingLevel = 2,
279
280
  emptyMessage,
280
281
  canOnlyChangeValues,
281
282
  canReset,
@@ -299,7 +300,9 @@ function PaletteEdit(_ref6) {
299
300
  setIsEditing(true);
300
301
  }
301
302
  }, [isGradient, elements]);
302
- return (0, _element.createElement)(_styles.PaletteEditStyles, null, (0, _element.createElement)(_styles.PaletteHStackHeader, null, (0, _element.createElement)(_styles.PaletteHeading, null, paletteLabel), (0, _element.createElement)(_styles.PaletteActionsContainer, null, hasElements && isEditing && (0, _element.createElement)(_styles.DoneButton, {
303
+ return (0, _element.createElement)(_styles.PaletteEditStyles, null, (0, _element.createElement)(_styles.PaletteHStackHeader, null, (0, _element.createElement)(_styles.PaletteHeading, {
304
+ level: paletteLabelHeadingLevel
305
+ }, paletteLabel), (0, _element.createElement)(_styles.PaletteActionsContainer, null, hasElements && isEditing && (0, _element.createElement)(_styles.DoneButton, {
303
306
  isSmall: true,
304
307
  onClick: () => {
305
308
  setIsEditing(false);