@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
@@ -9,31 +9,37 @@ import type { SeparatorProps } from 'reakit';
9
9
  */
10
10
  import type { SpaceInput } from '../ui/utils/space';
11
11
 
12
- export interface OwnProps {
12
+ export type DividerProps = Omit<
13
+ SeparatorProps,
14
+ 'children' | 'unstable_system' | 'orientation'
15
+ > & {
13
16
  /**
14
17
  * Adjusts all margins on the inline dimension.
18
+ *
19
+ * Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
20
+ * or a literal CSS value string.
15
21
  */
16
22
  margin?: SpaceInput;
17
- /**
18
- * Adjusts the inline-start margin.
19
- */
20
- marginStart?: SpaceInput;
21
23
  /**
22
24
  * Adjusts the inline-end margin.
25
+ *
26
+ * Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
27
+ * or a literal CSS value string.
23
28
  */
24
29
  marginEnd?: SpaceInput;
25
30
  /**
26
- * Divider's orientation. When using inside a flex container, you may need to make sure the divider is `stretch` aligned
27
- * in order for it to be visible.
31
+ * Adjusts the inline-start margin.
32
+ *
33
+ * Can either be a number (which will act as a multiplier to the library's grid system base of 4px),
34
+ * or a literal CSS value string.
35
+ */
36
+ marginStart?: SpaceInput;
37
+ /**
38
+ * Divider's orientation. When using inside a flex container, you may need
39
+ * to make sure the divider is `stretch` aligned in order for it to be
40
+ * visible.
28
41
  *
29
42
  * @default 'horizontal'
30
43
  */
31
44
  orientation?: SeparatorProps[ 'orientation' ];
32
- }
33
-
34
- export interface Props
35
- extends Omit<
36
- SeparatorProps,
37
- 'children' | 'unstable_system' | 'orientation'
38
- >,
39
- OwnProps {}
45
+ };
@@ -1,6 +1,6 @@
1
1
  # Draggable
2
2
 
3
- `Draggable` is a Component that provides a way to set up a a cross-browser (including IE) customisable drag image and the transfer data for the drag event. It decouples the drag handle and the element to drag: use it by wrapping the component that will become the drag handle and providing the DOM ID of the element to drag.
3
+ `Draggable` is a Component that provides a way to set up a cross-browser (including IE) customisable drag image and the transfer data for the drag event. It decouples the drag handle and the element to drag: use it by wrapping the component that will become the drag handle and providing the DOM ID of the element to drag.
4
4
 
5
5
  Note that the drag handle needs to declare the `draggable="true"` property and bind the `Draggable`s `onDraggableStart` and `onDraggableEnd` event handlers to its own `onDragStart` and `onDragEnd` respectively. `Draggable` takes care of the logic to setup the drag image and the transfer data, but is not concerned with creating an actual DOM element that is draggable.
6
6
 
@@ -0,0 +1,59 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import {
10
+ WordPressComponentProps,
11
+ contextConnect,
12
+ useContextSystem,
13
+ } from '../ui/context';
14
+ import { DropdownContentWrapperDiv } from './styles';
15
+ import type { DropdownContentWrapperProps } from './types';
16
+
17
+ function UnconnectedDropdownContentWrapper(
18
+ props: WordPressComponentProps< DropdownContentWrapperProps, 'div', false >,
19
+ forwardedRef: ForwardedRef< any >
20
+ ) {
21
+ const { paddingSize = 'small', ...derivedProps } = useContextSystem(
22
+ props,
23
+ 'DropdownContentWrapper'
24
+ );
25
+
26
+ return (
27
+ <DropdownContentWrapperDiv
28
+ { ...derivedProps }
29
+ paddingSize={ paddingSize }
30
+ ref={ forwardedRef }
31
+ />
32
+ );
33
+ }
34
+
35
+ /**
36
+ * A convenience wrapper for the `renderContent` when you want to apply
37
+ * different padding. (Default is `paddingSize="small"`).
38
+ *
39
+ * ```jsx
40
+ * import {
41
+ * Dropdown,
42
+ * __experimentalDropdownContentWrapper as DropdownContentWrapper,
43
+ * } from '@wordpress/components';
44
+ *
45
+ * <Dropdown
46
+ * renderContent={ () => (
47
+ * <DropdownContentWrapper paddingSize="medium">
48
+ * My dropdown content
49
+ * </DropdownContentWrapper>
50
+ * ) }
51
+ * />
52
+ * ```
53
+ */
54
+ export const DropdownContentWrapper = contextConnect(
55
+ UnconnectedDropdownContentWrapper,
56
+ 'DropdownContentWrapper'
57
+ );
58
+
59
+ export default DropdownContentWrapper;
@@ -1,81 +1,72 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- more,
6
- arrowLeft,
7
- arrowRight,
8
- arrowUp,
9
- arrowDown,
10
- } from '@wordpress/icons';
11
-
12
1
  /**
13
2
  * Internal dependencies
14
3
  */
15
4
  import Dropdown from '../';
16
5
  import Button from '../../button';
17
- import MenuGroup from '../../menu-group';
18
- import MenuItem from '../../menu-item';
19
- import DropdownMenu from '../../dropdown-menu';
6
+ import { DropdownContentWrapper } from '../dropdown-content-wrapper';
20
7
 
21
- export default { title: 'Components/Dropdown', component: Dropdown };
8
+ export default {
9
+ title: 'Components/Dropdown',
10
+ component: Dropdown,
11
+ subcomponents: { DropdownContentWrapper },
12
+ argTypes: {
13
+ expandOnMobile: { control: { type: 'boolean' } },
14
+ focusOnMount: {
15
+ control: {
16
+ type: 'radio',
17
+ options: [ 'firstElement', 'container', false ],
18
+ },
19
+ },
20
+ headerTitle: { control: { type: 'text' } },
21
+ renderContent: { control: { type: null } },
22
+ renderToggle: { control: { type: null } },
23
+ },
24
+ };
22
25
 
23
- const DropdownAndDropdownMenuExample = () => {
26
+ const Template = ( args ) => {
24
27
  return (
25
- <>
26
- <div>
27
- <p>This is a DropdownMenu component:</p>
28
- <DropdownMenu
29
- icon={ more }
30
- label="Select a direction"
31
- controls={ [
32
- {
33
- title: 'Up',
34
- icon: arrowUp,
35
- },
36
- {
37
- title: 'Right',
38
- icon: arrowRight,
39
- },
40
- {
41
- title: 'Down',
42
- icon: arrowDown,
43
- },
44
- {
45
- title: 'Left',
46
- icon: arrowLeft,
47
- },
48
- ] }
49
- />
50
- </div>
51
- <div>
52
- <p>This is an assembled Dropdown component:</p>
53
- <Dropdown
54
- className="my-container-class-name"
55
- contentClassName="my-popover-content-classname"
56
- position="bottom right"
57
- renderToggle={ ( { isOpen, onToggle } ) => (
58
- <Button
59
- icon={ more }
60
- onClick={ onToggle }
61
- aria-expanded={ isOpen }
62
- label="Select a direction"
63
- />
64
- ) }
65
- renderContent={ () => (
66
- <MenuGroup>
67
- <MenuItem icon={ arrowUp }>Up</MenuItem>
68
- <MenuItem icon={ arrowDown }>Down</MenuItem>
69
- <MenuItem icon={ arrowLeft }>Left</MenuItem>
70
- <MenuItem icon={ arrowRight }>Right</MenuItem>
71
- </MenuGroup>
72
- ) }
73
- />
74
- </div>
75
- </>
28
+ <div style={ { height: 150 } }>
29
+ <Dropdown { ...args } />
30
+ </div>
76
31
  );
77
32
  };
78
33
 
79
- export const _default = () => {
80
- return <DropdownAndDropdownMenuExample />;
34
+ export const Default = Template.bind( {} );
35
+ Default.args = {
36
+ position: 'bottom right',
37
+ renderToggle: ( { isOpen, onToggle } ) => (
38
+ <Button onClick={ onToggle } aria-expanded={ isOpen } isPrimary>
39
+ Open dropdown
40
+ </Button>
41
+ ),
42
+ renderContent: () => <div>This is the dropdown content.</div>,
43
+ };
44
+
45
+ /**
46
+ * To apply more padding to the dropdown content, use the provided `<DropdownContentWrapper>`
47
+ * convenience wrapper. A `paddingSize` of `"medium"` is suitable for relatively larger dropdowns (default is `"small"`).
48
+ */
49
+ export const WithMorePadding = Template.bind( {} );
50
+ WithMorePadding.args = {
51
+ ...Default.args,
52
+ renderContent: () => (
53
+ <DropdownContentWrapper paddingSize="medium">
54
+ Content wrapped with <code>{ `paddingSize="medium"` }</code>.
55
+ </DropdownContentWrapper>
56
+ ),
57
+ };
58
+
59
+ /**
60
+ * The `<DropdownContentWrapper>` convenience wrapper can also be used to remove padding entirely,
61
+ * with a `paddingSize` of `"none"`. This can also serve as a clean foundation to add arbitrary
62
+ * paddings, for example when child components already have padding on their own.
63
+ */
64
+ export const WithNoPadding = Template.bind( {} );
65
+ WithNoPadding.args = {
66
+ ...Default.args,
67
+ renderContent: () => (
68
+ <DropdownContentWrapper paddingSize="none">
69
+ Content wrapped with <code>{ `paddingSize="none"` }</code>.
70
+ </DropdownContentWrapper>
71
+ ),
81
72
  };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { css } from '@emotion/react';
5
+ import styled from '@emotion/styled';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { space } from '../ui/utils/space';
11
+ import type { DropdownContentWrapperProps } from './types';
12
+
13
+ const padding = ( { paddingSize = 'small' }: DropdownContentWrapperProps ) => {
14
+ if ( paddingSize === 'none' ) return;
15
+
16
+ const paddingValues = {
17
+ small: space( 2 ),
18
+ medium: space( 4 ),
19
+ };
20
+
21
+ return css`
22
+ padding: ${ paddingValues[ paddingSize ] || paddingValues.small };
23
+ `;
24
+ };
25
+
26
+ export const DropdownContentWrapperDiv = styled.div< DropdownContentWrapperProps >`
27
+ // Negative margin to reset (offset) the default padding on .components-popover__content
28
+ margin-left: ${ space( -2 ) };
29
+ margin-right: ${ space( -2 ) };
30
+ &:first-of-type {
31
+ margin-top: ${ space( -2 ) };
32
+ }
33
+ &:last-of-type {
34
+ margin-bottom: ${ space( -2 ) };
35
+ }
36
+
37
+ ${ padding };
38
+ `;
@@ -0,0 +1,8 @@
1
+ export type DropdownContentWrapperProps = {
2
+ /**
3
+ * Amount of padding to apply on the dropdown content.
4
+ *
5
+ * @default 'small'
6
+ */
7
+ paddingSize?: 'none' | 'small' | 'medium';
8
+ };
@@ -33,46 +33,45 @@ function Example() {
33
33
 
34
34
  Size of the shadow value when active (see the `value` and `isInteractive` props).
35
35
 
36
- - Required: No
36
+ - Required: No
37
37
 
38
38
  ### `borderRadius`: `CSSProperties[ 'borderRadius' ]`
39
39
 
40
40
  Renders the border-radius of the shadow.
41
41
 
42
- - Required: No
43
- - Default: `inherit`
42
+ - Required: No
43
+ - Default: `inherit`
44
44
 
45
45
  ### `focus`: `number`
46
46
 
47
- Size of the shadow value when focused (see the `value` and `isInteractive` props).
47
+ Size of the shadow value when focused (see the `value` and `isInteractive`props).
48
48
 
49
- - Required: No
49
+ - Required: No
50
50
 
51
51
  ### `hover`: `number`
52
52
 
53
- Size of the shadow value when hovered (see the `value` and `isInteractive` props).
53
+ Size of the shadow value when hovered (see the `value` and `isInteractive` props).
54
54
 
55
- - Required: No
55
+ - Required: No
56
56
 
57
57
  ### `isInteractive`: `boolean`
58
58
 
59
59
  Determines if `hover`, `active`, and `focus` shadow values should be automatically calculated and rendered.
60
60
 
61
- - Required: No
62
- - Default: `false`
61
+ - Required: No
62
+ - Default: `false`
63
63
 
64
64
  ### `offset`: `number`
65
65
 
66
66
  Dimensional offsets (margin) for the shadow.
67
67
 
68
- - Required: No
69
- - Default: `0`
68
+ - Required: No
69
+ - Default: `0`
70
70
 
71
- ### `value`
72
-
73
- **Type**: `number`
71
+ ### `value`: `number`
74
72
 
75
73
  Size of the shadow, based on the Style system's elevation system. The `value` determines the strength of the shadow, which sense of depth.
74
+
76
75
  In the example below, `isInteractive` is activated to give a better sense of depth.
77
76
 
78
77
  ```jsx
@@ -86,3 +85,6 @@ function Example() {
86
85
  );
87
86
  }
88
87
  ```
88
+
89
+ - Required: No
90
+ - Default: `0`
@@ -0,0 +1,48 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ForwardedRef } from 'react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { contextConnect, WordPressComponentProps } from '../ui/context';
10
+ import { View } from '../view';
11
+ import { useElevation } from './hook';
12
+ import type { ElevationProps } from './types';
13
+
14
+ function UnconnectedElevation(
15
+ props: WordPressComponentProps< ElevationProps, 'div' >,
16
+ forwardedRef: ForwardedRef< any >
17
+ ) {
18
+ const elevationProps = useElevation( props );
19
+
20
+ return <View { ...elevationProps } ref={ forwardedRef } />;
21
+ }
22
+
23
+ /**
24
+ * `Elevation` is a core component that renders shadow, using the component
25
+ * system's shadow system.
26
+ *
27
+ * The shadow effect is generated using the `value` prop.
28
+ *
29
+ * ```jsx
30
+ * import {
31
+ * __experimentalElevation as Elevation,
32
+ * __experimentalSurface as Surface,
33
+ * __experimentalText as Text,
34
+ * } from '@wordpress/components';
35
+ *
36
+ * function Example() {
37
+ * return (
38
+ * <Surface>
39
+ * <Text>Code is Poetry</Text>
40
+ * <Elevation value={ 5 } />
41
+ * </Surface>
42
+ * );
43
+ * }
44
+ * ```
45
+ */
46
+ export const Elevation = contextConnect( UnconnectedElevation, 'Elevation' );
47
+
48
+ export default Elevation;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { css } from '@emotion/react';
4
+ import { css, SerializedStyles } from '@emotion/react';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -11,28 +11,24 @@ import { useMemo } from '@wordpress/element';
11
11
  /**
12
12
  * Internal dependencies
13
13
  */
14
- import { useContextSystem } from '../ui/context';
14
+ import { useContextSystem, WordPressComponentProps } from '../ui/context';
15
15
  import * as styles from './styles';
16
16
  import { CONFIG, reduceMotion } from '../utils';
17
17
  import { useCx } from '../utils/hooks/use-cx';
18
18
  import { isValueDefined } from '../utils/values';
19
+ import type { ElevationProps } from './types';
19
20
 
20
- /**
21
- * @param {number} value
22
- * @return {string} The box shadow value.
23
- */
24
- export function getBoxShadow( value ) {
25
- const boxShadowColor = `rgba(0 ,0, 0, ${ value / 20 })`;
21
+ export function getBoxShadow( value: number ) {
22
+ const boxShadowColor = `rgba(0, 0, 0, ${ value / 20 })`;
26
23
  const boxShadow = `0 ${ value }px ${ value * 2 }px 0
27
24
  ${ boxShadowColor }`;
28
25
 
29
26
  return boxShadow;
30
27
  }
31
28
 
32
- /**
33
- * @param {import('../ui/context').WordPressComponentProps<import('./types').Props, 'div'>} props
34
- */
35
- export function useElevation( props ) {
29
+ export function useElevation(
30
+ props: WordPressComponentProps< ElevationProps, 'div' >
31
+ ) {
36
32
  const {
37
33
  active,
38
34
  borderRadius = 'inherit',
@@ -48,10 +44,12 @@ export function useElevation( props ) {
48
44
  const cx = useCx();
49
45
 
50
46
  const classes = useMemo( () => {
51
- /** @type {number | undefined} */
52
- let hoverValue = isValueDefined( hover ) ? hover : value * 2;
53
- /** @type {number | undefined} */
54
- let activeValue = isValueDefined( active ) ? active : value / 2;
47
+ let hoverValue: number | undefined = isValueDefined( hover )
48
+ ? hover
49
+ : value * 2;
50
+ let activeValue: number | undefined = isValueDefined( active )
51
+ ? active
52
+ : value / 2;
55
53
 
56
54
  if ( ! isInteractive ) {
57
55
  hoverValue = isValueDefined( hover ) ? hover : undefined;
@@ -60,7 +58,12 @@ export function useElevation( props ) {
60
58
 
61
59
  const transition = `box-shadow ${ CONFIG.transitionDuration } ${ CONFIG.transitionTimingFunction }`;
62
60
 
63
- const sx = {};
61
+ const sx: {
62
+ Base?: SerializedStyles;
63
+ hover?: SerializedStyles;
64
+ active?: SerializedStyles;
65
+ focus?: SerializedStyles;
66
+ } = {};
64
67
 
65
68
  sx.Base = css(
66
69
  {
File without changes
@@ -0,0 +1,85 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { ComponentMeta, ComponentStory } from '@storybook/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Elevation } from '..';
10
+
11
+ const meta: ComponentMeta< typeof Elevation > = {
12
+ component: Elevation,
13
+ title: 'Components (Experimental)/Elevation',
14
+ argTypes: {
15
+ as: { control: { type: 'text' } },
16
+ borderRadius: { control: { type: 'text' } },
17
+ },
18
+ parameters: {
19
+ controls: {
20
+ expanded: true,
21
+ },
22
+ docs: { source: { state: 'open' } },
23
+ },
24
+ };
25
+ export default meta;
26
+
27
+ const Template: ComponentStory< typeof Elevation > = ( args ) => {
28
+ return (
29
+ <div
30
+ style={ {
31
+ width: 150,
32
+ height: 150,
33
+ position: 'relative',
34
+ } }
35
+ >
36
+ <Elevation { ...args } />
37
+ </div>
38
+ );
39
+ };
40
+
41
+ const InteractiveTemplate: ComponentStory< typeof Elevation > = ( args ) => {
42
+ return (
43
+ <button
44
+ style={ {
45
+ border: 0,
46
+ background: 'transparent',
47
+ width: 150,
48
+ height: 150,
49
+ position: 'relative',
50
+ } }
51
+ >
52
+ Click me
53
+ <Elevation { ...args } />
54
+ </button>
55
+ );
56
+ };
57
+
58
+ export const Default: ComponentStory< typeof Elevation > = Template.bind( {} );
59
+ Default.args = {
60
+ value: 5,
61
+ };
62
+
63
+ /**
64
+ * Enable the `isInteractive` prop to automatically generate values
65
+ * for the hover/active/focus states.
66
+ */
67
+ export const WithInteractive: ComponentStory< typeof Elevation > =
68
+ InteractiveTemplate.bind( {} );
69
+ WithInteractive.args = {
70
+ ...Default.args,
71
+ isInteractive: true,
72
+ };
73
+
74
+ /**
75
+ * You can also provide custom values for the hover/active/focus states
76
+ * instead of using the `isInteractive` prop.
77
+ */
78
+ export const WithCustomInteractive: ComponentStory< typeof Elevation > =
79
+ InteractiveTemplate.bind( {} );
80
+ WithCustomInteractive.args = {
81
+ ...Default.args,
82
+ hover: 7,
83
+ active: 1,
84
+ focus: 10,
85
+ };
File without changes