@korsolutions/ui 0.0.11 → 0.0.12
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 +35 -15
- package/dist/components/index.mjs +99 -32
- package/dist/{index-Cq_-PiOm.d.mts → index-Dafk8ZGv.d.mts} +3 -3
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/primitives/index.d.mts +1 -1
- package/dist/{themes-D5iq6sfL.mjs → themes-DXcjBdO2.mjs} +4 -2
- package/package.json +1 -1
- package/src/components/button/variants/default.tsx +2 -2
- package/src/components/card/variants/default.tsx +2 -2
- package/src/components/field/variants/default.tsx +4 -4
- package/src/components/index.ts +1 -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/themes/default/index.ts +1 -0
- package/src/themes/provider.tsx +3 -1
- package/src/themes/types.ts +2 -0
- package/src/utils/use-themed-styles.ts +3 -1
- package/src/components/text/text.tsx +0 -13
- package/src/components/text/variants/index.ts +0 -5
package/README.md
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as InputStyles, f as SelectStyles, k as FieldStyles, r as CardStyles, u as SelectRootBaseProps, w as InputPrimitiveBaseProps, x as ButtonStyles } from "../index-
|
|
1
|
+
import { E as InputStyles, f as SelectStyles, k as FieldStyles, r as CardStyles, u as SelectRootBaseProps, w as InputPrimitiveBaseProps, x as ButtonStyles } from "../index-Dafk8ZGv.mjs";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { TextProps
|
|
3
|
+
import { TextProps, TextStyle } from "react-native";
|
|
4
4
|
|
|
5
5
|
//#region src/components/button/variants/index.d.ts
|
|
6
6
|
declare const ButtonVariants: {
|
|
@@ -34,11 +34,11 @@ interface CardProps {
|
|
|
34
34
|
declare function Card(props: CardProps): React.JSX.Element;
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/components/input/variants/default.d.ts
|
|
37
|
-
declare function useInputVariantDefault
|
|
37
|
+
declare function useInputVariantDefault(): InputStyles;
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/components/input/variants/index.d.ts
|
|
40
40
|
declare const InputVariants: {
|
|
41
|
-
default: typeof useInputVariantDefault
|
|
41
|
+
default: typeof useInputVariantDefault;
|
|
42
42
|
};
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/components/input/input.d.ts
|
|
@@ -82,19 +82,39 @@ interface SelectProps<T> extends SelectRootBaseProps {
|
|
|
82
82
|
}
|
|
83
83
|
declare function Select<T>(props: SelectProps<T>): React.JSX.Element;
|
|
84
84
|
//#endregion
|
|
85
|
-
//#region src/components/
|
|
86
|
-
declare function
|
|
85
|
+
//#region src/components/typography/variants/body-lg.d.ts
|
|
86
|
+
declare function useTextVariantBodyLg(): TextStyle;
|
|
87
87
|
//#endregion
|
|
88
|
-
//#region src/components/
|
|
89
|
-
declare
|
|
90
|
-
|
|
88
|
+
//#region src/components/typography/variants/body-md.d.ts
|
|
89
|
+
declare function useTextVariantBodyMd(): TextStyle;
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/components/typography/variants/body-sm.d.ts
|
|
92
|
+
declare function useTextVariantBodySm(): TextStyle;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/components/typography/variants/heading-lg.d.ts
|
|
95
|
+
declare function useTextVariantHeadingLg(): TextStyle;
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/components/typography/variants/heading-md.d.ts
|
|
98
|
+
declare function useTextVariantHeadingMd(): TextStyle;
|
|
99
|
+
//#endregion
|
|
100
|
+
//#region src/components/typography/variants/heading-sm.d.ts
|
|
101
|
+
declare function useTextVariantHeadingSm(): TextStyle;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/components/typography/variants/index.d.ts
|
|
104
|
+
declare const TypographyVariants: {
|
|
105
|
+
"body-sm": typeof useTextVariantBodySm;
|
|
106
|
+
"body-md": typeof useTextVariantBodyMd;
|
|
107
|
+
"body-lg": typeof useTextVariantBodyLg;
|
|
108
|
+
"heading-sm": typeof useTextVariantHeadingSm;
|
|
109
|
+
"heading-md": typeof useTextVariantHeadingMd;
|
|
110
|
+
"heading-lg": typeof useTextVariantHeadingLg;
|
|
91
111
|
};
|
|
92
112
|
//#endregion
|
|
93
|
-
//#region src/components/
|
|
94
|
-
interface
|
|
95
|
-
variant?: keyof typeof
|
|
113
|
+
//#region src/components/typography/typography.d.ts
|
|
114
|
+
interface TypographyProps extends TextProps {
|
|
115
|
+
variant?: keyof typeof TypographyVariants;
|
|
96
116
|
}
|
|
97
|
-
declare function
|
|
117
|
+
declare function Typography(props: TypographyProps): React.JSX.Element;
|
|
98
118
|
//#endregion
|
|
99
119
|
//#region src/components/link/variants/default.d.ts
|
|
100
120
|
declare function useLinkVariantDefault(): TextStyle;
|
|
@@ -105,10 +125,10 @@ declare const LinkVariants: {
|
|
|
105
125
|
};
|
|
106
126
|
//#endregion
|
|
107
127
|
//#region src/components/link/link.d.ts
|
|
108
|
-
interface LinkProps extends TextProps
|
|
128
|
+
interface LinkProps extends TextProps {
|
|
109
129
|
href?: string;
|
|
110
130
|
variant?: keyof typeof LinkVariants;
|
|
111
131
|
}
|
|
112
132
|
declare function Link(props: LinkProps): React.JSX.Element;
|
|
113
133
|
//#endregion
|
|
114
|
-
export { Button, Card, Field, FieldProps, Input, Link, LinkProps, Select, SelectOption, SelectProps,
|
|
134
|
+
export { Button, Card, Field, FieldProps, Input, Link, LinkProps, Select, SelectOption, SelectProps, Typography, TypographyProps };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as useTheme } from "../themes-
|
|
1
|
+
import { n as useTheme } from "../themes-DXcjBdO2.mjs";
|
|
2
2
|
import "../portal-DoPaAohb.mjs";
|
|
3
3
|
import { a as FieldPrimitive, i as InputPrimitive, n as SelectPrimitive, r as ButtonPrimitive, t as CardPrimitive } from "../primitives-C2enZ5Ku.mjs";
|
|
4
4
|
import React from "react";
|
|
5
|
-
import { Linking, Text
|
|
5
|
+
import { Linking, Text } from "react-native";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/utils/use-themed-styles.ts
|
|
@@ -12,14 +12,15 @@ const useThemedStyles = (callback) => {
|
|
|
12
12
|
colors: theme.colors,
|
|
13
13
|
radius: theme.radius,
|
|
14
14
|
fontFamily: theme.fontFamily,
|
|
15
|
-
letterSpacing: theme.letterSpacing
|
|
15
|
+
letterSpacing: theme.letterSpacing,
|
|
16
|
+
fontSize: theme.fontSize
|
|
16
17
|
});
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
//#endregion
|
|
20
21
|
//#region src/components/button/variants/default.tsx
|
|
21
22
|
const useButtonVariantDefault = () => {
|
|
22
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
23
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
23
24
|
root: {
|
|
24
25
|
default: {
|
|
25
26
|
flexDirection: "row",
|
|
@@ -37,7 +38,7 @@ const useButtonVariantDefault = () => {
|
|
|
37
38
|
label: {
|
|
38
39
|
default: {
|
|
39
40
|
color: colors.primaryForeground,
|
|
40
|
-
fontSize
|
|
41
|
+
fontSize,
|
|
41
42
|
fontWeight: "bold",
|
|
42
43
|
fontFamily
|
|
43
44
|
},
|
|
@@ -72,7 +73,7 @@ function Button(props) {
|
|
|
72
73
|
//#endregion
|
|
73
74
|
//#region src/components/card/variants/default.tsx
|
|
74
75
|
function useCardVariantDefault() {
|
|
75
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
76
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
76
77
|
root: { default: {
|
|
77
78
|
borderWidth: 1,
|
|
78
79
|
borderColor: colors.border,
|
|
@@ -84,7 +85,7 @@ function useCardVariantDefault() {
|
|
|
84
85
|
header: { default: { paddingHorizontal: 24 } },
|
|
85
86
|
title: { default: {
|
|
86
87
|
fontFamily,
|
|
87
|
-
fontSize:
|
|
88
|
+
fontSize: fontSize * 1.25,
|
|
88
89
|
fontWeight: "600",
|
|
89
90
|
color: colors.foreground
|
|
90
91
|
} },
|
|
@@ -112,8 +113,8 @@ function Card(props) {
|
|
|
112
113
|
|
|
113
114
|
//#endregion
|
|
114
115
|
//#region src/components/input/variants/default.tsx
|
|
115
|
-
function useInputVariantDefault
|
|
116
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
116
|
+
function useInputVariantDefault() {
|
|
117
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
117
118
|
default: {
|
|
118
119
|
placeholderTextColor: colors.mutedForeground,
|
|
119
120
|
selectionColor: colors.primary,
|
|
@@ -126,6 +127,7 @@ function useInputVariantDefault$1() {
|
|
|
126
127
|
paddingHorizontal: 16,
|
|
127
128
|
outlineWidth: 0,
|
|
128
129
|
fontFamily,
|
|
130
|
+
fontSize,
|
|
129
131
|
height: 48,
|
|
130
132
|
color: colors.foreground
|
|
131
133
|
}
|
|
@@ -140,7 +142,7 @@ function useInputVariantDefault$1() {
|
|
|
140
142
|
|
|
141
143
|
//#endregion
|
|
142
144
|
//#region src/components/input/variants/index.ts
|
|
143
|
-
const InputVariants = { default: useInputVariantDefault
|
|
145
|
+
const InputVariants = { default: useInputVariantDefault };
|
|
144
146
|
|
|
145
147
|
//#endregion
|
|
146
148
|
//#region src/components/input/input.tsx
|
|
@@ -156,25 +158,25 @@ function Input(props) {
|
|
|
156
158
|
//#endregion
|
|
157
159
|
//#region src/components/field/variants/default.tsx
|
|
158
160
|
const useFieldVariantDefault = () => {
|
|
159
|
-
return useThemedStyles(({ colors, fontFamily }) => ({
|
|
161
|
+
return useThemedStyles(({ colors, fontFamily, fontSize }) => ({
|
|
160
162
|
root: {
|
|
161
163
|
flexDirection: "column",
|
|
162
164
|
gap: 8
|
|
163
165
|
},
|
|
164
166
|
label: {
|
|
165
167
|
fontFamily,
|
|
166
|
-
fontSize:
|
|
168
|
+
fontSize: fontSize * .875,
|
|
167
169
|
fontWeight: "600",
|
|
168
170
|
color: colors.foreground
|
|
169
171
|
},
|
|
170
172
|
description: {
|
|
171
173
|
fontFamily,
|
|
172
|
-
fontSize:
|
|
174
|
+
fontSize: fontSize * .875,
|
|
173
175
|
color: colors.mutedForeground
|
|
174
176
|
},
|
|
175
177
|
error: {
|
|
176
178
|
fontFamily,
|
|
177
|
-
fontSize:
|
|
179
|
+
fontSize: fontSize * .875,
|
|
178
180
|
color: colors.danger
|
|
179
181
|
}
|
|
180
182
|
}));
|
|
@@ -206,7 +208,7 @@ function Field(props) {
|
|
|
206
208
|
//#endregion
|
|
207
209
|
//#region src/components/select/variants/default.tsx
|
|
208
210
|
function useSelectVariantDefault() {
|
|
209
|
-
return useThemedStyles(({ colors, radius, fontFamily }) => ({
|
|
211
|
+
return useThemedStyles(({ colors, radius, fontFamily, fontSize }) => ({
|
|
210
212
|
root: {
|
|
211
213
|
default: {},
|
|
212
214
|
disabled: {}
|
|
@@ -226,7 +228,7 @@ function useSelectVariantDefault() {
|
|
|
226
228
|
value: {
|
|
227
229
|
default: {
|
|
228
230
|
fontFamily,
|
|
229
|
-
fontSize
|
|
231
|
+
fontSize,
|
|
230
232
|
color: colors.foreground
|
|
231
233
|
},
|
|
232
234
|
disabled: { color: colors.mutedForeground }
|
|
@@ -234,7 +236,7 @@ function useSelectVariantDefault() {
|
|
|
234
236
|
placeholder: {
|
|
235
237
|
default: {
|
|
236
238
|
fontFamily,
|
|
237
|
-
fontSize
|
|
239
|
+
fontSize,
|
|
238
240
|
color: colors.mutedForeground
|
|
239
241
|
},
|
|
240
242
|
disabled: { color: colors.mutedForeground }
|
|
@@ -259,7 +261,7 @@ function useSelectVariantDefault() {
|
|
|
259
261
|
paddingVertical: 12,
|
|
260
262
|
paddingHorizontal: 16,
|
|
261
263
|
fontFamily,
|
|
262
|
-
fontSize
|
|
264
|
+
fontSize,
|
|
263
265
|
color: colors.foreground,
|
|
264
266
|
borderRadius: radius / 2
|
|
265
267
|
},
|
|
@@ -290,26 +292,91 @@ function Select(props) {
|
|
|
290
292
|
}
|
|
291
293
|
|
|
292
294
|
//#endregion
|
|
293
|
-
//#region src/components/
|
|
294
|
-
function
|
|
295
|
-
return useThemedStyles(({ colors, fontFamily, letterSpacing }) => ({
|
|
295
|
+
//#region src/components/typography/variants/body-lg.tsx
|
|
296
|
+
function useTextVariantBodyLg() {
|
|
297
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
298
|
+
color: colors.foreground,
|
|
299
|
+
fontSize: fontSize * 1.25,
|
|
300
|
+
fontFamily,
|
|
301
|
+
letterSpacing
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/components/typography/variants/body-md.tsx
|
|
307
|
+
function useTextVariantBodyMd() {
|
|
308
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
296
309
|
color: colors.foreground,
|
|
297
|
-
fontSize
|
|
310
|
+
fontSize,
|
|
298
311
|
fontFamily,
|
|
299
312
|
letterSpacing
|
|
300
313
|
}));
|
|
301
314
|
}
|
|
302
315
|
|
|
303
316
|
//#endregion
|
|
304
|
-
//#region src/components/
|
|
305
|
-
|
|
317
|
+
//#region src/components/typography/variants/body-sm.tsx
|
|
318
|
+
function useTextVariantBodySm() {
|
|
319
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
320
|
+
color: colors.foreground,
|
|
321
|
+
fontSize: fontSize * .875,
|
|
322
|
+
fontFamily,
|
|
323
|
+
letterSpacing
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
//#endregion
|
|
328
|
+
//#region src/components/typography/variants/heading-lg.tsx
|
|
329
|
+
function useTextVariantHeadingLg() {
|
|
330
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
331
|
+
color: colors.foreground,
|
|
332
|
+
fontSize: fontSize * 1.5,
|
|
333
|
+
fontFamily,
|
|
334
|
+
letterSpacing,
|
|
335
|
+
fontWeight: "600"
|
|
336
|
+
}));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
//#endregion
|
|
340
|
+
//#region src/components/typography/variants/heading-md.tsx
|
|
341
|
+
function useTextVariantHeadingMd() {
|
|
342
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
343
|
+
color: colors.foreground,
|
|
344
|
+
fontSize: fontSize * 1.25,
|
|
345
|
+
fontFamily,
|
|
346
|
+
letterSpacing,
|
|
347
|
+
fontWeight: "600"
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
//#endregion
|
|
352
|
+
//#region src/components/typography/variants/heading-sm.tsx
|
|
353
|
+
function useTextVariantHeadingSm() {
|
|
354
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
355
|
+
color: colors.foreground,
|
|
356
|
+
fontSize,
|
|
357
|
+
fontFamily,
|
|
358
|
+
letterSpacing,
|
|
359
|
+
fontWeight: "600"
|
|
360
|
+
}));
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
//#endregion
|
|
364
|
+
//#region src/components/typography/variants/index.ts
|
|
365
|
+
const TypographyVariants = {
|
|
366
|
+
["body-sm"]: useTextVariantBodySm,
|
|
367
|
+
["body-md"]: useTextVariantBodyMd,
|
|
368
|
+
["body-lg"]: useTextVariantBodyLg,
|
|
369
|
+
["heading-sm"]: useTextVariantHeadingSm,
|
|
370
|
+
["heading-md"]: useTextVariantHeadingMd,
|
|
371
|
+
["heading-lg"]: useTextVariantHeadingLg
|
|
372
|
+
};
|
|
306
373
|
|
|
307
374
|
//#endregion
|
|
308
|
-
//#region src/components/
|
|
309
|
-
function
|
|
310
|
-
const useVariantStyles =
|
|
375
|
+
//#region src/components/typography/typography.tsx
|
|
376
|
+
function Typography(props) {
|
|
377
|
+
const useVariantStyles = TypographyVariants[props.variant ?? "body-md"];
|
|
311
378
|
const variantStyles = useVariantStyles();
|
|
312
|
-
return /* @__PURE__ */ jsx(Text
|
|
379
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
313
380
|
...props,
|
|
314
381
|
style: variantStyles
|
|
315
382
|
});
|
|
@@ -318,9 +385,9 @@ function Text(props) {
|
|
|
318
385
|
//#endregion
|
|
319
386
|
//#region src/components/link/variants/default.tsx
|
|
320
387
|
function useLinkVariantDefault() {
|
|
321
|
-
return useThemedStyles(({ colors, fontFamily, letterSpacing }) => ({
|
|
388
|
+
return useThemedStyles(({ colors, fontFamily, letterSpacing, fontSize }) => ({
|
|
322
389
|
color: colors.primary,
|
|
323
|
-
fontSize
|
|
390
|
+
fontSize,
|
|
324
391
|
fontFamily,
|
|
325
392
|
textDecorationLine: "underline",
|
|
326
393
|
letterSpacing
|
|
@@ -342,7 +409,7 @@ function Link(props) {
|
|
|
342
409
|
}
|
|
343
410
|
props.onPress?.(e);
|
|
344
411
|
};
|
|
345
|
-
return /* @__PURE__ */ jsx(Text
|
|
412
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
346
413
|
...props,
|
|
347
414
|
style: variantStyles,
|
|
348
415
|
onPress: handlePress
|
|
@@ -350,4 +417,4 @@ function Link(props) {
|
|
|
350
417
|
}
|
|
351
418
|
|
|
352
419
|
//#endregion
|
|
353
|
-
export { Button, Card, Field, Input, Link, Select,
|
|
420
|
+
export { Button, Card, Field, Input, Link, Select, Typography };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react2 from "react";
|
|
2
2
|
import React$1 from "react";
|
|
3
3
|
import { StyleProp, TextInputProps, TextProps, TextStyle, ViewStyle } from "react-native";
|
|
4
4
|
|
|
@@ -65,7 +65,7 @@ interface InputPrimitiveProps extends InputPrimitiveBaseProps {
|
|
|
65
65
|
render?: (props: InputPrimitiveProps) => React.ReactNode;
|
|
66
66
|
styles?: InputStyles;
|
|
67
67
|
}
|
|
68
|
-
declare function InputPrimitive(props: InputPrimitiveProps):
|
|
68
|
+
declare function InputPrimitive(props: InputPrimitiveProps): react2.JSX.Element;
|
|
69
69
|
//#endregion
|
|
70
70
|
//#region src/primitives/button/button-label.d.ts
|
|
71
71
|
interface ButtonPrimitiveLabelProps {
|
|
@@ -152,7 +152,7 @@ interface SelectOptionProps {
|
|
|
152
152
|
render?: (props: SelectOptionProps) => React.ReactElement;
|
|
153
153
|
style?: StyleProp<TextStyle>;
|
|
154
154
|
}
|
|
155
|
-
declare function SelectOption(props: SelectOptionProps):
|
|
155
|
+
declare function SelectOption(props: SelectOptionProps): react2.JSX.Element;
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/primitives/select/types.d.ts
|
|
158
158
|
type SelectState = "default" | "disabled";
|
package/dist/index.d.mts
CHANGED
|
@@ -23,6 +23,7 @@ interface Colors {
|
|
|
23
23
|
type Radius = number;
|
|
24
24
|
type FontFamily = string;
|
|
25
25
|
type LetterSpacing = number;
|
|
26
|
+
type FontSize = number;
|
|
26
27
|
//#endregion
|
|
27
28
|
//#region src/themes/provider.d.ts
|
|
28
29
|
interface ThemeContext {
|
|
@@ -31,6 +32,7 @@ interface ThemeContext {
|
|
|
31
32
|
fontFamily: FontFamily;
|
|
32
33
|
colorScheme: ColorScheme;
|
|
33
34
|
letterSpacing: LetterSpacing;
|
|
35
|
+
fontSize: FontSize;
|
|
34
36
|
setColorScheme: (scheme: ColorScheme) => void;
|
|
35
37
|
setTheme: (themeName: ThemeName) => void;
|
|
36
38
|
themeName: ThemeName;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as FieldErrorProps, C as InputPrimitive, D as FieldPrimitive, E as InputStyles, M as FieldLabelProps, O as FieldPrimitiveRootProps, S as ButtonPrimitiveLabelProps, T as InputPrimitiveProps, _ as SelectTriggerProps, a as CardBodyProps, b as ButtonState, c as SelectPrimitive, d as SelectRootProps, f as SelectStyles, g as SelectValueProps, h as SelectOverlayProps, i as CardFooterProps, j as FieldDescriptionProps, k as FieldStyles, l as SelectPortalProps, m as SelectContentProps, n as CardRootProps, o as CardTitleProps, p as SelectOptionProps, r as CardStyles, s as CardHeaderProps, t as CardPrimitive, u as SelectRootBaseProps, v as ButtonPrimitive, w as InputPrimitiveBaseProps, x as ButtonStyles, y as ButtonPrimitiveRootProps } from "../index-
|
|
1
|
+
import { A as FieldErrorProps, C as InputPrimitive, D as FieldPrimitive, E as InputStyles, M as FieldLabelProps, O as FieldPrimitiveRootProps, S as ButtonPrimitiveLabelProps, T as InputPrimitiveProps, _ as SelectTriggerProps, a as CardBodyProps, b as ButtonState, c as SelectPrimitive, d as SelectRootProps, f as SelectStyles, g as SelectValueProps, h as SelectOverlayProps, i as CardFooterProps, j as FieldDescriptionProps, k as FieldStyles, l as SelectPortalProps, m as SelectContentProps, n as CardRootProps, o as CardTitleProps, p as SelectOptionProps, r as CardStyles, s as CardHeaderProps, t as CardPrimitive, u as SelectRootBaseProps, v as ButtonPrimitive, w as InputPrimitiveBaseProps, x as ButtonStyles, y as ButtonPrimitiveRootProps } from "../index-Dafk8ZGv.mjs";
|
|
2
2
|
export { ButtonPrimitive, ButtonPrimitiveLabelProps, ButtonPrimitiveRootProps, ButtonState, ButtonStyles, CardBodyProps, CardFooterProps, CardHeaderProps, CardPrimitive, CardRootProps, CardStyles, CardTitleProps, FieldDescriptionProps, FieldErrorProps, FieldLabelProps, FieldPrimitive, FieldPrimitiveRootProps, FieldStyles, InputPrimitive, InputPrimitiveBaseProps, InputPrimitiveProps, InputStyles, SelectContentProps, SelectOptionProps, SelectOverlayProps, SelectPortalProps, SelectPrimitive, SelectRootBaseProps, SelectRootProps, SelectStyles, SelectTriggerProps, SelectValueProps };
|
|
@@ -45,7 +45,8 @@ const defaultThemeAssets = {
|
|
|
45
45
|
},
|
|
46
46
|
radius: 10,
|
|
47
47
|
fontFamily: "System",
|
|
48
|
-
letterSpacing: 0
|
|
48
|
+
letterSpacing: 0,
|
|
49
|
+
fontSize: 16
|
|
49
50
|
};
|
|
50
51
|
|
|
51
52
|
//#endregion
|
|
@@ -73,7 +74,8 @@ const ThemeProvider = (props) => {
|
|
|
73
74
|
colors,
|
|
74
75
|
radius: themesAssets.radius,
|
|
75
76
|
fontFamily: themesAssets.fontFamily,
|
|
76
|
-
letterSpacing: themesAssets.letterSpacing
|
|
77
|
+
letterSpacing: themesAssets.letterSpacing,
|
|
78
|
+
fontSize: themesAssets.fontSize
|
|
77
79
|
},
|
|
78
80
|
children: props.children
|
|
79
81
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
|
3
3
|
|
|
4
4
|
export const useButtonVariantDefault = (): ButtonStyles => {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily }): ButtonStyles => ({
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): ButtonStyles => ({
|
|
7
7
|
root: {
|
|
8
8
|
default: {
|
|
9
9
|
flexDirection: "row",
|
|
@@ -25,7 +25,7 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
25
25
|
label: {
|
|
26
26
|
default: {
|
|
27
27
|
color: colors.primaryForeground,
|
|
28
|
-
fontSize
|
|
28
|
+
fontSize,
|
|
29
29
|
fontWeight: "bold",
|
|
30
30
|
fontFamily,
|
|
31
31
|
},
|
|
@@ -3,7 +3,7 @@ import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
|
3
3
|
|
|
4
4
|
export function useCardVariantDefault(): CardStyles {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily }): CardStyles => ({
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): CardStyles => ({
|
|
7
7
|
root: {
|
|
8
8
|
default: {
|
|
9
9
|
borderWidth: 1,
|
|
@@ -22,7 +22,7 @@ export function useCardVariantDefault(): CardStyles {
|
|
|
22
22
|
title: {
|
|
23
23
|
default: {
|
|
24
24
|
fontFamily,
|
|
25
|
-
fontSize:
|
|
25
|
+
fontSize: fontSize * 1.25,
|
|
26
26
|
fontWeight: "600",
|
|
27
27
|
color: colors.foreground,
|
|
28
28
|
},
|
|
@@ -3,25 +3,25 @@ import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
|
3
3
|
|
|
4
4
|
export const useFieldVariantDefault = (): FieldStyles => {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, fontFamily }): FieldStyles => ({
|
|
6
|
+
({ colors, fontFamily, fontSize }): FieldStyles => ({
|
|
7
7
|
root: {
|
|
8
8
|
flexDirection: "column",
|
|
9
9
|
gap: 8,
|
|
10
10
|
},
|
|
11
11
|
label: {
|
|
12
12
|
fontFamily,
|
|
13
|
-
fontSize:
|
|
13
|
+
fontSize: fontSize * 0.875,
|
|
14
14
|
fontWeight: "600",
|
|
15
15
|
color: colors.foreground,
|
|
16
16
|
},
|
|
17
17
|
description: {
|
|
18
18
|
fontFamily,
|
|
19
|
-
fontSize:
|
|
19
|
+
fontSize: fontSize * 0.875,
|
|
20
20
|
color: colors.mutedForeground,
|
|
21
21
|
},
|
|
22
22
|
error: {
|
|
23
23
|
fontFamily,
|
|
24
|
-
fontSize:
|
|
24
|
+
fontSize: fontSize * 0.875,
|
|
25
25
|
color: colors.danger,
|
|
26
26
|
},
|
|
27
27
|
})
|
package/src/components/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
|
3
3
|
|
|
4
4
|
export function useInputVariantDefault(): InputStyles {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily }): InputStyles => ({
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): InputStyles => ({
|
|
7
7
|
default: {
|
|
8
8
|
placeholderTextColor: colors.mutedForeground,
|
|
9
9
|
selectionColor: colors.primary,
|
|
@@ -16,6 +16,7 @@ export function useInputVariantDefault(): InputStyles {
|
|
|
16
16
|
paddingHorizontal: 16,
|
|
17
17
|
outlineWidth: 0,
|
|
18
18
|
fontFamily,
|
|
19
|
+
fontSize,
|
|
19
20
|
height: 48,
|
|
20
21
|
color: colors.foreground,
|
|
21
22
|
},
|
|
@@ -3,9 +3,9 @@ import { TextStyle } from "react-native";
|
|
|
3
3
|
|
|
4
4
|
export function useLinkVariantDefault(): TextStyle {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, fontFamily, letterSpacing }): TextStyle => ({
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
7
|
color: colors.primary,
|
|
8
|
-
fontSize
|
|
8
|
+
fontSize,
|
|
9
9
|
fontFamily,
|
|
10
10
|
textDecorationLine: "underline",
|
|
11
11
|
letterSpacing,
|
|
@@ -3,7 +3,7 @@ import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
|
3
3
|
|
|
4
4
|
export function useSelectVariantDefault(): SelectStyles {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily }): SelectStyles => ({
|
|
6
|
+
({ colors, radius, fontFamily, fontSize }): SelectStyles => ({
|
|
7
7
|
root: {
|
|
8
8
|
default: {},
|
|
9
9
|
disabled: {},
|
|
@@ -25,7 +25,7 @@ export function useSelectVariantDefault(): SelectStyles {
|
|
|
25
25
|
value: {
|
|
26
26
|
default: {
|
|
27
27
|
fontFamily,
|
|
28
|
-
fontSize
|
|
28
|
+
fontSize,
|
|
29
29
|
color: colors.foreground,
|
|
30
30
|
},
|
|
31
31
|
disabled: {
|
|
@@ -35,7 +35,7 @@ export function useSelectVariantDefault(): SelectStyles {
|
|
|
35
35
|
placeholder: {
|
|
36
36
|
default: {
|
|
37
37
|
fontFamily,
|
|
38
|
-
fontSize
|
|
38
|
+
fontSize,
|
|
39
39
|
color: colors.mutedForeground,
|
|
40
40
|
},
|
|
41
41
|
disabled: {
|
|
@@ -62,7 +62,7 @@ export function useSelectVariantDefault(): SelectStyles {
|
|
|
62
62
|
paddingVertical: 12,
|
|
63
63
|
paddingHorizontal: 16,
|
|
64
64
|
fontFamily,
|
|
65
|
-
fontSize
|
|
65
|
+
fontSize,
|
|
66
66
|
color: colors.foreground,
|
|
67
67
|
borderRadius: radius / 2,
|
|
68
68
|
},
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text as RnText, TextProps as RnTextProps } from "react-native";
|
|
3
|
+
import { TypographyVariants } from "./variants";
|
|
4
|
+
|
|
5
|
+
export interface TypographyProps extends RnTextProps {
|
|
6
|
+
variant?: keyof typeof TypographyVariants;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function Typography(props: TypographyProps) {
|
|
10
|
+
const useVariantStyles = TypographyVariants[props.variant ?? "body-md"];
|
|
11
|
+
const variantStyles = useVariantStyles();
|
|
12
|
+
return <RnText {...props} style={variantStyles} />;
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
export function useTextVariantBodyLg(): TextStyle {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
|
+
color: colors.foreground,
|
|
8
|
+
fontSize: fontSize * 1.25,
|
|
9
|
+
fontFamily,
|
|
10
|
+
letterSpacing,
|
|
11
|
+
})
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
2
|
import { TextStyle } from "react-native";
|
|
3
3
|
|
|
4
|
-
export function
|
|
4
|
+
export function useTextVariantBodyMd(): TextStyle {
|
|
5
5
|
return useThemedStyles(
|
|
6
|
-
({ colors, fontFamily, letterSpacing }): TextStyle => ({
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
7
|
color: colors.foreground,
|
|
8
|
-
fontSize
|
|
8
|
+
fontSize,
|
|
9
9
|
fontFamily,
|
|
10
10
|
letterSpacing,
|
|
11
11
|
})
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
export function useTextVariantBodySm(): TextStyle {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
|
+
color: colors.foreground,
|
|
8
|
+
fontSize: fontSize * 0.875,
|
|
9
|
+
fontFamily,
|
|
10
|
+
letterSpacing,
|
|
11
|
+
})
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
export function useTextVariantHeadingLg(): TextStyle {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
|
+
color: colors.foreground,
|
|
8
|
+
fontSize: fontSize * 1.5,
|
|
9
|
+
fontFamily,
|
|
10
|
+
letterSpacing,
|
|
11
|
+
fontWeight: "600",
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
export function useTextVariantHeadingMd(): TextStyle {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
|
+
color: colors.foreground,
|
|
8
|
+
fontSize: fontSize * 1.25,
|
|
9
|
+
fontFamily,
|
|
10
|
+
letterSpacing,
|
|
11
|
+
fontWeight: "600",
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useThemedStyles } from "@/utils/use-themed-styles";
|
|
2
|
+
import { TextStyle } from "react-native";
|
|
3
|
+
|
|
4
|
+
export function useTextVariantHeadingSm(): TextStyle {
|
|
5
|
+
return useThemedStyles(
|
|
6
|
+
({ colors, fontFamily, letterSpacing, fontSize }): TextStyle => ({
|
|
7
|
+
color: colors.foreground,
|
|
8
|
+
fontSize,
|
|
9
|
+
fontFamily,
|
|
10
|
+
letterSpacing,
|
|
11
|
+
fontWeight: "600",
|
|
12
|
+
})
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useTextVariantBodyLg } from "./body-lg";
|
|
2
|
+
import { useTextVariantBodyMd } from "./body-md";
|
|
3
|
+
import { useTextVariantBodySm } from "./body-sm";
|
|
4
|
+
import { useTextVariantHeadingLg } from "./heading-lg";
|
|
5
|
+
import { useTextVariantHeadingMd } from "./heading-md";
|
|
6
|
+
import { useTextVariantHeadingSm } from "./heading-sm";
|
|
7
|
+
|
|
8
|
+
export const TypographyVariants = {
|
|
9
|
+
["body-sm"]: useTextVariantBodySm,
|
|
10
|
+
["body-md"]: useTextVariantBodyMd,
|
|
11
|
+
["body-lg"]: useTextVariantBodyLg,
|
|
12
|
+
["heading-sm"]: useTextVariantHeadingSm,
|
|
13
|
+
["heading-md"]: useTextVariantHeadingMd,
|
|
14
|
+
["heading-lg"]: useTextVariantHeadingLg,
|
|
15
|
+
};
|
package/src/themes/provider.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createContext, PropsWithChildren, useContext, useEffect, useState } from "react";
|
|
2
|
-
import { Colors, ColorScheme, FontFamily, LetterSpacing, Radius, ThemeName } from "./types";
|
|
2
|
+
import { Colors, ColorScheme, FontFamily, FontSize, LetterSpacing, Radius, ThemeName } from "./types";
|
|
3
3
|
import { themes } from "./themes";
|
|
4
4
|
import { useColorScheme } from "react-native";
|
|
5
5
|
|
|
@@ -9,6 +9,7 @@ interface ThemeContext {
|
|
|
9
9
|
fontFamily: FontFamily;
|
|
10
10
|
colorScheme: ColorScheme;
|
|
11
11
|
letterSpacing: LetterSpacing;
|
|
12
|
+
fontSize: FontSize;
|
|
12
13
|
setColorScheme: (scheme: ColorScheme) => void;
|
|
13
14
|
setTheme: (themeName: ThemeName) => void;
|
|
14
15
|
themeName: ThemeName;
|
|
@@ -42,6 +43,7 @@ export const ThemeProvider = (props: PropsWithChildren) => {
|
|
|
42
43
|
radius: themesAssets.radius,
|
|
43
44
|
fontFamily: themesAssets.fontFamily,
|
|
44
45
|
letterSpacing: themesAssets.letterSpacing,
|
|
46
|
+
fontSize: themesAssets.fontSize,
|
|
45
47
|
}}
|
|
46
48
|
>
|
|
47
49
|
{props.children}
|
package/src/themes/types.ts
CHANGED
|
@@ -23,10 +23,12 @@ export interface Colors {
|
|
|
23
23
|
export type Radius = number;
|
|
24
24
|
export type FontFamily = string;
|
|
25
25
|
export type LetterSpacing = number;
|
|
26
|
+
export type FontSize = number;
|
|
26
27
|
|
|
27
28
|
export interface ThemeAssets {
|
|
28
29
|
colors: Record<ColorScheme, Colors>;
|
|
29
30
|
radius: Radius;
|
|
30
31
|
fontFamily: FontFamily;
|
|
31
32
|
letterSpacing: LetterSpacing;
|
|
33
|
+
fontSize: FontSize;
|
|
32
34
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useTheme } from "@/themes";
|
|
2
|
-
import { Colors, FontFamily, LetterSpacing, Radius } from "@/themes/types";
|
|
2
|
+
import { Colors, FontFamily, FontSize, LetterSpacing, Radius } from "@/themes/types";
|
|
3
3
|
|
|
4
4
|
interface CallbackProps {
|
|
5
5
|
colors: Colors;
|
|
6
6
|
radius: Radius;
|
|
7
7
|
fontFamily: FontFamily;
|
|
8
8
|
letterSpacing: LetterSpacing;
|
|
9
|
+
fontSize: FontSize;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const useThemedStyles = <T>(callback: (props: CallbackProps) => T): T => {
|
|
@@ -15,5 +16,6 @@ export const useThemedStyles = <T>(callback: (props: CallbackProps) => T): T =>
|
|
|
15
16
|
radius: theme.radius,
|
|
16
17
|
fontFamily: theme.fontFamily,
|
|
17
18
|
letterSpacing: theme.letterSpacing,
|
|
19
|
+
fontSize: theme.fontSize,
|
|
18
20
|
});
|
|
19
21
|
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Text as RnText, TextProps as RnTextProps } from "react-native";
|
|
3
|
-
import { TextVariants } from "./variants";
|
|
4
|
-
|
|
5
|
-
export interface TextProps extends RnTextProps {
|
|
6
|
-
variant?: keyof typeof TextVariants;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function Text(props: TextProps) {
|
|
10
|
-
const useVariantStyles = TextVariants[props.variant ?? "default"];
|
|
11
|
-
const variantStyles = useVariantStyles();
|
|
12
|
-
return <RnText {...props} style={variantStyles} />;
|
|
13
|
-
}
|