@vaneui/ui 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.
- package/README.md +1 -0
- package/dist/components/complex/sharer.d.ts +39 -0
- package/dist/components/ui/badge.d.ts +3 -0
- package/dist/components/ui/button.d.ts +3 -0
- package/dist/components/ui/chip.d.ts +3 -0
- package/dist/components/ui/commonValues.d.ts +45 -0
- package/dist/components/ui/divider.d.ts +3 -0
- package/dist/components/ui/layout.d.ts +8 -0
- package/dist/components/ui/props.d.ts +106 -0
- package/dist/components/ui/settings.d.ts +30 -0
- package/dist/components/ui/typography.d.ts +9 -0
- package/dist/components/ui/utils.d.ts +23 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.esm.js +3093 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +3111 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
- package/rollup.config.mjs +22 -0
- package/src/components/complex/sharer.tsx +220 -0
- package/src/components/ui/badge.tsx +32 -0
- package/src/components/ui/button.tsx +24 -0
- package/src/components/ui/chip.tsx +29 -0
- package/src/components/ui/commonValues.ts +51 -0
- package/src/components/ui/divider.tsx +7 -0
- package/src/components/ui/layout.tsx +102 -0
- package/src/components/ui/props.ts +128 -0
- package/src/components/ui/settings.ts +19 -0
- package/src/components/ui/typography.tsx +97 -0
- package/src/components/ui/utils.tsx +124 -0
- package/src/index.ts +6 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
type Platform = 'fb' | 'li' | 'x' | 'th' | 'em' | 'wa' | 'tg' | 're';
|
|
6
|
+
|
|
7
|
+
interface SocialShareCommonProps {
|
|
8
|
+
url?: string;
|
|
9
|
+
text?: string;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
isLink?: boolean;
|
|
13
|
+
isBlank?: boolean;
|
|
14
|
+
platforms?: Platform[];
|
|
15
|
+
containerComponent?: React.ElementType;
|
|
16
|
+
buttonComponent?: React.ElementType;
|
|
17
|
+
buttonComponents?: Partial<Record<Platform, React.ElementType>>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface FacebookShareProps {
|
|
21
|
+
hashtag?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface TwitterShareProps {
|
|
25
|
+
hashtags?: string;
|
|
26
|
+
via?: string;
|
|
27
|
+
related?: string;
|
|
28
|
+
inReplyTo?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface EmailShareProps {
|
|
32
|
+
title?: string;
|
|
33
|
+
to?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface WhatsAppShareProps {
|
|
37
|
+
to?: string;
|
|
38
|
+
web?: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface SocialShareProps extends SocialShareCommonProps {
|
|
42
|
+
facebookProps?: FacebookShareProps;
|
|
43
|
+
twitterProps?: TwitterShareProps;
|
|
44
|
+
emailProps?: EmailShareProps;
|
|
45
|
+
whatsappProps?: WhatsAppShareProps;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ShareConfig {
|
|
49
|
+
shareUrl: string;
|
|
50
|
+
getParams: () => { [key: string]: string | number | boolean | undefined };
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const buildQueryString = (
|
|
54
|
+
params: { [key: string]: string | number | boolean | undefined }
|
|
55
|
+
): string => {
|
|
56
|
+
const validKeys = Object.keys(params).filter(
|
|
57
|
+
key => params[key] !== undefined && params[key] !== ''
|
|
58
|
+
);
|
|
59
|
+
return validKeys.length > 0
|
|
60
|
+
? '?' +
|
|
61
|
+
validKeys
|
|
62
|
+
.map(key => `${key}=${encodeURIComponent(String(params[key]))}`)
|
|
63
|
+
.join('&')
|
|
64
|
+
: '';
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const SocialShare: React.FC<SocialShareProps> = ({
|
|
68
|
+
url = window.location.href,
|
|
69
|
+
text = '',
|
|
70
|
+
width = 600,
|
|
71
|
+
height = 480,
|
|
72
|
+
isLink = false,
|
|
73
|
+
isBlank = true,
|
|
74
|
+
platforms,
|
|
75
|
+
containerComponent,
|
|
76
|
+
buttonComponent,
|
|
77
|
+
buttonComponents,
|
|
78
|
+
facebookProps = {},
|
|
79
|
+
twitterProps = {},
|
|
80
|
+
emailProps = {},
|
|
81
|
+
whatsappProps = {},
|
|
82
|
+
}) => {
|
|
83
|
+
const shareConfigs: { [key in Platform]: ShareConfig } = {
|
|
84
|
+
fb: {
|
|
85
|
+
shareUrl: 'https://www.facebook.com/sharer/sharer.php',
|
|
86
|
+
getParams: () => ({
|
|
87
|
+
u: url,
|
|
88
|
+
hashtag: facebookProps.hashtag
|
|
89
|
+
? facebookProps.hashtag.startsWith('#')
|
|
90
|
+
? facebookProps.hashtag
|
|
91
|
+
: `#${facebookProps.hashtag}`
|
|
92
|
+
: '',
|
|
93
|
+
quote: text,
|
|
94
|
+
}),
|
|
95
|
+
},
|
|
96
|
+
li: {
|
|
97
|
+
shareUrl: 'https://www.linkedin.com/shareArticle',
|
|
98
|
+
getParams: () => ({
|
|
99
|
+
url,
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
x: {
|
|
103
|
+
shareUrl: 'https://x.com/intent/tweet',
|
|
104
|
+
getParams: () => ({
|
|
105
|
+
text,
|
|
106
|
+
url,
|
|
107
|
+
hashtags: twitterProps.hashtags,
|
|
108
|
+
via: twitterProps.via,
|
|
109
|
+
related: twitterProps.related,
|
|
110
|
+
in_reply_to: twitterProps.inReplyTo,
|
|
111
|
+
}),
|
|
112
|
+
},
|
|
113
|
+
th: {
|
|
114
|
+
shareUrl: 'https://threads.net/intent/post',
|
|
115
|
+
getParams: () => ({
|
|
116
|
+
text: `${text} ${url}`,
|
|
117
|
+
}),
|
|
118
|
+
},
|
|
119
|
+
em: {
|
|
120
|
+
shareUrl: 'mailto:' + (emailProps.to || ''),
|
|
121
|
+
getParams: () => ({
|
|
122
|
+
subject: emailProps.title,
|
|
123
|
+
body: `${text}\n${url}`,
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
wa: {
|
|
127
|
+
shareUrl: whatsappProps.web
|
|
128
|
+
? 'https://web.whatsapp.com/send'
|
|
129
|
+
: 'https://wa.me/',
|
|
130
|
+
getParams: () => ({
|
|
131
|
+
phone: whatsappProps.to,
|
|
132
|
+
text: `${text} ${url}`,
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
tg: {
|
|
136
|
+
shareUrl: 'https://t.me/share',
|
|
137
|
+
getParams: () => ({
|
|
138
|
+
text,
|
|
139
|
+
url,
|
|
140
|
+
}),
|
|
141
|
+
},
|
|
142
|
+
re: {
|
|
143
|
+
shareUrl: 'https://www.reddit.com/submit',
|
|
144
|
+
getParams: () => ({
|
|
145
|
+
url,
|
|
146
|
+
title: text,
|
|
147
|
+
}),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const platformLabels: { [key in Platform]: string } = {
|
|
152
|
+
fb: 'Facebook',
|
|
153
|
+
li: 'LinkedIn',
|
|
154
|
+
x: 'X',
|
|
155
|
+
th: 'Threads',
|
|
156
|
+
em: 'Email',
|
|
157
|
+
wa: 'WhatsApp',
|
|
158
|
+
tg: 'Telegram',
|
|
159
|
+
re: 'Reddit',
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const buildShareUrl = (config: ShareConfig): string => {
|
|
163
|
+
const params = config.getParams();
|
|
164
|
+
const queryString = buildQueryString(params);
|
|
165
|
+
return config.shareUrl + queryString;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const openShareWindow = (shareUrl: string): void => {
|
|
169
|
+
if (isLink) {
|
|
170
|
+
if (isBlank) {
|
|
171
|
+
window.open(shareUrl, '_blank');
|
|
172
|
+
} else {
|
|
173
|
+
window.location.href = shareUrl;
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
const left = window.innerWidth / 2 - width / 2 + window.screenX;
|
|
177
|
+
const top = window.innerHeight / 2 - height / 2 + window.screenY;
|
|
178
|
+
const popParams = `scrollbars=no, width=${width}, height=${height}, top=${top}, left=${left}`;
|
|
179
|
+
const newWindow = window.open(shareUrl, '', popParams);
|
|
180
|
+
if (newWindow) {
|
|
181
|
+
newWindow.focus();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const handleShare = (key: Platform): void => {
|
|
187
|
+
const config = shareConfigs[key];
|
|
188
|
+
if (!config) return;
|
|
189
|
+
const shareUrl = buildShareUrl(config);
|
|
190
|
+
openShareWindow(shareUrl);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
// Use the provided container component or default to 'div'
|
|
194
|
+
const Container = containerComponent || 'div';
|
|
195
|
+
// Default button component to use if no platform-specific component is provided
|
|
196
|
+
const DefaultButton = buttonComponent || 'button';
|
|
197
|
+
const platformsToShow: Platform[] =
|
|
198
|
+
platforms || (Object.keys(shareConfigs) as Platform[]);
|
|
199
|
+
|
|
200
|
+
return (
|
|
201
|
+
<Container>
|
|
202
|
+
{platformsToShow.map(key => {
|
|
203
|
+
// Use a specific button component if defined for the key
|
|
204
|
+
const Button = (buttonComponents && buttonComponents[key]) || DefaultButton;
|
|
205
|
+
const label = platformLabels[key] || key;
|
|
206
|
+
return (
|
|
207
|
+
<Button
|
|
208
|
+
key={key}
|
|
209
|
+
onClick={() => handleShare(key)}
|
|
210
|
+
title={`Share on ${label}`}
|
|
211
|
+
>
|
|
212
|
+
{label}
|
|
213
|
+
</Button>
|
|
214
|
+
);
|
|
215
|
+
})}
|
|
216
|
+
</Container>
|
|
217
|
+
);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export default SocialShare;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { componentBuilder } from "./utils";
|
|
3
|
+
import { TypographyComponentProps } from "./props";
|
|
4
|
+
|
|
5
|
+
export const Badge: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
+
componentBuilder(props, "span", "rounded-full w-fit")
|
|
7
|
+
.withSizes({
|
|
8
|
+
xs: "px-2 py-1 text-xs",
|
|
9
|
+
sm: "px-3 py-1 text-sm",
|
|
10
|
+
md: "px-4 py-2 text-base",
|
|
11
|
+
lg: "px-5 py-2 text-lg",
|
|
12
|
+
xl: "px-6 py-3 text-xl",
|
|
13
|
+
})
|
|
14
|
+
.withAppearance({
|
|
15
|
+
default: "bg-gray-200",
|
|
16
|
+
accent: "bg-gray-200",
|
|
17
|
+
primary: "bg-blue-200",
|
|
18
|
+
secondary: "bg-gray-200",
|
|
19
|
+
tertiary: "bg-gray-200",
|
|
20
|
+
success: "bg-green-200",
|
|
21
|
+
danger: "bg-red-200",
|
|
22
|
+
warning: "bg-yellow-200",
|
|
23
|
+
info: "bg-blue-200"
|
|
24
|
+
}, {})
|
|
25
|
+
.withTypography({
|
|
26
|
+
fontWeight: { semibold: true },
|
|
27
|
+
fontFamily: { mono: true },
|
|
28
|
+
textTransform: { uppercase: true },
|
|
29
|
+
textAppearance: { secondary: true },
|
|
30
|
+
})
|
|
31
|
+
.build();
|
|
32
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { componentBuilder } from "./utils";
|
|
3
|
+
import { TypographyComponentProps } from "./props";
|
|
4
|
+
|
|
5
|
+
export const Button: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
+
componentBuilder(props, "button", "w-fit h-fit cursor-pointer flex justify-center items-center border border-gray-200 transition-all duration-300")
|
|
7
|
+
.withSizes({
|
|
8
|
+
xs: "px-2 py-1 rounded-sm text-xs",
|
|
9
|
+
sm: "px-3 py-1 rounded-md text-sm",
|
|
10
|
+
md: "px-4 py-2 rounded-md text-base",
|
|
11
|
+
lg: "px-6 py-3 rounded-lg text-lg",
|
|
12
|
+
xl: "px-8 py-4 rounded-xl text-xl",
|
|
13
|
+
})
|
|
14
|
+
.withSizes({
|
|
15
|
+
xs: "shadow-xs hover:shadow-sm",
|
|
16
|
+
sm: "shadow-xs hover:shadow-sm",
|
|
17
|
+
md: "shadow-sm hover:shadow-md",
|
|
18
|
+
lg: "shadow-md hover:shadow-lg",
|
|
19
|
+
xl: "shadow-lg hover:shadow-xl",
|
|
20
|
+
})
|
|
21
|
+
.withTypography({
|
|
22
|
+
fontWeight: { semibold: true },
|
|
23
|
+
})
|
|
24
|
+
.build();
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { componentBuilder } from "./utils";
|
|
3
|
+
import { TypographyComponentProps } from "./props";
|
|
4
|
+
|
|
5
|
+
export const Chip: React.FC<TypographyComponentProps> = (props) =>
|
|
6
|
+
componentBuilder(props, "span", "rounded-full w-fit h-fit border")
|
|
7
|
+
.withSizes({
|
|
8
|
+
xs: "px-1 py-1 rounded-sm text-xs",
|
|
9
|
+
sm: "px-2 py-1 rounded-md text-sm",
|
|
10
|
+
md: "px-2 py-1 rounded-lg text-base",
|
|
11
|
+
lg: "px-3 py-2 rounded-xl text-lg",
|
|
12
|
+
xl: "px-4 py-3 rounded-2xl text-xl",
|
|
13
|
+
})
|
|
14
|
+
.withAppearance({
|
|
15
|
+
default: "bg-gray-100",
|
|
16
|
+
accent: "bg-gray-200",
|
|
17
|
+
primary: "bg-blue-200",
|
|
18
|
+
secondary: "bg-gray-200",
|
|
19
|
+
tertiary: "bg-gray-200",
|
|
20
|
+
success: "bg-green-200",
|
|
21
|
+
danger: "bg-red-200",
|
|
22
|
+
warning: "bg-yellow-200",
|
|
23
|
+
info: "bg-blue-200"
|
|
24
|
+
}, {})
|
|
25
|
+
.withTypography({
|
|
26
|
+
fontFamily: { mono: true },
|
|
27
|
+
textAppearance: { secondary: true },
|
|
28
|
+
})
|
|
29
|
+
.build();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export const fontWeightClasses = {
|
|
2
|
+
thin: "font-thin",
|
|
3
|
+
extralight: "font-extralight",
|
|
4
|
+
light: "font-light",
|
|
5
|
+
normal: "font-normal",
|
|
6
|
+
medium: "font-medium",
|
|
7
|
+
semibold: "font-semibold",
|
|
8
|
+
bold: "font-bold",
|
|
9
|
+
extrabold: "font-extrabold",
|
|
10
|
+
black: "font-black",
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const fontStyleClasses = {
|
|
14
|
+
italic: "italic",
|
|
15
|
+
notItalic: "not-italic",
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const fontFamilyClasses = {
|
|
19
|
+
sans: "font-sans",
|
|
20
|
+
serif: "font-serif",
|
|
21
|
+
mono: "font-mono",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const textDecorationClasses = {
|
|
25
|
+
underline: "underline",
|
|
26
|
+
lineThrough: "line-through",
|
|
27
|
+
noUnderline: "no-underline",
|
|
28
|
+
overline: "overline",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const textTransformClasses = {
|
|
32
|
+
uppercase: "uppercase",
|
|
33
|
+
lowercase: "lowercase",
|
|
34
|
+
capitalize: "capitalize",
|
|
35
|
+
normalCase: "normal-case",
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const textAppearanceClasses = {
|
|
39
|
+
default: "text-(--text-color-default)",
|
|
40
|
+
primary: "text-(--text-color-primary)",
|
|
41
|
+
secondary: "text-(--text-color-secondary)",
|
|
42
|
+
tertiary: "text-(--text-color-tertiary)",
|
|
43
|
+
muted: "text-(--text-color-muted)",
|
|
44
|
+
link: "text-(--text-color-link)",
|
|
45
|
+
|
|
46
|
+
accent: "text-(--text-color-accent)",
|
|
47
|
+
success: "text-(--text-color-success)",
|
|
48
|
+
danger: "text-(--text-color-danger)",
|
|
49
|
+
warning: "text-(--text-color-warning)",
|
|
50
|
+
info: "text-(--text-color-info)",
|
|
51
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridProps, LayoutComponentProps, ColProps, RowProps } from "./props";
|
|
3
|
+
import { componentBuilder } from "./utils";
|
|
4
|
+
|
|
5
|
+
const centeredClasses = {
|
|
6
|
+
centered: "items-center justify-center",
|
|
7
|
+
vCentered: "items-center",
|
|
8
|
+
hCentered: "justify-center"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Section: React.FC<LayoutComponentProps> = (props) =>
|
|
12
|
+
componentBuilder(props, "section", "w-full flex flex-col items-start")
|
|
13
|
+
.withCentered(centeredClasses)
|
|
14
|
+
.withSizes({
|
|
15
|
+
xs: "py-6 max-lg:py-4 max-md:py-2",
|
|
16
|
+
sm: "py-8 max-lg:py-6 max-md:py-4",
|
|
17
|
+
md: "py-10 max-lg:py-8 max-md:py-6",
|
|
18
|
+
lg: "py-12 max-lg:py-10 max-md:py-8",
|
|
19
|
+
xl: "py-14 max-lg:py-12 max-md:py-10",
|
|
20
|
+
})
|
|
21
|
+
.withSizes({
|
|
22
|
+
xs: "px-4 max-lg:px-2 max-md:px-0",
|
|
23
|
+
sm: "px-6 max-lg:px-6 max-md:px-2",
|
|
24
|
+
md: "px-8 max-lg:px-6 max-md:px-4",
|
|
25
|
+
lg: "px-10 max-lg:px-8 max-md:px-6",
|
|
26
|
+
xl: "px-12 max-lg:px-10 max-md:px-8",
|
|
27
|
+
})
|
|
28
|
+
.build();
|
|
29
|
+
|
|
30
|
+
export const Container: React.FC<LayoutComponentProps> = (props) =>
|
|
31
|
+
componentBuilder(props, "div", "flex flex-col mx-auto w-full")
|
|
32
|
+
.withCentered(centeredClasses)
|
|
33
|
+
.withSizes({
|
|
34
|
+
xs: "max-w-3xl gap-2 max-lg:gap-1",
|
|
35
|
+
sm: "max-w-4xl gap-4 max-lg:gap-3 max-md:gap-2",
|
|
36
|
+
md: "max-w-5xl gap-6 max-lg:gap-5 max-md:gap-4",
|
|
37
|
+
lg: "max-w-6xl gap-8 max-lg:gap-7 max-md:gap-6",
|
|
38
|
+
xl: "max-w-7xl gap-10 max-lg:gap-9 max-md:gap-8",
|
|
39
|
+
})
|
|
40
|
+
.build();
|
|
41
|
+
|
|
42
|
+
const commonGaps = {
|
|
43
|
+
xs: "gap-1",
|
|
44
|
+
sm: "gap-2 max-lg:gap-1",
|
|
45
|
+
md: "gap-4 max-lg:gap-3 max-md:gap-2",
|
|
46
|
+
lg: "gap-6 max-lg:gap-5 max-md:gap-4",
|
|
47
|
+
xl: "gap-8 max-lg:gap-7 max-md:gap-6",
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const Col: React.FC<ColProps> = (props) =>
|
|
51
|
+
componentBuilder(props, "div", "flex flex-col")
|
|
52
|
+
.withGaps({ noGap: "gap-0" }, commonGaps)
|
|
53
|
+
.withReverse({
|
|
54
|
+
reverse: "flex-col-reverse"
|
|
55
|
+
})
|
|
56
|
+
.withCentered(centeredClasses)
|
|
57
|
+
.build();
|
|
58
|
+
|
|
59
|
+
export const Row: React.FC<RowProps> = (props) =>
|
|
60
|
+
componentBuilder(props, "div", "flex flex-row")
|
|
61
|
+
.withGaps({ noGap: "gap-0" }, commonGaps)
|
|
62
|
+
.withReverse({
|
|
63
|
+
reverse: "flex-row-reverse"
|
|
64
|
+
})
|
|
65
|
+
.withCentered(centeredClasses)
|
|
66
|
+
.withBreakpoints({
|
|
67
|
+
xsCol: "max-xs:flex-col",
|
|
68
|
+
smCol: "max-sm:flex-col",
|
|
69
|
+
mdCol: "max-md:flex-col",
|
|
70
|
+
lgCol: "max-lg:flex-col",
|
|
71
|
+
xlCol: "max-xl:flex-col"
|
|
72
|
+
})
|
|
73
|
+
.withBooleanProps({
|
|
74
|
+
justifyStart: "justify-start",
|
|
75
|
+
justifyEnd: "justify-end",
|
|
76
|
+
justifyCenter: "justify-center",
|
|
77
|
+
justifyBetween: "justify-between",
|
|
78
|
+
justifyAround: "justify-around",
|
|
79
|
+
justifyEvenly: "justify-evenly",
|
|
80
|
+
justifyStretch: "justify-stretch",
|
|
81
|
+
justifyBaseline: "justify-baseline",
|
|
82
|
+
})
|
|
83
|
+
.build();
|
|
84
|
+
|
|
85
|
+
const gridGaps = {
|
|
86
|
+
xs: "gap-2",
|
|
87
|
+
sm: "gap-4 max-lg:gap-2",
|
|
88
|
+
md: "gap-6 max-lg:gap-4",
|
|
89
|
+
lg: "gap-8 max-lg:gap-6 max-md:gap-4",
|
|
90
|
+
xl: "gap-10 max-lg:gap-8 max-md:gap-6",
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const Grid3: React.FC<GridProps> = (props) =>
|
|
94
|
+
componentBuilder(props, "div", "w-full grid grid-cols-3 max-lg:grid-cols-2 max-md:grid-cols-1")
|
|
95
|
+
.withGaps({ noGap: "gap-0" }, gridGaps)
|
|
96
|
+
.build();
|
|
97
|
+
|
|
98
|
+
export const Grid4: React.FC<GridProps> = (props) =>
|
|
99
|
+
componentBuilder(props, "div", "w-full grid grid-cols-4 max-lg:grid-cols-3 max-md:grid-cols-2 max-sm:grid-cols-1")
|
|
100
|
+
.withGaps({ noGap: "gap-0" }, gridGaps)
|
|
101
|
+
.build();
|
|
102
|
+
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export interface SizeProps {
|
|
2
|
+
xs?: boolean;
|
|
3
|
+
sm?: boolean;
|
|
4
|
+
md?: boolean;
|
|
5
|
+
lg?: boolean;
|
|
6
|
+
xl?: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface FontFamilyProps {
|
|
10
|
+
sans?: boolean;
|
|
11
|
+
serif?: boolean;
|
|
12
|
+
mono?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface FontWeightProps {
|
|
16
|
+
thin?: boolean;
|
|
17
|
+
extralight?: boolean;
|
|
18
|
+
light?: boolean;
|
|
19
|
+
normal?: boolean;
|
|
20
|
+
medium?: boolean;
|
|
21
|
+
semibold?: boolean;
|
|
22
|
+
bold?: boolean;
|
|
23
|
+
extrabold?: boolean;
|
|
24
|
+
black?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface FontStyleProps {
|
|
28
|
+
italic?: boolean;
|
|
29
|
+
notItalic?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TextDecorationProps {
|
|
33
|
+
underline?: boolean;
|
|
34
|
+
lineThrough?: boolean;
|
|
35
|
+
noUnderline?: boolean;
|
|
36
|
+
overline?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface TextTransformProps {
|
|
40
|
+
uppercase?: boolean;
|
|
41
|
+
lowercase?: boolean;
|
|
42
|
+
capitalize?: boolean;
|
|
43
|
+
normalCase?: boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface TextAppearanceProps {
|
|
47
|
+
muted?: boolean;
|
|
48
|
+
link?: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface CommonAppearanceProps {
|
|
52
|
+
default?: boolean;
|
|
53
|
+
accent?: boolean;
|
|
54
|
+
primary?: boolean;
|
|
55
|
+
secondary?: boolean;
|
|
56
|
+
tertiary?: boolean;
|
|
57
|
+
success?: boolean;
|
|
58
|
+
danger?: boolean;
|
|
59
|
+
warning?: boolean;
|
|
60
|
+
info?: boolean;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface BreakpointProps {
|
|
64
|
+
xsCol?: boolean;
|
|
65
|
+
smCol?: boolean;
|
|
66
|
+
mdCol?: boolean;
|
|
67
|
+
lgCol?: boolean;
|
|
68
|
+
xlCol?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface HideProps {
|
|
72
|
+
xsHide?: boolean;
|
|
73
|
+
smHide?: boolean;
|
|
74
|
+
mdHide?: boolean;
|
|
75
|
+
lgHide?: boolean;
|
|
76
|
+
xlHide?: boolean;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PositionProps {
|
|
80
|
+
relative?: boolean;
|
|
81
|
+
absolute?: boolean;
|
|
82
|
+
fixed?: boolean;
|
|
83
|
+
sticky?: boolean;
|
|
84
|
+
static?: boolean;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface TagProps {
|
|
88
|
+
tag?: React.ElementType | string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface ReverseProps {
|
|
92
|
+
reverse?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface GapProps {
|
|
96
|
+
noGap?: boolean;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface CenteredProps {
|
|
100
|
+
centered?: boolean;
|
|
101
|
+
vCentered?: boolean;
|
|
102
|
+
hCentered?: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface JustifyProps {
|
|
106
|
+
justifyStart?: boolean;
|
|
107
|
+
justifyEnd?: boolean;
|
|
108
|
+
justifyCenter?: boolean;
|
|
109
|
+
justifyBetween?: boolean;
|
|
110
|
+
justifyAround?: boolean;
|
|
111
|
+
justifyEvenly?: boolean;
|
|
112
|
+
justifyStretch?: boolean;
|
|
113
|
+
justifyBaseline?: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type BaseComponentProps = TagProps & Partial<SizeProps & HideProps & PositionProps> & React.HTMLProps<HTMLElement>;
|
|
117
|
+
|
|
118
|
+
export type LayoutComponentProps = BaseComponentProps & ReverseProps & CenteredProps;
|
|
119
|
+
|
|
120
|
+
export type FontProps = FontWeightProps & FontStyleProps & TextDecorationProps & TextTransformProps & FontFamilyProps & TextAppearanceProps & CommonAppearanceProps;
|
|
121
|
+
|
|
122
|
+
export type TypographyComponentProps = BaseComponentProps & FontProps;
|
|
123
|
+
|
|
124
|
+
export type GridProps = BaseComponentProps & GapProps;
|
|
125
|
+
|
|
126
|
+
export type RowProps = BaseComponentProps & GapProps & ReverseProps & CenteredProps & BreakpointProps & JustifyProps;
|
|
127
|
+
|
|
128
|
+
export type ColProps = BaseComponentProps & GapProps & ReverseProps & CenteredProps;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CommonAppearanceProps, FontFamilyProps, FontStyleProps, FontWeightProps, TextAppearanceProps, TextDecorationProps, TextTransformProps } from "./props";
|
|
2
|
+
|
|
3
|
+
export type CommonAppearanceSettings = { [key in keyof CommonAppearanceProps]: boolean; };
|
|
4
|
+
|
|
5
|
+
export type FontFamilySettings = { [key in keyof FontFamilyProps]: boolean; };
|
|
6
|
+
export type FontWeightSettings = { [key in keyof FontWeightProps]: boolean; };
|
|
7
|
+
export type FontStyleSettings = { [key in keyof FontStyleProps]: boolean; };
|
|
8
|
+
export type TextAppearanceSettings = { [key in keyof TextAppearanceProps & CommonAppearanceProps]: boolean; };
|
|
9
|
+
export type TextDecorationSettings = { [key in keyof TextDecorationProps]: boolean; };
|
|
10
|
+
export type TextTransformSettings = { [key in keyof TextTransformProps]: boolean; };
|
|
11
|
+
|
|
12
|
+
export type TypographySettings = {
|
|
13
|
+
fontFamily?: FontFamilySettings;
|
|
14
|
+
fontWeight?: FontWeightSettings;
|
|
15
|
+
fontStyle?: FontStyleSettings;
|
|
16
|
+
textAppearance?: TextAppearanceSettings;
|
|
17
|
+
textDecoration?: TextDecorationSettings;
|
|
18
|
+
textTransform?: TextTransformSettings;
|
|
19
|
+
};
|