@postenbring/hedwig-react 4.4.1 → 4.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.
package/dist/index.mjs CHANGED
@@ -1,19 +1,15 @@
1
- import "./chunk-3D2MWIEX.mjs";
2
- import {
3
- WarningBanner
4
- } from "./chunk-EMQB6JIS.mjs";
5
1
  import "./chunk-JKCVB5TR.mjs";
6
2
  import {
7
3
  StyledHtml
8
4
  } from "./chunk-I76U35YW.mjs";
5
+ import "./chunk-3D2MWIEX.mjs";
6
+ import {
7
+ WarningBanner
8
+ } from "./chunk-EMQB6JIS.mjs";
9
9
  import "./chunk-3LYJRAOC.mjs";
10
10
  import {
11
11
  Table
12
12
  } from "./chunk-ZOZPWP3N.mjs";
13
- import "./chunk-CSXSUQ2M.mjs";
14
- import {
15
- Text
16
- } from "./chunk-DMOMTRIY.mjs";
17
13
  import "./chunk-7YWW46R3.mjs";
18
14
  import {
19
15
  Tabs
@@ -27,35 +23,47 @@ import {
27
23
  TabsTab
28
24
  } from "./chunk-WVCJV74B.mjs";
29
25
  import "./chunk-KQITCS3U.mjs";
26
+ import "./chunk-XELFBRQ4.mjs";
27
+ import {
28
+ Tag
29
+ } from "./chunk-RF25YRXA.mjs";
30
+ import "./chunk-CSXSUQ2M.mjs";
31
+ import {
32
+ Text
33
+ } from "./chunk-DMOMTRIY.mjs";
30
34
  import "./chunk-SRLM3K2X.mjs";
31
35
  import {
32
36
  ShowMoreButton
33
37
  } from "./chunk-JUHJZLH2.mjs";
34
- import "./chunk-JTZPQHKD.mjs";
35
- import {
36
- Skeleton
37
- } from "./chunk-QTC4ATZD.mjs";
38
38
  import "./chunk-AJFQHFQT.mjs";
39
39
  import {
40
40
  Spinner
41
41
  } from "./chunk-ZTZAPNZB.mjs";
42
+ import "./chunk-JTZPQHKD.mjs";
43
+ import {
44
+ Skeleton
45
+ } from "./chunk-QTC4ATZD.mjs";
42
46
  import "./chunk-TJH5QJMS.mjs";
43
47
  import {
44
48
  StepIndicator
45
49
  } from "./chunk-XQBJ75VD.mjs";
46
- import "./chunk-RC76SXBP.mjs";
50
+ import "./chunk-BVG5VSZK.mjs";
47
51
  import {
48
- Message,
49
- MessageDescription,
50
- MessageTitle
51
- } from "./chunk-ILN2L5NX.mjs";
52
- import "./chunk-FYFJ75NX.mjs";
52
+ Container
53
+ } from "./chunk-4QZR2H72.mjs";
54
+ import "./chunk-G65EYZFQ.mjs";
53
55
  import {
54
- Modal,
55
- ModalContent,
56
- ModalFooter,
57
- ModalHeader
58
- } from "./chunk-YQT2TN3U.mjs";
56
+ Grid,
57
+ GridItem
58
+ } from "./chunk-TC5PD4TA.mjs";
59
+ import "./chunk-ZQHLYAJU.mjs";
60
+ import {
61
+ HStack,
62
+ Stack,
63
+ VStack
64
+ } from "./chunk-FUIKSOJF.mjs";
65
+ import "./chunk-7ROE6ADK.mjs";
66
+ import "./chunk-NE6W2PCD.mjs";
59
67
  import "./chunk-H3E546OT.mjs";
60
68
  import {
61
69
  Navbar,
@@ -74,23 +82,19 @@ import {
74
82
  useNavbarExpendableMenuContext
75
83
  } from "./chunk-HOLFVKXQ.mjs";
76
84
  import "./chunk-XMDDGSCF.mjs";
77
- import "./chunk-BVG5VSZK.mjs";
78
- import {
79
- Container
80
- } from "./chunk-4QZR2H72.mjs";
81
- import "./chunk-G65EYZFQ.mjs";
85
+ import "./chunk-RC76SXBP.mjs";
82
86
  import {
83
- Grid,
84
- GridItem
85
- } from "./chunk-TC5PD4TA.mjs";
86
- import "./chunk-ZQHLYAJU.mjs";
87
+ Message,
88
+ MessageDescription,
89
+ MessageTitle
90
+ } from "./chunk-ILN2L5NX.mjs";
91
+ import "./chunk-FYFJ75NX.mjs";
87
92
  import {
88
- HStack,
89
- Stack,
90
- VStack
91
- } from "./chunk-FUIKSOJF.mjs";
92
- import "./chunk-7ROE6ADK.mjs";
93
- import "./chunk-NE6W2PCD.mjs";
93
+ Modal,
94
+ ModalContent,
95
+ ModalFooter,
96
+ ModalHeader
97
+ } from "./chunk-YQT2TN3U.mjs";
94
98
  import "./chunk-2YL2MVWN.mjs";
95
99
  import "./chunk-K2CB2NLY.mjs";
96
100
  import {
@@ -105,6 +109,10 @@ import {
105
109
  FooterLogo
106
110
  } from "./chunk-QDG2QLFV.mjs";
107
111
  import "./chunk-5J5LYE6Z.mjs";
112
+ import "./chunk-BYEJZSG5.mjs";
113
+ import {
114
+ Select
115
+ } from "./chunk-JGQTAIEP.mjs";
108
116
  import "./chunk-XSID7YR7.mjs";
109
117
  import {
110
118
  Suggestions
@@ -132,11 +140,11 @@ import "./chunk-CAIGPMDS.mjs";
132
140
  import {
133
141
  SearchWrapper
134
142
  } from "./chunk-RJ763KDH.mjs";
135
- import "./chunk-BYEJZSG5.mjs";
136
- import {
137
- Select
138
- } from "./chunk-JGQTAIEP.mjs";
139
143
  import "./chunk-KPPLVGZ3.mjs";
144
+ import {
145
+ ErrorSummary
146
+ } from "./chunk-NAXSP4VU.mjs";
147
+ import "./chunk-CKAL5ZJZ.mjs";
140
148
  import "./chunk-7LPYJC6S.mjs";
141
149
  import {
142
150
  Input
@@ -170,10 +178,6 @@ import "./chunk-5M6MEYM7.mjs";
170
178
  import {
171
179
  ValidationMessage
172
180
  } from "./chunk-F23MNQCK.mjs";
173
- import {
174
- ErrorSummary
175
- } from "./chunk-NAXSP4VU.mjs";
176
- import "./chunk-CKAL5ZJZ.mjs";
177
181
  import "./chunk-XLLYMQLW.mjs";
178
182
  import {
179
183
  Link
@@ -351,6 +355,7 @@ export {
351
355
  TabsContents,
352
356
  TabsList,
353
357
  TabsTab,
358
+ Tag,
354
359
  Text,
355
360
  Textarea,
356
361
  UnorderedList,
@@ -0,0 +1,3 @@
1
+ export { Tag } from "./tag";
2
+ export type * from "./tag";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tag/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,mBAAmB,OAAO,CAAC"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __objRest = (source, exclude) => {
24
+ var target = {};
25
+ for (var prop in source)
26
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
+ target[prop] = source[prop];
28
+ if (source != null && __getOwnPropSymbols)
29
+ for (var prop of __getOwnPropSymbols(source)) {
30
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
+ target[prop] = source[prop];
32
+ }
33
+ return target;
34
+ };
35
+ var __export = (target, all) => {
36
+ for (var name in all)
37
+ __defProp(target, name, { get: all[name], enumerable: true });
38
+ };
39
+ var __copyProps = (to, from, except, desc) => {
40
+ if (from && typeof from === "object" || typeof from === "function") {
41
+ for (let key of __getOwnPropNames(from))
42
+ if (!__hasOwnProp.call(to, key) && key !== except)
43
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
44
+ }
45
+ return to;
46
+ };
47
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
+
49
+ // src/tag/index.tsx
50
+ var tag_exports = {};
51
+ __export(tag_exports, {
52
+ Tag: () => Tag
53
+ });
54
+ module.exports = __toCommonJS(tag_exports);
55
+
56
+ // src/tag/tag.tsx
57
+ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
58
+ var import_react_slot = require("@radix-ui/react-slot");
59
+ var import_react = require("react");
60
+ var import_jsx_runtime = require("react/jsx-runtime");
61
+ var Tag = (0, import_react.forwardRef)(
62
+ (_a, ref) => {
63
+ var _b = _a, { "data-color": color, children, asChild, size = "default", className } = _b, rest = __objRest(_b, ["data-color", "children", "asChild", "size", "className"]);
64
+ const Component = asChild ? import_react_slot.Slot : "span";
65
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
66
+ Component,
67
+ __spreadProps(__spreadValues({
68
+ "data-color": color,
69
+ ref,
70
+ className: (0, import_typed_classname.clsx)("hds-tag", { "hds-tag--small": size === "small" }, className)
71
+ }, rest), {
72
+ children
73
+ })
74
+ );
75
+ }
76
+ );
77
+ Tag.displayName = "Tag";
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ Tag
81
+ });
82
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tag/index.tsx","../../src/tag/tag.tsx"],"sourcesContent":["export { Tag } from \"./tag\";\n\nexport type * from \"./tag\";\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n\n /**\n * Color of the tag. Combines the theme color and semantic variant.\n *\n * When omitted, the color is inherited from the parent(s).\n */\n \"data-color\"?: \"posten\" | \"bring\" | \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\n /**\n * Size of the tag\n *\n * @default \"default\"\n */\n size?: \"small\" | \"default\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * Tags are used to label, categorize or organize items using keywords to describe them.\n *\n * @example\n *\n * ```tsx\n * <Tag data-color=\"info\">Info</Tag>\n * ```\n *\n */\nexport const Tag = forwardRef<HTMLSpanElement, TagProps>(\n ({ \"data-color\": color, children, asChild, size = \"default\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n data-color={color}\n ref={ref}\n className={clsx(\"hds-tag\", { \"hds-tag--small\": size === \"small\" }, className as undefined)}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nTag.displayName = \"Tag\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AAyCrB;AAJC,IAAM,UAAM;AAAA,EACjB,CAAC,IAAkF,QAAQ;AAA1F,iBAAE,gBAAc,OAAO,UAAU,SAAS,OAAO,WAAW,UAxC/D,IAwCG,IAA0E,iBAA1E,IAA0E,CAAxE,cAAqB,YAAU,WAAS,QAAkB;AAC3D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,cAAY;AAAA,QACZ;AAAA,QACA,eAAW,6BAAK,WAAW,EAAE,kBAAkB,SAAS,QAAQ,GAAG,SAAsB;AAAA,SACrF,OAJL;AAAA,QAME;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,IAAI,cAAc;","names":[]}
@@ -0,0 +1,9 @@
1
+ import "../chunk-XELFBRQ4.mjs";
2
+ import {
3
+ Tag
4
+ } from "../chunk-RF25YRXA.mjs";
5
+ import "../chunk-YOSPWY5K.mjs";
6
+ export {
7
+ Tag
8
+ };
9
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,33 @@
1
+ export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
2
+ children: React.ReactNode;
3
+ /**
4
+ * Color of the tag. Combines the theme color and semantic variant.
5
+ *
6
+ * When omitted, the color is inherited from the parent(s).
7
+ */
8
+ "data-color"?: "posten" | "bring" | "neutral" | "info" | "success" | "warning" | "error";
9
+ /**
10
+ * Size of the tag
11
+ *
12
+ * @default "default"
13
+ */
14
+ size?: "small" | "default";
15
+ /**
16
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
17
+ *
18
+ * @default false
19
+ */
20
+ asChild?: boolean;
21
+ }
22
+ /**
23
+ * Tags are used to label, categorize or organize items using keywords to describe them.
24
+ *
25
+ * @example
26
+ *
27
+ * ```tsx
28
+ * <Tag data-color="info">Info</Tag>
29
+ * ```
30
+ *
31
+ */
32
+ export declare const Tag: import("react").ForwardRefExoticComponent<TagProps & import("react").RefAttributes<HTMLSpanElement>>;
33
+ //# sourceMappingURL=tag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../src/tag/tag.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,QAAS,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACrE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAEzF;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,GAAG,sGAcf,CAAC"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __objRest = (source, exclude) => {
24
+ var target = {};
25
+ for (var prop in source)
26
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
27
+ target[prop] = source[prop];
28
+ if (source != null && __getOwnPropSymbols)
29
+ for (var prop of __getOwnPropSymbols(source)) {
30
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
31
+ target[prop] = source[prop];
32
+ }
33
+ return target;
34
+ };
35
+ var __export = (target, all) => {
36
+ for (var name in all)
37
+ __defProp(target, name, { get: all[name], enumerable: true });
38
+ };
39
+ var __copyProps = (to, from, except, desc) => {
40
+ if (from && typeof from === "object" || typeof from === "function") {
41
+ for (let key of __getOwnPropNames(from))
42
+ if (!__hasOwnProp.call(to, key) && key !== except)
43
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
44
+ }
45
+ return to;
46
+ };
47
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
48
+
49
+ // src/tag/tag.tsx
50
+ var tag_exports = {};
51
+ __export(tag_exports, {
52
+ Tag: () => Tag
53
+ });
54
+ module.exports = __toCommonJS(tag_exports);
55
+ var import_typed_classname = require("@postenbring/hedwig-css/typed-classname");
56
+ var import_react_slot = require("@radix-ui/react-slot");
57
+ var import_react = require("react");
58
+ var import_jsx_runtime = require("react/jsx-runtime");
59
+ var Tag = (0, import_react.forwardRef)(
60
+ (_a, ref) => {
61
+ var _b = _a, { "data-color": color, children, asChild, size = "default", className } = _b, rest = __objRest(_b, ["data-color", "children", "asChild", "size", "className"]);
62
+ const Component = asChild ? import_react_slot.Slot : "span";
63
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
64
+ Component,
65
+ __spreadProps(__spreadValues({
66
+ "data-color": color,
67
+ ref,
68
+ className: (0, import_typed_classname.clsx)("hds-tag", { "hds-tag--small": size === "small" }, className)
69
+ }, rest), {
70
+ children
71
+ })
72
+ );
73
+ }
74
+ );
75
+ Tag.displayName = "Tag";
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ Tag
79
+ });
80
+ //# sourceMappingURL=tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/tag/tag.tsx"],"sourcesContent":["import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { forwardRef } from \"react\";\n\nexport interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode;\n\n /**\n * Color of the tag. Combines the theme color and semantic variant.\n *\n * When omitted, the color is inherited from the parent(s).\n */\n \"data-color\"?: \"posten\" | \"bring\" | \"neutral\" | \"info\" | \"success\" | \"warning\" | \"error\";\n\n /**\n * Size of the tag\n *\n * @default \"default\"\n */\n size?: \"small\" | \"default\";\n\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n *\n * @default false\n */\n asChild?: boolean;\n}\n\n/**\n * Tags are used to label, categorize or organize items using keywords to describe them.\n *\n * @example\n *\n * ```tsx\n * <Tag data-color=\"info\">Info</Tag>\n * ```\n *\n */\nexport const Tag = forwardRef<HTMLSpanElement, TagProps>(\n ({ \"data-color\": color, children, asChild, size = \"default\", className, ...rest }, ref) => {\n const Component = asChild ? Slot : \"span\";\n return (\n <Component\n data-color={color}\n ref={ref}\n className={clsx(\"hds-tag\", { \"hds-tag--small\": size === \"small\" }, className as undefined)}\n {...rest}\n >\n {children}\n </Component>\n );\n },\n);\nTag.displayName = \"Tag\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAAqB;AACrB,wBAAqB;AACrB,mBAA2B;AAyCrB;AAJC,IAAM,UAAM;AAAA,EACjB,CAAC,IAAkF,QAAQ;AAA1F,iBAAE,gBAAc,OAAO,UAAU,SAAS,OAAO,WAAW,UAxC/D,IAwCG,IAA0E,iBAA1E,IAA0E,CAAxE,cAAqB,YAAU,WAAS,QAAkB;AAC3D,UAAM,YAAY,UAAU,yBAAO;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,cAAY;AAAA,QACZ;AAAA,QACA,eAAW,6BAAK,WAAW,EAAE,kBAAkB,SAAS,QAAQ,GAAG,SAAsB;AAAA,SACrF,OAJL;AAAA,QAME;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,IAAI,cAAc;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ Tag
3
+ } from "../chunk-RF25YRXA.mjs";
4
+ import "../chunk-YOSPWY5K.mjs";
5
+ export {
6
+ Tag
7
+ };
8
+ //# sourceMappingURL=tag.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postenbring/hedwig-react",
3
- "version": "4.4.1",
3
+ "version": "4.5.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "@radix-ui/react-popover": "1.1.23",
33
33
  "@radix-ui/react-slot": "1.3.3",
34
- "@postenbring/hedwig-css": "4.4.1"
34
+ "@postenbring/hedwig-css": "4.5.0"
35
35
  },
36
36
  "publishConfig": {
37
37
  "access": "public"
package/src/index.ts CHANGED
@@ -25,6 +25,7 @@ export * from "./step-indicator";
25
25
  export * from "./styled-html";
26
26
  export * from "./table";
27
27
  export * from "./tabs";
28
+ export * from "./tag";
28
29
  export * from "./text";
29
30
  export * from "./utils";
30
31
  export * from "./warning-banner";
@@ -0,0 +1,3 @@
1
+ export { Tag } from "./tag";
2
+
3
+ export type * from "./tag";
@@ -0,0 +1,20 @@
1
+ /* eslint-disable import/no-extraneous-dependencies -- storybook story */
2
+ import type { Meta, StoryObj } from "@storybook/react-vite";
3
+ import { Tag } from ".";
4
+
5
+ const meta: Meta<typeof Tag> = {
6
+ title: "Tag",
7
+ component: Tag,
8
+ };
9
+
10
+ export default meta;
11
+
12
+ export const Preview: StoryObj<typeof Tag> = {
13
+ tags: ["!dev"],
14
+ args: {
15
+ children: "Tag",
16
+ "data-color": "posten",
17
+ size: "default",
18
+ asChild: false,
19
+ },
20
+ };
@@ -0,0 +1,55 @@
1
+ import { clsx } from "@postenbring/hedwig-css/typed-classname";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import { forwardRef } from "react";
4
+
5
+ export interface TagProps extends React.HTMLAttributes<HTMLSpanElement> {
6
+ children: React.ReactNode;
7
+
8
+ /**
9
+ * Color of the tag. Combines the theme color and semantic variant.
10
+ *
11
+ * When omitted, the color is inherited from the parent(s).
12
+ */
13
+ "data-color"?: "posten" | "bring" | "neutral" | "info" | "success" | "warning" | "error";
14
+
15
+ /**
16
+ * Size of the tag
17
+ *
18
+ * @default "default"
19
+ */
20
+ size?: "small" | "default";
21
+
22
+ /**
23
+ * Change the default rendered element for the one passed as a child, merging their props and behavior.
24
+ *
25
+ * @default false
26
+ */
27
+ asChild?: boolean;
28
+ }
29
+
30
+ /**
31
+ * Tags are used to label, categorize or organize items using keywords to describe them.
32
+ *
33
+ * @example
34
+ *
35
+ * ```tsx
36
+ * <Tag data-color="info">Info</Tag>
37
+ * ```
38
+ *
39
+ */
40
+ export const Tag = forwardRef<HTMLSpanElement, TagProps>(
41
+ ({ "data-color": color, children, asChild, size = "default", className, ...rest }, ref) => {
42
+ const Component = asChild ? Slot : "span";
43
+ return (
44
+ <Component
45
+ data-color={color}
46
+ ref={ref}
47
+ className={clsx("hds-tag", { "hds-tag--small": size === "small" }, className as undefined)}
48
+ {...rest}
49
+ >
50
+ {children}
51
+ </Component>
52
+ );
53
+ },
54
+ );
55
+ Tag.displayName = "Tag";