@bonprix-ds/react-typography 1.0.3 → 1.1.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.d.ts CHANGED
@@ -1,37 +1,3 @@
1
- import { default as default_2 } from 'react';
2
- import { ElementType } from 'react';
3
- import { ReactNode } from 'react';
4
-
5
- declare const Typography: ({ children, variant, component, bold, strikeThrough, color, align, truncate, className, id, }: TypographyProps) => default_2.JSX.Element;
6
- export default Typography;
7
-
8
- declare type TypographyColor = "inherit" | "primary" | "on-primary-high" | "on-primary-mid" | "on-bg-high" | "on-bg-mid" | "on-bg-low" | "error" | "alert" | "success" | "info" | "sale" | "on-sale" | "disabled" | "sustainable" | "black" | "white";
9
-
10
- export declare interface TypographyProps {
11
- /** The content of the Typography component. Might also be other markup elements. */
12
- children: ReactNode;
13
- /** A valid typography variant. */
14
- variant?: TypographyVariant;
15
- /** An HTML element, that should be used. */
16
- component?: ElementType;
17
- /** If `true`, the text will be bold. */
18
- bold?: boolean;
19
- /** If `true`, the text will be displayed with a strikethrough. */
20
- strikeThrough?: boolean;
21
- /** A valid color variant. */
22
- color?: TypographyColor;
23
- /** The horizontal text alignment. */
24
- align?: "left" | "center" | "right";
25
- /** Adds Ellipsis when text doesn't fit. */
26
- truncate?: boolean;
27
- /** Additional class names to apply to the component. */
28
- className?: string;
29
- /** Id of the component. */
30
- id?: string;
31
- }
32
-
33
- declare type TypographyVariant = (typeof typographyVariants)[number];
34
-
35
- export declare const typographyVariants: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "bonprix-h1", "bonprix-h2", "bonprix-h3", "bonprix-h4", "bonprix-h5", "bonprix-h6", "body1", "body1-bold", "body2", "body2-bold", "subtitle1", "subtitle2", "caption", "overline"];
36
-
37
- export { }
1
+ export { default } from "./src/Typography";
2
+ export type { Props as TypographyProps } from "./src/Typography";
3
+ export * from "./src/constants";
package/dist/index.js CHANGED
@@ -1,137 +1,3 @@
1
- import { twMerge as e } from "tailwind-merge";
2
- import "react";
3
- import { tv as t } from "tailwind-variants";
4
- import { jsx as n } from "react/jsx-runtime";
5
- //#region src/Typography.tsx
6
- var r = t({
7
- base: "my-0",
8
- variants: {
9
- variant: {
10
- h1: "typography-h1",
11
- h2: "typography-h2",
12
- h3: "typography-h3",
13
- h4: "typography-h4",
14
- h5: "typography-h5",
15
- h6: "typography-h6",
16
- "bonprix-h1": "typography-bonprix-h1",
17
- "bonprix-h2": "typography-bonprix-h2",
18
- "bonprix-h3": "typography-bonprix-h3",
19
- "bonprix-h4": "typography-bonprix-h4",
20
- "bonprix-h5": "typography-bonprix-h5",
21
- "bonprix-h6": "typography-bonprix-h6",
22
- subtitle1: "typography-subtitle1",
23
- subtitle2: "typography-subtitle2",
24
- body1: "typography-body1",
25
- "body1-bold": "typography-body1-bold",
26
- body2: "typography-body2",
27
- "body2-bold": "typography-body2-bold",
28
- caption: "typography-caption",
29
- overline: "typography-overline"
30
- },
31
- color: {
32
- inherit: "text-inherit",
33
- primary: "text-clr-primary",
34
- "on-primary-high": "text-clr-on-primary-high",
35
- "on-primary-mid": "text-clr-on-primary-mid",
36
- "on-bg-high": "text-clr-on-bg-high",
37
- "on-bg-mid": "text-clr-on-bg-mid",
38
- "on-bg-low": "text-clr-on-bg-low",
39
- error: "text-clr-fg-error",
40
- alert: "text-clr-fg-alert",
41
- success: "text-clr-fg-success",
42
- info: "text-clr-fg-info",
43
- sale: "text-clr-sale",
44
- "on-sale": "text-clr-on-sale",
45
- disabled: "text-clr-disabled",
46
- sustainable: "text-clr-sustainable",
47
- black: "text-clr-black",
48
- white: "text-clr-white"
49
- },
50
- bold: { true: "font-bold" },
51
- strikeThrough: { true: "line-through" },
52
- align: {
53
- left: "text-start",
54
- center: "text-center",
55
- right: "text-end"
56
- },
57
- truncate: { true: "truncate" },
58
- balance: { true: "text-balance" }
59
- }
60
- }), i = [
61
- "h1",
62
- "h2",
63
- "h3",
64
- "h4",
65
- "bonprix-h1",
66
- "bonprix-h2",
67
- "bonprix-h3",
68
- "bonprix-h4"
69
- ], a = ({ children: t, variant: a = "body1", component: o = "p", bold: s = !1, strikeThrough: c = !1, color: l = "on-bg-high", align: u = "left", truncate: d = !1, className: f = "", id: p }) => {
70
- let m = o ?? {
71
- h1: "h1",
72
- h2: "h2",
73
- h3: "h3",
74
- h4: "h4",
75
- h5: "h5",
76
- h6: "h6",
77
- "bonprix-h1": "h1",
78
- "bonprix-h2": "h2",
79
- "bonprix-h3": "h3",
80
- "bonprix-h4": "h4",
81
- "bonprix-h5": "h5",
82
- "bonprix-h6": "h6",
83
- subtitle1: "h6",
84
- subtitle2: "h6",
85
- body1: "p",
86
- "body1-bold": "p",
87
- body2: "p",
88
- "body2-bold": "p",
89
- caption: "span",
90
- overline: "span"
91
- }[a];
92
- return /* @__PURE__ */ n(m, {
93
- className: e(r({
94
- variant: a,
95
- bold: s,
96
- strikeThrough: c,
97
- color: l,
98
- align: u,
99
- truncate: d,
100
- balance: i.includes(a)
101
- }), f),
102
- "data-bpds": "typography",
103
- "data-bpds-variant": a,
104
- "data-bpds-color": l,
105
- "data-bpds-align": u,
106
- "data-bpds-bold": s,
107
- "data-bpds-strike-through": c,
108
- "data-bpds-truncate": d,
109
- id: p,
110
- children: t
111
- });
112
- }, o = [
113
- "h1",
114
- "h2",
115
- "h3",
116
- "h4",
117
- "h5",
118
- "h6",
119
- "bonprix-h1",
120
- "bonprix-h2",
121
- "bonprix-h3",
122
- "bonprix-h4",
123
- "bonprix-h5",
124
- "bonprix-h6",
125
- "body1",
126
- "body1-bold",
127
- "body2",
128
- "body2-bold",
129
- "subtitle1",
130
- "subtitle2",
131
- "caption",
132
- "overline"
133
- ];
134
- //#endregion
135
- export { a as default, o as typographyVariants };
136
-
137
- //# sourceMappingURL=index.js.map
1
+ import e from "./src/Typography.js";
2
+ import { typographyVariants as t } from "./src/constants.js";
3
+ export { e as default, t as typographyVariants };
@@ -0,0 +1,30 @@
1
+ import React, { ElementType, ReactNode } from "react";
2
+ import { typographyVariants } from "./constants";
3
+ type TypographyColor = "inherit" | "primary" | "on-primary-high" | "on-primary-mid" | "on-bg-high" | "on-bg-mid" | "on-bg-low" | "error" | "alert" | "success" | "info" | "sale" | "on-sale" | "disabled" | "sustainable" | "black" | "white";
4
+ type TypographyVariant = (typeof typographyVariants)[number];
5
+ /** @deprecated [typography-component] Use a native element with the `typography-*` and `text-clr-*` classes instead. */
6
+ export interface Props {
7
+ /** The content of the Typography component. Might also be other markup elements. */
8
+ children: ReactNode;
9
+ /** A valid typography variant. */
10
+ variant?: TypographyVariant;
11
+ /** An HTML element, that should be used. */
12
+ component?: ElementType;
13
+ /** If `true`, the text will be bold. */
14
+ bold?: boolean;
15
+ /** If `true`, the text will be displayed with a strikethrough. */
16
+ strikeThrough?: boolean;
17
+ /** A valid color variant. */
18
+ color?: TypographyColor;
19
+ /** The horizontal text alignment. */
20
+ align?: "left" | "center" | "right";
21
+ /** Adds Ellipsis when text doesn't fit. */
22
+ truncate?: boolean;
23
+ /** Additional class names to apply to the component. */
24
+ className?: string;
25
+ /** Id of the component. */
26
+ id?: string;
27
+ }
28
+ /** @deprecated [typography-component] Use a native element with the `typography-*` and `text-clr-*` classes instead. */
29
+ declare const Typography: ({ children, variant, component, bold, strikeThrough, color, align, truncate, className, id, }: Props) => React.JSX.Element;
30
+ export default Typography;
@@ -0,0 +1,55 @@
1
+ import { balancedVariants as e, generateClasses as t } from "./classes.js";
2
+ import "react";
3
+ import { twMerge as n } from "tailwind-merge";
4
+ import { warnDeprecated as r } from "@bonprix-ds/utils/deprecation";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ //#region src/Typography.tsx
7
+ var a = ({ children: a, variant: o = "body1", component: s = "p", bold: c = !1, strikeThrough: l = !1, color: u = "on-bg-high", align: d = "left", truncate: f = !1, className: p = "", id: m }) => {
8
+ r("typography-component");
9
+ let h = s ?? {
10
+ h1: "h1",
11
+ h2: "h2",
12
+ h3: "h3",
13
+ h4: "h4",
14
+ h5: "h5",
15
+ h6: "h6",
16
+ "bonprix-h1": "h1",
17
+ "bonprix-h2": "h2",
18
+ "bonprix-h3": "h3",
19
+ "bonprix-h4": "h4",
20
+ "bonprix-h5": "h5",
21
+ "bonprix-h6": "h6",
22
+ subtitle1: "h6",
23
+ subtitle2: "h6",
24
+ body1: "p",
25
+ "body1-bold": "p",
26
+ body2: "p",
27
+ "body2-bold": "p",
28
+ caption: "span",
29
+ overline: "span"
30
+ }[o];
31
+ return /* @__PURE__ */ i(h, {
32
+ className: n(t({
33
+ variant: o,
34
+ bold: c,
35
+ strikeThrough: l,
36
+ color: u,
37
+ align: d,
38
+ truncate: f,
39
+ balance: e.includes(o)
40
+ }), p),
41
+ "data-bpds": "typography",
42
+ "data-bpds-variant": o,
43
+ "data-bpds-color": u,
44
+ "data-bpds-align": d,
45
+ "data-bpds-bold": c,
46
+ "data-bpds-strike-through": l,
47
+ "data-bpds-truncate": f,
48
+ id: m,
49
+ children: a
50
+ });
51
+ };
52
+ //#endregion
53
+ export { a as default };
54
+
55
+ //# sourceMappingURL=Typography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Typography.js","names":["Typography","Component","component","variant","twMerge","generateClasses","balancedVariants","className","color","align","bold","strikeThrough","truncate"],"sources":["../../src/Typography.tsx"],"sourcesContent":["import React, { ElementType, ReactNode } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\n\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport { balancedVariants, generateClasses } from \"./classes\";\nimport { typographyVariants } from \"./constants\";\n\ntype TypographyColor =\n | \"inherit\"\n /* primary */\n | \"primary\"\n /* on primary */\n | \"on-primary-high\"\n | \"on-primary-mid\"\n /* on background */\n | \"on-bg-high\"\n | \"on-bg-mid\"\n | \"on-bg-low\"\n /* technical */\n | \"error\"\n | \"alert\"\n | \"success\"\n | \"info\"\n /* additional */\n | \"sale\"\n | \"on-sale\"\n | \"disabled\"\n | \"sustainable\"\n /* common */\n | \"black\"\n | \"white\";\n\ntype TypographyVariant = (typeof typographyVariants)[number];\n\n/** @deprecated [typography-component] Use a native element with the `typography-*` and `text-clr-*` classes instead. */\nexport interface Props {\n /** The content of the Typography component. Might also be other markup elements. */\n children: ReactNode;\n /** A valid typography variant. */\n variant?: TypographyVariant;\n /** An HTML element, that should be used. */\n component?: ElementType;\n /** If `true`, the text will be bold. */\n bold?: boolean;\n /** If `true`, the text will be displayed with a strikethrough. */\n strikeThrough?: boolean;\n /** A valid color variant. */\n color?: TypographyColor;\n /** The horizontal text alignment. */\n align?: \"left\" | \"center\" | \"right\";\n /** Adds Ellipsis when text doesn't fit. */\n truncate?: boolean;\n /** Additional class names to apply to the component. */\n className?: string;\n /** Id of the component. */\n id?: string;\n}\n\n/** @deprecated [typography-component] Use a native element with the `typography-*` and `text-clr-*` classes instead. */\nconst Typography = ({\n children,\n variant = \"body1\",\n component = \"p\",\n bold = false,\n strikeThrough = false,\n color = \"on-bg-high\",\n align = \"left\",\n truncate = false,\n className = \"\",\n id,\n}: Props) => {\n warnDeprecated(\"typography-component\");\n\n const typographyHtmlElementMapper: Record<TypographyVariant, string> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n \"bonprix-h1\": \"h1\",\n \"bonprix-h2\": \"h2\",\n \"bonprix-h3\": \"h3\",\n \"bonprix-h4\": \"h4\",\n \"bonprix-h5\": \"h5\",\n \"bonprix-h6\": \"h6\",\n subtitle1: \"h6\",\n subtitle2: \"h6\",\n body1: \"p\",\n \"body1-bold\": \"p\",\n body2: \"p\",\n \"body2-bold\": \"p\",\n caption: \"span\",\n overline: \"span\",\n };\n\n const Component = component ?? typographyHtmlElementMapper[variant];\n\n return (\n <Component\n className={twMerge(\n generateClasses({ variant, bold, strikeThrough, color, align, truncate, balance: balancedVariants.includes(variant) }),\n className,\n )}\n data-bpds=\"typography\"\n data-bpds-variant={variant}\n data-bpds-color={color}\n data-bpds-align={align}\n data-bpds-bold={bold}\n data-bpds-strike-through={strikeThrough}\n data-bpds-truncate={truncate}\n id={id}\n >\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n"],"mappings":";;;;;;AA4DA,IAAMA,KAAc,EAClB,aACA,aAAU,SACV,eAAY,KACZ,UAAO,IACP,mBAAgB,IAChB,WAAQ,cACR,WAAQ,QACR,cAAW,IACX,eAAY,IACZ,YACW;CACX,EAAe,sBAAsB;CAyBrC,IAAMC,IAAYC,KAAa;EAtB7B,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,WAAW;EACX,WAAW;EACX,OAAO;EACP,cAAc;EACd,OAAO;EACP,cAAc;EACd,SAAS;EACT,UAAU;CAGmB,EAA4BC;CAE3D,OACE,kBAACF,GAAD;EACE,WAAWG,EACTC,EAAgB;GAAE;GAAS;GAAM;GAAe;GAAO;GAAO;GAAU,SAASC,EAAiB,SAASH,CAAO;EAAE,CAAC,GACrHI,CACF;EACA,aAAU;EACV,qBAAmBJ;EACnB,mBAAiBK;EACjB,mBAAiBC;EACjB,kBAAgBC;EAChB,4BAA0BC;EAC1B,sBAAoBC;EAChB;EAEH;CACQ,CAAA;AAEf"}
@@ -0,0 +1,416 @@
1
+ import { typographyVariants } from "./constants";
2
+ export declare const generateClasses: import("tailwind-variants").TVReturnType<{
3
+ variant: {
4
+ h1: string;
5
+ h2: string;
6
+ h3: string;
7
+ h4: string;
8
+ h5: string;
9
+ h6: string;
10
+ "bonprix-h1": string;
11
+ "bonprix-h2": string;
12
+ "bonprix-h3": string;
13
+ "bonprix-h4": string;
14
+ "bonprix-h5": string;
15
+ "bonprix-h6": string;
16
+ subtitle1: string;
17
+ subtitle2: string;
18
+ body1: string;
19
+ "body1-bold": string;
20
+ body2: string;
21
+ "body2-bold": string;
22
+ caption: string;
23
+ overline: string;
24
+ };
25
+ color: {
26
+ inherit: string;
27
+ primary: string;
28
+ "on-primary-high": string;
29
+ "on-primary-mid": string;
30
+ "on-bg-high": string;
31
+ "on-bg-mid": string;
32
+ "on-bg-low": string;
33
+ error: string;
34
+ alert: string;
35
+ success: string;
36
+ info: string;
37
+ sale: string;
38
+ "on-sale": string;
39
+ disabled: string;
40
+ sustainable: string;
41
+ black: string;
42
+ white: string;
43
+ };
44
+ bold: {
45
+ true: string;
46
+ };
47
+ strikeThrough: {
48
+ true: string;
49
+ };
50
+ align: {
51
+ left: string;
52
+ center: string;
53
+ right: string;
54
+ };
55
+ truncate: {
56
+ true: string;
57
+ };
58
+ balance: {
59
+ true: string;
60
+ };
61
+ }, undefined, "my-0", import("tailwind-variants/dist/config.js").TVConfig<{
62
+ variant: {
63
+ h1: string;
64
+ h2: string;
65
+ h3: string;
66
+ h4: string;
67
+ h5: string;
68
+ h6: string;
69
+ "bonprix-h1": string;
70
+ "bonprix-h2": string;
71
+ "bonprix-h3": string;
72
+ "bonprix-h4": string;
73
+ "bonprix-h5": string;
74
+ "bonprix-h6": string;
75
+ subtitle1: string;
76
+ subtitle2: string;
77
+ body1: string;
78
+ "body1-bold": string;
79
+ body2: string;
80
+ "body2-bold": string;
81
+ caption: string;
82
+ overline: string;
83
+ };
84
+ color: {
85
+ inherit: string;
86
+ primary: string;
87
+ "on-primary-high": string;
88
+ "on-primary-mid": string;
89
+ "on-bg-high": string;
90
+ "on-bg-mid": string;
91
+ "on-bg-low": string;
92
+ error: string;
93
+ alert: string;
94
+ success: string;
95
+ info: string;
96
+ sale: string;
97
+ "on-sale": string;
98
+ disabled: string;
99
+ sustainable: string;
100
+ black: string;
101
+ white: string;
102
+ };
103
+ bold: {
104
+ true: string;
105
+ };
106
+ strikeThrough: {
107
+ true: string;
108
+ };
109
+ align: {
110
+ left: string;
111
+ center: string;
112
+ right: string;
113
+ };
114
+ truncate: {
115
+ true: string;
116
+ };
117
+ balance: {
118
+ true: string;
119
+ };
120
+ }, {
121
+ variant: {
122
+ h1: string;
123
+ h2: string;
124
+ h3: string;
125
+ h4: string;
126
+ h5: string;
127
+ h6: string;
128
+ "bonprix-h1": string;
129
+ "bonprix-h2": string;
130
+ "bonprix-h3": string;
131
+ "bonprix-h4": string;
132
+ "bonprix-h5": string;
133
+ "bonprix-h6": string;
134
+ subtitle1: string;
135
+ subtitle2: string;
136
+ body1: string;
137
+ "body1-bold": string;
138
+ body2: string;
139
+ "body2-bold": string;
140
+ caption: string;
141
+ overline: string;
142
+ };
143
+ color: {
144
+ inherit: string;
145
+ primary: string;
146
+ "on-primary-high": string;
147
+ "on-primary-mid": string;
148
+ "on-bg-high": string;
149
+ "on-bg-mid": string;
150
+ "on-bg-low": string;
151
+ error: string;
152
+ alert: string;
153
+ success: string;
154
+ info: string;
155
+ sale: string;
156
+ "on-sale": string;
157
+ disabled: string;
158
+ sustainable: string;
159
+ black: string;
160
+ white: string;
161
+ };
162
+ bold: {
163
+ true: string;
164
+ };
165
+ strikeThrough: {
166
+ true: string;
167
+ };
168
+ align: {
169
+ left: string;
170
+ center: string;
171
+ right: string;
172
+ };
173
+ truncate: {
174
+ true: string;
175
+ };
176
+ balance: {
177
+ true: string;
178
+ };
179
+ }>, {
180
+ variant: {
181
+ h1: string;
182
+ h2: string;
183
+ h3: string;
184
+ h4: string;
185
+ h5: string;
186
+ h6: string;
187
+ "bonprix-h1": string;
188
+ "bonprix-h2": string;
189
+ "bonprix-h3": string;
190
+ "bonprix-h4": string;
191
+ "bonprix-h5": string;
192
+ "bonprix-h6": string;
193
+ subtitle1: string;
194
+ subtitle2: string;
195
+ body1: string;
196
+ "body1-bold": string;
197
+ body2: string;
198
+ "body2-bold": string;
199
+ caption: string;
200
+ overline: string;
201
+ };
202
+ color: {
203
+ inherit: string;
204
+ primary: string;
205
+ "on-primary-high": string;
206
+ "on-primary-mid": string;
207
+ "on-bg-high": string;
208
+ "on-bg-mid": string;
209
+ "on-bg-low": string;
210
+ error: string;
211
+ alert: string;
212
+ success: string;
213
+ info: string;
214
+ sale: string;
215
+ "on-sale": string;
216
+ disabled: string;
217
+ sustainable: string;
218
+ black: string;
219
+ white: string;
220
+ };
221
+ bold: {
222
+ true: string;
223
+ };
224
+ strikeThrough: {
225
+ true: string;
226
+ };
227
+ align: {
228
+ left: string;
229
+ center: string;
230
+ right: string;
231
+ };
232
+ truncate: {
233
+ true: string;
234
+ };
235
+ balance: {
236
+ true: string;
237
+ };
238
+ }, undefined, import("tailwind-variants").TVReturnType<{
239
+ variant: {
240
+ h1: string;
241
+ h2: string;
242
+ h3: string;
243
+ h4: string;
244
+ h5: string;
245
+ h6: string;
246
+ "bonprix-h1": string;
247
+ "bonprix-h2": string;
248
+ "bonprix-h3": string;
249
+ "bonprix-h4": string;
250
+ "bonprix-h5": string;
251
+ "bonprix-h6": string;
252
+ subtitle1: string;
253
+ subtitle2: string;
254
+ body1: string;
255
+ "body1-bold": string;
256
+ body2: string;
257
+ "body2-bold": string;
258
+ caption: string;
259
+ overline: string;
260
+ };
261
+ color: {
262
+ inherit: string;
263
+ primary: string;
264
+ "on-primary-high": string;
265
+ "on-primary-mid": string;
266
+ "on-bg-high": string;
267
+ "on-bg-mid": string;
268
+ "on-bg-low": string;
269
+ error: string;
270
+ alert: string;
271
+ success: string;
272
+ info: string;
273
+ sale: string;
274
+ "on-sale": string;
275
+ disabled: string;
276
+ sustainable: string;
277
+ black: string;
278
+ white: string;
279
+ };
280
+ bold: {
281
+ true: string;
282
+ };
283
+ strikeThrough: {
284
+ true: string;
285
+ };
286
+ align: {
287
+ left: string;
288
+ center: string;
289
+ right: string;
290
+ };
291
+ truncate: {
292
+ true: string;
293
+ };
294
+ balance: {
295
+ true: string;
296
+ };
297
+ }, undefined, "my-0", import("tailwind-variants/dist/config.js").TVConfig<{
298
+ variant: {
299
+ h1: string;
300
+ h2: string;
301
+ h3: string;
302
+ h4: string;
303
+ h5: string;
304
+ h6: string;
305
+ "bonprix-h1": string;
306
+ "bonprix-h2": string;
307
+ "bonprix-h3": string;
308
+ "bonprix-h4": string;
309
+ "bonprix-h5": string;
310
+ "bonprix-h6": string;
311
+ subtitle1: string;
312
+ subtitle2: string;
313
+ body1: string;
314
+ "body1-bold": string;
315
+ body2: string;
316
+ "body2-bold": string;
317
+ caption: string;
318
+ overline: string;
319
+ };
320
+ color: {
321
+ inherit: string;
322
+ primary: string;
323
+ "on-primary-high": string;
324
+ "on-primary-mid": string;
325
+ "on-bg-high": string;
326
+ "on-bg-mid": string;
327
+ "on-bg-low": string;
328
+ error: string;
329
+ alert: string;
330
+ success: string;
331
+ info: string;
332
+ sale: string;
333
+ "on-sale": string;
334
+ disabled: string;
335
+ sustainable: string;
336
+ black: string;
337
+ white: string;
338
+ };
339
+ bold: {
340
+ true: string;
341
+ };
342
+ strikeThrough: {
343
+ true: string;
344
+ };
345
+ align: {
346
+ left: string;
347
+ center: string;
348
+ right: string;
349
+ };
350
+ truncate: {
351
+ true: string;
352
+ };
353
+ balance: {
354
+ true: string;
355
+ };
356
+ }, {
357
+ variant: {
358
+ h1: string;
359
+ h2: string;
360
+ h3: string;
361
+ h4: string;
362
+ h5: string;
363
+ h6: string;
364
+ "bonprix-h1": string;
365
+ "bonprix-h2": string;
366
+ "bonprix-h3": string;
367
+ "bonprix-h4": string;
368
+ "bonprix-h5": string;
369
+ "bonprix-h6": string;
370
+ subtitle1: string;
371
+ subtitle2: string;
372
+ body1: string;
373
+ "body1-bold": string;
374
+ body2: string;
375
+ "body2-bold": string;
376
+ caption: string;
377
+ overline: string;
378
+ };
379
+ color: {
380
+ inherit: string;
381
+ primary: string;
382
+ "on-primary-high": string;
383
+ "on-primary-mid": string;
384
+ "on-bg-high": string;
385
+ "on-bg-mid": string;
386
+ "on-bg-low": string;
387
+ error: string;
388
+ alert: string;
389
+ success: string;
390
+ info: string;
391
+ sale: string;
392
+ "on-sale": string;
393
+ disabled: string;
394
+ sustainable: string;
395
+ black: string;
396
+ white: string;
397
+ };
398
+ bold: {
399
+ true: string;
400
+ };
401
+ strikeThrough: {
402
+ true: string;
403
+ };
404
+ align: {
405
+ left: string;
406
+ center: string;
407
+ right: string;
408
+ };
409
+ truncate: {
410
+ true: string;
411
+ };
412
+ balance: {
413
+ true: string;
414
+ };
415
+ }>, unknown, unknown, undefined>>;
416
+ export declare const balancedVariants: (typeof typographyVariants)[number][];
@@ -0,0 +1,70 @@
1
+ import { tv as e } from "tailwind-variants";
2
+ //#region src/classes.ts
3
+ var t = e({
4
+ base: "my-0",
5
+ variants: {
6
+ variant: {
7
+ h1: "typography-h1",
8
+ h2: "typography-h2",
9
+ h3: "typography-h3",
10
+ h4: "typography-h4",
11
+ h5: "typography-h5",
12
+ h6: "typography-h6",
13
+ "bonprix-h1": "typography-bonprix-h1",
14
+ "bonprix-h2": "typography-bonprix-h2",
15
+ "bonprix-h3": "typography-bonprix-h3",
16
+ "bonprix-h4": "typography-bonprix-h4",
17
+ "bonprix-h5": "typography-bonprix-h5",
18
+ "bonprix-h6": "typography-bonprix-h6",
19
+ subtitle1: "typography-subtitle1",
20
+ subtitle2: "typography-subtitle2",
21
+ body1: "typography-body1",
22
+ "body1-bold": "typography-body1-bold",
23
+ body2: "typography-body2",
24
+ "body2-bold": "typography-body2-bold",
25
+ caption: "typography-caption",
26
+ overline: "typography-overline"
27
+ },
28
+ color: {
29
+ inherit: "text-inherit",
30
+ primary: "text-clr-primary",
31
+ "on-primary-high": "text-clr-on-primary-high",
32
+ "on-primary-mid": "text-clr-on-primary-mid",
33
+ "on-bg-high": "text-clr-on-bg-high",
34
+ "on-bg-mid": "text-clr-on-bg-mid",
35
+ "on-bg-low": "text-clr-on-bg-low",
36
+ error: "text-clr-fg-error",
37
+ alert: "text-clr-fg-alert",
38
+ success: "text-clr-fg-success",
39
+ info: "text-clr-fg-info",
40
+ sale: "text-clr-sale",
41
+ "on-sale": "text-clr-on-sale",
42
+ disabled: "text-clr-disabled",
43
+ sustainable: "text-clr-sustainable",
44
+ black: "text-clr-black",
45
+ white: "text-clr-white"
46
+ },
47
+ bold: { true: "font-bold" },
48
+ strikeThrough: { true: "line-through" },
49
+ align: {
50
+ left: "text-start",
51
+ center: "text-center",
52
+ right: "text-end"
53
+ },
54
+ truncate: { true: "truncate" },
55
+ balance: { true: "text-balance" }
56
+ }
57
+ }), n = [
58
+ "h1",
59
+ "h2",
60
+ "h3",
61
+ "h4",
62
+ "bonprix-h1",
63
+ "bonprix-h2",
64
+ "bonprix-h3",
65
+ "bonprix-h4"
66
+ ];
67
+ //#endregion
68
+ export { n as balancedVariants, t as generateClasses };
69
+
70
+ //# sourceMappingURL=classes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classes.js","names":["generateClasses","tv","balancedVariants"],"sources":["../../src/classes.ts"],"sourcesContent":["import { tv } from \"tailwind-variants\";\n\nimport { typographyVariants } from \"./constants\";\n\nexport const generateClasses = tv({\n base: \"my-0\",\n variants: {\n variant: {\n h1: \"typography-h1\",\n h2: \"typography-h2\",\n h3: \"typography-h3\",\n h4: \"typography-h4\",\n h5: \"typography-h5\",\n h6: \"typography-h6\",\n \"bonprix-h1\": \"typography-bonprix-h1\",\n \"bonprix-h2\": \"typography-bonprix-h2\",\n \"bonprix-h3\": \"typography-bonprix-h3\",\n \"bonprix-h4\": \"typography-bonprix-h4\",\n \"bonprix-h5\": \"typography-bonprix-h5\",\n \"bonprix-h6\": \"typography-bonprix-h6\",\n subtitle1: \"typography-subtitle1\",\n subtitle2: \"typography-subtitle2\",\n body1: \"typography-body1\",\n \"body1-bold\": \"typography-body1-bold\",\n body2: \"typography-body2\",\n \"body2-bold\": \"typography-body2-bold\",\n caption: \"typography-caption\",\n overline: \"typography-overline\",\n },\n color: {\n inherit: \"text-inherit\",\n /* primary */\n primary: \"text-clr-primary\",\n /* on primary */\n \"on-primary-high\": \"text-clr-on-primary-high\",\n \"on-primary-mid\": \"text-clr-on-primary-mid\",\n /* on background */\n \"on-bg-high\": \"text-clr-on-bg-high\",\n \"on-bg-mid\": \"text-clr-on-bg-mid\",\n \"on-bg-low\": \"text-clr-on-bg-low\",\n /* technical */\n error: \"text-clr-fg-error\",\n alert: \"text-clr-fg-alert\",\n success: \"text-clr-fg-success\",\n info: \"text-clr-fg-info\",\n /* additional */\n sale: \"text-clr-sale\",\n \"on-sale\": \"text-clr-on-sale\",\n disabled: \"text-clr-disabled\",\n sustainable: \"text-clr-sustainable\",\n /* common */\n black: \"text-clr-black\",\n white: \"text-clr-white\",\n },\n bold: {\n true: \"font-bold\",\n },\n strikeThrough: {\n true: \"line-through\",\n },\n align: {\n left: \"text-start\",\n center: \"text-center\",\n right: \"text-end\",\n },\n truncate: {\n true: \"truncate\",\n },\n balance: {\n true: \"text-balance\",\n },\n },\n});\n\nexport const balancedVariants: (typeof typographyVariants)[number][] = [\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"bonprix-h1\",\n \"bonprix-h2\",\n \"bonprix-h3\",\n \"bonprix-h4\",\n] as const;\n"],"mappings":";;AAIA,IAAaA,IAAkBC,EAAG;CAChC,MAAM;CACN,UAAU;EACR,SAAS;GACP,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,WAAW;GACX,WAAW;GACX,OAAO;GACP,cAAc;GACd,OAAO;GACP,cAAc;GACd,SAAS;GACT,UAAU;EACZ;EACA,OAAO;GACL,SAAS;GAET,SAAS;GAET,mBAAmB;GACnB,kBAAkB;GAElB,cAAc;GACd,aAAa;GACb,aAAa;GAEb,OAAO;GACP,OAAO;GACP,SAAS;GACT,MAAM;GAEN,MAAM;GACN,WAAW;GACX,UAAU;GACV,aAAa;GAEb,OAAO;GACP,OAAO;EACT;EACA,MAAM,EACJ,MAAM,YACR;EACA,eAAe,EACb,MAAM,eACR;EACA,OAAO;GACL,MAAM;GACN,QAAQ;GACR,OAAO;EACT;EACA,UAAU,EACR,MAAM,WACR;EACA,SAAS,EACP,MAAM,eACR;CACF;AACF,CAAC,GAEYC,IAA0D;CACrE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,2 @@
1
+ /** @deprecated [typography-component] Use the `typography-*` classes directly. */
2
+ export declare const typographyVariants: readonly ["h1", "h2", "h3", "h4", "h5", "h6", "bonprix-h1", "bonprix-h2", "bonprix-h3", "bonprix-h4", "bonprix-h5", "bonprix-h6", "body1", "body1-bold", "body2", "body2-bold", "subtitle1", "subtitle2", "caption", "overline"];
@@ -0,0 +1,27 @@
1
+ //#region src/constants.ts
2
+ var e = [
3
+ "h1",
4
+ "h2",
5
+ "h3",
6
+ "h4",
7
+ "h5",
8
+ "h6",
9
+ "bonprix-h1",
10
+ "bonprix-h2",
11
+ "bonprix-h3",
12
+ "bonprix-h4",
13
+ "bonprix-h5",
14
+ "bonprix-h6",
15
+ "body1",
16
+ "body1-bold",
17
+ "body2",
18
+ "body2-bold",
19
+ "subtitle1",
20
+ "subtitle2",
21
+ "caption",
22
+ "overline"
23
+ ];
24
+ //#endregion
25
+ export { e as typographyVariants };
26
+
27
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","names":["typographyVariants"],"sources":["../../src/constants.ts"],"sourcesContent":["/** @deprecated [typography-component] Use the `typography-*` classes directly. */\nexport const typographyVariants = [\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"bonprix-h1\",\n \"bonprix-h2\",\n \"bonprix-h3\",\n \"bonprix-h4\",\n \"bonprix-h5\",\n \"bonprix-h6\",\n \"body1\",\n \"body1-bold\",\n \"body2\",\n \"body2-bold\",\n \"subtitle1\",\n \"subtitle2\",\n \"caption\",\n \"overline\",\n] as const;\n"],"mappings":";AACA,IAAaA,IAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
package/package.json CHANGED
@@ -1,14 +1,25 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-typography",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Typography component, implemented in React, for the Bonprix Design System.",
5
- "type": "module",
6
- "publishConfig": {
7
- "access": "public",
8
- "provenance": true
5
+ "keywords": [],
6
+ "license": "UNLICENSED",
7
+ "author": "",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/bonprix/design-system.git",
11
+ "directory": "packages/react/typography"
9
12
  },
10
- "module": "./dist/index.js",
13
+ "files": [
14
+ "dist",
15
+ "!dist/tsconfig.tsbuildinfo",
16
+ "!dist/vite.config.d.ts",
17
+ "!dist/**/*.test.d.ts"
18
+ ],
19
+ "type": "module",
11
20
  "sideEffects": false,
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
12
23
  "exports": {
13
24
  ".": {
14
25
  "import": "./dist/index.js",
@@ -16,31 +27,24 @@
16
27
  "default": "./dist/index.js"
17
28
  }
18
29
  },
19
- "types": "./dist/index.d.ts",
20
- "files": [
21
- "dist"
22
- ],
23
- "keywords": [],
24
- "author": "",
25
- "license": "ISC",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/bonprix/design-system.git",
29
- "directory": "packages/react/typography"
30
+ "publishConfig": {
31
+ "access": "public",
32
+ "provenance": true
30
33
  },
31
- "peerDependencies": {
32
- "react": "^19.0.0",
33
- "react-dom": "^19.0.0",
34
- "tailwind-variants": "0.3.1",
35
- "tailwind-merge": "2.6.1"
34
+ "dependencies": {
35
+ "@bonprix-ds/utils": "0.3.0"
36
36
  },
37
37
  "devDependencies": {
38
- "vite": "8.2.1",
39
- "@types/react": "19.2.18",
40
- "@vitejs/plugin-react": "6.0.5",
41
- "rollup-preserve-directives": "1.1.3",
42
- "unplugin-dts": "1.0.3",
43
- "@microsoft/api-extractor": "7.58.12"
38
+ "@types/react": "19.3.0",
39
+ "vite": "8.3.2",
40
+ "@bonprix-ds/breaking-changes": "0.0.0",
41
+ "@bonprix-ds/vite-config": "0.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^19",
45
+ "react-dom": "^19",
46
+ "tailwind-merge": "2.6.1",
47
+ "tailwind-variants": "0.3.1"
44
48
  },
45
49
  "scripts": {
46
50
  "build": "vite build"
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/Typography.tsx","../src/constants.ts"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport React, { ElementType, ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { typographyVariants } from \"./constants\";\n\nconst generateClasses = tv({\n base: \"my-0\",\n variants: {\n variant: {\n h1: \"typography-h1\",\n h2: \"typography-h2\",\n h3: \"typography-h3\",\n h4: \"typography-h4\",\n h5: \"typography-h5\",\n h6: \"typography-h6\",\n \"bonprix-h1\": \"typography-bonprix-h1\",\n \"bonprix-h2\": \"typography-bonprix-h2\",\n \"bonprix-h3\": \"typography-bonprix-h3\",\n \"bonprix-h4\": \"typography-bonprix-h4\",\n \"bonprix-h5\": \"typography-bonprix-h5\",\n \"bonprix-h6\": \"typography-bonprix-h6\",\n subtitle1: \"typography-subtitle1\",\n subtitle2: \"typography-subtitle2\",\n body1: \"typography-body1\",\n \"body1-bold\": \"typography-body1-bold\",\n body2: \"typography-body2\",\n \"body2-bold\": \"typography-body2-bold\",\n caption: \"typography-caption\",\n overline: \"typography-overline\",\n },\n color: {\n inherit: \"text-inherit\",\n /* primary */\n primary: \"text-clr-primary\",\n /* on primary */\n \"on-primary-high\": \"text-clr-on-primary-high\",\n \"on-primary-mid\": \"text-clr-on-primary-mid\",\n /* on background */\n \"on-bg-high\": \"text-clr-on-bg-high\",\n \"on-bg-mid\": \"text-clr-on-bg-mid\",\n \"on-bg-low\": \"text-clr-on-bg-low\",\n /* technical */\n error: \"text-clr-fg-error\",\n alert: \"text-clr-fg-alert\",\n success: \"text-clr-fg-success\",\n info: \"text-clr-fg-info\",\n /* additional */\n sale: \"text-clr-sale\",\n \"on-sale\": \"text-clr-on-sale\",\n disabled: \"text-clr-disabled\",\n sustainable: \"text-clr-sustainable\",\n /* common */\n black: \"text-clr-black\",\n white: \"text-clr-white\",\n },\n bold: {\n true: \"font-bold\",\n },\n strikeThrough: {\n true: \"line-through\",\n },\n align: {\n left: \"text-start\",\n center: \"text-center\",\n right: \"text-end\",\n },\n truncate: {\n true: \"truncate\",\n },\n balance: {\n true: \"text-balance\",\n },\n },\n});\n\nconst balancedVariants: TypographyVariant[] = [\"h1\", \"h2\", \"h3\", \"h4\", \"bonprix-h1\", \"bonprix-h2\", \"bonprix-h3\", \"bonprix-h4\"] as const;\n\ntype TypographyColor =\n | \"inherit\"\n /* primary */\n | \"primary\"\n /* on primary */\n | \"on-primary-high\"\n | \"on-primary-mid\"\n /* on background */\n | \"on-bg-high\"\n | \"on-bg-mid\"\n | \"on-bg-low\"\n /* technical */\n | \"error\"\n | \"alert\"\n | \"success\"\n | \"info\"\n /* additional */\n | \"sale\"\n | \"on-sale\"\n | \"disabled\"\n | \"sustainable\"\n /* common */\n | \"black\"\n | \"white\";\n\ntype TypographyVariant = (typeof typographyVariants)[number];\n\nexport interface Props {\n /** The content of the Typography component. Might also be other markup elements. */\n children: ReactNode;\n /** A valid typography variant. */\n variant?: TypographyVariant;\n /** An HTML element, that should be used. */\n component?: ElementType;\n /** If `true`, the text will be bold. */\n bold?: boolean;\n /** If `true`, the text will be displayed with a strikethrough. */\n strikeThrough?: boolean;\n /** A valid color variant. */\n color?: TypographyColor;\n /** The horizontal text alignment. */\n align?: \"left\" | \"center\" | \"right\";\n /** Adds Ellipsis when text doesn't fit. */\n truncate?: boolean;\n /** Additional class names to apply to the component. */\n className?: string;\n /** Id of the component. */\n id?: string;\n}\n\nconst Typography = ({\n children,\n variant = \"body1\",\n component = \"p\",\n bold = false,\n strikeThrough = false,\n color = \"on-bg-high\",\n align = \"left\",\n truncate = false,\n className = \"\",\n id,\n}: Props) => {\n const typographyHtmlElementMapper: Record<TypographyVariant, string> = {\n h1: \"h1\",\n h2: \"h2\",\n h3: \"h3\",\n h4: \"h4\",\n h5: \"h5\",\n h6: \"h6\",\n \"bonprix-h1\": \"h1\",\n \"bonprix-h2\": \"h2\",\n \"bonprix-h3\": \"h3\",\n \"bonprix-h4\": \"h4\",\n \"bonprix-h5\": \"h5\",\n \"bonprix-h6\": \"h6\",\n subtitle1: \"h6\",\n subtitle2: \"h6\",\n body1: \"p\",\n \"body1-bold\": \"p\",\n body2: \"p\",\n \"body2-bold\": \"p\",\n caption: \"span\",\n overline: \"span\",\n };\n\n const Component = component ?? typographyHtmlElementMapper[variant];\n\n return (\n <Component\n className={twMerge(\n generateClasses({ variant, bold, strikeThrough, color, align, truncate, balance: balancedVariants.includes(variant) }),\n className,\n )}\n data-bpds=\"typography\"\n data-bpds-variant={variant}\n data-bpds-color={color}\n data-bpds-align={align}\n data-bpds-bold={bold}\n data-bpds-strike-through={strikeThrough}\n data-bpds-truncate={truncate}\n id={id}\n >\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n","export const typographyVariants = [\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"bonprix-h1\",\n \"bonprix-h2\",\n \"bonprix-h3\",\n \"bonprix-h4\",\n \"bonprix-h5\",\n \"bonprix-h6\",\n \"body1\",\n \"body1-bold\",\n \"body2\",\n \"body2-bold\",\n \"subtitle1\",\n \"subtitle2\",\n \"caption\",\n \"overline\",\n] as const;\n"],"mappings":";;;;;AAMA,IAAM,IAAkB,EAAG;CACzB,MAAM;CACN,UAAU;EACR,SAAS;GACP,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GACJ,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,cAAc;GACd,WAAW;GACX,WAAW;GACX,OAAO;GACP,cAAc;GACd,OAAO;GACP,cAAc;GACd,SAAS;GACT,UAAU;EACZ;EACA,OAAO;GACL,SAAS;GAET,SAAS;GAET,mBAAmB;GACnB,kBAAkB;GAElB,cAAc;GACd,aAAa;GACb,aAAa;GAEb,OAAO;GACP,OAAO;GACP,SAAS;GACT,MAAM;GAEN,MAAM;GACN,WAAW;GACX,UAAU;GACV,aAAa;GAEb,OAAO;GACP,OAAO;EACT;EACA,MAAM,EACJ,MAAM,YACR;EACA,eAAe,EACb,MAAM,eACR;EACA,OAAO;GACL,MAAM;GACN,QAAQ;GACR,OAAO;EACT;EACA,UAAU,EACR,MAAM,WACR;EACA,SAAS,EACP,MAAM,eACR;CACF;AACF,CAAC,GAEK,IAAwC;CAAC;CAAM;CAAM;CAAM;CAAM;CAAc;CAAc;CAAc;AAAY,GAoDvH,KAAc,EAClB,aACA,aAAU,SACV,eAAY,KACZ,UAAO,IACP,mBAAgB,IAChB,WAAQ,cACR,WAAQ,QACR,cAAW,IACX,eAAY,IACZ,YACW;CAwBX,IAAM,IAAY,KAAa;EAtB7B,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,IAAI;EACJ,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;EACd,WAAW;EACX,WAAW;EACX,OAAO;EACP,cAAc;EACd,OAAO;EACP,cAAc;EACd,SAAS;EACT,UAAU;CAGmB,EAA4B;CAE3D,OACE,kBAAC,GAAD;EACE,WAAW,EACT,EAAgB;GAAE;GAAS;GAAM;GAAe;GAAO;GAAO;GAAU,SAAS,EAAiB,SAAS,CAAO;EAAE,CAAC,GACrH,CACF;EACA,aAAU;EACV,qBAAmB;EACnB,mBAAiB;EACjB,mBAAiB;EACjB,kBAAgB;EAChB,4BAA0B;EAC1B,sBAAoB;EAChB;EAEH;CACQ,CAAA;AAEf,GCvLa,IAAqB;CAChC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}