get-elementa-ui 1.0.0 → 1.3.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/assets/fonts/Fraunces-Bold.ttf +0 -0
- package/dist/assets/fonts/Fraunces-Regular.ttf +0 -0
- package/dist/assets/fonts/Satoshi-Black.otf +0 -0
- package/dist/assets/fonts/Satoshi-Bold.otf +0 -0
- package/dist/assets/fonts/Satoshi-Light.otf +0 -0
- package/dist/assets/fonts/Satoshi-Medium.otf +0 -0
- package/dist/assets/fonts/Satoshi-Regular.otf +0 -0
- package/dist/assets/fonts/fraunces/Fraunces-Bold.ttf +0 -0
- package/dist/assets/fonts/fraunces/Fraunces-Regular.ttf +0 -0
- package/dist/assets/fonts/satoshi/Satoshi-Black.otf +0 -0
- package/dist/assets/fonts/satoshi/Satoshi-Bold.otf +0 -0
- package/dist/assets/fonts/satoshi/Satoshi-Light.otf +0 -0
- package/dist/assets/fonts/satoshi/Satoshi-Medium.otf +0 -0
- package/dist/assets/fonts/satoshi/Satoshi-Regular.otf +0 -0
- package/dist/components/text.js +55 -0
- package/dist/lib/types.js +16 -0
- package/dist/types/components/text.d.ts +5 -0
- package/dist/types/lib/types.d.ts +21 -0
- package/package.json +9 -4
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { cn } from '@/src/lib/utils';
|
|
5
|
+
import { TextVariant } from '@/src/lib/types';
|
|
6
|
+
/**
|
|
7
|
+
* This function renders the Text component for the library.
|
|
8
|
+
*/
|
|
9
|
+
export default function Text({ variant = TextVariant.Body, color, children }) {
|
|
10
|
+
// SECTION: Constants and Variables
|
|
11
|
+
const [className, setClassName] = useState('');
|
|
12
|
+
// !SECTION: Constants and Variables
|
|
13
|
+
// SECTION: States
|
|
14
|
+
// !SECTION: States
|
|
15
|
+
// SECTION: Functions
|
|
16
|
+
/**
|
|
17
|
+
* This function returns the class name for the given variant.
|
|
18
|
+
*
|
|
19
|
+
* @param variant - The variant of the text component.
|
|
20
|
+
* @returns The class name for the given variant.
|
|
21
|
+
*/
|
|
22
|
+
const getVariantClass = (variant) => {
|
|
23
|
+
switch (variant) {
|
|
24
|
+
case TextVariant.H1:
|
|
25
|
+
return 'text-[61px] font-heading';
|
|
26
|
+
case TextVariant.H2:
|
|
27
|
+
return 'text-[48px] font-heading';
|
|
28
|
+
case TextVariant.H3:
|
|
29
|
+
return 'text-[39px] font-heading';
|
|
30
|
+
case TextVariant.H4:
|
|
31
|
+
return 'text-[31px] font-bold font-heading';
|
|
32
|
+
case TextVariant.H5:
|
|
33
|
+
return 'text-[25px] font-bold font-heading';
|
|
34
|
+
case TextVariant.H6:
|
|
35
|
+
return 'text-[20px] font-bold font-heading';
|
|
36
|
+
case TextVariant.Body:
|
|
37
|
+
return 'text-[16px] font-body';
|
|
38
|
+
case TextVariant.Button:
|
|
39
|
+
return 'text-[16px] font-bold font-body';
|
|
40
|
+
default:
|
|
41
|
+
return 'text-[16px] font-body';
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
// !SECTION Functions
|
|
45
|
+
// SECTION: Event Handlers
|
|
46
|
+
// !SECTION: Event Handlers
|
|
47
|
+
// SECTION: Side Effects
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
setClassName(cn(getVariantClass(variant), color));
|
|
50
|
+
}, [variant, color]);
|
|
51
|
+
// !SECTION: Side Effects
|
|
52
|
+
// SECTION: UI
|
|
53
|
+
return _jsx("p", { className: className, children: children });
|
|
54
|
+
// !SECTION: UI
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var TextVariant;
|
|
2
|
+
(function (TextVariant) {
|
|
3
|
+
TextVariant[TextVariant["H1"] = 0] = "H1";
|
|
4
|
+
TextVariant[TextVariant["H2"] = 1] = "H2";
|
|
5
|
+
TextVariant[TextVariant["H3"] = 2] = "H3";
|
|
6
|
+
TextVariant[TextVariant["H4"] = 3] = "H4";
|
|
7
|
+
TextVariant[TextVariant["H5"] = 4] = "H5";
|
|
8
|
+
TextVariant[TextVariant["H6"] = 5] = "H6";
|
|
9
|
+
TextVariant[TextVariant["Body"] = 6] = "Body";
|
|
10
|
+
TextVariant[TextVariant["Button"] = 7] = "Button";
|
|
11
|
+
TextVariant[TextVariant["Subtitle1"] = 8] = "Subtitle1";
|
|
12
|
+
TextVariant[TextVariant["Subtitle2"] = 9] = "Subtitle2";
|
|
13
|
+
TextVariant[TextVariant["Caption"] = 10] = "Caption";
|
|
14
|
+
TextVariant[TextVariant["Custom"] = 11] = "Custom";
|
|
15
|
+
})(TextVariant || (TextVariant = {}));
|
|
16
|
+
export { TextVariant };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare enum TextVariant {
|
|
2
|
+
H1 = 0,
|
|
3
|
+
H2 = 1,
|
|
4
|
+
H3 = 2,
|
|
5
|
+
H4 = 3,
|
|
6
|
+
H5 = 4,
|
|
7
|
+
H6 = 5,
|
|
8
|
+
Body = 6,
|
|
9
|
+
Button = 7,
|
|
10
|
+
Subtitle1 = 8,
|
|
11
|
+
Subtitle2 = 9,
|
|
12
|
+
Caption = 10,
|
|
13
|
+
Custom = 11
|
|
14
|
+
}
|
|
15
|
+
interface TextProps {
|
|
16
|
+
variant?: TextVariant;
|
|
17
|
+
color?: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export { TextVariant };
|
|
21
|
+
export type { TextProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-elementa-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Elementa UI components library.",
|
|
5
5
|
"homepage": "https://deriva.xyz/branding",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"build": "rollup -c && tsc",
|
|
39
39
|
"build:watch": "rollup -c -w",
|
|
40
40
|
"prepublishOnly": "npm run build",
|
|
41
|
-
"publish:npm": "npm publish --access public"
|
|
42
|
-
"svgr": "svgr src/icons/*.svg --stdin-filepath .prettierrc --template src/lib/template.js --expand-props none --ignore-existing"
|
|
41
|
+
"publish:npm": "npm publish --access public"
|
|
43
42
|
},
|
|
44
43
|
"peerDependencies": {
|
|
45
44
|
"react": "^19.1.0"
|
|
@@ -54,7 +53,6 @@
|
|
|
54
53
|
"@rollup/plugin-json": "^6.1.0",
|
|
55
54
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
56
55
|
"@rollup/plugin-typescript": "^12.1.3",
|
|
57
|
-
"@svgr/cli": "^8.1.0",
|
|
58
56
|
"@types/babel__core": "^7.20.5",
|
|
59
57
|
"@types/babel__template": "^7.4.4",
|
|
60
58
|
"@types/node": "^20.12.2",
|
|
@@ -86,9 +84,16 @@
|
|
|
86
84
|
"clsx": "^2.1.1",
|
|
87
85
|
"lucide-react": "^0.575.0",
|
|
88
86
|
"radix-ui": "^1.4.3",
|
|
87
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
89
88
|
"shadcn": "^3.8.5",
|
|
90
89
|
"tailwind-merge": "^3.5.0",
|
|
91
90
|
"ts-node": "^10.9.2",
|
|
92
91
|
"tw-animate-css": "^1.4.0"
|
|
92
|
+
},
|
|
93
|
+
"exports": {
|
|
94
|
+
"./theme.css": "./src/styles/globals.css"
|
|
95
|
+
},
|
|
96
|
+
"resolutions": {
|
|
97
|
+
"@types/minimatch": "5.1.2"
|
|
93
98
|
}
|
|
94
99
|
}
|