@purr-react-styled-components/components.typography 0.0.8 → 0.0.10
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.cjs +34 -1
- package/dist/{_types.d.ts → index.d.cts} +7 -3
- package/dist/index.d.ts +26 -2
- package/dist/index.js +34 -77
- package/package.json +6 -4
- package/dist/_components.d.ts +0 -4
- package/dist/_style.d.ts +0 -15
package/dist/index.cjs
CHANGED
|
@@ -1 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';var P=require('clsx'),I=require('react'),utils_helpers$1=require('@purr-core/utils.helpers'),p=require('styled-components'),utils_helpers=require('@purr-react-styled-components/utils.helpers');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var P__default=/*#__PURE__*/_interopDefault(P);var I__default=/*#__PURE__*/_interopDefault(I);var p__default=/*#__PURE__*/_interopDefault(p);var o=({$size:y,$color:e,$bold:r,$font:t,$align:a})=>p.css`
|
|
2
|
+
transition: inherit;
|
|
3
|
+
font-size: ${typeof y=="number"?`${y}px`:y};
|
|
4
|
+
font-weight: ${r};
|
|
5
|
+
color: ${e};
|
|
6
|
+
font-family: ${t};
|
|
7
|
+
text-align: ${a};
|
|
8
|
+
`,g={H1:p__default.default.h1`
|
|
9
|
+
${o};
|
|
10
|
+
`,H2:p__default.default.h2`
|
|
11
|
+
${o};
|
|
12
|
+
`,H3:p__default.default.h3`
|
|
13
|
+
${o};
|
|
14
|
+
`,H4:p__default.default.h4`
|
|
15
|
+
${o};
|
|
16
|
+
`,H5:p__default.default.h5`
|
|
17
|
+
${o};
|
|
18
|
+
`,H6:p__default.default.h6`
|
|
19
|
+
${o};
|
|
20
|
+
`,Span:p__default.default.span`
|
|
21
|
+
${o};
|
|
22
|
+
`,Caption:p__default.default.caption`
|
|
23
|
+
${o};
|
|
24
|
+
`,Button:p__default.default.button`
|
|
25
|
+
${o};
|
|
26
|
+
${utils_helpers.getInvisibleButton};
|
|
27
|
+
`,A:p__default.default.a`
|
|
28
|
+
${o};
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
text-decoration-line: none;
|
|
31
|
+
`,P:p__default.default.p`
|
|
32
|
+
${o};
|
|
33
|
+
margin-block: 0;
|
|
34
|
+
`};var H=({variant:y="span",children:e,size:r="inherit",bold:t=400,color:a="inherit",font:s="inherit",className:l="",align:h="inherit",htmlAttributes:d})=>{let n=I.useMemo(()=>{let i=utils_helpers$1.capitalize(y);return g[i]},[y]);return I__default.default.createElement(n,{...d,$size:r,$color:a,$bold:t,$font:s,$align:h,className:P__default.default("typography",`typography__variant--${y}`,`typography__size--${r}`,`typography__bold--${t}`,`typography__color--${a}`,`typography__font--${s}`,`typography__align--${h}`,l)},e)};exports.Typography=H;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import React, { JSX, ReactNode, HTMLAttributes } from 'react';
|
|
1
2
|
import { Property } from 'csstype';
|
|
2
|
-
import { HTMLAttributes, JSX, ReactNode } from 'react';
|
|
3
3
|
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
interface ITypographyProps {
|
|
6
6
|
variant?: keyof JSX.IntrinsicElements;
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
size?: number | string;
|
|
@@ -13,10 +13,14 @@ export interface ITypographyProps {
|
|
|
13
13
|
align?: Property.TextAlign;
|
|
14
14
|
htmlAttributes?: HTMLAttributes<HTMLElement> & IExtendable;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
interface IStyledTypographyProps extends HTMLAttributes<HTMLElement>, IExtendable {
|
|
17
17
|
$size?: number | string;
|
|
18
18
|
$color?: string;
|
|
19
19
|
$bold?: number;
|
|
20
20
|
$font?: string;
|
|
21
21
|
$align?: Property.TextAlign;
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
declare const Typography: ({ variant, children, size, bold, color, font, className, align, htmlAttributes, }: ITypographyProps) => React.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { type IStyledTypographyProps, type ITypographyProps, Typography };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React, { JSX, ReactNode, HTMLAttributes } from 'react';
|
|
2
|
+
import { Property } from 'csstype';
|
|
3
|
+
import { IExtendable } from '@purr-core/utils.definitions';
|
|
4
|
+
|
|
5
|
+
interface ITypographyProps {
|
|
6
|
+
variant?: keyof JSX.IntrinsicElements;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
size?: number | string;
|
|
9
|
+
bold?: number;
|
|
10
|
+
color?: string;
|
|
11
|
+
font?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
align?: Property.TextAlign;
|
|
14
|
+
htmlAttributes?: HTMLAttributes<HTMLElement> & IExtendable;
|
|
15
|
+
}
|
|
16
|
+
interface IStyledTypographyProps extends HTMLAttributes<HTMLElement>, IExtendable {
|
|
17
|
+
$size?: number | string;
|
|
18
|
+
$color?: string;
|
|
19
|
+
$bold?: number;
|
|
20
|
+
$font?: string;
|
|
21
|
+
$align?: Property.TextAlign;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare const Typography: ({ variant, children, size, bold, color, font, className, align, htmlAttributes, }: ITypographyProps) => React.JSX.Element;
|
|
25
|
+
|
|
26
|
+
export { type IStyledTypographyProps, type ITypographyProps, Typography };
|
package/dist/index.js
CHANGED
|
@@ -1,77 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
displayName: "_style__H6",
|
|
36
|
-
componentId: "sc-rhhv96-5"
|
|
37
|
-
})(["", ";"], o),
|
|
38
|
-
Span: t.span.withConfig({
|
|
39
|
-
displayName: "_style__Span",
|
|
40
|
-
componentId: "sc-rhhv96-6"
|
|
41
|
-
})(["", ";"], o),
|
|
42
|
-
Caption: t.caption.withConfig({
|
|
43
|
-
displayName: "_style__Caption",
|
|
44
|
-
componentId: "sc-rhhv96-7"
|
|
45
|
-
})(["", ";"], o),
|
|
46
|
-
Button: t.button.withConfig({
|
|
47
|
-
displayName: "_style__Button",
|
|
48
|
-
componentId: "sc-rhhv96-8"
|
|
49
|
-
})(["", ";", ";"], o, C),
|
|
50
|
-
A: t.a.withConfig({
|
|
51
|
-
displayName: "_style__A",
|
|
52
|
-
componentId: "sc-rhhv96-9"
|
|
53
|
-
})(["", ";cursor:pointer;text-decoration-line:none;"], o),
|
|
54
|
-
P: t.p.withConfig({
|
|
55
|
-
displayName: "_style__P",
|
|
56
|
-
componentId: "sc-rhhv96-10"
|
|
57
|
-
})(["", ";margin-block:0;"], o)
|
|
58
|
-
}, x = ({
|
|
59
|
-
variant: n = "span",
|
|
60
|
-
children: h,
|
|
61
|
-
size: i = "inherit",
|
|
62
|
-
bold: e = 400,
|
|
63
|
-
color: p = "inherit",
|
|
64
|
-
font: r = "inherit",
|
|
65
|
-
className: a = "",
|
|
66
|
-
align: s = "inherit",
|
|
67
|
-
htmlAttributes: y
|
|
68
|
-
}) => {
|
|
69
|
-
const _ = d(() => {
|
|
70
|
-
const m = g(n);
|
|
71
|
-
return w[m];
|
|
72
|
-
}, [n]);
|
|
73
|
-
return /* @__PURE__ */ l(_, { ...y, $size: i, $color: p, $bold: e, $font: r, $align: s, className: c("typography", `typography__variant--${n}`, `typography__size--${i}`, `typography__bold--${e}`, `typography__color--${p}`, `typography__font--${r}`, `typography__align--${s}`, a), children: h });
|
|
74
|
-
};
|
|
75
|
-
export {
|
|
76
|
-
x as Typography
|
|
77
|
-
};
|
|
1
|
+
import P from'clsx';import I,{useMemo}from'react';import {capitalize}from'@purr-core/utils.helpers';import p,{css}from'styled-components';import {getInvisibleButton}from'@purr-react-styled-components/utils.helpers';var o=({$size:y,$color:e,$bold:r,$font:t,$align:a})=>css`
|
|
2
|
+
transition: inherit;
|
|
3
|
+
font-size: ${typeof y=="number"?`${y}px`:y};
|
|
4
|
+
font-weight: ${r};
|
|
5
|
+
color: ${e};
|
|
6
|
+
font-family: ${t};
|
|
7
|
+
text-align: ${a};
|
|
8
|
+
`,g={H1:p.h1`
|
|
9
|
+
${o};
|
|
10
|
+
`,H2:p.h2`
|
|
11
|
+
${o};
|
|
12
|
+
`,H3:p.h3`
|
|
13
|
+
${o};
|
|
14
|
+
`,H4:p.h4`
|
|
15
|
+
${o};
|
|
16
|
+
`,H5:p.h5`
|
|
17
|
+
${o};
|
|
18
|
+
`,H6:p.h6`
|
|
19
|
+
${o};
|
|
20
|
+
`,Span:p.span`
|
|
21
|
+
${o};
|
|
22
|
+
`,Caption:p.caption`
|
|
23
|
+
${o};
|
|
24
|
+
`,Button:p.button`
|
|
25
|
+
${o};
|
|
26
|
+
${getInvisibleButton};
|
|
27
|
+
`,A:p.a`
|
|
28
|
+
${o};
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
text-decoration-line: none;
|
|
31
|
+
`,P:p.p`
|
|
32
|
+
${o};
|
|
33
|
+
margin-block: 0;
|
|
34
|
+
`};var H=({variant:y="span",children:e,size:r="inherit",bold:t=400,color:a="inherit",font:s="inherit",className:l="",align:h="inherit",htmlAttributes:d})=>{let n=useMemo(()=>{let i=capitalize(y);return g[i]},[y]);return I.createElement(n,{...d,$size:r,$color:a,$bold:t,$font:s,$align:h,className:P("typography",`typography__variant--${y}`,`typography__size--${r}`,`typography__bold--${t}`,`typography__color--${a}`,`typography__font--${s}`,`typography__align--${h}`,l)},e)};export{H as Typography};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@purr-react-styled-components/components.typography",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"react": "*",
|
|
26
26
|
"styled-components": "*",
|
|
27
27
|
"clsx": "*",
|
|
28
|
-
"@purr-core/utils.definitions": "0.0.
|
|
29
|
-
"@purr-core/utils.helpers": "0.0.
|
|
30
|
-
"@purr-react-styled-components/utils.helpers": "0.0.
|
|
28
|
+
"@purr-core/utils.definitions": "0.0.12",
|
|
29
|
+
"@purr-core/utils.helpers": "0.0.12",
|
|
30
|
+
"@purr-react-styled-components/utils.helpers": "0.0.8"
|
|
31
31
|
},
|
|
32
32
|
"author": "@DinhThienPhuc",
|
|
33
33
|
"license": "ISC",
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"dev": "vite build --watch",
|
|
38
38
|
"build": "tsc && vite build",
|
|
39
|
+
"build:vite": "tsc && vite build",
|
|
40
|
+
"build:tsup": "tsup",
|
|
39
41
|
"lint": "eslint . --ext ts,tsx --max-warnings 0"
|
|
40
42
|
}
|
|
41
43
|
}
|
package/dist/_components.d.ts
DELETED
package/dist/_style.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { IStyledTypographyProps } from './_types';
|
|
2
|
-
|
|
3
|
-
export declare const Styled: {
|
|
4
|
-
H1: React.FC<IStyledTypographyProps>;
|
|
5
|
-
H2: React.FC<IStyledTypographyProps>;
|
|
6
|
-
H3: React.FC<IStyledTypographyProps>;
|
|
7
|
-
H4: React.FC<IStyledTypographyProps>;
|
|
8
|
-
H5: React.FC<IStyledTypographyProps>;
|
|
9
|
-
H6: React.FC<IStyledTypographyProps>;
|
|
10
|
-
Span: React.FC<IStyledTypographyProps>;
|
|
11
|
-
Caption: React.FC<IStyledTypographyProps>;
|
|
12
|
-
Button: React.FC<IStyledTypographyProps>;
|
|
13
|
-
A: React.FC<IStyledTypographyProps>;
|
|
14
|
-
P: React.FC<IStyledTypographyProps>;
|
|
15
|
-
};
|