@luscii-healthtech/web-ui 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -8
- package/dist/web-ui.cjs.development.css +37 -0
- package/dist/web-ui.cjs.development.js +48 -12
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.css +37 -0
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.css +37 -0
- package/dist/web-ui.esm.js +48 -12
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +4 -2
- package/src/index.tsx +1 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
3
|
-
children?: ReactChild;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* A custom Thing component. Neat!
|
|
7
|
-
*/
|
|
8
|
-
export declare const Thing: FC<Props>;
|
|
1
|
+
export { default as Text } from "./components/Text/Text";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.cweb-text {
|
|
2
|
+
font-family: "Inter", "Roboto", sans-serif;
|
|
3
|
+
font-size: 1rem;
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
line-height: 1.31em;
|
|
6
|
+
color: #2d2d2d;
|
|
7
|
+
margin: 0; }
|
|
8
|
+
.cweb-text.type-emphasized {
|
|
9
|
+
font-weight: bold; }
|
|
10
|
+
.cweb-text.type-error {
|
|
11
|
+
color: #e55b56;
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
line-height: 1.25em; }
|
|
14
|
+
.cweb-text.type-strong {
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
color: #0f3554; }
|
|
17
|
+
.cweb-text.type-small-dark {
|
|
18
|
+
font-size: 0.875rem;
|
|
19
|
+
line-height: 1.25em;
|
|
20
|
+
color: #2d2d2d; }
|
|
21
|
+
.cweb-text.type-small {
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
line-height: 1.25em;
|
|
24
|
+
color: #737373; }
|
|
25
|
+
.cweb-text.type-small-fineprint {
|
|
26
|
+
font-size: 0.875rem;
|
|
27
|
+
line-height: 1.25em;
|
|
28
|
+
color: #737373; }
|
|
29
|
+
.cweb-text.type-fineprint {
|
|
30
|
+
color: #737373; }
|
|
31
|
+
.cweb-text.level-inline {
|
|
32
|
+
display: inline; }
|
|
33
|
+
.cweb-text.level-block {
|
|
34
|
+
display: block; }
|
|
35
|
+
|
|
36
|
+
.in-html-link a:hover {
|
|
37
|
+
text-decoration: underline; }
|
|
@@ -4,20 +4,56 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
+
var classNames = _interopDefault(require('classnames'));
|
|
7
8
|
var React = _interopDefault(require('react'));
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
10
|
+
var Text = function Text(props) {
|
|
11
|
+
var containerProps = {
|
|
12
|
+
"data-test-id": props["data-test-id"],
|
|
13
|
+
className: classNames( // apply different style classes
|
|
14
|
+
// for now we stick with font-size 16px on the body
|
|
15
|
+
// so I am adjusting our styles accordingly (one step down)
|
|
16
|
+
{
|
|
17
|
+
"text-xs font-medium": props.type === "sm",
|
|
18
|
+
"text-xs font-semibold": props.type === "sm-strong",
|
|
19
|
+
"text-sm": props.type === "base",
|
|
20
|
+
"text-sm font-semibold": props.type === "strong",
|
|
21
|
+
"": props.type === "lg",
|
|
22
|
+
"font-semibold": props.type === "lg-strong",
|
|
23
|
+
"text-lg": props.type === "xl",
|
|
24
|
+
"font-semibold text-lg": props.type === "xl-strong"
|
|
25
|
+
}, {
|
|
26
|
+
inline: props.inline,
|
|
27
|
+
// FIXME: this class doesn't do anything without a max-width
|
|
28
|
+
truncate: props.truncate
|
|
29
|
+
}, {
|
|
30
|
+
"text-slate-700": props.color === "base",
|
|
31
|
+
"text-slate-500": props.color === "gray-500",
|
|
32
|
+
"text-slate-200": props.color === "gray-200",
|
|
33
|
+
"text-red-700": props.color === "red",
|
|
34
|
+
"text-green-700": props.color === "green",
|
|
35
|
+
"text-yellow-700": props.color === "amber",
|
|
36
|
+
"text-blue-700": props.color === "blue",
|
|
37
|
+
"text-white": props.color === "white",
|
|
38
|
+
"text-primary-dark": props.color === "blue"
|
|
39
|
+
}, {
|
|
40
|
+
"in-html-link": props.containsDangerousHtml
|
|
41
|
+
}, //can be used to overwrite other classes like the color
|
|
42
|
+
props.className)
|
|
43
|
+
};
|
|
44
|
+
return props.containsDangerousHtml ? React.createElement("p", Object.assign({}, containerProps, {
|
|
45
|
+
dangerouslySetInnerHTML: {
|
|
46
|
+
__html: props.text
|
|
47
|
+
}
|
|
48
|
+
})) : React.createElement("p", Object.assign({}, containerProps), props.text);
|
|
49
|
+
};
|
|
50
|
+
Text.defaultProps = {
|
|
51
|
+
type: "base",
|
|
52
|
+
inline: false,
|
|
53
|
+
color: "base",
|
|
54
|
+
containsDangerousHtml: false,
|
|
55
|
+
truncate: false
|
|
20
56
|
};
|
|
21
57
|
|
|
22
|
-
exports.
|
|
58
|
+
exports.Text = Text;
|
|
23
59
|
//# sourceMappingURL=web-ui.cjs.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.cjs.development.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"web-ui.cjs.development.js","sources":["../src/components/Text/Text.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nimport { RestPropped } from \"../../types/general.types\";\n\nimport \"./Text.scss\";\n\nexport type TextStyle = \"sm\" | \"sm-strong\" | \"base\" | \"strong\" | \"lg\" | \"lg-strong\" | \"xl\" | \"xl-strong\" | string;\n\n//Extend with other colors that we want to enable for text\nexport type TextColor = \"base\" | \"gray-500\" | \"gray-200\" | \"white\" | \"blue\" | \"red\" | \"green\" | \"amber\" | \"inherit\";\n\nexport interface TextProps extends RestPropped {\n text: string;\n type?: TextStyle; //defaults to \"base\"\n inline?: boolean; //defaults to false\n color?: TextColor; //defaults to \"base\"\n hoverColor?: TextColor; //defaults to \"base\"\n className?: string;\n containsDangerousHtml?: boolean; //defaults to false\n truncate?: boolean; //defaults to false\n \"data-test-id\"?: string;\n}\n\nexport const Text = (props: TextProps): JSX.Element => {\n const containerProps = {\n \"data-test-id\": props[\"data-test-id\"],\n className: classNames(\n // apply different style classes\n // for now we stick with font-size 16px on the body\n // so I am adjusting our styles accordingly (one step down)\n {\n \"text-xs font-medium\": props.type === \"sm\",\n \"text-xs font-semibold\": props.type === \"sm-strong\",\n \"text-sm\": props.type === \"base\",\n \"text-sm font-semibold\": props.type === \"strong\",\n \"\": props.type === \"lg\",\n \"font-semibold\": props.type === \"lg-strong\",\n \"text-lg\": props.type === \"xl\",\n \"font-semibold text-lg\": props.type === \"xl-strong\",\n },\n {\n inline: props.inline,\n // FIXME: this class doesn't do anything without a max-width\n truncate: props.truncate,\n },\n {\n \"text-slate-700\": props.color === \"base\",\n \"text-slate-500\": props.color === \"gray-500\",\n \"text-slate-200\": props.color === \"gray-200\",\n \"text-red-700\": props.color === \"red\",\n \"text-green-700\": props.color === \"green\",\n \"text-yellow-700\": props.color === \"amber\",\n \"text-blue-700\": props.color === \"blue\",\n \"text-white\": props.color === \"white\",\n \"text-primary-dark\": props.color === \"blue\",\n },\n {\n \"in-html-link\": props.containsDangerousHtml,\n },\n //can be used to overwrite other classes like the color\n props.className\n ),\n };\n\n return props.containsDangerousHtml ? (\n <p {...containerProps} dangerouslySetInnerHTML={{ __html: props.text }} />\n ) : (\n <p {...containerProps}>{props.text}</p>\n );\n};\n\nexport default Text;\n\nText.defaultProps = {\n type: \"base\",\n inline: false,\n color: \"base\",\n containsDangerousHtml: false,\n truncate: false,\n};\n"],"names":["Text","props","containerProps","className","classNames","type","inline","truncate","color","containsDangerousHtml","React","dangerouslySetInnerHTML","__html","text","defaultProps"],"mappings":";;;;;;;;;AAwBO,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAACC,KAAD;EAClB,IAAMC,cAAc,GAAG;IACrB,gBAAgBD,KAAK,CAAC,cAAD,CADA;IAErBE,SAAS,EAAEC,UAAU;;;IAIjB;MACE,uBAAuBH,KAAK,CAACI,IAAN,KAAe,IADxC;MAEE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe,WAF1C;MAGE,WAAWJ,KAAK,CAACI,IAAN,KAAe,MAH5B;MAIE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe,QAJ1C;MAKE,IAAIJ,KAAK,CAACI,IAAN,KAAe,IALrB;MAME,iBAAiBJ,KAAK,CAACI,IAAN,KAAe,WANlC;MAOE,WAAWJ,KAAK,CAACI,IAAN,KAAe,IAP5B;MAQE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe;KAZzB,EAcjB;MACEC,MAAM,EAAEL,KAAK,CAACK,MADhB;;MAGEC,QAAQ,EAAEN,KAAK,CAACM;KAjBD,EAmBjB;MACE,kBAAkBN,KAAK,CAACO,KAAN,KAAgB,MADpC;MAEE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,UAFpC;MAGE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,UAHpC;MAIE,gBAAgBP,KAAK,CAACO,KAAN,KAAgB,KAJlC;MAKE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,OALpC;MAME,mBAAmBP,KAAK,CAACO,KAAN,KAAgB,OANrC;MAOE,iBAAiBP,KAAK,CAACO,KAAN,KAAgB,MAPnC;MAQE,cAAcP,KAAK,CAACO,KAAN,KAAgB,OARhC;MASE,qBAAqBP,KAAK,CAACO,KAAN,KAAgB;KA5BtB,EA8BjB;MACE,gBAAgBP,KAAK,CAACQ;KA/BP;IAkCjBR,KAAK,CAACE,SAlCW;GAFvB;EAwCA,OAAOF,KAAK,CAACQ,qBAAN,GACLC,mBAAA,IAAA,oBAAOR;IAAgBS,uBAAuB,EAAE;MAAEC,MAAM,EAAEX,KAAK,CAACY;;IAAhE,CADK,GAGLH,mBAAA,IAAA,oBAAOR,eAAP,EAAwBD,KAAK,CAACY,IAA9B,CAHF;AAKD,CA9CM;AAkDPb,IAAI,CAACc,YAAL,GAAoB;EAClBT,IAAI,EAAE,MADY;EAElBC,MAAM,EAAE,KAFU;EAGlBE,KAAK,EAAE,MAHW;EAIlBC,qBAAqB,EAAE,KAJL;EAKlBF,QAAQ,EAAE;AALQ,CAApB;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.cweb-text {
|
|
2
|
+
font-family: "Inter", "Roboto", sans-serif;
|
|
3
|
+
font-size: 1rem;
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
line-height: 1.31em;
|
|
6
|
+
color: #2d2d2d;
|
|
7
|
+
margin: 0; }
|
|
8
|
+
.cweb-text.type-emphasized {
|
|
9
|
+
font-weight: bold; }
|
|
10
|
+
.cweb-text.type-error {
|
|
11
|
+
color: #e55b56;
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
line-height: 1.25em; }
|
|
14
|
+
.cweb-text.type-strong {
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
color: #0f3554; }
|
|
17
|
+
.cweb-text.type-small-dark {
|
|
18
|
+
font-size: 0.875rem;
|
|
19
|
+
line-height: 1.25em;
|
|
20
|
+
color: #2d2d2d; }
|
|
21
|
+
.cweb-text.type-small {
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
line-height: 1.25em;
|
|
24
|
+
color: #737373; }
|
|
25
|
+
.cweb-text.type-small-fineprint {
|
|
26
|
+
font-size: 0.875rem;
|
|
27
|
+
line-height: 1.25em;
|
|
28
|
+
color: #737373; }
|
|
29
|
+
.cweb-text.type-fineprint {
|
|
30
|
+
color: #737373; }
|
|
31
|
+
.cweb-text.level-inline {
|
|
32
|
+
display: inline; }
|
|
33
|
+
.cweb-text.level-block {
|
|
34
|
+
display: block; }
|
|
35
|
+
|
|
36
|
+
.in-html-link a:hover {
|
|
37
|
+
text-decoration: underline; }
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,
|
|
1
|
+
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("classnames")),r=e(require("react")),o=function(e){var o={"data-test-id":e["data-test-id"],className:t({"text-xs font-medium":"sm"===e.type,"text-xs font-semibold":"sm-strong"===e.type,"text-sm":"base"===e.type,"text-sm font-semibold":"strong"===e.type,"":"lg"===e.type,"font-semibold":"lg-strong"===e.type,"text-lg":"xl"===e.type,"font-semibold text-lg":"xl-strong"===e.type},{inline:e.inline,truncate:e.truncate},{"text-slate-700":"base"===e.color,"text-slate-500":"gray-500"===e.color,"text-slate-200":"gray-200"===e.color,"text-red-700":"red"===e.color,"text-green-700":"green"===e.color,"text-yellow-700":"amber"===e.color,"text-blue-700":"blue"===e.color,"text-white":"white"===e.color,"text-primary-dark":"blue"===e.color},{"in-html-link":e.containsDangerousHtml},e.className)};return e.containsDangerousHtml?r.createElement("p",Object.assign({},o,{dangerouslySetInnerHTML:{__html:e.text}})):r.createElement("p",Object.assign({},o),e.text)};o.defaultProps={type:"base",inline:!1,color:"base",containsDangerousHtml:!1,truncate:!1},exports.Text=o;
|
|
2
2
|
//# sourceMappingURL=web-ui.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.cjs.production.min.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"web-ui.cjs.production.min.js","sources":["../src/components/Text/Text.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nimport { RestPropped } from \"../../types/general.types\";\n\nimport \"./Text.scss\";\n\nexport type TextStyle = \"sm\" | \"sm-strong\" | \"base\" | \"strong\" | \"lg\" | \"lg-strong\" | \"xl\" | \"xl-strong\" | string;\n\n//Extend with other colors that we want to enable for text\nexport type TextColor = \"base\" | \"gray-500\" | \"gray-200\" | \"white\" | \"blue\" | \"red\" | \"green\" | \"amber\" | \"inherit\";\n\nexport interface TextProps extends RestPropped {\n text: string;\n type?: TextStyle; //defaults to \"base\"\n inline?: boolean; //defaults to false\n color?: TextColor; //defaults to \"base\"\n hoverColor?: TextColor; //defaults to \"base\"\n className?: string;\n containsDangerousHtml?: boolean; //defaults to false\n truncate?: boolean; //defaults to false\n \"data-test-id\"?: string;\n}\n\nexport const Text = (props: TextProps): JSX.Element => {\n const containerProps = {\n \"data-test-id\": props[\"data-test-id\"],\n className: classNames(\n // apply different style classes\n // for now we stick with font-size 16px on the body\n // so I am adjusting our styles accordingly (one step down)\n {\n \"text-xs font-medium\": props.type === \"sm\",\n \"text-xs font-semibold\": props.type === \"sm-strong\",\n \"text-sm\": props.type === \"base\",\n \"text-sm font-semibold\": props.type === \"strong\",\n \"\": props.type === \"lg\",\n \"font-semibold\": props.type === \"lg-strong\",\n \"text-lg\": props.type === \"xl\",\n \"font-semibold text-lg\": props.type === \"xl-strong\",\n },\n {\n inline: props.inline,\n // FIXME: this class doesn't do anything without a max-width\n truncate: props.truncate,\n },\n {\n \"text-slate-700\": props.color === \"base\",\n \"text-slate-500\": props.color === \"gray-500\",\n \"text-slate-200\": props.color === \"gray-200\",\n \"text-red-700\": props.color === \"red\",\n \"text-green-700\": props.color === \"green\",\n \"text-yellow-700\": props.color === \"amber\",\n \"text-blue-700\": props.color === \"blue\",\n \"text-white\": props.color === \"white\",\n \"text-primary-dark\": props.color === \"blue\",\n },\n {\n \"in-html-link\": props.containsDangerousHtml,\n },\n //can be used to overwrite other classes like the color\n props.className\n ),\n };\n\n return props.containsDangerousHtml ? (\n <p {...containerProps} dangerouslySetInnerHTML={{ __html: props.text }} />\n ) : (\n <p {...containerProps}>{props.text}</p>\n );\n};\n\nexport default Text;\n\nText.defaultProps = {\n type: \"base\",\n inline: false,\n color: \"base\",\n containsDangerousHtml: false,\n truncate: false,\n};\n"],"names":["Text","props","containerProps","data-test-id","className","classNames","text-xs font-medium","type","text-xs font-semibold","text-sm","text-sm font-semibold","font-semibold","text-lg","font-semibold text-lg","inline","truncate","text-slate-700","color","text-slate-500","text-slate-200","text-red-700","text-green-700","text-yellow-700","text-blue-700","text-white","text-primary-dark","in-html-link","containsDangerousHtml","React","dangerouslySetInnerHTML","__html","text","defaultProps"],"mappings":"+LAwBaA,EAAO,SAACC,GACnB,IAAMC,EAAiB,CACrBC,eAAgBF,EAAM,gBACtBG,UAAWC,EAIP,CACEC,sBAAsC,OAAfL,EAAMM,KAC7BC,wBAAwC,cAAfP,EAAMM,KAC/BE,UAA0B,SAAfR,EAAMM,KACjBG,wBAAwC,WAAfT,EAAMM,KAC/B,GAAmB,OAAfN,EAAMM,KACVI,gBAAgC,cAAfV,EAAMM,KACvBK,UAA0B,OAAfX,EAAMM,KACjBM,wBAAwC,cAAfZ,EAAMM,MAEjC,CACEO,OAAQb,EAAMa,OAEdC,SAAUd,EAAMc,UAElB,CACEC,iBAAkC,SAAhBf,EAAMgB,MACxBC,iBAAkC,aAAhBjB,EAAMgB,MACxBE,iBAAkC,aAAhBlB,EAAMgB,MACxBG,eAAgC,QAAhBnB,EAAMgB,MACtBI,iBAAkC,UAAhBpB,EAAMgB,MACxBK,kBAAmC,UAAhBrB,EAAMgB,MACzBM,gBAAiC,SAAhBtB,EAAMgB,MACvBO,aAA8B,UAAhBvB,EAAMgB,MACpBQ,oBAAqC,SAAhBxB,EAAMgB,OAE7B,CACES,eAAgBzB,EAAM0B,uBAGxB1B,EAAMG,YAIZ,OAAOH,EAAM0B,sBACXC,qCAAO1B,GAAgB2B,wBAAyB,CAAEC,OAAQ7B,EAAM8B,SAEhEH,qCAAO1B,GAAiBD,EAAM8B,OAMlC/B,EAAKgC,aAAe,CAClBzB,KAAM,OACNO,QAAQ,EACRG,MAAO,OACPU,uBAAuB,EACvBZ,UAAU"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
.cweb-text {
|
|
2
|
+
font-family: "Inter", "Roboto", sans-serif;
|
|
3
|
+
font-size: 1rem;
|
|
4
|
+
font-weight: normal;
|
|
5
|
+
line-height: 1.31em;
|
|
6
|
+
color: #2d2d2d;
|
|
7
|
+
margin: 0; }
|
|
8
|
+
.cweb-text.type-emphasized {
|
|
9
|
+
font-weight: bold; }
|
|
10
|
+
.cweb-text.type-error {
|
|
11
|
+
color: #e55b56;
|
|
12
|
+
font-size: 0.875rem;
|
|
13
|
+
line-height: 1.25em; }
|
|
14
|
+
.cweb-text.type-strong {
|
|
15
|
+
font-weight: bold;
|
|
16
|
+
color: #0f3554; }
|
|
17
|
+
.cweb-text.type-small-dark {
|
|
18
|
+
font-size: 0.875rem;
|
|
19
|
+
line-height: 1.25em;
|
|
20
|
+
color: #2d2d2d; }
|
|
21
|
+
.cweb-text.type-small {
|
|
22
|
+
font-size: 0.875rem;
|
|
23
|
+
line-height: 1.25em;
|
|
24
|
+
color: #737373; }
|
|
25
|
+
.cweb-text.type-small-fineprint {
|
|
26
|
+
font-size: 0.875rem;
|
|
27
|
+
line-height: 1.25em;
|
|
28
|
+
color: #737373; }
|
|
29
|
+
.cweb-text.type-fineprint {
|
|
30
|
+
color: #737373; }
|
|
31
|
+
.cweb-text.level-inline {
|
|
32
|
+
display: inline; }
|
|
33
|
+
.cweb-text.level-block {
|
|
34
|
+
display: block; }
|
|
35
|
+
|
|
36
|
+
.in-html-link a:hover {
|
|
37
|
+
text-decoration: underline; }
|
package/dist/web-ui.esm.js
CHANGED
|
@@ -1,17 +1,53 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
var Text = function Text(props) {
|
|
5
|
+
var containerProps = {
|
|
6
|
+
"data-test-id": props["data-test-id"],
|
|
7
|
+
className: classNames( // apply different style classes
|
|
8
|
+
// for now we stick with font-size 16px on the body
|
|
9
|
+
// so I am adjusting our styles accordingly (one step down)
|
|
10
|
+
{
|
|
11
|
+
"text-xs font-medium": props.type === "sm",
|
|
12
|
+
"text-xs font-semibold": props.type === "sm-strong",
|
|
13
|
+
"text-sm": props.type === "base",
|
|
14
|
+
"text-sm font-semibold": props.type === "strong",
|
|
15
|
+
"": props.type === "lg",
|
|
16
|
+
"font-semibold": props.type === "lg-strong",
|
|
17
|
+
"text-lg": props.type === "xl",
|
|
18
|
+
"font-semibold text-lg": props.type === "xl-strong"
|
|
19
|
+
}, {
|
|
20
|
+
inline: props.inline,
|
|
21
|
+
// FIXME: this class doesn't do anything without a max-width
|
|
22
|
+
truncate: props.truncate
|
|
23
|
+
}, {
|
|
24
|
+
"text-slate-700": props.color === "base",
|
|
25
|
+
"text-slate-500": props.color === "gray-500",
|
|
26
|
+
"text-slate-200": props.color === "gray-200",
|
|
27
|
+
"text-red-700": props.color === "red",
|
|
28
|
+
"text-green-700": props.color === "green",
|
|
29
|
+
"text-yellow-700": props.color === "amber",
|
|
30
|
+
"text-blue-700": props.color === "blue",
|
|
31
|
+
"text-white": props.color === "white",
|
|
32
|
+
"text-primary-dark": props.color === "blue"
|
|
33
|
+
}, {
|
|
34
|
+
"in-html-link": props.containsDangerousHtml
|
|
35
|
+
}, //can be used to overwrite other classes like the color
|
|
36
|
+
props.className)
|
|
37
|
+
};
|
|
38
|
+
return props.containsDangerousHtml ? React.createElement("p", Object.assign({}, containerProps, {
|
|
39
|
+
dangerouslySetInnerHTML: {
|
|
40
|
+
__html: props.text
|
|
41
|
+
}
|
|
42
|
+
})) : React.createElement("p", Object.assign({}, containerProps), props.text);
|
|
43
|
+
};
|
|
44
|
+
Text.defaultProps = {
|
|
45
|
+
type: "base",
|
|
46
|
+
inline: false,
|
|
47
|
+
color: "base",
|
|
48
|
+
containsDangerousHtml: false,
|
|
49
|
+
truncate: false
|
|
14
50
|
};
|
|
15
51
|
|
|
16
|
-
export {
|
|
52
|
+
export { Text };
|
|
17
53
|
//# sourceMappingURL=web-ui.esm.js.map
|
package/dist/web-ui.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-ui.esm.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"web-ui.esm.js","sources":["../src/components/Text/Text.tsx"],"sourcesContent":["import classNames from \"classnames\";\nimport React from \"react\";\n\nimport { RestPropped } from \"../../types/general.types\";\n\nimport \"./Text.scss\";\n\nexport type TextStyle = \"sm\" | \"sm-strong\" | \"base\" | \"strong\" | \"lg\" | \"lg-strong\" | \"xl\" | \"xl-strong\" | string;\n\n//Extend with other colors that we want to enable for text\nexport type TextColor = \"base\" | \"gray-500\" | \"gray-200\" | \"white\" | \"blue\" | \"red\" | \"green\" | \"amber\" | \"inherit\";\n\nexport interface TextProps extends RestPropped {\n text: string;\n type?: TextStyle; //defaults to \"base\"\n inline?: boolean; //defaults to false\n color?: TextColor; //defaults to \"base\"\n hoverColor?: TextColor; //defaults to \"base\"\n className?: string;\n containsDangerousHtml?: boolean; //defaults to false\n truncate?: boolean; //defaults to false\n \"data-test-id\"?: string;\n}\n\nexport const Text = (props: TextProps): JSX.Element => {\n const containerProps = {\n \"data-test-id\": props[\"data-test-id\"],\n className: classNames(\n // apply different style classes\n // for now we stick with font-size 16px on the body\n // so I am adjusting our styles accordingly (one step down)\n {\n \"text-xs font-medium\": props.type === \"sm\",\n \"text-xs font-semibold\": props.type === \"sm-strong\",\n \"text-sm\": props.type === \"base\",\n \"text-sm font-semibold\": props.type === \"strong\",\n \"\": props.type === \"lg\",\n \"font-semibold\": props.type === \"lg-strong\",\n \"text-lg\": props.type === \"xl\",\n \"font-semibold text-lg\": props.type === \"xl-strong\",\n },\n {\n inline: props.inline,\n // FIXME: this class doesn't do anything without a max-width\n truncate: props.truncate,\n },\n {\n \"text-slate-700\": props.color === \"base\",\n \"text-slate-500\": props.color === \"gray-500\",\n \"text-slate-200\": props.color === \"gray-200\",\n \"text-red-700\": props.color === \"red\",\n \"text-green-700\": props.color === \"green\",\n \"text-yellow-700\": props.color === \"amber\",\n \"text-blue-700\": props.color === \"blue\",\n \"text-white\": props.color === \"white\",\n \"text-primary-dark\": props.color === \"blue\",\n },\n {\n \"in-html-link\": props.containsDangerousHtml,\n },\n //can be used to overwrite other classes like the color\n props.className\n ),\n };\n\n return props.containsDangerousHtml ? (\n <p {...containerProps} dangerouslySetInnerHTML={{ __html: props.text }} />\n ) : (\n <p {...containerProps}>{props.text}</p>\n );\n};\n\nexport default Text;\n\nText.defaultProps = {\n type: \"base\",\n inline: false,\n color: \"base\",\n containsDangerousHtml: false,\n truncate: false,\n};\n"],"names":["Text","props","containerProps","className","classNames","type","inline","truncate","color","containsDangerousHtml","React","dangerouslySetInnerHTML","__html","text","defaultProps"],"mappings":";;;AAwBO,IAAMA,IAAI,GAAG,SAAPA,IAAO,CAACC,KAAD;EAClB,IAAMC,cAAc,GAAG;IACrB,gBAAgBD,KAAK,CAAC,cAAD,CADA;IAErBE,SAAS,EAAEC,UAAU;;;IAIjB;MACE,uBAAuBH,KAAK,CAACI,IAAN,KAAe,IADxC;MAEE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe,WAF1C;MAGE,WAAWJ,KAAK,CAACI,IAAN,KAAe,MAH5B;MAIE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe,QAJ1C;MAKE,IAAIJ,KAAK,CAACI,IAAN,KAAe,IALrB;MAME,iBAAiBJ,KAAK,CAACI,IAAN,KAAe,WANlC;MAOE,WAAWJ,KAAK,CAACI,IAAN,KAAe,IAP5B;MAQE,yBAAyBJ,KAAK,CAACI,IAAN,KAAe;KAZzB,EAcjB;MACEC,MAAM,EAAEL,KAAK,CAACK,MADhB;;MAGEC,QAAQ,EAAEN,KAAK,CAACM;KAjBD,EAmBjB;MACE,kBAAkBN,KAAK,CAACO,KAAN,KAAgB,MADpC;MAEE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,UAFpC;MAGE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,UAHpC;MAIE,gBAAgBP,KAAK,CAACO,KAAN,KAAgB,KAJlC;MAKE,kBAAkBP,KAAK,CAACO,KAAN,KAAgB,OALpC;MAME,mBAAmBP,KAAK,CAACO,KAAN,KAAgB,OANrC;MAOE,iBAAiBP,KAAK,CAACO,KAAN,KAAgB,MAPnC;MAQE,cAAcP,KAAK,CAACO,KAAN,KAAgB,OARhC;MASE,qBAAqBP,KAAK,CAACO,KAAN,KAAgB;KA5BtB,EA8BjB;MACE,gBAAgBP,KAAK,CAACQ;KA/BP;IAkCjBR,KAAK,CAACE,SAlCW;GAFvB;EAwCA,OAAOF,KAAK,CAACQ,qBAAN,GACLC,mBAAA,IAAA,oBAAOR;IAAgBS,uBAAuB,EAAE;MAAEC,MAAM,EAAEX,KAAK,CAACY;;IAAhE,CADK,GAGLH,mBAAA,IAAA,oBAAOR,eAAP,EAAwBD,KAAK,CAACY,IAA9B,CAHF;AAKD,CA9CM;AAkDPb,IAAI,CAACc,YAAL,GAAoB;EAClBT,IAAI,EAAE,MADY;EAElBC,MAAM,EAAE,KAFU;EAGlBE,KAAK,EAAE,MAHW;EAIlBC,qBAAqB,EAAE,KAJL;EAKlBF,QAAQ,EAAE;AALQ,CAApB;;;;"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.1",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -105,7 +105,9 @@
|
|
|
105
105
|
"react-glider": "^3.1.0",
|
|
106
106
|
"react-modal": "^3.15.1",
|
|
107
107
|
"react-quill": "^1.3.5",
|
|
108
|
-
"react-select": "^5.3.2"
|
|
108
|
+
"react-select": "^5.3.2",
|
|
109
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
110
|
+
"rollup-plugin-scss": "^3.0.0"
|
|
109
111
|
},
|
|
110
112
|
"description": "Luscii UI components library for web projects",
|
|
111
113
|
"directories": {
|
package/src/index.tsx
CHANGED
|
@@ -1,14 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
children?: ReactChild;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// Please do not use types off of a default export module or else Storybook Docs will suffer.
|
|
8
|
-
// see: https://github.com/storybookjs/storybook/issues/9556
|
|
9
|
-
/**
|
|
10
|
-
* A custom Thing component. Neat!
|
|
11
|
-
*/
|
|
12
|
-
export const Thing: FC<Props> = ({ children }) => {
|
|
13
|
-
return <div className={"mt-10 bg-red-500 p-5 rounded-md"}>{children || "this is a test"}</div>;
|
|
14
|
-
};
|
|
1
|
+
export { default as Text } from "./components/Text/Text";
|