@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
@@ -60,7 +60,6 @@ function isMultipleCategorySelection(
60
60
  * ```
61
61
  */
62
62
  export function QueryControls( {
63
- __next40pxDefaultSize = false,
64
63
  authorList,
65
64
  selectedAuthorId,
66
65
  numberOfItems,
@@ -82,7 +81,7 @@ export function QueryControls( {
82
81
  onOrderChange && onOrderByChange && (
83
82
  <SelectControl
84
83
  __nextHasNoMarginBottom
85
- __next40pxDefaultSize={ __next40pxDefaultSize }
84
+ __next40pxDefaultSize
86
85
  key="query-controls-order-select"
87
86
  label={ __( 'Order by' ) }
88
87
  value={
@@ -137,7 +136,7 @@ export function QueryControls( {
137
136
  props.categoriesList &&
138
137
  props.onCategoryChange && (
139
138
  <CategorySelect
140
- __next40pxDefaultSize={ __next40pxDefaultSize }
139
+ __next40pxDefaultSize
141
140
  key="query-controls-category-select"
142
141
  categoriesList={ props.categoriesList }
143
142
  label={ __( 'Category' ) }
@@ -150,7 +149,7 @@ export function QueryControls( {
150
149
  props.categorySuggestions &&
151
150
  props.onCategoryChange && (
152
151
  <FormTokenField
153
- __next40pxDefaultSize={ __next40pxDefaultSize }
152
+ __next40pxDefaultSize
154
153
  __nextHasNoMarginBottom
155
154
  key="query-controls-categories-select"
156
155
  label={ __( 'Categories' ) }
@@ -174,7 +173,7 @@ export function QueryControls( {
174
173
  ),
175
174
  onAuthorChange && (
176
175
  <AuthorSelect
177
- __next40pxDefaultSize={ __next40pxDefaultSize }
176
+ __next40pxDefaultSize
178
177
  key="query-controls-author-select"
179
178
  authorList={ authorList }
180
179
  label={ __( 'Author' ) }
@@ -186,7 +185,7 @@ export function QueryControls( {
186
185
  onNumberOfItemsChange && (
187
186
  <RangeControl
188
187
  __nextHasNoMarginBottom
189
- __next40pxDefaultSize={ __next40pxDefaultSize }
188
+ __next40pxDefaultSize
190
189
  key="query-controls-range-control"
191
190
  label={ __( 'Number of items' ) }
192
191
  value={ numberOfItems }
@@ -107,7 +107,8 @@ type BaseQueryControlsProps = {
107
107
  * Start opting into the larger default height that will become the
108
108
  * default size in a future version.
109
109
  *
110
- * @default false
110
+ * @deprecated Default behavior since WP 6.7. Prop can be safely removed.
111
+ * @ignore
111
112
  */
112
113
  __next40pxDefaultSize?: boolean;
113
114
  };
@@ -16,8 +16,8 @@ import BaseControl from '../base-control';
16
16
  import type { WordPressComponentProps } from '../context';
17
17
  import type { RadioControlProps } from './types';
18
18
  import { VStack } from '../v-stack';
19
- import { useBaseControlProps } from '../base-control/hooks';
20
19
  import { StyledHelp } from '../base-control/styles/base-control-styles';
20
+ import { VisuallyHidden } from '../visually-hidden';
21
21
 
22
22
  function generateOptionDescriptionId( radioGroupId: string, index: number ) {
23
23
  return `${ radioGroupId }-${ index }-option-description`;
@@ -27,6 +27,10 @@ function generateOptionId( radioGroupId: string, index: number ) {
27
27
  return `${ radioGroupId }-${ index }`;
28
28
  }
29
29
 
30
+ function generateHelpId( radioGroupId: string ) {
31
+ return `${ radioGroupId }__help`;
32
+ }
33
+
30
34
  /**
31
35
  * Render a user interface to select the user type using radio inputs.
32
36
  *
@@ -75,24 +79,24 @@ export function RadioControl(
75
79
  const onChangeValue = ( event: ChangeEvent< HTMLInputElement > ) =>
76
80
  onChange( event.target.value );
77
81
 
78
- // Use `useBaseControlProps` to get the id of the help text.
79
- const {
80
- controlProps: { 'aria-describedby': helpTextId },
81
- } = useBaseControlProps( { id, help } );
82
-
83
82
  if ( ! options?.length ) {
84
83
  return null;
85
84
  }
86
85
 
87
86
  return (
88
- <BaseControl
89
- __nextHasNoMarginBottom
90
- label={ label }
87
+ <fieldset
91
88
  id={ id }
92
- hideLabelFromVision={ hideLabelFromVision }
93
- help={ help }
94
89
  className={ clsx( className, 'components-radio-control' ) }
90
+ aria-describedby={ !! help ? generateHelpId( id ) : undefined }
95
91
  >
92
+ { hideLabelFromVision ? (
93
+ <VisuallyHidden as="legend">{ label }</VisuallyHidden>
94
+ ) : (
95
+ <BaseControl.VisualLabel as="legend">
96
+ { label }
97
+ </BaseControl.VisualLabel>
98
+ ) }
99
+
96
100
  <VStack
97
101
  spacing={ 3 }
98
102
  className={ clsx( 'components-radio-control__group-wrapper', {
@@ -113,14 +117,9 @@ export function RadioControl(
113
117
  onChange={ onChangeValue }
114
118
  checked={ option.value === selected }
115
119
  aria-describedby={
116
- clsx( [
117
- !! option.description &&
118
- generateOptionDescriptionId(
119
- id,
120
- index
121
- ),
122
- helpTextId,
123
- ] ) || undefined
120
+ !! option.description
121
+ ? generateOptionDescriptionId( id, index )
122
+ : undefined
124
123
  }
125
124
  { ...additionalProps }
126
125
  />
@@ -142,7 +141,16 @@ export function RadioControl(
142
141
  </div>
143
142
  ) ) }
144
143
  </VStack>
145
- </BaseControl>
144
+ { !! help && (
145
+ <StyledHelp
146
+ __nextHasNoMarginBottom
147
+ id={ generateHelpId( id ) }
148
+ className="components-base-control__help"
149
+ >
150
+ { help }
151
+ </StyledHelp>
152
+ ) }
153
+ </fieldset>
146
154
  );
147
155
  }
148
156
 
@@ -1,3 +1,12 @@
1
+ .components-radio-control {
2
+ border: 0;
3
+ margin: 0;
4
+ padding: 0;
5
+
6
+ font-family: $default-font;
7
+ font-size: $default-font-size;
8
+ }
9
+
1
10
  .components-radio-control__group-wrapper.has-help {
2
11
  margin-block-end: $grid-unit-15;
3
12
  }
@@ -32,7 +41,7 @@
32
41
 
33
42
  &::before {
34
43
  content: "";
35
- border-radius: 50%;
44
+ border-radius: $radius-round;
36
45
  }
37
46
  }
38
47
  }
@@ -57,5 +66,7 @@
57
66
 
58
67
  // Override the top margin of the StyledHelp component from BaseControl.
59
68
  // TODO: we should tweak the StyledHelp component to not have a top margin.
60
- margin-top: 0;
69
+ &.components-radio-control__option-description {
70
+ margin-top: 0;
71
+ }
61
72
  }
@@ -56,6 +56,47 @@ describe.each( [
56
56
  const [ , Component ] = modeAndComponent;
57
57
 
58
58
  describe( 'semantics and labelling', () => {
59
+ it( 'should group all radios under a fieldset with an accessible label (legend)', () => {
60
+ const onChangeSpy = jest.fn();
61
+ render(
62
+ <Component { ...defaultProps } onChange={ onChangeSpy } />
63
+ );
64
+
65
+ expect(
66
+ screen.getByRole( 'group', { name: defaultProps.label } )
67
+ ).toBeVisible();
68
+ } );
69
+
70
+ it( 'should group all radios under a fieldset with an accessible label even when the label is visually hidden', () => {
71
+ const onChangeSpy = jest.fn();
72
+ render(
73
+ <Component
74
+ { ...defaultProps }
75
+ hideLabelFromVision
76
+ onChange={ onChangeSpy }
77
+ />
78
+ );
79
+
80
+ expect(
81
+ screen.getByRole( 'group', { name: defaultProps.label } )
82
+ ).toBeVisible();
83
+ } );
84
+
85
+ it( 'should describe the radio group with the help text', () => {
86
+ const onChangeSpy = jest.fn();
87
+ render(
88
+ <Component
89
+ { ...defaultProps }
90
+ help="Test help text"
91
+ onChange={ onChangeSpy }
92
+ />
93
+ );
94
+
95
+ expect(
96
+ screen.getByRole( 'group', { name: defaultProps.label } )
97
+ ).toHaveAccessibleDescription( 'Test help text' );
98
+ } );
99
+
59
100
  it( 'should render radio inputs with accessible labels', () => {
60
101
  const onChangeSpy = jest.fn();
61
102
  render(
@@ -101,46 +142,7 @@ describe.each( [
101
142
  ).toHaveAccessibleName( defaultProps.options[ 1 ].label );
102
143
  } );
103
144
 
104
- it( 'should use the group help text to describe individual options', () => {
105
- const onChangeSpy = jest.fn();
106
- render(
107
- <Component
108
- { ...defaultProps }
109
- onChange={ onChangeSpy }
110
- selected={ defaultProps.options[ 1 ].value }
111
- help="Select your favorite animal."
112
- />
113
- );
114
-
115
- for ( const option of defaultProps.options ) {
116
- expect(
117
- screen.getByRole( 'radio', { name: option.label } )
118
- ).toHaveAccessibleDescription( 'Select your favorite animal.' );
119
- }
120
- } );
121
-
122
145
  it( 'should use the option description text to describe individual options', () => {
123
- const onChangeSpy = jest.fn();
124
- render(
125
- <Component
126
- { ...defaultPropsWithDescriptions }
127
- onChange={ onChangeSpy }
128
- selected={ defaultProps.options[ 1 ].value }
129
- />
130
- );
131
-
132
- let index = 1;
133
- for ( const option of defaultProps.options ) {
134
- expect(
135
- screen.getByRole( 'radio', { name: option.label } )
136
- ).toHaveAccessibleDescription(
137
- `This is the option number ${ index }.`
138
- );
139
- index += 1;
140
- }
141
- } );
142
-
143
- it( 'should use both the option description text and the group help text to describe individual options', () => {
144
146
  const onChangeSpy = jest.fn();
145
147
  render(
146
148
  <Component
@@ -151,12 +153,13 @@ describe.each( [
151
153
  />
152
154
  );
153
155
 
156
+ // Group help text should not be used to describe individual options.
154
157
  let index = 1;
155
158
  for ( const option of defaultProps.options ) {
156
159
  expect(
157
160
  screen.getByRole( 'radio', { name: option.label } )
158
161
  ).toHaveAccessibleDescription(
159
- `This is the option number ${ index }. Select your favorite animal`
162
+ `This is the option number ${ index }.`
160
163
  );
161
164
  index += 1;
162
165
  }
@@ -7,6 +7,7 @@ import { forwardRef, useContext } from '@wordpress/element';
7
7
  * External dependencies
8
8
  */
9
9
  import * as Ariakit from '@ariakit/react';
10
+ import { useStoreState } from '@ariakit/react';
10
11
 
11
12
  /**
12
13
  * Internal dependencies
@@ -26,7 +27,7 @@ function UnforwardedRadio(
26
27
  ) {
27
28
  const { store, disabled } = useContext( RadioGroupContext );
28
29
 
29
- const selectedValue = store?.useState( 'value' );
30
+ const selectedValue = useStoreState( store, 'value' );
30
31
  const isChecked = selectedValue !== undefined && selectedValue === value;
31
32
 
32
33
  return (
@@ -362,6 +362,13 @@ Determines if the `input` number field will render next to the RangeControl. Thi
362
362
  - Required: No
363
363
  - Platform: Web
364
364
 
365
+ ### `__next40pxDefaultSize`: `boolean`
366
+
367
+ Start opting into the larger default height that will become the default size in a future version.
368
+
369
+ - Required: No
370
+ - Default: `false`
371
+
365
372
  ### `__nextHasNoMarginBottom`: `boolean`
366
373
 
367
374
  Start opting into the new margin-free styles that will become the default in a future version.
@@ -41,6 +41,25 @@ import { space } from '../utils/space';
41
41
 
42
42
  const noop = () => {};
43
43
 
44
+ /**
45
+ * Computes the value that `RangeControl` should reset to when pressing
46
+ * the reset button.
47
+ */
48
+ function computeResetValue( {
49
+ resetFallbackValue,
50
+ initialPosition,
51
+ }: Pick< RangeControlProps, 'resetFallbackValue' | 'initialPosition' > ) {
52
+ if ( resetFallbackValue !== undefined ) {
53
+ return ! Number.isNaN( resetFallbackValue ) ? resetFallbackValue : null;
54
+ }
55
+
56
+ if ( initialPosition !== undefined ) {
57
+ return ! Number.isNaN( initialPosition ) ? initialPosition : null;
58
+ }
59
+
60
+ return null;
61
+ }
62
+
44
63
  function UnforwardedRangeControl(
45
64
  props: WordPressComponentProps< RangeControlProps, 'input', false >,
46
65
  forwardedRef: ForwardedRef< HTMLInputElement >
@@ -166,13 +185,12 @@ function UnforwardedRangeControl(
166
185
  };
167
186
 
168
187
  const handleOnReset = () => {
169
- let resetValue: number | null = parseFloat( `${ resetFallbackValue }` );
170
- let onChangeResetValue: number | undefined = resetValue;
171
-
172
- if ( isNaN( resetValue ) ) {
173
- resetValue = null;
174
- onChangeResetValue = undefined;
175
- }
188
+ // Reset to `resetFallbackValue` if defined, otherwise set internal value
189
+ // to `null` which, if propagated to the `value` prop, will cause
190
+ // the value to be reset to the `initialPosition` prop if defined.
191
+ const resetValue = Number.isNaN( resetFallbackValue )
192
+ ? null
193
+ : resetFallbackValue ?? null;
176
194
 
177
195
  setValue( resetValue );
178
196
 
@@ -189,7 +207,7 @@ function UnforwardedRangeControl(
189
207
  * preserve the undefined callback argument, except when a
190
208
  * resetFallbackValue is defined.
191
209
  */
192
- onChange( onChangeResetValue );
210
+ onChange( resetValue ?? undefined );
193
211
  };
194
212
 
195
213
  const handleShowTooltip = () => setShowTooltip( true );
@@ -210,9 +228,11 @@ function UnforwardedRangeControl(
210
228
  const offsetStyle = {
211
229
  [ isRTL() ? 'right' : 'left' ]: fillValueOffset,
212
230
  };
231
+
213
232
  return (
214
233
  <BaseControl
215
234
  __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
235
+ __associatedWPComponentName="RangeControl"
216
236
  className={ classes }
217
237
  label={ label }
218
238
  hideLabelFromVision={ hideLabelFromVision }
@@ -328,7 +348,17 @@ function UnforwardedRangeControl(
328
348
  className="components-range-control__reset"
329
349
  // If the RangeControl itself is disabled, the reset button shouldn't be in the tab sequence.
330
350
  accessibleWhenDisabled={ ! disabled }
331
- disabled={ disabled || value === undefined }
351
+ // The reset button should be disabled if RangeControl itself is disabled,
352
+ // or if the current `value` is equal to the value that would be currently
353
+ // assigned when clicking the button.
354
+ disabled={
355
+ disabled ||
356
+ value ===
357
+ computeResetValue( {
358
+ resetFallbackValue,
359
+ initialPosition,
360
+ } )
361
+ }
332
362
  variant="secondary"
333
363
  size="small"
334
364
  onClick={ handleOnReset }
@@ -70,6 +70,7 @@ const Template: StoryFn< typeof RangeControl > = ( { onChange, ...args } ) => {
70
70
 
71
71
  export const Default: StoryFn< typeof RangeControl > = Template.bind( {} );
72
72
  Default.args = {
73
+ __nextHasNoMarginBottom: true,
73
74
  help: 'Please select how transparent you would like this.',
74
75
  initialPosition: 50,
75
76
  label: 'Opacity',
@@ -104,6 +105,7 @@ export const WithAnyStep: StoryFn< typeof RangeControl > = ( {
104
105
  );
105
106
  };
106
107
  WithAnyStep.args = {
108
+ __nextHasNoMarginBottom: true,
107
109
  label: 'Brightness',
108
110
  step: 'any',
109
111
  };
@@ -167,6 +169,7 @@ export const WithIntegerStepAndMarks: StoryFn< typeof RangeControl > =
167
169
  MarkTemplate.bind( {} );
168
170
 
169
171
  WithIntegerStepAndMarks.args = {
172
+ __nextHasNoMarginBottom: true,
170
173
  label: 'Integer Step',
171
174
  marks: marksBase,
172
175
  max: 10,
@@ -183,6 +186,7 @@ export const WithDecimalStepAndMarks: StoryFn< typeof RangeControl > =
183
186
  MarkTemplate.bind( {} );
184
187
 
185
188
  WithDecimalStepAndMarks.args = {
189
+ __nextHasNoMarginBottom: true,
186
190
  marks: [
187
191
  ...marksBase,
188
192
  { value: 3.5, label: '3.5' },
@@ -202,6 +206,7 @@ export const WithNegativeMinimumAndMarks: StoryFn< typeof RangeControl > =
202
206
  MarkTemplate.bind( {} );
203
207
 
204
208
  WithNegativeMinimumAndMarks.args = {
209
+ __nextHasNoMarginBottom: true,
205
210
  marks: marksWithNegatives,
206
211
  max: 10,
207
212
  min: -10,
@@ -217,6 +222,7 @@ export const WithNegativeRangeAndMarks: StoryFn< typeof RangeControl > =
217
222
  MarkTemplate.bind( {} );
218
223
 
219
224
  WithNegativeRangeAndMarks.args = {
225
+ __nextHasNoMarginBottom: true,
220
226
  marks: marksWithNegatives,
221
227
  max: -1,
222
228
  min: -10,
@@ -232,6 +238,7 @@ export const WithAnyStepAndMarks: StoryFn< typeof RangeControl > =
232
238
  MarkTemplate.bind( {} );
233
239
 
234
240
  WithAnyStepAndMarks.args = {
241
+ __nextHasNoMarginBottom: true,
235
242
  marks: marksBase,
236
243
  max: 10,
237
244
  min: 0,
@@ -154,7 +154,7 @@ export const Mark = styled.span`
154
154
  height: ${ thumbSize }px;
155
155
  left: 0;
156
156
  position: absolute;
157
- top: -4px;
157
+ top: 9px;
158
158
  width: 1px;
159
159
 
160
160
  ${ markFill };
@@ -170,7 +170,7 @@ export const MarkLabel = styled.span`
170
170
  color: ${ COLORS.gray[ 300 ] };
171
171
  font-size: 11px;
172
172
  position: absolute;
173
- top: 12px;
173
+ top: 22px;
174
174
  white-space: nowrap;
175
175
 
176
176
  ${ rtl( { left: 0 } ) };
@@ -6,7 +6,7 @@ import { act, fireEvent, render, screen } from '@testing-library/react';
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import RangeControl from '../';
9
+ import _RangeControl from '../';
10
10
 
11
11
  const getRangeInput = (): HTMLInputElement => screen.getByRole( 'slider' );
12
12
  const getNumberInput = (): HTMLInputElement => screen.getByRole( 'spinbutton' );
@@ -15,6 +15,12 @@ const getResetButton = (): HTMLButtonElement => screen.getByRole( 'button' );
15
15
  const fireChangeEvent = ( input: HTMLInputElement, value?: number | string ) =>
16
16
  fireEvent.change( input, { target: { value } } );
17
17
 
18
+ const RangeControl = (
19
+ props: React.ComponentProps< typeof _RangeControl >
20
+ ) => {
21
+ return <_RangeControl { ...props } __nextHasNoMarginBottom />;
22
+ };
23
+
18
24
  describe( 'RangeControl', () => {
19
25
  describe( '#render()', () => {
20
26
  it( 'should trigger change callback with numeric value', () => {
@@ -292,14 +298,37 @@ describe( 'RangeControl', () => {
292
298
  } );
293
299
 
294
300
  describe( 'reset', () => {
295
- it( 'should reset to a custom fallback value, defined by a parent component', () => {
301
+ it( 'should clear the input value when clicking the reset button', () => {
302
+ const spy = jest.fn();
303
+ render( <RangeControl allowReset onChange={ spy } /> );
304
+
305
+ const resetButton = getResetButton();
306
+ const rangeInput = getRangeInput();
307
+ const numberInput = getNumberInput();
308
+
309
+ fireChangeEvent( numberInput, '14' );
310
+
311
+ expect( rangeInput.value ).toBe( '14' );
312
+ expect( numberInput.value ).toBe( '14' );
313
+ expect( spy ).toHaveBeenCalledWith( 14 );
314
+
315
+ fireEvent.click( resetButton );
316
+
317
+ // range input resets to min + (max-min)/2
318
+ expect( rangeInput.value ).toBe( '50' );
319
+ expect( numberInput.value ).toBe( '' );
320
+ expect( spy ).toHaveBeenCalledWith( undefined );
321
+
322
+ expect( resetButton ).toHaveAttribute( 'aria-disabled', 'true' );
323
+ } );
324
+
325
+ it( 'should reset to the `initialPosition` value when clicking the reset button', () => {
296
326
  const spy = jest.fn();
297
327
  render(
298
328
  <RangeControl
299
- initialPosition={ 10 }
300
329
  allowReset
330
+ initialPosition={ 23 }
301
331
  onChange={ spy }
302
- resetFallbackValue={ 33 }
303
332
  />
304
333
  );
305
334
 
@@ -307,21 +336,29 @@ describe( 'RangeControl', () => {
307
336
  const rangeInput = getRangeInput();
308
337
  const numberInput = getNumberInput();
309
338
 
339
+ fireChangeEvent( numberInput, '14' );
340
+
341
+ expect( rangeInput.value ).toBe( '14' );
342
+ expect( numberInput.value ).toBe( '14' );
343
+ expect( spy ).toHaveBeenCalledWith( 14 );
344
+
310
345
  fireEvent.click( resetButton );
311
346
 
312
- expect( rangeInput.value ).toBe( '33' );
313
- expect( numberInput.value ).toBe( '33' );
314
- expect( spy ).toHaveBeenCalledWith( 33 );
347
+ expect( rangeInput.value ).toBe( '23' );
348
+ expect( numberInput.value ).toBe( '23' );
349
+ expect( spy ).toHaveBeenCalledWith( undefined );
350
+
351
+ expect( resetButton ).toHaveAttribute( 'aria-disabled', 'true' );
315
352
  } );
316
353
 
317
- it( 'should reset to a 50% of min/max value, of no initialPosition or value is defined', () => {
354
+ it( 'should reset to the `resetFallbackValue` value when clicking the reset button', () => {
355
+ const spy = jest.fn();
318
356
  render(
319
357
  <RangeControl
320
- initialPosition={ undefined }
321
- min={ 0 }
322
- max={ 100 }
358
+ initialPosition={ 10 }
323
359
  allowReset
324
- resetFallbackValue={ undefined }
360
+ onChange={ spy }
361
+ resetFallbackValue={ 33 }
325
362
  />
326
363
  );
327
364
 
@@ -331,8 +368,11 @@ describe( 'RangeControl', () => {
331
368
 
332
369
  fireEvent.click( resetButton );
333
370
 
334
- expect( rangeInput.value ).toBe( '50' );
335
- expect( numberInput.value ).toBe( '' );
371
+ expect( rangeInput.value ).toBe( '33' );
372
+ expect( numberInput.value ).toBe( '33' );
373
+ expect( spy ).toHaveBeenCalledWith( 33 );
374
+
375
+ expect( resetButton ).toHaveAttribute( 'aria-disabled', 'true' );
336
376
  } );
337
377
  } );
338
378
  } );
@@ -77,10 +77,13 @@ function UnforwardedSearchControl(
77
77
 
78
78
  const contextValue = useMemo(
79
79
  () => ( {
80
- // Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system
81
- // to provide backwards compatibile margin for SearchControl.
82
- // (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.)
83
- BaseControl: { _overrides: { __nextHasNoMarginBottom } },
80
+ BaseControl: {
81
+ // Overrides the underlying BaseControl `__nextHasNoMarginBottom` via the context system
82
+ // to provide backwards compatibile margin for SearchControl.
83
+ // (In a standard InputControl, the BaseControl `__nextHasNoMarginBottom` is always set to true.)
84
+ _overrides: { __nextHasNoMarginBottom },
85
+ __associatedWPComponentName: 'SearchControl',
86
+ },
84
87
  // `isBorderless` is still experimental and not a public prop for InputControl yet.
85
88
  InputBase: { isBorderless: true },
86
89
  } ),
@@ -48,6 +48,7 @@ const Template: StoryFn< typeof SearchControl > = ( {
48
48
  export const Default = Template.bind( {} );
49
49
  Default.args = {
50
50
  help: 'Help text to explain the input.',
51
+ __nextHasNoMarginBottom: true,
51
52
  };
52
53
 
53
54
  /**
@@ -23,6 +23,7 @@ function ControlledSearchControl( {
23
23
  return (
24
24
  <SearchControl
25
25
  { ...restProps }
26
+ __nextHasNoMarginBottom
26
27
  value={ value }
27
28
  onChange={ ( ...args ) => {
28
29
  setValue( ...args );
@@ -229,6 +229,14 @@ The style variant of the control.
229
229
  - Required: No
230
230
  - Default: `'default'`
231
231
 
232
+ ### __next40pxDefaultSize
233
+
234
+ Start opting into the larger default height that will become the default size in a future version.
235
+
236
+ - Type: `Boolean`
237
+ - Required: No
238
+ - Default: `false`
239
+
232
240
  ### __nextHasNoMarginBottom
233
241
 
234
242
  Start opting into the new margin-free styles that will become the default in a future version.
@@ -99,6 +99,7 @@ function UnforwardedSelectControl< V extends string >(
99
99
  help={ help }
100
100
  id={ id }
101
101
  __nextHasNoMarginBottom={ __nextHasNoMarginBottom }
102
+ __associatedWPComponentName="SelectControl"
102
103
  >
103
104
  <StyledInputBase
104
105
  className={ classes }