@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
@@ -373,7 +373,7 @@ Object {
373
373
  will-change: box-shadow;
374
374
  border-radius: inherit;
375
375
  bottom: 0;
376
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
376
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
377
377
  opacity: 1;
378
378
  left: 0;
379
379
  right: 0;
@@ -629,7 +629,7 @@ Object {
629
629
  will-change: box-shadow;
630
630
  border-radius: inherit;
631
631
  bottom: 0;
632
- box-shadow: 0 0px 0px 0 rgba(0 ,0, 0, 0);
632
+ box-shadow: 0 0px 0px 0 rgba(0, 0, 0, 0);
633
633
  opacity: 1;
634
634
  left: 0;
635
635
  right: 0;
@@ -786,15 +786,15 @@ Snapshot Diff:
786
786
  </div>
787
787
  <div
788
788
  aria-hidden="true"
789
- - class="components-elevation css-1b4rkmt-View-Elevation-sx-Base-elevationClassName em57xhy0"
790
- + class="components-elevation css-91yjwm-View-Elevation-sx-Base-elevationClassName em57xhy0"
789
+ - class="components-elevation css-1lsfy80-View-Elevation-sx-Base-elevationClassName em57xhy0"
790
+ + class="components-elevation css-15t1t3g-View-Elevation-sx-Base-elevationClassName em57xhy0"
791
791
  data-wp-c16t="true"
792
792
  data-wp-component="Elevation"
793
793
  />
794
794
  <div
795
795
  aria-hidden="true"
796
- - class="components-elevation css-o8otup-View-Elevation-sx-Base-elevationClassName em57xhy0"
797
- + class="components-elevation css-91yjwm-View-Elevation-sx-Base-elevationClassName em57xhy0"
796
+ - class="components-elevation css-18cl04p-View-Elevation-sx-Base-elevationClassName em57xhy0"
797
+ + class="components-elevation css-15t1t3g-View-Elevation-sx-Base-elevationClassName em57xhy0"
798
798
  data-wp-c16t="true"
799
799
  data-wp-component="Elevation"
800
800
  />
@@ -829,7 +829,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
829
829
  will-change: box-shadow;
830
830
  border-radius: inherit;
831
831
  bottom: 0;
832
- box-shadow: 0 1px 2px 0 rgba(0 ,0, 0, 0.05);
832
+ box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
833
833
  opacity: 1;
834
834
  left: 0;
835
835
  right: 0;
@@ -854,7 +854,7 @@ exports[`Card Card component should warn when the isElevated prop is passed 1`]
854
854
  will-change: box-shadow;
855
855
  border-radius: inherit;
856
856
  bottom: 0;
857
- box-shadow: 0 2px 4px 0 rgba(0 ,0, 0, 0.1);
857
+ box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
858
858
  opacity: 1;
859
859
  left: 0;
860
860
  right: 0;
@@ -162,6 +162,13 @@ export const extractColorNameFromCurrentValue = (
162
162
  return __( 'Custom' );
163
163
  };
164
164
 
165
+ export const showTransparentBackground = ( currentValue ) => {
166
+ if ( typeof currentValue === 'undefined' ) {
167
+ return true;
168
+ }
169
+ return colord( currentValue ).alpha() === 0;
170
+ };
171
+
165
172
  export default function ColorPalette( {
166
173
  clearable = true,
167
174
  className,
@@ -228,14 +235,18 @@ export default function ColorPalette( {
228
235
  aria-haspopup="true"
229
236
  onClick={ onToggle }
230
237
  aria-label={ customColorAccessibleLabel }
231
- style={ {
232
- background: value,
233
- color:
234
- colordColor.contrast() >
235
- colordColor.contrast( '#000' )
236
- ? '#fff'
237
- : '#000',
238
- } }
238
+ style={
239
+ showTransparentBackground( value )
240
+ ? { color: '#000' }
241
+ : {
242
+ background: value,
243
+ color:
244
+ colordColor.contrast() >
245
+ colordColor.contrast( '#000' )
246
+ ? '#fff'
247
+ : '#000',
248
+ }
249
+ }
239
250
  >
240
251
  <FlexItem
241
252
  isBlock
@@ -7,10 +7,15 @@
7
7
  padding: $grid-unit-15;
8
8
  font-family: inherit;
9
9
  width: 100%;
10
+ // The background image creates a checkerboard pattern. Ignore rtlcss to
11
+ // make it work both in LTR and RTL.
12
+ // See https://github.com/WordPress/gutenberg/pull/42510
13
+ /*rtl:begin:ignore*/
10
14
  background-image:
11
15
  repeating-linear-gradient(45deg, $gray-200 25%, transparent 25%, transparent 75%, $gray-200 75%, $gray-200),
12
16
  repeating-linear-gradient(45deg, $gray-200 25%, transparent 25%, transparent 75%, $gray-200 75%, $gray-200);
13
17
  background-position: 0 0, 25px 25px;
18
+ /*rtl:end:ignore*/
14
19
  background-size: calc(2 * 25px) calc(2 * 25px);
15
20
  box-sizing: border-box;
16
21
  color: $white;
@@ -1,7 +1,10 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { extractColorNameFromCurrentValue } from '../';
4
+ import {
5
+ extractColorNameFromCurrentValue,
6
+ showTransparentBackground,
7
+ } from '../';
5
8
 
6
9
  describe( 'ColorPalette: Utils', () => {
7
10
  describe( 'extractColorNameFromCurrentValue', () => {
@@ -21,4 +24,19 @@ describe( 'ColorPalette: Utils', () => {
21
24
  expect( result ).toBe( 'Blue' );
22
25
  } );
23
26
  } );
27
+ describe( 'showTransparentBackground', () => {
28
+ test( 'should return true for undefined color values', () => {
29
+ expect( showTransparentBackground( undefined ) ).toBe( true );
30
+ } );
31
+ test( 'should return true for transparent colors', () => {
32
+ expect( showTransparentBackground( 'transparent' ) ).toBe( true );
33
+ expect( showTransparentBackground( '#75757500' ) ).toBe( true );
34
+ } );
35
+
36
+ test( 'should return false for non-transparent colors', () => {
37
+ expect( showTransparentBackground( '#FFF' ) ).toBe( false );
38
+ expect( showTransparentBackground( '#757575' ) ).toBe( false );
39
+ expect( showTransparentBackground( '#f5f5f524' ) ).toBe( false ); // 0.14 alpha.
40
+ } );
41
+ } );
24
42
  } );
@@ -53,7 +53,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
53
53
  prefix={
54
54
  <Spacer
55
55
  as={ Text }
56
- marginLeft={ space( 3.5 ) }
56
+ marginLeft={ space( 4 ) }
57
57
  color={ COLORS.ui.theme }
58
58
  lineHeight={ 1 }
59
59
  >
@@ -65,6 +65,7 @@ export const HexInput = ( { color, onChange, enableAlpha }: HexInputProps ) => {
65
65
  maxLength={ enableAlpha ? 9 : 7 }
66
66
  label={ __( 'Hex color' ) }
67
67
  hideLabelFromVision
68
+ size="__unstable-large"
68
69
  __unstableStateReducer={ stateReducer }
69
70
  __unstableInputWidth="9em"
70
71
  />
@@ -37,7 +37,7 @@ export const InputWithSlider = ( {
37
37
  prefix={
38
38
  <Spacer
39
39
  as={ Text }
40
- paddingLeft={ space( 3.5 ) }
40
+ paddingLeft={ space( 4 ) }
41
41
  color={ COLORS.ui.theme }
42
42
  lineHeight={ 1 }
43
43
  >
@@ -45,6 +45,7 @@ export const InputWithSlider = ( {
45
45
  </Spacer>
46
46
  }
47
47
  hideHTMLArrows
48
+ size="__unstable-large"
48
49
  />
49
50
  <RangeControl
50
51
  label={ label }
@@ -17,7 +17,6 @@ import { HStack } from '../h-stack';
17
17
  import {
18
18
  BackdropUI,
19
19
  Container as InputControlContainer,
20
- Input,
21
20
  } from '../input-control/styles/input-control-styles';
22
21
  import CONFIG from '../utils/config-values';
23
22
 
@@ -44,14 +43,6 @@ export const RangeControl = styled( InnerRangeControl )`
44
43
  }
45
44
  `;
46
45
 
47
- // All inputs should be the same height so this should be changed at the component level.
48
- // That involves changing heights of multiple input types probably buttons too etc.
49
- // So until that is done we are already using the new height on the color picker so it matches the mockups.
50
- const inputHeightStyle = `
51
- &&& ${ Input } {
52
- height: 40px;
53
- }`;
54
-
55
46
  // Make the Hue circle picker not go out of the bar.
56
47
  const interactiveHueStyles = `
57
48
  .react-colorful__interactive {
@@ -125,8 +116,6 @@ export const ColorfulWrapper = styled.div`
125
116
  ${ StyledField } {
126
117
  margin-bottom: 0;
127
118
  }
128
-
129
- ${ inputHeightStyle }
130
119
  `;
131
120
 
132
121
  export const CopyButton = styled( Button )`
@@ -16,7 +16,6 @@ import {
16
16
  useEffect,
17
17
  } from '@wordpress/element';
18
18
  import { useInstanceId } from '@wordpress/compose';
19
- import { ENTER, UP, DOWN, ESCAPE } from '@wordpress/keycodes';
20
19
  import { speak } from '@wordpress/a11y';
21
20
  import { closeSmall } from '@wordpress/icons';
22
21
 
@@ -119,22 +118,22 @@ function ComboboxControl( {
119
118
  return;
120
119
  }
121
120
 
122
- switch ( event.keyCode ) {
123
- case ENTER:
121
+ switch ( event.code ) {
122
+ case 'Enter':
124
123
  if ( selectedSuggestion ) {
125
124
  onSuggestionSelected( selectedSuggestion );
126
125
  preventDefault = true;
127
126
  }
128
127
  break;
129
- case UP:
128
+ case 'ArrowUp':
130
129
  handleArrowNavigation( -1 );
131
130
  preventDefault = true;
132
131
  break;
133
- case DOWN:
132
+ case 'ArrowDown':
134
133
  handleArrowNavigation( 1 );
135
134
  preventDefault = true;
136
135
  break;
137
- case ESCAPE:
136
+ case 'Escape':
138
137
  setIsExpanded( false );
139
138
  setSelectedSuggestion( null );
140
139
  preventDefault = true;
@@ -17,7 +17,7 @@ The dialog is confirmed by clicking the _confirm_ button or by pressing the `Ent
17
17
  Allows the component to be used standalone, just by declaring it as part of another React's component render method:
18
18
 
19
19
  - It will be automatically open (displayed) upon mounting;
20
- - It will be automatically closed when when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
20
+ - It will be automatically closed when clicking the _cancel_ button, by pressing the `ESC` key, or by clicking outside the dialog focus (i.e, the overlay);
21
21
  - `onCancel` is not mandatory but can be passed. Even if passed, the dialog will still be able to close itself.
22
22
 
23
23
  Activating this mode is as simple as omitting the `isOpen` prop. The only mandatory prop, in this case, is the `onConfirm` callback. The message is passed as the `children`. You can pass any JSX you'd like, which allows to further format the message or include sub-component if you'd like:
@@ -9,12 +9,14 @@ import classnames from 'classnames';
9
9
  */
10
10
  import { Icon, check, chevronDown } from '@wordpress/icons';
11
11
  import { __, sprintf } from '@wordpress/i18n';
12
- import { useCallback } from '@wordpress/element';
12
+ import { useCallback, useState } from '@wordpress/element';
13
13
 
14
14
  /**
15
15
  * Internal dependencies
16
16
  */
17
- import { Button, VisuallyHidden } from '../';
17
+ import { VisuallyHidden } from '../';
18
+ import { Select as SelectControlSelect } from '../select-control/styles/select-control-styles';
19
+ import InputBase from '../input-control/input-base';
18
20
 
19
21
  const itemToString = ( item ) => item?.name;
20
22
  // This is needed so that in Windows, where
@@ -58,12 +60,16 @@ const stateReducer = (
58
60
  export default function CustomSelectControl( {
59
61
  /** Start opting into the larger default height that will become the default size in a future version. */
60
62
  __next36pxDefaultSize = false,
63
+ /** Start opting into the unconstrained width that will become the default in a future version. */
64
+ __nextUnconstrainedWidth = false,
61
65
  className,
62
66
  hideLabelFromVision,
63
67
  label,
64
68
  describedBy,
65
69
  options: items,
66
70
  onChange: onSelectedItemChange,
71
+ /** @type {import('../select-control/types').SelectControlProps.size} */
72
+ size = 'default',
67
73
  value: _selectedItem,
68
74
  } ) {
69
75
  const {
@@ -85,6 +91,8 @@ export default function CustomSelectControl( {
85
91
  stateReducer,
86
92
  } );
87
93
 
94
+ const [ isFocused, setIsFocused ] = useState( false );
95
+
88
96
  function getDescribedBy() {
89
97
  if ( describedBy ) {
90
98
  return describedBy;
@@ -138,31 +146,41 @@ export default function CustomSelectControl( {
138
146
  { label }
139
147
  </label>
140
148
  ) }
141
- <Button
142
- { ...getToggleButtonProps( {
143
- // This is needed because some speech recognition software don't support `aria-labelledby`.
144
- 'aria-label': label,
145
- 'aria-labelledby': undefined,
146
- className: classnames(
147
- 'components-custom-select-control__button',
148
- { 'is-next-36px-default-size': __next36pxDefaultSize }
149
- ),
150
- isSmall: ! __next36pxDefaultSize,
151
- describedBy: getDescribedBy(),
152
- } ) }
149
+ <InputBase
150
+ isFocused={ isOpen || isFocused }
151
+ __unstableInputWidth={
152
+ __nextUnconstrainedWidth ? undefined : 'auto'
153
+ }
154
+ labelPosition={ __nextUnconstrainedWidth ? undefined : 'top' }
153
155
  >
154
- { itemToString( selectedItem ) }
155
- <Icon
156
- icon={ chevronDown }
157
- className={ classnames(
158
- 'components-custom-select-control__button-icon',
159
- {
160
- 'is-next-36px-default-size': __next36pxDefaultSize,
161
- }
162
- ) }
163
- size={ 18 }
164
- />
165
- </Button>
156
+ <SelectControlSelect
157
+ as="button"
158
+ onFocus={ () => setIsFocused( true ) }
159
+ onBlur={ () => setIsFocused( false ) }
160
+ selectSize={ size }
161
+ __next36pxDefaultSize={ __next36pxDefaultSize }
162
+ { ...getToggleButtonProps( {
163
+ // This is needed because some speech recognition software don't support `aria-labelledby`.
164
+ 'aria-label': label,
165
+ 'aria-labelledby': undefined,
166
+ className: classnames(
167
+ 'components-custom-select-control__button',
168
+ {
169
+ 'is-next-unconstrained-width':
170
+ __nextUnconstrainedWidth,
171
+ }
172
+ ),
173
+ describedBy: getDescribedBy(),
174
+ } ) }
175
+ >
176
+ { itemToString( selectedItem ) }
177
+ <Icon
178
+ icon={ chevronDown }
179
+ className="components-custom-select-control__button-icon"
180
+ size={ 18 }
181
+ />
182
+ </SelectControlSelect>
183
+ </InputBase>
166
184
  { /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
167
185
  <ul { ...menuProps } onKeyDown={ onKeyDownHandler }>
168
186
  { isOpen &&
@@ -7,8 +7,13 @@ export default {
7
7
  title: 'Components/CustomSelectControl',
8
8
  component: CustomSelectControl,
9
9
  argTypes: {
10
- __next36pxDefaultSize: {
11
- control: { type: 'boolean' },
10
+ __next36pxDefaultSize: { control: { type: 'boolean' } },
11
+ __nextUnconstrainedWidth: { control: { type: 'boolean' } },
12
+ size: {
13
+ control: {
14
+ type: 'radio',
15
+ options: [ 'small', 'default', '__unstable-large' ],
16
+ },
12
17
  },
13
18
  },
14
19
  };
@@ -8,45 +8,20 @@
8
8
  }
9
9
 
10
10
  .components-custom-select-control__button {
11
- border: 1px solid $gray-700;
12
- border-radius: $radius-block-ui;
13
- min-width: 130px;
14
11
  position: relative;
15
12
  text-align: left;
13
+ outline: 0; // focus ring is handled elsewhere
16
14
 
17
- &:not(.is-next-36px-default-size) {
18
- min-height: 30px;
19
- }
20
-
21
- // For all button sizes allow sufficient space for the
22
- // dropdown "arrow" icon to display.
23
- &.components-custom-select-control__button {
24
- // TODO: Some of these can be removed after some internal inconsistencies are addressed, such as the chevron
25
- // (https://github.com/WordPress/gutenberg/issues/39400) and Button padding (https://github.com/WordPress/gutenberg/issues/39431)
26
- padding-left: $grid-unit-20;
27
- padding-right: $icon-size + $grid-unit-10;
28
-
29
- &:not(.is-next-36px-default-size) {
30
- padding-left: $grid-unit-10;
31
- padding-right: $icon-size;
32
- }
33
- }
34
-
35
- &:focus:not(:disabled) {
36
- border-color: var(--wp-admin-theme-color);
37
- box-shadow: 0 0 0 ($border-width-focus - $border-width) var(--wp-admin-theme-color);
15
+ &:not(.is-next-unconstrained-width) {
16
+ min-width: 130px;
38
17
  }
39
18
 
40
19
  .components-custom-select-control__button-icon {
41
20
  height: 100%;
42
21
  padding: 0;
43
22
  position: absolute;
44
- right: $grid-unit-10;
23
+ right: $grid-unit-05;
45
24
  top: 0;
46
-
47
- &:not(.is-next-36px-default-size) {
48
- right: $grid-unit-05;
49
- }
50
25
  }
51
26
  }
52
27
 
@@ -32,19 +32,26 @@ function Example() {
32
32
 
33
33
  Adjusts all margins on the inline dimension.
34
34
 
35
- - Required: No
35
+ - Required: No
36
+
37
+ ### `marginEnd`: `number`
38
+
39
+ Adjusts the inline-end margin.
40
+
41
+ - Required: No
36
42
 
37
43
  ### `marginStart`: `number`
38
44
 
39
45
  Adjusts the inline-start margin.
40
46
 
41
- - Required: No
47
+ - Required: No
42
48
 
43
- ### `marginEnd`: `number`
49
+ ### `orientation`: `horizontal | vertical`
44
50
 
45
- Adjusts the inline-end margin.
51
+ Divider's orientation. When using inside a flex container, you may need to make sure the divider is `stretch` aligned in order for it to be visible.
46
52
 
47
- - Required: No
53
+ - Required: No
54
+ - Default: `horizontal`
48
55
 
49
56
  ### Inherited props
50
57
 
@@ -14,10 +14,10 @@ import {
14
14
  WordPressComponentProps,
15
15
  } from '../ui/context';
16
16
  import { DividerView } from './styles';
17
- import type { Props } from './types';
17
+ import type { DividerProps } from './types';
18
18
 
19
19
  function UnconnectedDivider(
20
- props: WordPressComponentProps< Props, 'hr', false >,
20
+ props: WordPressComponentProps< DividerProps, 'hr', false >,
21
21
  forwardedRef: ForwardedRef< any >
22
22
  ) {
23
23
  const contextProps = useContextSystem( props, 'Divider' );
@@ -34,7 +34,6 @@ function UnconnectedDivider(
34
34
  /**
35
35
  * `Divider` is a layout component that separates groups of related content.
36
36
  *
37
- * @example
38
37
  * ```js
39
38
  * import {
40
39
  * __experimentalDivider as Divider,
@@ -1,2 +1,2 @@
1
1
  export { default as Divider } from './component';
2
- export type { Props as DividerProps } from './types';
2
+ export type { DividerProps } from './types';
@@ -15,13 +15,13 @@ const meta: ComponentMeta< typeof Divider > = {
15
15
  title: 'Components (Experimental)/Divider',
16
16
  argTypes: {
17
17
  margin: {
18
- control: { type: 'number' },
18
+ control: { type: 'text' },
19
19
  },
20
20
  marginStart: {
21
- control: { type: 'number' },
21
+ control: { type: 'text' },
22
22
  },
23
23
  marginEnd: {
24
- control: { type: 'number' },
24
+ control: { type: 'text' },
25
25
  },
26
26
  },
27
27
  parameters: {
@@ -41,7 +41,7 @@ const Template: ComponentStory< typeof Divider > = ( args ) => (
41
41
 
42
42
  export const Horizontal: ComponentStory< typeof Divider > = Template.bind( {} );
43
43
  Horizontal.args = {
44
- margin: 2,
44
+ margin: '2',
45
45
  };
46
46
 
47
47
  export const Vertical: ComponentStory< typeof Divider > = Template.bind( {} );
@@ -9,10 +9,10 @@ import { css } from '@emotion/react';
9
9
  */
10
10
  import { space } from '../ui/utils/space';
11
11
  import { rtl } from '../utils';
12
- import type { Props } from './types';
12
+ import type { DividerProps } from './types';
13
13
 
14
14
  const MARGIN_DIRECTIONS: Record<
15
- NonNullable< Props[ 'orientation' ] >,
15
+ NonNullable< DividerProps[ 'orientation' ] >,
16
16
  Record< 'start' | 'end', string >
17
17
  > = {
18
18
  vertical: {
@@ -33,7 +33,7 @@ const renderMargin = ( {
33
33
  margin,
34
34
  marginStart,
35
35
  marginEnd,
36
- }: Props ) =>
36
+ }: DividerProps ) =>
37
37
  css(
38
38
  rtl( {
39
39
  [ MARGIN_DIRECTIONS[ orientation ].start ]: space(
@@ -47,7 +47,7 @@ const renderMargin = ( {
47
47
 
48
48
  const renderDisplay = ( {
49
49
  'aria-orientation': orientation = 'horizontal',
50
- }: Props ) => {
50
+ }: DividerProps ) => {
51
51
  return orientation === 'vertical'
52
52
  ? css( { display: 'inline' } )
53
53
  : undefined;
@@ -55,7 +55,7 @@ const renderDisplay = ( {
55
55
 
56
56
  const renderBorder = ( {
57
57
  'aria-orientation': orientation = 'horizontal',
58
- }: Props ) => {
58
+ }: DividerProps ) => {
59
59
  return css( {
60
60
  [ orientation === 'vertical' ? 'borderRight' : 'borderBottom' ]:
61
61
  '1px solid currentColor',
@@ -64,13 +64,13 @@ const renderBorder = ( {
64
64
 
65
65
  const renderSize = ( {
66
66
  'aria-orientation': orientation = 'horizontal',
67
- }: Props ) =>
67
+ }: DividerProps ) =>
68
68
  css( {
69
69
  height: orientation === 'vertical' ? 'auto' : 0,
70
70
  width: orientation === 'vertical' ? 0 : 'auto',
71
71
  } );
72
72
 
73
- export const DividerView = styled.hr< Props >`
73
+ export const DividerView = styled.hr< DividerProps >`
74
74
  border: 0;
75
75
  margin: 0;
76
76
 
@@ -23,14 +23,14 @@ Snapshot Diff:
23
23
  - Received styles
24
24
  + Base styles
25
25
 
26
- @@ -2,10 +2,8 @@
26
+ @@ -2,8 +2,10 @@
27
27
  Object {
28
28
  "border": "0",
29
29
  "border-bottom": "1px solid currentColor",
30
30
  "height": "0",
31
31
  "margin": "0",
32
- - "margin-bottom": "calc(4px * 7)",
33
- - "margin-top": "calc(4px * 7)",
32
+ + "margin-bottom": "calc(4px * 7)",
33
+ + "margin-top": "calc(4px * 7)",
34
34
  "width": "auto",
35
35
  },
36
36
  ]
@@ -41,13 +41,13 @@ Snapshot Diff:
41
41
  - Received styles
42
42
  + Base styles
43
43
 
44
- @@ -2,9 +2,8 @@
44
+ @@ -2,8 +2,9 @@
45
45
  Object {
46
46
  "border": "0",
47
47
  "border-bottom": "1px solid currentColor",
48
48
  "height": "0",
49
49
  "margin": "0",
50
- - "margin-bottom": "calc(4px * 5)",
50
+ + "margin-bottom": "calc(4px * 5)",
51
51
  "width": "auto",
52
52
  },
53
53
  ]
@@ -58,13 +58,13 @@ Snapshot Diff:
58
58
  - Received styles
59
59
  + Base styles
60
60
 
61
- @@ -2,9 +2,8 @@
61
+ @@ -2,8 +2,9 @@
62
62
  Object {
63
63
  "border": "0",
64
64
  "border-bottom": "1px solid currentColor",
65
65
  "height": "0",
66
66
  "margin": "0",
67
- - "margin-top": "calc(4px * 5)",
67
+ + "margin-top": "calc(4px * 5)",
68
68
  "width": "auto",
69
69
  },
70
70
  ]
@@ -0,0 +1,40 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Divider } from '..';
10
+
11
+ describe( 'props', () => {
12
+ beforeEach( () => {
13
+ render( <Divider /> );
14
+ } );
15
+
16
+ test( 'should render correctly', () => {
17
+ expect( screen.getByRole( 'separator' ) ).toMatchSnapshot();
18
+ } );
19
+
20
+ test( 'should render marginStart', () => {
21
+ render( <Divider marginStart={ 5 } /> );
22
+
23
+ const dividers = screen.getAllByRole( 'separator' );
24
+ expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
25
+ } );
26
+
27
+ test( 'should render marginEnd', () => {
28
+ render( <Divider marginEnd={ 5 } /> );
29
+
30
+ const dividers = screen.getAllByRole( 'separator' );
31
+ expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
32
+ } );
33
+
34
+ test( 'should render margin', () => {
35
+ render( <Divider margin={ 7 } /> );
36
+
37
+ const dividers = screen.getAllByRole( 'separator' );
38
+ expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
39
+ } );
40
+ } );