@metamask-previews/design-system-react 0.0.0-preview.aac9b91 → 0.0.0-preview.f4da8f1
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/components/button/Button.cjs.map +1 -0
- package/dist/components/button/Button.d.cts.map +1 -0
- package/dist/components/button/Button.d.mts.map +1 -0
- package/dist/components/button/Button.mjs.map +1 -0
- package/dist/components/button/index.cjs +6 -0
- package/dist/components/button/index.cjs.map +1 -0
- package/dist/components/button/index.d.cts +3 -0
- package/dist/components/button/index.d.cts.map +1 -0
- package/dist/components/button/index.d.mts +3 -0
- package/dist/components/button/index.d.mts.map +1 -0
- package/dist/components/button/index.mjs +2 -0
- package/dist/components/button/index.mjs.map +1 -0
- package/dist/components/index.cjs +16 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +6 -0
- package/dist/components/index.d.cts.map +1 -0
- package/dist/components/index.d.mts +6 -0
- package/dist/components/index.d.mts.map +1 -0
- package/dist/components/index.mjs +4 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/text/Text.cjs +17 -0
- package/dist/components/text/Text.cjs.map +1 -0
- package/dist/components/text/Text.constants.cjs +27 -0
- package/dist/components/text/Text.constants.cjs.map +1 -0
- package/dist/components/text/Text.constants.d.cts +5 -0
- package/dist/components/text/Text.constants.d.cts.map +1 -0
- package/dist/components/text/Text.constants.d.mts +5 -0
- package/dist/components/text/Text.constants.d.mts.map +1 -0
- package/dist/components/text/Text.constants.mjs +24 -0
- package/dist/components/text/Text.constants.mjs.map +1 -0
- package/dist/components/text/Text.d.cts +4 -0
- package/dist/components/text/Text.d.cts.map +1 -0
- package/dist/components/text/Text.d.mts +4 -0
- package/dist/components/text/Text.d.mts.map +1 -0
- package/dist/components/text/Text.mjs +17 -0
- package/dist/components/text/Text.mjs.map +1 -0
- package/dist/components/text/Text.types.cjs +96 -0
- package/dist/components/text/Text.types.cjs.map +1 -0
- package/dist/components/text/Text.types.d.cts +143 -0
- package/dist/components/text/Text.types.d.cts.map +1 -0
- package/dist/components/text/Text.types.d.mts +143 -0
- package/dist/components/text/Text.types.d.mts.map +1 -0
- package/dist/components/text/Text.types.mjs +93 -0
- package/dist/components/text/Text.types.mjs.map +1 -0
- package/dist/components/text/index.cjs +14 -0
- package/dist/components/text/index.cjs.map +1 -0
- package/dist/components/text/index.d.cts +4 -0
- package/dist/components/text/index.d.cts.map +1 -0
- package/dist/components/text/index.d.mts +4 -0
- package/dist/components/text/index.d.mts.map +1 -0
- package/dist/components/text/index.mjs +3 -0
- package/dist/components/text/index.mjs.map +1 -0
- package/dist/index.cjs +15 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/utils/tw-merge.cjs +67 -0
- package/dist/utils/tw-merge.cjs.map +1 -0
- package/dist/utils/tw-merge.d.cts +13 -0
- package/dist/utils/tw-merge.d.cts.map +1 -0
- package/dist/utils/tw-merge.d.mts +13 -0
- package/dist/utils/tw-merge.d.mts.map +1 -0
- package/dist/utils/tw-merge.mjs +64 -0
- package/dist/utils/tw-merge.mjs.map +1 -0
- package/package.json +9 -8
- package/dist/Button.cjs.map +0 -1
- package/dist/Button.d.cts.map +0 -1
- package/dist/Button.d.mts.map +0 -1
- package/dist/Button.mjs.map +0 -1
- package/dist/Button.test.cjs +0 -29
- package/dist/Button.test.cjs.map +0 -1
- package/dist/Button.test.d.cts +0 -2
- package/dist/Button.test.d.cts.map +0 -1
- package/dist/Button.test.d.mts +0 -2
- package/dist/Button.test.d.mts.map +0 -1
- package/dist/Button.test.mjs +0 -32
- package/dist/Button.test.mjs.map +0 -1
- package/dist/Text.cjs +0 -40
- package/dist/Text.cjs.map +0 -1
- package/dist/Text.d.cts +0 -19
- package/dist/Text.d.cts.map +0 -1
- package/dist/Text.d.mts +0 -19
- package/dist/Text.d.mts.map +0 -1
- package/dist/Text.mjs +0 -40
- package/dist/Text.mjs.map +0 -1
- package/dist/Text.test.cjs +0 -23
- package/dist/Text.test.cjs.map +0 -1
- package/dist/Text.test.d.cts +0 -2
- package/dist/Text.test.d.cts.map +0 -1
- package/dist/Text.test.d.mts +0 -2
- package/dist/Text.test.d.mts.map +0 -1
- package/dist/Text.test.mjs +0 -26
- package/dist/Text.test.mjs.map +0 -1
- /package/dist/{Button.cjs → components/button/Button.cjs} +0 -0
- /package/dist/{Button.d.cts → components/button/Button.d.cts} +0 -0
- /package/dist/{Button.d.mts → components/button/Button.d.mts} +0 -0
- /package/dist/{Button.mjs → components/button/Button.mjs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.cjs","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAQnB,MAAM,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CAC7D,0CACE,SAAS,EAAC,+DAA+D,KACrE,KAAK,IAER,QAAQ,CACF,CACV,CAAC;AAPW,QAAA,MAAM,UAOjB","sourcesContent":["import React from 'react';\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button contents */\n children: React.ReactNode;\n}\n\nexport const Button = ({ children, ...props }: ButtonProps) => (\n <button\n className=\"px-4 h-8 rounded-full bg-primary-default text-primary-inverse\"\n {...props}\n >\n {children}\n </button>\n);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.cts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAE1B,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,2BAA4B,WAAW,sBAOzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.mts","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAE1B,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACrD,sBAAsB;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,2BAA4B,WAAW,sBAOzD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.mjs","sourceRoot":"","sources":["../../../src/components/button/Button.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAQ1B,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAe,EAAE,EAAE,CAAC,CAC7D,gCACE,SAAS,EAAC,+DAA+D,KACrE,KAAK,IAER,QAAQ,CACF,CACV,CAAC","sourcesContent":["import React from 'react';\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n /** Button contents */\n children: React.ReactNode;\n}\n\nexport const Button = ({ children, ...props }: ButtonProps) => (\n <button\n className=\"px-4 h-8 rounded-full bg-primary-default text-primary-inverse\"\n {...props}\n >\n {children}\n </button>\n);\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = void 0;
|
|
4
|
+
var Button_1 = require("./Button.cjs");
|
|
5
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return Button_1.Button; } });
|
|
6
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAAzB,gGAAA,MAAM,OAAA","sourcesContent":["export { Button } from './Button';\nexport type { ButtonProps } from './Button';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB;AAClC,YAAY,EAAE,WAAW,EAAE,qBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB;AAClC,YAAY,EAAE,WAAW,EAAE,qBAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,qBAAiB","sourcesContent":["export { Button } from './Button';\nexport type { ButtonProps } from './Button';\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Button = exports.OverflowWrap = exports.TextTransform = exports.FontStyle = exports.FontWeight = exports.TextAlign = exports.TextColor = exports.TextVariant = exports.Text = void 0;
|
|
4
|
+
var text_1 = require("./text/index.cjs");
|
|
5
|
+
Object.defineProperty(exports, "Text", { enumerable: true, get: function () { return text_1.Text; } });
|
|
6
|
+
var text_2 = require("./text/index.cjs");
|
|
7
|
+
Object.defineProperty(exports, "TextVariant", { enumerable: true, get: function () { return text_2.TextVariant; } });
|
|
8
|
+
Object.defineProperty(exports, "TextColor", { enumerable: true, get: function () { return text_2.TextColor; } });
|
|
9
|
+
Object.defineProperty(exports, "TextAlign", { enumerable: true, get: function () { return text_2.TextAlign; } });
|
|
10
|
+
Object.defineProperty(exports, "FontWeight", { enumerable: true, get: function () { return text_2.FontWeight; } });
|
|
11
|
+
Object.defineProperty(exports, "FontStyle", { enumerable: true, get: function () { return text_2.FontStyle; } });
|
|
12
|
+
Object.defineProperty(exports, "TextTransform", { enumerable: true, get: function () { return text_2.TextTransform; } });
|
|
13
|
+
Object.defineProperty(exports, "OverflowWrap", { enumerable: true, get: function () { return text_2.OverflowWrap; } });
|
|
14
|
+
var button_1 = require("./button/index.cjs");
|
|
15
|
+
Object.defineProperty(exports, "Button", { enumerable: true, get: function () { return button_1.Button; } });
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":";;;AAAA,yCAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,yCAQgB;AAPd,mGAAA,WAAW,OAAA;AACX,iGAAA,SAAS,OAAA;AACT,iGAAA,SAAS,OAAA;AACT,kGAAA,UAAU,OAAA;AACV,iGAAA,SAAS,OAAA;AACT,qGAAA,aAAa,OAAA;AACb,oGAAA,YAAY,OAAA;AAId,6CAAkC;AAAzB,gGAAA,MAAM,OAAA","sourcesContent":["export { Text } from './text';\nexport {\n TextVariant,\n TextColor,\n TextAlign,\n FontWeight,\n FontStyle,\n TextTransform,\n OverflowWrap,\n} from './text';\nexport type { TextProps } from './text';\n\nexport { Button } from './button';\nexport type { ButtonProps } from './button';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Text } from "./text/index.cjs";
|
|
2
|
+
export { TextVariant, TextColor, TextAlign, FontWeight, FontStyle, TextTransform, OverflowWrap, } from "./text/index.cjs";
|
|
3
|
+
export type { TextProps } from "./text/index.cjs";
|
|
4
|
+
export { Button } from "./button/index.cjs";
|
|
5
|
+
export type { ButtonProps } from "./button/index.cjs";
|
|
6
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,yBAAe;AAC9B,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,GACb,yBAAe;AAChB,YAAY,EAAE,SAAS,EAAE,yBAAe;AAExC,OAAO,EAAE,MAAM,EAAE,2BAAiB;AAClC,YAAY,EAAE,WAAW,EAAE,2BAAiB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Text } from "./text/index.mjs";
|
|
2
|
+
export { TextVariant, TextColor, TextAlign, FontWeight, FontStyle, TextTransform, OverflowWrap, } from "./text/index.mjs";
|
|
3
|
+
export type { TextProps } from "./text/index.mjs";
|
|
4
|
+
export { Button } from "./button/index.mjs";
|
|
5
|
+
export type { ButtonProps } from "./button/index.mjs";
|
|
6
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,yBAAe;AAC9B,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,GACb,yBAAe;AAChB,YAAY,EAAE,SAAS,EAAE,yBAAe;AAExC,OAAO,EAAE,MAAM,EAAE,2BAAiB;AAClC,YAAY,EAAE,WAAW,EAAE,2BAAiB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,yBAAe;AAC9B,OAAO,EACL,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACb,yBAAe;AAGhB,OAAO,EAAE,MAAM,EAAE,2BAAiB","sourcesContent":["export { Text } from './text';\nexport {\n TextVariant,\n TextColor,\n TextAlign,\n FontWeight,\n FontStyle,\n TextTransform,\n OverflowWrap,\n} from './text';\nexport type { TextProps } from './text';\n\nexport { Button } from './button';\nexport type { ButtonProps } from './button';\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Text = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
9
|
+
const Text_types_1 = require("./Text.types.cjs");
|
|
10
|
+
const Text_constants_1 = require("./Text.constants.cjs");
|
|
11
|
+
const Text = ({ variant = Text_types_1.TextVariant.BodyMd, children, className, fontWeight, fontStyle, textTransform, textAlign, overflowWrap, ellipsis, as, color = Text_types_1.TextColor.TextDefault, }) => {
|
|
12
|
+
const Tag = as || Text_constants_1.TEXT_DEFAULT_TAG_MAP[variant];
|
|
13
|
+
const mergedClassName = (0, tw_merge_1.twMerge)(color, Text_constants_1.TEXT_CLASS_MAP[variant], fontWeight, fontStyle, textTransform, textAlign, overflowWrap, ellipsis && 'truncate', className);
|
|
14
|
+
return react_1.default.createElement(Tag, { className: mergedClassName }, children);
|
|
15
|
+
};
|
|
16
|
+
exports.Text = Text;
|
|
17
|
+
//# sourceMappingURL=Text.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.cjs","sourceRoot":"","sources":["../../../src/components/text/Text.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,uDAA+C;AAC/C,iDAAiE;AACjE,yDAAwE;AAEjE,MAAM,IAAI,GAAwB,CAAC,EACxC,OAAO,GAAG,wBAAW,CAAC,MAAM,EAC5B,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,EAAE,EACF,KAAK,GAAG,sBAAS,CAAC,WAAW,GAC9B,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,EAAE,IAAI,qCAAoB,CAAC,OAAO,CAAC,CAAC;IAEhD,MAAM,eAAe,GAAG,IAAA,kBAAO,EAC7B,KAAK,EACL,+BAAc,CAAC,OAAO,CAAC,EACvB,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,IAAI,UAAU,EACtB,SAAS,CACV,CAAC;IAEF,OAAO,8BAAC,GAAG,IAAC,SAAS,EAAE,eAAe,IAAG,QAAQ,CAAO,CAAC;AAC3D,CAAC,CAAC;AA5BW,QAAA,IAAI,QA4Bf","sourcesContent":["import React from 'react';\nimport { twMerge } from '../../utils/tw-merge';\nimport { TextVariant, TextProps, TextColor } from './Text.types';\nimport { TEXT_CLASS_MAP, TEXT_DEFAULT_TAG_MAP } from './Text.constants';\n\nexport const Text: React.FC<TextProps> = ({\n variant = TextVariant.BodyMd,\n children,\n className,\n fontWeight,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis,\n as,\n color = TextColor.TextDefault,\n}) => {\n const Tag = as || TEXT_DEFAULT_TAG_MAP[variant];\n\n const mergedClassName = twMerge(\n color,\n TEXT_CLASS_MAP[variant],\n fontWeight,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis && 'truncate',\n className,\n );\n\n return <Tag className={mergedClassName}>{children}</Tag>;\n};\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TEXT_DEFAULT_TAG_MAP = exports.TEXT_CLASS_MAP = void 0;
|
|
4
|
+
const Text_types_1 = require("./Text.types.cjs");
|
|
5
|
+
exports.TEXT_CLASS_MAP = {
|
|
6
|
+
[Text_types_1.TextVariant.DisplayLg]: 'text-[2.5rem] md:text-[4rem] font-bold md:font-medium',
|
|
7
|
+
[Text_types_1.TextVariant.DisplayMd]: 'text-s-display-md font-s-display-md leading-s-display-md tracking-s-display-md md:text-l-display-md md:font-medium',
|
|
8
|
+
[Text_types_1.TextVariant.HeadingLg]: 'text-s-heading-lg font-s-heading-lg leading-s-heading-lg tracking-s-heading-lg md:text-l-heading-lg',
|
|
9
|
+
[Text_types_1.TextVariant.HeadingMd]: 'text-s-heading-md font-s-heading-md leading-s-heading-md tracking-s-heading-md md:text-l-heading-md',
|
|
10
|
+
[Text_types_1.TextVariant.HeadingSm]: 'text-s-heading-sm font-s-heading-sm leading-s-heading-sm tracking-s-heading-sm md:text-l-heading-sm',
|
|
11
|
+
[Text_types_1.TextVariant.BodyLg]: 'text-s-body-lg font-s-body-lg leading-s-body-lg tracking-s-body-lg md:text-l-body-lg',
|
|
12
|
+
[Text_types_1.TextVariant.BodyMd]: 'text-s-body-md font-s-body-md leading-s-body-md tracking-s-body-md md:text-l-body-md',
|
|
13
|
+
[Text_types_1.TextVariant.BodySm]: 'text-s-body-sm font-s-body-sm leading-s-body-sm tracking-s-body-sm',
|
|
14
|
+
[Text_types_1.TextVariant.BodyXs]: 'text-s-body-xs font-s-body-xs leading-s-body-xs tracking-s-body-xs',
|
|
15
|
+
};
|
|
16
|
+
exports.TEXT_DEFAULT_TAG_MAP = {
|
|
17
|
+
[Text_types_1.TextVariant.DisplayLg]: 'h1',
|
|
18
|
+
[Text_types_1.TextVariant.DisplayMd]: 'h1',
|
|
19
|
+
[Text_types_1.TextVariant.HeadingLg]: 'h2',
|
|
20
|
+
[Text_types_1.TextVariant.HeadingMd]: 'h3',
|
|
21
|
+
[Text_types_1.TextVariant.HeadingSm]: 'h4',
|
|
22
|
+
[Text_types_1.TextVariant.BodyLg]: 'p',
|
|
23
|
+
[Text_types_1.TextVariant.BodyMd]: 'p',
|
|
24
|
+
[Text_types_1.TextVariant.BodySm]: 'p',
|
|
25
|
+
[Text_types_1.TextVariant.BodyXs]: 'p',
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=Text.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.cjs","sourceRoot":"","sources":["../../../src/components/text/Text.constants.ts"],"names":[],"mappings":";;;AAAA,iDAA2C;AAE9B,QAAA,cAAc,GAAgC;IACzD,CAAC,wBAAW,CAAC,SAAS,CAAC,EACrB,uDAAuD;IACzD,CAAC,wBAAW,CAAC,SAAS,CAAC,EACrB,oHAAoH;IACtH,CAAC,wBAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,wBAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,wBAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,wBAAW,CAAC,MAAM,CAAC,EAClB,sFAAsF;IACxF,CAAC,wBAAW,CAAC,MAAM,CAAC,EAClB,sFAAsF;IACxF,CAAC,wBAAW,CAAC,MAAM,CAAC,EAClB,oEAAoE;IACtE,CAAC,wBAAW,CAAC,MAAM,CAAC,EAClB,oEAAoE;CACvE,CAAC;AAEW,QAAA,oBAAoB,GAG7B;IACF,CAAC,wBAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,wBAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,wBAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,wBAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,wBAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,wBAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,wBAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,wBAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,wBAAW,CAAC,MAAM,CAAC,EAAE,GAAG;CAC1B,CAAC","sourcesContent":["import { TextVariant } from './Text.types';\n\nexport const TEXT_CLASS_MAP: Record<TextVariant, string> = {\n [TextVariant.DisplayLg]:\n 'text-[2.5rem] md:text-[4rem] font-bold md:font-medium',\n [TextVariant.DisplayMd]:\n 'text-s-display-md font-s-display-md leading-s-display-md tracking-s-display-md md:text-l-display-md md:font-medium',\n [TextVariant.HeadingLg]:\n 'text-s-heading-lg font-s-heading-lg leading-s-heading-lg tracking-s-heading-lg md:text-l-heading-lg',\n [TextVariant.HeadingMd]:\n 'text-s-heading-md font-s-heading-md leading-s-heading-md tracking-s-heading-md md:text-l-heading-md',\n [TextVariant.HeadingSm]:\n 'text-s-heading-sm font-s-heading-sm leading-s-heading-sm tracking-s-heading-sm md:text-l-heading-sm',\n [TextVariant.BodyLg]:\n 'text-s-body-lg font-s-body-lg leading-s-body-lg tracking-s-body-lg md:text-l-body-lg',\n [TextVariant.BodyMd]:\n 'text-s-body-md font-s-body-md leading-s-body-md tracking-s-body-md md:text-l-body-md',\n [TextVariant.BodySm]:\n 'text-s-body-sm font-s-body-sm leading-s-body-sm tracking-s-body-sm',\n [TextVariant.BodyXs]:\n 'text-s-body-xs font-s-body-xs leading-s-body-xs tracking-s-body-xs',\n};\n\nexport const TEXT_DEFAULT_TAG_MAP: Record<\n TextVariant,\n keyof JSX.IntrinsicElements\n> = {\n [TextVariant.DisplayLg]: 'h1',\n [TextVariant.DisplayMd]: 'h1',\n [TextVariant.HeadingLg]: 'h2',\n [TextVariant.HeadingMd]: 'h3',\n [TextVariant.HeadingSm]: 'h4',\n [TextVariant.BodyLg]: 'p',\n [TextVariant.BodyMd]: 'p',\n [TextVariant.BodySm]: 'p',\n [TextVariant.BodyXs]: 'p',\n};\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextVariant } from "./Text.types.cjs";
|
|
3
|
+
export declare const TEXT_CLASS_MAP: Record<TextVariant, string>;
|
|
4
|
+
export declare const TEXT_DEFAULT_TAG_MAP: Record<TextVariant, keyof JSX.IntrinsicElements>;
|
|
5
|
+
//# sourceMappingURL=Text.constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.d.cts","sourceRoot":"","sources":["../../../src/components/text/Text.constants.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,yBAAqB;AAE3C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAmBtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,WAAW,EACX,MAAM,GAAG,CAAC,iBAAiB,CAW5B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextVariant } from "./Text.types.mjs";
|
|
3
|
+
export declare const TEXT_CLASS_MAP: Record<TextVariant, string>;
|
|
4
|
+
export declare const TEXT_DEFAULT_TAG_MAP: Record<TextVariant, keyof JSX.IntrinsicElements>;
|
|
5
|
+
//# sourceMappingURL=Text.constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.d.mts","sourceRoot":"","sources":["../../../src/components/text/Text.constants.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,yBAAqB;AAE3C,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAmBtD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,WAAW,EACX,MAAM,GAAG,CAAC,iBAAiB,CAW5B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TextVariant } from "./Text.types.mjs";
|
|
2
|
+
export const TEXT_CLASS_MAP = {
|
|
3
|
+
[TextVariant.DisplayLg]: 'text-[2.5rem] md:text-[4rem] font-bold md:font-medium',
|
|
4
|
+
[TextVariant.DisplayMd]: 'text-s-display-md font-s-display-md leading-s-display-md tracking-s-display-md md:text-l-display-md md:font-medium',
|
|
5
|
+
[TextVariant.HeadingLg]: 'text-s-heading-lg font-s-heading-lg leading-s-heading-lg tracking-s-heading-lg md:text-l-heading-lg',
|
|
6
|
+
[TextVariant.HeadingMd]: 'text-s-heading-md font-s-heading-md leading-s-heading-md tracking-s-heading-md md:text-l-heading-md',
|
|
7
|
+
[TextVariant.HeadingSm]: 'text-s-heading-sm font-s-heading-sm leading-s-heading-sm tracking-s-heading-sm md:text-l-heading-sm',
|
|
8
|
+
[TextVariant.BodyLg]: 'text-s-body-lg font-s-body-lg leading-s-body-lg tracking-s-body-lg md:text-l-body-lg',
|
|
9
|
+
[TextVariant.BodyMd]: 'text-s-body-md font-s-body-md leading-s-body-md tracking-s-body-md md:text-l-body-md',
|
|
10
|
+
[TextVariant.BodySm]: 'text-s-body-sm font-s-body-sm leading-s-body-sm tracking-s-body-sm',
|
|
11
|
+
[TextVariant.BodyXs]: 'text-s-body-xs font-s-body-xs leading-s-body-xs tracking-s-body-xs',
|
|
12
|
+
};
|
|
13
|
+
export const TEXT_DEFAULT_TAG_MAP = {
|
|
14
|
+
[TextVariant.DisplayLg]: 'h1',
|
|
15
|
+
[TextVariant.DisplayMd]: 'h1',
|
|
16
|
+
[TextVariant.HeadingLg]: 'h2',
|
|
17
|
+
[TextVariant.HeadingMd]: 'h3',
|
|
18
|
+
[TextVariant.HeadingSm]: 'h4',
|
|
19
|
+
[TextVariant.BodyLg]: 'p',
|
|
20
|
+
[TextVariant.BodyMd]: 'p',
|
|
21
|
+
[TextVariant.BodySm]: 'p',
|
|
22
|
+
[TextVariant.BodyXs]: 'p',
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Text.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.constants.mjs","sourceRoot":"","sources":["../../../src/components/text/Text.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,yBAAqB;AAE3C,MAAM,CAAC,MAAM,cAAc,GAAgC;IACzD,CAAC,WAAW,CAAC,SAAS,CAAC,EACrB,uDAAuD;IACzD,CAAC,WAAW,CAAC,SAAS,CAAC,EACrB,oHAAoH;IACtH,CAAC,WAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,WAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,WAAW,CAAC,SAAS,CAAC,EACrB,qGAAqG;IACvG,CAAC,WAAW,CAAC,MAAM,CAAC,EAClB,sFAAsF;IACxF,CAAC,WAAW,CAAC,MAAM,CAAC,EAClB,sFAAsF;IACxF,CAAC,WAAW,CAAC,MAAM,CAAC,EAClB,oEAAoE;IACtE,CAAC,WAAW,CAAC,MAAM,CAAC,EAClB,oEAAoE;CACvE,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAG7B;IACF,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI;IAC7B,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG;IACzB,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,GAAG;CAC1B,CAAC","sourcesContent":["import { TextVariant } from './Text.types';\n\nexport const TEXT_CLASS_MAP: Record<TextVariant, string> = {\n [TextVariant.DisplayLg]:\n 'text-[2.5rem] md:text-[4rem] font-bold md:font-medium',\n [TextVariant.DisplayMd]:\n 'text-s-display-md font-s-display-md leading-s-display-md tracking-s-display-md md:text-l-display-md md:font-medium',\n [TextVariant.HeadingLg]:\n 'text-s-heading-lg font-s-heading-lg leading-s-heading-lg tracking-s-heading-lg md:text-l-heading-lg',\n [TextVariant.HeadingMd]:\n 'text-s-heading-md font-s-heading-md leading-s-heading-md tracking-s-heading-md md:text-l-heading-md',\n [TextVariant.HeadingSm]:\n 'text-s-heading-sm font-s-heading-sm leading-s-heading-sm tracking-s-heading-sm md:text-l-heading-sm',\n [TextVariant.BodyLg]:\n 'text-s-body-lg font-s-body-lg leading-s-body-lg tracking-s-body-lg md:text-l-body-lg',\n [TextVariant.BodyMd]:\n 'text-s-body-md font-s-body-md leading-s-body-md tracking-s-body-md md:text-l-body-md',\n [TextVariant.BodySm]:\n 'text-s-body-sm font-s-body-sm leading-s-body-sm tracking-s-body-sm',\n [TextVariant.BodyXs]:\n 'text-s-body-xs font-s-body-xs leading-s-body-xs tracking-s-body-xs',\n};\n\nexport const TEXT_DEFAULT_TAG_MAP: Record<\n TextVariant,\n keyof JSX.IntrinsicElements\n> = {\n [TextVariant.DisplayLg]: 'h1',\n [TextVariant.DisplayMd]: 'h1',\n [TextVariant.HeadingLg]: 'h2',\n [TextVariant.HeadingMd]: 'h3',\n [TextVariant.HeadingSm]: 'h4',\n [TextVariant.BodyLg]: 'p',\n [TextVariant.BodyMd]: 'p',\n [TextVariant.BodySm]: 'p',\n [TextVariant.BodyXs]: 'p',\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.cts","sourceRoot":"","sources":["../../../src/components/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAE1B,OAAO,EAAe,SAAS,EAAa,yBAAqB;AAGjE,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA4BpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.mts","sourceRoot":"","sources":["../../../src/components/text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc;AAE1B,OAAO,EAAe,SAAS,EAAa,yBAAqB;AAGjE,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA4BpC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $React from "react";
|
|
8
|
+
const React = $importDefault($React);
|
|
9
|
+
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
10
|
+
import { TextVariant, TextProps, TextColor } from "./Text.types.mjs";
|
|
11
|
+
import { TEXT_CLASS_MAP, TEXT_DEFAULT_TAG_MAP } from "./Text.constants.mjs";
|
|
12
|
+
export const Text = ({ variant = TextVariant.BodyMd, children, className, fontWeight, fontStyle, textTransform, textAlign, overflowWrap, ellipsis, as, color = TextColor.TextDefault, }) => {
|
|
13
|
+
const Tag = as || TEXT_DEFAULT_TAG_MAP[variant];
|
|
14
|
+
const mergedClassName = twMerge(color, TEXT_CLASS_MAP[variant], fontWeight, fontStyle, textTransform, textAlign, overflowWrap, ellipsis && 'truncate', className);
|
|
15
|
+
return React.createElement(Tag, { className: mergedClassName }, children);
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=Text.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.mjs","sourceRoot":"","sources":["../../../src/components/text/Text.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,MAAK,cAAc;;AAC1B,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,yBAAqB;AACjE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,6BAAyB;AAExE,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EACxC,OAAO,GAAG,WAAW,CAAC,MAAM,EAC5B,QAAQ,EACR,SAAS,EACT,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,EAAE,EACF,KAAK,GAAG,SAAS,CAAC,WAAW,GAC9B,EAAE,EAAE;IACH,MAAM,GAAG,GAAG,EAAE,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAEhD,MAAM,eAAe,GAAG,OAAO,CAC7B,KAAK,EACL,cAAc,CAAC,OAAO,CAAC,EACvB,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,IAAI,UAAU,EACtB,SAAS,CACV,CAAC;IAEF,OAAO,oBAAC,GAAG,IAAC,SAAS,EAAE,eAAe,IAAG,QAAQ,CAAO,CAAC;AAC3D,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { twMerge } from '../../utils/tw-merge';\nimport { TextVariant, TextProps, TextColor } from './Text.types';\nimport { TEXT_CLASS_MAP, TEXT_DEFAULT_TAG_MAP } from './Text.constants';\n\nexport const Text: React.FC<TextProps> = ({\n variant = TextVariant.BodyMd,\n children,\n className,\n fontWeight,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis,\n as,\n color = TextColor.TextDefault,\n}) => {\n const Tag = as || TEXT_DEFAULT_TAG_MAP[variant];\n\n const mergedClassName = twMerge(\n color,\n TEXT_CLASS_MAP[variant],\n fontWeight,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis && 'truncate',\n className,\n );\n\n return <Tag className={mergedClassName}>{children}</Tag>;\n};\n"]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextTransform = exports.FontStyle = exports.OverflowWrap = exports.FontWeight = exports.TextAlign = exports.TextColor = exports.TextVariant = void 0;
|
|
4
|
+
var TextVariant;
|
|
5
|
+
(function (TextVariant) {
|
|
6
|
+
// Display Sizes
|
|
7
|
+
TextVariant["DisplayLg"] = "display-lg";
|
|
8
|
+
TextVariant["DisplayMd"] = "display-md";
|
|
9
|
+
// Heading Sizes
|
|
10
|
+
TextVariant["HeadingLg"] = "heading-lg";
|
|
11
|
+
TextVariant["HeadingMd"] = "heading-md";
|
|
12
|
+
TextVariant["HeadingSm"] = "heading-sm";
|
|
13
|
+
// Font Sizes
|
|
14
|
+
TextVariant["BodyLg"] = "body-lg";
|
|
15
|
+
TextVariant["BodyMd"] = "body-md";
|
|
16
|
+
TextVariant["BodySm"] = "body-sm";
|
|
17
|
+
TextVariant["BodyXs"] = "body-xs";
|
|
18
|
+
})(TextVariant || (exports.TextVariant = TextVariant = {}));
|
|
19
|
+
var TextColor;
|
|
20
|
+
(function (TextColor) {
|
|
21
|
+
/** For default neutral text. */
|
|
22
|
+
TextColor["TextDefault"] = "text-default";
|
|
23
|
+
/** For softer contrast neutral text */
|
|
24
|
+
TextColor["TextAlternative"] = "text-alternative";
|
|
25
|
+
/** For the softest contrast neutral text (not accessible) */
|
|
26
|
+
TextColor["TextMuted"] = "text-muted";
|
|
27
|
+
/** For elements used on top of overlay/alternative. Used for text, icon or border */
|
|
28
|
+
TextColor["OverlayInverse"] = "text-overlay-inverse";
|
|
29
|
+
/** For interactive, active, and selected semantics. Used for text, background, icon or border */
|
|
30
|
+
TextColor["PrimaryDefault"] = "text-primary-default";
|
|
31
|
+
/** For elements used on top of primary/default. Used for text, icon or border */
|
|
32
|
+
TextColor["PrimaryInverse"] = "text-primary-inverse";
|
|
33
|
+
/** For the critical alert semantic elements. Used for text, background, icon or border */
|
|
34
|
+
TextColor["ErrorDefault"] = "text-error-default";
|
|
35
|
+
/** For the stronger contrast error semantic elements. */
|
|
36
|
+
TextColor["ErrorAlternative"] = "text-error-alternative";
|
|
37
|
+
/** For elements used on top of error/default. Used for text, icon or border */
|
|
38
|
+
TextColor["ErrorInverse"] = "text-error-inverse";
|
|
39
|
+
/** For the positive semantic elements. Used for text, background, icon or border */
|
|
40
|
+
TextColor["SuccessDefault"] = "text-success-default";
|
|
41
|
+
/** For elements used on top of success/default. Used for text, icon or border */
|
|
42
|
+
TextColor["SuccessInverse"] = "text-success-inverse";
|
|
43
|
+
/** For the caution alert semantic elements. Used for text, background, icon or border */
|
|
44
|
+
TextColor["WarningDefault"] = "text-warning-default";
|
|
45
|
+
/** For elements used on top of warning/default. Used for text, icon or border */
|
|
46
|
+
TextColor["WarningInverse"] = "text-warning-inverse";
|
|
47
|
+
/** For informational read-only elements. Used for text, background, icon or border */
|
|
48
|
+
TextColor["InfoDefault"] = "text-info-default";
|
|
49
|
+
/** For elements used on top of info/default. Used for text, icon or border */
|
|
50
|
+
TextColor["InfoInverse"] = "text-info-inverse";
|
|
51
|
+
/** Inherit the color of the parent element */
|
|
52
|
+
TextColor["Inherit"] = "text-inherit";
|
|
53
|
+
/** Make the text color transparent */
|
|
54
|
+
TextColor["Transparent"] = "text-transparent";
|
|
55
|
+
})(TextColor || (exports.TextColor = TextColor = {}));
|
|
56
|
+
var TextAlign;
|
|
57
|
+
(function (TextAlign) {
|
|
58
|
+
TextAlign["Left"] = "text-left";
|
|
59
|
+
TextAlign["Center"] = "text-center";
|
|
60
|
+
TextAlign["Right"] = "text-right";
|
|
61
|
+
TextAlign["Justify"] = "text-justify";
|
|
62
|
+
})(TextAlign || (exports.TextAlign = TextAlign = {}));
|
|
63
|
+
var FontWeight;
|
|
64
|
+
(function (FontWeight) {
|
|
65
|
+
/**
|
|
66
|
+
* Weight - 700
|
|
67
|
+
*/
|
|
68
|
+
FontWeight["Bold"] = "font-bold";
|
|
69
|
+
/**
|
|
70
|
+
* Weight - 500
|
|
71
|
+
*/
|
|
72
|
+
FontWeight["Medium"] = "font-medium";
|
|
73
|
+
/**
|
|
74
|
+
* Weight - 400
|
|
75
|
+
*/
|
|
76
|
+
FontWeight["Normal"] = "font-normal";
|
|
77
|
+
})(FontWeight || (exports.FontWeight = FontWeight = {}));
|
|
78
|
+
var OverflowWrap;
|
|
79
|
+
(function (OverflowWrap) {
|
|
80
|
+
OverflowWrap["BreakWord"] = "break-words";
|
|
81
|
+
OverflowWrap["Anywhere"] = "break-all";
|
|
82
|
+
OverflowWrap["Normal"] = "break-normal";
|
|
83
|
+
})(OverflowWrap || (exports.OverflowWrap = OverflowWrap = {}));
|
|
84
|
+
var FontStyle;
|
|
85
|
+
(function (FontStyle) {
|
|
86
|
+
FontStyle["Italic"] = "italic";
|
|
87
|
+
FontStyle["Normal"] = "not-italic";
|
|
88
|
+
})(FontStyle || (exports.FontStyle = FontStyle = {}));
|
|
89
|
+
var TextTransform;
|
|
90
|
+
(function (TextTransform) {
|
|
91
|
+
TextTransform["Uppercase"] = "uppercase";
|
|
92
|
+
TextTransform["Lowercase"] = "lowercase";
|
|
93
|
+
TextTransform["Capitalize"] = "capitalize";
|
|
94
|
+
TextTransform["Normal"] = "normal-case";
|
|
95
|
+
})(TextTransform || (exports.TextTransform = TextTransform = {}));
|
|
96
|
+
//# sourceMappingURL=Text.types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.cjs","sourceRoot":"","sources":["../../../src/components/text/Text.types.ts"],"names":[],"mappings":";;;AA0DA,IAAY,WAeX;AAfD,WAAY,WAAW;IACrB,gBAAgB;IAChB,uCAAwB,CAAA;IACxB,uCAAwB,CAAA;IAExB,gBAAgB;IAChB,uCAAwB,CAAA;IACxB,uCAAwB,CAAA;IACxB,uCAAwB,CAAA;IAExB,aAAa;IACb,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;IAClB,iCAAkB,CAAA;AACpB,CAAC,EAfW,WAAW,2BAAX,WAAW,QAetB;AAED,IAAY,SAmCX;AAnCD,WAAY,SAAS;IACnB,gCAAgC;IAChC,yCAA4B,CAAA;IAC5B,uCAAuC;IACvC,iDAAoC,CAAA;IACpC,6DAA6D;IAC7D,qCAAwB,CAAA;IACxB,qFAAqF;IACrF,oDAAuC,CAAA;IACvC,iGAAiG;IACjG,oDAAuC,CAAA;IACvC,iFAAiF;IACjF,oDAAuC,CAAA;IACvC,0FAA0F;IAC1F,gDAAmC,CAAA;IACnC,yDAAyD;IACzD,wDAA2C,CAAA;IAC3C,+EAA+E;IAC/E,gDAAmC,CAAA;IACnC,oFAAoF;IACpF,oDAAuC,CAAA;IACvC,iFAAiF;IACjF,oDAAuC,CAAA;IACvC,yFAAyF;IACzF,oDAAuC,CAAA;IACvC,iFAAiF;IACjF,oDAAuC,CAAA;IACvC,sFAAsF;IACtF,8CAAiC,CAAA;IACjC,8EAA8E;IAC9E,8CAAiC,CAAA;IACjC,8CAA8C;IAC9C,qCAAwB,CAAA;IACxB,sCAAsC;IACtC,6CAAgC,CAAA;AAClC,CAAC,EAnCW,SAAS,yBAAT,SAAS,QAmCpB;AAED,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,+BAAkB,CAAA;IAClB,mCAAsB,CAAA;IACtB,iCAAoB,CAAA;IACpB,qCAAwB,CAAA;AAC1B,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAwBD,IAAY,UAaX;AAbD,WAAY,UAAU;IACpB;;OAEG;IACH,gCAAkB,CAAA;IAClB;;OAEG;IACH,oCAAsB,CAAA;IACtB;;OAEG;IACH,oCAAsB,CAAA;AACxB,CAAC,EAbW,UAAU,0BAAV,UAAU,QAarB;AAED,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,yCAAyB,CAAA;IACzB,sCAAsB,CAAA;IACtB,uCAAuB,CAAA;AACzB,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB;AAED,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,8BAAiB,CAAA;IACjB,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB;AAED,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,wCAAuB,CAAA;IACvB,0CAAyB,CAAA;IACzB,uCAAsB,CAAA;AACxB,CAAC,EALW,aAAa,6BAAb,aAAa,QAKxB","sourcesContent":["export type TextProps = {\n /**\n * Optional prop to change the font size of the component. The Text component uses responsive font sizes.\n * Different variants map to specific HTML elements by default.\n * @default TextVariant.BodyMd\n */\n variant?: TextVariant;\n /**\n * The text content or elements to be rendered within the component.\n */\n children: React.ReactNode;\n /**\n * Optional prop for additional CSS classes to be applied to the Text component.\n */\n className?: string;\n /**\n * Optional prop to control the font weight of the text.\n * - Normal: 400\n * - Medium: 500\n * - Bold: 700\n */\n fontWeight?: FontWeight;\n /**\n * Optional prop to control the font style of the text.\n * Options: Normal, Italic\n */\n fontStyle?: FontStyle;\n /**\n * Optional prop to apply text transformation to the content.\n * Options: Uppercase, Lowercase, Capitalize, Normal\n */\n textTransform?: TextTransform;\n /**\n * Optional prop to control the text alignment within its container.\n * Options: Left, Center, Right, Justify\n */\n textAlign?: TextAlign;\n /**\n * Optional prop to determine how text should wrap when it reaches the edge of its container.\n * Options: BreakWord, Anywhere, Normal\n */\n overflowWrap?: OverflowWrap;\n /**\n * Optional prop that when true, adds an ellipsis (...) when text overflows its container.\n * @default false\n */\n ellipsis?: boolean;\n /**\n * Optional prop that changes the root HTML element of the Text component.\n * Uses semantic HTML tags like h1, p, span, etc.\n */\n as?: ValidTag;\n /**\n * Optional prop that sets the color of the text using predefined theme colors.\n * @default TextColor.TextDefault\n */\n color?: TextColor;\n};\nexport enum TextVariant {\n // Display Sizes\n DisplayLg = 'display-lg',\n DisplayMd = 'display-md',\n\n // Heading Sizes\n HeadingLg = 'heading-lg',\n HeadingMd = 'heading-md',\n HeadingSm = 'heading-sm',\n\n // Font Sizes\n BodyLg = 'body-lg',\n BodyMd = 'body-md',\n BodySm = 'body-sm',\n BodyXs = 'body-xs',\n}\n\nexport enum TextColor {\n /** For default neutral text. */\n TextDefault = 'text-default',\n /** For softer contrast neutral text */\n TextAlternative = 'text-alternative',\n /** For the softest contrast neutral text (not accessible) */\n TextMuted = 'text-muted',\n /** For elements used on top of overlay/alternative. Used for text, icon or border */\n OverlayInverse = 'text-overlay-inverse',\n /** For interactive, active, and selected semantics. Used for text, background, icon or border */\n PrimaryDefault = 'text-primary-default',\n /** For elements used on top of primary/default. Used for text, icon or border */\n PrimaryInverse = 'text-primary-inverse',\n /** For the critical alert semantic elements. Used for text, background, icon or border */\n ErrorDefault = 'text-error-default',\n /** For the stronger contrast error semantic elements. */\n ErrorAlternative = 'text-error-alternative',\n /** For elements used on top of error/default. Used for text, icon or border */\n ErrorInverse = 'text-error-inverse',\n /** For the positive semantic elements. Used for text, background, icon or border */\n SuccessDefault = 'text-success-default',\n /** For elements used on top of success/default. Used for text, icon or border */\n SuccessInverse = 'text-success-inverse',\n /** For the caution alert semantic elements. Used for text, background, icon or border */\n WarningDefault = 'text-warning-default',\n /** For elements used on top of warning/default. Used for text, icon or border */\n WarningInverse = 'text-warning-inverse',\n /** For informational read-only elements. Used for text, background, icon or border */\n InfoDefault = 'text-info-default',\n /** For elements used on top of info/default. Used for text, icon or border */\n InfoInverse = 'text-info-inverse',\n /** Inherit the color of the parent element */\n Inherit = 'text-inherit',\n /** Make the text color transparent */\n Transparent = 'text-transparent',\n}\n\nexport enum TextAlign {\n Left = 'text-left',\n Center = 'text-center',\n Right = 'text-right',\n Justify = 'text-justify',\n}\n\nexport type ValidTag =\n | 'dd'\n | 'div'\n | 'dt'\n | 'em'\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'\n | 'li'\n | 'p'\n | 'span'\n | 'strong'\n | 'ul'\n | 'label'\n | 'input'\n | 'header'\n | 'a'\n | 'button';\n\nexport enum FontWeight {\n /**\n * Weight - 700\n */\n Bold = 'font-bold',\n /**\n * Weight - 500\n */\n Medium = 'font-medium',\n /**\n * Weight - 400\n */\n Normal = 'font-normal',\n}\n\nexport enum OverflowWrap {\n BreakWord = 'break-words',\n Anywhere = 'break-all',\n Normal = 'break-normal',\n}\n\nexport enum FontStyle {\n Italic = 'italic',\n Normal = 'not-italic',\n}\n\nexport enum TextTransform {\n Uppercase = 'uppercase',\n Lowercase = 'lowercase',\n Capitalize = 'capitalize',\n Normal = 'normal-case',\n}\n"]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type TextProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Optional prop to change the font size of the component. The Text component uses responsive font sizes.
|
|
5
|
+
* Different variants map to specific HTML elements by default.
|
|
6
|
+
* @default TextVariant.BodyMd
|
|
7
|
+
*/
|
|
8
|
+
variant?: TextVariant;
|
|
9
|
+
/**
|
|
10
|
+
* The text content or elements to be rendered within the component.
|
|
11
|
+
*/
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Optional prop for additional CSS classes to be applied to the Text component.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Optional prop to control the font weight of the text.
|
|
19
|
+
* - Normal: 400
|
|
20
|
+
* - Medium: 500
|
|
21
|
+
* - Bold: 700
|
|
22
|
+
*/
|
|
23
|
+
fontWeight?: FontWeight;
|
|
24
|
+
/**
|
|
25
|
+
* Optional prop to control the font style of the text.
|
|
26
|
+
* Options: Normal, Italic
|
|
27
|
+
*/
|
|
28
|
+
fontStyle?: FontStyle;
|
|
29
|
+
/**
|
|
30
|
+
* Optional prop to apply text transformation to the content.
|
|
31
|
+
* Options: Uppercase, Lowercase, Capitalize, Normal
|
|
32
|
+
*/
|
|
33
|
+
textTransform?: TextTransform;
|
|
34
|
+
/**
|
|
35
|
+
* Optional prop to control the text alignment within its container.
|
|
36
|
+
* Options: Left, Center, Right, Justify
|
|
37
|
+
*/
|
|
38
|
+
textAlign?: TextAlign;
|
|
39
|
+
/**
|
|
40
|
+
* Optional prop to determine how text should wrap when it reaches the edge of its container.
|
|
41
|
+
* Options: BreakWord, Anywhere, Normal
|
|
42
|
+
*/
|
|
43
|
+
overflowWrap?: OverflowWrap;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop that when true, adds an ellipsis (...) when text overflows its container.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
ellipsis?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Optional prop that changes the root HTML element of the Text component.
|
|
51
|
+
* Uses semantic HTML tags like h1, p, span, etc.
|
|
52
|
+
*/
|
|
53
|
+
as?: ValidTag;
|
|
54
|
+
/**
|
|
55
|
+
* Optional prop that sets the color of the text using predefined theme colors.
|
|
56
|
+
* @default TextColor.TextDefault
|
|
57
|
+
*/
|
|
58
|
+
color?: TextColor;
|
|
59
|
+
};
|
|
60
|
+
export declare enum TextVariant {
|
|
61
|
+
DisplayLg = "display-lg",
|
|
62
|
+
DisplayMd = "display-md",
|
|
63
|
+
HeadingLg = "heading-lg",
|
|
64
|
+
HeadingMd = "heading-md",
|
|
65
|
+
HeadingSm = "heading-sm",
|
|
66
|
+
BodyLg = "body-lg",
|
|
67
|
+
BodyMd = "body-md",
|
|
68
|
+
BodySm = "body-sm",
|
|
69
|
+
BodyXs = "body-xs"
|
|
70
|
+
}
|
|
71
|
+
export declare enum TextColor {
|
|
72
|
+
/** For default neutral text. */
|
|
73
|
+
TextDefault = "text-default",
|
|
74
|
+
/** For softer contrast neutral text */
|
|
75
|
+
TextAlternative = "text-alternative",
|
|
76
|
+
/** For the softest contrast neutral text (not accessible) */
|
|
77
|
+
TextMuted = "text-muted",
|
|
78
|
+
/** For elements used on top of overlay/alternative. Used for text, icon or border */
|
|
79
|
+
OverlayInverse = "text-overlay-inverse",
|
|
80
|
+
/** For interactive, active, and selected semantics. Used for text, background, icon or border */
|
|
81
|
+
PrimaryDefault = "text-primary-default",
|
|
82
|
+
/** For elements used on top of primary/default. Used for text, icon or border */
|
|
83
|
+
PrimaryInverse = "text-primary-inverse",
|
|
84
|
+
/** For the critical alert semantic elements. Used for text, background, icon or border */
|
|
85
|
+
ErrorDefault = "text-error-default",
|
|
86
|
+
/** For the stronger contrast error semantic elements. */
|
|
87
|
+
ErrorAlternative = "text-error-alternative",
|
|
88
|
+
/** For elements used on top of error/default. Used for text, icon or border */
|
|
89
|
+
ErrorInverse = "text-error-inverse",
|
|
90
|
+
/** For the positive semantic elements. Used for text, background, icon or border */
|
|
91
|
+
SuccessDefault = "text-success-default",
|
|
92
|
+
/** For elements used on top of success/default. Used for text, icon or border */
|
|
93
|
+
SuccessInverse = "text-success-inverse",
|
|
94
|
+
/** For the caution alert semantic elements. Used for text, background, icon or border */
|
|
95
|
+
WarningDefault = "text-warning-default",
|
|
96
|
+
/** For elements used on top of warning/default. Used for text, icon or border */
|
|
97
|
+
WarningInverse = "text-warning-inverse",
|
|
98
|
+
/** For informational read-only elements. Used for text, background, icon or border */
|
|
99
|
+
InfoDefault = "text-info-default",
|
|
100
|
+
/** For elements used on top of info/default. Used for text, icon or border */
|
|
101
|
+
InfoInverse = "text-info-inverse",
|
|
102
|
+
/** Inherit the color of the parent element */
|
|
103
|
+
Inherit = "text-inherit",
|
|
104
|
+
/** Make the text color transparent */
|
|
105
|
+
Transparent = "text-transparent"
|
|
106
|
+
}
|
|
107
|
+
export declare enum TextAlign {
|
|
108
|
+
Left = "text-left",
|
|
109
|
+
Center = "text-center",
|
|
110
|
+
Right = "text-right",
|
|
111
|
+
Justify = "text-justify"
|
|
112
|
+
}
|
|
113
|
+
export type ValidTag = 'dd' | 'div' | 'dt' | 'em' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'li' | 'p' | 'span' | 'strong' | 'ul' | 'label' | 'input' | 'header' | 'a' | 'button';
|
|
114
|
+
export declare enum FontWeight {
|
|
115
|
+
/**
|
|
116
|
+
* Weight - 700
|
|
117
|
+
*/
|
|
118
|
+
Bold = "font-bold",
|
|
119
|
+
/**
|
|
120
|
+
* Weight - 500
|
|
121
|
+
*/
|
|
122
|
+
Medium = "font-medium",
|
|
123
|
+
/**
|
|
124
|
+
* Weight - 400
|
|
125
|
+
*/
|
|
126
|
+
Normal = "font-normal"
|
|
127
|
+
}
|
|
128
|
+
export declare enum OverflowWrap {
|
|
129
|
+
BreakWord = "break-words",
|
|
130
|
+
Anywhere = "break-all",
|
|
131
|
+
Normal = "break-normal"
|
|
132
|
+
}
|
|
133
|
+
export declare enum FontStyle {
|
|
134
|
+
Italic = "italic",
|
|
135
|
+
Normal = "not-italic"
|
|
136
|
+
}
|
|
137
|
+
export declare enum TextTransform {
|
|
138
|
+
Uppercase = "uppercase",
|
|
139
|
+
Lowercase = "lowercase",
|
|
140
|
+
Capitalize = "capitalize",
|
|
141
|
+
Normal = "normal-case"
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=Text.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.types.d.cts","sourceRoot":"","sources":["../../../src/components/text/Text.types.ts"],"names":[],"mappings":";AAAA,MAAM,MAAM,SAAS,GAAG;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AACF,oBAAY,WAAW;IAErB,SAAS,eAAe;IACxB,SAAS,eAAe;IAGxB,SAAS,eAAe;IACxB,SAAS,eAAe;IACxB,SAAS,eAAe;IAGxB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;IAClB,MAAM,YAAY;CACnB;AAED,oBAAY,SAAS;IACnB,gCAAgC;IAChC,WAAW,iBAAiB;IAC5B,uCAAuC;IACvC,eAAe,qBAAqB;IACpC,6DAA6D;IAC7D,SAAS,eAAe;IACxB,qFAAqF;IACrF,cAAc,yBAAyB;IACvC,iGAAiG;IACjG,cAAc,yBAAyB;IACvC,iFAAiF;IACjF,cAAc,yBAAyB;IACvC,0FAA0F;IAC1F,YAAY,uBAAuB;IACnC,yDAAyD;IACzD,gBAAgB,2BAA2B;IAC3C,+EAA+E;IAC/E,YAAY,uBAAuB;IACnC,oFAAoF;IACpF,cAAc,yBAAyB;IACvC,iFAAiF;IACjF,cAAc,yBAAyB;IACvC,yFAAyF;IACzF,cAAc,yBAAyB;IACvC,iFAAiF;IACjF,cAAc,yBAAyB;IACvC,sFAAsF;IACtF,WAAW,sBAAsB;IACjC,8EAA8E;IAC9E,WAAW,sBAAsB;IACjC,8CAA8C;IAC9C,OAAO,iBAAiB;IACxB,sCAAsC;IACtC,WAAW,qBAAqB;CACjC;AAED,oBAAY,SAAS;IACnB,IAAI,cAAc;IAClB,MAAM,gBAAgB;IACtB,KAAK,eAAe;IACpB,OAAO,iBAAiB;CACzB;AAED,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,KAAK,GACL,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,MAAM,GACN,QAAQ,GACR,IAAI,GACJ,OAAO,GACP,OAAO,GACP,QAAQ,GACR,GAAG,GACH,QAAQ,CAAC;AAEb,oBAAY,UAAU;IACpB;;OAEG;IACH,IAAI,cAAc;IAClB;;OAEG;IACH,MAAM,gBAAgB;IACtB;;OAEG;IACH,MAAM,gBAAgB;CACvB;AAED,oBAAY,YAAY;IACtB,SAAS,gBAAgB;IACzB,QAAQ,cAAc;IACtB,MAAM,iBAAiB;CACxB;AAED,oBAAY,SAAS;IACnB,MAAM,WAAW;IACjB,MAAM,eAAe;CACtB;AAED,oBAAY,aAAa;IACvB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,MAAM,gBAAgB;CACvB"}
|