@wordpress/ui 0.4.0 → 0.4.1-next.76cff8c98.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 (227) hide show
  1. package/CHANGELOG.md +15 -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/{index.js → badge/index.cjs} +13 -7
  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/{utils/element.js → form/primitives/field/control.cjs} +13 -20
  16. package/build/form/primitives/field/control.cjs.map +7 -0
  17. package/build/form/primitives/field/description.cjs +92 -0
  18. package/build/form/primitives/field/description.cjs.map +7 -0
  19. package/build/form/primitives/field/details.cjs +99 -0
  20. package/build/form/primitives/field/details.cjs.map +7 -0
  21. package/build/form/primitives/field/index.cjs +46 -0
  22. package/build/form/primitives/field/index.cjs.map +7 -0
  23. package/build/{lock-unlock.js → form/primitives/field/item.cjs} +13 -14
  24. package/build/form/primitives/field/item.cjs.map +7 -0
  25. package/build/form/primitives/field/label.cjs +98 -0
  26. package/build/form/primitives/field/label.cjs.map +7 -0
  27. package/build/form/primitives/field/root.cjs +79 -0
  28. package/build/form/primitives/field/root.cjs.map +7 -0
  29. package/build/form/primitives/field/types.cjs +19 -0
  30. package/build/form/primitives/field/types.cjs.map +7 -0
  31. package/build/form/primitives/index.cjs +41 -0
  32. package/build/form/primitives/index.cjs.map +7 -0
  33. package/build/index.cjs +33 -0
  34. package/build/index.cjs.map +7 -0
  35. package/build/stack/{index.js → index.cjs} +2 -2
  36. package/build/stack/index.cjs.map +7 -0
  37. package/build/stack/{stack.js → stack.cjs} +6 -18
  38. package/build/stack/stack.cjs.map +7 -0
  39. package/build/stack/{types.js → types.cjs} +1 -1
  40. package/build/stack/types.cjs.map +7 -0
  41. package/build/types/css-modules.d.cjs +2 -0
  42. package/build/types/css-modules.d.cjs.map +7 -0
  43. package/build/types/{react.d.js → react.d.cjs} +1 -1
  44. package/build/utils/{types.js → types.cjs} +1 -1
  45. package/build/visually-hidden/index.cjs +31 -0
  46. package/build/visually-hidden/index.cjs.map +7 -0
  47. package/build/visually-hidden/types.cjs +19 -0
  48. package/build/visually-hidden/types.cjs.map +7 -0
  49. package/build/visually-hidden/visually-hidden.cjs +69 -0
  50. package/build/visually-hidden/visually-hidden.cjs.map +7 -0
  51. package/build-module/badge/badge.mjs +70 -0
  52. package/build-module/badge/badge.mjs.map +7 -0
  53. package/build-module/badge/index.mjs +6 -0
  54. package/build-module/badge/index.mjs.map +7 -0
  55. package/build-module/badge/types.mjs +1 -0
  56. package/build-module/box/{box.js → box.mjs} +7 -6
  57. package/build-module/box/box.mjs.map +7 -0
  58. package/build-module/box/index.mjs +6 -0
  59. package/build-module/box/types.mjs +1 -0
  60. package/build-module/form/primitives/field/control.mjs +13 -0
  61. package/build-module/form/primitives/field/control.mjs.map +7 -0
  62. package/build-module/form/primitives/field/description.mjs +57 -0
  63. package/build-module/form/primitives/field/description.mjs.map +7 -0
  64. package/build-module/form/primitives/field/details.mjs +64 -0
  65. package/build-module/form/primitives/field/details.mjs.map +7 -0
  66. package/build-module/form/primitives/field/index.mjs +16 -0
  67. package/build-module/form/primitives/field/index.mjs.map +7 -0
  68. package/build-module/form/primitives/field/item.mjs +11 -0
  69. package/build-module/form/primitives/field/item.mjs.map +7 -0
  70. package/build-module/form/primitives/field/label.mjs +63 -0
  71. package/build-module/form/primitives/field/label.mjs.map +7 -0
  72. package/build-module/form/primitives/field/root.mjs +44 -0
  73. package/build-module/form/primitives/field/root.mjs.map +7 -0
  74. package/build-module/form/primitives/field/types.mjs +1 -0
  75. package/build-module/form/primitives/index.mjs +6 -0
  76. package/build-module/form/primitives/index.mjs.map +7 -0
  77. package/build-module/index.mjs +7 -0
  78. package/build-module/index.mjs.map +7 -0
  79. package/build-module/stack/index.mjs +6 -0
  80. package/build-module/stack/index.mjs.map +7 -0
  81. package/build-module/stack/{stack.js → stack.mjs} +6 -8
  82. package/build-module/stack/stack.mjs.map +7 -0
  83. package/build-module/stack/types.mjs +1 -0
  84. package/build-module/types/css-modules.d.mjs +1 -0
  85. package/build-module/types/{react.d.js → react.d.mjs} +1 -1
  86. package/build-module/utils/types.mjs +1 -0
  87. package/build-module/utils/types.mjs.map +7 -0
  88. package/build-module/visually-hidden/index.mjs +6 -0
  89. package/build-module/visually-hidden/index.mjs.map +7 -0
  90. package/build-module/visually-hidden/types.mjs +1 -0
  91. package/build-module/visually-hidden/types.mjs.map +7 -0
  92. package/build-module/visually-hidden/visually-hidden.mjs +44 -0
  93. package/build-module/visually-hidden/visually-hidden.mjs.map +7 -0
  94. package/build-types/badge/badge.d.ts +7 -0
  95. package/build-types/badge/badge.d.ts.map +1 -0
  96. package/build-types/badge/index.d.ts +2 -0
  97. package/build-types/badge/index.d.ts.map +1 -0
  98. package/build-types/badge/stories/index.story.d.ts +21 -0
  99. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  100. package/build-types/badge/types.d.ts +17 -0
  101. package/build-types/badge/types.d.ts.map +1 -0
  102. package/build-types/box/box.d.ts +0 -3
  103. package/build-types/box/box.d.ts.map +1 -1
  104. package/build-types/box/stories/index.story.d.ts +1 -11
  105. package/build-types/box/stories/index.story.d.ts.map +1 -1
  106. package/build-types/box/types.d.ts +8 -15
  107. package/build-types/box/types.d.ts.map +1 -1
  108. package/build-types/form/primitives/field/control.d.ts +6 -0
  109. package/build-types/form/primitives/field/control.d.ts.map +1 -0
  110. package/build-types/form/primitives/field/description.d.ts +9 -0
  111. package/build-types/form/primitives/field/description.d.ts.map +1 -0
  112. package/build-types/form/primitives/field/details.d.ts +21 -0
  113. package/build-types/form/primitives/field/details.d.ts.map +1 -0
  114. package/build-types/form/primitives/field/index.d.ts +8 -0
  115. package/build-types/form/primitives/field/index.d.ts.map +1 -0
  116. package/build-types/form/primitives/field/item.d.ts +3 -0
  117. package/build-types/form/primitives/field/item.d.ts.map +1 -0
  118. package/build-types/form/primitives/field/label.d.ts +11 -0
  119. package/build-types/form/primitives/field/label.d.ts.map +1 -0
  120. package/build-types/form/primitives/field/root.d.ts +13 -0
  121. package/build-types/form/primitives/field/root.d.ts.map +1 -0
  122. package/build-types/form/primitives/field/stories/index.story.d.ts +39 -0
  123. package/build-types/form/primitives/field/stories/index.story.d.ts.map +1 -0
  124. package/build-types/form/primitives/field/test/index.test.d.ts +2 -0
  125. package/build-types/form/primitives/field/test/index.test.d.ts.map +1 -0
  126. package/build-types/form/primitives/field/types.d.ts +62 -0
  127. package/build-types/form/primitives/field/types.d.ts.map +1 -0
  128. package/build-types/form/primitives/index.d.ts +2 -0
  129. package/build-types/form/primitives/index.d.ts.map +1 -0
  130. package/build-types/index.d.ts +4 -0
  131. package/build-types/index.d.ts.map +1 -1
  132. package/build-types/stack/index.d.ts +0 -3
  133. package/build-types/stack/index.d.ts.map +1 -1
  134. package/build-types/stack/stack.d.ts.map +1 -1
  135. package/build-types/stack/stories/index.story.d.ts +1 -11
  136. package/build-types/stack/stories/index.story.d.ts.map +1 -1
  137. package/build-types/stack/types.d.ts +2 -5
  138. package/build-types/stack/types.d.ts.map +1 -1
  139. package/build-types/test/index.test.d.ts +2 -0
  140. package/build-types/test/index.test.d.ts.map +1 -0
  141. package/build-types/visually-hidden/index.d.ts +2 -0
  142. package/build-types/visually-hidden/index.d.ts.map +1 -0
  143. package/build-types/visually-hidden/stories/index.story.d.ts +7 -0
  144. package/build-types/visually-hidden/stories/index.story.d.ts.map +1 -0
  145. package/build-types/visually-hidden/test/visually-hidden.test.d.ts +2 -0
  146. package/build-types/visually-hidden/test/visually-hidden.test.d.ts.map +1 -0
  147. package/build-types/visually-hidden/types.d.ts +8 -0
  148. package/build-types/visually-hidden/types.d.ts.map +1 -0
  149. package/build-types/visually-hidden/visually-hidden.d.ts +7 -0
  150. package/build-types/visually-hidden/visually-hidden.d.ts.map +1 -0
  151. package/package.json +17 -9
  152. package/src/badge/badge.tsx +95 -0
  153. package/src/badge/index.ts +1 -0
  154. package/src/badge/stories/choosing-intent.mdx +112 -0
  155. package/src/badge/stories/index.story.tsx +133 -0
  156. package/src/badge/types.ts +25 -0
  157. package/src/box/box.tsx +11 -23
  158. package/src/box/stories/index.story.tsx +3 -14
  159. package/src/box/types.ts +16 -59
  160. package/src/form/primitives/field/control.tsx +9 -0
  161. package/src/form/primitives/field/description.tsx +18 -0
  162. package/src/form/primitives/field/details.tsx +36 -0
  163. package/src/form/primitives/field/index.ts +8 -0
  164. package/src/form/primitives/field/item.tsx +9 -0
  165. package/src/form/primitives/field/label.tsx +21 -0
  166. package/src/form/primitives/field/root.tsx +31 -0
  167. package/src/form/primitives/field/stories/index.story.tsx +132 -0
  168. package/src/form/primitives/field/test/index.test.tsx +36 -0
  169. package/src/form/primitives/field/types.ts +82 -0
  170. package/src/form/primitives/index.ts +1 -0
  171. package/src/index.ts +4 -0
  172. package/src/stack/index.ts +0 -3
  173. package/src/stack/stack.tsx +5 -18
  174. package/src/stack/stories/index.story.tsx +1 -13
  175. package/src/stack/test/stack.test.tsx +22 -12
  176. package/src/stack/types.ts +2 -6
  177. package/src/test/index.test.ts +22 -0
  178. package/src/utils/css/field.module.css +27 -0
  179. package/src/utils/css/resets.module.css +13 -0
  180. package/src/visually-hidden/index.ts +1 -0
  181. package/src/visually-hidden/stories/index.story.tsx +22 -0
  182. package/src/visually-hidden/style.module.css +15 -0
  183. package/src/visually-hidden/test/visually-hidden.test.tsx +59 -0
  184. package/src/visually-hidden/types.ts +8 -0
  185. package/src/visually-hidden/visually-hidden.tsx +23 -0
  186. package/build/box/box.js.map +0 -7
  187. package/build/box/types.js.map +0 -7
  188. package/build/index.js.map +0 -7
  189. package/build/lock-unlock.js.map +0 -7
  190. package/build/stack/index.js.map +0 -7
  191. package/build/stack/stack.js.map +0 -7
  192. package/build/stack/types.js.map +0 -7
  193. package/build/types/css-modules.d.js +0 -2
  194. package/build/utils/element.js.map +0 -7
  195. package/build-module/box/box.js.map +0 -7
  196. package/build-module/box/index.js +0 -6
  197. package/build-module/box/types.js +0 -1
  198. package/build-module/index.js +0 -3
  199. package/build-module/index.js.map +0 -7
  200. package/build-module/lock-unlock.js +0 -11
  201. package/build-module/lock-unlock.js.map +0 -7
  202. package/build-module/stack/index.js +0 -6
  203. package/build-module/stack/index.js.map +0 -7
  204. package/build-module/stack/stack.js.map +0 -7
  205. package/build-module/stack/types.js +0 -1
  206. package/build-module/types/css-modules.d.js +0 -1
  207. package/build-module/utils/element.js +0 -20
  208. package/build-module/utils/element.js.map +0 -7
  209. package/build-module/utils/types.js +0 -1
  210. package/build-types/lock-unlock.d.ts +0 -2
  211. package/build-types/lock-unlock.d.ts.map +0 -1
  212. package/build-types/utils/element.d.ts +0 -25
  213. package/build-types/utils/element.d.ts.map +0 -1
  214. package/src/lock-unlock.ts +0 -10
  215. package/src/utils/element.ts +0 -51
  216. package/tsconfig.json +0 -13
  217. package/tsconfig.tsbuildinfo +0 -1
  218. /package/build/box/{index.js.map → index.cjs.map} +0 -0
  219. /package/build/types/{react.d.js.map → react.d.cjs.map} +0 -0
  220. /package/build/utils/{types.js.map → types.cjs.map} +0 -0
  221. /package/build-module/{box/types.js.map → badge/types.mjs.map} +0 -0
  222. /package/build-module/box/{index.js.map → index.mjs.map} +0 -0
  223. /package/build-module/{stack/types.js.map → box/types.mjs.map} +0 -0
  224. /package/build-module/{types/css-modules.d.js.map → form/primitives/field/types.mjs.map} +0 -0
  225. /package/build-module/{utils/types.js.map → stack/types.mjs.map} +0 -0
  226. /package/{build/types/css-modules.d.js.map → build-module/types/css-modules.d.mjs.map} +0 -0
  227. /package/build-module/types/{react.d.js.map → react.d.mjs.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stack/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/stack/stack.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAoBf,CAAC"}
1
+ {"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/stack/stack.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAmBf,CAAC"}
@@ -1,14 +1,4 @@
1
- /**
2
- * External dependencies
3
- */
4
- import type { Meta, StoryObj } from '@storybook/react';
5
- /**
6
- * WordPress dependencies
7
- */
8
- import '@wordpress/theme/design-tokens.css';
9
- /**
10
- * Internal dependencies
11
- */
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
12
2
  import { Stack } from '../index';
13
3
  declare const meta: Meta<typeof Stack>;
14
4
  export default meta;
@@ -1 +1 @@
1
- {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/stack/stories/index.story.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;GAEG;AACH,OAAO,oCAAoC,CAAC;AAE5C;;GAEG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,KAAK,CAI7B,CAAC;AACF,eAAe,IAAI,CAAC;AAYpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,KAAK,CAAE,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,KA4DrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAC"}
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/stack/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,KAAK,CAI7B,CAAC;AACF,eAAe,IAAI,CAAC;AAYpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,KAAK,CAAE,CAAC;AAEtC,eAAO,MAAM,OAAO,EAAE,KA4DrB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAC"}
@@ -1,8 +1,5 @@
1
- /**
2
- * Internal dependencies
3
- */
1
+ import { type GapSize } from '@wordpress/theme';
4
2
  import { type ComponentProps } from '../utils/types';
5
- export type SizeToken = '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
6
3
  export interface StackProps extends ComponentProps<'div'> {
7
4
  /**
8
5
  * The direction of the stack.
@@ -13,7 +10,7 @@ export interface StackProps extends ComponentProps<'div'> {
13
10
  *
14
11
  * @default undefined
15
12
  */
16
- gap?: SizeToken;
13
+ gap?: GapSize;
17
14
  /**
18
15
  * The alignment of the stack items along the cross axis.
19
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stack/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEjE,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,KAAK,CAAE;IAC1D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAClB,KAAK,CAAC,aAAa,CAAE,eAAe,CAAE,EACtC,aAAa,GAAG,gBAAgB,CAChC,CAAC;IAEF;;;;OAIG;IACH,GAAG,CAAC,EAAE,SAAS,CAAC;IAEhB;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,YAAY,CAAE,CAAC;IAE5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,gBAAgB,CAAE,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAE,KAAK,CAAC,aAAa,CAAE,UAAU,CAAE,EAAE,cAAc,CAAE,CAAC;IAEpE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/stack/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAE,KAAK,CAAE;IAC1D;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAClB,KAAK,CAAC,aAAa,CAAE,eAAe,CAAE,EACtC,aAAa,GAAG,gBAAgB,CAChC,CAAC;IAEF;;;;OAIG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,YAAY,CAAE,CAAC;IAE5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,gBAAgB,CAAE,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAE,KAAK,CAAC,aAAa,CAAE,UAAU,CAAE,EAAE,cAAc,CAAE,CAAC;IAEpE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/test/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { VisuallyHidden } from './visually-hidden';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { VisuallyHidden } from '../';
3
+ declare const meta: Meta<typeof VisuallyHidden>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof VisuallyHidden>;
6
+ export declare const Default: Story;
7
+ //# sourceMappingURL=index.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.story.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/stories/index.story.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAErC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAE,OAAO,cAAc,CAGtC,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAE,OAAO,cAAc,CAAE,CAAC;AAE/C,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=visually-hidden.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visually-hidden.test.d.ts","sourceRoot":"","sources":["../../../src/visually-hidden/test/visually-hidden.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps } from '../utils/types';
2
+ export interface VisuallyHiddenProps extends ComponentProps<'div'> {
3
+ /**
4
+ * The content to be rendered inside the component.
5
+ */
6
+ children?: React.ReactNode;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,WAAW,mBAAoB,SAAQ,cAAc,CAAE,KAAK,CAAE;IACnE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B"}
@@ -0,0 +1,7 @@
1
+ import type { VisuallyHiddenProps } from './types';
2
+ /**
3
+ * Visually hides content while keeping it accessible to screen readers.
4
+ * Useful when providing context that's only meaningful to assistive technology.
5
+ */
6
+ export declare const VisuallyHidden: import("react").ForwardRefExoticComponent<VisuallyHiddenProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ //# sourceMappingURL=visually-hidden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visually-hidden.d.ts","sourceRoot":"","sources":["../../src/visually-hidden/visually-hidden.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD;;;GAGG;AACH,eAAO,MAAM,cAAc,gHAa1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/ui",
3
- "version": "0.4.0",
3
+ "version": "0.4.1-next.76cff8c98.0",
4
4
  "description": "Themeable React UI components for the WordPress Design System.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -22,13 +22,20 @@
22
22
  "node": ">=20.10.0",
23
23
  "npm": ">=10.2.3"
24
24
  },
25
- "main": "build/index.js",
26
- "module": "build-module/index.js",
25
+ "files": [
26
+ "src",
27
+ "build",
28
+ "build-module",
29
+ "build-types",
30
+ "*.md"
31
+ ],
32
+ "main": "build/index.cjs",
33
+ "module": "build-module/index.mjs",
27
34
  "exports": {
28
35
  ".": {
29
36
  "types": "./build-types/index.d.ts",
30
- "import": "./build-module/index.js",
31
- "default": "./build/index.js"
37
+ "import": "./build-module/index.mjs",
38
+ "default": "./build/index.cjs"
32
39
  },
33
40
  "./package.json": "./package.json"
34
41
  },
@@ -36,12 +43,13 @@
36
43
  "types": "build-types",
37
44
  "sideEffects": false,
38
45
  "dependencies": {
39
- "@wordpress/element": "^6.37.0",
40
- "@wordpress/private-apis": "^1.37.0",
46
+ "@base-ui/react": "^1.0.0",
47
+ "@wordpress/element": "^6.36.1-next.76cff8c98.0",
48
+ "@wordpress/i18n": "^6.9.1-next.76cff8c98.0",
41
49
  "clsx": "^2.1.1"
42
50
  },
43
51
  "devDependencies": {
44
- "@wordpress/theme": "^0.4.0"
52
+ "@wordpress/theme": "^0.4.1-next.76cff8c98.0"
45
53
  },
46
54
  "peerDependencies": {
47
55
  "react": "^18.0.0",
@@ -50,5 +58,5 @@
50
58
  "publishConfig": {
51
59
  "access": "public"
52
60
  },
53
- "gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950"
61
+ "gitHead": "368727f14b858e75179e140967c2d9ec965c8790"
54
62
  }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { forwardRef } from '@wordpress/element';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { Box } from '../box';
10
+ import { type BoxProps } from '../box/types';
11
+ import { type BadgeProps } from './types';
12
+
13
+ /**
14
+ * Default render function that renders a span element with the given props.
15
+ */
16
+ const DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'span' > ) => (
17
+ <span { ...props } />
18
+ );
19
+
20
+ /**
21
+ * Maps intent values to Box backgroundColor and color props.
22
+ * Uses strong emphasis styles (as emphasis prop has been removed).
23
+ */
24
+ const getIntentStyles = (
25
+ intent: BadgeProps[ 'intent' ]
26
+ ): Partial< BoxProps > => {
27
+ switch ( intent ) {
28
+ case 'high':
29
+ return {
30
+ backgroundColor: 'error',
31
+ color: 'error',
32
+ };
33
+ case 'medium':
34
+ return {
35
+ backgroundColor: 'warning',
36
+ color: 'warning',
37
+ };
38
+ case 'low':
39
+ return {
40
+ backgroundColor: 'caution',
41
+ color: 'caution',
42
+ };
43
+ case 'stable':
44
+ return {
45
+ backgroundColor: 'success',
46
+ color: 'success',
47
+ };
48
+ case 'informational':
49
+ return {
50
+ backgroundColor: 'info',
51
+ color: 'info',
52
+ };
53
+ case 'draft':
54
+ return {
55
+ backgroundColor: 'neutral-weak',
56
+ color: 'neutral',
57
+ };
58
+ case 'none':
59
+ default:
60
+ return {
61
+ backgroundColor: 'neutral',
62
+ color: 'neutral-weak',
63
+ };
64
+ }
65
+ };
66
+
67
+ /**
68
+ * A badge component for displaying labels with semantic intent.
69
+ * Built on the Box primitive for consistent theming and accessibility.
70
+ */
71
+ export const Badge = forwardRef< HTMLDivElement, BadgeProps >( function Badge(
72
+ { children, intent = 'none', render = DEFAULT_RENDER, ...props },
73
+ ref
74
+ ) {
75
+ const intentStyles = getIntentStyles( intent );
76
+
77
+ return (
78
+ <Box
79
+ { ...intentStyles }
80
+ padding={ { inline: 'xs', block: '2xs' } }
81
+ borderRadius="lg"
82
+ render={ render }
83
+ style={ {
84
+ fontFamily: 'var(--wpds-font-family-body)',
85
+ fontSize: 'var(--wpds-font-size-sm)',
86
+ fontWeight: 'var(--wpds-font-weight-regular)',
87
+ lineHeight: 'var(--wpds-font-line-height-xs)',
88
+ ...props.style,
89
+ } }
90
+ ref={ ref }
91
+ >
92
+ { children }
93
+ </Box>
94
+ );
95
+ } );
@@ -0,0 +1 @@
1
+ export { Badge } from './badge';
@@ -0,0 +1,112 @@
1
+ import { Meta } from '@storybook/addon-docs/blocks';
2
+ import { Badge } from '../index';
3
+ import '@wordpress/theme/design-tokens.css';
4
+
5
+ <Meta title="Design System/Components/Badge/Choosing intent" />
6
+
7
+ # Choosing intent
8
+
9
+ <div style={ { padding: '2rem', display: 'flex', justifyContent: 'center', gap: '0.5rem', flexWrap: 'wrap', border: '1px solid #e0e0e0', borderRadius: '0.5rem' } }>
10
+ <Badge intent="high">high</Badge>
11
+ <Badge intent="medium">medium</Badge>
12
+ <Badge intent="low">low</Badge>
13
+ <Badge intent="stable">stable</Badge>
14
+ <Badge intent="informational">informational</Badge>
15
+ <Badge intent="draft">draft</Badge>
16
+ <Badge intent="none">none</Badge>
17
+ </div>
18
+
19
+ It can be difficult to determine which badge intent to use because the component's properties are not tied to any specific product view. Those properties should be balanced against the requirements of the view in which the badge appears, all while keeping an eye on high-level consistency (global statuses that appear across multiple views).
20
+
21
+ Here is a decision tree to help identify which badge to use.
22
+
23
+ ## 1. Ask first: should this draw the eye?
24
+
25
+ If the user scans this screen, should their attention be drawn to this badge?
26
+
27
+ - If **no** → use `none` (or even just plain text; no badge), even if the state is positive or "stable".
28
+ - If **yes** → pick an intent based on how important the action or awareness is.
29
+
30
+ ## 2. High / Medium / Low = action priority
31
+
32
+ Use when there's something for the user to act on.
33
+
34
+ ### `high` – Critical / top priority
35
+
36
+ * Needs attention as soon as possible
37
+ * _E.g. "Payment declined", "Security issue"_
38
+
39
+ <Badge intent="high">Payment declined</Badge> <Badge intent="high">Security issue</Badge>
40
+
41
+ ### `medium` – Important / blocks progress
42
+
43
+ * Blocks a key task, should be handled soon
44
+ * _E.g. "Approval required", "Review needed"_
45
+
46
+ <Badge intent="medium">Approval required</Badge> <Badge intent="medium">Review needed</Badge>
47
+
48
+ ### `low` – Worth noticing / non‑urgent
49
+
50
+ * Good to be aware of; action may be optional or later
51
+ * _E.g. "Pending", "Queued", "Minor issues", "Optional setup"_
52
+
53
+ <Badge intent="low">Pending</Badge> <Badge intent="low">Queued</Badge>
54
+
55
+ ## 3. Informational / draft = special non-final states
56
+
57
+ ### `informational` – Notable, no action / fix needed
58
+
59
+ * Context only; no clear action
60
+ * _E.g. "Scheduled", "Beta", "Internal only"_
61
+
62
+ <Badge intent="informational">Scheduled</Badge> <Badge intent="informational">Beta</Badge>
63
+
64
+ ### `draft` – Not final / work in progress
65
+
66
+ * _E.g. "Draft", "Unpublished", "Work in progress"_
67
+
68
+ <Badge intent="draft">Draft</Badge> <Badge intent="draft">Unpublished</Badge>
69
+
70
+ ## 4. Stable / none = normal states
71
+
72
+ ### `stable` – Positive / "healthy" state
73
+
74
+ * Use when confirming success or "all good" is important in that view
75
+ * _E.g. "Healthy", "Active", "Live"_
76
+
77
+ <Badge intent="stable">Healthy</Badge> <Badge intent="stable">Active</Badge>
78
+
79
+ ### `none` – Default for normal / background states
80
+
81
+ * Especially in dense lists where too much color creates visual noise
82
+ * _E.g. "Inactive", "Expired"_
83
+
84
+ <Badge intent="none">Inactive</Badge> <Badge intent="none">Expired</Badge>
85
+
86
+ ## Examples
87
+
88
+ ### Comment status:
89
+
90
+ - "Approved" → `none`: <Badge intent="none">Approved</Badge>
91
+ - "Approval required" → `medium`: <Badge intent="medium">Approval required</Badge>
92
+
93
+ ### Page status:
94
+
95
+ - "Published" → `none`: <Badge intent="none">Published</Badge>
96
+ - "Pending" → `low`: <Badge intent="low">Pending</Badge>
97
+ - "Draft" → `draft`: <Badge intent="draft">Draft</Badge>
98
+ - "Scheduled" → `informational`: <Badge intent="informational">Scheduled</Badge>
99
+ - "Private" → `informational`: <Badge intent="informational">Private</Badge>
100
+
101
+ ### Plugin status:
102
+
103
+ - "Active" → `stable`: <Badge intent="stable">Active</Badge>
104
+ - "Inactive" → `none`: <Badge intent="none">Inactive</Badge>
105
+
106
+ ## 5. When in doubt…
107
+
108
+ Use the least attention‑grabbing intent that still:
109
+
110
+ - Makes it clear what needs attention,
111
+ - Marks what isn't final, or
112
+ - Confirms a key success state in that context.
@@ -0,0 +1,133 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { Fragment } from '@wordpress/element';
10
+
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+ import { Badge } from '../index';
15
+
16
+ const meta: Meta< typeof Badge > = {
17
+ title: 'Design System/Components/Badge',
18
+ component: Badge,
19
+ tags: [ 'status-experimental' ],
20
+ };
21
+ export default meta;
22
+
23
+ type Story = StoryObj< typeof Badge >;
24
+
25
+ export const Default: Story = {
26
+ args: {
27
+ children: 'Badge',
28
+ },
29
+ };
30
+
31
+ export const High: Story = {
32
+ ...Default,
33
+ args: {
34
+ ...Default.args,
35
+ intent: 'high',
36
+ },
37
+ };
38
+
39
+ export const Medium: Story = {
40
+ ...Default,
41
+ args: {
42
+ ...Default.args,
43
+ intent: 'medium',
44
+ },
45
+ };
46
+
47
+ export const Low: Story = {
48
+ ...Default,
49
+ args: {
50
+ ...Default.args,
51
+ intent: 'low',
52
+ },
53
+ };
54
+
55
+ export const Stable: Story = {
56
+ ...Default,
57
+ args: {
58
+ ...Default.args,
59
+ intent: 'stable',
60
+ },
61
+ };
62
+
63
+ export const Informational: Story = {
64
+ ...Default,
65
+ args: {
66
+ ...Default.args,
67
+ intent: 'informational',
68
+ },
69
+ };
70
+
71
+ export const Draft: Story = {
72
+ ...Default,
73
+ args: {
74
+ ...Default.args,
75
+ intent: 'draft',
76
+ },
77
+ };
78
+
79
+ export const None: Story = {
80
+ ...Default,
81
+ args: {
82
+ ...Default.args,
83
+ intent: 'none',
84
+ },
85
+ };
86
+
87
+ export const AllIntents: Story = {
88
+ ...Default,
89
+ render: ( args ) => (
90
+ <div
91
+ style={ {
92
+ display: 'grid',
93
+ gridTemplateColumns: 'max-content min-content',
94
+ gap: '1rem',
95
+ color: 'var(--wpds-color-fg-content-neutral)',
96
+ backgroundColor: 'var(--wpds-color-bg-surface-neutral-strong)',
97
+ } }
98
+ >
99
+ { (
100
+ [
101
+ 'high',
102
+ 'medium',
103
+ 'low',
104
+ 'stable',
105
+ 'informational',
106
+ 'draft',
107
+ 'none',
108
+ ] as const
109
+ ).map( ( intent ) => (
110
+ <Fragment key={ intent }>
111
+ <div
112
+ style={ {
113
+ paddingInlineEnd: '1rem',
114
+ display: 'flex',
115
+ alignItems: 'center',
116
+ } }
117
+ >
118
+ { intent }
119
+ </div>
120
+ <div
121
+ style={ {
122
+ padding: '0.5rem 1rem',
123
+ display: 'flex',
124
+ alignItems: 'center',
125
+ } }
126
+ >
127
+ <Badge { ...args } intent={ intent } />
128
+ </div>
129
+ </Fragment>
130
+ ) ) }
131
+ </div>
132
+ ),
133
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { type ComponentProps } from '../utils/types';
5
+
6
+ export interface BadgeProps extends ComponentProps< 'span' > {
7
+ /**
8
+ * The text to display in the badge.
9
+ */
10
+ children: string;
11
+
12
+ /**
13
+ * The semantic intent of the badge, communicating its meaning through color.
14
+ *
15
+ * @default "none"
16
+ */
17
+ intent?:
18
+ | 'high'
19
+ | 'medium'
20
+ | 'low'
21
+ | 'stable'
22
+ | 'informational'
23
+ | 'draft'
24
+ | 'none';
25
+ }
package/src/box/box.tsx CHANGED
@@ -1,18 +1,9 @@
1
- /**
2
- * WordPress dependencies
3
- */
1
+ import { useRender, mergeProps } from '@base-ui/react';
4
2
  import { forwardRef } from '@wordpress/element';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
3
  import { type BoxProps } from './types';
10
- import { renderElement } from '../utils/element';
11
4
 
12
5
  /**
13
6
  * Default render function that renders a div element with the given props.
14
- *
15
- * @param props The props to apply to the HTML element.
16
7
  */
17
8
  const DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'div' > ) => (
18
9
  <div { ...props } />
@@ -20,30 +11,25 @@ const DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'div' > ) => (
20
11
 
21
12
  /**
22
13
  * Capitalizes the first character of a string.
23
- *
24
- * @param str The string to capitalize.
25
- * @return The capitalized string.
26
14
  */
27
15
  const capitalize = ( str: string ): string =>
28
16
  str.charAt( 0 ).toUpperCase() + str.slice( 1 );
29
17
 
30
18
  /**
31
- * Converts a size value to a CSS design token property reference (with
32
- * fallback) or a calculated value based on the base unit.
19
+ * Converts a size token name to a CSS design token property reference (with
20
+ * fallback).
33
21
  *
34
22
  * @param property The CSS property name.
35
23
  * @param target The design system token target.
36
- * @param value The size value, either a number (multiplier of base unit) or a string (token name).
24
+ * @param value The size token name.
37
25
  * @return A CSS value string with variable references.
38
26
  */
39
27
  const getSpacingValue = (
40
28
  property: string,
41
29
  target: string,
42
- value: number | string
30
+ value: string
43
31
  ): string =>
44
- typeof value === 'number'
45
- ? `calc(var(--wpds-dimension-base) * ${ value })`
46
- : `var(--wpds-dimension-${ property }-${ target }-${ value }, var(--wpds-dimension-${ property }-surface-${ value }))`;
32
+ `var(--wpds-dimension-${ property }-${ target }-${ value }, var(--wpds-dimension-${ property }-surface-${ value }))`;
47
33
 
48
34
  /**
49
35
  * Generates CSS styles for properties with optionally directional values,
@@ -92,7 +78,7 @@ export const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(
92
78
  },
93
79
  ref
94
80
  ) {
95
- const style: React.CSSProperties = { ...props.style };
81
+ const style: React.CSSProperties = {};
96
82
 
97
83
  if ( backgroundColor ) {
98
84
  style.backgroundColor = `var(--wpds-color-bg-${ target }-${ backgroundColor }, var(--wpds-color-bg-surface-${ backgroundColor }))`;
@@ -122,9 +108,11 @@ export const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(
122
108
  style.borderColor = `var(--wpds-color-stroke-${ target }-${ borderColor }, var(--wpds-color-stroke-surface-${ borderColor }))`;
123
109
  }
124
110
 
125
- return renderElement< 'div' >( {
111
+ const element = useRender( {
126
112
  render,
127
113
  ref,
128
- props: { ...props, style },
114
+ props: mergeProps< 'div' >( props, { style } ),
129
115
  } );
116
+
117
+ return element;
130
118
  } );
@@ -1,16 +1,5 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { type Meta, type StoryObj } from '@storybook/react';
5
-
6
- /**
7
- * WordPress dependencies
8
- */
9
- import '@wordpress/theme/design-tokens.css';
10
-
11
- /**
12
- * Internal dependencies
13
- */
1
+ import { type Meta, type StoryObj } from '@storybook/react-webpack5';
2
+ import { type PaddingSize } from '@wordpress/theme';
14
3
  import { Box } from '../box';
15
4
 
16
5
  const meta: Meta< typeof Box > = {
@@ -35,7 +24,7 @@ export const Default: Story = {
35
24
  argTypes: {
36
25
  padding: {
37
26
  control: 'select',
38
- options: [ '2xs', 'xs', 'sm', 'md', 'lg', 1, 2, 3, 4 ],
27
+ options: [ '2xs', 'xs', 'sm', 'md', 'lg' ] satisfies PaddingSize[],
39
28
  },
40
29
  },
41
30
  };