@wordpress/ui 0.4.0 → 0.5.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 (420) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE.md +1 -1
  3. package/README.md +18 -0
  4. package/build/badge/badge.cjs +95 -0
  5. package/build/badge/badge.cjs.map +7 -0
  6. package/build/{lock-unlock.js → badge/index.cjs} +8 -14
  7. package/build/badge/index.cjs.map +7 -0
  8. package/build/badge/types.cjs +19 -0
  9. package/build/badge/types.cjs.map +7 -0
  10. package/build/box/{box.js → box.cjs} +7 -6
  11. package/build/box/box.cjs.map +7 -0
  12. package/build/box/{index.js → index.cjs} +2 -2
  13. package/build/box/{types.js → types.cjs} +1 -1
  14. package/build/box/types.cjs.map +7 -0
  15. package/build/button/button.cjs +401 -0
  16. package/build/button/button.cjs.map +7 -0
  17. package/build/{utils/element.js → button/icon.cjs} +22 -20
  18. package/build/button/icon.cjs.map +7 -0
  19. package/build/button/index.cjs +39 -0
  20. package/build/button/index.cjs.map +7 -0
  21. package/build/button/types.cjs +19 -0
  22. package/build/button/types.cjs.map +7 -0
  23. package/build/form/primitives/field/control.cjs +38 -0
  24. package/build/form/primitives/field/control.cjs.map +7 -0
  25. package/build/form/primitives/field/description.cjs +92 -0
  26. package/build/form/primitives/field/description.cjs.map +7 -0
  27. package/build/form/primitives/field/details.cjs +99 -0
  28. package/build/form/primitives/field/details.cjs.map +7 -0
  29. package/build/form/primitives/field/index.cjs +46 -0
  30. package/build/form/primitives/field/index.cjs.map +7 -0
  31. package/build/form/primitives/field/item.cjs +36 -0
  32. package/build/form/primitives/field/item.cjs.map +7 -0
  33. package/build/form/primitives/field/label.cjs +98 -0
  34. package/build/form/primitives/field/label.cjs.map +7 -0
  35. package/build/form/primitives/field/root.cjs +79 -0
  36. package/build/form/primitives/field/root.cjs.map +7 -0
  37. package/build/form/primitives/field/types.cjs +19 -0
  38. package/build/form/primitives/field/types.cjs.map +7 -0
  39. package/build/form/primitives/fieldset/context.cjs +40 -0
  40. package/build/form/primitives/fieldset/context.cjs.map +7 -0
  41. package/build/form/primitives/fieldset/description.cjs +101 -0
  42. package/build/form/primitives/fieldset/description.cjs.map +7 -0
  43. package/build/form/primitives/fieldset/details.cjs +103 -0
  44. package/build/form/primitives/fieldset/details.cjs.map +7 -0
  45. package/build/form/primitives/fieldset/index.cjs +40 -0
  46. package/build/form/primitives/fieldset/index.cjs.map +7 -0
  47. package/build/form/primitives/fieldset/legend.cjs +94 -0
  48. package/build/form/primitives/fieldset/legend.cjs.map +7 -0
  49. package/build/form/primitives/fieldset/root.cjs +86 -0
  50. package/build/form/primitives/fieldset/root.cjs.map +7 -0
  51. package/build/form/primitives/fieldset/types.cjs +19 -0
  52. package/build/form/primitives/fieldset/types.cjs.map +7 -0
  53. package/build/form/primitives/index.cjs +50 -0
  54. package/build/form/primitives/index.cjs.map +7 -0
  55. package/build/form/primitives/input/index.cjs +31 -0
  56. package/build/form/primitives/input/index.cjs.map +7 -0
  57. package/build/form/primitives/input/input.cjs +148 -0
  58. package/build/form/primitives/input/input.cjs.map +7 -0
  59. package/build/form/primitives/input/types.cjs +19 -0
  60. package/build/form/primitives/input/types.cjs.map +7 -0
  61. package/build/form/primitives/input-layout/context.cjs +49 -0
  62. package/build/form/primitives/input-layout/context.cjs.map +7 -0
  63. package/build/form/primitives/input-layout/index.cjs +35 -0
  64. package/build/form/primitives/input-layout/index.cjs.map +7 -0
  65. package/build/form/primitives/input-layout/input-layout.cjs +196 -0
  66. package/build/form/primitives/input-layout/input-layout.cjs.map +7 -0
  67. package/build/form/primitives/input-layout/slot.cjs +165 -0
  68. package/build/form/primitives/input-layout/slot.cjs.map +7 -0
  69. package/build/form/primitives/input-layout/types.cjs +19 -0
  70. package/build/form/primitives/input-layout/types.cjs.map +7 -0
  71. package/build/icon/icon.cjs +46 -0
  72. package/build/icon/icon.cjs.map +7 -0
  73. package/build/{index.js → icon/index.cjs} +13 -7
  74. package/build/icon/index.cjs.map +7 -0
  75. package/build/icon/types.cjs +19 -0
  76. package/build/icon/types.cjs.map +7 -0
  77. package/build/index.cjs +37 -0
  78. package/build/index.cjs.map +7 -0
  79. package/build/stack/{index.js → index.cjs} +2 -2
  80. package/build/stack/index.cjs.map +7 -0
  81. package/build/stack/{stack.js → stack.cjs} +6 -18
  82. package/build/stack/stack.cjs.map +7 -0
  83. package/build/stack/{types.js → types.cjs} +1 -1
  84. package/build/stack/types.cjs.map +7 -0
  85. package/build/types/css-modules.d.cjs +2 -0
  86. package/build/types/css-modules.d.cjs.map +7 -0
  87. package/build/types/{react.d.js → react.d.cjs} +1 -1
  88. package/build/utils/{types.js → types.cjs} +1 -1
  89. package/build/visually-hidden/index.cjs +31 -0
  90. package/build/visually-hidden/index.cjs.map +7 -0
  91. package/build/visually-hidden/types.cjs +19 -0
  92. package/build/visually-hidden/types.cjs.map +7 -0
  93. package/build/visually-hidden/visually-hidden.cjs +69 -0
  94. package/build/visually-hidden/visually-hidden.cjs.map +7 -0
  95. package/build-module/badge/badge.mjs +70 -0
  96. package/build-module/badge/badge.mjs.map +7 -0
  97. package/build-module/badge/index.mjs +6 -0
  98. package/build-module/badge/index.mjs.map +7 -0
  99. package/build-module/badge/types.mjs +1 -0
  100. package/build-module/box/{box.js → box.mjs} +7 -6
  101. package/build-module/box/box.mjs.map +7 -0
  102. package/build-module/box/index.mjs +6 -0
  103. package/build-module/box/types.mjs +1 -0
  104. package/build-module/button/button.mjs +366 -0
  105. package/build-module/button/button.mjs.map +7 -0
  106. package/build-module/button/icon.mjs +22 -0
  107. package/build-module/button/icon.mjs.map +7 -0
  108. package/build-module/button/index.mjs +14 -0
  109. package/build-module/button/index.mjs.map +7 -0
  110. package/build-module/button/types.mjs +1 -0
  111. package/build-module/form/primitives/field/control.mjs +13 -0
  112. package/build-module/form/primitives/field/control.mjs.map +7 -0
  113. package/build-module/form/primitives/field/description.mjs +57 -0
  114. package/build-module/form/primitives/field/description.mjs.map +7 -0
  115. package/build-module/form/primitives/field/details.mjs +64 -0
  116. package/build-module/form/primitives/field/details.mjs.map +7 -0
  117. package/build-module/form/primitives/field/index.mjs +16 -0
  118. package/build-module/form/primitives/field/index.mjs.map +7 -0
  119. package/build-module/form/primitives/field/item.mjs +11 -0
  120. package/build-module/form/primitives/field/item.mjs.map +7 -0
  121. package/build-module/form/primitives/field/label.mjs +63 -0
  122. package/build-module/form/primitives/field/label.mjs.map +7 -0
  123. package/build-module/form/primitives/field/root.mjs +44 -0
  124. package/build-module/form/primitives/field/root.mjs.map +7 -0
  125. package/build-module/form/primitives/field/types.mjs +1 -0
  126. package/build-module/form/primitives/fieldset/context.mjs +14 -0
  127. package/build-module/form/primitives/fieldset/context.mjs.map +7 -0
  128. package/build-module/form/primitives/fieldset/description.mjs +66 -0
  129. package/build-module/form/primitives/fieldset/description.mjs.map +7 -0
  130. package/build-module/form/primitives/fieldset/details.mjs +68 -0
  131. package/build-module/form/primitives/fieldset/details.mjs.map +7 -0
  132. package/build-module/form/primitives/fieldset/index.mjs +12 -0
  133. package/build-module/form/primitives/fieldset/index.mjs.map +7 -0
  134. package/build-module/form/primitives/fieldset/legend.mjs +59 -0
  135. package/build-module/form/primitives/fieldset/legend.mjs.map +7 -0
  136. package/build-module/form/primitives/fieldset/root.mjs +51 -0
  137. package/build-module/form/primitives/fieldset/root.mjs.map +7 -0
  138. package/build-module/form/primitives/fieldset/types.mjs +1 -0
  139. package/build-module/form/primitives/index.mjs +12 -0
  140. package/build-module/form/primitives/index.mjs.map +7 -0
  141. package/build-module/form/primitives/input/index.mjs +6 -0
  142. package/build-module/form/primitives/input/index.mjs.map +7 -0
  143. package/build-module/form/primitives/input/input.mjs +113 -0
  144. package/build-module/form/primitives/input/input.mjs.map +7 -0
  145. package/build-module/form/primitives/input/types.mjs +1 -0
  146. package/build-module/form/primitives/input/types.mjs.map +7 -0
  147. package/build-module/form/primitives/input-layout/context.mjs +22 -0
  148. package/build-module/form/primitives/input-layout/context.mjs.map +7 -0
  149. package/build-module/form/primitives/input-layout/index.mjs +10 -0
  150. package/build-module/form/primitives/input-layout/index.mjs.map +7 -0
  151. package/build-module/form/primitives/input-layout/input-layout.mjs +161 -0
  152. package/build-module/form/primitives/input-layout/input-layout.mjs.map +7 -0
  153. package/build-module/form/primitives/input-layout/slot.mjs +130 -0
  154. package/build-module/form/primitives/input-layout/slot.mjs.map +7 -0
  155. package/build-module/form/primitives/input-layout/types.mjs +1 -0
  156. package/build-module/form/primitives/input-layout/types.mjs.map +7 -0
  157. package/build-module/icon/icon.mjs +21 -0
  158. package/build-module/icon/icon.mjs.map +7 -0
  159. package/build-module/icon/index.mjs +6 -0
  160. package/build-module/icon/index.mjs.map +7 -0
  161. package/build-module/icon/types.mjs +1 -0
  162. package/build-module/icon/types.mjs.map +7 -0
  163. package/build-module/index.mjs +9 -0
  164. package/build-module/index.mjs.map +7 -0
  165. package/build-module/stack/index.mjs +6 -0
  166. package/build-module/stack/index.mjs.map +7 -0
  167. package/build-module/stack/{stack.js → stack.mjs} +6 -8
  168. package/build-module/stack/stack.mjs.map +7 -0
  169. package/build-module/stack/types.mjs +1 -0
  170. package/build-module/stack/types.mjs.map +7 -0
  171. package/build-module/types/css-modules.d.mjs +1 -0
  172. package/build-module/types/css-modules.d.mjs.map +7 -0
  173. package/build-module/types/{react.d.js → react.d.mjs} +1 -1
  174. package/build-module/utils/types.mjs +1 -0
  175. package/build-module/utils/types.mjs.map +7 -0
  176. package/build-module/visually-hidden/index.mjs +6 -0
  177. package/build-module/visually-hidden/index.mjs.map +7 -0
  178. package/build-module/visually-hidden/types.mjs +1 -0
  179. package/build-module/visually-hidden/types.mjs.map +7 -0
  180. package/build-module/visually-hidden/visually-hidden.mjs +44 -0
  181. package/build-module/visually-hidden/visually-hidden.mjs.map +7 -0
  182. package/build-types/badge/badge.d.ts +7 -0
  183. package/build-types/badge/badge.d.ts.map +1 -0
  184. package/build-types/badge/index.d.ts +2 -0
  185. package/build-types/badge/index.d.ts.map +1 -0
  186. package/build-types/badge/stories/index.story.d.ts +15 -0
  187. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  188. package/build-types/badge/types.d.ts +14 -0
  189. package/build-types/badge/types.d.ts.map +1 -0
  190. package/build-types/box/box.d.ts +0 -3
  191. package/build-types/box/box.d.ts.map +1 -1
  192. package/build-types/box/stories/index.story.d.ts +1 -11
  193. package/build-types/box/stories/index.story.d.ts.map +1 -1
  194. package/build-types/box/types.d.ts +8 -15
  195. package/build-types/box/types.d.ts.map +1 -1
  196. package/build-types/button/button.d.ts +3 -0
  197. package/build-types/button/button.d.ts.map +1 -0
  198. package/build-types/button/icon.d.ts +10 -0
  199. package/build-types/button/icon.d.ts.map +1 -0
  200. package/build-types/button/index.d.ts +10 -0
  201. package/build-types/button/index.d.ts.map +1 -0
  202. package/build-types/button/stories/index.story.d.ts +23 -0
  203. package/build-types/button/stories/index.story.d.ts.map +1 -0
  204. package/build-types/button/test/button.test.d.ts +2 -0
  205. package/build-types/button/test/button.test.d.ts.map +1 -0
  206. package/build-types/button/test/icon.test.d.ts +2 -0
  207. package/build-types/button/test/icon.test.d.ts.map +1 -0
  208. package/build-types/button/types.d.ts +63 -0
  209. package/build-types/button/types.d.ts.map +1 -0
  210. package/build-types/form/primitives/field/control.d.ts +6 -0
  211. package/build-types/form/primitives/field/control.d.ts.map +1 -0
  212. package/build-types/form/primitives/field/description.d.ts +9 -0
  213. package/build-types/form/primitives/field/description.d.ts.map +1 -0
  214. package/build-types/form/primitives/field/details.d.ts +21 -0
  215. package/build-types/form/primitives/field/details.d.ts.map +1 -0
  216. package/build-types/form/primitives/field/index.d.ts +8 -0
  217. package/build-types/form/primitives/field/index.d.ts.map +1 -0
  218. package/build-types/form/primitives/field/item.d.ts +3 -0
  219. package/build-types/form/primitives/field/item.d.ts.map +1 -0
  220. package/build-types/form/primitives/field/label.d.ts +11 -0
  221. package/build-types/form/primitives/field/label.d.ts.map +1 -0
  222. package/build-types/form/primitives/field/root.d.ts +15 -0
  223. package/build-types/form/primitives/field/root.d.ts.map +1 -0
  224. package/build-types/form/primitives/field/stories/index.story.d.ts +39 -0
  225. package/build-types/form/primitives/field/stories/index.story.d.ts.map +1 -0
  226. package/build-types/form/primitives/field/test/index.test.d.ts +2 -0
  227. package/build-types/form/primitives/field/test/index.test.d.ts.map +1 -0
  228. package/build-types/form/primitives/field/types.d.ts +62 -0
  229. package/build-types/form/primitives/field/types.d.ts.map +1 -0
  230. package/build-types/form/primitives/fieldset/context.d.ts +8 -0
  231. package/build-types/form/primitives/fieldset/context.d.ts.map +1 -0
  232. package/build-types/form/primitives/fieldset/description.d.ts +9 -0
  233. package/build-types/form/primitives/fieldset/description.d.ts.map +1 -0
  234. package/build-types/form/primitives/fieldset/details.d.ts +21 -0
  235. package/build-types/form/primitives/fieldset/details.d.ts.map +1 -0
  236. package/build-types/form/primitives/fieldset/index.d.ts +6 -0
  237. package/build-types/form/primitives/fieldset/index.d.ts.map +1 -0
  238. package/build-types/form/primitives/fieldset/legend.d.ts +9 -0
  239. package/build-types/form/primitives/fieldset/legend.d.ts.map +1 -0
  240. package/build-types/form/primitives/fieldset/root.d.ts +15 -0
  241. package/build-types/form/primitives/fieldset/root.d.ts.map +1 -0
  242. package/build-types/form/primitives/fieldset/stories/index.story.d.ts +18 -0
  243. package/build-types/form/primitives/fieldset/stories/index.story.d.ts.map +1 -0
  244. package/build-types/form/primitives/fieldset/test/index.test.d.ts +2 -0
  245. package/build-types/form/primitives/fieldset/test/index.test.d.ts.map +1 -0
  246. package/build-types/form/primitives/fieldset/types.d.ts +32 -0
  247. package/build-types/form/primitives/fieldset/types.d.ts.map +1 -0
  248. package/build-types/form/primitives/index.d.ts +5 -0
  249. package/build-types/form/primitives/index.d.ts.map +1 -0
  250. package/build-types/form/primitives/input/index.d.ts +2 -0
  251. package/build-types/form/primitives/input/index.d.ts.map +1 -0
  252. package/build-types/form/primitives/input/input.d.ts +10 -0
  253. package/build-types/form/primitives/input/input.d.ts.map +1 -0
  254. package/build-types/form/primitives/input/stories/index.story.d.ts +13 -0
  255. package/build-types/form/primitives/input/stories/index.story.d.ts.map +1 -0
  256. package/build-types/form/primitives/input/test/index.test.d.ts +2 -0
  257. package/build-types/form/primitives/input/test/index.test.d.ts.map +1 -0
  258. package/build-types/form/primitives/input/types.d.ts +27 -0
  259. package/build-types/form/primitives/input/types.d.ts.map +1 -0
  260. package/build-types/form/primitives/input-layout/context.d.ts +17 -0
  261. package/build-types/form/primitives/input-layout/context.d.ts.map +1 -0
  262. package/build-types/form/primitives/input-layout/index.d.ts +4 -0
  263. package/build-types/form/primitives/input-layout/index.d.ts.map +1 -0
  264. package/build-types/form/primitives/input-layout/input-layout.d.ts +7 -0
  265. package/build-types/form/primitives/input-layout/input-layout.d.ts.map +1 -0
  266. package/build-types/form/primitives/input-layout/slot.d.ts +6 -0
  267. package/build-types/form/primitives/input-layout/slot.d.ts.map +1 -0
  268. package/build-types/form/primitives/input-layout/stories/index.story.d.ts +24 -0
  269. package/build-types/form/primitives/input-layout/stories/index.story.d.ts.map +1 -0
  270. package/build-types/form/primitives/input-layout/test/index.test.d.ts +2 -0
  271. package/build-types/form/primitives/input-layout/test/index.test.d.ts.map +1 -0
  272. package/build-types/form/primitives/input-layout/types.d.ts +41 -0
  273. package/build-types/form/primitives/input-layout/types.d.ts.map +1 -0
  274. package/build-types/icon/icon.d.ts +14 -0
  275. package/build-types/icon/icon.d.ts.map +1 -0
  276. package/build-types/icon/index.d.ts +2 -0
  277. package/build-types/icon/index.d.ts.map +1 -0
  278. package/build-types/icon/stories/index.story.d.ts +11 -0
  279. package/build-types/icon/stories/index.story.d.ts.map +1 -0
  280. package/build-types/icon/test/icon.test.d.ts +2 -0
  281. package/build-types/icon/test/icon.test.d.ts.map +1 -0
  282. package/build-types/icon/types.d.ts +15 -0
  283. package/build-types/icon/types.d.ts.map +1 -0
  284. package/build-types/index.d.ts +6 -0
  285. package/build-types/index.d.ts.map +1 -1
  286. package/build-types/stack/index.d.ts +0 -3
  287. package/build-types/stack/index.d.ts.map +1 -1
  288. package/build-types/stack/stack.d.ts.map +1 -1
  289. package/build-types/stack/stories/index.story.d.ts +1 -11
  290. package/build-types/stack/stories/index.story.d.ts.map +1 -1
  291. package/build-types/stack/types.d.ts +2 -5
  292. package/build-types/stack/types.d.ts.map +1 -1
  293. package/build-types/test/index.test.d.ts +2 -0
  294. package/build-types/test/index.test.d.ts.map +1 -0
  295. package/build-types/visually-hidden/index.d.ts +2 -0
  296. package/build-types/visually-hidden/index.d.ts.map +1 -0
  297. package/build-types/visually-hidden/stories/index.story.d.ts +7 -0
  298. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -0
  299. package/build-types/visually-hidden/test/visually-hidden.test.d.ts +2 -0
  300. package/build-types/visually-hidden/test/visually-hidden.test.d.ts.map +1 -0
  301. package/build-types/visually-hidden/types.d.ts +8 -0
  302. package/build-types/visually-hidden/types.d.ts.map +1 -0
  303. package/build-types/visually-hidden/visually-hidden.d.ts +7 -0
  304. package/build-types/visually-hidden/visually-hidden.d.ts.map +1 -0
  305. package/package.json +26 -9
  306. package/src/badge/badge.tsx +88 -0
  307. package/src/badge/index.ts +1 -0
  308. package/src/badge/stories/choosing-intent.mdx +112 -0
  309. package/src/badge/stories/index.story.tsx +120 -0
  310. package/src/badge/types.ts +22 -0
  311. package/src/box/box.tsx +11 -23
  312. package/src/box/stories/index.story.tsx +3 -15
  313. package/src/box/types.ts +16 -59
  314. package/src/button/button.tsx +57 -0
  315. package/src/button/icon.tsx +24 -0
  316. package/src/button/index.ts +16 -0
  317. package/src/button/stories/index.story.tsx +192 -0
  318. package/src/button/style.module.css +232 -0
  319. package/src/button/test/button.test.tsx +89 -0
  320. package/src/button/test/icon.test.tsx +13 -0
  321. package/src/button/types.ts +72 -0
  322. package/src/form/primitives/field/control.tsx +9 -0
  323. package/src/form/primitives/field/description.tsx +18 -0
  324. package/src/form/primitives/field/details.tsx +36 -0
  325. package/src/form/primitives/field/index.ts +8 -0
  326. package/src/form/primitives/field/item.tsx +9 -0
  327. package/src/form/primitives/field/label.tsx +21 -0
  328. package/src/form/primitives/field/root.tsx +33 -0
  329. package/src/form/primitives/field/stories/index.story.tsx +132 -0
  330. package/src/form/primitives/field/test/index.test.tsx +36 -0
  331. package/src/form/primitives/field/types.ts +82 -0
  332. package/src/form/primitives/fieldset/context.tsx +13 -0
  333. package/src/form/primitives/fieldset/description.tsx +36 -0
  334. package/src/form/primitives/fieldset/details.tsx +46 -0
  335. package/src/form/primitives/fieldset/index.ts +6 -0
  336. package/src/form/primitives/fieldset/legend.tsx +17 -0
  337. package/src/form/primitives/fieldset/root.tsx +42 -0
  338. package/src/form/primitives/fieldset/stories/index.story.tsx +67 -0
  339. package/src/form/primitives/fieldset/style.module.css +12 -0
  340. package/src/form/primitives/fieldset/test/index.test.tsx +135 -0
  341. package/src/form/primitives/fieldset/types.ts +35 -0
  342. package/src/form/primitives/index.ts +4 -0
  343. package/src/form/primitives/input/index.ts +1 -0
  344. package/src/form/primitives/input/input.tsx +28 -0
  345. package/src/form/primitives/input/stories/index.story.tsx +40 -0
  346. package/src/form/primitives/input/style.module.css +34 -0
  347. package/src/form/primitives/input/test/index.test.tsx +13 -0
  348. package/src/form/primitives/input/types.ts +31 -0
  349. package/src/form/primitives/input-layout/context.tsx +36 -0
  350. package/src/form/primitives/input-layout/index.ts +6 -0
  351. package/src/form/primitives/input-layout/input-layout.tsx +49 -0
  352. package/src/form/primitives/input-layout/slot.tsx +39 -0
  353. package/src/form/primitives/input-layout/stories/index.story.tsx +67 -0
  354. package/src/form/primitives/input-layout/style.module.css +82 -0
  355. package/src/form/primitives/input-layout/test/index.test.tsx +23 -0
  356. package/src/form/primitives/input-layout/types.ts +44 -0
  357. package/src/icon/icon.tsx +30 -0
  358. package/src/icon/index.ts +1 -0
  359. package/src/icon/stories/index.story.tsx +47 -0
  360. package/src/icon/test/icon.test.tsx +13 -0
  361. package/src/icon/types.ts +14 -0
  362. package/src/index.ts +6 -0
  363. package/src/stack/index.ts +0 -3
  364. package/src/stack/stack.tsx +5 -18
  365. package/src/stack/stories/index.story.tsx +1 -14
  366. package/src/stack/test/stack.test.tsx +22 -12
  367. package/src/stack/types.ts +2 -6
  368. package/src/stories/introduction.mdx +6 -0
  369. package/src/test/index.test.ts +22 -0
  370. package/src/utils/css/field.module.css +27 -0
  371. package/src/utils/css/focus.module.css +31 -0
  372. package/src/utils/css/resets.module.css +13 -0
  373. package/src/visually-hidden/index.ts +1 -0
  374. package/src/visually-hidden/stories/index.story.tsx +22 -0
  375. package/src/visually-hidden/style.module.css +15 -0
  376. package/src/visually-hidden/test/visually-hidden.test.tsx +59 -0
  377. package/src/visually-hidden/types.ts +8 -0
  378. package/src/visually-hidden/visually-hidden.tsx +23 -0
  379. package/build/box/box.js.map +0 -7
  380. package/build/box/types.js.map +0 -7
  381. package/build/index.js.map +0 -7
  382. package/build/lock-unlock.js.map +0 -7
  383. package/build/stack/index.js.map +0 -7
  384. package/build/stack/stack.js.map +0 -7
  385. package/build/stack/types.js.map +0 -7
  386. package/build/types/css-modules.d.js +0 -2
  387. package/build/utils/element.js.map +0 -7
  388. package/build-module/box/box.js.map +0 -7
  389. package/build-module/box/index.js +0 -6
  390. package/build-module/box/types.js +0 -1
  391. package/build-module/index.js +0 -3
  392. package/build-module/index.js.map +0 -7
  393. package/build-module/lock-unlock.js +0 -11
  394. package/build-module/lock-unlock.js.map +0 -7
  395. package/build-module/stack/index.js +0 -6
  396. package/build-module/stack/index.js.map +0 -7
  397. package/build-module/stack/stack.js.map +0 -7
  398. package/build-module/stack/types.js +0 -1
  399. package/build-module/types/css-modules.d.js +0 -1
  400. package/build-module/utils/element.js +0 -20
  401. package/build-module/utils/element.js.map +0 -7
  402. package/build-module/utils/types.js +0 -1
  403. package/build-types/lock-unlock.d.ts +0 -2
  404. package/build-types/lock-unlock.d.ts.map +0 -1
  405. package/build-types/utils/element.d.ts +0 -25
  406. package/build-types/utils/element.d.ts.map +0 -1
  407. package/src/lock-unlock.ts +0 -10
  408. package/src/utils/element.ts +0 -51
  409. package/tsconfig.json +0 -13
  410. package/tsconfig.tsbuildinfo +0 -1
  411. /package/build/box/{index.js.map → index.cjs.map} +0 -0
  412. /package/build/types/{react.d.js.map → react.d.cjs.map} +0 -0
  413. /package/build/utils/{types.js.map → types.cjs.map} +0 -0
  414. /package/build-module/{box/types.js.map → badge/types.mjs.map} +0 -0
  415. /package/build-module/box/{index.js.map → index.mjs.map} +0 -0
  416. /package/build-module/{stack/types.js.map → box/types.mjs.map} +0 -0
  417. /package/build-module/{types/css-modules.d.js.map → button/types.mjs.map} +0 -0
  418. /package/build-module/{utils/types.js.map → form/primitives/field/types.mjs.map} +0 -0
  419. /package/{build/types/css-modules.d.js.map → build-module/form/primitives/fieldset/types.mjs.map} +0 -0
  420. /package/build-module/types/{react.d.js.map → react.d.mjs.map} +0 -0
@@ -0,0 +1,35 @@
1
+ import type { Fieldset as _Fieldset } from '@base-ui/react';
2
+ import type { ComponentProps } from '../../../utils/types';
3
+
4
+ export type FieldsetRootProps = ComponentProps< typeof _Fieldset.Root > & {
5
+ children?: React.ReactNode;
6
+ };
7
+
8
+ export type FieldsetLegendProps = ComponentProps< typeof _Fieldset.Legend > & {
9
+ children?: React.ReactNode;
10
+ };
11
+
12
+ export type FieldsetDescriptionProps = ComponentProps< 'p' > & {
13
+ /**
14
+ * The accessible description, associated using `aria-describedby`.
15
+ *
16
+ * For screen reader accessibility, this should only contain plain text,
17
+ * and no semantics such as links.
18
+ */
19
+ children?: string;
20
+ };
21
+
22
+ export type FieldsetDetailsProps = ComponentProps< 'div' > & {
23
+ /**
24
+ * Additional information about the fieldset, which unlike a normal description,
25
+ * can include links and other semantic elements.
26
+ *
27
+ * Although this content is not associated with the fieldset using direct semantics,
28
+ * it is made discoverable to screen reader users via a visually hidden description,
29
+ * alerting them to the presence of additional information below.
30
+ *
31
+ * Do not use this component when the details content is only plain text,
32
+ * as it makes the readout unnecessarily verbose for screen reader users.
33
+ */
34
+ children?: React.ReactNode;
35
+ };
@@ -0,0 +1,4 @@
1
+ export * as Field from './field';
2
+ export * as Fieldset from './fieldset';
3
+ export { Input } from './input';
4
+ export { InputLayout } from './input-layout';
@@ -0,0 +1 @@
1
+ export { Input } from './input';
@@ -0,0 +1,28 @@
1
+ import { Input as _Input } from '@base-ui/react/input';
2
+ import clsx from 'clsx';
3
+ import { forwardRef } from '@wordpress/element';
4
+ import focusStyles from '../../../utils/css/focus.module.css';
5
+ import styles from './style.module.css';
6
+ import type { InputProps } from './types';
7
+ import { InputLayout } from '../input-layout';
8
+
9
+ export const Input = forwardRef< HTMLInputElement, InputProps >( function Input(
10
+ { className, size = 'default', prefix, suffix, style, ...restProps },
11
+ ref
12
+ ) {
13
+ return (
14
+ <InputLayout
15
+ className={ clsx(
16
+ focusStyles[ 'outset-ring--focus-within' ],
17
+ className
18
+ ) }
19
+ style={ style }
20
+ size={ size }
21
+ visuallyDisabled={ restProps.disabled }
22
+ prefix={ prefix }
23
+ suffix={ suffix }
24
+ >
25
+ <_Input ref={ ref } className={ styles.input } { ...restProps } />
26
+ </InputLayout>
27
+ );
28
+ } );
@@ -0,0 +1,40 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { Input, InputLayout } from '../../../..';
3
+
4
+ const meta: Meta< typeof Input > = {
5
+ title: 'Design System/Components/Form/Primitives/Input',
6
+ component: Input,
7
+ argTypes: {
8
+ defaultValue: { control: false },
9
+ onValueChange: { action: 'onValueChange' },
10
+ value: { control: false },
11
+ type: { control: 'text' },
12
+ },
13
+ };
14
+ export default meta;
15
+
16
+ type Story = StoryObj< typeof Input >;
17
+
18
+ export const Default: Story = {
19
+ args: {
20
+ placeholder: 'Placeholder',
21
+ },
22
+ };
23
+
24
+ /**
25
+ * The `InputLayout.Slot` component can be used to add standard padding in
26
+ * the `prefix` or `suffix` slot.
27
+ */
28
+ export const WithPrefix: Story = {
29
+ args: {
30
+ placeholder: 'username',
31
+ prefix: <InputLayout.Slot>@</InputLayout.Slot>,
32
+ },
33
+ };
34
+
35
+ export const Disabled: Story = {
36
+ args: {
37
+ ...Default.args,
38
+ disabled: true,
39
+ },
40
+ };
@@ -0,0 +1,34 @@
1
+ @layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
2
+
3
+ @layer wp-ui-components {
4
+ .input {
5
+ padding-block: var(--wp-ui-input-padding-block, 0);
6
+ padding-inline: var(--wp-ui-input-layout-padding-inline, 0);
7
+ width: 100%;
8
+ background: transparent;
9
+ border: none;
10
+ outline: none;
11
+ color: var(--wpds-color-fg-interactive-neutral);
12
+ font-family: inherit;
13
+ font-size: inherit;
14
+ line-height: inherit;
15
+
16
+ &::placeholder {
17
+ color: var(--wpds-color-fg-interactive-neutral-disabled);
18
+ }
19
+
20
+ &:disabled,
21
+ &[aria-disabled="true"] {
22
+ color: var(--wpds-color-fg-interactive-neutral-disabled);
23
+
24
+ @media ( forced-colors: active ) {
25
+ color: GrayText;
26
+ }
27
+ }
28
+
29
+ &[type="email"],
30
+ &[type="url"] {
31
+ direction: ltr; /* maintain LTR in RTL languages */
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,13 @@
1
+ import { render } from '@testing-library/react';
2
+ import { createRef } from '@wordpress/element';
3
+ import { Input } from '../index';
4
+
5
+ describe( 'Input', () => {
6
+ it( 'forwards ref', () => {
7
+ const ref = createRef< HTMLInputElement >();
8
+
9
+ render( <Input ref={ ref } /> );
10
+
11
+ expect( ref.current ).toBeInstanceOf( HTMLInputElement );
12
+ } );
13
+ } );
@@ -0,0 +1,31 @@
1
+ import type { Input } from '@base-ui/react/input';
2
+ import type { InputLayoutProps } from '../input-layout/types';
3
+ import type { ComponentProps } from '../../../utils/types';
4
+
5
+ export type InputProps = Omit<
6
+ ComponentProps< typeof Input >,
7
+ 'value' | 'defaultValue' | 'type' | 'disabled' | 'prefix' | 'size'
8
+ > &
9
+ Pick< InputLayoutProps, 'prefix' | 'suffix' > & {
10
+ /**
11
+ * Whether the field is disabled.
12
+ */
13
+ disabled?: boolean;
14
+ } & {
15
+ /**
16
+ * The type of the input element.
17
+ */
18
+ type?: Input.Props[ 'type' ];
19
+ /**
20
+ * The default value to use in uncontrolled mode.
21
+ */
22
+ defaultValue?: Input.Props[ 'defaultValue' ];
23
+ /**
24
+ * The value to use in controlled mode.
25
+ */
26
+ value?: Input.Props[ 'value' ];
27
+ /**
28
+ * The size of the field.
29
+ */
30
+ size?: Exclude< InputLayoutProps[ 'size' ], 'small' >;
31
+ };
@@ -0,0 +1,36 @@
1
+ import { Children, createContext, useContext } from '@wordpress/element';
2
+ import type { InputLayoutSlotType } from './types';
3
+
4
+ /**
5
+ * Context for providing slot type information to child components.
6
+ */
7
+ export const InputLayoutSlotTypeContext =
8
+ createContext< InputLayoutSlotType | null >( null );
9
+
10
+ /**
11
+ * Hook to access the current slot context.
12
+ */
13
+ export function useInputLayoutSlotContext() {
14
+ return useContext( InputLayoutSlotTypeContext );
15
+ }
16
+
17
+ /**
18
+ * Wrapper component that provides slot type context for prefix and suffix slots.
19
+ */
20
+ export function SlotContextProvider( {
21
+ type,
22
+ children,
23
+ }: {
24
+ type: InputLayoutSlotType;
25
+ children: React.ReactNode;
26
+ } ) {
27
+ if ( Children.count( children ) === 0 ) {
28
+ return null;
29
+ }
30
+
31
+ return (
32
+ <InputLayoutSlotTypeContext.Provider value={ type }>
33
+ { children }
34
+ </InputLayoutSlotTypeContext.Provider>
35
+ );
36
+ }
@@ -0,0 +1,6 @@
1
+ import { InputLayout as _InputLayout } from './input-layout';
2
+ import { InputLayoutSlot } from './slot';
3
+
4
+ export const InputLayout = Object.assign( _InputLayout, {
5
+ Slot: InputLayoutSlot,
6
+ } );
@@ -0,0 +1,49 @@
1
+ import clsx from 'clsx';
2
+ import { forwardRef } from '@wordpress/element';
3
+ import resetStyles from '../../../utils/css/resets.module.css';
4
+ import styles from './style.module.css';
5
+ import type { InputLayoutProps } from './types';
6
+ import { SlotContextProvider } from './context';
7
+
8
+ /**
9
+ * A low-level component that handles the visual layout of an input-like field,
10
+ * including disabled states and standard prefix/suffix slots.
11
+ */
12
+ export const InputLayout = forwardRef< HTMLDivElement, InputLayoutProps >(
13
+ function InputLayout(
14
+ {
15
+ className,
16
+ children,
17
+ visuallyDisabled,
18
+ size = 'default',
19
+ isBorderless,
20
+ prefix,
21
+ suffix,
22
+ ...restProps
23
+ },
24
+ ref
25
+ ) {
26
+ return (
27
+ <div
28
+ ref={ ref }
29
+ className={ clsx(
30
+ resetStyles[ 'box-sizing' ],
31
+ styles[ 'input-layout' ],
32
+ styles[ `is-size-${ size }` ],
33
+ visuallyDisabled && styles[ 'is-disabled' ],
34
+ isBorderless && styles[ 'is-borderless' ],
35
+ className
36
+ ) }
37
+ { ...restProps }
38
+ >
39
+ <SlotContextProvider type="prefix">
40
+ { prefix }
41
+ </SlotContextProvider>
42
+ { children }
43
+ <SlotContextProvider type="suffix">
44
+ { suffix }
45
+ </SlotContextProvider>
46
+ </div>
47
+ );
48
+ }
49
+ );
@@ -0,0 +1,39 @@
1
+ import clsx from 'clsx';
2
+ import { forwardRef } from '@wordpress/element';
3
+ import styles from './style.module.css';
4
+ import type { InputLayoutSlotProps } from './types';
5
+ import { useInputLayoutSlotContext } from './context';
6
+
7
+ /**
8
+ * A layout helper to add paddings in a prefix or suffix.
9
+ */
10
+ export const InputLayoutSlot = forwardRef<
11
+ HTMLDivElement,
12
+ InputLayoutSlotProps
13
+ >( function InputLayoutSlot(
14
+ { type: typeProp, padding = 'default', ...restProps },
15
+ ref
16
+ ) {
17
+ const typeContext = useInputLayoutSlotContext();
18
+ const type = typeProp ?? typeContext;
19
+
20
+ if ( ! type ) {
21
+ throw new Error(
22
+ 'InputLayoutSlot requires a `type` prop or must be used within an InputLayout prefix/suffix slot.'
23
+ );
24
+ }
25
+
26
+ return (
27
+ <div
28
+ ref={ ref }
29
+ className={ clsx(
30
+ styles[ 'input-layout-slot' ],
31
+ styles[ `is-${ type }` ],
32
+ styles[ `is-padding-${ padding }` ]
33
+ ) }
34
+ { ...restProps }
35
+ />
36
+ );
37
+ } );
38
+
39
+ InputLayoutSlot.displayName = 'InputLayout.Slot';
@@ -0,0 +1,67 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { InputLayout } from '../../../..';
3
+
4
+ const meta: Meta< typeof InputLayout > = {
5
+ title: 'Design System/Components/Form/Primitives/InputLayout',
6
+ component: InputLayout,
7
+ subcomponents: {
8
+ Slot: InputLayout.Slot,
9
+ },
10
+ };
11
+ export default meta;
12
+
13
+ type Story = StoryObj< typeof InputLayout >;
14
+
15
+ export const Default: Story = {
16
+ args: {},
17
+ };
18
+
19
+ /**
20
+ * By default, the `prefix` and `suffix` slots are rendered with no padding.
21
+ */
22
+ export const WithPrefix: Story = {
23
+ args: {
24
+ prefix: (
25
+ <div
26
+ style={ {
27
+ display: 'flex',
28
+ alignItems: 'center',
29
+ justifyContent: 'center',
30
+ height: '100%',
31
+ aspectRatio: '1 / 1',
32
+ background: '#eee',
33
+ } }
34
+ >
35
+ $
36
+ </div>
37
+ ),
38
+ },
39
+ };
40
+
41
+ /**
42
+ * The `InputLayout.Slot` component can be used to add standard padding in
43
+ * the `prefix` or `suffix` slot.
44
+ *
45
+ * The `padding="minimal"` setting will work best when the slot content is a button or icon.
46
+ */
47
+ export const WithPaddedPrefix: Story = {
48
+ args: {
49
+ prefix: <InputLayout.Slot>https://</InputLayout.Slot>,
50
+ },
51
+ };
52
+
53
+ export const Compact: Story = {
54
+ args: {
55
+ size: 'compact',
56
+ },
57
+ };
58
+
59
+ /**
60
+ * The `small` size is intended only for rare cases like the trigger
61
+ * button of a low-profile `select` element.
62
+ */
63
+ export const Small: Story = {
64
+ args: {
65
+ size: 'small',
66
+ },
67
+ };
@@ -0,0 +1,82 @@
1
+ @layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
2
+
3
+ @layer wp-ui-components {
4
+ .input-layout {
5
+ /* TODO: Use padding tokens */
6
+ --wp-ui-input-layout-padding-inline: calc(var(--wpds-dimension-base) * 3);
7
+
8
+ display: flex;
9
+ height: 40px;
10
+ background-color: var(--wpds-color-bg-interactive-neutral-weak);
11
+ border-width: var(--wpds-border-width-surface-xs);
12
+ border-style: solid;
13
+ border-color: var(--wpds-color-stroke-interactive-neutral);
14
+ border-radius: var(--wpds-border-radius-surface-sm);
15
+ font-family: var(--wpds-font-family-body);
16
+ font-size: max(var(--wpds-font-size-md), 16px); /* avoid mobile zoom */
17
+ line-height: 1;
18
+ color: var(--wpds-color-fg-interactive-neutral);
19
+
20
+ @media (min-width: 600px) {
21
+ font-size: var(--wpds-font-size-md);
22
+ }
23
+
24
+ &.is-size-compact {
25
+ /* TODO: Use padding tokens */
26
+ --wp-ui-input-layout-padding-inline: calc(var(--wpds-dimension-base) * 2);
27
+ height: 32px;
28
+ }
29
+
30
+ &.is-size-small {
31
+ /* TODO: Use padding tokens */
32
+ --wp-ui-input-layout-padding-inline: calc(var(--wpds-dimension-base) * 2);
33
+ height: 24px;
34
+ }
35
+
36
+ &.is-disabled {
37
+ background-color: var(--wpds-color-bg-interactive-neutral-weak-disabled);
38
+ border-color: var(--wpds-color-stroke-interactive-neutral-disabled);
39
+ color: var(--wpds-color-fg-interactive-neutral-disabled);
40
+
41
+ @media (forced-colors: active) {
42
+ border-color: GrayText;
43
+ color: GrayText;
44
+ }
45
+ }
46
+
47
+ &.is-borderless {
48
+ border-color: transparent;
49
+ }
50
+
51
+ /* Don't show focus ring when the focus is in the prefix or suffix slots */
52
+ &:has(.input-layout-slot:focus-within) {
53
+ outline: none;
54
+ }
55
+
56
+ &:hover:not(.is-disabled, .is-borderless) {
57
+ border-color: var(--wpds-color-stroke-interactive-neutral-active);
58
+ }
59
+ }
60
+
61
+ .input-layout-slot {
62
+ display: flex;
63
+ align-items: center;
64
+
65
+ &.is-padding-minimal {
66
+ --wp-ui-input-layout-prefix-padding-start:
67
+ calc(var(--wp-ui-input-layout-padding-inline) -
68
+ var(--wpds-dimension-base));
69
+ --wp-ui-input-layout-suffix-padding-end:
70
+ calc(var(--wp-ui-input-layout-padding-inline) -
71
+ var(--wpds-dimension-base));
72
+ }
73
+
74
+ &.is-prefix {
75
+ padding-inline-start: var(--wp-ui-input-layout-prefix-padding-start, var(--wp-ui-input-layout-padding-inline));
76
+ }
77
+
78
+ &.is-suffix {
79
+ padding-inline-end: var(--wp-ui-input-layout-suffix-padding-end, var(--wp-ui-input-layout-padding-inline));
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,23 @@
1
+ import { render } from '@testing-library/react';
2
+ import { createRef } from '@wordpress/element';
3
+ import { InputLayout } from '../index';
4
+ import { InputLayoutSlot } from '../slot';
5
+
6
+ describe( 'InputLayout', () => {
7
+ it( 'forwards ref', () => {
8
+ const layoutRef = createRef< HTMLDivElement >();
9
+ const slotRef = createRef< HTMLDivElement >();
10
+
11
+ render(
12
+ <InputLayout
13
+ ref={ layoutRef }
14
+ prefix={
15
+ <InputLayoutSlot ref={ slotRef }>Prefix</InputLayoutSlot>
16
+ }
17
+ />
18
+ );
19
+
20
+ expect( layoutRef.current ).toBeInstanceOf( HTMLDivElement );
21
+ expect( slotRef.current ).toBeInstanceOf( HTMLDivElement );
22
+ } );
23
+ } );
@@ -0,0 +1,44 @@
1
+ export interface InputLayoutProps
2
+ extends Omit< React.HTMLAttributes< HTMLDivElement >, 'prefix' > {
3
+ /**
4
+ * Whether the field should be visually styled as disabled.
5
+ */
6
+ visuallyDisabled?: boolean;
7
+ /**
8
+ * The size of the field.
9
+ *
10
+ * @default 'default'
11
+ */
12
+ size?: 'default' | 'compact' | 'small';
13
+ /**
14
+ * Whether the field should hide the border.
15
+ */
16
+ isBorderless?: boolean;
17
+ /**
18
+ * Element to render before the input.
19
+ */
20
+ prefix?: React.ReactNode;
21
+ /**
22
+ * Element to render after the input.
23
+ */
24
+ suffix?: React.ReactNode;
25
+ }
26
+
27
+ export type InputLayoutSlotType = 'prefix' | 'suffix';
28
+
29
+ export interface InputLayoutSlotProps
30
+ extends Omit< React.HTMLAttributes< HTMLDivElement >, 'type' > {
31
+ /**
32
+ * The type of the slot.
33
+ *
34
+ * When not provided, the type will be automatically inferred from the
35
+ * `InputLayout` context if the slot is used within a `prefix` or `suffix`.
36
+ */
37
+ type?: InputLayoutSlotType;
38
+ /**
39
+ * The padding of the slot.
40
+ *
41
+ * `minimal` will work best when the slot content is a button or icon.
42
+ */
43
+ padding?: 'default' | 'minimal';
44
+ }
@@ -0,0 +1,30 @@
1
+ import { forwardRef } from '@wordpress/element';
2
+ import { SVG } from '@wordpress/primitives';
3
+ import type { IconProps } from './types';
4
+
5
+ /**
6
+ * Renders an SVG icon with a 24px default size.
7
+ *
8
+ * If no `fill` colors are explicitly set on the icon itself, it will be rendered with a `currentColor` fill.
9
+ *
10
+ * ```jsx
11
+ * import { wordpress } from '@wordpress/icons';
12
+ *
13
+ * <Icon icon={ wordpress } />
14
+ * ```
15
+ */
16
+ export const Icon = forwardRef< SVGSVGElement, IconProps >( function Icon(
17
+ { icon, size = 24, ...restProps },
18
+ ref
19
+ ) {
20
+ return (
21
+ <SVG
22
+ ref={ ref }
23
+ fill="currentColor"
24
+ { ...icon.props }
25
+ { ...restProps }
26
+ width={ size }
27
+ height={ size }
28
+ />
29
+ );
30
+ } );
@@ -0,0 +1 @@
1
+ export { Icon } from './icon';
@@ -0,0 +1,47 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { wordpress } from '@wordpress/icons';
3
+ import { Icon } from '../index';
4
+
5
+ const meta: Meta< typeof Icon > = {
6
+ title: 'Design System/Components/Icon',
7
+ component: Icon,
8
+ decorators: [
9
+ ( Story ) => {
10
+ return (
11
+ <div
12
+ style={ {
13
+ color: 'var( --wpds-color-fg-content-neutral )',
14
+ } }
15
+ >
16
+ <Story />
17
+ </div>
18
+ );
19
+ },
20
+ ],
21
+ };
22
+ export default meta;
23
+
24
+ type Story = StoryObj< typeof Icon >;
25
+
26
+ export const Default: Story = {
27
+ args: {
28
+ icon: wordpress,
29
+ },
30
+ };
31
+
32
+ /**
33
+ * Explicit `fill` colors in the icon will be preserved.
34
+ */
35
+ export const WithIntrinsicFillColor: Story = {
36
+ args: {
37
+ icon: (
38
+ <svg
39
+ xmlns="http://www.w3.org/2000/svg"
40
+ viewBox="0 0 24 24"
41
+ fill="blue"
42
+ >
43
+ <rect x="0" y="0" width="24" height="24" />
44
+ </svg>
45
+ ),
46
+ },
47
+ };
@@ -0,0 +1,13 @@
1
+ import { render } from '@testing-library/react';
2
+ import { createRef } from '@wordpress/element';
3
+ import { Icon } from '../index';
4
+
5
+ describe( 'Icon', () => {
6
+ it( 'forwards ref', () => {
7
+ const ref = createRef< SVGSVGElement >();
8
+
9
+ render( <Icon ref={ ref } icon={ <svg /> } /> );
10
+
11
+ expect( ref.current ).toBeInstanceOf( SVGSVGElement );
12
+ } );
13
+ } );
@@ -0,0 +1,14 @@
1
+ export type IconProps = React.ComponentProps< 'svg' > & {
2
+ /**
3
+ * The icon to render, which must be an svg element or an `SVG` from `@wordpress/primitives`.
4
+ *
5
+ * In most cases, you should use an icon from
6
+ * [the `@wordpress/icons` package](https://wordpress.github.io/gutenberg/?path=/story/icons-icon--library).
7
+ */
8
+ icon: React.ReactElement< React.ComponentProps< 'svg' > >;
9
+ /**
10
+ * The size (width and height) of the icon.
11
+ * @default 24
12
+ */
13
+ size?: number;
14
+ };
package/src/index.ts CHANGED
@@ -1 +1,7 @@
1
+ export * from './badge';
1
2
  export * from './box';
3
+ export * from './button';
4
+ export * from './form/primitives';
5
+ export * from './icon';
6
+ export * from './stack';
7
+ export * from './visually-hidden';
@@ -1,4 +1 @@
1
- /**
2
- * Internal dependencies
3
- */
4
1
  export { Stack } from './stack';