@wordpress/components 37.0.0 → 38.0.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 (483) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +46 -0
  3. package/build/autocomplete/index.cjs +3 -1
  4. package/build/autocomplete/index.cjs.map +2 -2
  5. package/build/color-picker/component.cjs +14 -5
  6. package/build/color-picker/component.cjs.map +2 -2
  7. package/build/color-picker/picker.cjs +95 -23
  8. package/build/color-picker/picker.cjs.map +2 -2
  9. package/build/confirm-dialog/component.cjs +86 -4
  10. package/build/confirm-dialog/component.cjs.map +3 -3
  11. package/build/content-editable-control/index.cjs +19 -9
  12. package/build/content-editable-control/index.cjs.map +3 -3
  13. package/build/custom-select-control/index.cjs +1 -2
  14. package/build/custom-select-control/index.cjs.map +2 -2
  15. package/build/disabled/index.cjs +87 -4
  16. package/build/disabled/index.cjs.map +4 -4
  17. package/build/form-token-field/index.cjs +87 -2
  18. package/build/form-token-field/index.cjs.map +3 -3
  19. package/build/gradient-picker/index.cjs +26 -20
  20. package/build/gradient-picker/index.cjs.map +2 -2
  21. package/build/input-control/index.cjs +0 -1
  22. package/build/input-control/index.cjs.map +2 -2
  23. package/build/input-control/styles/input-control-styles.cjs +23 -31
  24. package/build/input-control/styles/input-control-styles.cjs.map +2 -2
  25. package/build/private-apis.cjs +0 -2
  26. package/build/private-apis.cjs.map +3 -3
  27. package/build/range-control/index.cjs +0 -1
  28. package/build/range-control/index.cjs.map +2 -2
  29. package/build/sandbox/index.cjs +23 -4
  30. package/build/sandbox/index.cjs.map +3 -3
  31. package/build/search-control/index.cjs +93 -10
  32. package/build/search-control/index.cjs.map +4 -4
  33. package/build/select-control/index.cjs +0 -1
  34. package/build/select-control/index.cjs.map +2 -2
  35. package/build/select-control/styles/select-control-styles.cjs +9 -16
  36. package/build/select-control/styles/select-control-styles.cjs.map +2 -2
  37. package/build/slot-fill/fill.cjs.map +2 -2
  38. package/build/toggle-group-control/toggle-group-control/component.cjs +91 -8
  39. package/build/toggle-group-control/toggle-group-control/component.cjs.map +4 -4
  40. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs +98 -17
  41. package/build/toggle-group-control/toggle-group-control-option-base/component.cjs.map +4 -4
  42. package/build/tools-panel/tools-panel/component.cjs +6 -0
  43. package/build/tools-panel/tools-panel/component.cjs.map +2 -2
  44. package/build/tools-panel/tools-panel/hook.cjs +87 -11
  45. package/build/tools-panel/tools-panel/hook.cjs.map +4 -4
  46. package/build/tools-panel/tools-panel-header/component.cjs +87 -2
  47. package/build/tools-panel/tools-panel-header/component.cjs.map +3 -3
  48. package/build/tools-panel/tools-panel-header/hook.cjs +90 -20
  49. package/build/tools-panel/tools-panel-header/hook.cjs.map +4 -4
  50. package/build/tools-panel/tools-panel-item/hook.cjs +88 -9
  51. package/build/tools-panel/tools-panel-item/hook.cjs.map +4 -4
  52. package/build/validated-form-controls/control-with-error.cjs +3 -0
  53. package/build/validated-form-controls/control-with-error.cjs.map +2 -2
  54. package/build-module/autocomplete/index.mjs +3 -1
  55. package/build-module/autocomplete/index.mjs.map +2 -2
  56. package/build-module/color-picker/component.mjs +14 -5
  57. package/build-module/color-picker/component.mjs.map +2 -2
  58. package/build-module/color-picker/picker.mjs +96 -24
  59. package/build-module/color-picker/picker.mjs.map +2 -2
  60. package/build-module/confirm-dialog/component.mjs +86 -4
  61. package/build-module/confirm-dialog/component.mjs.map +3 -3
  62. package/build-module/content-editable-control/index.mjs +21 -11
  63. package/build-module/content-editable-control/index.mjs.map +2 -2
  64. package/build-module/custom-select-control/index.mjs +1 -2
  65. package/build-module/custom-select-control/index.mjs.map +2 -2
  66. package/build-module/disabled/index.mjs +87 -4
  67. package/build-module/disabled/index.mjs.map +3 -3
  68. package/build-module/form-token-field/index.mjs +88 -3
  69. package/build-module/form-token-field/index.mjs.map +3 -3
  70. package/build-module/gradient-picker/index.mjs +26 -20
  71. package/build-module/gradient-picker/index.mjs.map +2 -2
  72. package/build-module/input-control/index.mjs +0 -1
  73. package/build-module/input-control/index.mjs.map +2 -2
  74. package/build-module/input-control/styles/input-control-styles.mjs +23 -31
  75. package/build-module/input-control/styles/input-control-styles.mjs.map +2 -2
  76. package/build-module/private-apis.mjs +0 -2
  77. package/build-module/private-apis.mjs.map +2 -2
  78. package/build-module/range-control/index.mjs +0 -1
  79. package/build-module/range-control/index.mjs.map +2 -2
  80. package/build-module/sandbox/index.mjs +13 -4
  81. package/build-module/sandbox/index.mjs.map +2 -2
  82. package/build-module/search-control/index.mjs +93 -10
  83. package/build-module/search-control/index.mjs.map +3 -3
  84. package/build-module/select-control/index.mjs +0 -1
  85. package/build-module/select-control/index.mjs.map +2 -2
  86. package/build-module/select-control/styles/select-control-styles.mjs +9 -16
  87. package/build-module/select-control/styles/select-control-styles.mjs.map +2 -2
  88. package/build-module/slot-fill/fill.mjs.map +2 -2
  89. package/build-module/toggle-group-control/toggle-group-control/component.mjs +92 -9
  90. package/build-module/toggle-group-control/toggle-group-control/component.mjs.map +3 -3
  91. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs +99 -18
  92. package/build-module/toggle-group-control/toggle-group-control-option-base/component.mjs.map +3 -3
  93. package/build-module/tools-panel/tools-panel/component.mjs +6 -0
  94. package/build-module/tools-panel/tools-panel/component.mjs.map +2 -2
  95. package/build-module/tools-panel/tools-panel/hook.mjs +87 -11
  96. package/build-module/tools-panel/tools-panel/hook.mjs.map +3 -3
  97. package/build-module/tools-panel/tools-panel-header/component.mjs +87 -2
  98. package/build-module/tools-panel/tools-panel-header/component.mjs.map +3 -3
  99. package/build-module/tools-panel/tools-panel-header/hook.mjs +90 -20
  100. package/build-module/tools-panel/tools-panel-header/hook.mjs.map +3 -3
  101. package/build-module/tools-panel/tools-panel-item/hook.mjs +89 -10
  102. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +3 -3
  103. package/build-module/validated-form-controls/control-with-error.mjs +3 -0
  104. package/build-module/validated-form-controls/control-with-error.mjs.map +2 -2
  105. package/build-style/style-rtl.css +20 -24
  106. package/build-style/style.css +20 -24
  107. package/build-types/autocomplete/index.d.ts +7 -3
  108. package/build-types/autocomplete/index.d.ts.map +1 -1
  109. package/build-types/border-box-control/border-box-control/component.d.ts +1 -3
  110. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  111. package/build-types/border-box-control/stories/index.story.d.ts +1 -3
  112. package/build-types/border-box-control/stories/index.story.d.ts.map +1 -1
  113. package/build-types/border-box-control/types.d.ts +1 -15
  114. package/build-types/border-box-control/types.d.ts.map +1 -1
  115. package/build-types/box-control/input-control.d.ts +3 -0
  116. package/build-types/box-control/input-control.d.ts.map +1 -0
  117. package/build-types/box-control/styles/box-control-styles.d.ts +4 -8
  118. package/build-types/box-control/styles/box-control-styles.d.ts.map +1 -1
  119. package/build-types/box-control/types.d.ts +1 -8
  120. package/build-types/box-control/types.d.ts.map +1 -1
  121. package/build-types/card/context.d.ts +3 -0
  122. package/build-types/card/context.d.ts.map +1 -0
  123. package/build-types/color-picker/component.d.ts.map +1 -1
  124. package/build-types/color-picker/picker.d.ts +17 -1
  125. package/build-types/color-picker/picker.d.ts.map +1 -1
  126. package/build-types/color-picker/styles.d.ts +4 -8
  127. package/build-types/color-picker/styles.d.ts.map +1 -1
  128. package/build-types/color-picker/types.d.ts +2 -0
  129. package/build-types/color-picker/types.d.ts.map +1 -1
  130. package/build-types/confirm-dialog/component.d.ts.map +1 -1
  131. package/build-types/content-editable-control/index.d.ts.map +1 -1
  132. package/build-types/context/wordpress-component.d.ts +2 -1
  133. package/build-types/context/wordpress-component.d.ts.map +1 -1
  134. package/build-types/custom-select-control/index.d.ts.map +1 -1
  135. package/build-types/custom-select-control/types.d.ts +1 -8
  136. package/build-types/custom-select-control/types.d.ts.map +1 -1
  137. package/build-types/date-time/date/index.d.ts +23 -0
  138. package/build-types/date-time/date/index.d.ts.map +1 -0
  139. package/build-types/date-time/date/styles.d.ts +45 -0
  140. package/build-types/date-time/date/styles.d.ts.map +1 -0
  141. package/build-types/date-time/date/test/index.d.ts +2 -0
  142. package/build-types/date-time/date/test/index.d.ts.map +1 -0
  143. package/build-types/date-time/date/test/use-lilius.d.ts +2 -0
  144. package/build-types/date-time/date/test/use-lilius.d.ts.map +1 -0
  145. package/build-types/date-time/date/use-lilius/index.d.ts +169 -0
  146. package/build-types/date-time/date/use-lilius/index.d.ts.map +1 -0
  147. package/build-types/date-time/time/index.d.ts +27 -0
  148. package/build-types/date-time/time/index.d.ts.map +1 -0
  149. package/build-types/date-time/time/styles.d.ts +93 -0
  150. package/build-types/date-time/time/styles.d.ts.map +1 -0
  151. package/build-types/date-time/time/test/index.d.ts +2 -0
  152. package/build-types/date-time/time/test/index.d.ts.map +1 -0
  153. package/build-types/date-time/time/time-input/index.d.ts +4 -0
  154. package/build-types/date-time/time/time-input/index.d.ts.map +1 -0
  155. package/build-types/date-time/time/time-input/test/index.d.ts +2 -0
  156. package/build-types/date-time/time/time-input/test/index.d.ts.map +1 -0
  157. package/build-types/date-time/time/timezone.d.ts +7 -0
  158. package/build-types/date-time/time/timezone.d.ts.map +1 -0
  159. package/build-types/date-time/time-picker/styles.d.ts +8 -16
  160. package/build-types/date-time/time-picker/styles.d.ts.map +1 -1
  161. package/build-types/disabled/index.d.ts.map +1 -1
  162. package/build-types/divider/styles.d.ts +10 -0
  163. package/build-types/divider/styles.d.ts.map +1 -0
  164. package/build-types/flex/styles.d.ts +17 -0
  165. package/build-types/flex/styles.d.ts.map +1 -0
  166. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts +2 -4
  167. package/build-types/focal-point-picker/styles/focal-point-picker-style.d.ts.map +1 -1
  168. package/build-types/font-size-picker/index.d.ts +12 -2
  169. package/build-types/font-size-picker/index.d.ts.map +1 -1
  170. package/build-types/font-size-picker/stories/e2e/index.story.d.ts +12 -1
  171. package/build-types/font-size-picker/stories/e2e/index.story.d.ts.map +1 -1
  172. package/build-types/font-size-picker/types.d.ts +2 -15
  173. package/build-types/font-size-picker/types.d.ts.map +1 -1
  174. package/build-types/form-token-field/index.d.ts.map +1 -1
  175. package/build-types/gradient-picker/index.d.ts.map +1 -1
  176. package/build-types/gradient-picker/stories/index.story.d.ts +1 -0
  177. package/build-types/gradient-picker/stories/index.story.d.ts.map +1 -1
  178. package/build-types/gradient-picker/test/index.d.ts +2 -0
  179. package/build-types/gradient-picker/test/index.d.ts.map +1 -0
  180. package/build-types/gradient-picker/types.d.ts +19 -4
  181. package/build-types/gradient-picker/types.d.ts.map +1 -1
  182. package/build-types/input-control/index.d.ts.map +1 -1
  183. package/build-types/input-control/styles/input-control-styles.d.ts +0 -6
  184. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  185. package/build-types/input-control/types.d.ts +1 -8
  186. package/build-types/input-control/types.d.ts.map +1 -1
  187. package/build-types/mobile/image/constants.d.ts +5 -0
  188. package/build-types/mobile/image/constants.d.ts.map +1 -0
  189. package/build-types/navigation/back-button/index.d.ts +7 -0
  190. package/build-types/navigation/back-button/index.d.ts.map +1 -0
  191. package/build-types/navigation/constants.d.ts +3 -0
  192. package/build-types/navigation/constants.d.ts.map +1 -0
  193. package/build-types/navigation/context.d.ts +4 -0
  194. package/build-types/navigation/context.d.ts.map +1 -0
  195. package/build-types/navigation/group/context.d.ts +7 -0
  196. package/build-types/navigation/group/context.d.ts.map +1 -0
  197. package/build-types/navigation/group/index.d.ts +7 -0
  198. package/build-types/navigation/group/index.d.ts.map +1 -0
  199. package/build-types/navigation/index.d.ts +46 -0
  200. package/build-types/navigation/index.d.ts.map +1 -0
  201. package/build-types/navigation/item/base-content.d.ts +3 -0
  202. package/build-types/navigation/item/base-content.d.ts.map +1 -0
  203. package/build-types/navigation/item/base.d.ts +3 -0
  204. package/build-types/navigation/item/base.d.ts.map +1 -0
  205. package/build-types/navigation/item/index.d.ts +7 -0
  206. package/build-types/navigation/item/index.d.ts.map +1 -0
  207. package/build-types/navigation/item/use-navigation-tree-item.d.ts +3 -0
  208. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +1 -0
  209. package/build-types/navigation/menu/context.d.ts +7 -0
  210. package/build-types/navigation/menu/context.d.ts.map +1 -0
  211. package/build-types/navigation/menu/index.d.ts +7 -0
  212. package/build-types/navigation/menu/index.d.ts.map +1 -0
  213. package/build-types/navigation/menu/menu-title-search.d.ts +3 -0
  214. package/build-types/navigation/menu/menu-title-search.d.ts.map +1 -0
  215. package/build-types/navigation/menu/menu-title.d.ts +3 -0
  216. package/build-types/navigation/menu/menu-title.d.ts.map +1 -0
  217. package/build-types/navigation/menu/search-no-results-found.d.ts +3 -0
  218. package/build-types/navigation/menu/search-no-results-found.d.ts.map +1 -0
  219. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +3 -0
  220. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +1 -0
  221. package/build-types/navigation/stories/index.story.d.ts +23 -0
  222. package/build-types/navigation/stories/index.story.d.ts.map +1 -0
  223. package/build-types/navigation/stories/utils/controlled-state.d.ts +7 -0
  224. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +1 -0
  225. package/build-types/navigation/stories/utils/default.d.ts +10 -0
  226. package/build-types/navigation/stories/utils/default.d.ts.map +1 -0
  227. package/build-types/navigation/stories/utils/group.d.ts +10 -0
  228. package/build-types/navigation/stories/utils/group.d.ts.map +1 -0
  229. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +10 -0
  230. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -0
  231. package/build-types/navigation/stories/utils/more-examples.d.ts +10 -0
  232. package/build-types/navigation/stories/utils/more-examples.d.ts.map +1 -0
  233. package/build-types/navigation/stories/utils/search.d.ts +10 -0
  234. package/build-types/navigation/stories/utils/search.d.ts.map +1 -0
  235. package/build-types/navigation/styles/navigation-styles.d.ts +55 -0
  236. package/build-types/navigation/styles/navigation-styles.d.ts.map +1 -0
  237. package/build-types/navigation/test/index.d.ts +2 -0
  238. package/build-types/navigation/test/index.d.ts.map +1 -0
  239. package/build-types/navigation/types.d.ts +266 -0
  240. package/build-types/navigation/types.d.ts.map +1 -0
  241. package/build-types/navigation/use-create-navigation-tree.d.ts +15 -0
  242. package/build-types/navigation/use-create-navigation-tree.d.ts.map +1 -0
  243. package/build-types/navigation/use-navigation-tree-nodes.d.ts +10 -0
  244. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +1 -0
  245. package/build-types/navigation/utils.d.ts +3 -0
  246. package/build-types/navigation/utils.d.ts.map +1 -0
  247. package/build-types/number-control/index.d.ts +2 -4
  248. package/build-types/number-control/index.d.ts.map +1 -1
  249. package/build-types/number-control/stories/index.story.d.ts +2 -4
  250. package/build-types/number-control/stories/index.story.d.ts.map +1 -1
  251. package/build-types/number-control/types.d.ts +1 -15
  252. package/build-types/number-control/types.d.ts.map +1 -1
  253. package/build-types/private-apis.d.ts.map +1 -1
  254. package/build-types/range-control/index.d.ts +2 -4
  255. package/build-types/range-control/index.d.ts.map +1 -1
  256. package/build-types/range-control/styles/range-control-styles.d.ts +2 -4
  257. package/build-types/range-control/styles/range-control-styles.d.ts.map +1 -1
  258. package/build-types/range-control/types.d.ts +2 -16
  259. package/build-types/range-control/types.d.ts.map +1 -1
  260. package/build-types/sandbox/index.d.ts.map +1 -1
  261. package/build-types/sandbox/types.d.ts +11 -0
  262. package/build-types/sandbox/types.d.ts.map +1 -1
  263. package/build-types/search-control/index.d.ts.map +1 -1
  264. package/build-types/search-control/types.d.ts +1 -1
  265. package/build-types/search-control/types.d.ts.map +1 -1
  266. package/build-types/select-control/index.d.ts.map +1 -1
  267. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  268. package/build-types/select-control/types.d.ts +0 -7
  269. package/build-types/select-control/types.d.ts.map +1 -1
  270. package/build-types/slot-fill/fill.d.ts.map +1 -1
  271. package/build-types/slot-fill/stories/index.story.d.ts +1 -6
  272. package/build-types/slot-fill/stories/index.story.d.ts.map +1 -1
  273. package/build-types/surface/styles.d.ts +11 -0
  274. package/build-types/surface/styles.d.ts.map +1 -0
  275. package/build-types/theme/styles.d.ts +10 -0
  276. package/build-types/theme/styles.d.ts.map +1 -0
  277. package/build-types/toggle-group-control/toggle-group-control/component.d.ts +0 -1
  278. package/build-types/toggle-group-control/toggle-group-control/component.d.ts.map +1 -1
  279. package/build-types/toggle-group-control/toggle-group-control-option-base/component.d.ts.map +1 -1
  280. package/build-types/toggle-group-control/types.d.ts +0 -7
  281. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  282. package/build-types/tools-panel/tools-panel/component.d.ts.map +1 -1
  283. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  284. package/build-types/tools-panel/tools-panel-header/component.d.ts.map +1 -1
  285. package/build-types/tools-panel/tools-panel-header/hook.d.ts.map +1 -1
  286. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  287. package/build-types/tree-select/types.d.ts +1 -8
  288. package/build-types/tree-select/types.d.ts.map +1 -1
  289. package/build-types/truncate/styles.d.ts +2 -0
  290. package/build-types/truncate/styles.d.ts.map +1 -0
  291. package/build-types/unit-control/index.d.ts +2 -4
  292. package/build-types/unit-control/index.d.ts.map +1 -1
  293. package/build-types/unit-control/styles/unit-control-styles.d.ts +2 -4
  294. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  295. package/build-types/unit-control/types.d.ts +1 -15
  296. package/build-types/unit-control/types.d.ts.map +1 -1
  297. package/build-types/utils/deprecated-36px-size.d.ts +7 -0
  298. package/build-types/utils/deprecated-36px-size.d.ts.map +1 -0
  299. package/build-types/validated-form-controls/components/number-control.d.ts +2 -4
  300. package/build-types/validated-form-controls/components/number-control.d.ts.map +1 -1
  301. package/build-types/validated-form-controls/components/range-control.d.ts +2 -4
  302. package/build-types/validated-form-controls/components/range-control.d.ts.map +1 -1
  303. package/build-types/validated-form-controls/components/stories/overview.story.d.ts +5 -0
  304. package/build-types/validated-form-controls/components/stories/overview.story.d.ts.map +1 -1
  305. package/build-types/validated-form-controls/components/toggle-group-control.d.ts +1 -2
  306. package/build-types/validated-form-controls/components/toggle-group-control.d.ts.map +1 -1
  307. package/build-types/validated-form-controls/control-with-error.d.ts.map +1 -1
  308. package/build-types/visually-hidden/test/index.d.ts +2 -0
  309. package/build-types/visually-hidden/test/index.d.ts.map +1 -0
  310. package/package.json +27 -27
  311. package/src/autocomplete/index.tsx +16 -3
  312. package/src/base-control/README.md +2 -2
  313. package/src/border-box-control/types.ts +4 -15
  314. package/src/box-control/types.ts +4 -8
  315. package/src/card/test/__snapshots__/index.tsx.snap +1 -1
  316. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +1 -1
  317. package/src/color-indicator/test/__snapshots__/index.tsx.snap +1 -1
  318. package/src/color-picker/component.tsx +23 -19
  319. package/src/color-picker/picker.tsx +144 -21
  320. package/src/color-picker/test/index.tsx +502 -0
  321. package/src/color-picker/types.ts +2 -0
  322. package/src/combobox-control/style.scss +2 -2
  323. package/src/confirm-dialog/component.tsx +2 -4
  324. package/src/confirm-dialog/style.module.scss +7 -0
  325. package/src/confirm-dialog/test/index.tsx +5 -0
  326. package/src/content-editable-control/index.tsx +24 -5
  327. package/src/content-editable-control/style.module.scss +1 -1
  328. package/src/content-editable-control/test/index.tsx +20 -8
  329. package/src/context/test/__snapshots__/context-system-provider.js.snap +1 -1
  330. package/src/context/wordpress-component.ts +7 -2
  331. package/src/custom-gradient-picker/test/index.tsx +111 -1
  332. package/src/custom-select-control/index.tsx +1 -2
  333. package/src/custom-select-control/test/__snapshots__/index.tsx.snap +6 -0
  334. package/src/custom-select-control/test/index.tsx +23 -0
  335. package/src/custom-select-control/types.ts +1 -8
  336. package/src/disabled/index.tsx +7 -5
  337. package/src/disabled/style.module.scss +15 -0
  338. package/src/disabled/test/index.tsx +6 -4
  339. package/src/elevation/test/__snapshots__/index.tsx.snap +1 -1
  340. package/src/external-link/style.scss +6 -12
  341. package/src/flex/test/__snapshots__/index.tsx.snap +1 -1
  342. package/src/font-size-picker/types.ts +6 -15
  343. package/src/form-toggle/test/__snapshots__/index.tsx.snap +1 -1
  344. package/src/form-token-field/index.tsx +5 -4
  345. package/src/form-token-field/style.module.scss +6 -0
  346. package/src/form-token-field/style.scss +2 -2
  347. package/src/gradient-picker/README.md +21 -3
  348. package/src/gradient-picker/index.tsx +43 -28
  349. package/src/gradient-picker/stories/index.story.tsx +41 -5
  350. package/src/gradient-picker/test/index.tsx +148 -0
  351. package/src/gradient-picker/types.ts +24 -4
  352. package/src/h-stack/test/__snapshots__/index.tsx.snap +1 -1
  353. package/src/heading/test/__snapshots__/index.tsx.snap +1 -1
  354. package/src/higher-order/with-filters/test/__snapshots__/index.tsx.snap +1 -1
  355. package/src/input-control/index.tsx +0 -1
  356. package/src/input-control/styles/input-control-styles.tsx +0 -8
  357. package/src/input-control/test/__snapshots__/index.js.snap +11 -0
  358. package/src/input-control/test/index.js +28 -0
  359. package/src/input-control/types.ts +1 -8
  360. package/src/item-group/test/__snapshots__/index.js.snap +1 -1
  361. package/src/menu/README.md +2 -2
  362. package/src/menu-item/test/__snapshots__/index.js.snap +1 -1
  363. package/src/modal/test/index.tsx +42 -0
  364. package/src/notice/test/__snapshots__/index.tsx.snap +1 -1
  365. package/src/number-control/types.ts +1 -22
  366. package/src/panel/test/__snapshots__/body.tsx.snap +1 -1
  367. package/src/panel/test/__snapshots__/header.tsx.snap +1 -1
  368. package/src/panel/test/__snapshots__/index.tsx.snap +1 -1
  369. package/src/panel/test/__snapshots__/row.tsx.snap +1 -1
  370. package/src/private-apis.ts +0 -2
  371. package/src/range-control/index.tsx +0 -1
  372. package/src/range-control/types.ts +2 -15
  373. package/src/sandbox/index.tsx +22 -2
  374. package/src/sandbox/test/index.tsx +21 -0
  375. package/src/sandbox/types.ts +11 -0
  376. package/src/scrollable/test/__snapshots__/index.tsx.snap +1 -1
  377. package/src/search-control/index.tsx +23 -20
  378. package/src/search-control/style.module.scss +16 -0
  379. package/src/search-control/test/index.tsx +8 -0
  380. package/src/search-control/types.ts +1 -1
  381. package/src/select-control/index.tsx +0 -1
  382. package/src/select-control/styles/select-control-styles.ts +0 -7
  383. package/src/select-control/test/__snapshots__/select-control.tsx.snap +11 -0
  384. package/src/select-control/test/select-control.tsx +37 -0
  385. package/src/select-control/types.ts +0 -7
  386. package/src/shortcut/test/__snapshots__/index.tsx.snap +1 -1
  387. package/src/slot-fill/fill.tsx +3 -9
  388. package/src/slot-fill/stories/index.story.tsx +52 -10
  389. package/src/slot-fill/test/__snapshots__/slot.js.snap +1 -1
  390. package/src/slot-fill/test/slot.js +53 -11
  391. package/src/spacer/test/__snapshots__/index.tsx.snap +1 -1
  392. package/src/text/test/__snapshots__/index.tsx.snap +1 -1
  393. package/src/text-control/style.scss +1 -1
  394. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +29 -707
  395. package/src/toggle-group-control/test/index.tsx +33 -3
  396. package/src/toggle-group-control/toggle-group-control/component.tsx +11 -16
  397. package/src/toggle-group-control/toggle-group-control/style.module.scss +63 -0
  398. package/src/toggle-group-control/toggle-group-control-option-base/component.tsx +22 -24
  399. package/src/toggle-group-control/toggle-group-control-option-base/style.module.scss +88 -0
  400. package/src/toggle-group-control/types.ts +0 -7
  401. package/src/tools-panel/style.module.scss +117 -0
  402. package/src/tools-panel/test/index.tsx +105 -39
  403. package/src/tools-panel/tools-panel/component.tsx +12 -1
  404. package/src/tools-panel/tools-panel/hook.ts +13 -15
  405. package/src/tools-panel/tools-panel-header/component.tsx +6 -2
  406. package/src/tools-panel/tools-panel-header/hook.ts +7 -25
  407. package/src/tools-panel/tools-panel-item/hook.ts +16 -34
  408. package/src/tooltip/test/index.tsx +1 -1
  409. package/src/tree-grid/test/__snapshots__/cell.tsx.snap +1 -1
  410. package/src/tree-grid/test/__snapshots__/index.tsx.snap +1 -1
  411. package/src/tree-grid/test/__snapshots__/roving-tab-index-item.tsx.snap +1 -1
  412. package/src/tree-grid/test/__snapshots__/roving-tab-index.tsx.snap +1 -1
  413. package/src/tree-grid/test/__snapshots__/row.tsx.snap +1 -1
  414. package/src/tree-select/README.md +1 -1
  415. package/src/tree-select/types.ts +1 -8
  416. package/src/unit-control/types.ts +1 -18
  417. package/src/utils/theme-variables.scss +1 -0
  418. package/src/v-stack/test/__snapshots__/index.tsx.snap +1 -1
  419. package/src/validated-form-controls/components/stories/overview.story.tsx +51 -0
  420. package/src/validated-form-controls/control-with-error.tsx +9 -0
  421. package/src/validated-form-controls/style.scss +3 -3
  422. package/src/validated-form-controls/test/control-with-error.tsx +42 -0
  423. package/src/view/test/__snapshots__/index.js.snap +1 -1
  424. package/build/confirm-dialog/styles.cjs +0 -42
  425. package/build/confirm-dialog/styles.cjs.map +0 -7
  426. package/build/disabled/styles/disabled-styles.cjs +0 -42
  427. package/build/disabled/styles/disabled-styles.cjs.map +0 -7
  428. package/build/form-token-field/styles.cjs +0 -49
  429. package/build/form-token-field/styles.cjs.map +0 -7
  430. package/build/search-control/styles.cjs +0 -74
  431. package/build/search-control/styles.cjs.map +0 -7
  432. package/build/theme/color-algorithms.cjs +0 -131
  433. package/build/theme/color-algorithms.cjs.map +0 -7
  434. package/build/theme/index.cjs +0 -160
  435. package/build/theme/index.cjs.map +0 -7
  436. package/build/theme/types.cjs +0 -19
  437. package/build/theme/types.cjs.map +0 -7
  438. package/build/toggle-group-control/toggle-group-control/styles.cjs +0 -53
  439. package/build/toggle-group-control/toggle-group-control/styles.cjs.map +0 -7
  440. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs +0 -94
  441. package/build/toggle-group-control/toggle-group-control-option-base/styles.cjs.map +0 -7
  442. package/build/tools-panel/styles.cjs +0 -129
  443. package/build/tools-panel/styles.cjs.map +0 -7
  444. package/build/utils/use-deprecated-props.cjs +0 -41
  445. package/build/utils/use-deprecated-props.cjs.map +0 -7
  446. package/build-module/confirm-dialog/styles.mjs +0 -17
  447. package/build-module/confirm-dialog/styles.mjs.map +0 -7
  448. package/build-module/disabled/styles/disabled-styles.mjs +0 -17
  449. package/build-module/disabled/styles/disabled-styles.mjs.map +0 -7
  450. package/build-module/form-token-field/styles.mjs +0 -14
  451. package/build-module/form-token-field/styles.mjs.map +0 -7
  452. package/build-module/search-control/styles.mjs +0 -38
  453. package/build-module/search-control/styles.mjs.map +0 -7
  454. package/build-module/theme/color-algorithms.mjs +0 -94
  455. package/build-module/theme/color-algorithms.mjs.map +0 -7
  456. package/build-module/theme/index.mjs +0 -129
  457. package/build-module/theme/index.mjs.map +0 -7
  458. package/build-module/theme/types.mjs +0 -1
  459. package/build-module/theme/types.mjs.map +0 -7
  460. package/build-module/toggle-group-control/toggle-group-control/styles.mjs +0 -27
  461. package/build-module/toggle-group-control/toggle-group-control/styles.mjs.map +0 -7
  462. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs +0 -56
  463. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.mjs.map +0 -7
  464. package/build-module/tools-panel/styles.mjs +0 -84
  465. package/build-module/tools-panel/styles.mjs.map +0 -7
  466. package/build-module/utils/use-deprecated-props.mjs +0 -16
  467. package/build-module/utils/use-deprecated-props.mjs.map +0 -7
  468. package/src/confirm-dialog/styles.ts +0 -18
  469. package/src/disabled/styles/disabled-styles.tsx +0 -23
  470. package/src/form-token-field/styles.ts +0 -15
  471. package/src/search-control/styles.ts +0 -27
  472. package/src/theme/README.md +0 -47
  473. package/src/theme/color-algorithms.ts +0 -142
  474. package/src/theme/index.tsx +0 -80
  475. package/src/theme/stories/index.story.tsx +0 -127
  476. package/src/theme/style.module.scss +0 -4
  477. package/src/theme/test/color-algorithms.ts +0 -100
  478. package/src/theme/test/index.tsx +0 -151
  479. package/src/theme/types.ts +0 -61
  480. package/src/toggle-group-control/toggle-group-control/styles.ts +0 -84
  481. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -109
  482. package/src/tools-panel/styles.ts +0 -176
  483. package/src/utils/use-deprecated-props.ts +0 -14
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -12,10 +17,9 @@ import {
12
17
  /**
13
18
  * Internal dependencies
14
19
  */
15
- import * as styles from '../styles';
20
+ import styles from '../style.module.scss';
16
21
  import type { WordPressComponentProps } from '../../context';
17
22
  import { useContextSystem } from '../../context';
18
- import { useCx } from '../../utils/hooks/use-cx';
19
23
  import type {
20
24
  ToolsPanelItem,
21
25
  ToolsPanelMenuItemKey,
@@ -25,8 +29,6 @@ import type {
25
29
  ResetAllFilter,
26
30
  } from '../types';
27
31
 
28
- const DEFAULT_COLUMNS = 2;
29
-
30
32
  type PanelItemsState = {
31
33
  panelItems: ToolsPanelItem[];
32
34
  menuItemOrder: string[];
@@ -339,17 +341,13 @@ export function useToolsPanel(
339
341
  );
340
342
  }, [ menuItems ] );
341
343
 
342
- const cx = useCx();
343
- const classes = useMemo( () => {
344
- return cx(
345
- styles.getToolsPanelStyles( {
346
- columns: DEFAULT_COLUMNS,
347
- hasInnerWrapper,
348
- areAllOptionalControlsHidden,
349
- } ),
350
- className
351
- );
352
- }, [ areAllOptionalControlsHidden, className, cx, hasInnerWrapper ] );
344
+ const classes = clsx(
345
+ styles[ 'tools-panel' ],
346
+ hasInnerWrapper && styles[ 'tools-panel-with-inner-wrapper' ],
347
+ areAllOptionalControlsHidden &&
348
+ styles[ 'tools-panel-hidden-inner-wrapper' ],
349
+ className
350
+ );
353
351
 
354
352
  // Toggle the checked state of a menu item which is then used to determine
355
353
  // display of the item within the panel.
@@ -19,9 +19,9 @@ import MenuItem from '../../menu-item';
19
19
  import { HStack } from '../../h-stack';
20
20
  import { Heading } from '../../heading';
21
21
  import { useToolsPanelHeader } from './hook';
22
+ import styles from '../style.module.scss';
22
23
  import type { WordPressComponentProps } from '../../context';
23
24
  import { contextConnect } from '../../context';
24
- import { ResetLabel } from '../styles';
25
25
  import type {
26
26
  ToolsPanelControlsGroupProps,
27
27
  ToolsPanelHeaderProps,
@@ -36,7 +36,11 @@ const DefaultControlsGroup = ( {
36
36
  return null;
37
37
  }
38
38
 
39
- const resetSuffix = <ResetLabel aria-hidden>{ __( 'Reset' ) }</ResetLabel>;
39
+ const resetSuffix = (
40
+ <span aria-hidden className={ styles[ 'reset-label' ] }>
41
+ { __( 'Reset' ) }
42
+ </span>
43
+ );
40
44
 
41
45
  return (
42
46
  <>
@@ -1,16 +1,15 @@
1
1
  /**
2
- * WordPress dependencies
2
+ * External dependencies
3
3
  */
4
- import { useMemo } from '@wordpress/element';
4
+ import clsx from 'clsx';
5
5
 
6
6
  /**
7
7
  * Internal dependencies
8
8
  */
9
- import * as styles from '../styles';
9
+ import styles from '../style.module.scss';
10
10
  import { useToolsPanelContext } from '../context';
11
11
  import type { WordPressComponentProps } from '../../context';
12
12
  import { useContextSystem } from '../../context';
13
- import { useCx } from '../../utils/hooks/use-cx';
14
13
  import type { ToolsPanelHeaderProps } from '../types';
15
14
 
16
15
  export function useToolsPanelHeader(
@@ -22,35 +21,18 @@ export function useToolsPanelHeader(
22
21
  ...otherProps
23
22
  } = useContextSystem( props, 'ToolsPanelHeader' );
24
23
 
25
- const cx = useCx();
26
- const classes = useMemo( () => {
27
- return cx( styles.ToolsPanelHeader, className );
28
- }, [ className, cx ] );
29
-
30
- const dropdownMenuClassName = useMemo( () => {
31
- return cx( styles.DropdownMenu );
32
- }, [ cx ] );
33
-
34
- const headingClassName = useMemo( () => {
35
- return cx( styles.ToolsPanelHeading );
36
- }, [ cx ] );
37
-
38
- const defaultControlsItemClassName = useMemo( () => {
39
- return cx( styles.DefaultControlsItem );
40
- }, [ cx ] );
41
-
42
24
  const { menuItems, hasMenuItems, areAllOptionalControlsHidden } =
43
25
  useToolsPanelContext();
44
26
 
45
27
  return {
46
28
  ...otherProps,
47
29
  areAllOptionalControlsHidden,
48
- defaultControlsItemClassName,
49
- dropdownMenuClassName,
30
+ defaultControlsItemClassName: styles[ 'default-controls-item' ],
31
+ dropdownMenuClassName: styles[ 'dropdown-menu' ],
50
32
  hasMenuItems,
51
- headingClassName,
33
+ headingClassName: styles[ 'tools-panel-heading' ],
52
34
  headingLevel,
53
35
  menuItems,
54
- className: classes,
36
+ className: clsx( styles[ 'tools-panel-header' ], className ),
55
37
  };
56
38
  }
@@ -1,22 +1,21 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import clsx from 'clsx';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
4
9
  import { usePrevious } from '@wordpress/compose';
5
- import {
6
- useCallback,
7
- useEffect,
8
- useLayoutEffect,
9
- useMemo,
10
- } from '@wordpress/element';
10
+ import { useCallback, useEffect, useLayoutEffect } from '@wordpress/element';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
14
14
  */
15
- import * as styles from '../styles';
15
+ import styles from '../style.module.scss';
16
16
  import { useToolsPanelContext } from '../context';
17
17
  import type { WordPressComponentProps } from '../../context';
18
18
  import { useContextSystem } from '../../context';
19
- import { useCx } from '../../utils/hooks/use-cx';
20
19
  import type { ToolsPanelItemProps } from '../types';
21
20
 
22
21
  const noop = () => {};
@@ -174,32 +173,15 @@ export function useToolsPanelItem(
174
173
  ? menuItems?.[ menuGroup ]?.[ label ] !== undefined
175
174
  : isMenuItemChecked;
176
175
 
177
- const cx = useCx();
178
- const classes = useMemo( () => {
179
- const shouldApplyPlaceholderStyles =
180
- shouldRenderPlaceholder && ! isShown;
181
- const firstItemStyle =
182
- firstDisplayedItem === label && __experimentalFirstVisibleItemClass;
183
- const lastItemStyle =
184
- lastDisplayedItem === label && __experimentalLastVisibleItemClass;
185
- return cx(
186
- styles.ToolsPanelItem,
187
- shouldApplyPlaceholderStyles && styles.ToolsPanelItemPlaceholder,
188
- ! shouldApplyPlaceholderStyles && className,
189
- firstItemStyle,
190
- lastItemStyle
191
- );
192
- }, [
193
- isShown,
194
- shouldRenderPlaceholder,
195
- className,
196
- cx,
197
- firstDisplayedItem,
198
- lastDisplayedItem,
199
- __experimentalFirstVisibleItemClass,
200
- __experimentalLastVisibleItemClass,
201
- label,
202
- ] );
176
+ const shouldApplyPlaceholderStyles = shouldRenderPlaceholder && ! isShown;
177
+ const classes = clsx(
178
+ styles[ 'tools-panel-item' ],
179
+ shouldApplyPlaceholderStyles &&
180
+ styles[ 'tools-panel-item-placeholder' ],
181
+ ! shouldApplyPlaceholderStyles && className,
182
+ firstDisplayedItem === label && __experimentalFirstVisibleItemClass,
183
+ lastDisplayedItem === label && __experimentalLastVisibleItemClass
184
+ );
203
185
 
204
186
  return {
205
187
  ...otherProps,
@@ -323,7 +323,7 @@ describe( 'Tooltip', () => {
323
323
  // "Tooltips appear instantly if another tooltip has just been hidden."
324
324
  // See: https://github.com/WordPress/gutenberg/pull/57345#discussion_r1435495655
325
325
  await sleep( 3000 );
326
- } );
326
+ }, 10_000 );
327
327
 
328
328
  it( 'should not show tooltip if the mouse leaves the tooltip anchor before set delay', async () => {
329
329
  const onMouseEnterMock = jest.fn();
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`TreeGridCell uses a child render function to render children 1`] = `
4
4
  <div>
@@ -1,3 +1,3 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`TreeGrid simple rendering renders a table, tbody and any child elements 1`] = `"<div role="application"><table role="treegrid"><tbody><tr role="row" aria-level="1" aria-posinset="1" aria-setsize="1"><td role="gridcell">Test</td></tr></tbody></table></div>"`;
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`RovingTabIndexItem allows another component to be specified as the rendered component using the \`as\` prop 1`] = `
4
4
  <div>
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`RovingTabIndex does not render any elements other than its children 1`] = `
4
4
  <div>
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`TreeGridRow forwards other props to the rendered tr element 1`] = `
4
4
  <div>
@@ -154,7 +154,7 @@ The id of the currently selected node.
154
154
 
155
155
  ### `size`
156
156
 
157
- - Type: `"default" | "small" | "compact" | "__unstable-large"`
157
+ - Type: `"default" | "small" | "compact"`
158
158
  - Required: No
159
159
  - Default: `'default'`
160
160
 
@@ -18,15 +18,8 @@ export interface Tree {
18
18
  export interface TreeSelectProps
19
19
  extends Omit<
20
20
  SelectControlSingleSelectionProps,
21
- 'value' | 'multiple' | 'onChange' | '__next40pxDefaultSize'
21
+ 'value' | 'multiple' | 'onChange'
22
22
  > {
23
- /**
24
- * Start opting into the larger default height that will become the default size in a future version.
25
- *
26
- * @deprecated Default behavior since WordPress 7.1. Prop can be safely removed.
27
- * @ignore
28
- */
29
- __next40pxDefaultSize?: boolean;
30
23
  /**
31
24
  * If this property is added, an option will be added with this label to represent empty selection.
32
25
  */
@@ -70,10 +70,7 @@ export type UnitSelectControlProps = {
70
70
 
71
71
  export type UnitControlProps = Pick< InputControlProps, 'size' > &
72
72
  Omit< UnitSelectControlProps, 'size' | 'unit' > &
73
- Omit<
74
- NumberControlProps,
75
- 'spinControls' | 'suffix' | 'type' | '__next40pxDefaultSize'
76
- > & {
73
+ Omit< NumberControlProps, 'spinControls' | 'suffix' | 'type' > & {
77
74
  /**
78
75
  * If `true`, the unit `<select>` is hidden.
79
76
  *
@@ -110,18 +107,4 @@ export type UnitControlProps = Pick< InputControlProps, 'size' > &
110
107
  * Callback when either the quantity or the unit inputs gains focus.
111
108
  */
112
109
  onFocus?: FocusEventHandler< HTMLInputElement | HTMLSelectElement >;
113
- /**
114
- * Do not throw a warning for the deprecated 36px default size.
115
- * For internal components of other components that already throw the warning.
116
- *
117
- * @ignore
118
- */
119
- __shouldNotWarnDeprecated36pxSize?: boolean;
120
- /**
121
- * Start opting into the larger default height that will become the default size in a future version.
122
- *
123
- * @deprecated Default behavior since WordPress 7.1. Prop can be safely removed.
124
- * @ignore
125
- */
126
- __next40pxDefaultSize?: boolean;
127
110
  };
@@ -37,3 +37,4 @@ $components-color-light-gray-placeholder: color-mix(in srgb, $components-color-b
37
37
  // Semantic aliases (prefer these over raw gray values when applicable).
38
38
  $components-color-border: #{ $components-color-gray-600 };
39
39
  $components-color-disabled: #{ $components-color-gray-600 };
40
+ $components-color-focus: var(--wp-components-color-accent, var(--wpds-color-stroke-focus));
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`props should render alignment 1`] = `
4
4
  <div>
@@ -365,6 +365,57 @@ export const ShowingErrorsAtArbitraryTimes: StoryObj<
365
365
  },
366
366
  };
367
367
 
368
+ /**
369
+ * A synthetic `invalid` event can be dispatched to reveal an existing error
370
+ * without moving focus.
371
+ */
372
+ export const ShowingErrorsWithoutMovingFocus: StoryObj<
373
+ typeof ValidatedInputControl
374
+ > = {
375
+ args: {
376
+ label: 'Text',
377
+ required: true,
378
+ help: 'The word "error" will trigger an error.',
379
+ },
380
+ decorators: [],
381
+ render: function Template( { ...args } ) {
382
+ const [ text, setText ] = useState< string | undefined >( 'error' );
383
+ const ref = useRef< HTMLInputElement >( null );
384
+
385
+ return (
386
+ <VStack spacing={ 4 } alignment="left">
387
+ <ValidatedInputControl
388
+ ref={ ref }
389
+ { ...args }
390
+ value={ text }
391
+ onChange={ setText }
392
+ customValidity={
393
+ text === 'error'
394
+ ? {
395
+ type: 'invalid',
396
+ message: 'The word "error" is not allowed.',
397
+ }
398
+ : undefined
399
+ }
400
+ />
401
+ <Button
402
+ __next40pxDefaultSize
403
+ variant="secondary"
404
+ onClick={ () =>
405
+ ref.current?.dispatchEvent(
406
+ new Event( 'invalid', {
407
+ cancelable: true,
408
+ } )
409
+ )
410
+ }
411
+ >
412
+ Show errors
413
+ </Button>
414
+ </VStack>
415
+ );
416
+ },
417
+ };
418
+
368
419
  /**
369
420
  * A `form` wrapper and `type="submit"` button can be used to force validation when
370
421
  * the user tries to commit their changes, while still allowing the modal to be closed by canceling.
@@ -124,6 +124,15 @@ function UnforwardedControlWithError< C extends React.ReactElement >(
124
124
  const suppressNativePopover = ( event: Event ) => {
125
125
  event.preventDefault();
126
126
 
127
+ // Only trusted `invalid` events (a form submission or a
128
+ // `reportValidity()` call) mirror the native focus behavior.
129
+ // Consumers may dispatch a synthetic `invalid` event to reveal
130
+ // this control's error message without disturbing the user's
131
+ // place in the form, so it must not move focus.
132
+ if ( ! event.isTrusted ) {
133
+ return;
134
+ }
135
+
127
136
  const target = event.target as ValidityTarget;
128
137
  const firstErrorInForm = Array.from(
129
138
  target.form?.elements ?? []
@@ -21,7 +21,7 @@
21
21
  .components-combobox-control__suggestions-container:has(
22
22
  input:invalid[data-validity-visible]
23
23
  ):not(:has([aria-expanded="true"])) {
24
- --wp-components-color-accent: #{$alert-red};
24
+ --wp-admin-theme-color: #{$alert-red};
25
25
  }
26
26
  }
27
27
 
@@ -41,14 +41,14 @@
41
41
 
42
42
  // For FormTokenField
43
43
  &:has(input:invalid[data-validity-visible]) .components-form-token-field__input-container:not(:has([aria-expanded="true"])) {
44
- --wp-components-color-accent: #{$alert-red};
44
+ --wp-admin-theme-color: #{$alert-red};
45
45
  border-color: $alert-red;
46
46
  }
47
47
 
48
48
  // For ContentEditableControl
49
49
  &:has(input:invalid[data-validity-visible])
50
50
  .components-validated-control__content-editable [role="textbox"] {
51
- --wp-components-color-accent: #{$alert-red};
51
+ --wp-admin-theme-color: #{$alert-red};
52
52
  border-color: $alert-red;
53
53
  }
54
54
  }
@@ -542,5 +542,47 @@ describe( 'ControlWithError', () => {
542
542
  ).toHaveFocus();
543
543
  } );
544
544
  } );
545
+
546
+ it( 'should show the error message without moving focus on a synthetic `invalid` event', async () => {
547
+ const user = userEvent.setup();
548
+ function ValidatedInputControlWithRef(
549
+ props: React.ComponentProps< typeof ValidatedInputControl >
550
+ ) {
551
+ const ref = useRef< HTMLInputElement >( null );
552
+ return (
553
+ <>
554
+ <ValidatedInputControl ref={ ref } { ...props } />
555
+ <button
556
+ type="button"
557
+ onClick={ () =>
558
+ ref.current?.dispatchEvent(
559
+ new Event( 'invalid', {
560
+ cancelable: true,
561
+ } )
562
+ )
563
+ }
564
+ >
565
+ Show errors
566
+ </button>
567
+ </>
568
+ );
569
+ }
570
+
571
+ render( <ValidatedInputControlWithRef label="Text" required /> );
572
+
573
+ const button = screen.getByRole( 'button', {
574
+ name: 'Show errors',
575
+ } );
576
+ await user.click( button );
577
+
578
+ // The error message is revealed...
579
+ await waitFor( () => {
580
+ expect(
581
+ screen.getByText( 'Constraints not satisfied' )
582
+ ).toBeVisible();
583
+ } );
584
+ // ...but focus is not moved to the invalid field.
585
+ expect( button ).toHaveFocus();
586
+ } );
545
587
  } );
546
588
  } );
@@ -1,4 +1,4 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`props should ignore legacy css prop styles (array) 1`] = `
4
4
  <div>
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/components/src/confirm-dialog/styles.ts
21
- var styles_exports = {};
22
- __export(styles_exports, {
23
- wrapper: () => wrapper
24
- });
25
- module.exports = __toCommonJS(styles_exports);
26
- var import_react = require("@emotion/react");
27
- function _EMOTION_STRINGIFIED_CSS_ERROR__() {
28
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
29
- }
30
- var wrapper = process.env.NODE_ENV === "production" ? {
31
- name: "7g5ii0",
32
- styles: "&&{z-index:1000001;}"
33
- } : {
34
- name: "1gucf3d-wrapper",
35
- styles: "&&{z-index:1000001;};label:wrapper;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhMEIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFRoZSB6LWluZGV4IGZvciBDb25maXJtRGlhbG9nIGlzIGJlaW5nIHNldCBoZXJlIGluc3RlYWQgb2YgaW5cbiAqIHBhY2thZ2VzL2Jhc2Utc3R5bGVzL196LWluZGV4LnNjc3MsIGJlY2F1c2UgdGhpcyBjb21wb25lbnQgdXNlc1xuICogZW1vdGlvbiBpbnN0ZWFkIG9mIHNhc3MuXG4gKlxuICogQ29uZmlybURpYWxvZyBuZWVkcyB0aGlzIGhpZ2hlciB6LWluZGV4IHRvIGVuc3VyZSBpdCByZW5kZXJzIG9uIHRvcCBvZlxuICogYW55IHBhcmVudCBQb3BvdmVyIGNvbXBvbmVudC5cbiAqL1xuZXhwb3J0IGNvbnN0IHdyYXBwZXIgPSBjc3NgXG5cdCYmIHtcblx0XHR6LWluZGV4OiAxMDAwMDAxO1xuXHR9XG5gO1xuIl19 */",
36
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
37
- };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- wrapper
41
- });
42
- //# sourceMappingURL=styles.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/confirm-dialog/styles.ts"],
4
- "sourcesContent": ["function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\n\n/**\n * The z-index for ConfirmDialog is being set here instead of in\n * packages/base-styles/_z-index.scss, because this component uses\n * emotion instead of sass.\n *\n * ConfirmDialog needs this higher z-index to ensure it renders on top of\n * any parent Popover component.\n */\nexport const wrapper = process.env.NODE_ENV === \"production\" ? {\n name: \"7g5ii0\",\n styles: \"&&{z-index:1000001;}\"\n} : {\n name: \"1gucf3d-wrapper\",\n styles: \"&&{z-index:1000001;};label:wrapper;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFhMEIiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuXG4vKipcbiAqIFRoZSB6LWluZGV4IGZvciBDb25maXJtRGlhbG9nIGlzIGJlaW5nIHNldCBoZXJlIGluc3RlYWQgb2YgaW5cbiAqIHBhY2thZ2VzL2Jhc2Utc3R5bGVzL196LWluZGV4LnNjc3MsIGJlY2F1c2UgdGhpcyBjb21wb25lbnQgdXNlc1xuICogZW1vdGlvbiBpbnN0ZWFkIG9mIHNhc3MuXG4gKlxuICogQ29uZmlybURpYWxvZyBuZWVkcyB0aGlzIGhpZ2hlciB6LWluZGV4IHRvIGVuc3VyZSBpdCByZW5kZXJzIG9uIHRvcCBvZlxuICogYW55IHBhcmVudCBQb3BvdmVyIGNvbXBvbmVudC5cbiAqL1xuZXhwb3J0IGNvbnN0IHdyYXBwZXIgPSBjc3NgXG5cdCYmIHtcblx0XHR6LWluZGV4OiAxMDAwMDAxO1xuXHR9XG5gO1xuIl19 */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAAoB;AAJpB,SAAS,mCAAmC;AAAE,SAAO;AAAmO;AAcjR,IAAM,UAAU,QAAQ,IAAI,aAAa,eAAe;AAAA,EAC7D,MAAM;AAAA,EACN,QAAQ;AACV,IAAI;AAAA,EACF,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AACZ;",
6
- "names": []
7
- }
@@ -1,42 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/components/src/disabled/styles/disabled-styles.tsx
21
- var disabled_styles_exports = {};
22
- __export(disabled_styles_exports, {
23
- disabledStyles: () => disabledStyles
24
- });
25
- module.exports = __toCommonJS(disabled_styles_exports);
26
- var import_react = require("@emotion/react");
27
- function _EMOTION_STRINGIFIED_CSS_ERROR__() {
28
- return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
29
- }
30
- var disabledStyles = process.env.NODE_ENV === "production" ? {
31
- name: "u2jump",
32
- styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
33
- } : {
34
- name: "iqemdn-disabledStyles",
35
- styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;};label:disabledStyles;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRpc2FibGVkLXN0eWxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2lDIiwiZmlsZSI6ImRpc2FibGVkLXN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBkaXNhYmxlZFN0eWxlcyA9IGNzc2Bcblx0cG9zaXRpb246IHJlbGF0aXZlO1xuXHRwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXHQmOjphZnRlciB7XG5cdFx0Y29udGVudDogJyc7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdHRvcDogMDtcblx0XHRyaWdodDogMDtcblx0XHRib3R0b206IDA7XG5cdFx0bGVmdDogMDtcblx0fVxuXG5cdC8vIEFsc28gbWFrZSBuZXN0ZWQgYmxvY2tzIHVuc2VsZWN0YWJsZS5cblx0KiB7XG5cdFx0cG9pbnRlci1ldmVudHM6IG5vbmU7XG5cdH1cbmA7XG4iXX0= */",
36
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
37
- };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- disabledStyles
41
- });
42
- //# sourceMappingURL=disabled-styles.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/disabled/styles/disabled-styles.tsx"],
4
- "sourcesContent": ["function _EMOTION_STRINGIFIED_CSS_ERROR__() { return \"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).\"; }\n/**\n * External dependencies\n */\nimport { css } from '@emotion/react';\nexport const disabledStyles = process.env.NODE_ENV === \"production\" ? {\n name: \"u2jump\",\n styles: \"position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}\"\n} : {\n name: \"iqemdn-disabledStyles\",\n styles: \"position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;};label:disabledStyles;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImRpc2FibGVkLXN0eWxlcy50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBS2lDIiwiZmlsZSI6ImRpc2FibGVkLXN0eWxlcy50c3giLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEV4dGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBjc3MgfSBmcm9tICdAZW1vdGlvbi9yZWFjdCc7XG5cbmV4cG9ydCBjb25zdCBkaXNhYmxlZFN0eWxlcyA9IGNzc2Bcblx0cG9zaXRpb246IHJlbGF0aXZlO1xuXHRwb2ludGVyLWV2ZW50czogbm9uZTtcblxuXHQmOjphZnRlciB7XG5cdFx0Y29udGVudDogJyc7XG5cdFx0cG9zaXRpb246IGFic29sdXRlO1xuXHRcdHRvcDogMDtcblx0XHRyaWdodDogMDtcblx0XHRib3R0b206IDA7XG5cdFx0bGVmdDogMDtcblx0fVxuXG5cdC8vIEFsc28gbWFrZSBuZXN0ZWQgYmxvY2tzIHVuc2VsZWN0YWJsZS5cblx0KiB7XG5cdFx0cG9pbnRlci1ldmVudHM6IG5vbmU7XG5cdH1cbmA7XG4iXX0= */\",\n toString: _EMOTION_STRINGIFIED_CSS_ERROR__\n};"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAAoB;AAJpB,SAAS,mCAAmC;AAAE,SAAO;AAAmO;AAKjR,IAAM,iBAAiB,QAAQ,IAAI,aAAa,eAAe;AAAA,EACpE,MAAM;AAAA,EACN,QAAQ;AACV,IAAI;AAAA,EACF,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AACZ;",
6
- "names": []
7
- }
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/components/src/form-token-field/styles.ts
31
- var styles_exports = {};
32
- __export(styles_exports, {
33
- TokensAndInputWrapperFlex: () => TokensAndInputWrapperFlex
34
- });
35
- module.exports = __toCommonJS(styles_exports);
36
- var import_base = __toESM(require("@emotion/styled/base"));
37
- var import_flex = require("../flex/index.cjs");
38
- var import_utils = require("../utils/index.cjs");
39
- var TokensAndInputWrapperFlex = /* @__PURE__ */ (0, import_base.default)(import_flex.Flex, process.env.NODE_ENV === "production" ? {
40
- target: "ehq8nmi0"
41
- } : {
42
- target: "ehq8nmi0",
43
- label: "TokensAndInputWrapperFlex"
44
- })("padding:7px;", import_utils.boxSizingReset, ";" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFXdUQiLCJmaWxlIjoic3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBFeHRlcm5hbCBkZXBlbmRlbmNpZXNcbiAqL1xuaW1wb3J0IHN0eWxlZCBmcm9tICdAZW1vdGlvbi9zdHlsZWQnO1xuXG4vKipcbiAqIEludGVybmFsIGRlcGVuZGVuY2llc1xuICovXG5pbXBvcnQgeyBGbGV4IH0gZnJvbSAnLi4vZmxleCc7XG5pbXBvcnQgeyBib3hTaXppbmdSZXNldCB9IGZyb20gJy4uL3V0aWxzJztcblxuZXhwb3J0IGNvbnN0IFRva2Vuc0FuZElucHV0V3JhcHBlckZsZXggPSBzdHlsZWQoIEZsZXggKWBcblx0cGFkZGluZzogN3B4O1xuXHQkeyBib3hTaXppbmdSZXNldCB9XG5gO1xuIl19 */"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- TokensAndInputWrapperFlex
48
- });
49
- //# sourceMappingURL=styles.cjs.map