@bonprix-ds/react-typography 1.0.2 → 1.0.3
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 +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
1
2
|
import { ElementType } from 'react';
|
|
2
|
-
import { FC } from 'react';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
4
|
|
|
5
|
-
declare const Typography:
|
|
5
|
+
declare const Typography: ({ children, variant, component, bold, strikeThrough, color, align, truncate, className, id, }: TypographyProps) => default_2.JSX.Element;
|
|
6
6
|
export default Typography;
|
|
7
7
|
|
|
8
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";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/Typography.tsx","../src/constants.ts"],"sourcesContent":["import { twMerge } from \"tailwind-merge\";\nimport React, { ElementType,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bonprix-ds/react-typography",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Typography component, implemented in React, for the Bonprix Design System.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"tailwind-merge": "2.6.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"vite": "8.2.
|
|
38
|
+
"vite": "8.2.1",
|
|
39
39
|
"@types/react": "19.2.18",
|
|
40
40
|
"@vitejs/plugin-react": "6.0.5",
|
|
41
41
|
"rollup-preserve-directives": "1.1.3",
|