@wordpress/components 35.0.1 → 36.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/CONTRIBUTING.md +33 -26
  3. package/build/alignment-matrix-control/cell.cjs +1 -1
  4. package/build/alignment-matrix-control/cell.cjs.map +2 -2
  5. package/build/alignment-matrix-control/index.cjs +1 -1
  6. package/build/alignment-matrix-control/index.cjs.map +2 -2
  7. package/build/angle-picker-control/angle-circle.cjs +1 -1
  8. package/build/angle-picker-control/angle-circle.cjs.map +2 -2
  9. package/build/angle-picker-control/index.cjs +2 -2
  10. package/build/autocomplete/get-autocomplete-match.cjs.map +1 -1
  11. package/build/autocomplete/index.cjs.map +1 -1
  12. package/build/base-control/styles/base-control-styles.cjs +6 -6
  13. package/build/base-control/styles/base-control-styles.cjs.map +2 -2
  14. package/build/border-control/styles.cjs +17 -14
  15. package/build/border-control/styles.cjs.map +2 -2
  16. package/build/box-control/{input-control.cjs → box-input-control.cjs} +9 -9
  17. package/build/box-control/box-input-control.cjs.map +7 -0
  18. package/build/box-control/index.cjs +9 -25
  19. package/build/box-control/index.cjs.map +3 -3
  20. package/build/button/index.cjs +3 -7
  21. package/build/button/index.cjs.map +2 -2
  22. package/build/card/card-divider/hook.cjs.map +2 -2
  23. package/build/color-palette/index.cjs.map +1 -1
  24. package/build/color-picker/component.cjs.map +1 -1
  25. package/build/date-time/utils.cjs.map +1 -1
  26. package/build/disabled/index.cjs.map +2 -2
  27. package/build/divider/component.cjs +108 -3
  28. package/build/divider/component.cjs.map +4 -4
  29. package/build/draggable/index.cjs.map +1 -1
  30. package/build/external-link/index.cjs +1 -1
  31. package/build/external-link/index.cjs.map +1 -1
  32. package/build/higher-order/with-fallback-styles/index.cjs +18 -44
  33. package/build/higher-order/with-fallback-styles/index.cjs.map +2 -2
  34. package/build/menu/popover.cjs.map +1 -1
  35. package/build/menu/styles.cjs +17 -17
  36. package/build/menu/styles.cjs.map +2 -2
  37. package/build/modal/index.cjs.map +1 -1
  38. package/build/modal/use-modal-exit-animation.cjs +37 -52
  39. package/build/modal/use-modal-exit-animation.cjs.map +2 -2
  40. package/build/palette-edit/index.cjs +1 -1
  41. package/build/progress-bar/index.cjs +1 -1
  42. package/build/progress-bar/index.cjs.map +2 -2
  43. package/build/query-controls/index.cjs +2 -2
  44. package/build/query-controls/index.cjs.map +2 -2
  45. package/build/range-control/index.cjs.map +1 -1
  46. package/build/sandbox/index.cjs +7 -1
  47. package/build/sandbox/index.cjs.map +2 -2
  48. package/build/snackbar/index.cjs +1 -1
  49. package/build/spinner/styles.cjs +4 -4
  50. package/build/spinner/styles.cjs.map +2 -2
  51. package/build/tabs/index.cjs +0 -18
  52. package/build/tabs/index.cjs.map +2 -2
  53. package/build/tabs/tablist.cjs +5 -15
  54. package/build/tabs/tablist.cjs.map +2 -2
  55. package/build/text-control/index.cjs +3 -12
  56. package/build/text-control/index.cjs.map +3 -3
  57. package/build/tools-panel/styles.cjs +13 -13
  58. package/build/tools-panel/styles.cjs.map +2 -2
  59. package/build/tools-panel/tools-panel/hook.cjs.map +1 -1
  60. package/build/tree-select/index.cjs +1 -1
  61. package/build/tree-select/index.cjs.map +1 -1
  62. package/build/truncate/utils.cjs +1 -1
  63. package/build/truncate/utils.cjs.map +1 -1
  64. package/build/utils/colors-values.cjs +12 -12
  65. package/build/utils/colors-values.cjs.map +2 -2
  66. package/build/utils/config-values.cjs +2 -2
  67. package/build/utils/config-values.cjs.map +2 -2
  68. package/build/utils/dropdown-motion.cjs.map +2 -2
  69. package/build/utils/strings.cjs.map +1 -1
  70. package/build/validated-form-controls/components/text-control.cjs +0 -1
  71. package/build/validated-form-controls/components/text-control.cjs.map +2 -2
  72. package/build-module/alignment-matrix-control/cell.mjs +1 -1
  73. package/build-module/alignment-matrix-control/cell.mjs.map +2 -2
  74. package/build-module/alignment-matrix-control/index.mjs +1 -1
  75. package/build-module/alignment-matrix-control/index.mjs.map +2 -2
  76. package/build-module/angle-picker-control/angle-circle.mjs +1 -1
  77. package/build-module/angle-picker-control/angle-circle.mjs.map +2 -2
  78. package/build-module/angle-picker-control/index.mjs +2 -2
  79. package/build-module/autocomplete/get-autocomplete-match.mjs.map +1 -1
  80. package/build-module/autocomplete/index.mjs.map +1 -1
  81. package/build-module/base-control/styles/base-control-styles.mjs +6 -6
  82. package/build-module/base-control/styles/base-control-styles.mjs.map +2 -2
  83. package/build-module/border-control/styles.mjs +17 -14
  84. package/build-module/border-control/styles.mjs.map +2 -2
  85. package/build-module/box-control/{input-control.mjs → box-input-control.mjs} +6 -6
  86. package/build-module/box-control/box-input-control.mjs.map +7 -0
  87. package/build-module/box-control/index.mjs +9 -25
  88. package/build-module/box-control/index.mjs.map +2 -2
  89. package/build-module/button/index.mjs +2 -5
  90. package/build-module/button/index.mjs.map +2 -2
  91. package/build-module/card/card-divider/hook.mjs.map +2 -2
  92. package/build-module/color-palette/index.mjs.map +1 -1
  93. package/build-module/color-picker/component.mjs.map +1 -1
  94. package/build-module/date-time/utils.mjs.map +1 -1
  95. package/build-module/disabled/index.mjs.map +2 -2
  96. package/build-module/divider/component.mjs +108 -3
  97. package/build-module/divider/component.mjs.map +3 -3
  98. package/build-module/draggable/index.mjs.map +1 -1
  99. package/build-module/external-link/index.mjs +1 -1
  100. package/build-module/external-link/index.mjs.map +1 -1
  101. package/build-module/higher-order/with-fallback-styles/index.mjs +20 -46
  102. package/build-module/higher-order/with-fallback-styles/index.mjs.map +2 -2
  103. package/build-module/menu/popover.mjs.map +1 -1
  104. package/build-module/menu/styles.mjs +17 -17
  105. package/build-module/menu/styles.mjs.map +2 -2
  106. package/build-module/modal/index.mjs.map +1 -1
  107. package/build-module/modal/use-modal-exit-animation.mjs +37 -52
  108. package/build-module/modal/use-modal-exit-animation.mjs.map +2 -2
  109. package/build-module/palette-edit/index.mjs +1 -1
  110. package/build-module/progress-bar/index.mjs +1 -1
  111. package/build-module/progress-bar/index.mjs.map +2 -2
  112. package/build-module/query-controls/index.mjs +2 -2
  113. package/build-module/query-controls/index.mjs.map +2 -2
  114. package/build-module/range-control/index.mjs.map +1 -1
  115. package/build-module/sandbox/index.mjs +3 -1
  116. package/build-module/sandbox/index.mjs.map +2 -2
  117. package/build-module/snackbar/index.mjs +1 -1
  118. package/build-module/spinner/styles.mjs +4 -4
  119. package/build-module/spinner/styles.mjs.map +2 -2
  120. package/build-module/tabs/index.mjs +1 -19
  121. package/build-module/tabs/index.mjs.map +2 -2
  122. package/build-module/tabs/tablist.mjs +5 -15
  123. package/build-module/tabs/tablist.mjs.map +2 -2
  124. package/build-module/text-control/index.mjs +3 -12
  125. package/build-module/text-control/index.mjs.map +2 -2
  126. package/build-module/tools-panel/styles.mjs +13 -13
  127. package/build-module/tools-panel/styles.mjs.map +2 -2
  128. package/build-module/tools-panel/tools-panel/hook.mjs.map +1 -1
  129. package/build-module/tree-select/index.mjs +1 -1
  130. package/build-module/tree-select/index.mjs.map +1 -1
  131. package/build-module/truncate/utils.mjs +1 -1
  132. package/build-module/truncate/utils.mjs.map +1 -1
  133. package/build-module/utils/colors-values.mjs +12 -12
  134. package/build-module/utils/colors-values.mjs.map +2 -2
  135. package/build-module/utils/config-values.mjs +2 -2
  136. package/build-module/utils/config-values.mjs.map +2 -2
  137. package/build-module/utils/dropdown-motion.mjs.map +2 -2
  138. package/build-module/utils/strings.mjs.map +1 -1
  139. package/build-module/validated-form-controls/components/text-control.mjs +0 -1
  140. package/build-module/validated-form-controls/components/text-control.mjs.map +2 -2
  141. package/build-style/style-rtl.css +85 -101
  142. package/build-style/style.css +85 -101
  143. package/build-types/base-control/styles/base-control-styles.d.ts.map +1 -1
  144. package/build-types/border-control/styles.d.ts.map +1 -1
  145. package/build-types/box-control/box-input-control.d.ts +3 -0
  146. package/build-types/box-control/box-input-control.d.ts.map +1 -0
  147. package/build-types/box-control/index.d.ts +2 -6
  148. package/build-types/box-control/index.d.ts.map +1 -1
  149. package/build-types/box-control/stories/index.story.d.ts.map +1 -1
  150. package/build-types/box-control/types.d.ts +7 -6
  151. package/build-types/box-control/types.d.ts.map +1 -1
  152. package/build-types/button/index.d.ts +0 -2
  153. package/build-types/button/index.d.ts.map +1 -1
  154. package/build-types/card/card-divider/hook.d.ts +1 -274
  155. package/build-types/card/card-divider/hook.d.ts.map +1 -1
  156. package/build-types/composite/stories/index.story.d.ts.map +1 -1
  157. package/build-types/confirm-dialog/stories/index.story.d.ts.map +1 -1
  158. package/build-types/disabled/index.d.ts +0 -1
  159. package/build-types/disabled/index.d.ts.map +1 -1
  160. package/build-types/disabled/stories/index.story.d.ts.map +1 -1
  161. package/build-types/divider/component.d.ts.map +1 -1
  162. package/build-types/dropdown/stories/index.story.d.ts.map +1 -1
  163. package/build-types/higher-order/with-fallback-styles/index.d.ts +1 -35
  164. package/build-types/higher-order/with-fallback-styles/index.d.ts.map +1 -1
  165. package/build-types/higher-order/with-fallback-styles/test/index.d.ts.map +1 -0
  166. package/build-types/icon/stories/index.story.d.ts +0 -1
  167. package/build-types/icon/stories/index.story.d.ts.map +1 -1
  168. package/build-types/menu/styles.d.ts.map +1 -1
  169. package/build-types/menu/types.d.ts +2 -2
  170. package/build-types/placeholder/stories/index.story.d.ts.map +1 -1
  171. package/build-types/resizable-box/index.d.ts +0 -2
  172. package/build-types/resizable-box/index.d.ts.map +1 -1
  173. package/build-types/resizable-box/stories/index.story.d.ts +0 -2
  174. package/build-types/resizable-box/stories/index.story.d.ts.map +1 -1
  175. package/build-types/sandbox/index.d.ts +15 -0
  176. package/build-types/sandbox/index.d.ts.map +1 -1
  177. package/build-types/spinner/styles.d.ts.map +1 -1
  178. package/build-types/tabs/index.d.ts.map +1 -1
  179. package/build-types/tabs/tablist.d.ts.map +1 -1
  180. package/build-types/text-control/index.d.ts +0 -1
  181. package/build-types/text-control/index.d.ts.map +1 -1
  182. package/build-types/text-control/stories/index.story.d.ts.map +1 -1
  183. package/build-types/text-control/types.d.ts +2 -1
  184. package/build-types/text-control/types.d.ts.map +1 -1
  185. package/build-types/tools-panel/styles.d.ts.map +1 -1
  186. package/build-types/utils/colors-values.d.ts.map +1 -1
  187. package/build-types/utils/dropdown-motion.d.ts.map +1 -1
  188. package/build-types/validated-form-controls/components/combobox-control.d.ts +2 -2
  189. package/build-types/validated-form-controls/components/text-control.d.ts +2 -2
  190. package/build-types/validated-form-controls/components/text-control.d.ts.map +1 -1
  191. package/package.json +34 -28
  192. package/src/angle-picker-control/angle-circle.tsx +3 -3
  193. package/src/base-control/README.md +2 -2
  194. package/src/base-control/styles/base-control-styles.ts +1 -0
  195. package/src/border-control/styles.ts +1 -0
  196. package/src/box-control/README.md +1 -13
  197. package/src/box-control/{input-control.tsx → box-input-control.tsx} +4 -4
  198. package/src/box-control/index.tsx +5 -23
  199. package/src/box-control/stories/index.story.tsx +1 -3
  200. package/src/box-control/test/index.tsx +15 -2
  201. package/src/box-control/types.ts +7 -6
  202. package/src/button/index.tsx +2 -4
  203. package/src/button/style.scss +3 -3
  204. package/src/card/card-divider/hook.ts +5 -1
  205. package/src/card/test/__snapshots__/index.tsx.snap +7 -9
  206. package/src/checkbox-control/test/__snapshots__/index.tsx.snap +4 -3
  207. package/src/composite/stories/index.story.tsx +5 -0
  208. package/src/confirm-dialog/stories/index.story.tsx +1 -0
  209. package/src/custom-select-control/test/index.tsx +1 -1
  210. package/src/disabled/README.md +0 -1
  211. package/src/disabled/index.tsx +0 -1
  212. package/src/disabled/stories/index.story.tsx +0 -1
  213. package/src/divider/component.tsx +27 -3
  214. package/src/divider/style.module.scss +21 -0
  215. package/src/divider/test/index.tsx +21 -11
  216. package/src/dropdown/stories/index.story.tsx +5 -0
  217. package/src/dropdown-menu/style.scss +1 -1
  218. package/src/external-link/style.scss +4 -4
  219. package/src/form-toggle/style.scss +1 -1
  220. package/src/heading/test/__snapshots__/index.tsx.snap +4 -4
  221. package/src/higher-order/with-constrained-tabbing/README.md +0 -2
  222. package/src/higher-order/with-fallback-styles/index.tsx +31 -61
  223. package/src/higher-order/with-fallback-styles/test/index.tsx +47 -0
  224. package/src/higher-order/with-focus-return/README.md +0 -2
  225. package/src/icon/stories/index.story.tsx +0 -15
  226. package/src/menu/README.md +2 -2
  227. package/src/menu/styles.ts +2 -0
  228. package/src/menu/test/index.tsx +104 -87
  229. package/src/menu/types.ts +2 -2
  230. package/src/menu-item/test/__snapshots__/index.js.snap +2 -0
  231. package/src/modal/style.scss +1 -1
  232. package/src/modal/test/index.tsx +0 -24
  233. package/src/modal/use-modal-exit-animation.ts +2 -2
  234. package/src/navigable-container/test/navigable-menu.tsx +0 -16
  235. package/src/navigable-container/test/tababble-container.tsx +0 -16
  236. package/src/navigator/test/index.tsx +0 -24
  237. package/src/notice/style.scss +11 -13
  238. package/src/notice/test/__snapshots__/index.tsx.snap +1 -0
  239. package/src/panel/README.md +2 -0
  240. package/src/panel/stories/index.story.tsx +2 -2
  241. package/src/panel/style.scss +1 -1
  242. package/src/placeholder/stories/index.story.tsx +0 -1
  243. package/src/radio-control/style.scss +1 -1
  244. package/src/resizable-box/index.tsx +1 -2
  245. package/src/sandbox/index.tsx +18 -1
  246. package/src/sandbox/test/index.tsx +44 -1
  247. package/src/spinner/styles.ts +1 -0
  248. package/src/tab-panel/style.scss +6 -6
  249. package/src/tab-panel/test/index.tsx +0 -17
  250. package/src/tabs/index.tsx +1 -26
  251. package/src/tabs/tablist.tsx +5 -21
  252. package/src/tabs/test/index.tsx +16 -44
  253. package/src/text/test/__snapshots__/index.tsx.snap +3 -3
  254. package/src/text-control/README.md +0 -9
  255. package/src/text-control/index.tsx +3 -14
  256. package/src/text-control/stories/index.story.tsx +0 -2
  257. package/src/text-control/style.scss +7 -11
  258. package/src/text-control/test/text-control.tsx +1 -5
  259. package/src/text-control/types.ts +2 -1
  260. package/src/toggle-group-control/test/__snapshots__/index.tsx.snap +38 -26
  261. package/src/toolbar/toolbar-group/style.scss +2 -2
  262. package/src/tools-panel/styles.ts +1 -1
  263. package/src/tools-panel/tools-panel/README.md +0 -2
  264. package/src/tooltip/stories/index.story.tsx +2 -2
  265. package/src/tree-grid/test/index.tsx +0 -23
  266. package/src/utils/colors-values.js +36 -16
  267. package/src/utils/config-values.js +2 -2
  268. package/src/utils/dropdown-motion.ts +6 -4
  269. package/src/utils/theme-variables.scss +18 -13
  270. package/src/validated-form-controls/components/text-control.tsx +2 -10
  271. package/build/box-control/input-control.cjs.map +0 -7
  272. package/build/divider/styles.cjs +0 -98
  273. package/build/divider/styles.cjs.map +0 -7
  274. package/build-module/box-control/input-control.mjs.map +0 -7
  275. package/build-module/divider/styles.mjs +0 -63
  276. package/build-module/divider/styles.mjs.map +0 -7
  277. package/build-types/box-control/input-control.d.ts +0 -3
  278. package/build-types/box-control/input-control.d.ts.map +0 -1
  279. package/build-types/card/context.d.ts +0 -3
  280. package/build-types/card/context.d.ts.map +0 -1
  281. package/build-types/date-time/date/index.d.ts +0 -23
  282. package/build-types/date-time/date/index.d.ts.map +0 -1
  283. package/build-types/date-time/date/styles.d.ts +0 -45
  284. package/build-types/date-time/date/styles.d.ts.map +0 -1
  285. package/build-types/date-time/date/test/index.d.ts.map +0 -1
  286. package/build-types/date-time/date/test/use-lilius.d.ts +0 -2
  287. package/build-types/date-time/date/test/use-lilius.d.ts.map +0 -1
  288. package/build-types/date-time/date/use-lilius/index.d.ts +0 -169
  289. package/build-types/date-time/date/use-lilius/index.d.ts.map +0 -1
  290. package/build-types/date-time/time/index.d.ts +0 -27
  291. package/build-types/date-time/time/index.d.ts.map +0 -1
  292. package/build-types/date-time/time/styles.d.ts +0 -93
  293. package/build-types/date-time/time/styles.d.ts.map +0 -1
  294. package/build-types/date-time/time/test/index.d.ts +0 -2
  295. package/build-types/date-time/time/test/index.d.ts.map +0 -1
  296. package/build-types/date-time/time/time-input/index.d.ts +0 -4
  297. package/build-types/date-time/time/time-input/index.d.ts.map +0 -1
  298. package/build-types/date-time/time/time-input/test/index.d.ts +0 -2
  299. package/build-types/date-time/time/time-input/test/index.d.ts.map +0 -1
  300. package/build-types/date-time/time/timezone.d.ts +0 -7
  301. package/build-types/date-time/time/timezone.d.ts.map +0 -1
  302. package/build-types/divider/styles.d.ts +0 -10
  303. package/build-types/divider/styles.d.ts.map +0 -1
  304. package/build-types/mobile/image/constants.d.ts +0 -5
  305. package/build-types/mobile/image/constants.d.ts.map +0 -1
  306. package/build-types/navigation/back-button/index.d.ts +0 -7
  307. package/build-types/navigation/back-button/index.d.ts.map +0 -1
  308. package/build-types/navigation/constants.d.ts +0 -3
  309. package/build-types/navigation/constants.d.ts.map +0 -1
  310. package/build-types/navigation/context.d.ts +0 -4
  311. package/build-types/navigation/context.d.ts.map +0 -1
  312. package/build-types/navigation/group/context.d.ts +0 -7
  313. package/build-types/navigation/group/context.d.ts.map +0 -1
  314. package/build-types/navigation/group/index.d.ts +0 -7
  315. package/build-types/navigation/group/index.d.ts.map +0 -1
  316. package/build-types/navigation/index.d.ts +0 -46
  317. package/build-types/navigation/index.d.ts.map +0 -1
  318. package/build-types/navigation/item/base-content.d.ts +0 -3
  319. package/build-types/navigation/item/base-content.d.ts.map +0 -1
  320. package/build-types/navigation/item/base.d.ts +0 -3
  321. package/build-types/navigation/item/base.d.ts.map +0 -1
  322. package/build-types/navigation/item/index.d.ts +0 -7
  323. package/build-types/navigation/item/index.d.ts.map +0 -1
  324. package/build-types/navigation/item/use-navigation-tree-item.d.ts +0 -3
  325. package/build-types/navigation/item/use-navigation-tree-item.d.ts.map +0 -1
  326. package/build-types/navigation/menu/context.d.ts +0 -7
  327. package/build-types/navigation/menu/context.d.ts.map +0 -1
  328. package/build-types/navigation/menu/index.d.ts +0 -7
  329. package/build-types/navigation/menu/index.d.ts.map +0 -1
  330. package/build-types/navigation/menu/menu-title-search.d.ts +0 -3
  331. package/build-types/navigation/menu/menu-title-search.d.ts.map +0 -1
  332. package/build-types/navigation/menu/menu-title.d.ts +0 -3
  333. package/build-types/navigation/menu/menu-title.d.ts.map +0 -1
  334. package/build-types/navigation/menu/search-no-results-found.d.ts +0 -3
  335. package/build-types/navigation/menu/search-no-results-found.d.ts.map +0 -1
  336. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts +0 -3
  337. package/build-types/navigation/menu/use-navigation-tree-menu.d.ts.map +0 -1
  338. package/build-types/navigation/stories/index.story.d.ts +0 -23
  339. package/build-types/navigation/stories/index.story.d.ts.map +0 -1
  340. package/build-types/navigation/stories/utils/controlled-state.d.ts +0 -7
  341. package/build-types/navigation/stories/utils/controlled-state.d.ts.map +0 -1
  342. package/build-types/navigation/stories/utils/default.d.ts +0 -10
  343. package/build-types/navigation/stories/utils/default.d.ts.map +0 -1
  344. package/build-types/navigation/stories/utils/group.d.ts +0 -10
  345. package/build-types/navigation/stories/utils/group.d.ts.map +0 -1
  346. package/build-types/navigation/stories/utils/hide-if-empty.d.ts +0 -10
  347. package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +0 -1
  348. package/build-types/navigation/stories/utils/more-examples.d.ts +0 -10
  349. package/build-types/navigation/stories/utils/more-examples.d.ts.map +0 -1
  350. package/build-types/navigation/stories/utils/search.d.ts +0 -10
  351. package/build-types/navigation/stories/utils/search.d.ts.map +0 -1
  352. package/build-types/navigation/styles/navigation-styles.d.ts +0 -55
  353. package/build-types/navigation/styles/navigation-styles.d.ts.map +0 -1
  354. package/build-types/navigation/test/index.d.ts +0 -2
  355. package/build-types/navigation/test/index.d.ts.map +0 -1
  356. package/build-types/navigation/types.d.ts +0 -266
  357. package/build-types/navigation/types.d.ts.map +0 -1
  358. package/build-types/navigation/use-create-navigation-tree.d.ts +0 -15
  359. package/build-types/navigation/use-create-navigation-tree.d.ts.map +0 -1
  360. package/build-types/navigation/use-navigation-tree-nodes.d.ts +0 -10
  361. package/build-types/navigation/use-navigation-tree-nodes.d.ts.map +0 -1
  362. package/build-types/navigation/utils.d.ts +0 -3
  363. package/build-types/navigation/utils.d.ts.map +0 -1
  364. package/build-types/visually-hidden/test/index.d.ts +0 -2
  365. package/build-types/visually-hidden/test/index.d.ts.map +0 -1
  366. package/src/divider/styles.ts +0 -81
  367. package/src/divider/test/__snapshots__/index.tsx.snap +0 -71
  368. /package/build-types/{date-time/date → higher-order/with-fallback-styles}/test/index.d.ts +0 -0
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import * as Ariakit from '@ariakit/react';
5
+ import clsx from 'clsx';
5
6
  import type { ForwardedRef } from 'react';
6
7
 
7
8
  /**
@@ -9,18 +10,41 @@ import type { ForwardedRef } from 'react';
9
10
  */
10
11
  import type { WordPressComponentProps } from '../context';
11
12
  import { contextConnect, useContextSystem } from '../context';
12
- import { DividerView } from './styles';
13
+ import { space } from '../utils/space';
13
14
  import type { DividerProps } from './types';
15
+ import styles from './style.module.scss';
14
16
 
15
17
  function UnconnectedDivider(
16
18
  props: WordPressComponentProps< DividerProps, 'hr', false >,
17
19
  forwardedRef: ForwardedRef< any >
18
20
  ) {
19
- const contextProps = useContextSystem( props, 'Divider' );
21
+ const {
22
+ className,
23
+ margin,
24
+ marginEnd,
25
+ marginStart,
26
+ style,
27
+ ...contextProps
28
+ } = useContextSystem( props, 'Divider' );
29
+
30
+ const dividerStyle = { ...style };
31
+ const resolvedMarginStart = space( marginStart ?? margin );
32
+ const resolvedMarginEnd = space( marginEnd ?? margin );
33
+
34
+ if ( resolvedMarginStart ) {
35
+ dividerStyle[ '--wp-components-divider-margin-start' ] =
36
+ resolvedMarginStart;
37
+ }
38
+
39
+ if ( resolvedMarginEnd ) {
40
+ dividerStyle[ '--wp-components-divider-margin-end' ] =
41
+ resolvedMarginEnd;
42
+ }
20
43
 
21
44
  return (
22
45
  <Ariakit.Separator
23
- render={ <DividerView /> }
46
+ className={ clsx( styles.divider, className ) }
47
+ style={ dividerStyle }
24
48
  { ...contextProps }
25
49
  ref={ forwardedRef }
26
50
  />
@@ -0,0 +1,21 @@
1
+ .divider {
2
+ border: 0;
3
+ margin: 0;
4
+
5
+ &[aria-orientation="horizontal"] {
6
+ border-block-end: 1px solid currentColor;
7
+ block-size: 0;
8
+ inline-size: auto;
9
+ margin-block-start: var(--wp-components-divider-margin-start, 0);
10
+ margin-block-end: var(--wp-components-divider-margin-end, 0);
11
+ }
12
+
13
+ &[aria-orientation="vertical"] {
14
+ display: inline;
15
+ border-inline-end: 1px solid currentColor;
16
+ block-size: auto;
17
+ inline-size: 0;
18
+ margin-inline-start: var(--wp-components-divider-margin-start, 0);
19
+ margin-inline-end: var(--wp-components-divider-margin-end, 0);
20
+ }
21
+ }
@@ -9,32 +9,42 @@ import { render, screen } from '@testing-library/react';
9
9
  import { Divider } from '..';
10
10
 
11
11
  describe( 'props', () => {
12
- test( 'should render correctly', () => {
12
+ test( 'should render a horizontal separator by default', () => {
13
13
  render( <Divider /> );
14
- expect( screen.getByRole( 'separator' ) ).toMatchSnapshot();
14
+
15
+ const divider = screen.getByRole( 'separator' );
16
+ expect( divider ).toHaveAttribute( 'aria-orientation', 'horizontal' );
15
17
  } );
16
18
 
17
19
  test( 'should render marginStart', () => {
18
- render( <Divider /> );
19
20
  render( <Divider marginStart={ 5 } /> );
20
21
 
21
- const dividers = screen.getAllByRole( 'separator' );
22
- expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
22
+ expect( screen.getByRole( 'separator' ) ).toHaveStyle( {
23
+ '--wp-components-divider-margin-start': 'calc(4px * 5)',
24
+ } );
23
25
  } );
24
26
 
25
27
  test( 'should render marginEnd', () => {
26
- render( <Divider /> );
27
28
  render( <Divider marginEnd={ 5 } /> );
28
29
 
29
- const dividers = screen.getAllByRole( 'separator' );
30
- expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
30
+ expect( screen.getByRole( 'separator' ) ).toHaveStyle( {
31
+ '--wp-components-divider-margin-end': 'calc(4px * 5)',
32
+ } );
31
33
  } );
32
34
 
33
35
  test( 'should render margin', () => {
34
- render( <Divider /> );
35
36
  render( <Divider margin={ 7 } /> );
36
37
 
37
- const dividers = screen.getAllByRole( 'separator' );
38
- expect( dividers[ 0 ] ).toMatchStyleDiffSnapshot( dividers[ 1 ] );
38
+ expect( screen.getByRole( 'separator' ) ).toHaveStyle( {
39
+ '--wp-components-divider-margin-start': 'calc(4px * 7)',
40
+ '--wp-components-divider-margin-end': 'calc(4px * 7)',
41
+ } );
42
+ } );
43
+
44
+ test( 'should render vertical orientation', () => {
45
+ render( <Divider orientation="vertical" /> );
46
+
47
+ const divider = screen.getByRole( 'separator' );
48
+ expect( divider ).toHaveAttribute( 'aria-orientation', 'vertical' );
39
49
  } );
40
50
  } );
@@ -19,6 +19,11 @@ const meta: Meta< typeof Dropdown > = {
19
19
  id: 'components-dropdown',
20
20
  component: Dropdown,
21
21
  subcomponents: { DropdownContentWrapper },
22
+ // Temporary: Due to an upstream bug, render the root explicitly so the
23
+ // components manifest extractor can resolve props from the JSX.
24
+ //
25
+ // See: https://github.com/storybookjs/storybook/issues/34877
26
+ render: ( args ) => <Dropdown { ...args } />,
22
27
  args: {
23
28
  onClose: fn(),
24
29
  onToggle: fn(),
@@ -30,7 +30,7 @@
30
30
  display: block;
31
31
  content: "";
32
32
  box-sizing: content-box;
33
- background-color: $gray-300;
33
+ background-color: var(--wpds-color-stroke-surface-neutral);
34
34
  position: absolute;
35
35
  top: -3px;
36
36
  left: 0;
@@ -1,5 +1,5 @@
1
1
  .components-external-link {
2
- color: var(--wpds-color-fg-interactive-brand);
2
+ color: var(--wpds-color-foreground-interactive-brand);
3
3
  text-decoration: none;
4
4
 
5
5
  // Match the `outset-ring--focus` utility used by `Link` in `@wordpress/ui`.
@@ -12,18 +12,18 @@
12
12
  outline-offset: 1px;
13
13
 
14
14
  &:visited {
15
- color: var(--wpds-color-fg-interactive-brand);
15
+ color: var(--wpds-color-foreground-interactive-brand);
16
16
  }
17
17
 
18
18
  &:hover,
19
19
  &:active {
20
- color: var(--wpds-color-fg-interactive-brand-active);
20
+ color: var(--wpds-color-foreground-interactive-brand-active);
21
21
  }
22
22
 
23
23
  &:focus {
24
24
  outline:
25
25
  var(--wpds-border-width-focus) solid
26
- var(--wpds-color-stroke-focus-brand);
26
+ var(--wpds-color-stroke-focus);
27
27
  // Override style from wp-admin common.css.
28
28
  box-shadow: none;
29
29
  border-radius: 0;
@@ -106,7 +106,7 @@ $transition-duration: 0.2s;
106
106
  .components-disabled & {
107
107
  .components-form-toggle__track {
108
108
  background-color: $components-color-gray-100;
109
- border-color: $components-color-gray-300;
109
+ border-color: var(--wpds-color-stroke-interactive-neutral-disabled);
110
110
 
111
111
  @media ( forced-colors: active ) {
112
112
  border-color: GrayText;
@@ -2,11 +2,11 @@
2
2
 
3
3
  exports[`props should render correctly 1`] = `
4
4
  .emotion-0 {
5
- color: var(--wp-components-color-foreground, #1e1e1e);
5
+ color: var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e));
6
6
  line-height: 1.4;
7
7
  margin: 0;
8
8
  text-wrap: pretty;
9
- color: var(--wp-components-color-foreground, #1e1e1e);
9
+ color: var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e));
10
10
  font-size: calc(1.95 * 13px);
11
11
  font-weight: 600;
12
12
  display: block;
@@ -29,7 +29,7 @@ Snapshot Diff:
29
29
  @@ -1,10 +1,10 @@
30
30
  Array [
31
31
  Object {
32
- "color": "var(--wp-components-color-foreground, #1e1e1e)",
32
+ "color": "var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))",
33
33
  "display": "block",
34
34
  - "font-size": "calc(1.25 * 13px)",
35
35
  + "font-size": "calc(1.95 * 13px)",
@@ -48,7 +48,7 @@ Snapshot Diff:
48
48
  @@ -1,10 +1,10 @@
49
49
  Array [
50
50
  Object {
51
- "color": "var(--wp-components-color-foreground, #1e1e1e)",
51
+ "color": "var(--wp-components-color-foreground, var(--wpds-color-foreground-content-neutral, #1e1e1e))",
52
52
  "display": "block",
53
53
  - "font-size": "calc(1.25 * 13px)",
54
54
  + "font-size": "calc(1.95 * 13px)",
@@ -23,12 +23,10 @@ const MyComponentWithConstrainedTabbing = () => {
23
23
  let form = (
24
24
  <form>
25
25
  <TextControl
26
- __next40pxDefaultSize
27
26
  label="Input 1"
28
27
  onChange={ () => {} }
29
28
  />
30
29
  <TextControl
31
- __next40pxDefaultSize
32
30
  label="Input 2"
33
31
  onChange={ () => {} }
34
32
  />
@@ -6,19 +6,17 @@ import fastDeepEqual from 'fast-deep-equal/es6/index.js';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { Component } from '@wordpress/element';
10
- import { createHigherOrderComponent } from '@wordpress/compose';
9
+ import { useState, useRef } from '@wordpress/element';
10
+ import {
11
+ createHigherOrderComponent,
12
+ useIsomorphicLayoutEffect,
13
+ } from '@wordpress/compose';
11
14
 
12
15
  type Props = {
13
16
  node?: HTMLElement;
14
17
  [ key: string ]: any;
15
18
  };
16
19
 
17
- type State = {
18
- fallbackStyles?: { [ key: string ]: any };
19
- grabStylesCompleted: boolean;
20
- };
21
-
22
20
  export default (
23
21
  mapNodeToProps: (
24
22
  node: HTMLElement,
@@ -26,69 +24,41 @@ export default (
26
24
  ) => { [ key: string ]: any }
27
25
  ) =>
28
26
  createHigherOrderComponent( ( WrappedComponent ) => {
29
- return class WithFallbackStyles extends Component< Props, State > {
30
- nodeRef?: HTMLElement;
27
+ return function WithFallbackStyles( props: Props ) {
28
+ const [ fallbackStyles, setFallbackStyles ] = useState<
29
+ { [ key: string ]: any } | undefined
30
+ >( undefined );
31
31
 
32
- constructor( props: Props ) {
33
- super( props );
34
- this.nodeRef = this.props.node;
35
- this.state = {
36
- fallbackStyles: undefined,
37
- grabStylesCompleted: false,
38
- };
32
+ const nodeRef = useRef< HTMLDivElement >( null );
39
33
 
40
- this.bindRef = this.bindRef.bind( this );
41
- }
42
-
43
- bindRef( node: HTMLDivElement ) {
44
- if ( ! node ) {
45
- return;
46
- }
47
- this.nodeRef = node;
48
- }
34
+ // Runs before paint, so the fallback styles apply without a flash.
35
+ useIsomorphicLayoutEffect( () => {
36
+ const node = props.node ?? nodeRef.current;
37
+ // Derived from fallbackStyles: the grab is complete once every
38
+ // mapped value has resolved to a truthy style.
39
+ const grabStylesCompleted =
40
+ !! fallbackStyles &&
41
+ Object.values( fallbackStyles ).every( Boolean );
49
42
 
50
- componentDidMount() {
51
- this.grabFallbackStyles();
52
- }
53
-
54
- componentDidUpdate() {
55
- this.grabFallbackStyles();
56
- }
57
-
58
- grabFallbackStyles() {
59
- const { grabStylesCompleted, fallbackStyles } = this.state;
60
- if ( this.nodeRef && ! grabStylesCompleted ) {
61
- const newFallbackStyles = mapNodeToProps(
62
- this.nodeRef,
63
- this.props
64
- );
43
+ if ( node && ! grabStylesCompleted ) {
44
+ const newFallbackStyles = mapNodeToProps( node, props );
65
45
 
66
46
  if (
67
47
  ! fastDeepEqual( newFallbackStyles, fallbackStyles )
68
48
  ) {
69
- this.setState( {
70
- fallbackStyles: newFallbackStyles,
71
- grabStylesCompleted:
72
- Object.values( newFallbackStyles ).every(
73
- Boolean
74
- ),
75
- } );
49
+ setFallbackStyles( newFallbackStyles );
76
50
  }
77
51
  }
78
- }
52
+ } );
53
+
54
+ const wrappedComponent = (
55
+ <WrappedComponent { ...props } { ...fallbackStyles } />
56
+ );
79
57
 
80
- render() {
81
- const wrappedComponent = (
82
- <WrappedComponent
83
- { ...this.props }
84
- { ...this.state.fallbackStyles }
85
- />
86
- );
87
- return this.props.node ? (
88
- wrappedComponent
89
- ) : (
90
- <div ref={ this.bindRef }> { wrappedComponent } </div>
91
- );
92
- }
58
+ return props.node ? (
59
+ wrappedComponent
60
+ ) : (
61
+ <div ref={ nodeRef }> { wrappedComponent } </div>
62
+ );
93
63
  };
94
64
  }, 'withFallbackStyles' );
@@ -0,0 +1,47 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { render, screen } from '@testing-library/react';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import withFallbackStyles from '..';
10
+
11
+ describe( 'withFallbackStyles', () => {
12
+ const Wrapped = ( props: { fallbackColor?: string } ) => (
13
+ <div>{ props.fallbackColor ?? 'no-fallback' }</div>
14
+ );
15
+
16
+ it( 'derives the fallback styles from the provided node prop', () => {
17
+ const node = document.createElement( 'span' );
18
+ node.dataset.color = 'rgb(1, 2, 3)';
19
+ const mapNodeToProps = jest.fn( ( el: HTMLElement ) => ( {
20
+ fallbackColor: el.dataset.color,
21
+ } ) );
22
+ const Component = withFallbackStyles( mapNodeToProps )( Wrapped );
23
+
24
+ render( <Component node={ node } /> );
25
+
26
+ // The rendered value proves the actual node was read by mapNodeToProps.
27
+ expect( mapNodeToProps ).toHaveBeenCalledWith(
28
+ node,
29
+ expect.objectContaining( { node } )
30
+ );
31
+ expect( screen.getByText( 'rgb(1, 2, 3)' ) ).toBeInTheDocument();
32
+ } );
33
+
34
+ it( 'derives the fallback styles from the internal wrapper node when no node prop is given', () => {
35
+ const mapNodeToProps = jest.fn( ( el: HTMLElement ) => ( {
36
+ fallbackColor: el.tagName.toLowerCase(),
37
+ } ) );
38
+ const Component = withFallbackStyles( mapNodeToProps )( Wrapped );
39
+
40
+ render( <Component /> );
41
+
42
+ // The HOC wraps in a <div>, so reading the node's tagName yields 'div'.
43
+ expect( mapNodeToProps ).toHaveBeenCalled();
44
+ expect( mapNodeToProps.mock.calls[ 0 ][ 0 ].tagName ).toBe( 'DIV' );
45
+ expect( screen.getByText( 'div' ) ).toBeInTheDocument();
46
+ } );
47
+ } );
@@ -14,7 +14,6 @@ const EnhancedComponent = withFocusReturn( () => (
14
14
  <div>
15
15
  Focus will return to the previous input when this component is unmounted
16
16
  <TextControl
17
- __next40pxDefaultSize
18
17
  autoFocus={ true }
19
18
  onChange={ () => {} }
20
19
  />
@@ -31,7 +30,6 @@ const MyComponentWithFocusReturn = () => {
31
30
  return (
32
31
  <div>
33
32
  <TextControl
34
- __next40pxDefaultSize
35
33
  placeholder="Type something"
36
34
  value={ text }
37
35
  onChange={ ( value ) => setText( value ) }
@@ -26,21 +26,6 @@ Default.args = {
26
26
  icon: wordpress,
27
27
  };
28
28
 
29
- export const FillColor: StoryFn< typeof Icon > = ( args ) => {
30
- return (
31
- <div
32
- style={ {
33
- fill: 'blue',
34
- } }
35
- >
36
- <Icon { ...args } />
37
- </div>
38
- );
39
- };
40
- FillColor.args = {
41
- ...Default.args,
42
- };
43
-
44
29
  /**
45
30
  * When `icon` is a function, it will be passed the `size` prop and any other additional props.
46
31
  */
@@ -306,7 +306,7 @@ that don't support the native `disabled` attribute.
306
306
  The checked state of the radio menu item when it is initially rendered.
307
307
  Use when not wanting to control its checked state.
308
308
 
309
- Note: this prop will be overriden by the `checked` prop, if it is defined.
309
+ Note: this prop will be overridden by the `checked` prop, if it is defined.
310
310
 
311
311
  ##### `hideOnClick`
312
312
 
@@ -404,7 +404,7 @@ that don't support the native `disabled` attribute.
404
404
  The checked state of the checkbox menu item when it is initially rendered.
405
405
  Use when not wanting to control its checked state.
406
406
 
407
- Note: this prop will be overriden by the `checked` prop, if it is defined.
407
+ Note: this prop will be overridden by the `checked` prop, if it is defined.
408
408
 
409
409
  ##### `hideOnClick`
410
410
 
@@ -22,7 +22,9 @@ const ITEM_PADDING_INLINE = space( 3 );
22
22
  // - border color and divider color are different from COLORS.theme variables
23
23
  // - lighter text color is not defined in COLORS.theme, should it be?
24
24
  // - lighter background color is not defined in COLORS.theme, should it be?
25
+ // TODO: should use the `stroke-surface-neutral` WPDS token when refactored to SCSS modules
25
26
  const DEFAULT_BORDER_COLOR = COLORS.theme.gray[ 300 ];
27
+ // TODO: should use the `stroke-surface-neutral-weak` WPDS token when refactored to SCSS modules
26
28
  const DIVIDER_COLOR = COLORS.theme.gray[ 200 ];
27
29
  const LIGHTER_TEXT_COLOR = COLORS.theme.gray[ 700 ];
28
30
  const LIGHT_BACKGROUND_COLOR = COLORS.theme.gray[ 100 ];