@wordpress/components 19.15.0 → 19.16.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 (439) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/build/angle-picker-control/index.js +2 -2
  3. package/build/angle-picker-control/index.js.map +1 -1
  4. package/build/base-control/styles/base-control-styles.js +8 -8
  5. package/build/base-control/styles/base-control-styles.js.map +1 -1
  6. package/build/border-control/border-control/component.js +38 -25
  7. package/build/border-control/border-control/component.js.map +1 -1
  8. package/build/border-control/border-control/hook.js +4 -7
  9. package/build/border-control/border-control/hook.js.map +1 -1
  10. package/build/border-control/border-control-dropdown/component.js +13 -7
  11. package/build/border-control/border-control-dropdown/component.js.map +1 -1
  12. package/build/border-control/border-control-dropdown/hook.js +0 -4
  13. package/build/border-control/border-control-dropdown/hook.js.map +1 -1
  14. package/build/border-control/styles.js +33 -56
  15. package/build/border-control/styles.js.map +1 -1
  16. package/build/box-control/axial-input-controls.js +1 -1
  17. package/build/box-control/axial-input-controls.js.map +1 -1
  18. package/build/box-control/utils.js +2 -8
  19. package/build/box-control/utils.js.map +1 -1
  20. package/build/color-palette/index.js +14 -2
  21. package/build/color-palette/index.js.map +1 -1
  22. package/build/color-picker/hex-input.js +2 -1
  23. package/build/color-picker/hex-input.js.map +1 -1
  24. package/build/color-picker/input-with-slider.js +3 -2
  25. package/build/color-picker/input-with-slider.js.map +1 -1
  26. package/build/color-picker/styles.js +8 -15
  27. package/build/color-picker/styles.js.map +1 -1
  28. package/build/combobox-control/index.js +5 -7
  29. package/build/combobox-control/index.js.map +1 -1
  30. package/build/custom-select-control/index.js +26 -8
  31. package/build/custom-select-control/index.js.map +1 -1
  32. package/build/divider/component.js +0 -1
  33. package/build/divider/component.js.map +1 -1
  34. package/build/divider/index.js.map +1 -1
  35. package/build/divider/styles.js +5 -5
  36. package/build/divider/styles.js.map +1 -1
  37. package/build/dropdown/dropdown-content-wrapper.js +60 -0
  38. package/build/dropdown/dropdown-content-wrapper.js.map +1 -0
  39. package/build/dropdown/styles.js +42 -0
  40. package/build/dropdown/styles.js.map +1 -0
  41. package/build/dropdown/types.js +6 -0
  42. package/build/dropdown/types.js.map +1 -0
  43. package/build/elevation/component.js +15 -15
  44. package/build/elevation/component.js.map +1 -1
  45. package/build/elevation/hook.js +5 -17
  46. package/build/elevation/hook.js.map +1 -1
  47. package/build/elevation/index.js.map +1 -1
  48. package/build/elevation/styles.js +1 -1
  49. package/build/elevation/styles.js.map +1 -1
  50. package/build/flex/flex/component.js +11 -17
  51. package/build/flex/flex/component.js.map +1 -1
  52. package/build/flex/flex-block/component.js +9 -3
  53. package/build/flex/flex-block/component.js.map +1 -1
  54. package/build/flex/flex-item/component.js +9 -3
  55. package/build/flex/flex-item/component.js.map +1 -1
  56. package/build/index.js +24 -0
  57. package/build/index.js.map +1 -1
  58. package/build/input-control/index.js +7 -0
  59. package/build/input-control/index.js.map +1 -1
  60. package/build/input-control/input-base.js +23 -1
  61. package/build/input-control/input-base.js.map +1 -1
  62. package/build/input-control/input-prefix-wrapper.js +54 -0
  63. package/build/input-control/input-prefix-wrapper.js.map +1 -0
  64. package/build/input-control/input-suffix-wrapper.js +54 -0
  65. package/build/input-control/input-suffix-wrapper.js.map +1 -0
  66. package/build/input-control/styles/input-control-styles.js +61 -42
  67. package/build/input-control/styles/input-control-styles.js.map +1 -1
  68. package/build/mobile/image/index.native.js +7 -4
  69. package/build/mobile/image/index.native.js.map +1 -1
  70. package/build/mobile/media-edit/index.native.js +1 -7
  71. package/build/mobile/media-edit/index.native.js.map +1 -1
  72. package/build/popover/index.js +13 -10
  73. package/build/popover/index.js.map +1 -1
  74. package/build/radio-control/index.js +1 -3
  75. package/build/radio-control/index.js.map +1 -1
  76. package/build/range-control/utils.js +1 -1
  77. package/build/range-control/utils.js.map +1 -1
  78. package/build/sandbox/index.native.js +13 -2
  79. package/build/sandbox/index.native.js.map +1 -1
  80. package/build/scroll-lock/index.js +35 -6
  81. package/build/scroll-lock/index.js.map +1 -1
  82. package/build/select-control/index.js +1 -3
  83. package/build/select-control/index.js.map +1 -1
  84. package/build/select-control/styles/select-control-styles.js +31 -11
  85. package/build/select-control/styles/select-control-styles.js.map +1 -1
  86. package/build/shortcut/index.js +4 -13
  87. package/build/shortcut/index.js.map +1 -1
  88. package/build/shortcut/types.js +6 -0
  89. package/build/shortcut/types.js.map +1 -0
  90. package/build/spacer/component.js +3 -1
  91. package/build/spacer/component.js.map +1 -1
  92. package/build/toggle-group-control/toggle-group-control/component.js +4 -1
  93. package/build/toggle-group-control/toggle-group-control/component.js.map +1 -1
  94. package/build/toggle-group-control/toggle-group-control/styles.js +20 -4
  95. package/build/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  96. package/build/toggle-group-control/toggle-group-control-option-base/styles.js +7 -9
  97. package/build/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  98. package/build/tooltip/index.js +51 -14
  99. package/build/tooltip/index.js.map +1 -1
  100. package/build/tree-select/index.js +2 -2
  101. package/build/tree-select/index.js.map +1 -1
  102. package/build/ui/context/use-context-system.js +7 -2
  103. package/build/ui/context/use-context-system.js.map +1 -1
  104. package/build/ui/utils/space.js +7 -1
  105. package/build/ui/utils/space.js.map +1 -1
  106. package/build/unit-control/styles/unit-control-styles.js +10 -26
  107. package/build/unit-control/styles/unit-control-styles.js.map +1 -1
  108. package/build-module/angle-picker-control/index.js +2 -2
  109. package/build-module/angle-picker-control/index.js.map +1 -1
  110. package/build-module/base-control/styles/base-control-styles.js +8 -8
  111. package/build-module/base-control/styles/base-control-styles.js.map +1 -1
  112. package/build-module/border-control/border-control/component.js +37 -25
  113. package/build-module/border-control/border-control/component.js.map +1 -1
  114. package/build-module/border-control/border-control/hook.js +4 -7
  115. package/build-module/border-control/border-control/hook.js.map +1 -1
  116. package/build-module/border-control/border-control-dropdown/component.js +12 -7
  117. package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
  118. package/build-module/border-control/border-control-dropdown/hook.js +0 -4
  119. package/build-module/border-control/border-control-dropdown/hook.js.map +1 -1
  120. package/build-module/border-control/styles.js +33 -49
  121. package/build-module/border-control/styles.js.map +1 -1
  122. package/build-module/box-control/axial-input-controls.js +1 -1
  123. package/build-module/box-control/axial-input-controls.js.map +1 -1
  124. package/build-module/box-control/utils.js +2 -7
  125. package/build-module/box-control/utils.js.map +1 -1
  126. package/build-module/color-palette/index.js +10 -1
  127. package/build-module/color-palette/index.js.map +1 -1
  128. package/build-module/color-picker/hex-input.js +2 -1
  129. package/build-module/color-picker/hex-input.js.map +1 -1
  130. package/build-module/color-picker/input-with-slider.js +3 -2
  131. package/build-module/color-picker/input-with-slider.js.map +1 -1
  132. package/build-module/color-picker/styles.js +9 -16
  133. package/build-module/color-picker/styles.js.map +1 -1
  134. package/build-module/combobox-control/index.js +5 -6
  135. package/build-module/combobox-control/index.js.map +1 -1
  136. package/build-module/custom-select-control/index.js +26 -10
  137. package/build-module/custom-select-control/index.js.map +1 -1
  138. package/build-module/divider/component.js +0 -1
  139. package/build-module/divider/component.js.map +1 -1
  140. package/build-module/divider/index.js.map +1 -1
  141. package/build-module/divider/styles.js +5 -5
  142. package/build-module/divider/styles.js.map +1 -1
  143. package/build-module/dropdown/dropdown-content-wrapper.js +47 -0
  144. package/build-module/dropdown/dropdown-content-wrapper.js.map +1 -0
  145. package/build-module/dropdown/styles.js +31 -0
  146. package/build-module/dropdown/styles.js.map +1 -0
  147. package/build-module/dropdown/types.js +2 -0
  148. package/build-module/dropdown/types.js.map +1 -0
  149. package/build-module/elevation/component.js +15 -15
  150. package/build-module/elevation/component.js.map +1 -1
  151. package/build-module/elevation/hook.js +5 -17
  152. package/build-module/elevation/hook.js.map +1 -1
  153. package/build-module/elevation/index.js.map +1 -1
  154. package/build-module/elevation/styles.js +1 -1
  155. package/build-module/elevation/styles.js.map +1 -1
  156. package/build-module/flex/flex/component.js +11 -17
  157. package/build-module/flex/flex/component.js.map +1 -1
  158. package/build-module/flex/flex-block/component.js +9 -3
  159. package/build-module/flex/flex-block/component.js.map +1 -1
  160. package/build-module/flex/flex-item/component.js +9 -3
  161. package/build-module/flex/flex-item/component.js.map +1 -1
  162. package/build-module/index.js +3 -0
  163. package/build-module/index.js.map +1 -1
  164. package/build-module/input-control/index.js +6 -0
  165. package/build-module/input-control/index.js.map +1 -1
  166. package/build-module/input-control/input-base.js +24 -3
  167. package/build-module/input-control/input-base.js.map +1 -1
  168. package/build-module/input-control/input-prefix-wrapper.js +41 -0
  169. package/build-module/input-control/input-prefix-wrapper.js.map +1 -0
  170. package/build-module/input-control/input-suffix-wrapper.js +41 -0
  171. package/build-module/input-control/input-suffix-wrapper.js.map +1 -0
  172. package/build-module/input-control/styles/input-control-styles.js +57 -41
  173. package/build-module/input-control/styles/input-control-styles.js.map +1 -1
  174. package/build-module/mobile/image/index.native.js +9 -6
  175. package/build-module/mobile/image/index.native.js.map +1 -1
  176. package/build-module/mobile/media-edit/index.native.js +1 -6
  177. package/build-module/mobile/media-edit/index.native.js.map +1 -1
  178. package/build-module/popover/index.js +13 -10
  179. package/build-module/popover/index.js.map +1 -1
  180. package/build-module/radio-control/index.js +1 -2
  181. package/build-module/radio-control/index.js.map +1 -1
  182. package/build-module/range-control/utils.js +1 -1
  183. package/build-module/range-control/utils.js.map +1 -1
  184. package/build-module/sandbox/index.native.js +13 -3
  185. package/build-module/sandbox/index.native.js.map +1 -1
  186. package/build-module/scroll-lock/index.js +32 -6
  187. package/build-module/scroll-lock/index.js.map +1 -1
  188. package/build-module/select-control/index.js +1 -2
  189. package/build-module/select-control/index.js.map +1 -1
  190. package/build-module/select-control/styles/select-control-styles.js +31 -11
  191. package/build-module/select-control/styles/select-control-styles.js.map +1 -1
  192. package/build-module/shortcut/index.js +4 -13
  193. package/build-module/shortcut/index.js.map +1 -1
  194. package/build-module/shortcut/types.js +2 -0
  195. package/build-module/shortcut/types.js.map +1 -0
  196. package/build-module/spacer/component.js +3 -1
  197. package/build-module/spacer/component.js.map +1 -1
  198. package/build-module/toggle-group-control/toggle-group-control/component.js +4 -1
  199. package/build-module/toggle-group-control/toggle-group-control/component.js.map +1 -1
  200. package/build-module/toggle-group-control/toggle-group-control/styles.js +15 -3
  201. package/build-module/toggle-group-control/toggle-group-control/styles.js.map +1 -1
  202. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js +6 -7
  203. package/build-module/toggle-group-control/toggle-group-control-option-base/styles.js.map +1 -1
  204. package/build-module/tooltip/index.js +53 -16
  205. package/build-module/tooltip/index.js.map +1 -1
  206. package/build-module/tree-select/index.js +3 -3
  207. package/build-module/tree-select/index.js.map +1 -1
  208. package/build-module/ui/context/use-context-system.js +7 -2
  209. package/build-module/ui/context/use-context-system.js.map +1 -1
  210. package/build-module/ui/utils/space.js +7 -1
  211. package/build-module/ui/utils/space.js.map +1 -1
  212. package/build-module/unit-control/styles/unit-control-styles.js +10 -27
  213. package/build-module/unit-control/styles/unit-control-styles.js.map +1 -1
  214. package/build-style/style-rtl.css +12 -26
  215. package/build-style/style.css +12 -24
  216. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  217. package/build-types/border-control/border-control/component.d.ts.map +1 -1
  218. package/build-types/border-control/border-control/hook.d.ts +1 -1
  219. package/build-types/border-control/border-control/hook.d.ts.map +1 -1
  220. package/build-types/border-control/border-control-dropdown/component.d.ts.map +1 -1
  221. package/build-types/border-control/border-control-dropdown/hook.d.ts +0 -1
  222. package/build-types/border-control/border-control-dropdown/hook.d.ts.map +1 -1
  223. package/build-types/border-control/stories/index.d.ts.map +1 -1
  224. package/build-types/border-control/styles.d.ts +1 -4
  225. package/build-types/border-control/styles.d.ts.map +1 -1
  226. package/build-types/card/card-divider/hook.d.ts +1 -1
  227. package/build-types/color-palette/index.d.ts +1 -0
  228. package/build-types/color-palette/index.d.ts.map +1 -1
  229. package/build-types/color-picker/hex-input.d.ts.map +1 -1
  230. package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
  231. package/build-types/color-picker/styles.d.ts.map +1 -1
  232. package/build-types/divider/component.d.ts +2 -3
  233. package/build-types/divider/component.d.ts.map +1 -1
  234. package/build-types/divider/index.d.ts +1 -1
  235. package/build-types/divider/index.d.ts.map +1 -1
  236. package/build-types/divider/styles.d.ts +6 -2
  237. package/build-types/divider/styles.d.ts.map +1 -1
  238. package/build-types/divider/test/index.d.ts +2 -0
  239. package/build-types/divider/test/index.d.ts.map +1 -0
  240. package/build-types/divider/types.d.ts +18 -10
  241. package/build-types/divider/types.d.ts.map +1 -1
  242. package/build-types/dropdown/dropdown-content-wrapper.d.ts +23 -0
  243. package/build-types/dropdown/dropdown-content-wrapper.d.ts.map +1 -0
  244. package/build-types/dropdown/styles.d.ts +7 -0
  245. package/build-types/dropdown/styles.d.ts.map +1 -0
  246. package/build-types/dropdown/types.d.ts +9 -0
  247. package/build-types/dropdown/types.d.ts.map +1 -0
  248. package/build-types/elevation/component.d.ts +11 -10
  249. package/build-types/elevation/component.d.ts.map +1 -1
  250. package/build-types/elevation/hook.d.ts +6 -7
  251. package/build-types/elevation/hook.d.ts.map +1 -1
  252. package/build-types/elevation/index.d.ts +2 -2
  253. package/build-types/elevation/index.d.ts.map +1 -1
  254. package/build-types/elevation/stories/index.d.ts +22 -0
  255. package/build-types/elevation/stories/index.d.ts.map +1 -0
  256. package/build-types/elevation/styles.d.ts +1 -1
  257. package/build-types/elevation/styles.d.ts.map +1 -1
  258. package/build-types/elevation/test/index.d.ts +2 -0
  259. package/build-types/elevation/test/index.d.ts.map +1 -0
  260. package/build-types/elevation/types.d.ts +12 -19
  261. package/build-types/elevation/types.d.ts.map +1 -1
  262. package/build-types/flex/flex/component.d.ts +11 -17
  263. package/build-types/flex/flex/component.d.ts.map +1 -1
  264. package/build-types/flex/flex-block/component.d.ts +9 -3
  265. package/build-types/flex/flex-block/component.d.ts.map +1 -1
  266. package/build-types/flex/flex-item/component.d.ts +9 -3
  267. package/build-types/flex/flex-item/component.d.ts.map +1 -1
  268. package/build-types/flex/types.d.ts +4 -1
  269. package/build-types/flex/types.d.ts.map +1 -1
  270. package/build-types/input-control/index.d.ts +1 -1
  271. package/build-types/input-control/index.d.ts.map +1 -1
  272. package/build-types/input-control/input-base.d.ts +1 -1
  273. package/build-types/input-control/input-base.d.ts.map +1 -1
  274. package/build-types/input-control/input-prefix-wrapper.d.ts +19 -0
  275. package/build-types/input-control/input-prefix-wrapper.d.ts.map +1 -0
  276. package/build-types/input-control/input-suffix-wrapper.d.ts +19 -0
  277. package/build-types/input-control/input-suffix-wrapper.d.ts.map +1 -0
  278. package/build-types/input-control/stories/index.d.ts +10 -0
  279. package/build-types/input-control/stories/index.d.ts.map +1 -1
  280. package/build-types/input-control/styles/input-control-styles.d.ts +21 -0
  281. package/build-types/input-control/styles/input-control-styles.d.ts.map +1 -1
  282. package/build-types/input-control/types.d.ts +45 -3
  283. package/build-types/input-control/types.d.ts.map +1 -1
  284. package/build-types/popover/index.d.ts.map +1 -1
  285. package/build-types/radio-control/index.d.ts.map +1 -1
  286. package/build-types/range-control/types.d.ts +4 -2
  287. package/build-types/range-control/types.d.ts.map +1 -1
  288. package/build-types/range-control/utils.d.ts.map +1 -1
  289. package/build-types/scroll-lock/index.d.ts +32 -3
  290. package/build-types/scroll-lock/index.d.ts.map +1 -1
  291. package/build-types/scroll-lock/stories/index.d.ts +9 -0
  292. package/build-types/scroll-lock/stories/index.d.ts.map +1 -0
  293. package/build-types/scroll-lock/test/index.d.ts +2 -0
  294. package/build-types/scroll-lock/test/index.d.ts.map +1 -0
  295. package/build-types/select-control/index.d.ts.map +1 -1
  296. package/build-types/select-control/styles/select-control-styles.d.ts +1 -1
  297. package/build-types/select-control/styles/select-control-styles.d.ts.map +1 -1
  298. package/build-types/select-control/types.d.ts +1 -1
  299. package/build-types/select-control/types.d.ts.map +1 -1
  300. package/build-types/shortcut/index.d.ts +5 -24
  301. package/build-types/shortcut/index.d.ts.map +1 -1
  302. package/build-types/shortcut/test/index.d.ts +2 -0
  303. package/build-types/shortcut/test/index.d.ts.map +1 -0
  304. package/build-types/shortcut/types.d.ts +14 -0
  305. package/build-types/shortcut/types.d.ts.map +1 -0
  306. package/build-types/spacer/component.d.ts +3 -1
  307. package/build-types/spacer/component.d.ts.map +1 -1
  308. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts +5 -1
  309. package/build-types/toggle-group-control/toggle-group-control/styles.d.ts.map +1 -1
  310. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts +0 -1
  311. package/build-types/toggle-group-control/toggle-group-control-option-base/styles.d.ts.map +1 -1
  312. package/build-types/toggle-group-control/types.d.ts +6 -0
  313. package/build-types/toggle-group-control/types.d.ts.map +1 -1
  314. package/build-types/tooltip/index.d.ts.map +1 -1
  315. package/build-types/tree-select/index.d.ts.map +1 -1
  316. package/build-types/tree-select/types.d.ts +1 -0
  317. package/build-types/tree-select/types.d.ts.map +1 -1
  318. package/build-types/ui/context/use-context-system.d.ts.map +1 -1
  319. package/build-types/ui/utils/space.d.ts +7 -1
  320. package/build-types/ui/utils/space.d.ts.map +1 -1
  321. package/build-types/unit-control/index.d.ts +2 -2
  322. package/build-types/unit-control/index.d.ts.map +1 -1
  323. package/build-types/unit-control/styles/unit-control-styles.d.ts +0 -1
  324. package/build-types/unit-control/styles/unit-control-styles.d.ts.map +1 -1
  325. package/build-types/unit-control/types.d.ts +1 -1
  326. package/build-types/unit-control/types.d.ts.map +1 -1
  327. package/package.json +17 -17
  328. package/src/angle-picker-control/index.js +1 -2
  329. package/src/base-control/styles/base-control-styles.ts +5 -0
  330. package/src/border-control/border-control/component.tsx +41 -32
  331. package/src/border-control/border-control/hook.ts +4 -9
  332. package/src/border-control/border-control-dropdown/component.tsx +50 -45
  333. package/src/border-control/border-control-dropdown/hook.ts +0 -5
  334. package/src/border-control/stories/index.tsx +3 -0
  335. package/src/border-control/styles.ts +23 -69
  336. package/src/border-control/test/index.js +19 -8
  337. package/src/box-control/axial-input-controls.js +1 -1
  338. package/src/box-control/utils.js +6 -13
  339. package/src/card/test/__snapshots__/index.js.snap +8 -8
  340. package/src/color-palette/index.js +19 -8
  341. package/src/color-palette/style.scss +5 -0
  342. package/src/color-palette/test/utils.ts +19 -1
  343. package/src/color-picker/hex-input.tsx +2 -1
  344. package/src/color-picker/input-with-slider.tsx +2 -1
  345. package/src/color-picker/styles.ts +0 -11
  346. package/src/combobox-control/index.js +5 -6
  347. package/src/confirm-dialog/README.md +1 -1
  348. package/src/custom-select-control/index.js +44 -26
  349. package/src/custom-select-control/stories/index.js +7 -2
  350. package/src/custom-select-control/style.scss +4 -29
  351. package/src/divider/README.md +12 -5
  352. package/src/divider/component.tsx +2 -3
  353. package/src/divider/index.ts +1 -1
  354. package/src/divider/stories/index.tsx +4 -4
  355. package/src/divider/styles.ts +7 -7
  356. package/src/divider/test/__snapshots__/{index.js.snap → index.tsx.snap} +7 -7
  357. package/src/divider/test/index.tsx +40 -0
  358. package/src/divider/types.ts +21 -15
  359. package/src/draggable/README.md +1 -1
  360. package/src/dropdown/dropdown-content-wrapper.tsx +59 -0
  361. package/src/dropdown/stories/index.js +60 -69
  362. package/src/dropdown/styles.ts +38 -0
  363. package/src/dropdown/types.ts +8 -0
  364. package/src/elevation/README.md +16 -14
  365. package/src/elevation/component.tsx +48 -0
  366. package/src/elevation/{hook.js → hook.ts} +20 -17
  367. package/src/elevation/{index.js → index.ts} +0 -0
  368. package/src/elevation/stories/index.tsx +85 -0
  369. package/src/elevation/{styles.js → styles.ts} +0 -0
  370. package/src/elevation/test/__snapshots__/{index.js.snap → index.tsx.snap} +19 -13
  371. package/src/elevation/test/index.tsx +64 -0
  372. package/src/elevation/types.ts +12 -19
  373. package/src/flex/flex/README.md +1 -5
  374. package/src/flex/flex/component.js +11 -17
  375. package/src/flex/flex-block/README.md +0 -4
  376. package/src/flex/flex-block/component.js +9 -3
  377. package/src/flex/flex-item/README.md +0 -4
  378. package/src/flex/flex-item/component.js +9 -3
  379. package/src/flex/stories/index.js +1 -1
  380. package/src/flex/types.ts +4 -1
  381. package/src/form-token-field/test/index.js +1 -1
  382. package/src/index.js +3 -0
  383. package/src/input-control/index.tsx +6 -0
  384. package/src/input-control/input-base.tsx +28 -12
  385. package/src/input-control/input-prefix-wrapper.tsx +48 -0
  386. package/src/input-control/input-suffix-wrapper.tsx +48 -0
  387. package/src/input-control/stories/index.tsx +15 -2
  388. package/src/input-control/styles/input-control-styles.tsx +25 -11
  389. package/src/input-control/types.ts +52 -3
  390. package/src/mobile/image/index.native.js +12 -7
  391. package/src/mobile/media-edit/index.native.js +2 -7
  392. package/src/modal/style.scss +5 -1
  393. package/src/popover/index.js +13 -9
  394. package/src/popover/stories/index.js +2 -0
  395. package/src/popover/style.scss +1 -1
  396. package/src/radio-control/index.tsx +1 -2
  397. package/src/range-control/README.md +1 -1
  398. package/src/range-control/test/index.tsx +30 -0
  399. package/src/range-control/types.ts +4 -2
  400. package/src/range-control/utils.ts +4 -1
  401. package/src/sandbox/index.native.js +14 -1
  402. package/src/scroll-lock/README.md +1 -1
  403. package/src/scroll-lock/{index.js → index.tsx} +34 -7
  404. package/src/scroll-lock/stories/index.tsx +96 -0
  405. package/src/scroll-lock/test/index.tsx +26 -0
  406. package/src/select-control/index.tsx +1 -2
  407. package/src/select-control/styles/select-control-styles.ts +33 -9
  408. package/src/select-control/types.ts +1 -0
  409. package/src/shortcut/{index.js → index.tsx} +5 -9
  410. package/src/shortcut/test/__snapshots__/index.tsx.snap +15 -0
  411. package/src/shortcut/test/index.tsx +41 -0
  412. package/src/shortcut/types.ts +10 -0
  413. package/src/spacer/component.tsx +3 -1
  414. package/src/toggle-group-control/stories/index.js +19 -3
  415. package/src/toggle-group-control/test/__snapshots__/index.js.snap +4 -4
  416. package/src/toggle-group-control/toggle-group-control/component.tsx +3 -3
  417. package/src/toggle-group-control/toggle-group-control/styles.ts +22 -2
  418. package/src/toggle-group-control/toggle-group-control-option-base/styles.ts +0 -4
  419. package/src/toggle-group-control/types.ts +6 -0
  420. package/src/tools-panel/tools-panel/README.md +94 -21
  421. package/src/tooltip/index.js +56 -10
  422. package/src/tooltip/stories/index.js +28 -13
  423. package/src/tooltip/style.scss +1 -1
  424. package/src/tree-select/index.tsx +5 -4
  425. package/src/tree-select/types.ts +4 -0
  426. package/src/ui/context/test/context-system-provider.js +101 -1
  427. package/src/ui/context/use-context-system.js +7 -2
  428. package/src/ui/utils/space.ts +7 -1
  429. package/src/unit-control/styles/unit-control-styles.ts +15 -13
  430. package/src/unit-control/test/__snapshots__/index.tsx.snap +4 -4
  431. package/src/unit-control/types.ts +1 -1
  432. package/tsconfig.tsbuildinfo +1 -1
  433. package/src/divider/test/index.js +0 -41
  434. package/src/elevation/component.js +0 -43
  435. package/src/elevation/stories/index.js +0 -148
  436. package/src/elevation/test/index.js +0 -51
  437. package/src/scroll-lock/stories/index.js +0 -71
  438. package/src/scroll-lock/test/index.js +0 -53
  439. package/src/shortcut/test/index.js +0 -37
@@ -10,7 +10,7 @@ exports[`props should render active 1`] = `
10
10
  will-change: box-shadow;
11
11
  border-radius: inherit;
12
12
  bottom: 0;
13
- box-shadow: 0 7px 14px 0 rgba(0 ,0, 0, 0.35);
13
+ box-shadow: 0 7px 14px 0 rgba(0, 0, 0, 0.35);
14
14
  opacity: 1;
15
15
  left: 0;
16
16
  right: 0;
@@ -26,16 +26,17 @@ exports[`props should render active 1`] = `
26
26
  }
27
27
 
28
28
  *:hover>.emotion-0 {
29
- box-shadow: 0 14px 28px 0 rgba(0 ,0, 0, 0.7);
29
+ box-shadow: 0 14px 28px 0 rgba(0, 0, 0, 0.7);
30
30
  }
31
31
 
32
32
  *:active>.emotion-0 {
33
- box-shadow: 0 5px 10px 0 rgba(0 ,0, 0, 0.25);
33
+ box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.25);
34
34
  }
35
35
 
36
36
  <div
37
37
  aria-hidden="true"
38
38
  class="components-elevation emotion-0 emotion-1"
39
+ data-testid="elevation"
39
40
  data-wp-c16t="true"
40
41
  data-wp-component="Elevation"
41
42
  />
@@ -51,7 +52,7 @@ exports[`props should render correctly 1`] = `
51
52
  will-change: box-shadow;
52
53
  border-radius: inherit;
53
54
  bottom: 0;
54
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
55
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
55
56
  opacity: 1;
56
57
  left: 0;
57
58
  right: 0;
@@ -69,6 +70,7 @@ exports[`props should render correctly 1`] = `
69
70
  <div
70
71
  aria-hidden="true"
71
72
  class="components-elevation emotion-0 emotion-1"
73
+ data-testid="elevation"
72
74
  data-wp-c16t="true"
73
75
  data-wp-component="Elevation"
74
76
  />
@@ -84,7 +86,7 @@ exports[`props should render hover 1`] = `
84
86
  will-change: box-shadow;
85
87
  border-radius: inherit;
86
88
  bottom: 0;
87
- box-shadow: 0 7px 14px 0 rgba(0 ,0, 0, 0.35);
89
+ box-shadow: 0 7px 14px 0 rgba(0, 0, 0, 0.35);
88
90
  opacity: 1;
89
91
  left: 0;
90
92
  right: 0;
@@ -100,12 +102,13 @@ exports[`props should render hover 1`] = `
100
102
  }
101
103
 
102
104
  *:hover>.emotion-0 {
103
- box-shadow: 0 14px 28px 0 rgba(0 ,0, 0, 0.7);
105
+ box-shadow: 0 14px 28px 0 rgba(0, 0, 0, 0.7);
104
106
  }
105
107
 
106
108
  <div
107
109
  aria-hidden="true"
108
110
  class="components-elevation emotion-0 emotion-1"
111
+ data-testid="elevation"
109
112
  data-wp-c16t="true"
110
113
  data-wp-component="Elevation"
111
114
  />
@@ -121,7 +124,7 @@ exports[`props should render isInteractive 1`] = `
121
124
  will-change: box-shadow;
122
125
  border-radius: inherit;
123
126
  bottom: 0;
124
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
127
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
125
128
  opacity: 1;
126
129
  left: 0;
127
130
  right: 0;
@@ -137,16 +140,17 @@ exports[`props should render isInteractive 1`] = `
137
140
  }
138
141
 
139
142
  *:hover>.emotion-0 {
140
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
143
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
141
144
  }
142
145
 
143
146
  *:active>.emotion-0 {
144
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
147
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
145
148
  }
146
149
 
147
150
  <div
148
151
  aria-hidden="true"
149
152
  class="components-elevation emotion-0 emotion-1"
153
+ data-testid="elevation"
150
154
  data-wp-c16t="true"
151
155
  data-wp-component="Elevation"
152
156
  />
@@ -162,7 +166,7 @@ exports[`props should render offset 1`] = `
162
166
  will-change: box-shadow;
163
167
  border-radius: inherit;
164
168
  bottom: -2px;
165
- box-shadow: 0 7px 14px 0 rgba(0 ,0, 0, 0.35);
169
+ box-shadow: 0 7px 14px 0 rgba(0, 0, 0, 0.35);
166
170
  opacity: 1;
167
171
  left: -2px;
168
172
  right: -2px;
@@ -178,16 +182,17 @@ exports[`props should render offset 1`] = `
178
182
  }
179
183
 
180
184
  *:hover>.emotion-0 {
181
- box-shadow: 0 14px 28px 0 rgba(0 ,0, 0, 0.7);
185
+ box-shadow: 0 14px 28px 0 rgba(0, 0, 0, 0.7);
182
186
  }
183
187
 
184
188
  *:active>.emotion-0 {
185
- box-shadow: 0 5px 10px 0 rgba(0 ,0, 0, 0.25);
189
+ box-shadow: 0 5px 10px 0 rgba(0, 0, 0, 0.25);
186
190
  }
187
191
 
188
192
  <div
189
193
  aria-hidden="true"
190
194
  class="components-elevation emotion-0 emotion-1"
195
+ data-testid="elevation"
191
196
  data-wp-c16t="true"
192
197
  data-wp-component="Elevation"
193
198
  />
@@ -203,7 +208,7 @@ exports[`props should render value 1`] = `
203
208
  will-change: box-shadow;
204
209
  border-radius: inherit;
205
210
  bottom: 0;
206
- box-shadow: 0 7px 14px 0 rgba(0 ,0, 0, 0.35);
211
+ box-shadow: 0 7px 14px 0 rgba(0, 0, 0, 0.35);
207
212
  opacity: 1;
208
213
  left: 0;
209
214
  right: 0;
@@ -221,6 +226,7 @@ exports[`props should render value 1`] = `
221
226
  <div
222
227
  aria-hidden="true"
223
228
  class="components-elevation emotion-0 emotion-1"
229
+ data-testid="elevation"
224
230
  data-wp-c16t="true"
225
231
  data-wp-component="Elevation"
226
232
  />
@@ -0,0 +1,64 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Elevation } from '..';
10
+
11
+ describe( 'props', () => {
12
+ test( 'should render correctly', () => {
13
+ render( <Elevation data-testid="elevation" /> );
14
+
15
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
16
+ } );
17
+
18
+ test( 'should render isInteractive', () => {
19
+ render( <Elevation isInteractive data-testid="elevation" /> );
20
+
21
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
22
+ } );
23
+
24
+ test( 'should render value', () => {
25
+ render( <Elevation value={ 7 } data-testid="elevation" /> );
26
+
27
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
28
+ } );
29
+
30
+ test( 'should render hover', () => {
31
+ render(
32
+ <Elevation hover={ 14 } value={ 7 } data-testid="elevation" />
33
+ );
34
+
35
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
36
+ } );
37
+
38
+ test( 'should render active', () => {
39
+ render(
40
+ <Elevation
41
+ active={ 5 }
42
+ hover={ 14 }
43
+ value={ 7 }
44
+ data-testid="elevation"
45
+ />
46
+ );
47
+
48
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
49
+ } );
50
+
51
+ test( 'should render offset', () => {
52
+ render(
53
+ <Elevation
54
+ active={ 5 }
55
+ hover={ 14 }
56
+ offset={ -2 }
57
+ value={ 7 }
58
+ data-testid="elevation"
59
+ />
60
+ );
61
+
62
+ expect( screen.getByTestId( 'elevation' ) ).toMatchSnapshot();
63
+ } );
64
+ } );
@@ -3,9 +3,10 @@
3
3
  */
4
4
  import type { CSSProperties } from 'react';
5
5
 
6
- export type Props = {
6
+ export type ElevationProps = {
7
7
  /**
8
- * Size of the shadow value when active (see the `value` and `isInteractive` props).
8
+ * Size of the shadow value when active (see the `value` and `isInteractive`
9
+ * props).
9
10
  */
10
11
  active?: number;
11
12
  /**
@@ -15,15 +16,18 @@ export type Props = {
15
16
  */
16
17
  borderRadius?: CSSProperties[ 'borderRadius' ];
17
18
  /**
18
- * Size of the shadow value when focused (see the `value` and `isInteractive` props).
19
+ * Size of the shadow value when focused (see the `value` and
20
+ * `isInteractive` props).
19
21
  */
20
22
  focus?: number;
21
23
  /**
22
- * Size of the shadow value when hovered (see the `value` and `isInteractive` props).
24
+ * Size of the shadow value when hovered (see the `value` and
25
+ * `isInteractive` props).
23
26
  */
24
27
  hover?: number;
25
28
  /**
26
- * Determines if hover, active, and focus shadow values should be automatically calculated and rendered.
29
+ * Determines if `hover`, `active`, and `focus` shadow values should be
30
+ * automatically calculated and rendered.
27
31
  *
28
32
  * @default false
29
33
  */
@@ -35,20 +39,9 @@ export type Props = {
35
39
  */
36
40
  offset?: number;
37
41
  /**
38
- * Size of the shadow, based on the Style system's elevation system. The `value` determines the strength of the shadow, which sense of depth.
39
- * In the example below, `isInteractive` is activated to give a better sense of depth.
40
- *
41
- * @example
42
- * ```jsx
43
- * import { __experimentalElevation as Elevation } from '@wordpress/components';
44
- * * function Example() {
45
- * return (
46
- * <div>
47
- * <Elevation isInteractive value={ 200 } />
48
- * </div>
49
- * );
50
- * }
51
- * ```
42
+ * Size of the shadow, based on the Style system's elevation system. The
43
+ * `value` determines the strength of the shadow, which creates the sense of
44
+ * depth.
52
45
  *
53
46
  * @default 0
54
47
  */
@@ -7,11 +7,7 @@
7
7
  `Flex` is used with any of it's two sub-components, `FlexItem` and `FlexBlock`.
8
8
 
9
9
  ```jsx
10
- import {
11
- Flex,
12
- FlexBlock,
13
- FlexItem,
14
- } from '@wordpress/components';
10
+ import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
15
11
 
16
12
  function Example() {
17
13
  return (
@@ -33,27 +33,21 @@ function Flex( props, forwardedRef ) {
33
33
  *
34
34
  * @example
35
35
  * ```jsx
36
- * import {
37
- * __experimentalFlex as Flex,
38
- * __experimentalFlexBlock as FlexBlock,
39
- * __experimentalFlexItem as FlexItem,
40
- * __experimentalText as Text
41
- * } from `@wordpress/components`;
36
+ * import { Flex, FlexBlock, FlexItem } from '@wordpress/components';
42
37
  *
43
38
  * function Example() {
44
- * return (
45
- * <Flex>
46
- * <FlexItem>
47
- * <Text>Code</Text>
48
- * </FlexItem>
49
- * <FlexBlock>
50
- * <Text>Poetry</Text>
51
- * </FlexBlock>
52
- * </Flex>
53
- * );
39
+ * return (
40
+ * <Flex>
41
+ * <FlexItem>
42
+ * <p>Code</p>
43
+ * </FlexItem>
44
+ * <FlexBlock>
45
+ * <p>Poetry</p>
46
+ * </FlexBlock>
47
+ * </Flex>
48
+ * );
54
49
  * }
55
50
  * ```
56
- *
57
51
  */
58
52
  const ConnectedFlex = contextConnect( Flex, 'Flex' );
59
53
 
@@ -1,9 +1,5 @@
1
1
  # FlexBlock
2
2
 
3
- <div class="callout callout-alert">
4
- This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
5
- </div>
6
-
7
3
  A layout component to contain items of a fixed width within `Flex`.
8
4
 
9
5
  ## Usage
@@ -20,9 +20,15 @@ function FlexBlock( props, forwardedRef ) {
20
20
  *
21
21
  * @example
22
22
  * ```jsx
23
- * <Flex>
24
- * <FlexBlock>...</FlexBlock>
25
- * </Flex>
23
+ * import { Flex, FlexBlock } from '@wordpress/components';
24
+ *
25
+ * function Example() {
26
+ * return (
27
+ * <Flex>
28
+ * <FlexBlock>...</FlexBlock>
29
+ * </Flex>
30
+ * );
31
+ * }
26
32
  * ```
27
33
  */
28
34
  const ConnectedFlexBlock = contextConnect( FlexBlock, 'FlexBlock' );
@@ -1,9 +1,5 @@
1
1
  # FlexItem
2
2
 
3
- <div class="callout callout-alert">
4
- This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
5
- </div>
6
-
7
3
  A layout component to contain items of a fixed width within `Flex`.
8
4
 
9
5
  ## Usage
@@ -20,9 +20,15 @@ function FlexItem( props, forwardedRef ) {
20
20
  *
21
21
  * @example
22
22
  * ```jsx
23
- * <Flex>
24
- * <FlexItem>...</FlexItem>
25
- * </Flex>
23
+ * import { Flex, FlexItem } from '@wordpress/components';
24
+ *
25
+ * function Example() {
26
+ * return (
27
+ * <Flex>
28
+ * <FlexItem>...</FlexItem>
29
+ * </Flex>
30
+ * );
31
+ * }
26
32
  * ```
27
33
  */
28
34
  const ConnectedFlexItem = contextConnect( FlexItem, 'FlexItem' );
@@ -6,7 +6,7 @@ import { View } from '../../view';
6
6
 
7
7
  export default {
8
8
  component: Flex,
9
- title: 'Components (Experimental)/Flex',
9
+ title: 'Components/Flex',
10
10
  };
11
11
 
12
12
  export const _default = () => {
package/src/flex/types.ts CHANGED
@@ -35,7 +35,10 @@ export type FlexProps = {
35
35
  */
36
36
  expanded?: boolean;
37
37
  /**
38
- * Spacing in between each child can be adjusted by using `gap`. The value of `gap` works as a multiplier to the library's grid system (base of `4px`).
38
+ * Spacing in between each child can be adjusted by using `gap`.
39
+ *
40
+ * Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
41
+ * or a literal CSS value string.
39
42
  *
40
43
  * @default 2
41
44
  */
@@ -162,7 +162,7 @@ describe( 'FormTokenField', () => {
162
162
  );
163
163
  } );
164
164
 
165
- it( 'should show suggestions when when input is empty if expandOnFocus is set to true', () => {
165
+ it( 'should show suggestions when input is empty if expandOnFocus is set to true', () => {
166
166
  setUp( { __experimentalExpandOnFocus: true } );
167
167
  wrapper.setState( {
168
168
  isExpanded: true,
package/src/index.js CHANGED
@@ -66,6 +66,7 @@ export { default as Draggable } from './draggable';
66
66
  export { default as DropZone } from './drop-zone';
67
67
  export { default as DropZoneProvider } from './drop-zone/provider';
68
68
  export { default as Dropdown } from './dropdown';
69
+ export { default as __experimentalDropdownContentWrapper } from './dropdown/dropdown-content-wrapper';
69
70
  export { default as DropdownMenu } from './dropdown-menu';
70
71
  export { DuotoneSwatch, DuotonePicker } from './duotone-picker';
71
72
  export { Elevation as __experimentalElevation } from './elevation';
@@ -91,6 +92,8 @@ export {
91
92
  Item as __experimentalItem,
92
93
  } from './item-group';
93
94
  export { default as __experimentalInputControl } from './input-control';
95
+ export { default as __experimentalInputControlPrefixWrapper } from './input-control/input-prefix-wrapper';
96
+ export { default as __experimentalInputControlSuffixWrapper } from './input-control/input-suffix-wrapper';
94
97
  export { default as KeyboardShortcuts } from './keyboard-shortcuts';
95
98
  export { default as MenuGroup } from './menu-group';
96
99
  export { default as MenuItem } from './menu-item';
@@ -16,6 +16,7 @@ import { useState, forwardRef } from '@wordpress/element';
16
16
  import InputBase from './input-base';
17
17
  import InputField from './input-field';
18
18
  import type { InputControlProps } from './types';
19
+ import { space } from '../ui/utils/space';
19
20
  import { useDraft } from './utils';
20
21
 
21
22
  const noop = () => {};
@@ -29,6 +30,7 @@ function useUniqueId( idProp?: string ) {
29
30
 
30
31
  export function UnforwardedInputControl(
31
32
  {
33
+ __next36pxDefaultSize,
32
34
  __unstableStateReducer: stateReducer = ( state ) => state,
33
35
  __unstableInputWidth,
34
36
  className,
@@ -62,6 +64,7 @@ export function UnforwardedInputControl(
62
64
 
63
65
  return (
64
66
  <InputBase
67
+ __next36pxDefaultSize={ __next36pxDefaultSize }
65
68
  __unstableInputWidth={ __unstableInputWidth }
66
69
  className={ classes }
67
70
  disabled={ disabled }
@@ -78,6 +81,7 @@ export function UnforwardedInputControl(
78
81
  >
79
82
  <InputField
80
83
  { ...props }
84
+ __next36pxDefaultSize={ __next36pxDefaultSize }
81
85
  className="components-input-control__input"
82
86
  disabled={ disabled }
83
87
  id={ id }
@@ -85,6 +89,8 @@ export function UnforwardedInputControl(
85
89
  isPressEnterToChange={ isPressEnterToChange }
86
90
  onKeyDown={ onKeyDown }
87
91
  onValidate={ onValidate }
92
+ paddingInlineStart={ prefix ? space( 2 ) : undefined }
93
+ paddingInlineEnd={ suffix ? space( 2 ) : undefined }
88
94
  ref={ ref }
89
95
  setIsFocused={ setIsFocused }
90
96
  size={ size }
@@ -7,7 +7,7 @@ import type { ForwardedRef } from 'react';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useInstanceId } from '@wordpress/compose';
10
- import { forwardRef } from '@wordpress/element';
10
+ import { forwardRef, useMemo } from '@wordpress/element';
11
11
 
12
12
  /**
13
13
  * Internal dependencies
@@ -20,8 +20,10 @@ import {
20
20
  Prefix,
21
21
  Suffix,
22
22
  LabelWrapper,
23
+ getSizeConfig,
23
24
  } from './styles/input-control-styles';
24
25
  import type { InputBaseProps, LabelPosition } from './types';
26
+ import { ContextSystemProvider } from '../ui/context';
25
27
 
26
28
  function useUniqueId( idProp?: string ) {
27
29
  const instanceId = useInstanceId( InputBase );
@@ -52,6 +54,7 @@ function getUIFlexProps( labelPosition?: LabelPosition ) {
52
54
 
53
55
  export function InputBase(
54
56
  {
57
+ __next36pxDefaultSize,
55
58
  __unstableInputWidth,
56
59
  children,
57
60
  className,
@@ -71,6 +74,17 @@ export function InputBase(
71
74
  const id = useUniqueId( idProp );
72
75
  const hideLabel = hideLabelFromVision || ! label;
73
76
 
77
+ const { paddingLeft, paddingRight } = getSizeConfig( {
78
+ inputSize: size,
79
+ __next36pxDefaultSize,
80
+ } );
81
+ const prefixSuffixContextValue = useMemo( () => {
82
+ return {
83
+ InputControlPrefixWrapper: { paddingLeft },
84
+ InputControlSuffixWrapper: { paddingRight },
85
+ };
86
+ }, [ paddingLeft, paddingRight ] );
87
+
74
88
  return (
75
89
  // @ts-expect-error The `direction` prop from Flex (FlexDirection) conflicts with legacy SVGAttributes `direction` (string) that come from React intrinsic prop definitions.
76
90
  <Root
@@ -99,17 +113,19 @@ export function InputBase(
99
113
  hideLabel={ hideLabel }
100
114
  labelPosition={ labelPosition }
101
115
  >
102
- { prefix && (
103
- <Prefix className="components-input-control__prefix">
104
- { prefix }
105
- </Prefix>
106
- ) }
107
- { children }
108
- { suffix && (
109
- <Suffix className="components-input-control__suffix">
110
- { suffix }
111
- </Suffix>
112
- ) }
116
+ <ContextSystemProvider value={ prefixSuffixContextValue }>
117
+ { prefix && (
118
+ <Prefix className="components-input-control__prefix">
119
+ { prefix }
120
+ </Prefix>
121
+ ) }
122
+ { children }
123
+ { suffix && (
124
+ <Suffix className="components-input-control__suffix">
125
+ { suffix }
126
+ </Suffix>
127
+ ) }
128
+ </ContextSystemProvider>
113
129
  <Backdrop disabled={ disabled } isFocused={ isFocused } />
114
130
  </Container>
115
131
  </Root>
@@ -0,0 +1,48 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Spacer } from '../spacer';
10
+ import {
11
+ WordPressComponentProps,
12
+ contextConnect,
13
+ useContextSystem,
14
+ } from '../ui/context';
15
+ import type { InputControlPrefixWrapperProps } from './types';
16
+
17
+ function UnconnectedInputControlPrefixWrapper(
18
+ props: WordPressComponentProps< InputControlPrefixWrapperProps, 'div' >,
19
+ forwardedRef: ForwardedRef< any >
20
+ ) {
21
+ const derivedProps = useContextSystem( props, 'InputControlPrefixWrapper' );
22
+
23
+ return (
24
+ <Spacer marginBottom={ 0 } { ...derivedProps } ref={ forwardedRef } />
25
+ );
26
+ }
27
+
28
+ /**
29
+ * A convenience wrapper for the `prefix` when you want to apply
30
+ * standard padding in accordance with the size variant.
31
+ *
32
+ * ```jsx
33
+ * import {
34
+ * __experimentalInputControl as InputControl,
35
+ * __experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
36
+ * } from '@wordpress/components';
37
+ *
38
+ * <InputControl
39
+ * prefix={<InputControlPrefixWrapper>@</InputControlPrefixWrapper>}
40
+ * />
41
+ * ```
42
+ */
43
+ export const InputControlPrefixWrapper = contextConnect(
44
+ UnconnectedInputControlPrefixWrapper,
45
+ 'InputControlPrefixWrapper'
46
+ );
47
+
48
+ export default InputControlPrefixWrapper;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Spacer } from '../spacer';
10
+ import {
11
+ WordPressComponentProps,
12
+ contextConnect,
13
+ useContextSystem,
14
+ } from '../ui/context';
15
+ import type { InputControlSuffixWrapperProps } from './types';
16
+
17
+ function UnconnectedInputControlSuffixWrapper(
18
+ props: WordPressComponentProps< InputControlSuffixWrapperProps, 'div' >,
19
+ forwardedRef: ForwardedRef< any >
20
+ ) {
21
+ const derivedProps = useContextSystem( props, 'InputControlSuffixWrapper' );
22
+
23
+ return (
24
+ <Spacer marginBottom={ 0 } { ...derivedProps } ref={ forwardedRef } />
25
+ );
26
+ }
27
+
28
+ /**
29
+ * A convenience wrapper for the `suffix` when you want to apply
30
+ * standard padding in accordance with the size variant.
31
+ *
32
+ * ```jsx
33
+ * import {
34
+ * __experimentalInputControl as InputControl,
35
+ * __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
36
+ * } from '@wordpress/components';
37
+ *
38
+ * <InputControl
39
+ * suffix={<InputControlSuffixWrapper>%</InputControlSuffixWrapper>}
40
+ * />
41
+ * ```
42
+ */
43
+ export const InputControlSuffixWrapper = contextConnect(
44
+ UnconnectedInputControlSuffixWrapper,
45
+ 'InputControlSuffixWrapper'
46
+ );
47
+
48
+ export default InputControlSuffixWrapper;