@wordpress/components 40.0.0 → 40.1.1-next.v.202609031004.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 (291) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/build/border-box-control/border-box-control/component.cjs +37 -5
  3. package/build/border-box-control/border-box-control/component.cjs.map +3 -3
  4. package/build/border-box-control/border-box-control/hook.cjs +24 -3
  5. package/build/border-box-control/border-box-control/hook.cjs.map +3 -3
  6. package/build/border-box-control/border-box-control-linked-button/hook.cjs +2 -2
  7. package/build/border-box-control/border-box-control-linked-button/hook.cjs.map +2 -2
  8. package/build/border-box-control/border-box-control-split-controls/hook.cjs +2 -2
  9. package/build/border-box-control/border-box-control-split-controls/hook.cjs.map +2 -2
  10. package/build/border-box-control/border-box-control-visualizer/hook.cjs +2 -2
  11. package/build/border-box-control/border-box-control-visualizer/hook.cjs.map +2 -2
  12. package/build/color-palette/index.cjs +1 -1
  13. package/build/color-palette/index.cjs.map +2 -2
  14. package/build/context/context-system-provider.cjs +2 -5
  15. package/build/context/context-system-provider.cjs.map +3 -3
  16. package/build/context/use-context-system.cjs +7 -2
  17. package/build/context/use-context-system.cjs.map +2 -2
  18. package/build/icon/index.cjs +30 -12
  19. package/build/icon/index.cjs.map +2 -2
  20. package/build/item-group/item/hook.cjs +1 -1
  21. package/build/item-group/item/hook.cjs.map +2 -2
  22. package/build/item-group/item-group/hook.cjs +1 -1
  23. package/build/item-group/item-group/hook.cjs.map +2 -2
  24. package/build/resizable-box/index.cjs.map +1 -1
  25. package/build/snackbar/index.cjs +8 -5
  26. package/build/snackbar/index.cjs.map +2 -2
  27. package/build/tools-panel/tools-panel/hook.cjs +102 -106
  28. package/build/tools-panel/tools-panel/hook.cjs.map +2 -2
  29. package/build/tools-panel/tools-panel-item/hook.cjs +33 -33
  30. package/build/tools-panel/tools-panel-item/hook.cjs.map +2 -2
  31. package/build-module/border-box-control/border-box-control/component.mjs +38 -6
  32. package/build-module/border-box-control/border-box-control/component.mjs.map +2 -2
  33. package/build-module/border-box-control/border-box-control/hook.mjs +14 -3
  34. package/build-module/border-box-control/border-box-control/hook.mjs.map +2 -2
  35. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs +2 -2
  36. package/build-module/border-box-control/border-box-control-linked-button/hook.mjs.map +2 -2
  37. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs +2 -2
  38. package/build-module/border-box-control/border-box-control-split-controls/hook.mjs.map +2 -2
  39. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs +2 -2
  40. package/build-module/border-box-control/border-box-control-visualizer/hook.mjs.map +2 -2
  41. package/build-module/color-palette/index.mjs +1 -1
  42. package/build-module/color-palette/index.mjs.map +2 -2
  43. package/build-module/context/context-system-provider.mjs +2 -5
  44. package/build-module/context/context-system-provider.mjs.map +3 -3
  45. package/build-module/context/use-context-system.mjs +7 -2
  46. package/build-module/context/use-context-system.mjs.map +2 -2
  47. package/build-module/icon/index.mjs +30 -12
  48. package/build-module/icon/index.mjs.map +2 -2
  49. package/build-module/item-group/item/hook.mjs +1 -1
  50. package/build-module/item-group/item/hook.mjs.map +2 -2
  51. package/build-module/item-group/item-group/hook.mjs +1 -1
  52. package/build-module/item-group/item-group/hook.mjs.map +2 -2
  53. package/build-module/resizable-box/index.mjs.map +1 -1
  54. package/build-module/snackbar/index.mjs +8 -5
  55. package/build-module/snackbar/index.mjs.map +2 -2
  56. package/build-module/tools-panel/tools-panel/hook.mjs +103 -107
  57. package/build-module/tools-panel/tools-panel/hook.mjs.map +2 -2
  58. package/build-module/tools-panel/tools-panel-item/hook.mjs +35 -35
  59. package/build-module/tools-panel/tools-panel-item/hook.mjs.map +2 -2
  60. package/build-style/style-rtl.css +7 -35
  61. package/build-style/style.css +7 -35
  62. package/build-types/border-box-control/border-box-control/component.d.ts +4 -0
  63. package/build-types/border-box-control/border-box-control/component.d.ts.map +1 -1
  64. package/build-types/border-box-control/border-box-control/hook.d.ts +4 -2
  65. package/build-types/border-box-control/border-box-control/hook.d.ts.map +1 -1
  66. package/build-types/border-box-control/types.d.ts +6 -2
  67. package/build-types/border-box-control/types.d.ts.map +1 -1
  68. package/build-types/composite/types.d.ts +1 -1
  69. package/build-types/context/context-system-provider.d.ts +8 -6
  70. package/build-types/context/context-system-provider.d.ts.map +1 -1
  71. package/build-types/context/use-context-system.d.ts.map +1 -1
  72. package/build-types/icon/index.d.ts.map +1 -1
  73. package/build-types/popover/types.d.ts +6 -2
  74. package/build-types/popover/types.d.ts.map +1 -1
  75. package/build-types/snackbar/index.d.ts.map +1 -1
  76. package/build-types/tools-panel/tools-panel/hook.d.ts +4 -4
  77. package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
  78. package/build-types/tools-panel/tools-panel-item/hook.d.ts.map +1 -1
  79. package/build-types/tools-panel/types.d.ts +52 -9
  80. package/build-types/tools-panel/types.d.ts.map +1 -1
  81. package/package.json +26 -25
  82. package/src/angle-picker-control/style.module.scss +1 -1
  83. package/src/autocomplete/test/get-autocomplete-match.ts +2 -1
  84. package/src/base-control/stories/index.story.tsx +2 -2
  85. package/src/border-box-control/border-box-control/README.md +5 -3
  86. package/src/border-box-control/border-box-control/component.tsx +83 -15
  87. package/src/border-box-control/border-box-control/hook.ts +19 -1
  88. package/src/border-box-control/stories/index.story.tsx +10 -0
  89. package/src/border-box-control/style.module.scss +34 -3
  90. package/src/border-box-control/test/{index.tsx → index.jsdom.test.tsx} +133 -0
  91. package/src/border-box-control/test/utils.ts +11 -0
  92. package/src/border-box-control/types.ts +6 -2
  93. package/src/border-control/test/{index.js → index.jsdom.test.tsx} +20 -13
  94. package/src/checkbox-control/style.scss +2 -2
  95. package/src/checkbox-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +8 -5
  96. package/src/color-palette/index.tsx +1 -1
  97. package/src/composite/README.md +1 -1
  98. package/src/composite/types.ts +1 -1
  99. package/src/context/{context-system-provider.js → context-system-provider.tsx} +19 -5
  100. package/src/context/stories/{ComponentsProvider.stories.jsx → ComponentsProvider.stories.tsx} +2 -2
  101. package/src/context/test/__snapshots__/{context-system-provider.js.snap → context-system-provider.jsdom.test.tsx.snap} +3 -3
  102. package/src/context/test/context-connect.tsx +1 -2
  103. package/src/context/test/{context-system-provider.js → context-system-provider.jsdom.test.tsx} +81 -43
  104. package/src/context/test/wordpress-component.tsx +1 -2
  105. package/src/context/use-context-system.js +13 -4
  106. package/src/custom-gradient-picker/test/serializer.ts +1 -0
  107. package/src/date-time/test/utils.test.ts +9 -0
  108. package/src/draggable/style.module.scss +1 -1
  109. package/src/dropdown/style.module.scss +2 -2
  110. package/src/font-size-picker/test/utils.ts +1 -0
  111. package/src/icon/index.tsx +28 -12
  112. package/src/icon/test/{index.tsx → index.jsdom.test.tsx} +66 -0
  113. package/src/input-control/test/{index.js → index.jsdom.test.tsx} +16 -10
  114. package/src/item-group/style.module.scss +1 -2
  115. package/src/navigator/test/router.ts +1 -0
  116. package/src/notice/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +5 -2
  117. package/src/popover/README.md +2 -2
  118. package/src/popover/test/{index.tsx → index.jsdom.test.tsx} +23 -0
  119. package/src/popover/types.ts +9 -3
  120. package/src/query-controls/test/terms.ts +1 -0
  121. package/src/resizable-box/index.tsx +1 -1
  122. package/src/slot-fill/test/{index.js → index.jsdom.test.tsx} +3 -3
  123. package/src/slot-fill/test/{slot.js → slot.jsdom.test.tsx} +17 -9
  124. package/src/snackbar/index.tsx +10 -6
  125. package/src/snackbar/test/{index.tsx → index.jsdom.test.tsx} +28 -2
  126. package/src/snackbar/test/list.jsdom.test.tsx +99 -0
  127. package/src/surface/style.module.scss +2 -2
  128. package/src/textarea-control/style.module.scss +1 -1
  129. package/src/tip/style.scss +1 -1
  130. package/src/toggle-group-control/toggle-group-control/style.module.scss +1 -1
  131. package/src/tools-panel/test/{index.tsx → index.jsdom.test.tsx} +528 -9
  132. package/src/tools-panel/tools-panel/hook.ts +195 -180
  133. package/src/tools-panel/tools-panel-item/README.md +42 -1
  134. package/src/tools-panel/tools-panel-item/hook.ts +97 -69
  135. package/src/tools-panel/types.ts +54 -9
  136. package/src/truncate/style.module.scss +0 -1
  137. package/src/unit-control/test/utils.ts +1 -0
  138. package/src/utils/hooks/test/{use-controlled-state.js → use-controlled-state.jsdom.test.tsx} +17 -3
  139. package/src/utils/hooks/test/{use-controlled-value.js → use-controlled-value.jsdom.test.tsx} +3 -1
  140. package/src/utils/hooks/test/{use-cx.js → use-cx.jsdom.test.tsx} +3 -1
  141. package/src/utils/test/colors.js +1 -0
  142. package/src/utils/test/{get-node-text.js → get-node-text.tsx} +1 -0
  143. package/src/utils/test/math.js +1 -0
  144. package/src/utils/test/rtl.js +1 -0
  145. package/src/utils/test/space.js +1 -0
  146. package/src/utils/test/strings.js +1 -0
  147. package/src/utils/test/unit-values.js +1 -0
  148. package/src/view/test/{index.js → index.jsdom.test.tsx} +5 -1
  149. package/src/snackbar/test/list.tsx +0 -39
  150. /package/src/alignment-matrix-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  151. /package/src/autocomplete/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  152. /package/src/badge/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  153. /package/src/base-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  154. /package/src/box-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  155. /package/src/button/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  156. /package/src/card/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  157. /package/src/card/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  158. /package/src/checkbox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  159. /package/src/circular-option-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  160. /package/src/color-indicator/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  161. /package/src/color-indicator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  162. /package/src/color-palette/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  163. /package/src/color-palette/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  164. /package/src/color-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  165. /package/src/combobox-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  166. /package/src/composite/legacy/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  167. /package/src/composite/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  168. /package/src/confirm-dialog/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  169. /package/src/content-editable-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  170. /package/src/custom-gradient-picker/gradient-bar/test/{utils.ts → utils.jsdom.test.ts} +0 -0
  171. /package/src/custom-gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  172. /package/src/custom-select-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  173. /package/src/custom-select-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  174. /package/src/custom-select-control-v2/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  175. /package/src/date-time/date-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  176. /package/src/date-time/date-picker/test/{use-lilius.ts → use-lilius.jsdom.test.ts} +0 -0
  177. /package/src/date-time/date-time/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  178. /package/src/date-time/time-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  179. /package/src/date-time/time-picker/time-input/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  180. /package/src/disabled/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  181. /package/src/divider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  182. /package/src/dropdown/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  183. /package/src/dropdown-menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  184. /package/src/duotone-picker/test/{custom-duotone-bar.tsx → custom-duotone-bar.jsdom.test.tsx} +0 -0
  185. /package/src/duotone-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  186. /package/src/elevation/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  187. /package/src/elevation/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  188. /package/src/external-link/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  189. /package/src/flex/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  190. /package/src/flex/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  191. /package/src/focal-point-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  192. /package/src/focal-point-picker/test/{media.tsx → media.jsdom.test.tsx} +0 -0
  193. /package/src/font-size-picker/test/{font-size-picker-select.tsx → font-size-picker-select.jsdom.test.tsx} +0 -0
  194. /package/src/font-size-picker/test/{font-size-picker-toggle-group.tsx → font-size-picker-toggle-group.jsdom.test.tsx} +0 -0
  195. /package/src/font-size-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  196. /package/src/form-file-upload/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  197. /package/src/form-toggle/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  198. /package/src/form-toggle/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  199. /package/src/form-token-field/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  200. /package/src/gradient-picker/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  201. /package/src/grid/test/{grid.tsx → grid.jsdom.test.tsx} +0 -0
  202. /package/src/guide/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  203. /package/src/h-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  204. /package/src/h-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  205. /package/src/heading/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  206. /package/src/heading/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  207. /package/src/higher-order/with-fallback-styles/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  208. /package/src/higher-order/with-filters/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  209. /package/src/higher-order/with-filters/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  210. /package/src/higher-order/with-focus-outside/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  211. /package/src/higher-order/with-focus-return/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  212. /package/src/higher-order/with-notices/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  213. /package/src/higher-order/with-spoken-messages/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  214. /package/src/input-control/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  215. /package/src/isolated-event-container/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  216. /package/src/item-group/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  217. /package/src/item-group/test/{index.js → index.jsdom.test.tsx} +0 -0
  218. /package/src/keyboard-shortcuts/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  219. /package/src/menu/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  220. /package/src/menu-group/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  221. /package/src/menu-item/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
  222. /package/src/menu-item/test/{index.js → index.jsdom.test.tsx} +0 -0
  223. /package/src/modal/test/{aria-helper.ts → aria-helper.jsdom.test.ts} +0 -0
  224. /package/src/modal/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  225. /package/src/navigable-container/test/{navigable-menu.tsx → navigable-menu.jsdom.test.tsx} +0 -0
  226. /package/src/navigable-container/test/{tababble-container.tsx → tababble-container.jsdom.test.tsx} +0 -0
  227. /package/src/navigator/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  228. /package/src/notice/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  229. /package/src/notice/test/{list.tsx → list.jsdom.test.tsx} +0 -0
  230. /package/src/number-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  231. /package/src/palette-edit/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  232. /package/src/panel/test/__snapshots__/{body.tsx.snap → body.jsdom.test.tsx.snap} +0 -0
  233. /package/src/panel/test/__snapshots__/{header.tsx.snap → header.jsdom.test.tsx.snap} +0 -0
  234. /package/src/panel/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  235. /package/src/panel/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  236. /package/src/panel/test/{body.tsx → body.jsdom.test.tsx} +0 -0
  237. /package/src/panel/test/{header.tsx → header.jsdom.test.tsx} +0 -0
  238. /package/src/panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  239. /package/src/panel/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  240. /package/src/placeholder/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  241. /package/src/progress-bar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  242. /package/src/radio-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  243. /package/src/range-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  244. /package/src/resizable-box/resize-tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  245. /package/src/resizable-box/resize-tooltip/test/{label.tsx → label.jsdom.test.tsx} +0 -0
  246. /package/src/sandbox/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  247. /package/src/scroll-lock/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  248. /package/src/scrollable/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  249. /package/src/search-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  250. /package/src/select-control/test/__snapshots__/{select-control.tsx.snap → select-control.jsdom.test.tsx.snap} +0 -0
  251. /package/src/select-control/test/{select-control.tsx → select-control.jsdom.test.tsx} +0 -0
  252. /package/src/shortcut/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  253. /package/src/shortcut/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  254. /package/src/slot-fill/test/__snapshots__/{slot.js.snap → slot.jsdom.test.tsx.snap} +0 -0
  255. /package/src/spacer/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  256. /package/src/spacer/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  257. /package/src/style-provider/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  258. /package/src/surface/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  259. /package/src/tab-panel/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  260. /package/src/tabs/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  261. /package/src/text/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  262. /package/src/text/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  263. /package/src/text-control/test/{text-control.tsx → text-control.jsdom.test.tsx} +0 -0
  264. /package/src/text-highlight/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  265. /package/src/toggle-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  266. /package/src/toggle-group-control/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  267. /package/src/toggle-group-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  268. /package/src/toolbar/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  269. /package/src/toolbar/test/{toolbar-group.tsx → toolbar-group.jsdom.test.tsx} +0 -0
  270. /package/src/tooltip/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  271. /package/src/tree-grid/test/__snapshots__/{cell.tsx.snap → cell.jsdom.test.tsx.snap} +0 -0
  272. /package/src/tree-grid/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  273. /package/src/tree-grid/test/__snapshots__/{roving-tab-index-item.tsx.snap → roving-tab-index-item.jsdom.test.tsx.snap} +0 -0
  274. /package/src/tree-grid/test/__snapshots__/{roving-tab-index.tsx.snap → roving-tab-index.jsdom.test.tsx.snap} +0 -0
  275. /package/src/tree-grid/test/__snapshots__/{row.tsx.snap → row.jsdom.test.tsx.snap} +0 -0
  276. /package/src/tree-grid/test/{cell.tsx → cell.jsdom.test.tsx} +0 -0
  277. /package/src/tree-grid/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  278. /package/src/tree-grid/test/{roving-tab-index-item.tsx → roving-tab-index-item.jsdom.test.tsx} +0 -0
  279. /package/src/tree-grid/test/{roving-tab-index.tsx → roving-tab-index.jsdom.test.tsx} +0 -0
  280. /package/src/tree-grid/test/{row.tsx → row.jsdom.test.tsx} +0 -0
  281. /package/src/truncate/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  282. /package/src/unit-control/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  283. /package/src/utils/test/{polymorphic-element.tsx → polymorphic-element.jsdom.test.tsx} +0 -0
  284. /package/src/v-stack/test/__snapshots__/{index.tsx.snap → index.jsdom.test.tsx.snap} +0 -0
  285. /package/src/v-stack/test/{index.tsx → index.jsdom.test.tsx} +0 -0
  286. /package/src/validated-form-controls/test/{content-editable-control.tsx → content-editable-control.jsdom.test.tsx} +0 -0
  287. /package/src/validated-form-controls/test/{custom-select-control.tsx → custom-select-control.jsdom.test.tsx} +0 -0
  288. /package/src/validated-form-controls/test/{input-control.tsx → input-control.jsdom.test.tsx} +0 -0
  289. /package/src/validated-form-controls/test/{range-control.tsx → range-control.jsdom.test.tsx} +0 -0
  290. /package/src/validated-form-controls/test/{textarea-control.tsx → textarea-control.jsdom.test.tsx} +0 -0
  291. /package/src/view/test/__snapshots__/{index.js.snap → index.jsdom.test.tsx.snap} +0 -0
@@ -93,6 +93,16 @@ export type ToolsPanelHeaderProps = {
93
93
  toggleItem: (label: string) => void;
94
94
  };
95
95
  export type ToolsPanelItem = {
96
+ /**
97
+ * For optional items only, this determines whether the item is shown on
98
+ * first render even when `hasValue()` returns `false`.
99
+ *
100
+ * An item is always shown while it has a value, so this only controls the
101
+ * initial state of items without one.
102
+ *
103
+ * @default false
104
+ */
105
+ defaultShown?: boolean;
96
106
  /**
97
107
  * This is called when building the `ToolsPanel` menu to determine the
98
108
  * item's initial checked state.
@@ -115,6 +125,27 @@ export type ToolsPanelItem = {
115
125
  * panel.
116
126
  */
117
127
  label: string;
128
+ /**
129
+ * A callback executed when the user shows or hides the item via the
130
+ * `ToolsPanel` menu, passed `true` when it was shown and `false` when it
131
+ * was hidden.
132
+ *
133
+ * Unlike `onDeselect`, this fires whether or not the item has a value, and
134
+ * only in response to an explicit menu action. Visibility changes with
135
+ * another cause do not trigger it, such as an item becoming visible
136
+ * because it received a value or because `defaultShown` was set, or
137
+ * hiding because `Reset all` ran.
138
+ *
139
+ * Items flagged with `isShownByDefault` are always visible and stay so when
140
+ * toggled off, so this is never called for them.
141
+ *
142
+ * A single menu action may also call `onSelect` or `onDeselect`, which are
143
+ * unchanged. Showing an item without a value calls this with `true` and
144
+ * `onSelect`; hiding an item that has a value calls this with `false` and
145
+ * `onDeselect`. Use this callback to track visibility and `onDeselect` to
146
+ * reset a value, rather than treating them as interchangeable.
147
+ */
148
+ onShownChange?: (isShown: boolean) => void;
118
149
  /**
119
150
  * Panel items will ensure they are only registering with their intended panel
120
151
  * by comparing the `panelId` props set on both the item and the panel itself,
@@ -147,6 +178,18 @@ export type ToolsPanelItemProps = ToolsPanelItem & {
147
178
  */
148
179
  resetAllFilter?: ResetAllFilter;
149
180
  };
181
+ /**
182
+ * The shape of an item as it is held in `ToolsPanel` state. It extends
183
+ * `ToolsPanelItem` with the data the panel needs but that isn't part of the
184
+ * item's own API surface.
185
+ */
186
+ export type RegisteredToolsPanelItem = ToolsPanelItem & {
187
+ /**
188
+ * The item's `resetAllFilter`, collected at registration time so the panel
189
+ * doesn't need a second round of effects to gather them.
190
+ */
191
+ resetAllFilter?: ResetAllFilter;
192
+ };
150
193
  export type ToolsPanelMenuItemKey = 'default' | 'optional';
151
194
  export type ToolsPanelMenuItems = {
152
195
  [menuItemKey in ToolsPanelMenuItemKey]: {
@@ -157,11 +200,17 @@ export type ToolsPanelContext = {
157
200
  panelId?: string | null;
158
201
  menuItems: ToolsPanelMenuItems;
159
202
  hasMenuItems: boolean;
160
- registerPanelItem: (item: ToolsPanelItem) => void;
161
- deregisterPanelItem: (label: string) => void;
203
+ registerPanelItem: (item: RegisteredToolsPanelItem) => void;
204
+ deregisterPanelItem: (label: string, item?: RegisteredToolsPanelItem) => void;
162
205
  registerResetAllFilter: (filter: ResetAllFilter) => void;
163
206
  deregisterResetAllFilter: (filter: ResetAllFilter) => void;
164
- flagItemCustomization: (value: boolean, label: string, group?: ToolsPanelMenuItemKey) => void;
207
+ flagItemCustomization: (value: boolean, label: string,
208
+ /**
209
+ * Ignored, and kept only so that existing three argument callers
210
+ * still typecheck. The group a value lands in now follows from the
211
+ * registered item's `isShownByDefault` rather than from the caller.
212
+ */
213
+ group?: ToolsPanelMenuItemKey) => void;
165
214
  isResetting: boolean;
166
215
  shouldRenderPlaceholderItems: boolean;
167
216
  areAllOptionalControlsHidden: boolean;
@@ -175,11 +224,5 @@ export type ToolsPanelControlsGroupProps = {
175
224
  items: [string, boolean][];
176
225
  toggleItem: (label: string) => void;
177
226
  };
178
- export type ToolsPanelMenuItemsConfig = {
179
- panelItems: ToolsPanelItem[];
180
- shouldReset: boolean;
181
- currentMenuItems?: ToolsPanelMenuItems;
182
- menuItemOrder: string[];
183
- };
184
227
  export {};
185
228
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools-panel/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,cAAc,GA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;IAC3B,mCAAmC,CAAC,EAAE,MAAM,CAAC;IAC7C,kCAAkC,CAAC,EAAE,MAAM,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IAC1C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,CAAE,MAAM,EAAE,OAAO,CAAE,EAAE,CAAC;IAC7B,UAAU,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;CACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/components",
3
- "version": "40.0.0",
3
+ "version": "40.1.1-next.v.202609031004.0",
4
4
  "description": "UI components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -62,27 +62,27 @@
62
62
  "@types/gradient-parser": "^1.1.0",
63
63
  "@types/highlight-words-core": "^1.2.1",
64
64
  "@use-gesture/react": "^10.3.1",
65
- "@wordpress/a11y": "^4.54.0",
66
- "@wordpress/base-styles": "^13.0.0",
67
- "@wordpress/compose": "^8.7.0",
68
- "@wordpress/date": "^5.54.0",
69
- "@wordpress/deprecated": "^4.54.0",
70
- "@wordpress/dom": "^4.54.0",
71
- "@wordpress/element": "^8.6.0",
72
- "@wordpress/escape-html": "^3.54.0",
73
- "@wordpress/hooks": "^4.54.0",
74
- "@wordpress/html-entities": "^4.54.0",
75
- "@wordpress/i18n": "^6.27.0",
76
- "@wordpress/icons": "^15.5.0",
77
- "@wordpress/is-shallow-equal": "^5.54.0",
78
- "@wordpress/kebab-case": "^1.1.0",
79
- "@wordpress/keycodes": "^4.54.0",
80
- "@wordpress/primitives": "^4.54.0",
81
- "@wordpress/private-apis": "^1.54.0",
82
- "@wordpress/rich-text": "^7.54.0",
83
- "@wordpress/style-runtime": "^0.10.0",
84
- "@wordpress/ui": "^0.21.0",
85
- "@wordpress/warning": "^3.54.0",
65
+ "@wordpress/a11y": "^4.54.1-next.v.202609031004.0",
66
+ "@wordpress/base-styles": "^13.1.1-next.v.202609031004.0",
67
+ "@wordpress/compose": "^8.7.2-next.v.202609031004.0",
68
+ "@wordpress/date": "^5.54.1-next.v.202609031004.0",
69
+ "@wordpress/deprecated": "^4.54.1-next.v.202609031004.0",
70
+ "@wordpress/dom": "^4.54.1-next.v.202609031004.0",
71
+ "@wordpress/element": "^8.6.2-next.v.202609031004.0",
72
+ "@wordpress/escape-html": "^3.54.1-next.v.202609031004.0",
73
+ "@wordpress/hooks": "^4.54.1-next.v.202609031004.0",
74
+ "@wordpress/html-entities": "^4.54.1-next.v.202609031004.0",
75
+ "@wordpress/i18n": "^6.27.1-next.v.202609031004.0",
76
+ "@wordpress/icons": "^16.0.1-next.v.202609031004.0",
77
+ "@wordpress/is-shallow-equal": "^5.54.1-next.v.202609031004.0",
78
+ "@wordpress/kebab-case": "^1.1.1-next.v.202609031004.0",
79
+ "@wordpress/keycodes": "^4.54.1-next.v.202609031004.0",
80
+ "@wordpress/primitives": "^4.54.2-next.v.202609031004.0",
81
+ "@wordpress/private-apis": "^1.54.2-next.v.202609031004.0",
82
+ "@wordpress/rich-text": "^7.55.1-next.v.202609031004.0",
83
+ "@wordpress/style-runtime": "^0.10.1-next.v.202609031004.0",
84
+ "@wordpress/ui": "^0.22.1-next.v.202609031004.0",
85
+ "@wordpress/warning": "^3.54.1-next.v.202609031004.0",
86
86
  "change-case": "^4.1.2",
87
87
  "clsx": "^2.1.1",
88
88
  "colord": "^2.9.3",
@@ -111,11 +111,12 @@
111
111
  "@testing-library/user-event": "^14.6.1",
112
112
  "@types/jest": "^30.0.0",
113
113
  "@types/react-dom": "^18.3.1",
114
- "@wordpress/jest-console": "^9.2.0",
114
+ "@wordpress/jest-console": "^9.2.2-next.v.202609031004.0",
115
115
  "@wordpress/stylelint-tools": "file:../../tools/stylelint",
116
116
  "snapshot-diff": "^0.10.0",
117
117
  "storybook": "^10.5.3",
118
- "timezone-mock": "^1.3.6"
118
+ "timezone-mock": "^1.3.6",
119
+ "vitest": "^4.1.10"
119
120
  },
120
121
  "peerDependencies": {
121
122
  "@types/react": "^18 || ^19",
@@ -130,5 +131,5 @@
130
131
  "publishConfig": {
131
132
  "access": "public"
132
133
  },
133
- "gitHead": "5ef24f60261976bb198ad035db24bf81c1fb92b4"
134
+ "gitHead": "7275d6c6d93b542fca3cd98cdb9c7344ddd11e19"
134
135
  }
@@ -31,7 +31,7 @@
31
31
  border-radius: $radius-round;
32
32
  box-sizing: border-box;
33
33
  display: block;
34
- /* stylelint-disable-next-line plugin/use-logical-properties-and-values -- Geometric centering */
34
+ /* stylelint-disable-next-line logical-css/require-logical-properties -- Geometric centering */
35
35
  left: 50%;
36
36
  top: 4px;
37
37
  transform: translateX(-50%);
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it, vi } from 'vitest';
1
2
  import { getAutocompleteMatch } from '../get-autocomplete-match';
2
3
  import type { WPCompleter } from '../types';
3
4
 
@@ -174,7 +175,7 @@ describe( 'getAutocompleteMatch', () => {
174
175
  } );
175
176
 
176
177
  it( 'should pass correct before/after text to allowContext', () => {
177
- const allowContext = jest.fn().mockReturnValue( true );
178
+ const allowContext = vi.fn().mockReturnValue( true );
178
179
  const completers = [
179
180
  createCompleter( {
180
181
  triggerPrefix: '@',
@@ -19,9 +19,9 @@ const meta: Meta< typeof BaseControl > = {
19
19
  controls: { expanded: true },
20
20
  docs: { canvas: { sourceState: 'shown' } },
21
21
  componentStatus: {
22
- status: 'recommended',
22
+ status: 'not-recommended',
23
23
  whereUsed: 'global',
24
- notes: '`BaseControl.VisualLabel` can continue to be used for now. To add labels and descriptions semantically, use [`Field`](?path=/docs/design-system-components-form-primitives-field--docs) in `@wordpress/ui`.',
24
+ notes: 'Use [`Field`](?path=/docs/design-system-components-form-primitives-field--docs) from `@wordpress/ui` instead. For a purely visual label outside `Field.Root`, use `Field.VisualLabel`. For a group legend, use [`Fieldset`](?path=/docs/design-system-components-form-primitives-fieldset--docs) and `Fieldset.Legend`.',
25
25
  },
26
26
  },
27
27
  };
@@ -103,7 +103,9 @@ Provides control over whether the label will only be visible to screen readers.
103
103
 
104
104
  ### `label`: `string`
105
105
 
106
- If provided, a label will be generated using this as the content.
106
+ If provided, a label will be generated using this as the content. A visible
107
+ label is rendered in a row alongside the linked/unlinked toggle; when there is
108
+ no visible label the toggle is rendered beside the border inputs instead.
107
109
 
108
110
  _Whether it is visible only to screen readers is controlled via
109
111
  `hideLabelFromVision`._
@@ -130,9 +132,9 @@ The available base placements are 'top', 'right', 'bottom', 'left'. Each of thes
130
132
 
131
133
  - Required: No
132
134
 
133
- ### `popoverOffset`: `number`
135
+ ### `popoverOffset`: `number | { mainAxis?: number; crossAxis?: number }`
134
136
 
135
- The space between the popover and the control wrapper.
137
+ The space between the popover and the control wrapper. A number displaces the popover along its main axis; pass an object to also displace it along its cross axis.
136
138
 
137
139
  - Required: No
138
140
 
@@ -1,10 +1,11 @@
1
1
  import { __ } from '@wordpress/i18n';
2
2
  import { useMemo, useState } from '@wordpress/element';
3
- import { useMergeRefs } from '@wordpress/compose';
3
+ import { useInstanceId, useMergeRefs } from '@wordpress/compose';
4
4
  import BorderBoxControlLinkedButton from '../border-box-control-linked-button';
5
5
  import BorderBoxControlSplitControls from '../border-box-control-split-controls';
6
6
  import { BorderControl } from '../../border-control';
7
- import { StyledLabel } from '../../base-control/styles/base-control-styles';
7
+ import BaseControl from '../../base-control';
8
+ import { Grid } from '../../grid';
8
9
  import { View } from '../../view';
9
10
  import { VisuallyHidden } from '../../visually-hidden';
10
11
  import type { WordPressComponentProps } from '../../context';
@@ -16,17 +17,22 @@ import type {
16
17
  BorderControlProps,
17
18
  } from '../../border-control/types';
18
19
 
19
- const BorderLabel = ( props: LabelProps ) => {
20
- const { label, hideLabelFromVision } = props;
20
+ const BorderLabel = ( props: LabelProps & { id?: string } ) => {
21
+ const { id, label, hideLabelFromVision } = props;
21
22
 
22
23
  if ( ! label ) {
23
24
  return null;
24
25
  }
25
26
 
27
+ // The visible label is rendered as `BaseControl.VisualLabel` so it carries
28
+ // the stable `.components-base-control__label` className consumers style
29
+ // against; `StyledLabel` is an emotion component with a generated one.
26
30
  return hideLabelFromVision ? (
27
- <VisuallyHidden as="label">{ label }</VisuallyHidden>
31
+ <VisuallyHidden as="span" id={ id }>
32
+ { label }
33
+ </VisuallyHidden>
28
34
  ) : (
29
- <StyledLabel>{ label }</StyledLabel>
35
+ <BaseControl.VisualLabel id={ id }>{ label }</BaseControl.VisualLabel>
30
36
  );
31
37
  };
32
38
 
@@ -42,6 +48,8 @@ const UnconnectedBorderBoxControl = (
42
48
  enableAlpha,
43
49
  enableStyle,
44
50
  hasMixedBorders,
51
+ hasVisibleLabel,
52
+ headerClassName,
45
53
  hideLabelFromVision,
46
54
  isLinked,
47
55
  label,
@@ -55,9 +63,27 @@ const UnconnectedBorderBoxControl = (
55
63
  toggleLinked,
56
64
  wrapperClassName,
57
65
  __experimentalIsRenderedInSidebar,
66
+ 'aria-label': ariaLabel,
67
+ 'aria-labelledby': ariaLabelledBy,
58
68
  ...otherProps
59
69
  } = useBorderBoxControl( props );
60
70
 
71
+ // The label names the group of border controls rather than a single input,
72
+ // so it is associated via `aria-labelledby` instead of `htmlFor`.
73
+ const generatedLabelId = useInstanceId(
74
+ BorderBoxControl,
75
+ 'border-box-control-label'
76
+ );
77
+
78
+ // A consumer-provided accessible name takes precedence, so the generated
79
+ // relationship is only used as a fallback. Where an external name wins,
80
+ // the unused ID is left off the internal label. Empty values are treated
81
+ // as absent, matching the accessible name computation, which skips an
82
+ // empty `aria-label` or `aria-labelledby` rather than resolving a name
83
+ // from it.
84
+ const labelId =
85
+ label && ! ariaLabel && ! ariaLabelledBy ? generatedLabelId : undefined;
86
+
61
87
  // Use internal state instead of a ref to make sure that the component
62
88
  // re-renders when the popover's anchor updates.
63
89
  const [ popoverAnchor, setPopoverAnchor ] = useState< Element | null >(
@@ -80,12 +106,46 @@ const UnconnectedBorderBoxControl = (
80
106
  );
81
107
 
82
108
  const mergedRef = useMergeRefs( [ setPopoverAnchor, forwardedRef ] );
109
+
83
110
  return (
84
- <View className={ className } { ...otherProps } ref={ mergedRef }>
85
- <BorderLabel
86
- label={ label }
87
- hideLabelFromVision={ hideLabelFromVision }
88
- />
111
+ <View
112
+ className={ className }
113
+ // Whichever naming source wins, it describes the border controls
114
+ // as a whole, so the wrapper needs a role for that accessible
115
+ // name to attach to. Without a name there is no group to expose.
116
+ role={ label || ariaLabel || ariaLabelledBy ? 'group' : undefined }
117
+ aria-label={ ariaLabel }
118
+ aria-labelledby={ ariaLabelledBy ?? labelId }
119
+ { ...otherProps }
120
+ ref={ mergedRef }
121
+ >
122
+ { hasVisibleLabel ? (
123
+ // The toggle shares the label's row so that it lines up with
124
+ // the equivalent toggle on sibling controls, e.g. the border
125
+ // radius one.
126
+ <Grid
127
+ className={ headerClassName }
128
+ columns={ 2 }
129
+ templateColumns="1fr min-content"
130
+ alignment="center"
131
+ >
132
+ <BorderLabel
133
+ id={ labelId }
134
+ label={ label }
135
+ hideLabelFromVision={ hideLabelFromVision }
136
+ />
137
+ <BorderBoxControlLinkedButton
138
+ onClick={ toggleLinked }
139
+ isLinked={ isLinked }
140
+ />
141
+ </Grid>
142
+ ) : (
143
+ <BorderLabel
144
+ id={ labelId }
145
+ label={ label }
146
+ hideLabelFromVision={ hideLabelFromVision }
147
+ />
148
+ ) }
89
149
  <View className={ wrapperClassName }>
90
150
  { isLinked ? (
91
151
  <BorderControl
@@ -123,10 +183,14 @@ const UnconnectedBorderBoxControl = (
123
183
  }
124
184
  />
125
185
  ) }
126
- <BorderBoxControlLinkedButton
127
- onClick={ toggleLinked }
128
- isLinked={ isLinked }
129
- />
186
+ { /* With no label row to join, the toggle sits alongside the
187
+ inputs instead. */ }
188
+ { ! hasVisibleLabel && (
189
+ <BorderBoxControlLinkedButton
190
+ onClick={ toggleLinked }
191
+ isLinked={ isLinked }
192
+ />
193
+ ) }
130
194
  </View>
131
195
  </View>
132
196
  );
@@ -136,6 +200,10 @@ const UnconnectedBorderBoxControl = (
136
200
  * An input control for the color, style, and width of the border of a box. The
137
201
  * border can be customized as a whole, or individually for each side of the box.
138
202
  *
203
+ * The controls are exposed as a group named by the `label` prop. Passing
204
+ * `aria-labelledby` or `aria-label` names the group instead, taking precedence
205
+ * over `label`; with none of the three, the wrapper is not exposed as a group.
206
+ *
139
207
  * ```jsx
140
208
  * import { BorderBoxControl } from '@wordpress/components';
141
209
  * import { __ } from '@wordpress/i18n';
@@ -1,3 +1,4 @@
1
+ import clsx from 'clsx';
1
2
  import { useState } from '@wordpress/element';
2
3
  import styles from '../style.module.scss';
3
4
  import {
@@ -23,6 +24,8 @@ export function useBorderBoxControl(
23
24
  onChange,
24
25
  enableAlpha = false,
25
26
  enableStyle = true,
27
+ hideLabelFromVision,
28
+ label,
26
29
  value,
27
30
  __experimentalIsRenderedInSidebar = false,
28
31
  // Deprecated props, no longer used.
@@ -31,6 +34,11 @@ export function useBorderBoxControl(
31
34
  ...otherProps
32
35
  } = useContextSystem( props, 'BorderBoxControl' );
33
36
 
37
+ // A visible label gives the control a header row to place the linked/
38
+ // unlinked toggle in, alongside that label. Without one the toggle stays
39
+ // inside the input wrapper, positioned absolutely.
40
+ const hasVisibleLabel = !! label && ! hideLabelFromVision;
41
+
34
42
  const mixedBorders = hasMixedBorders( value );
35
43
  const splitBorders = hasSplitBorders( value );
36
44
 
@@ -99,13 +107,23 @@ export function useBorderBoxControl(
99
107
  }
100
108
  };
101
109
 
102
- const linkedControlClassName = styles[ 'linked-border-control' ];
110
+ // The linked control reserves an inline-end gutter for the absolutely
111
+ // positioned toggle. Once the toggle moves up into the header row that
112
+ // gutter only shortens the input, so drop it.
113
+ const linkedControlClassName = clsx( styles[ 'linked-border-control' ], {
114
+ [ styles[ 'linked-border-control-full-width' ] ]: hasVisibleLabel,
115
+ } );
103
116
  const wrapperClassName = styles.wrapper;
117
+ const headerClassName = styles.header;
104
118
 
105
119
  return {
106
120
  ...otherProps,
107
121
  className,
108
122
  colors,
123
+ hasVisibleLabel,
124
+ headerClassName,
125
+ hideLabelFromVision,
126
+ label,
109
127
  disableUnits: mixedBorders && ! hasWidthValue,
110
128
  enableAlpha,
111
129
  enableStyle,
@@ -79,3 +79,13 @@ Default.args = {
79
79
  label: 'Borders',
80
80
  enableStyle: true,
81
81
  };
82
+
83
+ /**
84
+ * With no visible label there is no label row for the linked/unlinked toggle to
85
+ * join, so it is rendered alongside the border inputs instead.
86
+ */
87
+ export const WithoutLabel = Template.bind( {} );
88
+ WithoutLabel.args = {
89
+ ...Default.args,
90
+ label: undefined,
91
+ };
@@ -1,3 +1,5 @@
1
+ @use "@wordpress/base-styles/variables" as *;
2
+
1
3
  .linked-border-control {
2
4
  /* Preserve the original `&&` specificity so this beats BorderControl's margin reset. */
3
5
  &#{&} {
@@ -6,14 +8,43 @@
6
8
  }
7
9
  }
8
10
 
11
+ /* No inline-end gutter is needed when the toggle sits in the header row. */
12
+ .linked-border-control-full-width {
13
+ &#{&} {
14
+ margin-inline-end: 0;
15
+ }
16
+ }
17
+
18
+ /* The label row the linked/unlinked toggle joins when a visible label is
19
+ rendered. Laid out as a content-driven grid like `BoxControl`'s label row, so
20
+ a label that wraps grows the row rather than overflowing a fixed height. */
21
+ .header {
22
+ /* The row is as tall as the toggle (24px, `Button` `size="small"`), so 4px
23
+ here leaves the same 28px between label and inputs as the sibling
24
+ controls, which instead pair a fixed 16px row with a 12px margin. */
25
+ margin-bottom: $grid-unit-05;
26
+
27
+ /* The label (a `BaseControl.VisualLabel`, so a `span`) supplies its own
28
+ bottom margin as the gap to the input below. In the header row that gap
29
+ comes from the row itself, and the margin would both pull the vertically
30
+ centred label off centre and pad the row out once the label wraps. */
31
+ > span {
32
+ margin-bottom: 0;
33
+ }
34
+ }
35
+
9
36
  .wrapper {
10
37
  position: relative;
38
+
39
+ /* Without a header row the toggle is positioned against the input instead. */
40
+ .linked-button {
41
+ position: absolute;
42
+ top: 8px;
43
+ inset-inline-end: 0;
44
+ }
11
45
  }
12
46
 
13
47
  .linked-button {
14
- position: absolute;
15
- top: 8px;
16
- inset-inline-end: 0;
17
48
  line-height: 0;
18
49
  }
19
50