@purpurds/heading 3.0.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/LICENSE.txt +31 -0
- package/dist/heading.cjs.js +6 -0
- package/dist/heading.cjs.js.map +1 -0
- package/dist/heading.d.ts +38 -0
- package/dist/heading.d.ts.map +1 -0
- package/dist/heading.es.js +103 -0
- package/dist/heading.es.js.map +1 -0
- package/dist/heading.system.js +6 -0
- package/dist/heading.system.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +59 -0
- package/readme.mdx +59 -0
- package/src/global.d.ts +4 -0
- package/src/heading.mixins.scss +95 -0
- package/src/heading.module.scss +61 -0
- package/src/heading.stories.tsx +46 -0
- package/src/heading.test.tsx +27 -0
- package/src/heading.tsx +74 -0
package/dist/LICENSE.txt
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
Name: classnames
|
|
2
|
+
Version: 2.5.1
|
|
3
|
+
License: MIT
|
|
4
|
+
Private: false
|
|
5
|
+
Description: A simple utility for conditionally joining classNames together
|
|
6
|
+
Repository: git+https://github.com/JedWatson/classnames.git
|
|
7
|
+
Author: Jed Watson
|
|
8
|
+
License Copyright:
|
|
9
|
+
===
|
|
10
|
+
|
|
11
|
+
The MIT License (MIT)
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2018 Jed Watson
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime");function _(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var d={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(r){(function(){var a={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var i=arguments[e];i&&(t=p(t,u(i)))}return t}function u(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var i in t)a.call(t,i)&&t[i]&&(e=p(e,i));return e}function p(t,e){return e?t?t+" "+e:t+e:t}r.exports?(n.default=n,r.exports=n):window.classNames=n})()})(d);var y=d.exports;const g=_(y),s={"purpur-heading":"_purpur-heading_2c2y0_1","purpur-heading--hyphens":"_purpur-heading--hyphens_2c2y0_8","purpur-heading--subsection-100":"_purpur-heading--subsection-100_2c2y0_11","purpur-heading--title-100":"_purpur-heading--title-100_2c2y0_17","purpur-heading--title-200":"_purpur-heading--title-200_2c2y0_23","purpur-heading--title-300":"_purpur-heading--title-300_2c2y0_29","purpur-heading--title-400":"_purpur-heading--title-400_2c2y0_35","purpur-heading--title-500":"_purpur-heading--title-500_2c2y0_41","purpur-heading--title-600":"_purpur-heading--title-600_2c2y0_47","purpur-heading--title-700":"_purpur-heading--title-700_2c2y0_53","purpur-heading--display-25":"_purpur-heading--display-25_2c2y0_59","purpur-heading--display-50":"_purpur-heading--display-50_2c2y0_65","purpur-heading--display-100":"_purpur-heading--display-100_2c2y0_71","purpur-heading--display-200":"_purpur-heading--display-200_2c2y0_77"},f={H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6"},c={TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"},T={DISPLAY25:"display-25",DISPLAY50:"display-50",DISPLAY100:"display-100",DISPLAY200:"display-200"},l="purpur-heading",I=({["data-testid"]:r,children:a,className:n="",enableHyphenation:u=!1,tag:p,variant:t=c.TITLE100,...e})=>{const i=p,o=g([n,s[l],s[`${l}--${t}`],{[s[`${l}--hyphens`]]:u}]);return h.jsx(i,{...e,className:o,"data-testid":r,children:a})};exports.DisplayVariant=T;exports.Heading=I;exports.HeadingTag=f;exports.TitleVariant=c;
|
|
6
|
+
//# sourceMappingURL=heading.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/heading.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ComponentProps, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./heading.module.scss\";\n\nexport const HeadingTag = {\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n} as const;\n\nexport type HeadingTagType = (typeof HeadingTag)[keyof typeof HeadingTag];\n\nexport const TitleVariant = {\n TITLE100: \"title-100\",\n TITLE200: \"title-200\",\n TITLE300: \"title-300\",\n TITLE400: \"title-400\",\n TITLE500: \"title-500\",\n TITLE600: \"title-600\",\n TITLE700: \"title-700\",\n SUBSECTION100: \"subsection-100\",\n} as const;\n\nexport type TitleVariantType = (typeof TitleVariant)[keyof typeof TitleVariant];\n\nexport const DisplayVariant = {\n DISPLAY25: \"display-25\",\n DISPLAY50: \"display-50\",\n DISPLAY100: \"display-100\",\n DISPLAY200: \"display-200\",\n} as const;\n\nexport type DisplayVariantType = (typeof DisplayVariant)[keyof typeof DisplayVariant];\n\nexport type HeadingProps = ComponentProps<HeadingTagType> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n tag: HeadingTagType;\n variant?: TitleVariantType | DisplayVariantType;\n};\n\nconst rootClassName = \"purpur-heading\";\n\nexport const Heading = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n enableHyphenation = false,\n tag,\n variant = TitleVariant.TITLE100,\n ...props\n}: HeadingProps) => {\n const Tag = tag;\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n },\n ]);\n\n return (\n <Tag {...props} className={classes} data-testid={dataTestid}>\n {children}\n </Tag>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","HeadingTag","TitleVariant","DisplayVariant","rootClassName","Heading","dataTestid","children","className","enableHyphenation","tag","variant","props","Tag","c","styles","jsx"],"mappings":";;;;gBAOC,UAAY,CAGZ,IAAIA,EAAS,CAAE,EAAC,eAEhB,SAASC,GAAc,CAGtB,QAFIC,EAAU,GAELC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAC1C,IAAIC,EAAM,UAAUD,CAAC,EACjBC,IACHF,EAAUG,EAAYH,EAASI,EAAWF,CAAG,CAAC,EAE/C,CAED,OAAOF,CACP,CAED,SAASI,EAAYF,EAAK,CACzB,GAAI,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,SAC7C,OAAOA,EAGR,GAAI,OAAOA,GAAQ,SAClB,MAAO,GAGR,GAAI,MAAM,QAAQA,CAAG,EACpB,OAAOH,EAAW,MAAM,KAAMG,CAAG,EAGlC,GAAIA,EAAI,WAAa,OAAO,UAAU,UAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe,EAClG,OAAOA,EAAI,WAGZ,IAAIF,EAAU,GAEd,QAASK,KAAOH,EACXJ,EAAO,KAAKI,EAAKG,CAAG,GAAKH,EAAIG,CAAG,IACnCL,EAAUG,EAAYH,EAASK,CAAG,GAIpC,OAAOL,CACP,CAED,SAASG,EAAaG,EAAOC,EAAU,CACtC,OAAKA,EAIDD,EACIA,EAAQ,IAAMC,EAGfD,EAAQC,EAPPD,CAQR,CAEoCE,EAAO,SAC3CT,EAAW,QAAUA,EACrBS,EAAA,QAAiBT,GAOjB,OAAO,WAAaA,CAEtB,i8BCvEaU,EAAa,CACxB,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,EAIaC,EAAe,CAC1B,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,cAAe,gBACjB,EAIaC,EAAiB,CAC5B,UAAW,aACX,UAAW,aACX,WAAY,cACZ,WAAY,aACd,EAaMC,EAAgB,iBAETC,EAAU,CAAC,CACtB,CAAC,eAAgBC,EACjB,SAAAC,EACA,UAAAC,EAAY,GACZ,kBAAAC,EAAoB,GACpB,IAAAC,EACA,QAAAC,EAAUT,EAAa,SACvB,GAAGU,CACL,IAAoB,CAClB,MAAMC,EAAMH,EACNlB,EAAUsB,EAAE,CAChBN,EACAO,EAAOX,CAAa,EACpBW,EAAO,GAAGX,CAAa,KAAKO,CAAO,EAAE,EACrC,CACE,CAACI,EAAO,GAAGX,CAAa,WAAW,CAAC,EAAGK,CACzC,CAAA,CACD,EAGC,OAAAO,MAACH,GAAK,GAAGD,EAAO,UAAWpB,EAAS,cAAac,EAC9C,SAAAC,CACH,CAAA,CAEJ","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactNode } from "react";
|
|
2
|
+
export declare const HeadingTag: {
|
|
3
|
+
readonly H1: "h1";
|
|
4
|
+
readonly H2: "h2";
|
|
5
|
+
readonly H3: "h3";
|
|
6
|
+
readonly H4: "h4";
|
|
7
|
+
readonly H5: "h5";
|
|
8
|
+
readonly H6: "h6";
|
|
9
|
+
};
|
|
10
|
+
export type HeadingTagType = (typeof HeadingTag)[keyof typeof HeadingTag];
|
|
11
|
+
export declare const TitleVariant: {
|
|
12
|
+
readonly TITLE100: "title-100";
|
|
13
|
+
readonly TITLE200: "title-200";
|
|
14
|
+
readonly TITLE300: "title-300";
|
|
15
|
+
readonly TITLE400: "title-400";
|
|
16
|
+
readonly TITLE500: "title-500";
|
|
17
|
+
readonly TITLE600: "title-600";
|
|
18
|
+
readonly TITLE700: "title-700";
|
|
19
|
+
readonly SUBSECTION100: "subsection-100";
|
|
20
|
+
};
|
|
21
|
+
export type TitleVariantType = (typeof TitleVariant)[keyof typeof TitleVariant];
|
|
22
|
+
export declare const DisplayVariant: {
|
|
23
|
+
readonly DISPLAY25: "display-25";
|
|
24
|
+
readonly DISPLAY50: "display-50";
|
|
25
|
+
readonly DISPLAY100: "display-100";
|
|
26
|
+
readonly DISPLAY200: "display-200";
|
|
27
|
+
};
|
|
28
|
+
export type DisplayVariantType = (typeof DisplayVariant)[keyof typeof DisplayVariant];
|
|
29
|
+
export type HeadingProps = ComponentProps<HeadingTagType> & {
|
|
30
|
+
["data-testid"]?: string;
|
|
31
|
+
children: ReactNode;
|
|
32
|
+
className?: string;
|
|
33
|
+
enableHyphenation?: boolean;
|
|
34
|
+
tag: HeadingTagType;
|
|
35
|
+
variant?: TitleVariantType | DisplayVariantType;
|
|
36
|
+
};
|
|
37
|
+
export declare const Heading: ({ ["data-testid"]: dataTestid, children, className, enableHyphenation, tag, variant, ...props }: HeadingProps) => React.JSX.Element;
|
|
38
|
+
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../src/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzD,eAAO,MAAM,UAAU;;;;;;;CAOb,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAE1E,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAEhF,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEtF,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,CAAC,aAAa,CAAC,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,GAAG,EAAE,cAAc,CAAC;IACpB,OAAO,CAAC,EAAE,gBAAgB,GAAG,kBAAkB,CAAC;CACjD,CAAC;AAIF,eAAO,MAAM,OAAO,oGAQjB,YAAY,sBAgBd,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
function h(e) {
|
|
3
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
4
|
+
}
|
|
5
|
+
var d = { exports: {} };
|
|
6
|
+
/*!
|
|
7
|
+
Copyright (c) 2018 Jed Watson.
|
|
8
|
+
Licensed under the MIT License (MIT), see
|
|
9
|
+
http://jedwatson.github.io/classnames
|
|
10
|
+
*/
|
|
11
|
+
(function(e) {
|
|
12
|
+
(function() {
|
|
13
|
+
var u = {}.hasOwnProperty;
|
|
14
|
+
function p() {
|
|
15
|
+
for (var t = "", r = 0; r < arguments.length; r++) {
|
|
16
|
+
var i = arguments[r];
|
|
17
|
+
i && (t = n(t, a(i)));
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
}
|
|
21
|
+
function a(t) {
|
|
22
|
+
if (typeof t == "string" || typeof t == "number")
|
|
23
|
+
return t;
|
|
24
|
+
if (typeof t != "object")
|
|
25
|
+
return "";
|
|
26
|
+
if (Array.isArray(t))
|
|
27
|
+
return p.apply(null, t);
|
|
28
|
+
if (t.toString !== Object.prototype.toString && !t.toString.toString().includes("[native code]"))
|
|
29
|
+
return t.toString();
|
|
30
|
+
var r = "";
|
|
31
|
+
for (var i in t)
|
|
32
|
+
u.call(t, i) && t[i] && (r = n(r, i));
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
function n(t, r) {
|
|
36
|
+
return r ? t ? t + " " + r : t + r : t;
|
|
37
|
+
}
|
|
38
|
+
e.exports ? (p.default = p, e.exports = p) : window.classNames = p;
|
|
39
|
+
})();
|
|
40
|
+
})(d);
|
|
41
|
+
var _ = d.exports;
|
|
42
|
+
const y = /* @__PURE__ */ h(_), s = {
|
|
43
|
+
"purpur-heading": "_purpur-heading_2c2y0_1",
|
|
44
|
+
"purpur-heading--hyphens": "_purpur-heading--hyphens_2c2y0_8",
|
|
45
|
+
"purpur-heading--subsection-100": "_purpur-heading--subsection-100_2c2y0_11",
|
|
46
|
+
"purpur-heading--title-100": "_purpur-heading--title-100_2c2y0_17",
|
|
47
|
+
"purpur-heading--title-200": "_purpur-heading--title-200_2c2y0_23",
|
|
48
|
+
"purpur-heading--title-300": "_purpur-heading--title-300_2c2y0_29",
|
|
49
|
+
"purpur-heading--title-400": "_purpur-heading--title-400_2c2y0_35",
|
|
50
|
+
"purpur-heading--title-500": "_purpur-heading--title-500_2c2y0_41",
|
|
51
|
+
"purpur-heading--title-600": "_purpur-heading--title-600_2c2y0_47",
|
|
52
|
+
"purpur-heading--title-700": "_purpur-heading--title-700_2c2y0_53",
|
|
53
|
+
"purpur-heading--display-25": "_purpur-heading--display-25_2c2y0_59",
|
|
54
|
+
"purpur-heading--display-50": "_purpur-heading--display-50_2c2y0_65",
|
|
55
|
+
"purpur-heading--display-100": "_purpur-heading--display-100_2c2y0_71",
|
|
56
|
+
"purpur-heading--display-200": "_purpur-heading--display-200_2c2y0_77"
|
|
57
|
+
}, T = {
|
|
58
|
+
H1: "h1",
|
|
59
|
+
H2: "h2",
|
|
60
|
+
H3: "h3",
|
|
61
|
+
H4: "h4",
|
|
62
|
+
H5: "h5",
|
|
63
|
+
H6: "h6"
|
|
64
|
+
}, g = {
|
|
65
|
+
TITLE100: "title-100",
|
|
66
|
+
TITLE200: "title-200",
|
|
67
|
+
TITLE300: "title-300",
|
|
68
|
+
TITLE400: "title-400",
|
|
69
|
+
TITLE500: "title-500",
|
|
70
|
+
TITLE600: "title-600",
|
|
71
|
+
TITLE700: "title-700",
|
|
72
|
+
SUBSECTION100: "subsection-100"
|
|
73
|
+
}, I = {
|
|
74
|
+
DISPLAY25: "display-25",
|
|
75
|
+
DISPLAY50: "display-50",
|
|
76
|
+
DISPLAY100: "display-100",
|
|
77
|
+
DISPLAY200: "display-200"
|
|
78
|
+
}, l = "purpur-heading", L = ({
|
|
79
|
+
["data-testid"]: e,
|
|
80
|
+
children: u,
|
|
81
|
+
className: p = "",
|
|
82
|
+
enableHyphenation: a = !1,
|
|
83
|
+
tag: n,
|
|
84
|
+
variant: t = g.TITLE100,
|
|
85
|
+
...r
|
|
86
|
+
}) => {
|
|
87
|
+
const i = n, o = y([
|
|
88
|
+
p,
|
|
89
|
+
s[l],
|
|
90
|
+
s[`${l}--${t}`],
|
|
91
|
+
{
|
|
92
|
+
[s[`${l}--hyphens`]]: a
|
|
93
|
+
}
|
|
94
|
+
]);
|
|
95
|
+
return /* @__PURE__ */ c(i, { ...r, className: o, "data-testid": e, children: u });
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
I as DisplayVariant,
|
|
99
|
+
L as Heading,
|
|
100
|
+
T as HeadingTag,
|
|
101
|
+
g as TitleVariant
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=heading.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.es.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/heading.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ComponentProps, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./heading.module.scss\";\n\nexport const HeadingTag = {\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n} as const;\n\nexport type HeadingTagType = (typeof HeadingTag)[keyof typeof HeadingTag];\n\nexport const TitleVariant = {\n TITLE100: \"title-100\",\n TITLE200: \"title-200\",\n TITLE300: \"title-300\",\n TITLE400: \"title-400\",\n TITLE500: \"title-500\",\n TITLE600: \"title-600\",\n TITLE700: \"title-700\",\n SUBSECTION100: \"subsection-100\",\n} as const;\n\nexport type TitleVariantType = (typeof TitleVariant)[keyof typeof TitleVariant];\n\nexport const DisplayVariant = {\n DISPLAY25: \"display-25\",\n DISPLAY50: \"display-50\",\n DISPLAY100: \"display-100\",\n DISPLAY200: \"display-200\",\n} as const;\n\nexport type DisplayVariantType = (typeof DisplayVariant)[keyof typeof DisplayVariant];\n\nexport type HeadingProps = ComponentProps<HeadingTagType> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n tag: HeadingTagType;\n variant?: TitleVariantType | DisplayVariantType;\n};\n\nconst rootClassName = \"purpur-heading\";\n\nexport const Heading = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n enableHyphenation = false,\n tag,\n variant = TitleVariant.TITLE100,\n ...props\n}: HeadingProps) => {\n const Tag = tag;\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n },\n ]);\n\n return (\n <Tag {...props} className={classes} data-testid={dataTestid}>\n {children}\n </Tag>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","HeadingTag","TitleVariant","DisplayVariant","rootClassName","Heading","dataTestid","children","className","enableHyphenation","tag","variant","props","Tag","c","styles","jsx"],"mappings":";;;;;;;;;;;AAOA,GAAC,WAAY;AAGZ,QAAIA,IAAS,CAAE,EAAC;AAEhB,aAASC,IAAc;AAGtB,eAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,YAAIC,IAAM,UAAUD,CAAC;AACrB,QAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAWF,CAAG,CAAC;AAAA,MAE/C;AAED,aAAOF;AAAA,IACP;AAED,aAASI,EAAYF,GAAK;AACzB,UAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,eAAOA;AAGR,UAAI,OAAOA,KAAQ;AAClB,eAAO;AAGR,UAAI,MAAM,QAAQA,CAAG;AACpB,eAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,UAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,eAAOA,EAAI;AAGZ,UAAIF,IAAU;AAEd,eAASK,KAAOH;AACf,QAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAASK,CAAG;AAIpC,aAAOL;AAAA,IACP;AAED,aAASG,EAAaG,GAAOC,GAAU;AACtC,aAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,IAQR;AAED,IAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,EAAA,UAAiBT,KAOjB,OAAO,aAAaA;AAAA,EAEtB;;;;;;;;;;;;;;;;;;GCvEaU,IAAa;AAAA,EACxB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAIaC,IAAe;AAAA,EAC1B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,eAAe;AACjB,GAIaC,IAAiB;AAAA,EAC5B,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AACd,GAaMC,IAAgB,kBAETC,IAAU,CAAC;AAAA,EACtB,CAAC,gBAAgBC;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,mBAAAC,IAAoB;AAAA,EACpB,KAAAC;AAAA,EACA,SAAAC,IAAUT,EAAa;AAAA,EACvB,GAAGU;AACL,MAAoB;AAClB,QAAMC,IAAMH,GACNlB,IAAUsB,EAAE;AAAA,IAChBN;AAAA,IACAO,EAAOX,CAAa;AAAA,IACpBW,EAAO,GAAGX,CAAa,KAAKO,CAAO,EAAE;AAAA,IACrC;AAAA,MACE,CAACI,EAAO,GAAGX,CAAa,WAAW,CAAC,GAAGK;AAAA,IACzC;AAAA,EAAA,CACD;AAGC,SAAA,gBAAAO,EAACH,KAAK,GAAGD,GAAO,WAAWpB,GAAS,eAAac,GAC9C,UAAAC,EACH,CAAA;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
System.register(["react"],function(a,T){"use strict";var o;return{setters:[u=>{o=u.default}],execute:function(){function u(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var h={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(r){(function(){var d={}.hasOwnProperty;function n(){for(var t="",e=0;e<arguments.length;e++){var i=arguments[e];i&&(t=p(t,c(i)))}return t}function c(t){if(typeof t=="string"||typeof t=="number")return t;if(typeof t!="object")return"";if(Array.isArray(t))return n.apply(null,t);if(t.toString!==Object.prototype.toString&&!t.toString.toString().includes("[native code]"))return t.toString();var e="";for(var i in t)d.call(t,i)&&t[i]&&(e=p(e,i));return e}function p(t,e){return e?t?t+" "+e:t+e:t}r.exports?(n.default=n,r.exports=n):window.classNames=n})()})(h);var _=h.exports;const y=u(_),s={"purpur-heading":"_purpur-heading_2c2y0_1","purpur-heading--hyphens":"_purpur-heading--hyphens_2c2y0_8","purpur-heading--subsection-100":"_purpur-heading--subsection-100_2c2y0_11","purpur-heading--title-100":"_purpur-heading--title-100_2c2y0_17","purpur-heading--title-200":"_purpur-heading--title-200_2c2y0_23","purpur-heading--title-300":"_purpur-heading--title-300_2c2y0_29","purpur-heading--title-400":"_purpur-heading--title-400_2c2y0_35","purpur-heading--title-500":"_purpur-heading--title-500_2c2y0_41","purpur-heading--title-600":"_purpur-heading--title-600_2c2y0_47","purpur-heading--title-700":"_purpur-heading--title-700_2c2y0_53","purpur-heading--display-25":"_purpur-heading--display-25_2c2y0_59","purpur-heading--display-50":"_purpur-heading--display-50_2c2y0_65","purpur-heading--display-100":"_purpur-heading--display-100_2c2y0_71","purpur-heading--display-200":"_purpur-heading--display-200_2c2y0_77"},I=a("HeadingTag",{H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6"}),g=a("TitleVariant",{TITLE100:"title-100",TITLE200:"title-200",TITLE300:"title-300",TITLE400:"title-400",TITLE500:"title-500",TITLE600:"title-600",TITLE700:"title-700",SUBSECTION100:"subsection-100"}),m=a("DisplayVariant",{DISPLAY25:"display-25",DISPLAY50:"display-50",DISPLAY100:"display-100",DISPLAY200:"display-200"}),l="purpur-heading",E=a("Heading",({["data-testid"]:r,children:d,className:n="",enableHyphenation:c=!1,tag:p,variant:t=g.TITLE100,...e})=>{const i=p,f=y([n,s[l],s[`${l}--${t}`],{[s[`${l}--hyphens`]]:c}]);return o.createElement(i,{...e,className:f,"data-testid":r},d)})}}});
|
|
6
|
+
//# sourceMappingURL=heading.system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.system.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/heading.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue(arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(null, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React, { ComponentProps, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./heading.module.scss\";\n\nexport const HeadingTag = {\n H1: \"h1\",\n H2: \"h2\",\n H3: \"h3\",\n H4: \"h4\",\n H5: \"h5\",\n H6: \"h6\",\n} as const;\n\nexport type HeadingTagType = (typeof HeadingTag)[keyof typeof HeadingTag];\n\nexport const TitleVariant = {\n TITLE100: \"title-100\",\n TITLE200: \"title-200\",\n TITLE300: \"title-300\",\n TITLE400: \"title-400\",\n TITLE500: \"title-500\",\n TITLE600: \"title-600\",\n TITLE700: \"title-700\",\n SUBSECTION100: \"subsection-100\",\n} as const;\n\nexport type TitleVariantType = (typeof TitleVariant)[keyof typeof TitleVariant];\n\nexport const DisplayVariant = {\n DISPLAY25: \"display-25\",\n DISPLAY50: \"display-50\",\n DISPLAY100: \"display-100\",\n DISPLAY200: \"display-200\",\n} as const;\n\nexport type DisplayVariantType = (typeof DisplayVariant)[keyof typeof DisplayVariant];\n\nexport type HeadingProps = ComponentProps<HeadingTagType> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n tag: HeadingTagType;\n variant?: TitleVariantType | DisplayVariantType;\n};\n\nconst rootClassName = \"purpur-heading\";\n\nexport const Heading = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n enableHyphenation = false,\n tag,\n variant = TitleVariant.TITLE100,\n ...props\n}: HeadingProps) => {\n const Tag = tag;\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n },\n ]);\n\n return (\n <Tag {...props} className={classes} data-testid={dataTestid}>\n {children}\n </Tag>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","HeadingTag","exports","TitleVariant","DisplayVariant","rootClassName","Heading","dataTestid","children","className","enableHyphenation","tag","variant","props","Tag","c","styles","React"],"mappings":";;;;gBAOC,UAAY,CAGZ,IAAIA,EAAS,CAAE,EAAC,eAEhB,SAASC,GAAc,CAGtB,QAFIC,EAAU,GAELC,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAAK,CAC1C,IAAIC,EAAM,UAAUD,CAAC,EACjBC,IACHF,EAAUG,EAAYH,EAASI,EAAWF,CAAG,CAAC,EAE/C,CAED,OAAOF,CACP,CAED,SAASI,EAAYF,EAAK,CACzB,GAAI,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,SAC7C,OAAOA,EAGR,GAAI,OAAOA,GAAQ,SAClB,MAAO,GAGR,GAAI,MAAM,QAAQA,CAAG,EACpB,OAAOH,EAAW,MAAM,KAAMG,CAAG,EAGlC,GAAIA,EAAI,WAAa,OAAO,UAAU,UAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe,EAClG,OAAOA,EAAI,WAGZ,IAAIF,EAAU,GAEd,QAASK,KAAOH,EACXJ,EAAO,KAAKI,EAAKG,CAAG,GAAKH,EAAIG,CAAG,IACnCL,EAAUG,EAAYH,EAASK,CAAG,GAIpC,OAAOL,CACP,CAED,SAASG,EAAaG,EAAOC,EAAU,CACtC,OAAKA,EAIDD,EACIA,EAAQ,IAAMC,EAGfD,EAAQC,EAPPD,CAQR,CAEoCE,EAAO,SAC3CT,EAAW,QAAUA,EACrBS,EAAA,QAAiBT,GAOjB,OAAO,WAAaA,CAEtB,i8BCvEaU,EAAaC,EAAA,aAAA,CACxB,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,KACJ,GAAI,IACN,CAAA,EAIaC,EAAeD,EAAA,eAAA,CAC1B,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,SAAU,YACV,cAAe,gBACjB,CAAA,EAIaE,EAAiBF,EAAA,iBAAA,CAC5B,UAAW,aACX,UAAW,aACX,WAAY,cACZ,WAAY,aACd,CAAA,EAaMG,EAAgB,iBAETC,cAAU,CAAC,CACtB,CAAC,eAAgBC,EACjB,SAAAC,EACA,UAAAC,EAAY,GACZ,kBAAAC,EAAoB,GACpB,IAAAC,EACA,QAAAC,EAAUT,EAAa,SACvB,GAAGU,CACL,IAAoB,CAClB,MAAMC,EAAMH,EACNnB,EAAUuB,EAAE,CAChBN,EACAO,EAAOX,CAAa,EACpBW,EAAO,GAAGX,CAAa,KAAKO,CAAO,EAAE,EACrC,CACE,CAACI,EAAO,GAAGX,CAAa,WAAW,CAAC,EAAGK,CACzC,CAAA,CACD,EAGC,OAAAO,EAAA,cAACH,GAAK,GAAGD,EAAO,UAAWrB,EAAS,cAAae,GAC9CC,CACH,CAEJ,CAAA","x_google_ignoreList":[0]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._purpur-heading_2c2y0_1{color:var(--purpur-color-text-default);display:block;-webkit-hyphens:none;hyphens:none;margin:0;max-width:60ch}._purpur-heading--hyphens_2c2y0_8{-webkit-hyphens:auto;hyphens:auto}._purpur-heading--subsection-100_2c2y0_11{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-medium);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-default)}._purpur-heading--title-100_2c2y0_17{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-100),3vw,var(--purpur-typography-scale-200));line-height:var(--purpur-typography-line-height-default)}._purpur-heading--title-200_2c2y0_23{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-200),3vw,var(--purpur-typography-scale-400));line-height:var(--purpur-typography-line-height-default)}._purpur-heading--title-300_2c2y0_29{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-400),3vw,var(--purpur-typography-scale-600));line-height:var(--purpur-typography-line-height-default)}._purpur-heading--title-400_2c2y0_35{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-500),3vw,var(--purpur-typography-scale-700));line-height:var(--purpur-typography-line-height-default)}._purpur-heading--title-500_2c2y0_41{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-500),3vw,var(--purpur-typography-scale-800));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--title-600_2c2y0_47{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-650),3vw,var(--purpur-typography-scale-850));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--title-700_2c2y0_53{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-bold);font-size:clamp(var(--purpur-typography-scale-700),3vw,var(--purpur-typography-scale-900));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--display-25_2c2y0_59{font-family:var(--purpur-typography-family-display),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-medium);font-size:clamp(var(--purpur-typography-scale-600),3vw,var(--purpur-typography-scale-800));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--display-50_2c2y0_65{font-family:var(--purpur-typography-family-display),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-medium);font-size:clamp(var(--purpur-typography-scale-650),3vw,var(--purpur-typography-scale-850));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--display-100_2c2y0_71{font-family:var(--purpur-typography-family-display),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-medium);font-size:clamp(var(--purpur-typography-scale-700),3vw,var(--purpur-typography-scale-900));line-height:var(--purpur-typography-line-height-tight)}._purpur-heading--display-200_2c2y0_77{font-family:var(--purpur-typography-family-display),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-medium);font-size:clamp(var(--purpur-typography-scale-800),3vw,var(--purpur-typography-scale-1000));line-height:var(--purpur-typography-line-height-tight)}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purpurds/heading",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"main": "./dist/heading.cjs.js",
|
|
6
|
+
"types": "./dist/heading.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./dist/heading.cjs.js",
|
|
10
|
+
"systemjs": "./dist/heading.system.js",
|
|
11
|
+
"types": "./dist/heading.d.ts",
|
|
12
|
+
"default": "./dist/heading.es.js"
|
|
13
|
+
},
|
|
14
|
+
"./styles": "./dist/styles.css"
|
|
15
|
+
},
|
|
16
|
+
"source": "src/heading.tsx",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"classnames": "~2.5.0",
|
|
19
|
+
"@purpurds/tokens": "3.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@rushstack/eslint-patch": "~1.7.0",
|
|
23
|
+
"@storybook/blocks": "~7.6.0",
|
|
24
|
+
"@storybook/react": "~7.6.0",
|
|
25
|
+
"@telia/base-rig": "~8.2.0",
|
|
26
|
+
"@telia/react-rig": "~3.2.0",
|
|
27
|
+
"@testing-library/dom": "~9.3.3",
|
|
28
|
+
"@testing-library/jest-dom": "~6.3.0",
|
|
29
|
+
"@testing-library/react": "~14.1.2",
|
|
30
|
+
"@types/node": "18",
|
|
31
|
+
"@types/react-dom": "~18.2.17",
|
|
32
|
+
"@types/react": "~18.2.42",
|
|
33
|
+
"eslint-plugin-testing-library": "~6.2.0",
|
|
34
|
+
"eslint": "~8.56.0",
|
|
35
|
+
"jsdom": "~22.1.0",
|
|
36
|
+
"lint-staged": "~10.5.3",
|
|
37
|
+
"prettier": "~2.8.8",
|
|
38
|
+
"react-dom": "~18.2.0",
|
|
39
|
+
"react": "~18.2.0",
|
|
40
|
+
"typescript": "~5.2.2",
|
|
41
|
+
"vite": "~5.0.6",
|
|
42
|
+
"vitest": "~1.2.0",
|
|
43
|
+
"@purpurds/component-rig": "1.0.0"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"build:dev": "vite",
|
|
47
|
+
"build:watch": "vite build --watch",
|
|
48
|
+
"build": "rm -rf dist && vite build && vite build --mode systemjs",
|
|
49
|
+
"ci:build": "rushx build",
|
|
50
|
+
"coverage": "vitest run --coverage",
|
|
51
|
+
"lint:fix": "eslint . --fix",
|
|
52
|
+
"lint": "lint-staged --no-stash 2>&1",
|
|
53
|
+
"sbdev": "rush sbdev",
|
|
54
|
+
"test:unit": "vitest run --passWithNoTests",
|
|
55
|
+
"test:watch": "vitest --watch",
|
|
56
|
+
"test": "rushx test:unit",
|
|
57
|
+
"typecheck": "tsc -p ./tsconfig.json"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/readme.mdx
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
|
|
2
|
+
|
|
3
|
+
import * as HeadingStories from "./src/heading.stories";
|
|
4
|
+
import packageInfo from "./package.json";
|
|
5
|
+
|
|
6
|
+
<Meta name="Docs" title="Components/Heading" of={HeadingStories} />
|
|
7
|
+
|
|
8
|
+
# Heading
|
|
9
|
+
|
|
10
|
+
<Subtitle>Version {packageInfo.version}</Subtitle>
|
|
11
|
+
>Note that the responsive behaviour of this component is more fluid than the specification in Figma,
|
|
12
|
+
meaning that it adheres to the min and max sizes specified, but in viewports in-between in will be a
|
|
13
|
+
ratio to the viewport with rather than a fixed size.
|
|
14
|
+
|
|
15
|
+
### Showcase
|
|
16
|
+
|
|
17
|
+
<Primary />
|
|
18
|
+
|
|
19
|
+
### Properties
|
|
20
|
+
|
|
21
|
+
<ArgTypes />
|
|
22
|
+
|
|
23
|
+
### Installation
|
|
24
|
+
|
|
25
|
+
#### Via NPM
|
|
26
|
+
|
|
27
|
+
Add the dependency to your consumer app like `"@purpurds/heading": "x.y.z"`
|
|
28
|
+
|
|
29
|
+
#### From outside the monorepo (build-time)
|
|
30
|
+
|
|
31
|
+
To install this package, you need to setup access to the artifactory. [Click here to go to the guide on how to do that](https://github.com/telia-company/jfrog-documentation/blob/main/doc/JFrog/JFrog_Onboarding.md#getting-access-to-artifactory-and-other-jfrog-applications).
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
In MyApp.tsx
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import "@purpurds/tokens/index.css";
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
and
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import "@purpurds/heading/styles";
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
In MyComponent.tsx
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
import { Heading } from "@purpurds/heading";
|
|
51
|
+
|
|
52
|
+
export const MyComponent = () => {
|
|
53
|
+
return (
|
|
54
|
+
<div>
|
|
55
|
+
<Heading {...someProps}>Some content</Heading>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
```
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
@mixin purpur-subsection-100() {
|
|
2
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
3
|
+
sans-serif;
|
|
4
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
5
|
+
font-size: var(--purpur-typography-scale-100);
|
|
6
|
+
line-height: var(--purpur-typography-line-height-default);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@mixin purpur-title-100() {
|
|
10
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
11
|
+
sans-serif;
|
|
12
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
13
|
+
font-size: clamp(var(--purpur-typography-scale-100), 3vw, var(--purpur-typography-scale-200));
|
|
14
|
+
line-height: var(--purpur-typography-line-height-default);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@mixin purpur-title-200() {
|
|
18
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
19
|
+
sans-serif;
|
|
20
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
21
|
+
font-size: clamp(var(--purpur-typography-scale-200), 3vw, var(--purpur-typography-scale-400));
|
|
22
|
+
line-height: var(--purpur-typography-line-height-default);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@mixin purpur-title-300() {
|
|
26
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
27
|
+
sans-serif;
|
|
28
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
29
|
+
font-size: clamp(var(--purpur-typography-scale-400), 3vw, var(--purpur-typography-scale-600));
|
|
30
|
+
line-height: var(--purpur-typography-line-height-default);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@mixin purpur-title-400() {
|
|
34
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
35
|
+
sans-serif;
|
|
36
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
37
|
+
font-size: clamp(var(--purpur-typography-scale-500), 3vw, var(--purpur-typography-scale-700));
|
|
38
|
+
line-height: var(--purpur-typography-line-height-default);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@mixin purpur-title-500() {
|
|
42
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
43
|
+
sans-serif;
|
|
44
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
45
|
+
font-size: clamp(var(--purpur-typography-scale-500), 3vw, var(--purpur-typography-scale-800));
|
|
46
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@mixin purpur-title-600() {
|
|
50
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
51
|
+
sans-serif;
|
|
52
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
53
|
+
font-size: clamp(var(--purpur-typography-scale-650), 3vw, var(--purpur-typography-scale-850));
|
|
54
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@mixin purpur-title-700() {
|
|
58
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
59
|
+
sans-serif;
|
|
60
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
61
|
+
font-size: clamp(var(--purpur-typography-scale-700), 3vw, var(--purpur-typography-scale-900));
|
|
62
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@mixin purpur-display-25() {
|
|
66
|
+
font-family: var(--purpur-typography-family-display), Helvetica, Arial, "Lucida Grande",
|
|
67
|
+
sans-serif;
|
|
68
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
69
|
+
font-size: clamp(var(--purpur-typography-scale-600), 3vw, var(--purpur-typography-scale-800));
|
|
70
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@mixin purpur-display-50() {
|
|
74
|
+
font-family: var(--purpur-typography-family-display), Helvetica, Arial, "Lucida Grande",
|
|
75
|
+
sans-serif;
|
|
76
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
77
|
+
font-size: clamp(var(--purpur-typography-scale-650), 3vw, var(--purpur-typography-scale-850));
|
|
78
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@mixin purpur-display-100() {
|
|
82
|
+
font-family: var(--purpur-typography-family-display), Helvetica, Arial, "Lucida Grande",
|
|
83
|
+
sans-serif;
|
|
84
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
85
|
+
font-size: clamp(var(--purpur-typography-scale-700), 3vw, var(--purpur-typography-scale-900));
|
|
86
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@mixin purpur-display-200() {
|
|
90
|
+
font-family: var(--purpur-typography-family-display), Helvetica, Arial, "Lucida Grande",
|
|
91
|
+
sans-serif;
|
|
92
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
93
|
+
font-size: clamp(var(--purpur-typography-scale-800), 3vw, var(--purpur-typography-scale-1000));
|
|
94
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
95
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@import "./heading.mixins";
|
|
2
|
+
|
|
3
|
+
.purpur-heading {
|
|
4
|
+
color: var(--purpur-color-text-default);
|
|
5
|
+
display: block;
|
|
6
|
+
hyphens: none;
|
|
7
|
+
margin: 0;
|
|
8
|
+
max-width: 60ch;
|
|
9
|
+
|
|
10
|
+
&--hyphens {
|
|
11
|
+
hyphens: auto;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&--subsection-100 {
|
|
15
|
+
@include purpur-subsection-100;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--title-100 {
|
|
19
|
+
@include purpur-title-100;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--title-200 {
|
|
23
|
+
@include purpur-title-200;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--title-300 {
|
|
27
|
+
@include purpur-title-300;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
&--title-400 {
|
|
31
|
+
@include purpur-title-400;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&--title-500 {
|
|
35
|
+
@include purpur-title-500;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&--title-600 {
|
|
39
|
+
@include purpur-title-600;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--title-700 {
|
|
43
|
+
@include purpur-title-700;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&--display-25 {
|
|
47
|
+
@include purpur-display-25;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&--display-50 {
|
|
51
|
+
@include purpur-display-50;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&--display-100 {
|
|
55
|
+
@include purpur-display-100;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&--display-200 {
|
|
59
|
+
@include purpur-display-200;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { DisplayVariant, Heading, HeadingTag, TitleVariant } from "./heading";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Heading> = {
|
|
6
|
+
title: "Components/Heading",
|
|
7
|
+
component: Heading,
|
|
8
|
+
parameters: {
|
|
9
|
+
design: [
|
|
10
|
+
{
|
|
11
|
+
name: "Heading",
|
|
12
|
+
type: "figma",
|
|
13
|
+
url:
|
|
14
|
+
"https://www.figma.com/file/2QIcZVqP99ZKY4rNW7VuSx/Purpur-DS---Foundations-Library?type=design&node-id=5704%3A1581&mode=design&t=JZyDcq4SLtP80IvN-1",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
argTypes: {
|
|
19
|
+
variant: {
|
|
20
|
+
options: [...Object.values(TitleVariant), ...Object.values(DisplayVariant)],
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
},
|
|
23
|
+
tag: {
|
|
24
|
+
options: Object.values(HeadingTag),
|
|
25
|
+
control: { type: "select" },
|
|
26
|
+
},
|
|
27
|
+
enableHyphenation: {
|
|
28
|
+
defaultValue: false,
|
|
29
|
+
control: { type: "boolean" },
|
|
30
|
+
},
|
|
31
|
+
["data-testid"]: { control: { type: "text" } },
|
|
32
|
+
className: { control: { type: "text" } },
|
|
33
|
+
children: { control: { type: "text" } },
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<typeof Heading>;
|
|
39
|
+
|
|
40
|
+
export const Showcase: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
variant: TitleVariant.TITLE100,
|
|
43
|
+
tag: HeadingTag.H1,
|
|
44
|
+
children: "The quick brown fox jumps over the lazy dog",
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as matchers from "@testing-library/jest-dom/matchers";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
import { Heading } from "./heading";
|
|
7
|
+
|
|
8
|
+
expect.extend(matchers);
|
|
9
|
+
|
|
10
|
+
describe("Heading", () => {
|
|
11
|
+
it("should accept children text content", () => {
|
|
12
|
+
render(
|
|
13
|
+
<Heading data-testid="first-paragraph" variant="title-100" tag="h2">
|
|
14
|
+
Some text content
|
|
15
|
+
</Heading>
|
|
16
|
+
);
|
|
17
|
+
expect(screen.getByTestId("first-paragraph")).toHaveTextContent("Some text content");
|
|
18
|
+
});
|
|
19
|
+
it("default variant value should be title-100", () => {
|
|
20
|
+
render(
|
|
21
|
+
<Heading data-testid="second-paragraph" tag="h2">
|
|
22
|
+
Some text content
|
|
23
|
+
</Heading>
|
|
24
|
+
);
|
|
25
|
+
expect(screen.getByTestId("second-paragraph")).toHaveClass("purpur-heading--title-100");
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/heading.tsx
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactNode } from "react";
|
|
2
|
+
import c from "classnames";
|
|
3
|
+
|
|
4
|
+
import styles from "./heading.module.scss";
|
|
5
|
+
|
|
6
|
+
export const HeadingTag = {
|
|
7
|
+
H1: "h1",
|
|
8
|
+
H2: "h2",
|
|
9
|
+
H3: "h3",
|
|
10
|
+
H4: "h4",
|
|
11
|
+
H5: "h5",
|
|
12
|
+
H6: "h6",
|
|
13
|
+
} as const;
|
|
14
|
+
|
|
15
|
+
export type HeadingTagType = (typeof HeadingTag)[keyof typeof HeadingTag];
|
|
16
|
+
|
|
17
|
+
export const TitleVariant = {
|
|
18
|
+
TITLE100: "title-100",
|
|
19
|
+
TITLE200: "title-200",
|
|
20
|
+
TITLE300: "title-300",
|
|
21
|
+
TITLE400: "title-400",
|
|
22
|
+
TITLE500: "title-500",
|
|
23
|
+
TITLE600: "title-600",
|
|
24
|
+
TITLE700: "title-700",
|
|
25
|
+
SUBSECTION100: "subsection-100",
|
|
26
|
+
} as const;
|
|
27
|
+
|
|
28
|
+
export type TitleVariantType = (typeof TitleVariant)[keyof typeof TitleVariant];
|
|
29
|
+
|
|
30
|
+
export const DisplayVariant = {
|
|
31
|
+
DISPLAY25: "display-25",
|
|
32
|
+
DISPLAY50: "display-50",
|
|
33
|
+
DISPLAY100: "display-100",
|
|
34
|
+
DISPLAY200: "display-200",
|
|
35
|
+
} as const;
|
|
36
|
+
|
|
37
|
+
export type DisplayVariantType = (typeof DisplayVariant)[keyof typeof DisplayVariant];
|
|
38
|
+
|
|
39
|
+
export type HeadingProps = ComponentProps<HeadingTagType> & {
|
|
40
|
+
["data-testid"]?: string;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
enableHyphenation?: boolean;
|
|
44
|
+
tag: HeadingTagType;
|
|
45
|
+
variant?: TitleVariantType | DisplayVariantType;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const rootClassName = "purpur-heading";
|
|
49
|
+
|
|
50
|
+
export const Heading = ({
|
|
51
|
+
["data-testid"]: dataTestid,
|
|
52
|
+
children,
|
|
53
|
+
className = "",
|
|
54
|
+
enableHyphenation = false,
|
|
55
|
+
tag,
|
|
56
|
+
variant = TitleVariant.TITLE100,
|
|
57
|
+
...props
|
|
58
|
+
}: HeadingProps) => {
|
|
59
|
+
const Tag = tag;
|
|
60
|
+
const classes = c([
|
|
61
|
+
className,
|
|
62
|
+
styles[rootClassName],
|
|
63
|
+
styles[`${rootClassName}--${variant}`],
|
|
64
|
+
{
|
|
65
|
+
[styles[`${rootClassName}--hyphens`]]: enableHyphenation,
|
|
66
|
+
},
|
|
67
|
+
]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<Tag {...props} className={classes} data-testid={dataTestid}>
|
|
71
|
+
{children}
|
|
72
|
+
</Tag>
|
|
73
|
+
);
|
|
74
|
+
};
|