@postenbring/hedwig-react 4.4.1 → 4.5.1
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/chunk-RF25YRXA.mjs +33 -0
- package/dist/chunk-RF25YRXA.mjs.map +1 -0
- package/dist/chunk-XELFBRQ4.mjs +1 -0
- package/dist/chunk-XELFBRQ4.mjs.map +1 -0
- package/dist/form/index.mjs +14 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -28
- package/dist/tag/index.d.ts +3 -0
- package/dist/tag/index.d.ts.map +1 -0
- package/dist/tag/index.js +82 -0
- package/dist/tag/index.js.map +1 -0
- package/dist/tag/index.mjs +9 -0
- package/dist/tag/index.mjs.map +1 -0
- package/dist/tag/tag.d.ts +33 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +80 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/tag/tag.mjs +8 -0
- package/dist/tag/tag.mjs.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/tag/index.tsx +3 -0
- package/src/tag/tag.stories.tsx +20 -0
- package/src/tag/tag.tsx +55 -0
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,14 @@ import "./chunk-3D2MWIEX.mjs";
|
|
|
2
2
|
import {
|
|
3
3
|
WarningBanner
|
|
4
4
|
} from "./chunk-EMQB6JIS.mjs";
|
|
5
|
+
import "./chunk-XELFBRQ4.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Tag
|
|
8
|
+
} from "./chunk-RF25YRXA.mjs";
|
|
9
|
+
import "./chunk-CSXSUQ2M.mjs";
|
|
10
|
+
import {
|
|
11
|
+
Text
|
|
12
|
+
} from "./chunk-DMOMTRIY.mjs";
|
|
5
13
|
import "./chunk-JKCVB5TR.mjs";
|
|
6
14
|
import {
|
|
7
15
|
StyledHtml
|
|
@@ -10,10 +18,6 @@ import "./chunk-3LYJRAOC.mjs";
|
|
|
10
18
|
import {
|
|
11
19
|
Table
|
|
12
20
|
} from "./chunk-ZOZPWP3N.mjs";
|
|
13
|
-
import "./chunk-CSXSUQ2M.mjs";
|
|
14
|
-
import {
|
|
15
|
-
Text
|
|
16
|
-
} from "./chunk-DMOMTRIY.mjs";
|
|
17
21
|
import "./chunk-7YWW46R3.mjs";
|
|
18
22
|
import {
|
|
19
23
|
Tabs
|
|
@@ -27,14 +31,16 @@ import {
|
|
|
27
31
|
TabsTab
|
|
28
32
|
} from "./chunk-WVCJV74B.mjs";
|
|
29
33
|
import "./chunk-KQITCS3U.mjs";
|
|
30
|
-
import "./chunk-SRLM3K2X.mjs";
|
|
31
|
-
import {
|
|
32
|
-
ShowMoreButton
|
|
33
|
-
} from "./chunk-JUHJZLH2.mjs";
|
|
34
34
|
import "./chunk-JTZPQHKD.mjs";
|
|
35
35
|
import {
|
|
36
36
|
Skeleton
|
|
37
37
|
} from "./chunk-QTC4ATZD.mjs";
|
|
38
|
+
import "./chunk-RC76SXBP.mjs";
|
|
39
|
+
import {
|
|
40
|
+
Message,
|
|
41
|
+
MessageDescription,
|
|
42
|
+
MessageTitle
|
|
43
|
+
} from "./chunk-ILN2L5NX.mjs";
|
|
38
44
|
import "./chunk-AJFQHFQT.mjs";
|
|
39
45
|
import {
|
|
40
46
|
Spinner
|
|
@@ -43,12 +49,6 @@ import "./chunk-TJH5QJMS.mjs";
|
|
|
43
49
|
import {
|
|
44
50
|
StepIndicator
|
|
45
51
|
} from "./chunk-XQBJ75VD.mjs";
|
|
46
|
-
import "./chunk-RC76SXBP.mjs";
|
|
47
|
-
import {
|
|
48
|
-
Message,
|
|
49
|
-
MessageDescription,
|
|
50
|
-
MessageTitle
|
|
51
|
-
} from "./chunk-ILN2L5NX.mjs";
|
|
52
52
|
import "./chunk-FYFJ75NX.mjs";
|
|
53
53
|
import {
|
|
54
54
|
Modal,
|
|
@@ -74,6 +74,10 @@ import {
|
|
|
74
74
|
useNavbarExpendableMenuContext
|
|
75
75
|
} from "./chunk-HOLFVKXQ.mjs";
|
|
76
76
|
import "./chunk-XMDDGSCF.mjs";
|
|
77
|
+
import "./chunk-SRLM3K2X.mjs";
|
|
78
|
+
import {
|
|
79
|
+
ShowMoreButton
|
|
80
|
+
} from "./chunk-JUHJZLH2.mjs";
|
|
77
81
|
import "./chunk-BVG5VSZK.mjs";
|
|
78
82
|
import {
|
|
79
83
|
Container
|
|
@@ -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,15 +140,21 @@ 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
|
|
143
151
|
} from "./chunk-62VLFCXX.mjs";
|
|
152
|
+
import "./chunk-TDLSHJ4Z.mjs";
|
|
153
|
+
import {
|
|
154
|
+
DatePicker
|
|
155
|
+
} from "./chunk-RGZSYJFL.mjs";
|
|
156
|
+
import "./chunk-Y5SUMFYJ.mjs";
|
|
157
|
+
import "./chunk-DMRQEQQK.mjs";
|
|
144
158
|
import "./chunk-YJOOSTJC.mjs";
|
|
145
159
|
import {
|
|
146
160
|
Checkbox
|
|
@@ -156,12 +170,6 @@ import {
|
|
|
156
170
|
import {
|
|
157
171
|
FieldsetLegend
|
|
158
172
|
} from "./chunk-CD4LCDK3.mjs";
|
|
159
|
-
import "./chunk-TDLSHJ4Z.mjs";
|
|
160
|
-
import {
|
|
161
|
-
DatePicker
|
|
162
|
-
} from "./chunk-RGZSYJFL.mjs";
|
|
163
|
-
import "./chunk-Y5SUMFYJ.mjs";
|
|
164
|
-
import "./chunk-DMRQEQQK.mjs";
|
|
165
173
|
import "./chunk-NSLSA7F7.mjs";
|
|
166
174
|
import {
|
|
167
175
|
ErrorMessage
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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"}
|
package/dist/tag/tag.js
ADDED
|
@@ -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":[]}
|
package/dist/tag/tag.mjs
ADDED
|
@@ -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.
|
|
3
|
+
"version": "4.5.1",
|
|
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.
|
|
34
|
+
"@postenbring/hedwig-css": "4.5.1"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
package/src/index.ts
CHANGED
|
@@ -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
|
+
};
|
package/src/tag/tag.tsx
ADDED
|
@@ -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";
|