@wordpress/components 28.5.0 → 28.6.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 (544) hide show
  1. package/CHANGELOG.md +82 -0
  2. package/CONTRIBUTING.md +155 -64
  3. package/build/alignment-matrix-control/cell.js +2 -2
  4. package/build/alignment-matrix-control/cell.js.map +1 -1
  5. package/build/alignment-matrix-control/index.js +6 -5
  6. package/build/alignment-matrix-control/index.js.map +1 -1
  7. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js +8 -17
  8. package/build/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  9. package/build/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
  10. package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  11. package/build/base-control/index.js +54 -41
  12. package/build/base-control/index.js.map +1 -1
  13. package/build/base-control/types.js.map +1 -1
  14. package/build/border-control/styles.js +13 -13
  15. package/build/border-control/styles.js.map +1 -1
  16. package/build/checkbox-control/index.js +1 -0
  17. package/build/checkbox-control/index.js.map +1 -1
  18. package/build/circular-option-picker/circular-option-picker-option.js +4 -4
  19. package/build/circular-option-picker/circular-option-picker-option.js.map +1 -1
  20. package/build/circular-option-picker/circular-option-picker.js +3 -3
  21. package/build/circular-option-picker/circular-option-picker.js.map +1 -1
  22. package/build/circular-option-picker/types.js.map +1 -1
  23. package/build/color-palette/utils.js +17 -5
  24. package/build/color-palette/utils.js.map +1 -1
  25. package/build/color-picker/input-with-slider.js +1 -0
  26. package/build/color-picker/input-with-slider.js.map +1 -1
  27. package/build/combobox-control/index.js +1 -0
  28. package/build/combobox-control/index.js.map +1 -1
  29. package/build/composite/context.js +19 -0
  30. package/build/composite/context.js.map +1 -0
  31. package/build/composite/index.js +287 -9
  32. package/build/composite/index.js.map +1 -1
  33. package/build/composite/legacy/index.js +10 -8
  34. package/build/composite/legacy/index.js.map +1 -1
  35. package/build/composite/types.js +6 -0
  36. package/build/composite/types.js.map +1 -0
  37. package/build/custom-select-control/types.js.map +1 -1
  38. package/build/custom-select-control-v2/custom-select.js +3 -2
  39. package/build/custom-select-control-v2/custom-select.js.map +1 -1
  40. package/build/date-time/time/index.js +11 -3
  41. package/build/date-time/time/index.js.map +1 -1
  42. package/build/date-time/types.js.map +1 -1
  43. package/build/dimension-control/index.js +25 -8
  44. package/build/dimension-control/index.js.map +1 -1
  45. package/build/dimension-control/types.js.map +1 -1
  46. package/build/dropdown-menu-v2/index.js +3 -2
  47. package/build/dropdown-menu-v2/index.js.map +1 -1
  48. package/build/dropdown-menu-v2/styles.js +23 -21
  49. package/build/dropdown-menu-v2/styles.js.map +1 -1
  50. package/build/focal-point-picker/controls.js +1 -3
  51. package/build/focal-point-picker/controls.js.map +1 -1
  52. package/build/focal-point-picker/index.js +1 -2
  53. package/build/focal-point-picker/index.js.map +1 -1
  54. package/build/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  55. package/build/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  56. package/build/focal-point-picker/types.js.map +1 -1
  57. package/build/form-file-upload/types.js.map +1 -1
  58. package/build/index.js +5 -5
  59. package/build/index.js.map +1 -1
  60. package/build/item-group/styles.js +11 -11
  61. package/build/item-group/styles.js.map +1 -1
  62. package/build/mobile/utils/alignments.native.js +1 -1
  63. package/build/mobile/utils/alignments.native.js.map +1 -1
  64. package/build/navigator/navigator-back-button/component.js +1 -1
  65. package/build/navigator/navigator-back-button/component.js.map +1 -1
  66. package/build/navigator/navigator-back-button/hook.js +3 -9
  67. package/build/navigator/navigator-back-button/hook.js.map +1 -1
  68. package/build/navigator/navigator-provider/component.js +17 -9
  69. package/build/navigator/navigator-provider/component.js.map +1 -1
  70. package/build/navigator/navigator-to-parent-button/component.js +13 -40
  71. package/build/navigator/navigator-to-parent-button/component.js.map +1 -1
  72. package/build/navigator/types.js.map +1 -1
  73. package/build/palette-edit/styles.js +11 -11
  74. package/build/palette-edit/styles.js.map +1 -1
  75. package/build/popover/index.js +6 -1
  76. package/build/popover/index.js.map +1 -1
  77. package/build/private-apis.js +6 -6
  78. package/build/private-apis.js.map +1 -1
  79. package/build/progress-bar/styles.js +5 -5
  80. package/build/progress-bar/styles.js.map +1 -1
  81. package/build/query-controls/index.js +5 -6
  82. package/build/query-controls/index.js.map +1 -1
  83. package/build/query-controls/types.js.map +1 -1
  84. package/build/radio-control/index.js +20 -19
  85. package/build/radio-control/index.js.map +1 -1
  86. package/build/radio-group/radio.js +3 -2
  87. package/build/radio-group/radio.js.map +1 -1
  88. package/build/range-control/index.js +32 -9
  89. package/build/range-control/index.js.map +1 -1
  90. package/build/range-control/styles/range-control-styles.js +29 -29
  91. package/build/range-control/styles/range-control-styles.js.map +1 -1
  92. package/build/search-control/index.js +5 -4
  93. package/build/search-control/index.js.map +1 -1
  94. package/build/select-control/index.js +1 -0
  95. package/build/select-control/index.js.map +1 -1
  96. package/build/tab-panel/index.js +3 -2
  97. package/build/tab-panel/index.js.map +1 -1
  98. package/build/tabs/index.js +3 -2
  99. package/build/tabs/index.js.map +1 -1
  100. package/build/tabs/tablist.js +6 -4
  101. package/build/tabs/tablist.js.map +1 -1
  102. package/build/tabs/tabpanel.js +6 -1
  103. package/build/tabs/tabpanel.js.map +1 -1
  104. package/build/text/styles.js +7 -7
  105. package/build/text/styles.js.map +1 -1
  106. package/build/text-control/index.js +1 -0
  107. package/build/text-control/index.js.map +1 -1
  108. package/build/textarea-control/index.js +1 -0
  109. package/build/textarea-control/index.js.map +1 -1
  110. package/build/textarea-control/styles/textarea-control-styles.js +8 -2
  111. package/build/textarea-control/styles/textarea-control-styles.js.map +1 -1
  112. package/build/toggle-control/index.js +9 -1
  113. package/build/toggle-control/index.js.map +1 -1
  114. package/build/toggle-group-control/toggle-group-control/as-radio-group.js +3 -2
  115. package/build/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  116. package/build/toggle-group-control/toggle-group-control/component.js +1 -0
  117. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  118. package/build/toggle-group-control/toggle-group-control/styles.js +7 -7
  119. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  120. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
  121. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  122. package/build/tools-panel/styles.js +13 -13
  123. package/build/tools-panel/styles.js.map +1 -1
  124. package/build/tooltip/index.js +3 -2
  125. package/build/tooltip/index.js.map +1 -1
  126. package/build/tree-select/index.js +19 -6
  127. package/build/tree-select/index.js.map +1 -1
  128. package/build/unit-control/styles/unit-control-styles.js +7 -7
  129. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  130. package/build/utils/config-values.js +4 -3
  131. package/build/utils/config-values.js.map +1 -1
  132. package/build-module/alignment-matrix-control/cell.js +2 -2
  133. package/build-module/alignment-matrix-control/cell.js.map +1 -1
  134. package/build-module/alignment-matrix-control/index.js +4 -3
  135. package/build-module/alignment-matrix-control/index.js.map +1 -1
  136. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js +9 -18
  137. package/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js.map +1 -1
  138. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +4 -4
  139. package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
  140. package/build-module/base-control/index.js +54 -42
  141. package/build-module/base-control/index.js.map +1 -1
  142. package/build-module/base-control/types.js.map +1 -1
  143. package/build-module/border-control/styles.js +13 -13
  144. package/build-module/border-control/styles.js.map +1 -1
  145. package/build-module/checkbox-control/index.js +1 -0
  146. package/build-module/checkbox-control/index.js.map +1 -1
  147. package/build-module/circular-option-picker/circular-option-picker-option.js +4 -4
  148. package/build-module/circular-option-picker/circular-option-picker-option.js.map +1 -1
  149. package/build-module/circular-option-picker/circular-option-picker.js +1 -1
  150. package/build-module/circular-option-picker/circular-option-picker.js.map +1 -1
  151. package/build-module/circular-option-picker/types.js.map +1 -1
  152. package/build-module/color-palette/utils.js +17 -5
  153. package/build-module/color-palette/utils.js.map +1 -1
  154. package/build-module/color-picker/input-with-slider.js +1 -0
  155. package/build-module/color-picker/input-with-slider.js.map +1 -1
  156. package/build-module/combobox-control/index.js +1 -0
  157. package/build-module/combobox-control/index.js.map +1 -1
  158. package/build-module/composite/context.js +12 -0
  159. package/build-module/composite/context.js.map +1 -0
  160. package/build-module/composite/index.js +284 -6
  161. package/build-module/composite/index.js.map +1 -1
  162. package/build-module/composite/legacy/index.js +10 -6
  163. package/build-module/composite/legacy/index.js.map +1 -1
  164. package/build-module/composite/types.js +2 -0
  165. package/build-module/composite/types.js.map +1 -0
  166. package/build-module/custom-select-control/types.js.map +1 -1
  167. package/build-module/custom-select-control-v2/custom-select.js +2 -1
  168. package/build-module/custom-select-control-v2/custom-select.js.map +1 -1
  169. package/build-module/date-time/time/index.js +11 -3
  170. package/build-module/date-time/time/index.js.map +1 -1
  171. package/build-module/date-time/types.js.map +1 -1
  172. package/build-module/dimension-control/index.js +25 -8
  173. package/build-module/dimension-control/index.js.map +1 -1
  174. package/build-module/dimension-control/types.js.map +1 -1
  175. package/build-module/dropdown-menu-v2/index.js +2 -1
  176. package/build-module/dropdown-menu-v2/index.js.map +1 -1
  177. package/build-module/dropdown-menu-v2/styles.js +23 -21
  178. package/build-module/dropdown-menu-v2/styles.js.map +1 -1
  179. package/build-module/focal-point-picker/controls.js +1 -3
  180. package/build-module/focal-point-picker/controls.js.map +1 -1
  181. package/build-module/focal-point-picker/index.js +1 -2
  182. package/build-module/focal-point-picker/index.js.map +1 -1
  183. package/build-module/focal-point-picker/styles/focal-point-picker-style.js +11 -11
  184. package/build-module/focal-point-picker/styles/focal-point-picker-style.js.map +1 -1
  185. package/build-module/focal-point-picker/types.js.map +1 -1
  186. package/build-module/form-file-upload/types.js.map +1 -1
  187. package/build-module/index.js +1 -1
  188. package/build-module/index.js.map +1 -1
  189. package/build-module/item-group/styles.js +11 -11
  190. package/build-module/item-group/styles.js.map +1 -1
  191. package/build-module/mobile/utils/alignments.native.js +1 -1
  192. package/build-module/mobile/utils/alignments.native.js.map +1 -1
  193. package/build-module/navigator/navigator-back-button/component.js +1 -1
  194. package/build-module/navigator/navigator-back-button/component.js.map +1 -1
  195. package/build-module/navigator/navigator-back-button/hook.js +3 -9
  196. package/build-module/navigator/navigator-back-button/hook.js.map +1 -1
  197. package/build-module/navigator/navigator-provider/component.js +17 -9
  198. package/build-module/navigator/navigator-provider/component.js.map +1 -1
  199. package/build-module/navigator/navigator-to-parent-button/component.js +12 -41
  200. package/build-module/navigator/navigator-to-parent-button/component.js.map +1 -1
  201. package/build-module/navigator/types.js.map +1 -1
  202. package/build-module/palette-edit/styles.js +11 -11
  203. package/build-module/palette-edit/styles.js.map +1 -1
  204. package/build-module/popover/index.js +6 -1
  205. package/build-module/popover/index.js.map +1 -1
  206. package/build-module/private-apis.js +6 -6
  207. package/build-module/private-apis.js.map +1 -1
  208. package/build-module/progress-bar/styles.js +5 -5
  209. package/build-module/progress-bar/styles.js.map +1 -1
  210. package/build-module/query-controls/index.js +5 -6
  211. package/build-module/query-controls/index.js.map +1 -1
  212. package/build-module/query-controls/types.js.map +1 -1
  213. package/build-module/radio-control/index.js +20 -19
  214. package/build-module/radio-control/index.js.map +1 -1
  215. package/build-module/radio-group/radio.js +2 -1
  216. package/build-module/radio-group/radio.js.map +1 -1
  217. package/build-module/range-control/index.js +32 -9
  218. package/build-module/range-control/index.js.map +1 -1
  219. package/build-module/range-control/styles/range-control-styles.js +29 -29
  220. package/build-module/range-control/styles/range-control-styles.js.map +1 -1
  221. package/build-module/search-control/index.js +5 -4
  222. package/build-module/search-control/index.js.map +1 -1
  223. package/build-module/select-control/index.js +1 -0
  224. package/build-module/select-control/index.js.map +1 -1
  225. package/build-module/tab-panel/index.js +2 -1
  226. package/build-module/tab-panel/index.js.map +1 -1
  227. package/build-module/tabs/index.js +2 -1
  228. package/build-module/tabs/index.js.map +1 -1
  229. package/build-module/tabs/tablist.js +5 -3
  230. package/build-module/tabs/tablist.js.map +1 -1
  231. package/build-module/tabs/tabpanel.js +6 -2
  232. package/build-module/tabs/tabpanel.js.map +1 -1
  233. package/build-module/text/styles.js +7 -7
  234. package/build-module/text/styles.js.map +1 -1
  235. package/build-module/text-control/index.js +1 -0
  236. package/build-module/text-control/index.js.map +1 -1
  237. package/build-module/textarea-control/index.js +1 -0
  238. package/build-module/textarea-control/index.js.map +1 -1
  239. package/build-module/textarea-control/styles/textarea-control-styles.js +9 -2
  240. package/build-module/textarea-control/styles/textarea-control-styles.js.map +1 -1
  241. package/build-module/toggle-control/index.js +9 -1
  242. package/build-module/toggle-control/index.js.map +1 -1
  243. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js +2 -1
  244. package/build-module/toggle-group-control/toggle-group-control/as-radio-group.js.map +1 -1
  245. package/build-module/toggle-group-control/toggle-group-control/component.js +1 -0
  246. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  247. package/build-module/toggle-group-control/toggle-group-control/styles.js +7 -7
  248. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  249. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +9 -9
  250. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  251. package/build-module/tools-panel/styles.js +13 -13
  252. package/build-module/tools-panel/styles.js.map +1 -1
  253. package/build-module/tooltip/index.js +2 -1
  254. package/build-module/tooltip/index.js.map +1 -1
  255. package/build-module/tree-select/index.js +19 -6
  256. package/build-module/tree-select/index.js.map +1 -1
  257. package/build-module/unit-control/styles/unit-control-styles.js +7 -7
  258. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  259. package/build-module/utils/config-values.js +4 -3
  260. package/build-module/utils/config-values.js.map +1 -1
  261. package/build-style/style-rtl.css +19 -9
  262. package/build-style/style.css +19 -9
  263. package/build-types/alignment-matrix-control/index.d.ts.map +1 -1
  264. package/build-types/alignment-matrix-control/styles/alignment-matrix-control-styles.d.ts.map +1 -1
  265. package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
  266. package/build-types/base-control/hooks.d.ts +1 -0
  267. package/build-types/base-control/hooks.d.ts.map +1 -1
  268. package/build-types/base-control/index.d.ts +44 -0
  269. package/build-types/base-control/index.d.ts.map +1 -1
  270. package/build-types/base-control/types.d.ts +7 -0
  271. package/build-types/base-control/types.d.ts.map +1 -1
  272. package/build-types/checkbox-control/index.d.ts.map +1 -1
  273. package/build-types/checkbox-control/stories/index.story.d.ts.map +1 -1
  274. package/build-types/circular-option-picker/circular-option-picker-option.d.ts.map +1 -1
  275. package/build-types/circular-option-picker/types.d.ts +2 -3
  276. package/build-types/circular-option-picker/types.d.ts.map +1 -1
  277. package/build-types/color-palette/utils.d.ts.map +1 -1
  278. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  279. package/build-types/color-picker/styles.d.ts.map +1 -1
  280. package/build-types/combobox-control/index.d.ts.map +1 -1
  281. package/build-types/combobox-control/stories/index.story.d.ts.map +1 -1
  282. package/build-types/composite/context.d.ts +7 -0
  283. package/build-types/composite/context.d.ts.map +1 -0
  284. package/build-types/composite/index.d.ts +181 -1
  285. package/build-types/composite/index.d.ts.map +1 -1
  286. package/build-types/composite/legacy/index.d.ts +7 -2
  287. package/build-types/composite/legacy/index.d.ts.map +1 -1
  288. package/build-types/composite/legacy/stories/utils.d.ts +19 -0
  289. package/build-types/composite/legacy/stories/utils.d.ts.map +1 -1
  290. package/build-types/composite/stories/index.story.d.ts +13 -0
  291. package/build-types/composite/stories/index.story.d.ts.map +1 -0
  292. package/build-types/composite/stories/utils.d.ts +29 -0
  293. package/build-types/composite/stories/utils.d.ts.map +1 -0
  294. package/build-types/composite/types.d.ts +288 -0
  295. package/build-types/composite/types.d.ts.map +1 -0
  296. package/build-types/custom-select-control/types.d.ts +3 -3
  297. package/build-types/custom-select-control/types.d.ts.map +1 -1
  298. package/build-types/custom-select-control-v2/custom-select.d.ts.map +1 -1
  299. package/build-types/date-time/date-time/index.d.ts +1 -1
  300. package/build-types/date-time/time/index.d.ts +1 -1
  301. package/build-types/date-time/time/index.d.ts.map +1 -1
  302. package/build-types/date-time/types.d.ts +7 -1
  303. package/build-types/date-time/types.d.ts.map +1 -1
  304. package/build-types/dimension-control/index.d.ts +1 -0
  305. package/build-types/dimension-control/index.d.ts.map +1 -1
  306. package/build-types/dimension-control/stories/index.story.d.ts +8 -1
  307. package/build-types/dimension-control/stories/index.story.d.ts.map +1 -1
  308. package/build-types/dimension-control/types.d.ts +2 -7
  309. package/build-types/dimension-control/types.d.ts.map +1 -1
  310. package/build-types/dropdown-menu-v2/index.d.ts.map +1 -1
  311. package/build-types/dropdown-menu-v2/styles.d.ts.map +1 -1
  312. package/build-types/focal-point-picker/controls.d.ts +1 -1
  313. package/build-types/focal-point-picker/controls.d.ts.map +1 -1
  314. package/build-types/focal-point-picker/index.d.ts +1 -1
  315. package/build-types/focal-point-picker/index.d.ts.map +1 -1
  316. package/build-types/focal-point-picker/stories/index.story.d.ts.map +1 -1
  317. package/build-types/focal-point-picker/types.d.ts +2 -2
  318. package/build-types/focal-point-picker/types.d.ts.map +1 -1
  319. package/build-types/form-file-upload/types.d.ts +6 -0
  320. package/build-types/form-file-upload/types.d.ts.map +1 -1
  321. package/build-types/index.d.ts +1 -1
  322. package/build-types/index.d.ts.map +1 -1
  323. package/build-types/navigator/navigator-back-button/component.d.ts +1 -1
  324. package/build-types/navigator/navigator-back-button/hook.d.ts +2 -2
  325. package/build-types/navigator/navigator-back-button/hook.d.ts.map +1 -1
  326. package/build-types/navigator/navigator-provider/component.d.ts.map +1 -1
  327. package/build-types/navigator/navigator-to-parent-button/component.d.ts +6 -0
  328. package/build-types/navigator/navigator-to-parent-button/component.d.ts.map +1 -1
  329. package/build-types/navigator/types.d.ts +45 -9
  330. package/build-types/navigator/types.d.ts.map +1 -1
  331. package/build-types/popover/index.d.ts +1 -1
  332. package/build-types/popover/index.d.ts.map +1 -1
  333. package/build-types/popover/stories/e2e/index.story.d.ts +1 -1
  334. package/build-types/private-apis.d.ts.map +1 -1
  335. package/build-types/query-controls/index.d.ts +1 -1
  336. package/build-types/query-controls/index.d.ts.map +1 -1
  337. package/build-types/query-controls/types.d.ts +2 -1
  338. package/build-types/query-controls/types.d.ts.map +1 -1
  339. package/build-types/radio-control/index.d.ts.map +1 -1
  340. package/build-types/radio-group/radio.d.ts.map +1 -1
  341. package/build-types/range-control/index.d.ts.map +1 -1
  342. package/build-types/range-control/stories/index.story.d.ts.map +1 -1
  343. package/build-types/search-control/index.d.ts.map +1 -1
  344. package/build-types/search-control/stories/index.story.d.ts.map +1 -1
  345. package/build-types/select-control/index.d.ts.map +1 -1
  346. package/build-types/select-control/stories/index.story.d.ts +4 -2
  347. package/build-types/select-control/stories/index.story.d.ts.map +1 -1
  348. package/build-types/tab-panel/index.d.ts.map +1 -1
  349. package/build-types/tabs/index.d.ts.map +1 -1
  350. package/build-types/tabs/tablist.d.ts.map +1 -1
  351. package/build-types/tabs/tabpanel.d.ts +0 -3
  352. package/build-types/tabs/tabpanel.d.ts.map +1 -1
  353. package/build-types/text-control/index.d.ts.map +1 -1
  354. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  355. package/build-types/textarea-control/index.d.ts.map +1 -1
  356. package/build-types/textarea-control/styles/textarea-control-styles.d.ts.map +1 -1
  357. package/build-types/toggle-control/index.d.ts.map +1 -1
  358. package/build-types/toggle-control/stories/index.story.d.ts.map +1 -1
  359. package/build-types/toggle-group-control/toggle-group-control/as-radio-group.d.ts.map +1 -1
  360. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  361. package/build-types/tooltip/index.d.ts.map +1 -1
  362. package/build-types/tree-select/index.d.ts.map +1 -1
  363. package/build-types/utils/config-values.d.ts +4 -3
  364. package/package.json +20 -20
  365. package/src/alignment-matrix-control/cell.tsx +3 -3
  366. package/src/alignment-matrix-control/index.tsx +5 -4
  367. package/src/alignment-matrix-control/styles/alignment-matrix-control-styles.ts +2 -2
  368. package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +2 -2
  369. package/src/base-control/README.md +5 -2
  370. package/src/base-control/index.tsx +61 -41
  371. package/src/base-control/types.ts +7 -0
  372. package/src/border-box-control/border-box-control/README.md +7 -0
  373. package/src/border-control/border-control/README.md +7 -0
  374. package/src/border-control/styles.ts +1 -1
  375. package/src/button/README.md +7 -0
  376. package/src/button/style.scss +2 -2
  377. package/src/button-group/style.scss +2 -2
  378. package/src/checkbox-control/index.tsx +1 -0
  379. package/src/checkbox-control/stories/index.story.tsx +1 -0
  380. package/src/checkbox-control/test/index.tsx +8 -1
  381. package/src/circular-option-picker/circular-option-picker-option.tsx +8 -6
  382. package/src/circular-option-picker/circular-option-picker.tsx +1 -1
  383. package/src/circular-option-picker/style.scss +3 -3
  384. package/src/circular-option-picker/types.ts +2 -3
  385. package/src/color-indicator/style.scss +1 -1
  386. package/src/color-palette/style.scss +2 -2
  387. package/src/color-palette/utils.ts +23 -10
  388. package/src/color-picker/input-with-slider.tsx +1 -0
  389. package/src/combobox-control/README.md +8 -0
  390. package/src/combobox-control/index.tsx +1 -0
  391. package/src/combobox-control/stories/index.story.tsx +3 -4
  392. package/src/combobox-control/test/index.tsx +5 -1
  393. package/src/composite/README.md +325 -0
  394. package/src/composite/context.ts +14 -0
  395. package/src/composite/index.tsx +341 -0
  396. package/src/composite/legacy/index.tsx +15 -14
  397. package/src/composite/legacy/stories/utils.tsx +19 -0
  398. package/src/composite/stories/index.story.tsx +466 -0
  399. package/src/composite/{current/stories → stories}/utils.tsx +22 -7
  400. package/src/composite/types.ts +298 -0
  401. package/src/custom-gradient-picker/style.scss +2 -2
  402. package/src/custom-select-control/README.md +7 -0
  403. package/src/custom-select-control/test/index.tsx +125 -0
  404. package/src/custom-select-control/types.ts +3 -3
  405. package/src/custom-select-control-v2/custom-select.tsx +2 -1
  406. package/src/date-time/time/index.tsx +26 -12
  407. package/src/date-time/types.ts +11 -1
  408. package/src/dimension-control/README.md +17 -0
  409. package/src/dimension-control/index.tsx +26 -9
  410. package/src/dimension-control/stories/index.story.tsx +1 -0
  411. package/src/dimension-control/test/__snapshots__/index.test.js.snap +0 -16
  412. package/src/dimension-control/test/index.test.js +5 -1
  413. package/src/dimension-control/types.ts +5 -7
  414. package/src/drop-zone/style.scss +1 -1
  415. package/src/dropdown-menu-v2/index.tsx +5 -3
  416. package/src/dropdown-menu-v2/styles.ts +17 -15
  417. package/src/focal-point-picker/README.md +9 -1
  418. package/src/focal-point-picker/controls.tsx +1 -3
  419. package/src/focal-point-picker/index.tsx +1 -2
  420. package/src/focal-point-picker/stories/index.story.tsx +3 -0
  421. package/src/focal-point-picker/styles/focal-point-picker-style.ts +1 -1
  422. package/src/focal-point-picker/test/index.tsx +5 -1
  423. package/src/focal-point-picker/types.ts +2 -2
  424. package/src/font-size-picker/README.md +7 -0
  425. package/src/form-file-upload/README.md +8 -0
  426. package/src/form-file-upload/types.ts +6 -0
  427. package/src/form-token-field/README.md +1 -0
  428. package/src/guide/style.scss +0 -1
  429. package/src/index.ts +1 -1
  430. package/src/input-control/README.md +8 -0
  431. package/src/item-group/styles.ts +1 -1
  432. package/src/mobile/utils/alignments.native.js +1 -0
  433. package/src/modal/style.scss +3 -3
  434. package/src/navigator/navigator-back-button/component.tsx +1 -1
  435. package/src/navigator/navigator-back-button/hook.ts +6 -10
  436. package/src/navigator/navigator-provider/README.md +38 -36
  437. package/src/navigator/navigator-provider/component.tsx +13 -7
  438. package/src/navigator/navigator-screen/README.md +13 -1
  439. package/src/navigator/navigator-to-parent-button/README.md +2 -0
  440. package/src/navigator/navigator-to-parent-button/component.tsx +14 -43
  441. package/src/navigator/test/index.tsx +136 -6
  442. package/src/navigator/types.ts +45 -10
  443. package/src/number-control/README.md +8 -0
  444. package/src/palette-edit/styles.ts +5 -5
  445. package/src/placeholder/style.scss +4 -1
  446. package/src/popover/index.tsx +9 -3
  447. package/src/popover/style.scss +2 -2
  448. package/src/popover/test/index.tsx +34 -0
  449. package/src/private-apis.ts +6 -12
  450. package/src/progress-bar/styles.ts +2 -2
  451. package/src/query-controls/README.md +7 -0
  452. package/src/query-controls/index.tsx +5 -6
  453. package/src/query-controls/types.ts +2 -1
  454. package/src/radio-control/index.tsx +28 -20
  455. package/src/radio-control/style.scss +13 -2
  456. package/src/radio-control/test/index.tsx +43 -40
  457. package/src/radio-group/radio.tsx +2 -1
  458. package/src/range-control/README.md +7 -0
  459. package/src/range-control/index.tsx +39 -9
  460. package/src/range-control/stories/index.story.tsx +7 -0
  461. package/src/range-control/styles/range-control-styles.ts +2 -2
  462. package/src/range-control/test/index.tsx +54 -14
  463. package/src/search-control/index.tsx +7 -4
  464. package/src/search-control/stories/index.story.tsx +1 -0
  465. package/src/search-control/test/index.tsx +1 -0
  466. package/src/select-control/README.md +8 -0
  467. package/src/select-control/index.tsx +1 -0
  468. package/src/select-control/stories/index.story.tsx +8 -5
  469. package/src/select-control/test/select-control.tsx +12 -6
  470. package/src/snackbar/style.scss +2 -2
  471. package/src/tab-panel/index.tsx +4 -1
  472. package/src/tab-panel/style.scss +1 -1
  473. package/src/tabs/index.tsx +2 -1
  474. package/src/tabs/tablist.tsx +6 -4
  475. package/src/tabs/tabpanel.tsx +6 -2
  476. package/src/text/styles.ts +1 -1
  477. package/src/text-control/README.md +8 -0
  478. package/src/text-control/index.tsx +1 -0
  479. package/src/text-control/stories/index.story.tsx +3 -1
  480. package/src/text-control/test/text-control.tsx +5 -1
  481. package/src/textarea-control/index.tsx +1 -0
  482. package/src/textarea-control/stories/index.story.tsx +2 -0
  483. package/src/textarea-control/styles/textarea-control-styles.ts +75 -2
  484. package/src/toggle-control/index.tsx +9 -0
  485. package/src/toggle-control/stories/index.story.tsx +1 -0
  486. package/src/toggle-control/test/index.tsx +7 -1
  487. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +8 -24
  488. package/src/toggle-group-control/test/index.tsx +5 -1
  489. package/src/toggle-group-control/toggle-group-control/README.md +7 -0
  490. package/src/toggle-group-control/toggle-group-control/as-radio-group.tsx +2 -1
  491. package/src/toggle-group-control/toggle-group-control/component.tsx +1 -0
  492. package/src/toggle-group-control/toggle-group-control/styles.ts +1 -1
  493. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +2 -2
  494. package/src/toolbar/toolbar/style.scss +2 -2
  495. package/src/tools-panel/styles.ts +1 -1
  496. package/src/tooltip/index.tsx +2 -1
  497. package/src/tooltip/style.scss +1 -1
  498. package/src/tree-select/index.tsx +16 -5
  499. package/src/tree-select/stories/index.story.tsx +1 -0
  500. package/src/unit-control/README.md +7 -0
  501. package/src/unit-control/styles/unit-control-styles.ts +1 -1
  502. package/src/utils/config-values.js +4 -3
  503. package/tsconfig.tsbuildinfo +1 -1
  504. package/build/composite/current/index.js +0 -43
  505. package/build/composite/current/index.js.map +0 -1
  506. package/build/composite/v2.js +0 -17
  507. package/build/composite/v2.js.map +0 -1
  508. package/build/utils/input/base.js +0 -20
  509. package/build/utils/input/base.js.map +0 -1
  510. package/build/utils/input/index.js +0 -17
  511. package/build/utils/input/index.js.map +0 -1
  512. package/build/utils/input/input-control.js +0 -21
  513. package/build/utils/input/input-control.js.map +0 -1
  514. package/build-module/composite/current/index.js +0 -12
  515. package/build-module/composite/current/index.js.map +0 -1
  516. package/build-module/composite/v2.js +0 -5
  517. package/build-module/composite/v2.js.map +0 -1
  518. package/build-module/utils/input/base.js +0 -13
  519. package/build-module/utils/input/base.js.map +0 -1
  520. package/build-module/utils/input/index.js +0 -2
  521. package/build-module/utils/input/index.js.map +0 -1
  522. package/build-module/utils/input/input-control.js +0 -14
  523. package/build-module/utils/input/input-control.js.map +0 -1
  524. package/build-types/composite/current/index.d.ts +0 -12
  525. package/build-types/composite/current/index.d.ts.map +0 -1
  526. package/build-types/composite/current/stories/index.story.d.ts +0 -13
  527. package/build-types/composite/current/stories/index.story.d.ts.map +0 -1
  528. package/build-types/composite/current/stories/utils.d.ts +0 -14
  529. package/build-types/composite/current/stories/utils.d.ts.map +0 -1
  530. package/build-types/composite/v2.d.ts +0 -2
  531. package/build-types/composite/v2.d.ts.map +0 -1
  532. package/build-types/utils/input/base.d.ts +0 -3
  533. package/build-types/utils/input/base.d.ts.map +0 -1
  534. package/build-types/utils/input/index.d.ts +0 -2
  535. package/build-types/utils/input/index.d.ts.map +0 -1
  536. package/build-types/utils/input/input-control.d.ts +0 -2
  537. package/build-types/utils/input/input-control.d.ts.map +0 -1
  538. package/src/composite/current/index.ts +0 -20
  539. package/src/composite/current/stories/index.story.tsx +0 -86
  540. package/src/composite/index.ts +0 -7
  541. package/src/composite/v2.ts +0 -4
  542. package/src/utils/input/base.js +0 -30
  543. package/src/utils/input/index.js +0 -1
  544. package/src/utils/input/input-control.js +0 -63
package/CHANGELOG.md CHANGED
@@ -2,6 +2,86 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 28.6.0 (2024-08-21)
6
+
7
+ ### Deprecations
8
+
9
+ - Deprecate bottom margin on the following `BaseControl`-based components. Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version ([#64408](https://github.com/WordPress/gutenberg/pull/64408)).
10
+ - `BaseControl`
11
+ - `CheckboxControl`
12
+ - `ComboboxControl`
13
+ - `DimensionControl`
14
+ - `FocalPointPicker`
15
+ - `RangeControl`
16
+ - `SearchControl`
17
+ - `SelectControl`
18
+ - `TextControl`
19
+ - `TextareaControl`
20
+ - `ToggleControl`
21
+ - `ToggleGroupControl`
22
+ - `TreeSelect`
23
+ - Deprecate `NavigatorToParentButton` and `useNavigator().goToParent()` in favor of `NavigatorBackButton` and `useNavigator().goBack()` ([#63317](https://github.com/WordPress/gutenberg/pull/63317)).
24
+
25
+ ### Enhancements
26
+
27
+ - `Placeholder`: Temporarily rewind radius scale ([#64672](https://github.com/WordPress/gutenberg/pull/64672)).
28
+ - `Composite`: improve Storybook examples and add interactive controls ([#64397](https://github.com/WordPress/gutenberg/pull/64397)).
29
+ - `Composite`: use internal context to forward the composite store to sub-components ([#64493](https://github.com/WordPress/gutenberg/pull/64493)).
30
+ - `QueryControls`: Default to new 40px size ([#64457](https://github.com/WordPress/gutenberg/pull/64457)).
31
+ - `TimePicker`: add `hideLabelFromVision` prop ([#64267](https://github.com/WordPress/gutenberg/pull/64267)).
32
+ - `FocalPointPicker`: Default to new 40px size ([#64456](https://github.com/WordPress/gutenberg/pull/64456)).
33
+ - `DropdownMenuV2`: adopt elevation scale ([#64432](https://github.com/WordPress/gutenberg/pull/64432)).
34
+ - `AlignmentMatrixControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
35
+ - `AnglePickerControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
36
+ - `BorderControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
37
+ - `ButtonGroup`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
38
+ - `Button`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
39
+ - `CircularOptionPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
40
+ - `ColorIndicator`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
41
+ - `ColorPalette`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
42
+ - `CustomGradientPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
43
+ - `DropZone`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
44
+ - `DropdownMenuV2`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
45
+ - `FocalPointPicker`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
46
+ - `Guide`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
47
+ - `Modal`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
48
+ - `Placeholder`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
49
+ - `Popover`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
50
+ - `ProgressBar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
51
+ - `RadioControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
52
+ - `Snackbar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
53
+ - `TabPanel`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
54
+ - `Text`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
55
+ - `ToggleGroupControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
56
+ - `ToolbarGroup`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
57
+ - `Toolbar`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
58
+ - `Tooltip`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
59
+ - `UnitControl`: Adopt radius scale ([#64368](https://github.com/WordPress/gutenberg/pull/64368)).
60
+ - `Popover`: allow `style` prop usage ([#64489](https://github.com/WordPress/gutenberg/pull/64489)).
61
+ - `ToolsPanel`: sets column-gap to 16px for ToolsPanel grid ([#64497](https://github.com/WordPress/gutenberg/pull/64497)).
62
+ - `Modal`: Replace references to deprecated styling variables ([#64655](https://github.com/WordPress/gutenberg/pull/64655)).
63
+ - `Popover`: Replace references to deprecated styling variables ([#64655](https://github.com/WordPress/gutenberg/pull/64655)).
64
+ - `Snackbar`: Replace references to deprecated styling variables ([#64655](https://github.com/WordPress/gutenberg/pull/64655)).
65
+ - `TextareaControl`: Update styles ([#64586](https://github.com/WordPress/gutenberg/pull/64586)).
66
+ - `CircularOptionPicker`: Update hard-coded border-width value ([#64680](https://github.com/WordPress/gutenberg/pull/64680)).
67
+ - `CustomGradientPicker`: Update hard-coded border-width value ([#64680](https://github.com/WordPress/gutenberg/pull/64680)).
68
+
69
+ ### Bug Fixes
70
+
71
+ - `RangeControl`: disable reset button when the current value is equal to the reset value ([#64579](https://github.com/WordPress/gutenberg/pull/64579)).
72
+ - `RangeControl`: tweak mark and label absolute positioning ([#64487](https://github.com/WordPress/gutenberg/pull/64487)).
73
+ - `RadioGroup`: use fieldset and legend to group radio inputs ([#64582](https://github.com/WordPress/gutenberg/pull/64582)).
74
+
75
+ ### Internal
76
+
77
+ - `Composite` v2: add `Hover` and `Typeahead` subcomponents ([#64399](https://github.com/WordPress/gutenberg/pull/64399)).
78
+ - `Composite` v2: add focus-related props to `Composite`and`Composite.Item` subcomponents ([#64450](https://github.com/WordPress/gutenberg/pull/64450)).
79
+ - `Composite` v2: add `Context` subcomponent ([#64493](https://github.com/WordPress/gutenberg/pull/64493)).
80
+ - `DropdownMenu` v2: use themed color variables ([#64647](https://github.com/WordPress/gutenberg/pull/64647)).
81
+ - `CustomSelectControl`: Improve type inferring ([#64412](https://github.com/WordPress/gutenberg/pull/64412)).
82
+ - Update `ariakit` to version `0.4.10` ([#64637](https://github.com/WordPress/gutenberg/pull/64637)).
83
+ - Ariakit: Use `useStoreState()` instead of `store.useState()` ([#64648](https://github.com/WordPress/gutenberg/pull/64648)).
84
+
5
85
  ## 28.5.0 (2024-08-07)
6
86
 
7
87
  ### Bug Fixes
@@ -17,11 +97,13 @@
17
97
 
18
98
  ### Enhancements
19
99
 
100
+ - `ColorPalette`: partial support of `color-mix()` CSS colors ([#64224](https://github.com/WordPress/gutenberg/pull/64224)).
20
101
  - `TimeInput`: Expose as subcomponent of `TimePicker` ([#63145](https://github.com/WordPress/gutenberg/pull/63145)).
21
102
  - `RadioControl`: add support for option help text ([#63751](https://github.com/WordPress/gutenberg/pull/63751)).
22
103
  - `SelectControl`: Infer `value` type from `options` ([#64069](https://github.com/WordPress/gutenberg/pull/64069)).
23
104
  - `Guide`: Add `__next40pxDefaultSize` to buttons ([#64181](https://github.com/WordPress/gutenberg/pull/64181)).
24
105
  - `SelectControl`: Pass through `options` props ([#64211](https://github.com/WordPress/gutenberg/pull/64211)).
106
+ - `DimensionControl`: Add `__nextHasNoMarginBottom` prop to remove bottom margin ([#64346](https://github.com/WordPress/gutenberg/pull/64346)).
25
107
 
26
108
  ### Internal
27
109
 
package/CONTRIBUTING.md CHANGED
@@ -6,20 +6,20 @@ The following is a set of guidelines for contributing to the `@wordpress/compone
6
6
 
7
7
  This set of guidelines should apply especially to newly introduced components. In fact, while these guidelines should also be retroactively applied to existing components, it is sometimes impossible to do so for legacy/compatibility reasons.
8
8
 
9
- For an example of a component that follows these requirements, take a look at [`ItemGroup`](/packages/components/src/item-group).
10
- - [Introducing new components](#introducing-new-components)
11
- - [Compatibility](#compatibility)
12
- - [Compound components](#compound-components)
13
- - [Components & Hooks](#components--hooks)
14
- - [TypeScript](#typescript)
15
- - [Styling](#styling)
16
- - [Context system](#context-system)
17
- - [Unit tests](#unit-tests)
18
- - [Storybook](#storybook)
19
- - [Documentation](#documentation)
20
- - [README example](#README-example)
21
- - [Folder structure](#folder-structure)
22
- - [Component versioning](#component-versioning)
9
+ - [Introducing new components](#introducing-new-components)
10
+ - [Compatibility](#compatibility)
11
+ - [Compound components](#compound-components)
12
+ - [Components & Hooks](#components--hooks)
13
+ - [Naming Conventions](#naming-conventions)
14
+ - [TypeScript](#typescript)
15
+ - [Styling](#styling)
16
+ - [Context system](#context-system)
17
+ - [Unit tests](#unit-tests)
18
+ - [Storybook](#storybook)
19
+ - [Documentation](#documentation)
20
+ - [README example](#README-example)
21
+ - [Folder structure](#folder-structure)
22
+ - [Component versioning](#component-versioning)
23
23
 
24
24
  ## Introducing new components
25
25
 
@@ -95,13 +95,13 @@ In these situations, one possible approach is to "soft-deprecate" a given legacy
95
95
  2. Updating all places in Gutenberg that use that API.
96
96
  3. Adding deprecation warnings (only after the previous point is completed, otherwise the Browser Console will be polluted by all those warnings and some e2e tests may fail).
97
97
 
98
- When adding new components or new props to existing components, it's recommended to prefix them with `__unstable` or `__experimental` until they're stable enough to be exposed as part of the public API.
98
+ When adding new components or new props to existing components, it's recommended to create a [private version](/packages/private-apis/README.md)) of the component until the changes are stable enough to be exposed as part of the public API.
99
99
 
100
100
  ### Learn more
101
101
 
102
- - [How to preserve backward compatibility for a React Component](/docs/contributors/code/backward-compatibility.md#how-to-preserve-backward-compatibility-for-a-react-component)
103
- - [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#experimental-and-unstable-apis)
104
- - [Deprecating styles](#deprecating-styles)
102
+ - [How to preserve backward compatibility for a React Component](/docs/contributors/code/backward-compatibility.md#how-to-preserve-backward-compatibility-for-a-react-component)
103
+ - [Experimental and Unstable APIs](/docs/contributors/code/coding-guidelines.md#legacy-experimental-apis-plugin-only-apis-and-private-apis)
104
+ - [Deprecating styles](#deprecating-styles)
105
105
 
106
106
  <!-- ## Polymorphic Components (i.e. the `as` prop)
107
107
 
@@ -121,20 +121,16 @@ When creating components that render a list of subcomponents, prefer to expose t
121
121
  ```jsx
122
122
  // ❌ Don't:
123
123
  <List
124
- items={ [
125
- { value: 'Item 1' },
126
- { value: 'Item 2' },
127
- { value: 'Item 3' },
128
- ] }
124
+ items={ [ { value: 'Item 1' }, { value: 'Item 2' }, { value: 'Item 3' } ] }
129
125
  />
130
126
  ```
131
127
 
132
128
  ```jsx
133
129
  // ✅ Do:
134
130
  <List>
135
- <ListItem value="Item 1" />
136
- <ListItem value="Item 2" />
137
- <ListItem value="Item 3" />
131
+ <List.Item value="Item 1" />
132
+ <List.Item value="Item 2" />
133
+ <List.Item value="Item 3" />
138
134
  </List>
139
135
  ```
140
136
 
@@ -185,25 +181,25 @@ One way to enable reusability and composition is to extract a component's underl
185
181
 
186
182
  ```tsx
187
183
  // in `hook.ts`
188
- function useExampleComponent( props: PolymorphicComponentProps< ExampleProps, 'div' > ) {
184
+ function useExampleComponent(
185
+ props: PolymorphicComponentProps< ExampleProps, 'div' >
186
+ ) {
189
187
  // Merge received props with the context system.
190
- const { isVisible, className, ...otherProps } = useContextSystem( props, 'Example' );
188
+ const { isVisible, className, ...otherProps } = useContextSystem(
189
+ props,
190
+ 'Example'
191
+ );
191
192
 
192
193
  // Any other reusable rendering logic (e.g. computing className, state, event listeners...)
193
194
  const cx = useCx();
194
195
  const classes = useMemo(
195
- () =>
196
- cx(
197
- styles.example,
198
- isVisible && styles.visible,
199
- className
200
- ),
196
+ () => cx( styles.example, isVisible && styles.visible, className ),
201
197
  [ className, isVisible ]
202
198
  );
203
199
 
204
200
  return {
205
201
  ...otherProps,
206
- className: classes
202
+ className: classes,
207
203
  };
208
204
  }
209
205
 
@@ -220,8 +216,8 @@ function Example(
220
216
 
221
217
  A couple of good examples of how hooks are used for composition are:
222
218
 
223
- - the `Card` component, which builds on top of the `Surface` component by [calling the `useSurface` hook inside its own hook](/packages/components/src/card/card/hook.ts);
224
- - the `HStack` component, which builds on top of the `Flex` component and [calls the `useFlex` hook inside its own hook](/packages/components/src/h-stack/hook.tsx).
219
+ - the `Card` component, which builds on top of the `Surface` component by [calling the `useSurface` hook inside its own hook](/packages/components/src/card/card/hook.ts);
220
+ - the `HStack` component, which builds on top of the `Flex` component and [calls the `useFlex` hook inside its own hook](/packages/components/src/h-stack/hook.tsx).
225
221
 
226
222
  <!-- ## API Consinstency
227
223
 
@@ -236,6 +232,95 @@ A couple of good examples of how hooks are used for composition are:
236
232
 
237
233
  TDB -->
238
234
 
235
+ ## Naming Conventions
236
+
237
+ It is recommended that compound components use dot notation to separate the namespace from the individual component names. The top-level compound component should be called the namespace (no dot notation).
238
+
239
+ Dedicated React context should also use dot notation, while hooks should not.
240
+
241
+ When exporting compound components and preparing them to be consumed, it is important that:
242
+
243
+ - the JSDocs appear correctly in IntelliSense;
244
+ - the top-level component's JSDoc appears in the Storybook docs page;
245
+ - the top-level and subcomponent's prop types appear correctly in the Storybook props table.
246
+
247
+ To meet the above requirements, we recommend:
248
+
249
+ - using `Object.assign()` to add subcomponents as properties of the top-level component;
250
+ - using named functions for all components;
251
+ - setting explicitly the `displayName` on all subcomponents;
252
+ - adding the top-level JSDoc to the result of the `Object.assign` call;
253
+ - adding inline subcomponent JSDocs inside the `Object.assign` call.
254
+
255
+ The following example implements all of the above recommendations.
256
+
257
+ ```tsx
258
+ //=======================
259
+ // Component.tsx
260
+ //=======================
261
+ import { forwardRef, createContext } from '@wordpress/element';
262
+
263
+ function UnforwardedTopLevelComponent( props, ref ) {
264
+ /* ... */
265
+ }
266
+ const TopLevelComponent = forwardRef( UnforwardedTopLevelComponent );
267
+
268
+ function UnforwardedSubComponent( props, ref ) {
269
+ /* ... */
270
+ }
271
+ const SubComponent = forwardRef( UnforwardedSubComponent );
272
+ SubComponent.displayName = 'Component.SubComponent';
273
+
274
+ const Context = createContext();
275
+
276
+ /** The top-level component's JSDoc. */
277
+ export const Component = Object.assign( TopLevelComponent, {
278
+ /** The subcomponent's JSDoc. */
279
+ SubComponent,
280
+ /** The context's JSDoc. */
281
+ Context,
282
+ } );
283
+
284
+ /** The hook's JSDoc. */
285
+ export function useComponent() {
286
+ /* ... */
287
+ }
288
+
289
+ //=======================
290
+ // App.tsx
291
+ //=======================
292
+ import { Component, useComponent } from '@wordpress/components';
293
+ import { useContext } from '@wordpress/element';
294
+
295
+ function CompoundComponentExample() {
296
+ return (
297
+ <Component>
298
+ <Component.SubComponent />
299
+ </Component>
300
+ );
301
+ }
302
+
303
+ function ContextProviderExample() {
304
+ return (
305
+ <Component.Context.Provider value={ /* ... */ }>
306
+ { /* React tree */ }
307
+ </Component.Context.Provider>
308
+ );
309
+ }
310
+
311
+ function ContextConsumerExample() {
312
+ const componentContext = useContext( Component.Context );
313
+
314
+ // etc
315
+ }
316
+
317
+ function HookExample() {
318
+ const hookReturnValue = useComponent();
319
+
320
+ // etc.
321
+ }
322
+ ```
323
+
239
324
  ## TypeScript
240
325
 
241
326
  We strongly encourage using TypeScript for all new components.
@@ -278,8 +363,10 @@ function UnconnectedMyComponent(
278
363
  // parameter (`div` in this example)
279
364
  // - the special `as` prop (which marks the component as polymorphic),
280
365
  // unless the third parameter is `false`
281
- props: WordPressComponentProps< ComponentOwnProps, 'div', true >
282
- ) { /* ... */ }
366
+ props: WordPressComponentProps< ComponentOwnProps, 'div', true >
367
+ ) {
368
+ /* ... */
369
+ }
283
370
  ```
284
371
 
285
372
  ### Considerations for the docgen
@@ -287,10 +374,15 @@ function UnconnectedMyComponent(
287
374
  Make sure you have a **named** export for the component, not just the default export ([example](https://github.com/WordPress/gutenberg/blob/trunk/packages/components/src/divider/component.tsx)). This ensures that the docgen can properly extract the types data. The naming should be so that the connected/forwarded component has the plain component name (`MyComponent`), and the raw component is prefixed (`UnconnectedMyComponent` or `UnforwardedMyComponent`). This makes the component's `displayName` look nicer in React devtools and in the autogenerated Storybook code snippets.
288
375
 
289
376
  ```js
290
- function UnconnectedMyComponent() { /* ... */ }
377
+ function UnconnectedMyComponent() {
378
+ /* ... */
379
+ }
291
380
 
292
381
  // 👇 Without this named export, the docgen will not work!
293
- export const MyComponent = contextConnect( UnconnectedMyComponent, 'MyComponent' );
382
+ export const MyComponent = contextConnect(
383
+ UnconnectedMyComponent,
384
+ 'MyComponent'
385
+ );
294
386
  export default MyComponent;
295
387
  ```
296
388
 
@@ -314,16 +406,15 @@ Changing the styles of a non-experimental component must be done with care. To p
314
406
  import deprecated from '@wordpress/deprecated';
315
407
  import { Wrapper } from './styles.ts';
316
408
 
317
- function MyComponent({ __nextHasNoOuterMargins = false }) {
409
+ function MyComponent( { __nextHasNoOuterMargins = false } ) {
318
410
  if ( ! __nextHasNoOuterMargins ) {
319
411
  deprecated( 'Outer margin styles for wp.components.MyComponent', {
320
412
  since: '6.0',
321
413
  version: '6.2', // Set a reasonable grace period depending on impact
322
- hint:
323
- 'Set the `__nextHasNoOuterMargins` prop to true to start opting into the new styles, which will become the default in a future version.',
414
+ hint: 'Set the `__nextHasNoOuterMargins` prop to true to start opting into the new styles, which will become the default in a future version.',
324
415
  } );
325
416
  }
326
- return <Wrapper __nextHasNoOuterMargins={__nextHasNoOuterMargins} />
417
+ return <Wrapper __nextHasNoOuterMargins={ __nextHasNoOuterMargins } />;
327
418
  }
328
419
  ```
329
420
 
@@ -331,7 +422,7 @@ Styles should be structured so the deprecated styles are cleanly encapsulated, a
331
422
 
332
423
  ```js
333
424
  // styles.ts
334
- const deprecatedMargins = ({ __nextHasNoOuterMargins }) => {
425
+ const deprecatedMargins = ( { __nextHasNoOuterMargins } ) => {
335
426
  if ( ! __nextHasNoOuterMargins ) {
336
427
  return css`
337
428
  margin: 8px;
@@ -342,7 +433,7 @@ const deprecatedMargins = ({ __nextHasNoOuterMargins }) => {
342
433
  export const Wrapper = styled.div`
343
434
  margin: 0;
344
435
 
345
- ${deprecatedMargins}
436
+ ${ deprecatedMargins }
346
437
  `;
347
438
  ```
348
439
 
@@ -358,14 +449,14 @@ Not all style changes justify a formal deprecation process. The main thing to lo
358
449
 
359
450
  ##### DOES need formal deprecation
360
451
 
361
- - Removing an outer margin.
362
- - Substantial changes to width/height, such as adding or removing a size restriction.
452
+ - Removing an outer margin.
453
+ - Substantial changes to width/height, such as adding or removing a size restriction.
363
454
 
364
455
  ##### DOES NOT need formal deprecation
365
456
 
366
- - Breakage only occurs in non-standard usage, such as when the consumer is overriding component internals.
367
- - Minor layout shifts of a few pixels.
368
- - Internal layout changes of a higher-level component.
457
+ - Breakage only occurs in non-standard usage, such as when the consumer is overriding component internals.
458
+ - Minor layout shifts of a few pixels.
459
+ - Internal layout changes of a higher-level component.
369
460
 
370
461
  ## Context system
371
462
 
@@ -373,9 +464,9 @@ The `@wordpress/components` context system is based on [React's `Context` API](h
373
464
 
374
465
  Components can use this system via a couple of functions:
375
466
 
376
- - they can provide values using a shared `ContextSystemProvider` component
377
- - they can connect to the Context via `contextConnect`
378
- - they can read the "computed" values from the context via `useContextSystem`
467
+ - they can provide values using a shared `ContextSystemProvider` component
468
+ - they can connect to the Context via `contextConnect`
469
+ - they can read the "computed" values from the context via `useContextSystem`
379
470
 
380
471
  An example of how this is used can be found in the [`Card` component family](/packages/components/src/card). For example, this is how the `Card` component injects the `size` and `isBorderless` props down to its `CardBody` subcomponent — which makes it use the correct spacing and border settings "auto-magically".
381
472
 
@@ -400,11 +491,7 @@ export function useCard( props ) {
400
491
  import { contextConnect, ContextSystemProvider } from '../../context';
401
492
 
402
493
  function Card( props, forwardedRef ) {
403
- const {
404
- size,
405
- isBorderless,
406
- ...otherComputedHookProps
407
- } = useCard( props );
494
+ const { size, isBorderless, ...otherComputedHookProps } = useCard( props );
408
495
 
409
496
  // [...]
410
497
 
@@ -441,7 +528,10 @@ export function useCardBody( props ) {
441
528
  // If a `CardBody` component is rendered as a child of a `Card` component, the value of
442
529
  // the `size` prop will be the one set by the parent `Card` component via the Context
443
530
  // System (unless the prop gets explicitely set on the `CardBody` component).
444
- const { size = 'medium', ...otherDerivedProps } = useContextSystem( props, 'CardBody' );
531
+ const { size = 'medium', ...otherDerivedProps } = useContextSystem(
532
+ props,
533
+ 'CardBody'
534
+ );
445
535
 
446
536
  // [...]
447
537
 
@@ -457,7 +547,7 @@ Please refer to the [JavaScript Testing Overview docs](/docs/contributors/code/t
457
547
 
458
548
  All new components should add stories to the project's [Storybook](https://storybook.js.org/). Each [story](https://storybook.js.org/docs/react/get-started/whats-a-story) captures the rendered state of a UI component in isolation. This greatly simplifies working on a given component, while also serving as an interactive form of documentation.
459
549
 
460
- A component's story should be showcasing its different states — for example, the different variants of a `Button`:
550
+ A component's story should be showcasing its different states — for example, the different variants of a `Button`:
461
551
 
462
552
  ```jsx
463
553
  import Button from '../';
@@ -543,6 +633,7 @@ Prop description. With a new line before and after the description and before an
543
633
  Add this section when there are props that are drilled down into an internal component. See [ClipboardButton](/packages/components/src/clipboard-button/README.md) for an example.
544
634
 
545
635
  <!-- Only add the next section if the component relies on the [Context System](#context-system) -->
636
+
546
637
  ## Context
547
638
 
548
639
  See examples for this section for the [ItemGroup](/packages/components/src/item-group/item-group/README.md#context) and [`Card`](/packages/components/src/card/card/README.md#context) components.
@@ -601,8 +692,8 @@ As the needs of the package evolve with time, sometimes we may opt to fully rewr
601
692
 
602
693
  Here is some terminology that will be used in the upcoming sections:
603
694
 
604
- - "Legacy" component: the version(s) of the component that existsted on `trunk` before the rewrite;
605
- - API surface: the component's public APIs. It includes the list of components (and sub-components) exported from the package, their props, any associated React context. It does not include internal classnames and internal DOM structure of the components.
695
+ - "Legacy" component: the version(s) of the component that existsted on `trunk` before the rewrite;
696
+ - API surface: the component's public APIs. It includes the list of components (and subcomponents) exported from the package, their props, any associated React context. It does not include internal classnames and internal DOM structure of the components.
606
697
 
607
698
  ### Approaches
608
699
 
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = Cell;
8
- var _v = require("../composite/v2");
8
+ var _composite = require("../composite");
9
9
  var _tooltip = _interopRequireDefault(require("../tooltip"));
10
10
  var _visuallyHidden = require("../visually-hidden");
11
11
  var _utils = require("./utils");
@@ -28,7 +28,7 @@ function Cell({
28
28
  const tooltipText = _utils.ALIGNMENT_LABEL[value];
29
29
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_tooltip.default, {
30
30
  text: tooltipText,
31
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_v.CompositeItem, {
31
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_composite.Composite.Item, {
32
32
  id: id,
33
33
  render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_alignmentMatrixControlStyles.Cell, {
34
34
  ...props,
@@ -1 +1 @@
1
- {"version":3,"names":["_v","require","_tooltip","_interopRequireDefault","_visuallyHidden","_utils","_alignmentMatrixControlStyles","_jsxRuntime","Cell","id","isActive","value","props","tooltipText","ALIGNMENT_LABEL","jsx","default","text","children","jsxs","CompositeItem","render","role","VisuallyHidden","Point"],"sources":["@wordpress/components/src/alignment-matrix-control/cell.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { CompositeItem } from '../composite/v2';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport {\n\tCell as CellView,\n\tPoint,\n} from './styles/alignment-matrix-control-styles';\nimport type { AlignmentMatrixControlCellProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nexport default function Cell( {\n\tid,\n\tisActive = false,\n\tvalue,\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlCellProps, 'span', false > ) {\n\tconst tooltipText = ALIGNMENT_LABEL[ value ];\n\n\treturn (\n\t\t<Tooltip text={ tooltipText }>\n\t\t\t<CompositeItem\n\t\t\t\tid={ id }\n\t\t\t\trender={ <CellView { ...props } role=\"gridcell\" /> }\n\t\t\t>\n\t\t\t\t{ /* VoiceOver needs a text content to be rendered within grid cell,\n\t\t\totherwise it'll announce the content as \"blank\". So we use a visually\n\t\t\thidden element instead of aria-label. */ }\n\t\t\t\t<VisuallyHidden>{ value }</VisuallyHidden>\n\t\t\t\t<Point isActive={ isActive } role=\"presentation\" />\n\t\t\t</CompositeItem>\n\t\t</Tooltip>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,EAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AAGkD,IAAAM,WAAA,GAAAN,OAAA;AAdlD;AACA;AACA;;AAKA;AACA;AACA;;AASe,SAASO,IAAIA,CAAE;EAC7BC,EAAE;EACFC,QAAQ,GAAG,KAAK;EAChBC,KAAK;EACL,GAAGC;AACuE,CAAC,EAAG;EAC9E,MAAMC,WAAW,GAAGC,sBAAe,CAAEH,KAAK,CAAE;EAE5C,oBACC,IAAAJ,WAAA,CAAAQ,GAAA,EAACb,QAAA,CAAAc,OAAO;IAACC,IAAI,EAAGJ,WAAa;IAAAK,QAAA,eAC5B,IAAAX,WAAA,CAAAY,IAAA,EAACnB,EAAA,CAAAoB,aAAa;MACbX,EAAE,EAAGA,EAAI;MACTY,MAAM,eAAG,IAAAd,WAAA,CAAAQ,GAAA,EAACT,6BAAA,CAAAE,IAAQ;QAAA,GAAMI,KAAK;QAAGU,IAAI,EAAC;MAAU,CAAE,CAAG;MAAAJ,QAAA,gBAKpD,IAAAX,WAAA,CAAAQ,GAAA,EAACX,eAAA,CAAAmB,cAAc;QAAAL,QAAA,EAAGP;MAAK,CAAkB,CAAC,eAC1C,IAAAJ,WAAA,CAAAQ,GAAA,EAACT,6BAAA,CAAAkB,KAAK;QAACd,QAAQ,EAAGA,QAAU;QAACY,IAAI,EAAC;MAAc,CAAE,CAAC;IAAA,CACrC;EAAC,CACR,CAAC;AAEZ","ignoreList":[]}
1
+ {"version":3,"names":["_composite","require","_tooltip","_interopRequireDefault","_visuallyHidden","_utils","_alignmentMatrixControlStyles","_jsxRuntime","Cell","id","isActive","value","props","tooltipText","ALIGNMENT_LABEL","jsx","default","text","children","jsxs","Composite","Item","render","role","VisuallyHidden","Point"],"sources":["@wordpress/components/src/alignment-matrix-control/cell.tsx"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { Composite } from '../composite';\nimport Tooltip from '../tooltip';\nimport { VisuallyHidden } from '../visually-hidden';\n\n/**\n * Internal dependencies\n */\nimport { ALIGNMENT_LABEL } from './utils';\nimport {\n\tCell as CellView,\n\tPoint,\n} from './styles/alignment-matrix-control-styles';\nimport type { AlignmentMatrixControlCellProps } from './types';\nimport type { WordPressComponentProps } from '../context';\n\nexport default function Cell( {\n\tid,\n\tisActive = false,\n\tvalue,\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlCellProps, 'span', false > ) {\n\tconst tooltipText = ALIGNMENT_LABEL[ value ];\n\n\treturn (\n\t\t<Tooltip text={ tooltipText }>\n\t\t\t<Composite.Item\n\t\t\t\tid={ id }\n\t\t\t\trender={ <CellView { ...props } role=\"gridcell\" /> }\n\t\t\t>\n\t\t\t\t{ /* VoiceOver needs a text content to be rendered within grid cell,\n\t\t\totherwise it'll announce the content as \"blank\". So we use a visually\n\t\t\thidden element instead of aria-label. */ }\n\t\t\t\t<VisuallyHidden>{ value }</VisuallyHidden>\n\t\t\t\t<Point isActive={ isActive } role=\"presentation\" />\n\t\t\t</Composite.Item>\n\t\t</Tooltip>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,6BAAA,GAAAL,OAAA;AAGkD,IAAAM,WAAA,GAAAN,OAAA;AAdlD;AACA;AACA;;AAKA;AACA;AACA;;AASe,SAASO,IAAIA,CAAE;EAC7BC,EAAE;EACFC,QAAQ,GAAG,KAAK;EAChBC,KAAK;EACL,GAAGC;AACuE,CAAC,EAAG;EAC9E,MAAMC,WAAW,GAAGC,sBAAe,CAAEH,KAAK,CAAE;EAE5C,oBACC,IAAAJ,WAAA,CAAAQ,GAAA,EAACb,QAAA,CAAAc,OAAO;IAACC,IAAI,EAAGJ,WAAa;IAAAK,QAAA,eAC5B,IAAAX,WAAA,CAAAY,IAAA,EAACnB,UAAA,CAAAoB,SAAS,CAACC,IAAI;MACdZ,EAAE,EAAGA,EAAI;MACTa,MAAM,eAAG,IAAAf,WAAA,CAAAQ,GAAA,EAACT,6BAAA,CAAAE,IAAQ;QAAA,GAAMI,KAAK;QAAGW,IAAI,EAAC;MAAU,CAAE,CAAG;MAAAL,QAAA,gBAKpD,IAAAX,WAAA,CAAAQ,GAAA,EAACX,eAAA,CAAAoB,cAAc;QAAAN,QAAA,EAAGP;MAAK,CAAkB,CAAC,eAC1C,IAAAJ,WAAA,CAAAQ,GAAA,EAACT,6BAAA,CAAAmB,KAAK;QAACf,QAAQ,EAAGA,QAAU;QAACa,IAAI,EAAC;MAAc,CAAE,CAAC;IAAA,CACpC;EAAC,CACT,CAAC;AAEZ","ignoreList":[]}
@@ -7,10 +7,11 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.AlignmentMatrixControl = AlignmentMatrixControl;
8
8
  exports.default = void 0;
9
9
  var _clsx = _interopRequireDefault(require("clsx"));
10
+ var _react = require("@ariakit/react");
10
11
  var _i18n = require("@wordpress/i18n");
11
12
  var _compose = require("@wordpress/compose");
12
13
  var _cell = _interopRequireDefault(require("./cell"));
13
- var _v = require("../composite/v2");
14
+ var _composite = require("../composite");
14
15
  var _alignmentMatrixControlStyles = require("./styles/alignment-matrix-control-styles");
15
16
  var _icon = _interopRequireDefault(require("./icon"));
16
17
  var _utils = require("./utils");
@@ -58,7 +59,7 @@ function AlignmentMatrixControl({
58
59
  ...props
59
60
  }) {
60
61
  const baseId = (0, _compose.useInstanceId)(AlignmentMatrixControl, 'alignment-matrix-control', id);
61
- const compositeStore = (0, _v.useCompositeStore)({
62
+ const compositeStore = (0, _composite.useCompositeStore)({
62
63
  defaultActiveId: (0, _utils.getItemId)(baseId, defaultValue),
63
64
  activeId: (0, _utils.getItemId)(baseId, value),
64
65
  setActiveId: nextActiveId => {
@@ -69,9 +70,9 @@ function AlignmentMatrixControl({
69
70
  },
70
71
  rtl: (0, _i18n.isRTL)()
71
72
  });
72
- const activeId = compositeStore.useState('activeId');
73
+ const activeId = (0, _react.useStoreState)(compositeStore, 'activeId');
73
74
  const classes = (0, _clsx.default)('component-alignment-matrix-control', className);
74
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_v.Composite, {
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_composite.Composite, {
75
76
  store: compositeStore,
76
77
  render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_alignmentMatrixControlStyles.Root, {
77
78
  ...props,
@@ -81,7 +82,7 @@ function AlignmentMatrixControl({
81
82
  role: "grid",
82
83
  size: width
83
84
  }),
84
- children: _utils.GRID.map((cells, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_v.CompositeRow, {
85
+ children: _utils.GRID.map((cells, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_composite.Composite.Row, {
85
86
  render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_alignmentMatrixControlStyles.Row, {
86
87
  role: "row"
87
88
  }),
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_i18n","_compose","_cell","_v","_alignmentMatrixControlStyles","_icon","_utils","_jsxRuntime","AlignmentMatrixControl","className","id","label","__","defaultValue","value","onChange","width","props","baseId","useInstanceId","compositeStore","useCompositeStore","defaultActiveId","getItemId","activeId","setActiveId","nextActiveId","nextValue","getItemValue","rtl","isRTL","useState","classes","clsx","jsx","Composite","store","render","Root","role","size","children","GRID","map","cells","index","CompositeRow","Row","cell","cellId","isActive","default","Icon","AlignmentMatrixControlIcon","_default","exports"],"sources":["@wordpress/components/src/alignment-matrix-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite, CompositeRow, useCompositeStore } from '../composite/v2';\nimport { Root, Row } from './styles/alignment-matrix-control-styles';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport type { WordPressComponentProps } from '../context';\nimport type { AlignmentMatrixControlProps } from './types';\n\n/**\n *\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport function AlignmentMatrixControl( {\n\tclassName,\n\tid,\n\tlabel = __( 'Alignment Matrix Control' ),\n\tdefaultValue = 'center center',\n\tvalue,\n\tonChange,\n\twidth = 92,\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlProps, 'div', false > ) {\n\tconst baseId = useInstanceId(\n\t\tAlignmentMatrixControl,\n\t\t'alignment-matrix-control',\n\t\tid\n\t);\n\n\tconst compositeStore = useCompositeStore( {\n\t\tdefaultActiveId: getItemId( baseId, defaultValue ),\n\t\tactiveId: getItemId( baseId, value ),\n\t\tsetActiveId: ( nextActiveId ) => {\n\t\t\tconst nextValue = getItemValue( baseId, nextActiveId );\n\t\t\tif ( nextValue ) {\n\t\t\t\tonChange?.( nextValue );\n\t\t\t}\n\t\t},\n\t\trtl: isRTL(),\n\t} );\n\n\tconst activeId = compositeStore.useState( 'activeId' );\n\n\tconst classes = clsx( 'component-alignment-matrix-control', className );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trender={\n\t\t\t\t<Root\n\t\t\t\t\t{ ...props }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\tid={ baseId }\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\tsize={ width }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ GRID.map( ( cells, index ) => (\n\t\t\t\t<CompositeRow render={ <Row role=\"row\" /> } key={ index }>\n\t\t\t\t\t{ cells.map( ( cell ) => {\n\t\t\t\t\t\tconst cellId = getItemId( baseId, cell );\n\t\t\t\t\t\tconst isActive = cellId === activeId;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tid={ cellId }\n\t\t\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\t\t\tkey={ cell }\n\t\t\t\t\t\t\t\tvalue={ cell }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</CompositeRow>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\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,aAA0B;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAJ,OAAA,GAE1C3C,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_react","_i18n","_compose","_cell","_composite","_alignmentMatrixControlStyles","_icon","_utils","_jsxRuntime","AlignmentMatrixControl","className","id","label","__","defaultValue","value","onChange","width","props","baseId","useInstanceId","compositeStore","useCompositeStore","defaultActiveId","getItemId","activeId","setActiveId","nextActiveId","nextValue","getItemValue","rtl","isRTL","useStoreState","classes","clsx","jsx","Composite","store","render","Root","role","size","children","GRID","map","cells","index","Row","cell","cellId","isActive","default","Icon","AlignmentMatrixControlIcon","_default","exports"],"sources":["@wordpress/components/src/alignment-matrix-control/index.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport { useStoreState } from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport Cell from './cell';\nimport { Composite, useCompositeStore } from '../composite';\nimport { Root, Row } from './styles/alignment-matrix-control-styles';\nimport AlignmentMatrixControlIcon from './icon';\nimport { GRID, getItemId, getItemValue } from './utils';\nimport type { WordPressComponentProps } from '../context';\nimport type { AlignmentMatrixControlProps } from './types';\n\n/**\n *\n * AlignmentMatrixControl components enable adjustments to horizontal and vertical alignments for UI.\n *\n * ```jsx\n * import { __experimentalAlignmentMatrixControl as AlignmentMatrixControl } from '@wordpress/components';\n * import { useState } from '@wordpress/element';\n *\n * const Example = () => {\n * \tconst [ alignment, setAlignment ] = useState( 'center center' );\n *\n * \treturn (\n * \t\t<AlignmentMatrixControl\n * \t\t\tvalue={ alignment }\n * \t\t\tonChange={ setAlignment }\n * \t\t/>\n * \t);\n * };\n * ```\n */\nexport function AlignmentMatrixControl( {\n\tclassName,\n\tid,\n\tlabel = __( 'Alignment Matrix Control' ),\n\tdefaultValue = 'center center',\n\tvalue,\n\tonChange,\n\twidth = 92,\n\t...props\n}: WordPressComponentProps< AlignmentMatrixControlProps, 'div', false > ) {\n\tconst baseId = useInstanceId(\n\t\tAlignmentMatrixControl,\n\t\t'alignment-matrix-control',\n\t\tid\n\t);\n\n\tconst compositeStore = useCompositeStore( {\n\t\tdefaultActiveId: getItemId( baseId, defaultValue ),\n\t\tactiveId: getItemId( baseId, value ),\n\t\tsetActiveId: ( nextActiveId ) => {\n\t\t\tconst nextValue = getItemValue( baseId, nextActiveId );\n\t\t\tif ( nextValue ) {\n\t\t\t\tonChange?.( nextValue );\n\t\t\t}\n\t\t},\n\t\trtl: isRTL(),\n\t} );\n\n\tconst activeId = useStoreState( compositeStore, 'activeId' );\n\n\tconst classes = clsx( 'component-alignment-matrix-control', className );\n\n\treturn (\n\t\t<Composite\n\t\t\tstore={ compositeStore }\n\t\t\trender={\n\t\t\t\t<Root\n\t\t\t\t\t{ ...props }\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tclassName={ classes }\n\t\t\t\t\tid={ baseId }\n\t\t\t\t\trole=\"grid\"\n\t\t\t\t\tsize={ width }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t{ GRID.map( ( cells, index ) => (\n\t\t\t\t<Composite.Row render={ <Row role=\"row\" /> } key={ index }>\n\t\t\t\t\t{ cells.map( ( cell ) => {\n\t\t\t\t\t\tconst cellId = getItemId( baseId, cell );\n\t\t\t\t\t\tconst isActive = cellId === activeId;\n\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tid={ cellId }\n\t\t\t\t\t\t\t\tisActive={ isActive }\n\t\t\t\t\t\t\t\tkey={ cell }\n\t\t\t\t\t\t\t\tvalue={ cell }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</Composite.Row>\n\t\t\t) ) }\n\t\t</Composite>\n\t);\n}\n\nAlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;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