@purr-react-styled-components/components.typography 0.0.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.
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { ITypographyProps } from './_types';
3
+
4
+ export declare const Typography: ({ variant, children, size, bold, color, font, className, align, htmlAttributes, }: ITypographyProps) => React.JSX.Element;
@@ -0,0 +1,15 @@
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
+ };
@@ -0,0 +1,22 @@
1
+ import { Property } from 'csstype';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+ import { IExtendable } from '@purr-core/utils.definitions';
4
+
5
+ export 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
+ export interface IStyledTypographyProps extends HTMLAttributes<HTMLElement>, IExtendable {
17
+ $size?: number | string;
18
+ $color?: string;
19
+ $bold?: number;
20
+ $font?: string;
21
+ $align?: Property.TextAlign;
22
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),d=require("clsx"),g=require("react"),m=require("@purr-core/utils.helpers"),t=require("styled-components"),u=require("@purr-react-styled-components/utils.helpers"),e=({$size:o,$color:r,$bold:n,$font:i,$align:s})=>t.css(["transition:inherit;font-size:",";font-weight:",";color:",";font-family:",";text-align:",";"],typeof o=="number"?`${o}px`:o,n,r,i,s),f={H1:t.h1.withConfig({displayName:"_style__H1",componentId:"sc-rhhv96-0"})(["",";"],e),H2:t.h2.withConfig({displayName:"_style__H2",componentId:"sc-rhhv96-1"})(["",";"],e),H3:t.h3.withConfig({displayName:"_style__H3",componentId:"sc-rhhv96-2"})(["",";"],e),H4:t.h4.withConfig({displayName:"_style__H4",componentId:"sc-rhhv96-3"})(["",";"],e),H5:t.h5.withConfig({displayName:"_style__H5",componentId:"sc-rhhv96-4"})(["",";"],e),H6:t.h6.withConfig({displayName:"_style__H6",componentId:"sc-rhhv96-5"})(["",";"],e),Span:t.span.withConfig({displayName:"_style__Span",componentId:"sc-rhhv96-6"})(["",";"],e),Caption:t.caption.withConfig({displayName:"_style__Caption",componentId:"sc-rhhv96-7"})(["",";"],e),Button:t.button.withConfig({displayName:"_style__Button",componentId:"sc-rhhv96-8"})(["",";",";"],e,u.getInvisibleButton),A:t.a.withConfig({displayName:"_style__A",componentId:"sc-rhhv96-9"})(["",";cursor:pointer;text-decoration-line:none;"],e),P:t.p.withConfig({displayName:"_style__P",componentId:"sc-rhhv96-10"})(["",";margin-block:0;"],e)},C=({variant:o="span",children:r,size:n="inherit",bold:i=400,color:s="inherit",font:p="inherit",className:a="",align:h="inherit",htmlAttributes:y})=>{const _=g.useMemo(()=>{const c=m.capitalize(o);return f[c]},[o]);return l.jsx(_,{...y,$size:n,$color:s,$bold:i,$font:p,$align:h,className:d("typography",`typography__variant--${o}`,`typography__size--${n}`,`typography__bold--${i}`,`typography__color--${s}`,`typography__font--${p}`,`typography__align--${h}`,a),children:r})};exports.Typography=C;
@@ -0,0 +1,2 @@
1
+ export * from './_components';
2
+ export * from './_types';
package/dist/index.js ADDED
@@ -0,0 +1,77 @@
1
+ import { jsx as l } from "react/jsx-runtime";
2
+ import c from "clsx";
3
+ import { useMemo as d } from "react";
4
+ import { capitalize as g } from "@purr-core/utils.helpers";
5
+ import t, { css as f } from "styled-components";
6
+ import { getInvisibleButton as C } from "@purr-react-styled-components/utils.helpers";
7
+ const o = ({
8
+ $size: n,
9
+ $color: h,
10
+ $bold: i,
11
+ $font: e,
12
+ $align: p
13
+ }) => f(["transition:inherit;font-size:", ";font-weight:", ";color:", ";font-family:", ";text-align:", ";"], typeof n == "number" ? `${n}px` : n, i, h, e, p), w = {
14
+ H1: t.h1.withConfig({
15
+ displayName: "_style__H1",
16
+ componentId: "sc-rhhv96-0"
17
+ })(["", ";"], o),
18
+ H2: t.h2.withConfig({
19
+ displayName: "_style__H2",
20
+ componentId: "sc-rhhv96-1"
21
+ })(["", ";"], o),
22
+ H3: t.h3.withConfig({
23
+ displayName: "_style__H3",
24
+ componentId: "sc-rhhv96-2"
25
+ })(["", ";"], o),
26
+ H4: t.h4.withConfig({
27
+ displayName: "_style__H4",
28
+ componentId: "sc-rhhv96-3"
29
+ })(["", ";"], o),
30
+ H5: t.h5.withConfig({
31
+ displayName: "_style__H5",
32
+ componentId: "sc-rhhv96-4"
33
+ })(["", ";"], o),
34
+ H6: t.h6.withConfig({
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
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@purr-react-styled-components/components.typography",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.cjs"
17
+ }
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "peerDependencies": {
24
+ "typescript": "*",
25
+ "react": "*",
26
+ "styled-components": "*",
27
+ "clsx": "*",
28
+ "@purr-core/utils.definitions": "0.0.4",
29
+ "@purr-core/utils.helpers": "0.0.4",
30
+ "@purr-react-styled-components/utils.helpers": "0.0.1"
31
+ },
32
+ "author": "@DinhThienPhuc",
33
+ "license": "ISC",
34
+ "description": "",
35
+ "sideEffects": false,
36
+ "scripts": {
37
+ "dev": "vite build --watch",
38
+ "build": "tsc && vite build",
39
+ "lint": "eslint . --ext ts,tsx --max-warnings 0"
40
+ }
41
+ }