@korsolutions/ui 0.0.11 → 0.0.13
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 +2 -0
- package/dist/components/index.d.mts +70 -15
- package/dist/components/index.mjs +269 -38
- package/dist/{index-Cq_-PiOm.d.mts → index-_E4x_kNB.d.mts} +95 -6
- package/dist/index.d.mts +5 -3
- package/dist/index.mjs +1 -1
- package/dist/primitives/index.d.mts +2 -2
- package/dist/primitives/index.mjs +2 -2
- package/dist/{primitives-C2enZ5Ku.mjs → primitives-DQMWXbuX.mjs} +121 -4
- package/dist/{themes-D5iq6sfL.mjs → themes-DXcjBdO2.mjs} +4 -2
- package/package.json +7 -4
- package/src/components/avatar/avatar.tsx +23 -0
- package/src/components/avatar/variants/default.tsx +30 -0
- package/src/components/avatar/variants/index.ts +5 -0
- package/src/components/button/variants/default.tsx +9 -3
- package/src/components/button/variants/index.ts +2 -0
- package/src/components/button/variants/secondary.tsx +58 -0
- package/src/components/card/variants/default.tsx +2 -2
- package/src/components/empty/empty.tsx +26 -0
- package/src/components/empty/variants/default.tsx +35 -0
- package/src/components/empty/variants/index.ts +5 -0
- package/src/components/field/variants/default.tsx +4 -4
- package/src/components/index.ts +3 -1
- package/src/components/input/variants/default.tsx +2 -1
- package/src/components/link/variants/default.tsx +2 -2
- package/src/components/select/variants/default.tsx +4 -4
- package/src/components/typography/typography.tsx +13 -0
- package/src/components/typography/variants/body-lg.tsx +13 -0
- package/src/components/{text/variants/default.tsx → typography/variants/body-md.tsx} +3 -3
- package/src/components/typography/variants/body-sm.tsx +13 -0
- package/src/components/typography/variants/heading-lg.tsx +14 -0
- package/src/components/typography/variants/heading-md.tsx +14 -0
- package/src/components/typography/variants/heading-sm.tsx +14 -0
- package/src/components/typography/variants/index.ts +15 -0
- package/src/primitives/avatar/avatar-fallback.tsx +16 -0
- package/src/primitives/avatar/avatar-image.tsx +17 -0
- package/src/primitives/avatar/avatar-root.tsx +21 -0
- package/src/primitives/avatar/context.ts +16 -0
- package/src/primitives/avatar/index.ts +14 -0
- package/src/primitives/avatar/types.ts +9 -0
- package/src/primitives/button/button-root.tsx +9 -4
- package/src/primitives/button/types.ts +1 -1
- package/src/primitives/empty/context.ts +16 -0
- package/src/primitives/empty/empty-description.tsx +16 -0
- package/src/primitives/empty/empty-media.tsx +16 -0
- package/src/primitives/empty/empty-root.tsx +21 -0
- package/src/primitives/empty/empty-title.tsx +16 -0
- package/src/primitives/empty/index.ts +17 -0
- package/src/primitives/empty/types.ts +11 -0
- package/src/primitives/index.ts +2 -0
- package/src/themes/default/index.ts +1 -0
- package/src/themes/provider.tsx +3 -1
- package/src/themes/types.ts +2 -0
- package/src/utils/hsla-utils.ts +26 -0
- package/src/utils/use-themed-styles.ts +3 -1
- package/tsconfig.json +1 -0
- package/src/components/text/text.tsx +0 -13
- package/src/components/text/variants/index.ts +0 -5
package/README.md
ADDED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as FieldStyles, C as SelectStyles, F as InputPrimitiveBaseProps, L as InputStyles, M as ButtonStyles, c as EmptyStyles, m as CardStyles, r as AvatarStyles, x as SelectRootBaseProps } from "../index-_E4x_kNB.mjs";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ImageSource, TextProps, TextStyle } from "react-native";
|
|
4
4
|
|
|
5
5
|
//#region src/components/button/variants/index.d.ts
|
|
6
6
|
declare const ButtonVariants: {
|
|
7
7
|
default: () => ButtonStyles;
|
|
8
|
+
secondary: () => ButtonStyles;
|
|
8
9
|
};
|
|
9
10
|
//#endregion
|
|
10
11
|
//#region src/components/button/button.d.ts
|
|
@@ -34,11 +35,11 @@ interface CardProps {
|
|
|
34
35
|
declare function Card(props: CardProps): React.JSX.Element;
|
|
35
36
|
//#endregion
|
|
36
37
|
//#region src/components/input/variants/default.d.ts
|
|
37
|
-
declare function useInputVariantDefault
|
|
38
|
+
declare function useInputVariantDefault(): InputStyles;
|
|
38
39
|
//#endregion
|
|
39
40
|
//#region src/components/input/variants/index.d.ts
|
|
40
41
|
declare const InputVariants: {
|
|
41
|
-
default: typeof useInputVariantDefault
|
|
42
|
+
default: typeof useInputVariantDefault;
|
|
42
43
|
};
|
|
43
44
|
//#endregion
|
|
44
45
|
//#region src/components/input/input.d.ts
|
|
@@ -82,19 +83,39 @@ interface SelectProps<T> extends SelectRootBaseProps {
|
|
|
82
83
|
}
|
|
83
84
|
declare function Select<T>(props: SelectProps<T>): React.JSX.Element;
|
|
84
85
|
//#endregion
|
|
85
|
-
//#region src/components/
|
|
86
|
-
declare function
|
|
86
|
+
//#region src/components/typography/variants/body-lg.d.ts
|
|
87
|
+
declare function useTextVariantBodyLg(): TextStyle;
|
|
87
88
|
//#endregion
|
|
88
|
-
//#region src/components/
|
|
89
|
-
declare
|
|
90
|
-
|
|
89
|
+
//#region src/components/typography/variants/body-md.d.ts
|
|
90
|
+
declare function useTextVariantBodyMd(): TextStyle;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/components/typography/variants/body-sm.d.ts
|
|
93
|
+
declare function useTextVariantBodySm(): TextStyle;
|
|
94
|
+
//#endregion
|
|
95
|
+
//#region src/components/typography/variants/heading-lg.d.ts
|
|
96
|
+
declare function useTextVariantHeadingLg(): TextStyle;
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/components/typography/variants/heading-md.d.ts
|
|
99
|
+
declare function useTextVariantHeadingMd(): TextStyle;
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region src/components/typography/variants/heading-sm.d.ts
|
|
102
|
+
declare function useTextVariantHeadingSm(): TextStyle;
|
|
103
|
+
//#endregion
|
|
104
|
+
//#region src/components/typography/variants/index.d.ts
|
|
105
|
+
declare const TypographyVariants: {
|
|
106
|
+
"body-sm": typeof useTextVariantBodySm;
|
|
107
|
+
"body-md": typeof useTextVariantBodyMd;
|
|
108
|
+
"body-lg": typeof useTextVariantBodyLg;
|
|
109
|
+
"heading-sm": typeof useTextVariantHeadingSm;
|
|
110
|
+
"heading-md": typeof useTextVariantHeadingMd;
|
|
111
|
+
"heading-lg": typeof useTextVariantHeadingLg;
|
|
91
112
|
};
|
|
92
113
|
//#endregion
|
|
93
|
-
//#region src/components/
|
|
94
|
-
interface
|
|
95
|
-
variant?: keyof typeof
|
|
114
|
+
//#region src/components/typography/typography.d.ts
|
|
115
|
+
interface TypographyProps extends TextProps {
|
|
116
|
+
variant?: keyof typeof TypographyVariants;
|
|
96
117
|
}
|
|
97
|
-
declare function
|
|
118
|
+
declare function Typography(props: TypographyProps): React.JSX.Element;
|
|
98
119
|
//#endregion
|
|
99
120
|
//#region src/components/link/variants/default.d.ts
|
|
100
121
|
declare function useLinkVariantDefault(): TextStyle;
|
|
@@ -105,10 +126,44 @@ declare const LinkVariants: {
|
|
|
105
126
|
};
|
|
106
127
|
//#endregion
|
|
107
128
|
//#region src/components/link/link.d.ts
|
|
108
|
-
interface LinkProps extends TextProps
|
|
129
|
+
interface LinkProps extends TextProps {
|
|
109
130
|
href?: string;
|
|
110
131
|
variant?: keyof typeof LinkVariants;
|
|
111
132
|
}
|
|
112
133
|
declare function Link(props: LinkProps): React.JSX.Element;
|
|
113
134
|
//#endregion
|
|
114
|
-
|
|
135
|
+
//#region src/components/empty/variants/default.d.ts
|
|
136
|
+
declare function useEmptyVariantDefault(): EmptyStyles;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/components/empty/variants/index.d.ts
|
|
139
|
+
declare const EmptyVariants: {
|
|
140
|
+
default: typeof useEmptyVariantDefault;
|
|
141
|
+
};
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/components/empty/empty.d.ts
|
|
144
|
+
interface EmptyProps {
|
|
145
|
+
children?: React.ReactNode;
|
|
146
|
+
media?: React.ReactNode;
|
|
147
|
+
title: string;
|
|
148
|
+
description?: string;
|
|
149
|
+
variant?: keyof typeof EmptyVariants;
|
|
150
|
+
}
|
|
151
|
+
declare function Empty(props: EmptyProps): React.JSX.Element;
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/components/avatar/variants/default.d.ts
|
|
154
|
+
declare function useAvatarVariantDefault(): AvatarStyles;
|
|
155
|
+
//#endregion
|
|
156
|
+
//#region src/components/avatar/variants/index.d.ts
|
|
157
|
+
declare const AvatarVariants: {
|
|
158
|
+
default: typeof useAvatarVariantDefault;
|
|
159
|
+
};
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/components/avatar/avatar.d.ts
|
|
162
|
+
interface AvatarProps {
|
|
163
|
+
source?: ImageSource;
|
|
164
|
+
fallback: string;
|
|
165
|
+
variant?: keyof typeof AvatarVariants;
|
|
166
|
+
}
|
|
167
|
+
declare function Avatar(props: AvatarProps): React.JSX.Element;
|
|
168
|
+
//#endregion
|
|
169
|
+
export { Avatar, AvatarProps, Button, Card, Empty, EmptyProps, Field, FieldProps, Input, Link, LinkProps, Select, SelectOption, SelectProps, Typography, TypographyProps };
|
|
@@ -1,10 +1,29 @@
|
|
|
1
|
-
import { n as useTheme } from "../themes-
|
|
1
|
+
import { n as useTheme } from "../themes-DXcjBdO2.mjs";
|
|
2
2
|
import "../portal-DoPaAohb.mjs";
|
|
3
|
-
import { a as
|
|
4
|
-
import React from "react";
|
|
5
|
-
import { Linking, Text
|
|
3
|
+
import { a as ButtonPrimitive, i as SelectPrimitive, n as EmptyPrimitive, o as InputPrimitive, r as CardPrimitive, s as FieldPrimitive, t as AvatarPrimitive } from "../primitives-DQMWXbuX.mjs";
|
|
4
|
+
import React, { useState } from "react";
|
|
5
|
+
import { Linking, Text } from "react-native";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
|
+
//#region src/utils/hsla-utils.ts
|
|
9
|
+
const hslaSetLightness = (hsla, lightness) => {
|
|
10
|
+
const parts = hsla.replace(/^hsla?\(|\s+|\)$/g, "").split(",");
|
|
11
|
+
if (parts.length < 3) throw new Error("Invalid HSLA color format");
|
|
12
|
+
return `hsla(${parseInt(parts[0], 10)}, ${parseInt(parts[1], 10)}%, ${lightness}%, ${parts[3] ? parseFloat(parts[3]) : 1})`;
|
|
13
|
+
};
|
|
14
|
+
const hslaGetLightness = (hsla) => {
|
|
15
|
+
const parts = hsla.replace(/^hsla?\(|\s+|\)$/g, "").split(",");
|
|
16
|
+
if (parts.length < 3) throw new Error("Invalid HSLA color format");
|
|
17
|
+
return parseInt(parts[2], 10);
|
|
18
|
+
};
|
|
19
|
+
const hslaSetRelativeLightness = (hsla, delta) => {
|
|
20
|
+
let newLightness = hslaGetLightness(hsla) + delta;
|
|
21
|
+
if (newLightness > 100) newLightness = 100;
|
|
22
|
+
if (newLightness < 0) newLightness = 0;
|
|
23
|
+
return hslaSetLightness(hsla, newLightness);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
8
27
|
//#region src/utils/use-themed-styles.ts
|
|
9
28
|
const useThemedStyles = (callback) => {
|
|
10
29
|
const theme = useTheme();
|
|
@@ -12,32 +31,75 @@ const useThemedStyles = (callback) => {
|
|
|
12
31
|
colors: theme.colors,
|
|
13
32
|
radius: theme.radius,
|
|
14
33
|
fontFamily: theme.fontFamily,
|
|
15
|
-
letterSpacing: theme.letterSpacing
|
|
34
|
+
letterSpacing: theme.letterSpacing,
|
|
35
|
+
fontSize: theme.fontSize
|
|
16
36
|
});
|
|
17
37
|
};
|
|
18
38
|
|
|
19
39
|
//#endregion
|
|
20
40
|
//#region src/components/button/variants/default.tsx
|
|
21
41
|
const useButtonVariantDefault = () => {
|
|
22
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
42
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
23
43
|
root: {
|
|
24
44
|
default: {
|
|
25
45
|
flexDirection: "row",
|
|
26
|
-
backgroundColor: colors.primary,
|
|
27
46
|
paddingVertical: 12,
|
|
28
47
|
paddingHorizontal: 16,
|
|
29
48
|
borderRadius: radius,
|
|
30
49
|
gap: 8,
|
|
31
50
|
alignItems: "center",
|
|
32
|
-
justifyContent: "center"
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
backgroundColor: colors.primary,
|
|
53
|
+
borderWidth: 1,
|
|
54
|
+
borderColor: colors.border
|
|
33
55
|
},
|
|
34
56
|
disabled: { opacity: .5 },
|
|
35
|
-
loading: { opacity: .8 }
|
|
57
|
+
loading: { opacity: .8 },
|
|
58
|
+
hovered: { backgroundColor: hslaSetRelativeLightness(colors.primary, -10) }
|
|
36
59
|
},
|
|
37
60
|
label: {
|
|
38
61
|
default: {
|
|
39
62
|
color: colors.primaryForeground,
|
|
40
|
-
fontSize
|
|
63
|
+
fontSize,
|
|
64
|
+
fontWeight: "bold",
|
|
65
|
+
fontFamily
|
|
66
|
+
},
|
|
67
|
+
disabled: { color: colors.mutedForeground },
|
|
68
|
+
loading: { color: colors.mutedForeground }
|
|
69
|
+
},
|
|
70
|
+
spinner: {
|
|
71
|
+
default: { color: colors.primaryForeground },
|
|
72
|
+
disabled: { color: colors.mutedForeground },
|
|
73
|
+
loading: { color: colors.mutedForeground }
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/components/button/variants/secondary.tsx
|
|
80
|
+
const useButtonVariantSecondary = () => {
|
|
81
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
82
|
+
root: {
|
|
83
|
+
default: {
|
|
84
|
+
flexDirection: "row",
|
|
85
|
+
paddingVertical: 12,
|
|
86
|
+
paddingHorizontal: 16,
|
|
87
|
+
borderRadius: radius,
|
|
88
|
+
gap: 8,
|
|
89
|
+
alignItems: "center",
|
|
90
|
+
justifyContent: "center",
|
|
91
|
+
borderWidth: 1,
|
|
92
|
+
borderColor: colors.border,
|
|
93
|
+
backgroundColor: colors.secondary
|
|
94
|
+
},
|
|
95
|
+
disabled: { opacity: .5 },
|
|
96
|
+
loading: { opacity: .8 },
|
|
97
|
+
hovered: { backgroundColor: hslaSetRelativeLightness(colors.secondary, -1) }
|
|
98
|
+
},
|
|
99
|
+
label: {
|
|
100
|
+
default: {
|
|
101
|
+
color: colors.foreground,
|
|
102
|
+
fontSize,
|
|
41
103
|
fontWeight: "bold",
|
|
42
104
|
fontFamily
|
|
43
105
|
},
|
|
@@ -54,7 +116,10 @@ const useButtonVariantDefault = () => {
|
|
|
54
116
|
|
|
55
117
|
//#endregion
|
|
56
118
|
//#region src/components/button/variants/index.ts
|
|
57
|
-
const ButtonVariants = {
|
|
119
|
+
const ButtonVariants = {
|
|
120
|
+
default: useButtonVariantDefault,
|
|
121
|
+
secondary: useButtonVariantSecondary
|
|
122
|
+
};
|
|
58
123
|
|
|
59
124
|
//#endregion
|
|
60
125
|
//#region src/components/button/button.tsx
|
|
@@ -72,7 +137,7 @@ function Button(props) {
|
|
|
72
137
|
//#endregion
|
|
73
138
|
//#region src/components/card/variants/default.tsx
|
|
74
139
|
function useCardVariantDefault() {
|
|
75
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
140
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
76
141
|
root: { default: {
|
|
77
142
|
borderWidth: 1,
|
|
78
143
|
borderColor: colors.border,
|
|
@@ -84,7 +149,7 @@ function useCardVariantDefault() {
|
|
|
84
149
|
header: { default: { paddingHorizontal: 24 } },
|
|
85
150
|
title: { default: {
|
|
86
151
|
fontFamily,
|
|
87
|
-
fontSize:
|
|
152
|
+
fontSize: fontSize * 1.25,
|
|
88
153
|
fontWeight: "600",
|
|
89
154
|
color: colors.foreground
|
|
90
155
|
} },
|
|
@@ -112,8 +177,8 @@ function Card(props) {
|
|
|
112
177
|
|
|
113
178
|
//#endregion
|
|
114
179
|
//#region src/components/input/variants/default.tsx
|
|
115
|
-
function useInputVariantDefault
|
|
116
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
180
|
+
function useInputVariantDefault() {
|
|
181
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
117
182
|
default: {
|
|
118
183
|
placeholderTextColor: colors.mutedForeground,
|
|
119
184
|
selectionColor: colors.primary,
|
|
@@ -126,6 +191,7 @@ function useInputVariantDefault$1() {
|
|
|
126
191
|
paddingHorizontal: 16,
|
|
127
192
|
outlineWidth: 0,
|
|
128
193
|
fontFamily,
|
|
194
|
+
fontSize,
|
|
129
195
|
height: 48,
|
|
130
196
|
color: colors.foreground
|
|
131
197
|
}
|
|
@@ -140,7 +206,7 @@ function useInputVariantDefault$1() {
|
|
|
140
206
|
|
|
141
207
|
//#endregion
|
|
142
208
|
//#region src/components/input/variants/index.ts
|
|
143
|
-
const InputVariants = { default: useInputVariantDefault
|
|
209
|
+
const InputVariants = { default: useInputVariantDefault };
|
|
144
210
|
|
|
145
211
|
//#endregion
|
|
146
212
|
//#region src/components/input/input.tsx
|
|
@@ -156,25 +222,25 @@ function Input(props) {
|
|
|
156
222
|
//#endregion
|
|
157
223
|
//#region src/components/field/variants/default.tsx
|
|
158
224
|
const useFieldVariantDefault = () => {
|
|
159
|
-
return useThemedStyles(({ colors, fontFamily }) => ({
|
|
225
|
+
return useThemedStyles(({ colors, fontFamily, fontSize }) => ({
|
|
160
226
|
root: {
|
|
161
227
|
flexDirection: "column",
|
|
162
228
|
gap: 8
|
|
163
229
|
},
|
|
164
230
|
label: {
|
|
165
231
|
fontFamily,
|
|
166
|
-
fontSize:
|
|
232
|
+
fontSize: fontSize * .875,
|
|
167
233
|
fontWeight: "600",
|
|
168
234
|
color: colors.foreground
|
|
169
235
|
},
|
|
170
236
|
description: {
|
|
171
237
|
fontFamily,
|
|
172
|
-
fontSize:
|
|
238
|
+
fontSize: fontSize * .875,
|
|
173
239
|
color: colors.mutedForeground
|
|
174
240
|
},
|
|
175
241
|
error: {
|
|
176
242
|
fontFamily,
|
|
177
|
-
fontSize:
|
|
243
|
+
fontSize: fontSize * .875,
|
|
178
244
|
color: colors.danger
|
|
179
245
|
}
|
|
180
246
|
}));
|
|
@@ -206,7 +272,7 @@ function Field(props) {
|
|
|
206
272
|
//#endregion
|
|
207
273
|
//#region src/components/select/variants/default.tsx
|
|
208
274
|
function useSelectVariantDefault() {
|
|
209
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
275
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
210
276
|
root: {
|
|
211
277
|
default: {},
|
|
212
278
|
disabled: {}
|
|
@@ -226,7 +292,7 @@ function useSelectVariantDefault() {
|
|
|
226
292
|
value: {
|
|
227
293
|
default: {
|
|
228
294
|
fontFamily,
|
|
229
|
-
fontSize
|
|
295
|
+
fontSize,
|
|
230
296
|
color: colors.foreground
|
|
231
297
|
},
|
|
232
298
|
disabled: { color: colors.mutedForeground }
|
|
@@ -234,7 +300,7 @@ function useSelectVariantDefault() {
|
|
|
234
300
|
placeholder: {
|
|
235
301
|
default: {
|
|
236
302
|
fontFamily,
|
|
237
|
-
fontSize
|
|
303
|
+
fontSize,
|
|
238
304
|
color: colors.mutedForeground
|
|
239
305
|
},
|
|
240
306
|
disabled: { color: colors.mutedForeground }
|
|
@@ -259,7 +325,7 @@ function useSelectVariantDefault() {
|
|
|
259
325
|
paddingVertical: 12,
|
|
260
326
|
paddingHorizontal: 16,
|
|
261
327
|
fontFamily,
|
|
262
|
-
fontSize
|
|
328
|
+
fontSize,
|
|
263
329
|
color: colors.foreground,
|
|
264
330
|
borderRadius: radius / 2
|
|
265
331
|
},
|
|
@@ -290,26 +356,91 @@ function Select(props) {
|
|
|
290
356
|
}
|
|
291
357
|
|
|
292
358
|
//#endregion
|
|
293
|
-
//#region src/components/
|
|
294
|
-
function
|
|
295
|
-
return useThemedStyles(({ colors, fontFamily, letterSpacing }) => ({
|
|
359
|
+
//#region src/components/typography/variants/body-lg.tsx
|
|
360
|
+
function useTextVariantBodyLg() {
|
|
361
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
296
362
|
color: colors.foreground,
|
|
297
|
-
fontSize:
|
|
363
|
+
fontSize: fontSize * 1.25,
|
|
298
364
|
fontFamily,
|
|
299
365
|
letterSpacing
|
|
300
366
|
}));
|
|
301
367
|
}
|
|
302
368
|
|
|
303
369
|
//#endregion
|
|
304
|
-
//#region src/components/
|
|
305
|
-
|
|
370
|
+
//#region src/components/typography/variants/body-md.tsx
|
|
371
|
+
function useTextVariantBodyMd() {
|
|
372
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
373
|
+
color: colors.foreground,
|
|
374
|
+
fontSize,
|
|
375
|
+
fontFamily,
|
|
376
|
+
letterSpacing
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
//#endregion
|
|
381
|
+
//#region src/components/typography/variants/body-sm.tsx
|
|
382
|
+
function useTextVariantBodySm() {
|
|
383
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
384
|
+
color: colors.foreground,
|
|
385
|
+
fontSize: fontSize * .875,
|
|
386
|
+
fontFamily,
|
|
387
|
+
letterSpacing
|
|
388
|
+
}));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region src/components/typography/variants/heading-lg.tsx
|
|
393
|
+
function useTextVariantHeadingLg() {
|
|
394
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
395
|
+
color: colors.foreground,
|
|
396
|
+
fontSize: fontSize * 1.5,
|
|
397
|
+
fontFamily,
|
|
398
|
+
letterSpacing,
|
|
399
|
+
fontWeight: "600"
|
|
400
|
+
}));
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/components/typography/variants/heading-md.tsx
|
|
405
|
+
function useTextVariantHeadingMd() {
|
|
406
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
407
|
+
color: colors.foreground,
|
|
408
|
+
fontSize: fontSize * 1.25,
|
|
409
|
+
fontFamily,
|
|
410
|
+
letterSpacing,
|
|
411
|
+
fontWeight: "600"
|
|
412
|
+
}));
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/components/typography/variants/heading-sm.tsx
|
|
417
|
+
function useTextVariantHeadingSm() {
|
|
418
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
419
|
+
color: colors.foreground,
|
|
420
|
+
fontSize,
|
|
421
|
+
fontFamily,
|
|
422
|
+
letterSpacing,
|
|
423
|
+
fontWeight: "600"
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
//#endregion
|
|
428
|
+
//#region src/components/typography/variants/index.ts
|
|
429
|
+
const TypographyVariants = {
|
|
430
|
+
["body-sm"]: useTextVariantBodySm,
|
|
431
|
+
["body-md"]: useTextVariantBodyMd,
|
|
432
|
+
["body-lg"]: useTextVariantBodyLg,
|
|
433
|
+
["heading-sm"]: useTextVariantHeadingSm,
|
|
434
|
+
["heading-md"]: useTextVariantHeadingMd,
|
|
435
|
+
["heading-lg"]: useTextVariantHeadingLg
|
|
436
|
+
};
|
|
306
437
|
|
|
307
438
|
//#endregion
|
|
308
|
-
//#region src/components/
|
|
309
|
-
function
|
|
310
|
-
const useVariantStyles =
|
|
439
|
+
//#region src/components/typography/typography.tsx
|
|
440
|
+
function Typography(props) {
|
|
441
|
+
const useVariantStyles = TypographyVariants[props.variant ?? "body-md"];
|
|
311
442
|
const variantStyles = useVariantStyles();
|
|
312
|
-
return /* @__PURE__ */ jsx(Text
|
|
443
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
313
444
|
...props,
|
|
314
445
|
style: variantStyles
|
|
315
446
|
});
|
|
@@ -318,9 +449,9 @@ function Text(props) {
|
|
|
318
449
|
//#endregion
|
|
319
450
|
//#region src/components/link/variants/default.tsx
|
|
320
451
|
function useLinkVariantDefault() {
|
|
321
|
-
return useThemedStyles(({ colors, fontFamily, letterSpacing }) => ({
|
|
452
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
322
453
|
color: colors.primary,
|
|
323
|
-
fontSize
|
|
454
|
+
fontSize,
|
|
324
455
|
fontFamily,
|
|
325
456
|
textDecorationLine: "underline",
|
|
326
457
|
letterSpacing
|
|
@@ -342,7 +473,7 @@ function Link(props) {
|
|
|
342
473
|
}
|
|
343
474
|
props.onPress?.(e);
|
|
344
475
|
};
|
|
345
|
-
return /* @__PURE__ */ jsx(Text
|
|
476
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
346
477
|
...props,
|
|
347
478
|
style: variantStyles,
|
|
348
479
|
onPress: handlePress
|
|
@@ -350,4 +481,104 @@ function Link(props) {
|
|
|
350
481
|
}
|
|
351
482
|
|
|
352
483
|
//#endregion
|
|
353
|
-
|
|
484
|
+
//#region src/components/empty/variants/default.tsx
|
|
485
|
+
function useEmptyVariantDefault() {
|
|
486
|
+
return useThemedStyles(({ colors, fontFamily, fontSize }) => ({
|
|
487
|
+
root: {
|
|
488
|
+
alignItems: "center",
|
|
489
|
+
padding: 32,
|
|
490
|
+
gap: 32
|
|
491
|
+
},
|
|
492
|
+
media: {
|
|
493
|
+
backgroundColor: colors.muted,
|
|
494
|
+
width: 64,
|
|
495
|
+
height: 64,
|
|
496
|
+
borderRadius: "50%",
|
|
497
|
+
alignItems: "center",
|
|
498
|
+
justifyContent: "center"
|
|
499
|
+
},
|
|
500
|
+
title: {
|
|
501
|
+
fontFamily,
|
|
502
|
+
fontSize,
|
|
503
|
+
color: colors.foreground,
|
|
504
|
+
textAlign: "center",
|
|
505
|
+
fontWeight: "600"
|
|
506
|
+
},
|
|
507
|
+
description: {
|
|
508
|
+
fontFamily,
|
|
509
|
+
fontSize: fontSize * .875,
|
|
510
|
+
color: colors.mutedForeground,
|
|
511
|
+
textAlign: "center"
|
|
512
|
+
}
|
|
513
|
+
}));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
//#endregion
|
|
517
|
+
//#region src/components/empty/variants/index.ts
|
|
518
|
+
const EmptyVariants = { default: useEmptyVariantDefault };
|
|
519
|
+
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region src/components/empty/empty.tsx
|
|
522
|
+
function Empty(props) {
|
|
523
|
+
const useVariantStyles = EmptyVariants[props.variant || "default"];
|
|
524
|
+
const styles = useVariantStyles();
|
|
525
|
+
return /* @__PURE__ */ jsxs(EmptyPrimitive.Root, {
|
|
526
|
+
styles,
|
|
527
|
+
children: [
|
|
528
|
+
!!props.media && /* @__PURE__ */ jsx(EmptyPrimitive.Media, { children: props.media }),
|
|
529
|
+
/* @__PURE__ */ jsx(EmptyPrimitive.Title, { children: props.title }),
|
|
530
|
+
props.description && /* @__PURE__ */ jsx(EmptyPrimitive.Description, { children: props.description }),
|
|
531
|
+
props.children
|
|
532
|
+
]
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
//#endregion
|
|
537
|
+
//#region src/components/avatar/variants/default.tsx
|
|
538
|
+
function useAvatarVariantDefault() {
|
|
539
|
+
return useThemedStyles(({ colors, fontFamily, fontSize }) => ({
|
|
540
|
+
root: {
|
|
541
|
+
backgroundColor: colors.surface,
|
|
542
|
+
borderRadius: "50%",
|
|
543
|
+
overflow: "hidden",
|
|
544
|
+
width: 64,
|
|
545
|
+
height: 64,
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
justifyContent: "center"
|
|
548
|
+
},
|
|
549
|
+
image: {
|
|
550
|
+
width: "100%",
|
|
551
|
+
height: "100%",
|
|
552
|
+
resizeMode: "cover"
|
|
553
|
+
},
|
|
554
|
+
fallback: {
|
|
555
|
+
fontFamily,
|
|
556
|
+
fontSize,
|
|
557
|
+
color: colors.foreground,
|
|
558
|
+
textAlign: "center",
|
|
559
|
+
verticalAlign: "middle"
|
|
560
|
+
}
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
//#endregion
|
|
565
|
+
//#region src/components/avatar/variants/index.ts
|
|
566
|
+
const AvatarVariants = { default: useAvatarVariantDefault };
|
|
567
|
+
|
|
568
|
+
//#endregion
|
|
569
|
+
//#region src/components/avatar/avatar.tsx
|
|
570
|
+
function Avatar(props) {
|
|
571
|
+
const useVariantStyles = AvatarVariants[props.variant || "default"];
|
|
572
|
+
const styles = useVariantStyles();
|
|
573
|
+
const [imageError, setImageError] = useState(false);
|
|
574
|
+
return /* @__PURE__ */ jsxs(AvatarPrimitive.Root, {
|
|
575
|
+
styles,
|
|
576
|
+
children: [props.source && /* @__PURE__ */ jsx(AvatarPrimitive.Image, {
|
|
577
|
+
source: props.source,
|
|
578
|
+
onError: () => setImageError(true)
|
|
579
|
+
}), (!props.source || imageError) && /* @__PURE__ */ jsx(AvatarPrimitive.Fallback, { children: props.fallback })]
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
//#endregion
|
|
584
|
+
export { Avatar, Button, Card, Empty, Field, Input, Link, Select, Typography };
|