@purpurds/paragraph 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/paragraph.cjs.js +6 -0
- package/dist/paragraph.cjs.js.map +1 -0
- package/dist/paragraph.d.ts +24 -0
- package/dist/paragraph.d.ts.map +1 -0
- package/dist/paragraph.es.js +91 -0
- package/dist/paragraph.es.js.map +1 -0
- package/dist/paragraph.system.js +6 -0
- package/dist/paragraph.system.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +60 -0
- package/readme.mdx +81 -0
- package/src/global.d.ts +4 -0
- package/src/paragraph.mixins.scss +72 -0
- package/src/paragraph.module.scss +56 -0
- package/src/paragraph.stories.tsx +42 -0
- package/src/paragraph.test.tsx +23 -0
- package/src/paragraph.tsx +56 -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 g=require("react/jsx-runtime");function _(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var o={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(p){(function(){var s={}.hasOwnProperty;function u(){for(var r="",a=0;a<arguments.length;a++){var e=arguments[a];e&&(r=t(r,i(e)))}return r}function i(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return u.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var e in r)s.call(r,e)&&r[e]&&(a=t(a,e));return a}function t(r,a){return a?r?r+" "+a:r+a:r}p.exports?(u.default=u,p.exports=u):window.classNames=u})()})(o);var d=o.exports;const c=_(d),n={"purpur-paragraph":"_purpur-paragraph_hwaj6_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_hwaj6_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_hwaj6_10","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_hwaj6_13","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_hwaj6_19","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_hwaj6_26","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_hwaj6_33","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_hwaj6_39","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_hwaj6_45","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_hwaj6_51","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_hwaj6_57","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_hwaj6_64","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_hwaj6_71"},l={PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"},h="purpur-paragraph",m=({["data-testid"]:p,children:s,className:u="",disabled:i,enableHyphenation:t=!1,variant:r=l.PARAGRAPH100,...a})=>{const e=c([u,n[h],n[`${h}--${r}`],{[n[`${h}--hyphens`]]:t,[n[`${h}--disabled`]]:i}]);return g.jsx("p",{...a,className:e,"data-testid":p,children:s})};exports.Paragraph=m;exports.ParagraphVariant=l;
|
|
6
|
+
//# sourceMappingURL=paragraph.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paragraph.cjs.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/paragraph.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, { ParamHTMLAttributes, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./paragraph.module.scss\";\n\nexport const ParagraphVariant = {\n PARAGRAPH100: \"paragraph-100\",\n PARAGRAPH100MEDIUM: \"paragraph-100-medium\",\n PARAGRAPH100BOLD: \"paragraph-100-bold\",\n PARAGRAPH200: \"paragraph-200\",\n PREAMBLE100: \"preamble-100\",\n PREAMBLE200: \"preamble-200\",\n ADDITIONAL100: \"additional-100\",\n ADDITIONAL100MEDIUM: \"additional-100-medium\",\n OVERLINE100: \"overline-100\",\n OVERLINE200: \"overline-200\",\n} as const;\n\nexport type ParagraphVariant = (typeof ParagraphVariant)[keyof typeof ParagraphVariant];\n\nexport type ParagraphProps = ParamHTMLAttributes<HTMLParagraphElement> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n disabled?: boolean;\n variant?: ParagraphVariant;\n};\n\nconst rootClassName = \"purpur-paragraph\";\n\nexport const Paragraph = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n disabled,\n enableHyphenation = false,\n variant = ParagraphVariant.PARAGRAPH100,\n ...props\n}: ParagraphProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n [styles[`${rootClassName}--disabled`]]: disabled,\n },\n ]);\n\n return (\n <p {...props} className={classes} data-testid={dataTestid}>\n {children}\n </p>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","ParagraphVariant","rootClassName","Paragraph","dataTestid","children","className","disabled","enableHyphenation","variant","props","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,6gCCvEaU,EAAmB,CAC9B,aAAc,gBACd,mBAAoB,uBACpB,iBAAkB,qBAClB,aAAc,gBACd,YAAa,eACb,YAAa,eACb,cAAe,iBACf,oBAAqB,wBACrB,YAAa,eACb,YAAa,cACf,EAaMC,EAAgB,mBAETC,EAAY,CAAC,CACxB,CAAC,eAAgBC,EACjB,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EACA,kBAAAC,EAAoB,GACpB,QAAAC,EAAUR,EAAiB,aAC3B,GAAGS,CACL,IAAsB,CACpB,MAAMlB,EAAU,EAAE,CAChBc,EACAK,EAAOT,CAAa,EACpBS,EAAO,GAAGT,CAAa,KAAKO,CAAO,EAAE,EACrC,CACE,CAACE,EAAO,GAAGT,CAAa,WAAW,CAAC,EAAGM,EACvC,CAACG,EAAO,GAAGT,CAAa,YAAY,CAAC,EAAGK,CAC1C,CAAA,CACD,EAGC,OAAAK,MAAC,KAAG,GAAGF,EAAO,UAAWlB,EAAS,cAAaY,EAC5C,SAAAC,CACH,CAAA,CAEJ","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { ParamHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
export declare const ParagraphVariant: {
|
|
3
|
+
readonly PARAGRAPH100: "paragraph-100";
|
|
4
|
+
readonly PARAGRAPH100MEDIUM: "paragraph-100-medium";
|
|
5
|
+
readonly PARAGRAPH100BOLD: "paragraph-100-bold";
|
|
6
|
+
readonly PARAGRAPH200: "paragraph-200";
|
|
7
|
+
readonly PREAMBLE100: "preamble-100";
|
|
8
|
+
readonly PREAMBLE200: "preamble-200";
|
|
9
|
+
readonly ADDITIONAL100: "additional-100";
|
|
10
|
+
readonly ADDITIONAL100MEDIUM: "additional-100-medium";
|
|
11
|
+
readonly OVERLINE100: "overline-100";
|
|
12
|
+
readonly OVERLINE200: "overline-200";
|
|
13
|
+
};
|
|
14
|
+
export type ParagraphVariant = (typeof ParagraphVariant)[keyof typeof ParagraphVariant];
|
|
15
|
+
export type ParagraphProps = ParamHTMLAttributes<HTMLParagraphElement> & {
|
|
16
|
+
["data-testid"]?: string;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
enableHyphenation?: boolean;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
variant?: ParagraphVariant;
|
|
22
|
+
};
|
|
23
|
+
export declare const Paragraph: ({ ["data-testid"]: dataTestid, children, className, disabled, enableHyphenation, variant, ...props }: ParagraphProps) => React.JSX.Element;
|
|
24
|
+
//# sourceMappingURL=paragraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paragraph.d.ts","sourceRoot":"","sources":["../src/paragraph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAK9D,eAAO,MAAM,gBAAgB;;;;;;;;;;;CAWnB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC,oBAAoB,CAAC,GAAG;IACvE,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,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAIF,eAAO,MAAM,SAAS,yGAQnB,cAAc,sBAgBhB,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
function _(p) {
|
|
3
|
+
return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
|
|
4
|
+
}
|
|
5
|
+
var i = { 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(p) {
|
|
12
|
+
(function() {
|
|
13
|
+
var o = {}.hasOwnProperty;
|
|
14
|
+
function u() {
|
|
15
|
+
for (var r = "", a = 0; a < arguments.length; a++) {
|
|
16
|
+
var e = arguments[a];
|
|
17
|
+
e && (r = t(r, s(e)));
|
|
18
|
+
}
|
|
19
|
+
return r;
|
|
20
|
+
}
|
|
21
|
+
function s(r) {
|
|
22
|
+
if (typeof r == "string" || typeof r == "number")
|
|
23
|
+
return r;
|
|
24
|
+
if (typeof r != "object")
|
|
25
|
+
return "";
|
|
26
|
+
if (Array.isArray(r))
|
|
27
|
+
return u.apply(null, r);
|
|
28
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
29
|
+
return r.toString();
|
|
30
|
+
var a = "";
|
|
31
|
+
for (var e in r)
|
|
32
|
+
o.call(r, e) && r[e] && (a = t(a, e));
|
|
33
|
+
return a;
|
|
34
|
+
}
|
|
35
|
+
function t(r, a) {
|
|
36
|
+
return a ? r ? r + " " + a : r + a : r;
|
|
37
|
+
}
|
|
38
|
+
p.exports ? (u.default = u, p.exports = u) : window.classNames = u;
|
|
39
|
+
})();
|
|
40
|
+
})(i);
|
|
41
|
+
var g = i.exports;
|
|
42
|
+
const d = /* @__PURE__ */ _(g), h = {
|
|
43
|
+
"purpur-paragraph": "_purpur-paragraph_hwaj6_1",
|
|
44
|
+
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_hwaj6_7",
|
|
45
|
+
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_hwaj6_10",
|
|
46
|
+
"purpur-paragraph--paragraph-100": "_purpur-paragraph--paragraph-100_hwaj6_13",
|
|
47
|
+
"purpur-paragraph--paragraph-100-medium": "_purpur-paragraph--paragraph-100-medium_hwaj6_19",
|
|
48
|
+
"purpur-paragraph--paragraph-100-bold": "_purpur-paragraph--paragraph-100-bold_hwaj6_26",
|
|
49
|
+
"purpur-paragraph--paragraph-200": "_purpur-paragraph--paragraph-200_hwaj6_33",
|
|
50
|
+
"purpur-paragraph--preamble-100": "_purpur-paragraph--preamble-100_hwaj6_39",
|
|
51
|
+
"purpur-paragraph--preamble-200": "_purpur-paragraph--preamble-200_hwaj6_45",
|
|
52
|
+
"purpur-paragraph--additional-100": "_purpur-paragraph--additional-100_hwaj6_51",
|
|
53
|
+
"purpur-paragraph--additional-100-medium": "_purpur-paragraph--additional-100-medium_hwaj6_57",
|
|
54
|
+
"purpur-paragraph--overline-100": "_purpur-paragraph--overline-100_hwaj6_64",
|
|
55
|
+
"purpur-paragraph--overline-200": "_purpur-paragraph--overline-200_hwaj6_71"
|
|
56
|
+
}, m = {
|
|
57
|
+
PARAGRAPH100: "paragraph-100",
|
|
58
|
+
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
59
|
+
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
60
|
+
PARAGRAPH200: "paragraph-200",
|
|
61
|
+
PREAMBLE100: "preamble-100",
|
|
62
|
+
PREAMBLE200: "preamble-200",
|
|
63
|
+
ADDITIONAL100: "additional-100",
|
|
64
|
+
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
65
|
+
OVERLINE100: "overline-100",
|
|
66
|
+
OVERLINE200: "overline-200"
|
|
67
|
+
}, n = "purpur-paragraph", f = ({
|
|
68
|
+
["data-testid"]: p,
|
|
69
|
+
children: o,
|
|
70
|
+
className: u = "",
|
|
71
|
+
disabled: s,
|
|
72
|
+
enableHyphenation: t = !1,
|
|
73
|
+
variant: r = m.PARAGRAPH100,
|
|
74
|
+
...a
|
|
75
|
+
}) => {
|
|
76
|
+
const e = d([
|
|
77
|
+
u,
|
|
78
|
+
h[n],
|
|
79
|
+
h[`${n}--${r}`],
|
|
80
|
+
{
|
|
81
|
+
[h[`${n}--hyphens`]]: t,
|
|
82
|
+
[h[`${n}--disabled`]]: s
|
|
83
|
+
}
|
|
84
|
+
]);
|
|
85
|
+
return /* @__PURE__ */ l("p", { ...a, className: e, "data-testid": p, children: o });
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
f as Paragraph,
|
|
89
|
+
m as ParagraphVariant
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=paragraph.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paragraph.es.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/paragraph.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, { ParamHTMLAttributes, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./paragraph.module.scss\";\n\nexport const ParagraphVariant = {\n PARAGRAPH100: \"paragraph-100\",\n PARAGRAPH100MEDIUM: \"paragraph-100-medium\",\n PARAGRAPH100BOLD: \"paragraph-100-bold\",\n PARAGRAPH200: \"paragraph-200\",\n PREAMBLE100: \"preamble-100\",\n PREAMBLE200: \"preamble-200\",\n ADDITIONAL100: \"additional-100\",\n ADDITIONAL100MEDIUM: \"additional-100-medium\",\n OVERLINE100: \"overline-100\",\n OVERLINE200: \"overline-200\",\n} as const;\n\nexport type ParagraphVariant = (typeof ParagraphVariant)[keyof typeof ParagraphVariant];\n\nexport type ParagraphProps = ParamHTMLAttributes<HTMLParagraphElement> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n disabled?: boolean;\n variant?: ParagraphVariant;\n};\n\nconst rootClassName = \"purpur-paragraph\";\n\nexport const Paragraph = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n disabled,\n enableHyphenation = false,\n variant = ParagraphVariant.PARAGRAPH100,\n ...props\n}: ParagraphProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n [styles[`${rootClassName}--disabled`]]: disabled,\n },\n ]);\n\n return (\n <p {...props} className={classes} data-testid={dataTestid}>\n {children}\n </p>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","ParagraphVariant","rootClassName","Paragraph","dataTestid","children","className","disabled","enableHyphenation","variant","props","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,IAAmB;AAAA,EAC9B,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,eAAe;AAAA,EACf,qBAAqB;AAAA,EACrB,aAAa;AAAA,EACb,aAAa;AACf,GAaMC,IAAgB,oBAETC,IAAY,CAAC;AAAA,EACxB,CAAC,gBAAgBC;AAAA,EACjB,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,mBAAAC,IAAoB;AAAA,EACpB,SAAAC,IAAUR,EAAiB;AAAA,EAC3B,GAAGS;AACL,MAAsB;AACpB,QAAMlB,IAAUmB,EAAE;AAAA,IAChBL;AAAA,IACAM,EAAOV,CAAa;AAAA,IACpBU,EAAO,GAAGV,CAAa,KAAKO,CAAO,EAAE;AAAA,IACrC;AAAA,MACE,CAACG,EAAO,GAAGV,CAAa,WAAW,CAAC,GAAGM;AAAA,MACvC,CAACI,EAAO,GAAGV,CAAa,YAAY,CAAC,GAAGK;AAAA,IAC1C;AAAA,EAAA,CACD;AAGC,SAAA,gBAAAM,EAAC,OAAG,GAAGH,GAAO,WAAWlB,GAAS,eAAaY,GAC5C,UAAAC,EACH,CAAA;AAEJ;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
System.register(["react"],function(l,f){"use strict";var g;return{setters:[s=>{g=s.default}],execute:function(){function s(p){return p&&p.__esModule&&Object.prototype.hasOwnProperty.call(p,"default")?p.default:p}var _={exports:{}};/*!
|
|
2
|
+
Copyright (c) 2018 Jed Watson.
|
|
3
|
+
Licensed under the MIT License (MIT), see
|
|
4
|
+
http://jedwatson.github.io/classnames
|
|
5
|
+
*/(function(p){(function(){var i={}.hasOwnProperty;function t(){for(var r="",a=0;a<arguments.length;a++){var e=arguments[a];e&&(r=h(r,o(e)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return t.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var a="";for(var e in r)i.call(r,e)&&r[e]&&(a=h(a,e));return a}function h(r,a){return a?r?r+" "+a:r+a:r}p.exports?(t.default=t,p.exports=t):window.classNames=t})()})(_);var d=_.exports;const c=s(d),u={"purpur-paragraph":"_purpur-paragraph_hwaj6_1","purpur-paragraph--disabled":"_purpur-paragraph--disabled_hwaj6_7","purpur-paragraph--hyphens":"_purpur-paragraph--hyphens_hwaj6_10","purpur-paragraph--paragraph-100":"_purpur-paragraph--paragraph-100_hwaj6_13","purpur-paragraph--paragraph-100-medium":"_purpur-paragraph--paragraph-100-medium_hwaj6_19","purpur-paragraph--paragraph-100-bold":"_purpur-paragraph--paragraph-100-bold_hwaj6_26","purpur-paragraph--paragraph-200":"_purpur-paragraph--paragraph-200_hwaj6_33","purpur-paragraph--preamble-100":"_purpur-paragraph--preamble-100_hwaj6_39","purpur-paragraph--preamble-200":"_purpur-paragraph--preamble-200_hwaj6_45","purpur-paragraph--additional-100":"_purpur-paragraph--additional-100_hwaj6_51","purpur-paragraph--additional-100-medium":"_purpur-paragraph--additional-100-medium_hwaj6_57","purpur-paragraph--overline-100":"_purpur-paragraph--overline-100_hwaj6_64","purpur-paragraph--overline-200":"_purpur-paragraph--overline-200_hwaj6_71"},m=l("ParagraphVariant",{PARAGRAPH100:"paragraph-100",PARAGRAPH100MEDIUM:"paragraph-100-medium",PARAGRAPH100BOLD:"paragraph-100-bold",PARAGRAPH200:"paragraph-200",PREAMBLE100:"preamble-100",PREAMBLE200:"preamble-200",ADDITIONAL100:"additional-100",ADDITIONAL100MEDIUM:"additional-100-medium",OVERLINE100:"overline-100",OVERLINE200:"overline-200"}),n="purpur-paragraph",A=l("Paragraph",({["data-testid"]:p,children:i,className:t="",disabled:o,enableHyphenation:h=!1,variant:r=m.PARAGRAPH100,...a})=>{const e=c([t,u[n],u[`${n}--${r}`],{[u[`${n}--hyphens`]]:h,[u[`${n}--disabled`]]:o}]);return g.createElement("p",{...a,className:e,"data-testid":p},i)})}}});
|
|
6
|
+
//# sourceMappingURL=paragraph.system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paragraph.system.js","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js","../src/paragraph.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, { ParamHTMLAttributes, ReactNode } from \"react\";\nimport c from \"classnames\";\n\nimport styles from \"./paragraph.module.scss\";\n\nexport const ParagraphVariant = {\n PARAGRAPH100: \"paragraph-100\",\n PARAGRAPH100MEDIUM: \"paragraph-100-medium\",\n PARAGRAPH100BOLD: \"paragraph-100-bold\",\n PARAGRAPH200: \"paragraph-200\",\n PREAMBLE100: \"preamble-100\",\n PREAMBLE200: \"preamble-200\",\n ADDITIONAL100: \"additional-100\",\n ADDITIONAL100MEDIUM: \"additional-100-medium\",\n OVERLINE100: \"overline-100\",\n OVERLINE200: \"overline-200\",\n} as const;\n\nexport type ParagraphVariant = (typeof ParagraphVariant)[keyof typeof ParagraphVariant];\n\nexport type ParagraphProps = ParamHTMLAttributes<HTMLParagraphElement> & {\n [\"data-testid\"]?: string;\n children: ReactNode;\n className?: string;\n enableHyphenation?: boolean;\n disabled?: boolean;\n variant?: ParagraphVariant;\n};\n\nconst rootClassName = \"purpur-paragraph\";\n\nexport const Paragraph = ({\n [\"data-testid\"]: dataTestid,\n children,\n className = \"\",\n disabled,\n enableHyphenation = false,\n variant = ParagraphVariant.PARAGRAPH100,\n ...props\n}: ParagraphProps) => {\n const classes = c([\n className,\n styles[rootClassName],\n styles[`${rootClassName}--${variant}`],\n {\n [styles[`${rootClassName}--hyphens`]]: enableHyphenation,\n [styles[`${rootClassName}--disabled`]]: disabled,\n },\n ]);\n\n return (\n <p {...props} className={classes} data-testid={dataTestid}>\n {children}\n </p>\n );\n};\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","ParagraphVariant","exports","rootClassName","Paragraph","dataTestid","children","className","disabled","enableHyphenation","variant","props","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,6gCCvEaU,EAAmBC,EAAA,mBAAA,CAC9B,aAAc,gBACd,mBAAoB,uBACpB,iBAAkB,qBAClB,aAAc,gBACd,YAAa,eACb,YAAa,eACb,cAAe,iBACf,oBAAqB,wBACrB,YAAa,eACb,YAAa,cACf,CAAA,EAaMC,EAAgB,mBAETC,gBAAY,CAAC,CACxB,CAAC,eAAgBC,EACjB,SAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EACA,kBAAAC,EAAoB,GACpB,QAAAC,EAAUT,EAAiB,aAC3B,GAAGU,CACL,IAAsB,CACpB,MAAMnB,EAAU,EAAE,CAChBe,EACAK,EAAOT,CAAa,EACpBS,EAAO,GAAGT,CAAa,KAAKO,CAAO,EAAE,EACrC,CACE,CAACE,EAAO,GAAGT,CAAa,WAAW,CAAC,EAAGM,EACvC,CAACG,EAAO,GAAGT,CAAa,YAAY,CAAC,EAAGK,CAC1C,CAAA,CACD,EAGC,OAAAK,EAAA,cAAC,KAAG,GAAGF,EAAO,UAAWnB,EAAS,cAAaa,GAC5CC,CACH,CAEJ,CAAA","x_google_ignoreList":[0]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._purpur-paragraph_hwaj6_1{color:var(--purpur-color-text-default);display:block;margin:0;-webkit-hyphens:none;hyphens:none}._purpur-paragraph--disabled_hwaj6_7{color:var(--purpur-color-text-weak)}._purpur-paragraph--hyphens_hwaj6_10{-webkit-hyphens:auto;hyphens:auto}._purpur-paragraph--paragraph-100_hwaj6_13{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-loose)}._purpur-paragraph--paragraph-100-medium_hwaj6_19{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-loose);font-weight:var(--purpur-typography-weight-medium)}._purpur-paragraph--paragraph-100-bold_hwaj6_26{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-loose);font-weight:var(--purpur-typography-weight-bold)}._purpur-paragraph--paragraph-200_hwaj6_33{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-100);line-height:var(--purpur-typography-line-height-looser)}._purpur-paragraph--preamble-100_hwaj6_39{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-200);line-height:var(--purpur-typography-line-height-loose)}._purpur-paragraph--preamble-200_hwaj6_45{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:clamp(var(--purpur-typography-scale-150),3vw,var(--purpur-typography-scale-400));line-height:var(--purpur-typography-line-height-loose)}._purpur-paragraph--additional-100_hwaj6_51{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-75);line-height:var(--purpur-typography-line-height-loose)}._purpur-paragraph--additional-100-medium_hwaj6_57{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-weight:var(--purpur-typography-weight-normal);font-size:var(--purpur-typography-scale-75);line-height:var(--purpur-typography-line-height-loose);font-weight:var(--purpur-typography-weight-medium)}._purpur-paragraph--overline-100_hwaj6_64{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-size:var(--purpur-typography-scale-75);letter-spacing:var(--purpur-spacing-10);line-height:var(--purpur-typography-line-height-tight);text-transform:uppercase}._purpur-paragraph--overline-200_hwaj6_71{font-family:var(--purpur-typography-family-default),Helvetica,Arial,"Lucida Grande",sans-serif;font-size:clamp(var(--purpur-typography-scale-75),3vw,var(--purpur-typography-scale-100));letter-spacing:var(--purpur-spacing-10);line-height:var(--purpur-typography-line-height-tight);text-transform:uppercase}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@purpurds/paragraph",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"main": "./dist/paragraph.cjs.js",
|
|
6
|
+
"types": "./dist/paragraph.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"require": "./dist/paragraph.cjs.js",
|
|
10
|
+
"systemjs": "./dist/paragraph.system.js",
|
|
11
|
+
"types": "./dist/paragraph.d.ts",
|
|
12
|
+
"default": "./dist/paragraph.es.js"
|
|
13
|
+
},
|
|
14
|
+
"./styles": "./dist/styles.css",
|
|
15
|
+
"./src/paragraph.mixins.scss": "./src/paragraph.mixins.scss"
|
|
16
|
+
},
|
|
17
|
+
"source": "src/paragraph.tsx",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"classnames": "~2.5.0",
|
|
20
|
+
"@purpurds/tokens": "3.0.0"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@rushstack/eslint-patch": "~1.7.0",
|
|
24
|
+
"@storybook/blocks": "~7.6.0",
|
|
25
|
+
"@storybook/react": "~7.6.0",
|
|
26
|
+
"@telia/base-rig": "~8.2.0",
|
|
27
|
+
"@telia/react-rig": "~3.2.0",
|
|
28
|
+
"@testing-library/dom": "~9.3.3",
|
|
29
|
+
"@testing-library/jest-dom": "~6.3.0",
|
|
30
|
+
"@testing-library/react": "~14.1.2",
|
|
31
|
+
"@types/node": "18",
|
|
32
|
+
"@types/react-dom": "~18.2.17",
|
|
33
|
+
"@types/react": "~18.2.42",
|
|
34
|
+
"eslint-plugin-testing-library": "~6.2.0",
|
|
35
|
+
"eslint": "~8.56.0",
|
|
36
|
+
"jsdom": "~22.1.0",
|
|
37
|
+
"lint-staged": "~10.5.3",
|
|
38
|
+
"prettier": "~2.8.8",
|
|
39
|
+
"react-dom": "~18.2.0",
|
|
40
|
+
"react": "~18.2.0",
|
|
41
|
+
"typescript": "~5.2.2",
|
|
42
|
+
"vite": "~5.0.6",
|
|
43
|
+
"vitest": "~1.2.0",
|
|
44
|
+
"@purpurds/component-rig": "1.0.0"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build:dev": "vite",
|
|
48
|
+
"build:watch": "vite build --watch",
|
|
49
|
+
"build": "rm -rf dist && vite build && vite build --mode systemjs",
|
|
50
|
+
"ci:build": "rushx build",
|
|
51
|
+
"coverage": "vitest run --coverage",
|
|
52
|
+
"lint:fix": "eslint . --fix",
|
|
53
|
+
"lint": "lint-staged --no-stash 2>&1",
|
|
54
|
+
"sbdev": "rush sbdev",
|
|
55
|
+
"test:unit": "vitest run --passWithNoTests",
|
|
56
|
+
"test:watch": "vitest --watch",
|
|
57
|
+
"test": "rushx test:unit",
|
|
58
|
+
"typecheck": "tsc -p ./tsconfig.json"
|
|
59
|
+
}
|
|
60
|
+
}
|
package/readme.mdx
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Meta, Stories, ArgTypes, Primary, Subtitle } from "@storybook/blocks";
|
|
2
|
+
|
|
3
|
+
import * as ParagraphStories from "./src/paragraph.stories";
|
|
4
|
+
import packageInfo from "./package.json";
|
|
5
|
+
|
|
6
|
+
<Meta name="Docs" title="Components/Paragraph" of={ParagraphStories} />
|
|
7
|
+
|
|
8
|
+
# Paragraph
|
|
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
|
+
Create a block level element with text content styled as a paragraph.
|
|
16
|
+
|
|
17
|
+
- `paragraph-100` the default paragraph style for body texts
|
|
18
|
+
- `paragraph-200` has extended line height for long texts, e.g. blog or article texts
|
|
19
|
+
|
|
20
|
+
### Accessibility
|
|
21
|
+
|
|
22
|
+
Paragraphs make a page more accessible and physically separated from adjacent blocks through blank lines. Assistive technology supports shortcuts to navigate through next and previous paragraph. For more detailed accessibilty guidelines See [W3Cs information about p element](https://www.w3.org/TR/2010/WD-html5-20101019/grouping-content.html#the-p-element).
|
|
23
|
+
|
|
24
|
+
### Inline elements
|
|
25
|
+
|
|
26
|
+
Inline elements can be used inside paragraph to highlight a specific part of text. They add an effect on the text, for example bolding or italics, and for screen reader the pronounciation is be different. Tags marking an inline element can be placed inside the paragraph tags without breaking the flow of the content. The most commonly used inline elements are presented below.
|
|
27
|
+
|
|
28
|
+
| Element | Tag | Description |
|
|
29
|
+
| ------------------ | ---------- | -------------------------------------------------------------------------------- |
|
|
30
|
+
| Bring Attention To | `<b>` | Used to draw the reader's attention to the element's contents. |
|
|
31
|
+
| Citation | `<cite>` | Used to describe a reference to a cited creative work. |
|
|
32
|
+
| Emphasis | `<em>` | Marks text that has stress emphasis. |
|
|
33
|
+
| Idiomatic Text | `<i>` | Represents a range of text that is set off from the normal text for some reason. |
|
|
34
|
+
| Strong Importance | `<strong>` | Indicates that its contents have strong importance, seriousness, or urgency. |
|
|
35
|
+
| Time | `<time>` | Represents a specific period in time. |
|
|
36
|
+
|
|
37
|
+
### Showcase
|
|
38
|
+
|
|
39
|
+
<Primary />
|
|
40
|
+
|
|
41
|
+
### Properties
|
|
42
|
+
|
|
43
|
+
<ArgTypes />
|
|
44
|
+
|
|
45
|
+
### Installation
|
|
46
|
+
|
|
47
|
+
#### Via NPM
|
|
48
|
+
|
|
49
|
+
Add the dependency to your consumer app like `"@purpurds/paragraph": "x.y.z"`
|
|
50
|
+
|
|
51
|
+
#### From outside the monorepo (build-time)
|
|
52
|
+
|
|
53
|
+
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).
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
In MyApp.tsx
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import "@purpurds/tokens/index.css";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
and
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import "@purpurds/paragraph/styles";
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
In MyComponent.tsx
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { Paragraph } from "@purpurds/paragraph";
|
|
73
|
+
|
|
74
|
+
export const MyComponent = () => {
|
|
75
|
+
return (
|
|
76
|
+
<div>
|
|
77
|
+
<Paragraph {...someProps}>Some content</Paragraph>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
```
|
package/src/global.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@mixin purpur-paragraph-100() {
|
|
2
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
3
|
+
sans-serif;
|
|
4
|
+
font-weight: var(--purpur-typography-weight-normal);
|
|
5
|
+
font-size: var(--purpur-typography-scale-100);
|
|
6
|
+
line-height: var(--purpur-typography-line-height-loose);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
@mixin purpur-paragraph-100-medium() {
|
|
10
|
+
@include purpur-paragraph-100;
|
|
11
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@mixin purpur-paragraph-100-bold() {
|
|
15
|
+
@include purpur-paragraph-100;
|
|
16
|
+
font-weight: var(--purpur-typography-weight-bold);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@mixin purpur-paragraph-200() {
|
|
20
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
21
|
+
sans-serif;
|
|
22
|
+
font-weight: var(--purpur-typography-weight-normal);
|
|
23
|
+
font-size: var(--purpur-typography-scale-100);
|
|
24
|
+
line-height: var(--purpur-typography-line-height-looser);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@mixin purpur-preamble-100() {
|
|
28
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
29
|
+
sans-serif;
|
|
30
|
+
font-weight: var(--purpur-typography-weight-normal);
|
|
31
|
+
font-size: var(--purpur-typography-scale-200);
|
|
32
|
+
line-height: var(--purpur-typography-line-height-loose);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@mixin purpur-preamble-200() {
|
|
36
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
37
|
+
sans-serif;
|
|
38
|
+
font-weight: var(--purpur-typography-weight-normal);
|
|
39
|
+
font-size: clamp(var(--purpur-typography-scale-150), 3vw, var(--purpur-typography-scale-400));
|
|
40
|
+
line-height: var(--purpur-typography-line-height-loose);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@mixin purpur-additional-100() {
|
|
44
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
45
|
+
sans-serif;
|
|
46
|
+
font-weight: var(--purpur-typography-weight-normal);
|
|
47
|
+
font-size: var(--purpur-typography-scale-75);
|
|
48
|
+
line-height: var(--purpur-typography-line-height-loose);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin purpur-additional-100-medium() {
|
|
52
|
+
@include purpur-additional-100;
|
|
53
|
+
font-weight: var(--purpur-typography-weight-medium);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@mixin purpur-overline-100() {
|
|
57
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
58
|
+
sans-serif;
|
|
59
|
+
font-size: var(--purpur-typography-scale-75);
|
|
60
|
+
letter-spacing: var(--purpur-spacing-10);
|
|
61
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
62
|
+
text-transform: uppercase;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@mixin purpur-overline-200() {
|
|
66
|
+
font-family: var(--purpur-typography-family-default), Helvetica, Arial, "Lucida Grande",
|
|
67
|
+
sans-serif;
|
|
68
|
+
font-size: clamp(var(--purpur-typography-scale-75), 3vw, var(--purpur-typography-scale-100));
|
|
69
|
+
letter-spacing: var(--purpur-spacing-10);
|
|
70
|
+
line-height: var(--purpur-typography-line-height-tight);
|
|
71
|
+
text-transform: uppercase;
|
|
72
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
@import "./paragraph.mixins";
|
|
2
|
+
|
|
3
|
+
.purpur-paragraph {
|
|
4
|
+
color: var(--purpur-color-text-default);
|
|
5
|
+
display: block;
|
|
6
|
+
margin: 0;
|
|
7
|
+
hyphens: none;
|
|
8
|
+
|
|
9
|
+
&--disabled {
|
|
10
|
+
color: var(--purpur-color-text-weak);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&--hyphens {
|
|
14
|
+
hyphens: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&--paragraph-100 {
|
|
18
|
+
@include purpur-paragraph-100;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--paragraph-100-medium {
|
|
22
|
+
@include purpur-paragraph-100-medium;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&--paragraph-100-bold {
|
|
26
|
+
@include purpur-paragraph-100-bold;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&--paragraph-200 {
|
|
30
|
+
@include purpur-paragraph-200;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&--preamble-100 {
|
|
34
|
+
@include purpur-preamble-100;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--preamble-200 {
|
|
38
|
+
@include purpur-preamble-200;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&--additional-100 {
|
|
42
|
+
@include purpur-additional-100;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--additional-100-medium {
|
|
46
|
+
@include purpur-additional-100-medium;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&--overline-100 {
|
|
50
|
+
@include purpur-overline-100;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&--overline-200 {
|
|
54
|
+
@include purpur-overline-200;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
import { Paragraph, ParagraphVariant } from "./paragraph";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Paragraph> = {
|
|
6
|
+
title: "Components/Paragraph",
|
|
7
|
+
component: Paragraph,
|
|
8
|
+
parameters: {
|
|
9
|
+
design: [
|
|
10
|
+
{
|
|
11
|
+
name: "Paragraph",
|
|
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(ParagraphVariant),
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
},
|
|
23
|
+
enableHyphenation: {
|
|
24
|
+
control: { type: "boolean" },
|
|
25
|
+
},
|
|
26
|
+
disabled: {
|
|
27
|
+
control: { type: "boolean" },
|
|
28
|
+
},
|
|
29
|
+
["data-testid"]: { control: { type: "text" } },
|
|
30
|
+
className: { control: { type: "text" } },
|
|
31
|
+
children: { control: { type: "text" } },
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export default meta;
|
|
35
|
+
type Story = StoryObj<typeof Paragraph>;
|
|
36
|
+
|
|
37
|
+
export const Showcase: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
variant: ParagraphVariant.PARAGRAPH100,
|
|
40
|
+
children: "The quick brown fox jumps over the lazy dog",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
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 { Paragraph } from "./paragraph";
|
|
7
|
+
|
|
8
|
+
expect.extend(matchers);
|
|
9
|
+
|
|
10
|
+
describe("Paragraph", () => {
|
|
11
|
+
it("should accept children text content", () => {
|
|
12
|
+
render(
|
|
13
|
+
<Paragraph data-testid="first-paragraph" variant="paragraph-100">
|
|
14
|
+
Some text content
|
|
15
|
+
</Paragraph>
|
|
16
|
+
);
|
|
17
|
+
expect(screen.getByTestId("first-paragraph")).toHaveTextContent("Some text content");
|
|
18
|
+
});
|
|
19
|
+
it("default variant value should be paragraph-100", () => {
|
|
20
|
+
render(<Paragraph data-testid="second-paragraph">Some text content</Paragraph>);
|
|
21
|
+
expect(screen.getByTestId("second-paragraph")).toHaveClass("purpur-paragraph--paragraph-100");
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { ParamHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import c from "classnames";
|
|
3
|
+
|
|
4
|
+
import styles from "./paragraph.module.scss";
|
|
5
|
+
|
|
6
|
+
export const ParagraphVariant = {
|
|
7
|
+
PARAGRAPH100: "paragraph-100",
|
|
8
|
+
PARAGRAPH100MEDIUM: "paragraph-100-medium",
|
|
9
|
+
PARAGRAPH100BOLD: "paragraph-100-bold",
|
|
10
|
+
PARAGRAPH200: "paragraph-200",
|
|
11
|
+
PREAMBLE100: "preamble-100",
|
|
12
|
+
PREAMBLE200: "preamble-200",
|
|
13
|
+
ADDITIONAL100: "additional-100",
|
|
14
|
+
ADDITIONAL100MEDIUM: "additional-100-medium",
|
|
15
|
+
OVERLINE100: "overline-100",
|
|
16
|
+
OVERLINE200: "overline-200",
|
|
17
|
+
} as const;
|
|
18
|
+
|
|
19
|
+
export type ParagraphVariant = (typeof ParagraphVariant)[keyof typeof ParagraphVariant];
|
|
20
|
+
|
|
21
|
+
export type ParagraphProps = ParamHTMLAttributes<HTMLParagraphElement> & {
|
|
22
|
+
["data-testid"]?: string;
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
className?: string;
|
|
25
|
+
enableHyphenation?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
variant?: ParagraphVariant;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const rootClassName = "purpur-paragraph";
|
|
31
|
+
|
|
32
|
+
export const Paragraph = ({
|
|
33
|
+
["data-testid"]: dataTestid,
|
|
34
|
+
children,
|
|
35
|
+
className = "",
|
|
36
|
+
disabled,
|
|
37
|
+
enableHyphenation = false,
|
|
38
|
+
variant = ParagraphVariant.PARAGRAPH100,
|
|
39
|
+
...props
|
|
40
|
+
}: ParagraphProps) => {
|
|
41
|
+
const classes = c([
|
|
42
|
+
className,
|
|
43
|
+
styles[rootClassName],
|
|
44
|
+
styles[`${rootClassName}--${variant}`],
|
|
45
|
+
{
|
|
46
|
+
[styles[`${rootClassName}--hyphens`]]: enableHyphenation,
|
|
47
|
+
[styles[`${rootClassName}--disabled`]]: disabled,
|
|
48
|
+
},
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<p {...props} className={classes} data-testid={dataTestid}>
|
|
53
|
+
{children}
|
|
54
|
+
</p>
|
|
55
|
+
);
|
|
56
|
+
};
|