@wordpress/ui 0.4.0 → 1.0.1-next.8fd3f8831.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 (91) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/badge/badge.cjs +95 -0
  3. package/build/badge/badge.cjs.map +7 -0
  4. package/build/{lock-unlock.js → badge/index.cjs} +8 -14
  5. package/build/badge/index.cjs.map +7 -0
  6. package/build/badge/types.cjs +19 -0
  7. package/build/badge/types.cjs.map +7 -0
  8. package/build/box/{box.js → box.cjs} +3 -3
  9. package/build/box/box.cjs.map +7 -0
  10. package/build/box/{index.js → index.cjs} +2 -2
  11. package/build/box/{types.js → types.cjs} +1 -1
  12. package/build/box/types.cjs.map +7 -0
  13. package/build/{index.js → index.cjs} +7 -3
  14. package/build/index.cjs.map +7 -0
  15. package/build/stack/{index.js → index.cjs} +2 -2
  16. package/build/stack/index.cjs.map +7 -0
  17. package/build/stack/{stack.js → stack.cjs} +3 -3
  18. package/build/stack/{types.js → types.cjs} +1 -1
  19. package/build/stack/types.cjs.map +7 -0
  20. package/build/types/css-modules.d.cjs +2 -0
  21. package/build/types/css-modules.d.cjs.map +7 -0
  22. package/build/types/{react.d.js → react.d.cjs} +1 -1
  23. package/build/utils/{element.js → element.cjs} +1 -1
  24. package/build/utils/{types.js → types.cjs} +1 -1
  25. package/build-module/badge/badge.js +70 -0
  26. package/build-module/badge/badge.js.map +7 -0
  27. package/build-module/badge/index.js +6 -0
  28. package/build-module/badge/index.js.map +7 -0
  29. package/build-module/badge/types.js +1 -0
  30. package/build-module/box/box.js +2 -2
  31. package/build-module/box/box.js.map +2 -2
  32. package/build-module/box/index.js +1 -1
  33. package/build-module/index.js +3 -1
  34. package/build-module/index.js.map +2 -2
  35. package/build-module/stack/index.js +1 -1
  36. package/build-module/stack/index.js.map +2 -2
  37. package/build-module/stack/stack.js +1 -1
  38. package/build-types/badge/badge.d.ts +7 -0
  39. package/build-types/badge/badge.d.ts.map +1 -0
  40. package/build-types/badge/index.d.ts +2 -0
  41. package/build-types/badge/index.d.ts.map +1 -0
  42. package/build-types/badge/stories/index.story.d.ts +22 -0
  43. package/build-types/badge/stories/index.story.d.ts.map +1 -0
  44. package/build-types/badge/types.d.ts +17 -0
  45. package/build-types/badge/types.d.ts.map +1 -0
  46. package/build-types/box/box.d.ts.map +1 -1
  47. package/build-types/box/stories/index.story.d.ts +0 -9
  48. package/build-types/box/stories/index.story.d.ts.map +1 -1
  49. package/build-types/box/types.d.ts +8 -15
  50. package/build-types/box/types.d.ts.map +1 -1
  51. package/build-types/index.d.ts +2 -0
  52. package/build-types/index.d.ts.map +1 -1
  53. package/build-types/stack/index.d.ts +0 -3
  54. package/build-types/stack/index.d.ts.map +1 -1
  55. package/build-types/stack/types.d.ts +2 -5
  56. package/build-types/stack/types.d.ts.map +1 -1
  57. package/build-types/test/index.test.d.ts +2 -0
  58. package/build-types/test/index.test.d.ts.map +1 -0
  59. package/package.json +14 -7
  60. package/src/badge/badge.tsx +98 -0
  61. package/src/badge/index.ts +1 -0
  62. package/src/badge/stories/choosing-intent.mdx +112 -0
  63. package/src/badge/stories/index.story.tsx +134 -0
  64. package/src/badge/types.ts +25 -0
  65. package/src/box/box.tsx +5 -7
  66. package/src/box/stories/index.story.tsx +2 -12
  67. package/src/box/types.ts +16 -59
  68. package/src/index.ts +2 -0
  69. package/src/stack/index.ts +0 -3
  70. package/src/stack/types.ts +2 -6
  71. package/src/test/index.test.ts +22 -0
  72. package/build/box/box.js.map +0 -7
  73. package/build/box/types.js.map +0 -7
  74. package/build/index.js.map +0 -7
  75. package/build/lock-unlock.js.map +0 -7
  76. package/build/stack/index.js.map +0 -7
  77. package/build/stack/types.js.map +0 -7
  78. package/build/types/css-modules.d.js +0 -2
  79. package/build-module/lock-unlock.js +0 -11
  80. package/build-module/lock-unlock.js.map +0 -7
  81. package/build-types/lock-unlock.d.ts +0 -2
  82. package/build-types/lock-unlock.d.ts.map +0 -1
  83. package/src/lock-unlock.ts +0 -10
  84. package/tsconfig.json +0 -13
  85. package/tsconfig.tsbuildinfo +0 -1
  86. /package/build/box/{index.js.map → index.cjs.map} +0 -0
  87. /package/build/stack/{stack.js.map → stack.cjs.map} +0 -0
  88. /package/build/types/{react.d.js.map → react.d.cjs.map} +0 -0
  89. /package/build/utils/{element.js.map → element.cjs.map} +0 -0
  90. /package/build/utils/{types.js.map → types.cjs.map} +0 -0
  91. /package/{build/types/css-modules.d.js.map → build-module/badge/types.js.map} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2
+
3
+ ## Unreleased
4
+
5
+ ## 1.0.0-next.0 (2025-12-24)
6
+
7
+ ### Breaking Changes
8
+
9
+ - Remove numeric multiplier option for spacing tokens from `Stack` and `Box` components. ([#73852](https://github.com/WordPress/gutenberg/pull/73852), [#74008](https://github.com/WordPress/gutenberg/pull/74008))
10
+
11
+ ### New Features
12
+
13
+ - Add `Stack` component. ([#73928](https://github.com/WordPress/gutenberg/pull/73928))
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // packages/ui/src/badge/badge.tsx
21
+ var badge_exports = {};
22
+ __export(badge_exports, {
23
+ Badge: () => Badge
24
+ });
25
+ module.exports = __toCommonJS(badge_exports);
26
+ var import_element = require("@wordpress/element");
27
+ var import_box = require("../box/index.cjs");
28
+ var import_jsx_runtime = require("react/jsx-runtime");
29
+ var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { ...props });
30
+ var getIntentStyles = (intent) => {
31
+ switch (intent) {
32
+ case "high":
33
+ return {
34
+ backgroundColor: "error",
35
+ color: "error"
36
+ };
37
+ case "medium":
38
+ return {
39
+ backgroundColor: "warning",
40
+ color: "warning"
41
+ };
42
+ case "low":
43
+ return {
44
+ backgroundColor: "caution",
45
+ color: "caution"
46
+ };
47
+ case "stable":
48
+ return {
49
+ backgroundColor: "success",
50
+ color: "success"
51
+ };
52
+ case "informational":
53
+ return {
54
+ backgroundColor: "info",
55
+ color: "info"
56
+ };
57
+ case "draft":
58
+ return {
59
+ backgroundColor: "neutral-weak",
60
+ color: "neutral"
61
+ };
62
+ case "none":
63
+ default:
64
+ return {
65
+ backgroundColor: "neutral",
66
+ color: "neutral-weak"
67
+ };
68
+ }
69
+ };
70
+ var Badge = (0, import_element.forwardRef)(function Badge2({ children, intent = "none", render = DEFAULT_RENDER, ...props }, ref) {
71
+ const intentStyles = getIntentStyles(intent);
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ import_box.Box,
74
+ {
75
+ ...intentStyles,
76
+ padding: { inline: "xs", block: "2xs" },
77
+ borderRadius: "lg",
78
+ render,
79
+ style: {
80
+ fontFamily: "var(--wpds-font-family-body)",
81
+ fontSize: "var(--wpds-font-size-small)",
82
+ fontWeight: "400",
83
+ lineHeight: "var(--wpds-font-line-height-x-small)",
84
+ ...props.style
85
+ },
86
+ ref,
87
+ children
88
+ }
89
+ );
90
+ });
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ Badge
94
+ });
95
+ //# sourceMappingURL=badge.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/badge/badge.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Box } from '../box';\nimport { type BoxProps } from '../box/types';\nimport { type BadgeProps } from './types';\n\n/**\n * Default render function that renders a span element with the given props.\n *\n * @param props The props to apply to the HTML element.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'span' > ) => (\n\t<span { ...props } />\n);\n\n/**\n * Maps intent values to Box backgroundColor and color props.\n * Uses strong emphasis styles (as emphasis prop has been removed).\n * @param intent\n */\nconst getIntentStyles = (\n\tintent: BadgeProps[ 'intent' ]\n): Partial< BoxProps > => {\n\tswitch ( intent ) {\n\t\tcase 'high':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'error',\n\t\t\t\tcolor: 'error',\n\t\t\t};\n\t\tcase 'medium':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'warning',\n\t\t\t\tcolor: 'warning',\n\t\t\t};\n\t\tcase 'low':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'caution',\n\t\t\t\tcolor: 'caution',\n\t\t\t};\n\t\tcase 'stable':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'success',\n\t\t\t\tcolor: 'success',\n\t\t\t};\n\t\tcase 'informational':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'info',\n\t\t\t\tcolor: 'info',\n\t\t\t};\n\t\tcase 'draft':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral-weak',\n\t\t\t\tcolor: 'neutral',\n\t\t\t};\n\t\tcase 'none':\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral',\n\t\t\t\tcolor: 'neutral-weak',\n\t\t\t};\n\t}\n};\n\n/**\n * A badge component for displaying labels with semantic intent.\n * Built on the Box primitive for consistent theming and accessibility.\n */\nexport const Badge = forwardRef< HTMLDivElement, BadgeProps >( function Badge(\n\t{ children, intent = 'none', render = DEFAULT_RENDER, ...props },\n\tref\n) {\n\tconst intentStyles = getIntentStyles( intent );\n\n\treturn (\n\t\t<Box\n\t\t\t{ ...intentStyles }\n\t\t\tpadding={ { inline: 'xs', block: '2xs' } }\n\t\t\tborderRadius=\"lg\"\n\t\t\trender={ render }\n\t\t\tstyle={ {\n\t\t\t\tfontFamily: 'var(--wpds-font-family-body)',\n\t\t\t\tfontSize: 'var(--wpds-font-size-small)',\n\t\t\t\tfontWeight: '400',\n\t\t\t\tlineHeight: 'var(--wpds-font-line-height-x-small)',\n\t\t\t\t...props.style,\n\t\t\t} }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n} );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA2B;AAK3B,iBAAoB;AAUnB;AADD,IAAM,iBAAiB,CAAE,UACxB,4CAAC,UAAO,GAAG,OAAQ;AAQpB,IAAM,kBAAkB,CACvB,WACyB;AACzB,UAAS,QAAS;AAAA,IACjB,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AAAA,IACL;AACC,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,EACF;AACD;AAMO,IAAM,YAAQ,2BAA0C,SAASA,OACvE,EAAE,UAAU,SAAS,QAAQ,SAAS,gBAAgB,GAAG,MAAM,GAC/D,KACC;AACD,QAAM,eAAe,gBAAiB,MAAO;AAE7C,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL,SAAU,EAAE,QAAQ,MAAM,OAAO,MAAM;AAAA,MACvC,cAAa;AAAA,MACb;AAAA,MACA,OAAQ;AAAA,QACP,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,GAAG,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF,CAAE;",
6
+ "names": ["Badge"]
7
+ }
@@ -17,21 +17,15 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // packages/ui/src/lock-unlock.ts
21
- var lock_unlock_exports = {};
22
- __export(lock_unlock_exports, {
23
- lock: () => lock,
24
- unlock: () => unlock
20
+ // packages/ui/src/badge/index.ts
21
+ var badge_exports = {};
22
+ __export(badge_exports, {
23
+ Badge: () => import_badge.Badge
25
24
  });
26
- module.exports = __toCommonJS(lock_unlock_exports);
27
- var import_private_apis = require("@wordpress/private-apis");
28
- var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
29
- "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
30
- "@wordpress/dataviews"
31
- );
25
+ module.exports = __toCommonJS(badge_exports);
26
+ var import_badge = require("./badge.cjs");
32
27
  // Annotate the CommonJS export names for ESM import in node:
33
28
  0 && (module.exports = {
34
- lock,
35
- unlock
29
+ Badge
36
30
  });
37
- //# sourceMappingURL=lock-unlock.js.map
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/badge/index.ts"],
4
+ "sourcesContent": ["export { Badge } from './badge';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // packages/ui/src/badge/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/badge/types.ts"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { type ComponentProps } from '../utils/types';\n\nexport interface BadgeProps extends ComponentProps< 'span' > {\n\t/**\n\t * The text to display in the badge.\n\t */\n\tchildren: string;\n\n\t/**\n\t * The semantic intent of the badge, communicating its meaning through color.\n\t *\n\t * @default \"none\"\n\t */\n\tintent?:\n\t\t| 'high'\n\t\t| 'medium'\n\t\t| 'low'\n\t\t| 'stable'\n\t\t| 'informational'\n\t\t| 'draft'\n\t\t| 'none';\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -24,11 +24,11 @@ __export(box_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(box_exports);
26
26
  var import_element = require("@wordpress/element");
27
- var import_element2 = require("../utils/element");
27
+ var import_element2 = require("../utils/element.cjs");
28
28
  var import_jsx_runtime = require("react/jsx-runtime");
29
29
  var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...props });
30
30
  var capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
31
- var getSpacingValue = (property, target, value) => typeof value === "number" ? `calc(var(--wpds-dimension-base) * ${value})` : `var(--wpds-dimension-${property}-${target}-${value}, var(--wpds-dimension-${property}-surface-${value}))`;
31
+ var getSpacingValue = (property, target, value) => `var(--wpds-dimension-${property}-${target}-${value}, var(--wpds-dimension-${property}-surface-${value}))`;
32
32
  var getDimensionVariantStyles = (property, target, value) => typeof value !== "object" ? { [property]: getSpacingValue(property, target, value) } : Object.keys(value).reduce(
33
33
  (result, key) => ({
34
34
  ...result,
@@ -84,4 +84,4 @@ var Box = (0, import_element.forwardRef)(function Box2({
84
84
  0 && (module.exports = {
85
85
  Box
86
86
  });
87
- //# sourceMappingURL=box.js.map
87
+ //# sourceMappingURL=box.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/box/box.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { type BoxProps } from './types';\nimport { renderElement } from '../utils/element';\n\n/**\n * Default render function that renders a div element with the given props.\n *\n * @param props The props to apply to the HTML element.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'div' > ) => (\n\t<div { ...props } />\n);\n\n/**\n * Capitalizes the first character of a string.\n *\n * @param str The string to capitalize.\n * @return The capitalized string.\n */\nconst capitalize = ( str: string ): string =>\n\tstr.charAt( 0 ).toUpperCase() + str.slice( 1 );\n\n/**\n * Converts a size token name to a CSS design token property reference (with\n * fallback).\n *\n * @param property The CSS property name.\n * @param target The design system token target.\n * @param value The size token name.\n * @return A CSS value string with variable references.\n */\nconst getSpacingValue = (\n\tproperty: string,\n\ttarget: string,\n\tvalue: string\n): string =>\n\t`var(--wpds-dimension-${ property }-${ target }-${ value }, var(--wpds-dimension-${ property }-surface-${ value }))`;\n\n/**\n * Generates CSS styles for properties with optionally directional values,\n * normalizing single values and objects with directional keys for logical\n * properties.\n *\n * @param property The CSS property name from BoxProps.\n * @param target The design system token target.\n * @param value The property value (single or object with directional keys).\n * @return A CSSProperties object with the computed styles.\n */\nconst getDimensionVariantStyles = < T extends keyof BoxProps >(\n\tproperty: T,\n\ttarget: string,\n\tvalue: NonNullable< BoxProps[ T ] >\n): React.CSSProperties =>\n\ttypeof value !== 'object'\n\t\t? { [ property ]: getSpacingValue( property, target, value ) }\n\t\t: Object.keys( value ).reduce(\n\t\t\t\t( result, key ) => ( {\n\t\t\t\t\t...result,\n\t\t\t\t\t[ property + capitalize( key ) ]: getSpacingValue(\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tvalue[ key ]\n\t\t\t\t\t),\n\t\t\t\t} ),\n\t\t\t\t{} as Record< string, string >\n\t\t );\n\n/**\n * A low-level visual primitive that provides an interface for applying design\n * token-based customization for background, text, padding, and more.\n */\nexport const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(\n\t{\n\t\ttarget = 'surface',\n\t\tbackgroundColor,\n\t\tcolor,\n\t\tpadding,\n\t\tborderRadius,\n\t\tborderWidth,\n\t\tborderColor,\n\t\trender = DEFAULT_RENDER,\n\t\t...props\n\t},\n\tref\n) {\n\tconst style: React.CSSProperties = { ...props.style };\n\n\tif ( backgroundColor ) {\n\t\tstyle.backgroundColor = `var(--wpds-color-bg-${ target }-${ backgroundColor }, var(--wpds-color-bg-surface-${ backgroundColor }))`;\n\t}\n\n\tif ( color ) {\n\t\tstyle.color = `var(--wpds-color-fg-${ target }-${ color }, var(--wpds-color-fg-content-${ color }))`;\n\t}\n\n\tif ( padding ) {\n\t\tObject.assign(\n\t\t\tstyle,\n\t\t\tgetDimensionVariantStyles( 'padding', target, padding )\n\t\t);\n\t}\n\n\tif ( borderRadius ) {\n\t\tstyle.borderRadius = `var(--wpds-border-radius-${ target }-${ borderRadius }, var(--wpds-border-radius-surface-${ borderRadius }))`;\n\t}\n\n\tif ( borderWidth ) {\n\t\tstyle.borderWidth = `var(--wpds-border-width-${ target }-${ borderWidth }, var(--wpds-border-width-surface-${ borderWidth }))`;\n\t\tstyle.borderStyle = 'solid';\n\t}\n\n\tif ( borderColor ) {\n\t\tstyle.borderColor = `var(--wpds-color-stroke-${ target }-${ borderColor }, var(--wpds-color-stroke-surface-${ borderColor }))`;\n\t}\n\n\treturn renderElement< 'div' >( {\n\t\trender,\n\t\tref,\n\t\tprops: { ...props, style },\n\t} );\n} );\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA2B;AAM3B,IAAAA,kBAA8B;AAQ7B;AADD,IAAM,iBAAiB,CAAE,UACxB,4CAAC,SAAM,GAAG,OAAQ;AASnB,IAAM,aAAa,CAAE,QACpB,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AAW9C,IAAM,kBAAkB,CACvB,UACA,QACA,UAEA,wBAAyB,QAAS,IAAK,MAAO,IAAK,KAAM,0BAA2B,QAAS,YAAa,KAAM;AAYjH,IAAM,4BAA4B,CACjC,UACA,QACA,UAEA,OAAO,UAAU,WACd,EAAE,CAAE,QAAS,GAAG,gBAAiB,UAAU,QAAQ,KAAM,EAAE,IAC3D,OAAO,KAAM,KAAM,EAAE;AAAA,EACrB,CAAE,QAAQ,SAAW;AAAA,IACpB,GAAG;AAAA,IACH,CAAE,WAAW,WAAY,GAAI,CAAE,GAAG;AAAA,MACjC;AAAA,MACA;AAAA,MACA,MAAO,GAAI;AAAA,IACZ;AAAA,EACD;AAAA,EACA,CAAC;AACD;AAMG,IAAM,UAAM,2BAAwC,SAASC,KACnE;AAAA,EACC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACJ,GACA,KACC;AACD,QAAM,QAA6B,EAAE,GAAG,MAAM,MAAM;AAEpD,MAAK,iBAAkB;AACtB,UAAM,kBAAkB,uBAAwB,MAAO,IAAK,eAAgB,iCAAkC,eAAgB;AAAA,EAC/H;AAEA,MAAK,OAAQ;AACZ,UAAM,QAAQ,uBAAwB,MAAO,IAAK,KAAM,iCAAkC,KAAM;AAAA,EACjG;AAEA,MAAK,SAAU;AACd,WAAO;AAAA,MACN;AAAA,MACA,0BAA2B,WAAW,QAAQ,OAAQ;AAAA,IACvD;AAAA,EACD;AAEA,MAAK,cAAe;AACnB,UAAM,eAAe,4BAA6B,MAAO,IAAK,YAAa,sCAAuC,YAAa;AAAA,EAChI;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAC1H,UAAM,cAAc;AAAA,EACrB;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAAA,EAC3H;AAEA,aAAO,+BAAwB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,OAAO,EAAE,GAAG,OAAO,MAAM;AAAA,EAC1B,CAAE;AACH,CAAE;",
6
+ "names": ["import_element", "Box"]
7
+ }
@@ -23,9 +23,9 @@ __export(box_exports, {
23
23
  Box: () => import_box.Box
24
24
  });
25
25
  module.exports = __toCommonJS(box_exports);
26
- var import_box = require("./box");
26
+ var import_box = require("./box.cjs");
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
29
  Box
30
30
  });
31
- //# sourceMappingURL=index.js.map
31
+ //# sourceMappingURL=index.cjs.map
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // packages/ui/src/box/types.ts
17
17
  var types_exports = {};
18
18
  module.exports = __toCommonJS(types_exports);
19
- //# sourceMappingURL=types.js.map
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/box/types.ts"],
4
+ "sourcesContent": ["import {\n\ttype PaddingSize,\n\ttype BorderRadiusSize,\n\ttype BorderWidthSize,\n\ttype Target,\n\ttype SurfaceBackgroundColor,\n\ttype ContentForegroundColor,\n\ttype SurfaceStrokeColor,\n} from '@wordpress/theme';\nimport { type ComponentProps } from '../utils/types';\n\ntype DimensionVariant< T > = {\n\tblock?: T;\n\tblockStart?: T;\n\tblockEnd?: T;\n\tinline?: T;\n\tinlineStart?: T;\n\tinlineEnd?: T;\n};\n\nexport interface BoxProps extends ComponentProps< 'div' > {\n\t/**\n\t * The target rendering element design token grouping to use for the box.\n\t */\n\ttarget?: Target;\n\n\t/**\n\t * The surface background design token for box background color.\n\t */\n\tbackgroundColor?: SurfaceBackgroundColor;\n\n\t/**\n\t * The surface foreground design token for box text color.\n\t */\n\tcolor?: ContentForegroundColor;\n\n\t/**\n\t * The surface spacing design token or base unit multiplier for box padding.\n\t */\n\tpadding?: PaddingSize | DimensionVariant< PaddingSize >;\n\n\t/**\n\t * The surface border radius design token.\n\t */\n\tborderRadius?: BorderRadiusSize;\n\n\t/**\n\t * The surface border width design token.\n\t */\n\tborderWidth?: BorderWidthSize;\n\n\t/**\n\t * The surface border stroke color design token.\n\t */\n\tborderColor?: SurfaceStrokeColor;\n\n\t/**\n\t * The content to be rendered inside the component.\n\t */\n\tchildren?: React.ReactNode;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -17,9 +17,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // packages/ui/src/index.ts
18
18
  var index_exports = {};
19
19
  module.exports = __toCommonJS(index_exports);
20
- __reExport(index_exports, require("./box"), module.exports);
20
+ __reExport(index_exports, require("./box/index.cjs"), module.exports);
21
+ __reExport(index_exports, require("./badge/index.cjs"), module.exports);
22
+ __reExport(index_exports, require("./stack/index.cjs"), module.exports);
21
23
  // Annotate the CommonJS export names for ESM import in node:
22
24
  0 && (module.exports = {
23
- ...require("./box")
25
+ ...require("./box/index.cjs"),
26
+ ...require("./badge/index.cjs"),
27
+ ...require("./stack/index.cjs")
24
28
  });
25
- //# sourceMappingURL=index.js.map
29
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts"],
4
+ "sourcesContent": ["export * from './box';\nexport * from './badge';\nexport * from './stack';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,4BAAd;AACA,0BAAc,8BADd;AAEA,0BAAc,8BAFd;",
6
+ "names": []
7
+ }
@@ -23,9 +23,9 @@ __export(stack_exports, {
23
23
  Stack: () => import_stack.Stack
24
24
  });
25
25
  module.exports = __toCommonJS(stack_exports);
26
- var import_stack = require("./stack");
26
+ var import_stack = require("./stack.cjs");
27
27
  // Annotate the CommonJS export names for ESM import in node:
28
28
  0 && (module.exports = {
29
29
  Stack
30
30
  });
31
- //# sourceMappingURL=index.js.map
31
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/stack/index.ts"],
4
+ "sourcesContent": ["export { Stack } from './stack';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAsB;",
6
+ "names": []
7
+ }
@@ -33,9 +33,9 @@ __export(stack_exports, {
33
33
  Stack: () => Stack
34
34
  });
35
35
  module.exports = __toCommonJS(stack_exports);
36
- var import_clsx = __toESM(require("clsx"));
36
+ var import_clsx = __toESM(require("clsx"), 1);
37
37
  var import_element = require("@wordpress/element");
38
- var import_element2 = require("../utils/element");
38
+ var import_element2 = require("../utils/element.cjs");
39
39
 
40
40
  // packages/ui/src/stack/style.module.css
41
41
  var css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
@@ -72,4 +72,4 @@ var Stack = (0, import_element.forwardRef)(function Stack2({ direction, gap, ali
72
72
  0 && (module.exports = {
73
73
  Stack
74
74
  });
75
- //# sourceMappingURL=stack.js.map
75
+ //# sourceMappingURL=stack.cjs.map
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // packages/ui/src/stack/types.ts
17
17
  var types_exports = {};
18
18
  module.exports = __toCommonJS(types_exports);
19
- //# sourceMappingURL=types.js.map
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/stack/types.ts"],
4
+ "sourcesContent": ["import { type GapSize } from '@wordpress/theme';\nimport { type ComponentProps } from '../utils/types';\n\nexport interface StackProps extends ComponentProps< 'div' > {\n\t/**\n\t * The direction of the stack.\n\t */\n\tdirection?: Exclude<\n\t\tReact.CSSProperties[ 'flexDirection' ],\n\t\t'row-reverse' | 'column-reverse'\n\t>;\n\n\t/**\n\t * The amount of space between each child element using design system tokens.\n\t *\n\t * @default undefined\n\t */\n\tgap?: GapSize;\n\n\t/**\n\t * The alignment of the stack items along the cross axis.\n\t *\n\t * @default 'initial'\n\t */\n\talign?: React.CSSProperties[ 'alignItems' ];\n\n\t/**\n\t * The alignment of the stack items along the main axis.\n\t *\n\t * @default 'initial'\n\t */\n\tjustify?: React.CSSProperties[ 'justifyContent' ];\n\n\t/**\n\t * Whether the stack items should wrap to the next line.\n\t */\n\twrap?: Exclude< React.CSSProperties[ 'flexWrap' ], 'wrap-reverse' >;\n\n\t/**\n\t * The content to be rendered inside the component.\n\t */\n\tchildren?: React.ReactNode;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=css-modules.d.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -2,4 +2,4 @@
2
2
 
3
3
  // packages/ui/src/types/react.d.ts
4
4
  var import_react = require("react");
5
- //# sourceMappingURL=react.d.js.map
5
+ //# sourceMappingURL=react.d.cjs.map
@@ -42,4 +42,4 @@ var renderElement = ({
42
42
  0 && (module.exports = {
43
43
  renderElement
44
44
  });
45
- //# sourceMappingURL=element.js.map
45
+ //# sourceMappingURL=element.cjs.map
@@ -16,4 +16,4 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // packages/ui/src/utils/types.ts
17
17
  var types_exports = {};
18
18
  module.exports = __toCommonJS(types_exports);
19
- //# sourceMappingURL=types.js.map
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1,70 @@
1
+ // packages/ui/src/badge/badge.tsx
2
+ import { forwardRef } from "@wordpress/element";
3
+ import { Box } from "../box/index.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ var DEFAULT_RENDER = (props) => /* @__PURE__ */ jsx("span", { ...props });
6
+ var getIntentStyles = (intent) => {
7
+ switch (intent) {
8
+ case "high":
9
+ return {
10
+ backgroundColor: "error",
11
+ color: "error"
12
+ };
13
+ case "medium":
14
+ return {
15
+ backgroundColor: "warning",
16
+ color: "warning"
17
+ };
18
+ case "low":
19
+ return {
20
+ backgroundColor: "caution",
21
+ color: "caution"
22
+ };
23
+ case "stable":
24
+ return {
25
+ backgroundColor: "success",
26
+ color: "success"
27
+ };
28
+ case "informational":
29
+ return {
30
+ backgroundColor: "info",
31
+ color: "info"
32
+ };
33
+ case "draft":
34
+ return {
35
+ backgroundColor: "neutral-weak",
36
+ color: "neutral"
37
+ };
38
+ case "none":
39
+ default:
40
+ return {
41
+ backgroundColor: "neutral",
42
+ color: "neutral-weak"
43
+ };
44
+ }
45
+ };
46
+ var Badge = forwardRef(function Badge2({ children, intent = "none", render = DEFAULT_RENDER, ...props }, ref) {
47
+ const intentStyles = getIntentStyles(intent);
48
+ return /* @__PURE__ */ jsx(
49
+ Box,
50
+ {
51
+ ...intentStyles,
52
+ padding: { inline: "xs", block: "2xs" },
53
+ borderRadius: "lg",
54
+ render,
55
+ style: {
56
+ fontFamily: "var(--wpds-font-family-body)",
57
+ fontSize: "var(--wpds-font-size-small)",
58
+ fontWeight: "400",
59
+ lineHeight: "var(--wpds-font-line-height-x-small)",
60
+ ...props.style
61
+ },
62
+ ref,
63
+ children
64
+ }
65
+ );
66
+ });
67
+ export {
68
+ Badge
69
+ };
70
+ //# sourceMappingURL=badge.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/badge/badge.tsx"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { Box } from '../box';\nimport { type BoxProps } from '../box/types';\nimport { type BadgeProps } from './types';\n\n/**\n * Default render function that renders a span element with the given props.\n *\n * @param props The props to apply to the HTML element.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'span' > ) => (\n\t<span { ...props } />\n);\n\n/**\n * Maps intent values to Box backgroundColor and color props.\n * Uses strong emphasis styles (as emphasis prop has been removed).\n * @param intent\n */\nconst getIntentStyles = (\n\tintent: BadgeProps[ 'intent' ]\n): Partial< BoxProps > => {\n\tswitch ( intent ) {\n\t\tcase 'high':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'error',\n\t\t\t\tcolor: 'error',\n\t\t\t};\n\t\tcase 'medium':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'warning',\n\t\t\t\tcolor: 'warning',\n\t\t\t};\n\t\tcase 'low':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'caution',\n\t\t\t\tcolor: 'caution',\n\t\t\t};\n\t\tcase 'stable':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'success',\n\t\t\t\tcolor: 'success',\n\t\t\t};\n\t\tcase 'informational':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'info',\n\t\t\t\tcolor: 'info',\n\t\t\t};\n\t\tcase 'draft':\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral-weak',\n\t\t\t\tcolor: 'neutral',\n\t\t\t};\n\t\tcase 'none':\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tbackgroundColor: 'neutral',\n\t\t\t\tcolor: 'neutral-weak',\n\t\t\t};\n\t}\n};\n\n/**\n * A badge component for displaying labels with semantic intent.\n * Built on the Box primitive for consistent theming and accessibility.\n */\nexport const Badge = forwardRef< HTMLDivElement, BadgeProps >( function Badge(\n\t{ children, intent = 'none', render = DEFAULT_RENDER, ...props },\n\tref\n) {\n\tconst intentStyles = getIntentStyles( intent );\n\n\treturn (\n\t\t<Box\n\t\t\t{ ...intentStyles }\n\t\t\tpadding={ { inline: 'xs', block: '2xs' } }\n\t\t\tborderRadius=\"lg\"\n\t\t\trender={ render }\n\t\t\tstyle={ {\n\t\t\t\tfontFamily: 'var(--wpds-font-family-body)',\n\t\t\t\tfontSize: 'var(--wpds-font-size-small)',\n\t\t\t\tfontWeight: '400',\n\t\t\t\tlineHeight: 'var(--wpds-font-line-height-x-small)',\n\t\t\t\t...props.style,\n\t\t\t} }\n\t\t\tref={ ref }\n\t\t>\n\t\t\t{ children }\n\t\t</Box>\n\t);\n} );\n"],
5
+ "mappings": ";AAGA,SAAS,kBAAkB;AAK3B,SAAS,WAAW;AAUnB;AADD,IAAM,iBAAiB,CAAE,UACxB,oBAAC,UAAO,GAAG,OAAQ;AAQpB,IAAM,kBAAkB,CACvB,WACyB;AACzB,UAAS,QAAS;AAAA,IACjB,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AACJ,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,IACD,KAAK;AAAA,IACL;AACC,aAAO;AAAA,QACN,iBAAiB;AAAA,QACjB,OAAO;AAAA,MACR;AAAA,EACF;AACD;AAMO,IAAM,QAAQ,WAA0C,SAASA,OACvE,EAAE,UAAU,SAAS,QAAQ,SAAS,gBAAgB,GAAG,MAAM,GAC/D,KACC;AACD,QAAM,eAAe,gBAAiB,MAAO;AAE7C,SACC;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACL,SAAU,EAAE,QAAQ,MAAM,OAAO,MAAM;AAAA,MACvC,cAAa;AAAA,MACb;AAAA,MACA,OAAQ;AAAA,QACP,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,GAAG,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF,CAAE;",
6
+ "names": ["Badge"]
7
+ }
@@ -0,0 +1,6 @@
1
+ // packages/ui/src/badge/index.ts
2
+ import { Badge } from "./badge.js";
3
+ export {
4
+ Badge
5
+ };
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/badge/index.ts"],
4
+ "sourcesContent": ["export { Badge } from './badge';\n"],
5
+ "mappings": ";AAAA,SAAS,aAAa;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
@@ -1,10 +1,10 @@
1
1
  // packages/ui/src/box/box.tsx
2
2
  import { forwardRef } from "@wordpress/element";
3
- import { renderElement } from "../utils/element";
3
+ import { renderElement } from "../utils/element.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  var DEFAULT_RENDER = (props) => /* @__PURE__ */ jsx("div", { ...props });
6
6
  var capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
7
- var getSpacingValue = (property, target, value) => typeof value === "number" ? `calc(var(--wpds-dimension-base) * ${value})` : `var(--wpds-dimension-${property}-${target}-${value}, var(--wpds-dimension-${property}-surface-${value}))`;
7
+ var getSpacingValue = (property, target, value) => `var(--wpds-dimension-${property}-${target}-${value}, var(--wpds-dimension-${property}-surface-${value}))`;
8
8
  var getDimensionVariantStyles = (property, target, value) => typeof value !== "object" ? { [property]: getSpacingValue(property, target, value) } : Object.keys(value).reduce(
9
9
  (result, key) => ({
10
10
  ...result,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/box/box.tsx"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { type BoxProps } from './types';\nimport { renderElement } from '../utils/element';\n\n/**\n * Default render function that renders a div element with the given props.\n *\n * @param props The props to apply to the HTML element.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'div' > ) => (\n\t<div { ...props } />\n);\n\n/**\n * Capitalizes the first character of a string.\n *\n * @param str The string to capitalize.\n * @return The capitalized string.\n */\nconst capitalize = ( str: string ): string =>\n\tstr.charAt( 0 ).toUpperCase() + str.slice( 1 );\n\n/**\n * Converts a size value to a CSS design token property reference (with\n * fallback) or a calculated value based on the base unit.\n *\n * @param property The CSS property name.\n * @param target The design system token target.\n * @param value The size value, either a number (multiplier of base unit) or a string (token name).\n * @return A CSS value string with variable references.\n */\nconst getSpacingValue = (\n\tproperty: string,\n\ttarget: string,\n\tvalue: number | string\n): string =>\n\ttypeof value === 'number'\n\t\t? `calc(var(--wpds-dimension-base) * ${ value })`\n\t\t: `var(--wpds-dimension-${ property }-${ target }-${ value }, var(--wpds-dimension-${ property }-surface-${ value }))`;\n\n/**\n * Generates CSS styles for properties with optionally directional values,\n * normalizing single values and objects with directional keys for logical\n * properties.\n *\n * @param property The CSS property name from BoxProps.\n * @param target The design system token target.\n * @param value The property value (single or object with directional keys).\n * @return A CSSProperties object with the computed styles.\n */\nconst getDimensionVariantStyles = < T extends keyof BoxProps >(\n\tproperty: T,\n\ttarget: string,\n\tvalue: NonNullable< BoxProps[ T ] >\n): React.CSSProperties =>\n\ttypeof value !== 'object'\n\t\t? { [ property ]: getSpacingValue( property, target, value ) }\n\t\t: Object.keys( value ).reduce(\n\t\t\t\t( result, key ) => ( {\n\t\t\t\t\t...result,\n\t\t\t\t\t[ property + capitalize( key ) ]: getSpacingValue(\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tvalue[ key ]\n\t\t\t\t\t),\n\t\t\t\t} ),\n\t\t\t\t{} as Record< string, string >\n\t\t );\n\n/**\n * A low-level visual primitive that provides an interface for applying design\n * token-based customization for background, text, padding, and more.\n */\nexport const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(\n\t{\n\t\ttarget = 'surface',\n\t\tbackgroundColor,\n\t\tcolor,\n\t\tpadding,\n\t\tborderRadius,\n\t\tborderWidth,\n\t\tborderColor,\n\t\trender = DEFAULT_RENDER,\n\t\t...props\n\t},\n\tref\n) {\n\tconst style: React.CSSProperties = { ...props.style };\n\n\tif ( backgroundColor ) {\n\t\tstyle.backgroundColor = `var(--wpds-color-bg-${ target }-${ backgroundColor }, var(--wpds-color-bg-surface-${ backgroundColor }))`;\n\t}\n\n\tif ( color ) {\n\t\tstyle.color = `var(--wpds-color-fg-${ target }-${ color }, var(--wpds-color-fg-content-${ color }))`;\n\t}\n\n\tif ( padding ) {\n\t\tObject.assign(\n\t\t\tstyle,\n\t\t\tgetDimensionVariantStyles( 'padding', target, padding )\n\t\t);\n\t}\n\n\tif ( borderRadius ) {\n\t\tstyle.borderRadius = `var(--wpds-border-radius-${ target }-${ borderRadius }, var(--wpds-border-radius-surface-${ borderRadius }))`;\n\t}\n\n\tif ( borderWidth ) {\n\t\tstyle.borderWidth = `var(--wpds-border-width-${ target }-${ borderWidth }, var(--wpds-border-width-surface-${ borderWidth }))`;\n\t\tstyle.borderStyle = 'solid';\n\t}\n\n\tif ( borderColor ) {\n\t\tstyle.borderColor = `var(--wpds-color-stroke-${ target }-${ borderColor }, var(--wpds-color-stroke-surface-${ borderColor }))`;\n\t}\n\n\treturn renderElement< 'div' >( {\n\t\trender,\n\t\tref,\n\t\tprops: { ...props, style },\n\t} );\n} );\n"],
5
- "mappings": ";AAGA,SAAS,kBAAkB;AAM3B,SAAS,qBAAqB;AAQ7B;AADD,IAAM,iBAAiB,CAAE,UACxB,oBAAC,SAAM,GAAG,OAAQ;AASnB,IAAM,aAAa,CAAE,QACpB,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AAW9C,IAAM,kBAAkB,CACvB,UACA,QACA,UAEA,OAAO,UAAU,WACd,qCAAsC,KAAM,MAC5C,wBAAyB,QAAS,IAAK,MAAO,IAAK,KAAM,0BAA2B,QAAS,YAAa,KAAM;AAYpH,IAAM,4BAA4B,CACjC,UACA,QACA,UAEA,OAAO,UAAU,WACd,EAAE,CAAE,QAAS,GAAG,gBAAiB,UAAU,QAAQ,KAAM,EAAE,IAC3D,OAAO,KAAM,KAAM,EAAE;AAAA,EACrB,CAAE,QAAQ,SAAW;AAAA,IACpB,GAAG;AAAA,IACH,CAAE,WAAW,WAAY,GAAI,CAAE,GAAG;AAAA,MACjC;AAAA,MACA;AAAA,MACA,MAAO,GAAI;AAAA,IACZ;AAAA,EACD;AAAA,EACA,CAAC;AACD;AAMG,IAAM,MAAM,WAAwC,SAASA,KACnE;AAAA,EACC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACJ,GACA,KACC;AACD,QAAM,QAA6B,EAAE,GAAG,MAAM,MAAM;AAEpD,MAAK,iBAAkB;AACtB,UAAM,kBAAkB,uBAAwB,MAAO,IAAK,eAAgB,iCAAkC,eAAgB;AAAA,EAC/H;AAEA,MAAK,OAAQ;AACZ,UAAM,QAAQ,uBAAwB,MAAO,IAAK,KAAM,iCAAkC,KAAM;AAAA,EACjG;AAEA,MAAK,SAAU;AACd,WAAO;AAAA,MACN;AAAA,MACA,0BAA2B,WAAW,QAAQ,OAAQ;AAAA,IACvD;AAAA,EACD;AAEA,MAAK,cAAe;AACnB,UAAM,eAAe,4BAA6B,MAAO,IAAK,YAAa,sCAAuC,YAAa;AAAA,EAChI;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAC1H,UAAM,cAAc;AAAA,EACrB;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAAA,EAC3H;AAEA,SAAO,cAAwB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,OAAO,EAAE,GAAG,OAAO,MAAM;AAAA,EAC1B,CAAE;AACH,CAAE;",
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { type BoxProps } from './types';\nimport { renderElement } from '../utils/element';\n\n/**\n * Default render function that renders a div element with the given props.\n *\n * @param props The props to apply to the HTML element.\n */\nconst DEFAULT_RENDER = ( props: React.ComponentPropsWithoutRef< 'div' > ) => (\n\t<div { ...props } />\n);\n\n/**\n * Capitalizes the first character of a string.\n *\n * @param str The string to capitalize.\n * @return The capitalized string.\n */\nconst capitalize = ( str: string ): string =>\n\tstr.charAt( 0 ).toUpperCase() + str.slice( 1 );\n\n/**\n * Converts a size token name to a CSS design token property reference (with\n * fallback).\n *\n * @param property The CSS property name.\n * @param target The design system token target.\n * @param value The size token name.\n * @return A CSS value string with variable references.\n */\nconst getSpacingValue = (\n\tproperty: string,\n\ttarget: string,\n\tvalue: string\n): string =>\n\t`var(--wpds-dimension-${ property }-${ target }-${ value }, var(--wpds-dimension-${ property }-surface-${ value }))`;\n\n/**\n * Generates CSS styles for properties with optionally directional values,\n * normalizing single values and objects with directional keys for logical\n * properties.\n *\n * @param property The CSS property name from BoxProps.\n * @param target The design system token target.\n * @param value The property value (single or object with directional keys).\n * @return A CSSProperties object with the computed styles.\n */\nconst getDimensionVariantStyles = < T extends keyof BoxProps >(\n\tproperty: T,\n\ttarget: string,\n\tvalue: NonNullable< BoxProps[ T ] >\n): React.CSSProperties =>\n\ttypeof value !== 'object'\n\t\t? { [ property ]: getSpacingValue( property, target, value ) }\n\t\t: Object.keys( value ).reduce(\n\t\t\t\t( result, key ) => ( {\n\t\t\t\t\t...result,\n\t\t\t\t\t[ property + capitalize( key ) ]: getSpacingValue(\n\t\t\t\t\t\tproperty,\n\t\t\t\t\t\ttarget,\n\t\t\t\t\t\tvalue[ key ]\n\t\t\t\t\t),\n\t\t\t\t} ),\n\t\t\t\t{} as Record< string, string >\n\t\t );\n\n/**\n * A low-level visual primitive that provides an interface for applying design\n * token-based customization for background, text, padding, and more.\n */\nexport const Box = forwardRef< HTMLDivElement, BoxProps >( function Box(\n\t{\n\t\ttarget = 'surface',\n\t\tbackgroundColor,\n\t\tcolor,\n\t\tpadding,\n\t\tborderRadius,\n\t\tborderWidth,\n\t\tborderColor,\n\t\trender = DEFAULT_RENDER,\n\t\t...props\n\t},\n\tref\n) {\n\tconst style: React.CSSProperties = { ...props.style };\n\n\tif ( backgroundColor ) {\n\t\tstyle.backgroundColor = `var(--wpds-color-bg-${ target }-${ backgroundColor }, var(--wpds-color-bg-surface-${ backgroundColor }))`;\n\t}\n\n\tif ( color ) {\n\t\tstyle.color = `var(--wpds-color-fg-${ target }-${ color }, var(--wpds-color-fg-content-${ color }))`;\n\t}\n\n\tif ( padding ) {\n\t\tObject.assign(\n\t\t\tstyle,\n\t\t\tgetDimensionVariantStyles( 'padding', target, padding )\n\t\t);\n\t}\n\n\tif ( borderRadius ) {\n\t\tstyle.borderRadius = `var(--wpds-border-radius-${ target }-${ borderRadius }, var(--wpds-border-radius-surface-${ borderRadius }))`;\n\t}\n\n\tif ( borderWidth ) {\n\t\tstyle.borderWidth = `var(--wpds-border-width-${ target }-${ borderWidth }, var(--wpds-border-width-surface-${ borderWidth }))`;\n\t\tstyle.borderStyle = 'solid';\n\t}\n\n\tif ( borderColor ) {\n\t\tstyle.borderColor = `var(--wpds-color-stroke-${ target }-${ borderColor }, var(--wpds-color-stroke-surface-${ borderColor }))`;\n\t}\n\n\treturn renderElement< 'div' >( {\n\t\trender,\n\t\tref,\n\t\tprops: { ...props, style },\n\t} );\n} );\n"],
5
+ "mappings": ";AAGA,SAAS,kBAAkB;AAM3B,SAAS,qBAAqB;AAQ7B;AADD,IAAM,iBAAiB,CAAE,UACxB,oBAAC,SAAM,GAAG,OAAQ;AASnB,IAAM,aAAa,CAAE,QACpB,IAAI,OAAQ,CAAE,EAAE,YAAY,IAAI,IAAI,MAAO,CAAE;AAW9C,IAAM,kBAAkB,CACvB,UACA,QACA,UAEA,wBAAyB,QAAS,IAAK,MAAO,IAAK,KAAM,0BAA2B,QAAS,YAAa,KAAM;AAYjH,IAAM,4BAA4B,CACjC,UACA,QACA,UAEA,OAAO,UAAU,WACd,EAAE,CAAE,QAAS,GAAG,gBAAiB,UAAU,QAAQ,KAAM,EAAE,IAC3D,OAAO,KAAM,KAAM,EAAE;AAAA,EACrB,CAAE,QAAQ,SAAW;AAAA,IACpB,GAAG;AAAA,IACH,CAAE,WAAW,WAAY,GAAI,CAAE,GAAG;AAAA,MACjC;AAAA,MACA;AAAA,MACA,MAAO,GAAI;AAAA,IACZ;AAAA,EACD;AAAA,EACA,CAAC;AACD;AAMG,IAAM,MAAM,WAAwC,SAASA,KACnE;AAAA,EACC,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT,GAAG;AACJ,GACA,KACC;AACD,QAAM,QAA6B,EAAE,GAAG,MAAM,MAAM;AAEpD,MAAK,iBAAkB;AACtB,UAAM,kBAAkB,uBAAwB,MAAO,IAAK,eAAgB,iCAAkC,eAAgB;AAAA,EAC/H;AAEA,MAAK,OAAQ;AACZ,UAAM,QAAQ,uBAAwB,MAAO,IAAK,KAAM,iCAAkC,KAAM;AAAA,EACjG;AAEA,MAAK,SAAU;AACd,WAAO;AAAA,MACN;AAAA,MACA,0BAA2B,WAAW,QAAQ,OAAQ;AAAA,IACvD;AAAA,EACD;AAEA,MAAK,cAAe;AACnB,UAAM,eAAe,4BAA6B,MAAO,IAAK,YAAa,sCAAuC,YAAa;AAAA,EAChI;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAC1H,UAAM,cAAc;AAAA,EACrB;AAEA,MAAK,aAAc;AAClB,UAAM,cAAc,2BAA4B,MAAO,IAAK,WAAY,qCAAsC,WAAY;AAAA,EAC3H;AAEA,SAAO,cAAwB;AAAA,IAC9B;AAAA,IACA;AAAA,IACA,OAAO,EAAE,GAAG,OAAO,MAAM;AAAA,EAC1B,CAAE;AACH,CAAE;",
6
6
  "names": ["Box"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/ui/src/box/index.ts
2
- import { Box } from "./box";
2
+ import { Box } from "./box.js";
3
3
  export {
4
4
  Box
5
5
  };
@@ -1,3 +1,5 @@
1
1
  // packages/ui/src/index.ts
2
- export * from "./box";
2
+ export * from "./box/index.js";
3
+ export * from "./badge/index.js";
4
+ export * from "./stack/index.js";
3
5
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export * from './box';\n"],
5
- "mappings": ";AAAA,cAAc;",
4
+ "sourcesContent": ["export * from './box';\nexport * from './badge';\nexport * from './stack';\n"],
5
+ "mappings": ";AAAA,cAAc;AACd,cAAc;AACd,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,5 @@
1
1
  // packages/ui/src/stack/index.ts
2
- import { Stack } from "./stack";
2
+ import { Stack } from "./stack.js";
3
3
  export {
4
4
  Stack
5
5
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/stack/index.ts"],
4
- "sourcesContent": ["/**\n * Internal dependencies\n */\nexport { Stack } from './stack';\n"],
5
- "mappings": ";AAGA,SAAS,aAAa;",
4
+ "sourcesContent": ["export { Stack } from './stack';\n"],
5
+ "mappings": ";AAAA,SAAS,aAAa;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  // packages/ui/src/stack/stack.tsx
2
2
  import clsx from "clsx";
3
3
  import { forwardRef } from "@wordpress/element";
4
- import { renderElement } from "../utils/element";
4
+ import { renderElement } from "../utils/element.js";
5
5
 
6
6
  // packages/ui/src/stack/style.module.css
7
7
  var css = `@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;
@@ -0,0 +1,7 @@
1
+ import { type BadgeProps } from './types';
2
+ /**
3
+ * A badge component for displaying labels with semantic intent.
4
+ * Built on the Box primitive for consistent theming and accessibility.
5
+ */
6
+ export declare const Badge: import("react").ForwardRefExoticComponent<BadgeProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../src/badge/badge.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC;AA2D1C;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAwBf,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Badge } from './badge';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}