@korsolutions/ui 0.0.85 → 0.0.87
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/AGENTS.md +3 -3
- package/dist/module/components/alert-dialog/components/alert-dialog-root.js +1 -1
- package/dist/module/components/alert-dialog/components/alert-dialog-root.js.map +1 -1
- package/dist/module/components/alert-dialog/variants/default.js +93 -85
- package/dist/module/components/alert-dialog/variants/default.js.map +1 -1
- package/dist/module/components/button/button.js +1 -1
- package/dist/module/components/button/button.js.map +1 -1
- package/dist/module/components/button/variants/default.js +48 -44
- package/dist/module/components/button/variants/default.js.map +1 -1
- package/dist/module/components/button/variants/ghost.js +64 -60
- package/dist/module/components/button/variants/ghost.js.map +1 -1
- package/dist/module/components/button/variants/secondary.js +66 -62
- package/dist/module/components/button/variants/secondary.js.map +1 -1
- package/dist/module/components/combobox/components/combobox-root.js +1 -1
- package/dist/module/components/combobox/components/combobox-root.js.map +1 -1
- package/dist/module/components/combobox/variants/default.js +91 -88
- package/dist/module/components/combobox/variants/default.js.map +1 -1
- package/dist/module/components/icon-button/icon-button.js +4 -5
- package/dist/module/components/icon-button/icon-button.js.map +1 -1
- package/dist/module/components/icon-button/variants/default.js +31 -24
- package/dist/module/components/icon-button/variants/default.js.map +1 -1
- package/dist/module/components/icon-button/variants/ghost.js +32 -25
- package/dist/module/components/icon-button/variants/ghost.js.map +1 -1
- package/dist/module/components/icon-button/variants/secondary.js +34 -27
- package/dist/module/components/icon-button/variants/secondary.js.map +1 -1
- package/dist/module/components/index.js +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/input/input.js +1 -1
- package/dist/module/components/input/input.js.map +1 -1
- package/dist/module/components/input/variants/default.js +39 -37
- package/dist/module/components/input/variants/default.js.map +1 -1
- package/dist/module/components/input/variants/secondary.js +39 -37
- package/dist/module/components/input/variants/secondary.js.map +1 -1
- package/dist/module/components/phone-input/components/phone-input-root.js +2 -1
- package/dist/module/components/phone-input/components/phone-input-root.js.map +1 -1
- package/dist/module/components/phone-input/variants/default.js +115 -112
- package/dist/module/components/phone-input/variants/default.js.map +1 -1
- package/dist/module/components/select/components/select-root.js +1 -1
- package/dist/module/components/select/components/select-root.js.map +1 -1
- package/dist/module/components/select/variants/default.js +75 -73
- package/dist/module/components/select/variants/default.js.map +1 -1
- package/dist/module/components/sidebar/components/sidebar-content.js +19 -0
- package/dist/module/components/sidebar/components/sidebar-content.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-footer.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group-label.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-group.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-group.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-header.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-header.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js +36 -0
- package/dist/module/components/sidebar/components/sidebar-menu-item.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js +22 -0
- package/dist/module/components/sidebar/components/sidebar-menu-sub.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js +18 -0
- package/dist/module/components/sidebar/components/sidebar-menu.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js +47 -0
- package/dist/module/components/sidebar/components/sidebar-provider.js.map +1 -0
- package/dist/module/components/sidebar/components/sidebar-root.js +27 -0
- package/dist/module/components/sidebar/components/sidebar-root.js.map +1 -0
- package/dist/module/components/sidebar/context.js +12 -0
- package/dist/module/components/sidebar/context.js.map +1 -0
- package/dist/module/components/sidebar/index.js +26 -0
- package/dist/module/components/sidebar/index.js.map +1 -0
- package/dist/module/components/sidebar/types.js +4 -0
- package/dist/module/components/sidebar/types.js.map +1 -0
- package/dist/module/components/sidebar/variants/default.js +101 -0
- package/dist/module/components/sidebar/variants/default.js.map +1 -0
- package/dist/module/components/sidebar/variants/index.js +7 -0
- package/dist/module/components/sidebar/variants/index.js.map +1 -0
- package/dist/module/themes/default/index.js +1 -0
- package/dist/module/themes/default/index.js.map +1 -1
- package/dist/module/themes/provider.js +1 -0
- package/dist/module/themes/provider.js.map +1 -1
- package/dist/module/themes/utils.js +2 -1
- package/dist/module/themes/utils.js.map +1 -1
- package/dist/module/utils/size-scale.js +42 -0
- package/dist/module/utils/size-scale.js.map +1 -0
- package/dist/module/utils/use-themed-styles.js +4 -1
- package/dist/module/utils/use-themed-styles.js.map +1 -1
- package/dist/typescript/src/components/alert-dialog/components/alert-dialog-root.d.ts +2 -0
- package/dist/typescript/src/components/alert-dialog/components/alert-dialog-root.d.ts.map +1 -1
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts +3 -2
- package/dist/typescript/src/components/alert-dialog/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/alert-dialog/variants/index.d.ts +1 -1
- package/dist/typescript/src/components/button/button.d.ts +2 -0
- package/dist/typescript/src/components/button/button.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/ghost.d.ts.map +1 -1
- package/dist/typescript/src/components/button/variants/index.d.ts +3 -3
- package/dist/typescript/src/components/button/variants/secondary.d.ts +2 -1
- package/dist/typescript/src/components/button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/combobox/components/combobox-root.d.ts +2 -0
- package/dist/typescript/src/components/combobox/components/combobox-root.d.ts.map +1 -1
- package/dist/typescript/src/components/combobox/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/combobox/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/icon-button.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/icon-button.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/ghost.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/ghost.d.ts.map +1 -1
- package/dist/typescript/src/components/icon-button/variants/index.d.ts +3 -3
- package/dist/typescript/src/components/icon-button/variants/secondary.d.ts +2 -1
- package/dist/typescript/src/components/icon-button/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/index.d.ts +1 -0
- package/dist/typescript/src/components/index.d.ts.map +1 -1
- package/dist/typescript/src/components/input/input.d.ts +2 -0
- package/dist/typescript/src/components/input/input.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/input/variants/secondary.d.ts +3 -2
- package/dist/typescript/src/components/input/variants/secondary.d.ts.map +1 -1
- package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts +3 -1
- package/dist/typescript/src/components/phone-input/components/phone-input-root.d.ts.map +1 -1
- package/dist/typescript/src/components/phone-input/variants/default.d.ts +2 -1
- package/dist/typescript/src/components/phone-input/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/select/components/select-root.d.ts +2 -0
- package/dist/typescript/src/components/select/components/select-root.d.ts.map +1 -1
- package/dist/typescript/src/components/select/variants/default.d.ts +3 -2
- package/dist/typescript/src/components/select/variants/default.d.ts.map +1 -1
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-content.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-footer.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group-label.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-group.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-header.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-item.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts +10 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu-sub.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-menu.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts +17 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-provider.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts +8 -0
- package/dist/typescript/src/components/sidebar/components/sidebar-root.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/context.d.ts +12 -0
- package/dist/typescript/src/components/sidebar/context.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/index.d.ts +35 -0
- package/dist/typescript/src/components/sidebar/index.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/types.d.ts +29 -0
- package/dist/typescript/src/components/sidebar/types.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts +3 -0
- package/dist/typescript/src/components/sidebar/variants/default.d.ts.map +1 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts +5 -0
- package/dist/typescript/src/components/sidebar/variants/index.d.ts.map +1 -0
- package/dist/typescript/src/index.d.ts +2 -0
- package/dist/typescript/src/index.d.ts.map +1 -1
- package/dist/typescript/src/themes/default/index.d.ts.map +1 -1
- package/dist/typescript/src/themes/provider.d.ts +1 -0
- package/dist/typescript/src/themes/provider.d.ts.map +1 -1
- package/dist/typescript/src/themes/types.d.ts +5 -0
- package/dist/typescript/src/themes/types.d.ts.map +1 -1
- package/dist/typescript/src/themes/utils.d.ts.map +1 -1
- package/dist/typescript/src/utils/size-scale.d.ts +20 -0
- package/dist/typescript/src/utils/size-scale.d.ts.map +1 -0
- package/dist/typescript/src/utils/use-themed-styles.d.ts +5 -0
- package/dist/typescript/src/utils/use-themed-styles.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/alert-dialog/components/alert-dialog-root.tsx +3 -1
- package/src/components/alert-dialog/variants/default.tsx +88 -79
- package/src/components/button/button.tsx +3 -1
- package/src/components/button/variants/default.tsx +14 -10
- package/src/components/button/variants/ghost.tsx +14 -10
- package/src/components/button/variants/secondary.tsx +14 -10
- package/src/components/combobox/components/combobox-root.tsx +3 -1
- package/src/components/combobox/variants/default.tsx +17 -14
- package/src/components/icon-button/icon-button.tsx +6 -6
- package/src/components/icon-button/variants/default.tsx +12 -6
- package/src/components/icon-button/variants/ghost.tsx +12 -6
- package/src/components/icon-button/variants/secondary.tsx +12 -6
- package/src/components/index.ts +1 -0
- package/src/components/input/input.tsx +3 -1
- package/src/components/input/variants/default.tsx +11 -9
- package/src/components/input/variants/secondary.tsx +12 -10
- package/src/components/phone-input/components/phone-input-root.tsx +4 -1
- package/src/components/phone-input/variants/default.tsx +21 -18
- package/src/components/select/components/select-root.tsx +3 -1
- package/src/components/select/variants/default.tsx +16 -14
- package/src/components/sidebar/components/sidebar-content.tsx +19 -0
- package/src/components/sidebar/components/sidebar-footer.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group-label.tsx +15 -0
- package/src/components/sidebar/components/sidebar-group.tsx +15 -0
- package/src/components/sidebar/components/sidebar-header.tsx +15 -0
- package/src/components/sidebar/components/sidebar-menu-item.tsx +61 -0
- package/src/components/sidebar/components/sidebar-menu-sub.tsx +23 -0
- package/src/components/sidebar/components/sidebar-menu.tsx +15 -0
- package/src/components/sidebar/components/sidebar-provider.tsx +73 -0
- package/src/components/sidebar/components/sidebar-root.tsx +19 -0
- package/src/components/sidebar/context.ts +21 -0
- package/src/components/sidebar/index.ts +37 -0
- package/src/components/sidebar/types.ts +31 -0
- package/src/components/sidebar/variants/default.tsx +96 -0
- package/src/components/sidebar/variants/index.ts +5 -0
- package/src/index.tsx +2 -0
- package/src/themes/default/index.ts +1 -0
- package/src/themes/provider.tsx +2 -0
- package/src/themes/types.ts +5 -0
- package/src/themes/utils.ts +1 -0
- package/src/utils/size-scale.ts +45 -0
- package/src/utils/use-themed-styles.ts +8 -0
|
@@ -1,84 +1,93 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
2
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
|
+
import { type AlertDialogStyles } from "../types";
|
|
3
4
|
|
|
4
|
-
export const useAlertDialogVariantDefault = (): AlertDialogStyles => {
|
|
5
|
+
export const useAlertDialogVariantDefault = (size: Size): AlertDialogStyles => {
|
|
5
6
|
return useThemedStyles(
|
|
6
|
-
({ colors, radius, fontFamily, fontSize }): AlertDialogStyles =>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
7
|
+
({ colors, radius, fontFamily, fontSize, sizeScale }): AlertDialogStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
overlay: {
|
|
12
|
+
position: "absolute",
|
|
13
|
+
top: 0,
|
|
14
|
+
left: 0,
|
|
15
|
+
right: 0,
|
|
16
|
+
bottom: 0,
|
|
17
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
18
|
+
justifyContent: "center",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
zIndex: 999,
|
|
21
|
+
},
|
|
22
|
+
content: {
|
|
23
|
+
backgroundColor: colors.background,
|
|
24
|
+
borderRadius: radius,
|
|
25
|
+
padding: 24,
|
|
26
|
+
maxWidth: 400,
|
|
27
|
+
width: "90%",
|
|
28
|
+
shadowColor: "#000",
|
|
29
|
+
shadowOffset: { width: 0, height: 2 },
|
|
30
|
+
shadowOpacity: 0.25,
|
|
31
|
+
shadowRadius: 8,
|
|
32
|
+
elevation: 5,
|
|
33
|
+
position: "absolute",
|
|
34
|
+
top: "50%",
|
|
35
|
+
left: "50%",
|
|
36
|
+
transform: [{ translateX: "-50%" }, { translateY: "-50%" }],
|
|
37
|
+
borderWidth: 1,
|
|
38
|
+
borderColor: colors.border,
|
|
39
|
+
zIndex: 1000,
|
|
40
|
+
},
|
|
41
|
+
title: {
|
|
42
|
+
fontSize: fontSize * 1.25,
|
|
43
|
+
fontWeight: "600",
|
|
44
|
+
color: colors.foreground,
|
|
45
|
+
fontFamily,
|
|
46
|
+
marginBottom: 8,
|
|
47
|
+
},
|
|
48
|
+
description: {
|
|
49
|
+
fontSize,
|
|
50
|
+
color: colors.mutedForeground,
|
|
51
|
+
fontFamily,
|
|
52
|
+
lineHeight: fontSize * 1.5,
|
|
53
|
+
},
|
|
54
|
+
footer: {
|
|
55
|
+
flexDirection: "row",
|
|
56
|
+
justifyContent: "flex-end",
|
|
57
|
+
gap: s.gap,
|
|
58
|
+
marginTop: 24,
|
|
59
|
+
},
|
|
60
|
+
cancel: {
|
|
61
|
+
height: s.height,
|
|
62
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
63
|
+
borderRadius: radius,
|
|
64
|
+
borderWidth: 1,
|
|
65
|
+
borderColor: colors.border,
|
|
66
|
+
backgroundColor: colors.background,
|
|
67
|
+
justifyContent: "center",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
},
|
|
70
|
+
cancelText: {
|
|
71
|
+
color: colors.foreground,
|
|
72
|
+
fontSize: s.fontSize,
|
|
73
|
+
fontWeight: "500",
|
|
74
|
+
fontFamily,
|
|
75
|
+
},
|
|
76
|
+
action: {
|
|
77
|
+
height: s.height,
|
|
78
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
79
|
+
borderRadius: radius,
|
|
80
|
+
backgroundColor: colors.primary,
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
},
|
|
84
|
+
actionText: {
|
|
85
|
+
color: colors.primaryForeground,
|
|
86
|
+
fontSize: s.fontSize,
|
|
87
|
+
fontWeight: "500",
|
|
88
|
+
fontFamily,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
},
|
|
83
92
|
);
|
|
84
93
|
};
|
|
@@ -10,11 +10,13 @@ import {
|
|
|
10
10
|
import { useOrganizedChildren } from "../../hooks/use-organized-children";
|
|
11
11
|
import { useComponentConfig } from "../../themes/provider";
|
|
12
12
|
import { mergeStyles } from "../../utils/calculate-styles";
|
|
13
|
+
import type { Size } from "../../utils/size-scale";
|
|
13
14
|
import type { ButtonState } from "./types";
|
|
14
15
|
import { ButtonVariants } from "./variants";
|
|
15
16
|
|
|
16
17
|
export interface ButtonProps extends Omit<PressableProps, "disabled"> {
|
|
17
18
|
variant?: keyof typeof ButtonVariants;
|
|
19
|
+
size?: Size;
|
|
18
20
|
children?: React.ReactNode;
|
|
19
21
|
|
|
20
22
|
isDisabled?: boolean;
|
|
@@ -31,7 +33,7 @@ const calculateState = (props: ButtonProps, isHovered: boolean): ButtonState =>
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
export function Button(props: ButtonProps) {
|
|
34
|
-
const variantStyles = ButtonVariants[props.variant ?? "default"]();
|
|
36
|
+
const variantStyles = ButtonVariants[props.variant ?? "default"](props.size ?? "md");
|
|
35
37
|
const componentConfig = useComponentConfig("button");
|
|
36
38
|
const [isHovered, setIsHovered] = useState(false);
|
|
37
39
|
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantDefault = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantDefault = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
backgroundColor: colors.primary,
|
|
@@ -35,14 +38,15 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
35
38
|
text: {
|
|
36
39
|
default: {
|
|
37
40
|
color: colors.primaryForeground,
|
|
38
|
-
fontSize,
|
|
41
|
+
fontSize: sizeStyles.fontSize,
|
|
39
42
|
fontFamily,
|
|
40
43
|
},
|
|
41
44
|
},
|
|
42
45
|
icon: {
|
|
43
46
|
default: {
|
|
44
47
|
color: colors.primaryForeground,
|
|
45
|
-
size:
|
|
48
|
+
size: sizeStyles.iconSize,
|
|
49
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
46
50
|
},
|
|
47
51
|
},
|
|
48
52
|
spinner: {
|
|
@@ -50,6 +54,6 @@ export const useButtonVariantDefault = (): ButtonStyles => {
|
|
|
50
54
|
color: colors.primaryForeground,
|
|
51
55
|
},
|
|
52
56
|
},
|
|
53
|
-
}
|
|
54
|
-
);
|
|
57
|
+
};
|
|
58
|
+
});
|
|
55
59
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantGhost = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantGhost = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
backgroundColor: "transparent",
|
|
@@ -33,7 +36,7 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
33
36
|
text: {
|
|
34
37
|
default: {
|
|
35
38
|
color: colors.foreground,
|
|
36
|
-
fontSize,
|
|
39
|
+
fontSize: sizeStyles.fontSize,
|
|
37
40
|
fontFamily,
|
|
38
41
|
},
|
|
39
42
|
disabled: {
|
|
@@ -46,7 +49,8 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
46
49
|
icon: {
|
|
47
50
|
default: {
|
|
48
51
|
color: colors.foreground,
|
|
49
|
-
size:
|
|
52
|
+
size: sizeStyles.iconSize,
|
|
53
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
50
54
|
},
|
|
51
55
|
disabled: {
|
|
52
56
|
color: colors.mutedForeground,
|
|
@@ -66,6 +70,6 @@ export const useButtonVariantGhost = (): ButtonStyles => {
|
|
|
66
70
|
color: colors.mutedForeground,
|
|
67
71
|
},
|
|
68
72
|
},
|
|
69
|
-
}
|
|
70
|
-
);
|
|
73
|
+
};
|
|
74
|
+
});
|
|
71
75
|
};
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import type { CursorValue } from "react-native";
|
|
2
2
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
3
|
+
import type { Size } from "../../../utils/size-scale";
|
|
3
4
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
4
5
|
import type { ButtonStyles } from "../types";
|
|
5
6
|
|
|
6
|
-
export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
7
|
-
return useThemedStyles(
|
|
8
|
-
|
|
7
|
+
export const useButtonVariantSecondary = (size: Size): ButtonStyles => {
|
|
8
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ButtonStyles => {
|
|
9
|
+
const sizeStyles = sizeScale(size);
|
|
10
|
+
|
|
11
|
+
return {
|
|
9
12
|
root: {
|
|
10
13
|
default: {
|
|
11
14
|
flexDirection: "row",
|
|
12
|
-
|
|
13
|
-
paddingHorizontal:
|
|
15
|
+
height: sizeStyles.height,
|
|
16
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
14
17
|
borderRadius: radius,
|
|
15
|
-
gap:
|
|
18
|
+
gap: sizeStyles.gap,
|
|
16
19
|
alignItems: "center",
|
|
17
20
|
justifyContent: "center",
|
|
18
21
|
borderWidth: 1,
|
|
@@ -35,7 +38,7 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
35
38
|
text: {
|
|
36
39
|
default: {
|
|
37
40
|
color: colors.secondaryForeground,
|
|
38
|
-
fontSize,
|
|
41
|
+
fontSize: sizeStyles.fontSize,
|
|
39
42
|
fontFamily,
|
|
40
43
|
},
|
|
41
44
|
disabled: {
|
|
@@ -48,7 +51,8 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
48
51
|
icon: {
|
|
49
52
|
default: {
|
|
50
53
|
color: colors.secondaryForeground,
|
|
51
|
-
size:
|
|
54
|
+
size: sizeStyles.iconSize,
|
|
55
|
+
strokeWidth: sizeStyles.strokeWidth,
|
|
52
56
|
},
|
|
53
57
|
disabled: {
|
|
54
58
|
color: colors.mutedForeground,
|
|
@@ -68,6 +72,6 @@ export const useButtonVariantSecondary = (): ButtonStyles => {
|
|
|
68
72
|
color: colors.mutedForeground,
|
|
69
73
|
},
|
|
70
74
|
},
|
|
71
|
-
}
|
|
72
|
-
);
|
|
75
|
+
};
|
|
76
|
+
});
|
|
73
77
|
};
|
|
@@ -9,12 +9,14 @@ import {
|
|
|
9
9
|
import { DEFAULT_LAYOUT, DEFAULT_POSITION, type LayoutPosition } from "../../../hooks";
|
|
10
10
|
import { useComponentConfig } from "../../../themes/provider";
|
|
11
11
|
import { mergeStyles } from "../../../utils/calculate-styles";
|
|
12
|
+
import type { Size } from "../../../utils/size-scale";
|
|
12
13
|
import { ComboboxContext } from "../context";
|
|
13
14
|
import type { ComboboxState } from "../types";
|
|
14
15
|
import { ComboboxVariants } from "../variants";
|
|
15
16
|
|
|
16
17
|
export interface ComboboxRootProps {
|
|
17
18
|
variant?: keyof typeof ComboboxVariants;
|
|
19
|
+
size?: Size;
|
|
18
20
|
|
|
19
21
|
value?: string;
|
|
20
22
|
onChange?: (value: string) => void;
|
|
@@ -36,7 +38,7 @@ const calculateState = (props: ComboboxRootProps): ComboboxState => {
|
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
export function ComboboxRoot(props: ComboboxRootProps) {
|
|
39
|
-
const variantStyles = ComboboxVariants[props.variant ?? "default"]();
|
|
41
|
+
const variantStyles = ComboboxVariants[props.variant ?? "default"](props.size ?? "md");
|
|
40
42
|
const globalStyles = useComponentConfig("combobox");
|
|
41
43
|
const mergedStyles = mergeStyles(variantStyles, globalStyles?.styles);
|
|
42
44
|
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Platform } from "react-native";
|
|
2
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
4
|
import { type ComboboxStyles } from "../types";
|
|
4
5
|
|
|
5
|
-
export function useComboboxVariantDefault(): ComboboxStyles {
|
|
6
|
-
return useThemedStyles(
|
|
7
|
-
|
|
6
|
+
export function useComboboxVariantDefault(size: Size): ComboboxStyles {
|
|
7
|
+
return useThemedStyles(({ colors, radius, fontFamily, sizeScale }): ComboboxStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
8
11
|
root: {
|
|
9
12
|
default: {},
|
|
10
13
|
disabled: {},
|
|
@@ -20,10 +23,10 @@ export function useComboboxVariantDefault(): ComboboxStyles {
|
|
|
20
23
|
backgroundColor: colors.surface,
|
|
21
24
|
justifyContent: "center",
|
|
22
25
|
paddingVertical: 4,
|
|
23
|
-
paddingHorizontal:
|
|
24
|
-
minHeight:
|
|
26
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
27
|
+
minHeight: s.height,
|
|
25
28
|
fontFamily,
|
|
26
|
-
fontSize,
|
|
29
|
+
fontSize: s.fontSize,
|
|
27
30
|
color: colors.foreground,
|
|
28
31
|
outlineWidth: 0,
|
|
29
32
|
pointerEvents: "auto",
|
|
@@ -69,10 +72,10 @@ export function useComboboxVariantDefault(): ComboboxStyles {
|
|
|
69
72
|
},
|
|
70
73
|
option: {
|
|
71
74
|
default: {
|
|
72
|
-
paddingVertical:
|
|
73
|
-
paddingHorizontal:
|
|
75
|
+
paddingVertical: s.paddingVertical,
|
|
76
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
74
77
|
fontFamily,
|
|
75
|
-
fontSize,
|
|
78
|
+
fontSize: s.fontSize,
|
|
76
79
|
color: colors.foreground,
|
|
77
80
|
borderRadius: radius / 2,
|
|
78
81
|
},
|
|
@@ -88,15 +91,15 @@ export function useComboboxVariantDefault(): ComboboxStyles {
|
|
|
88
91
|
},
|
|
89
92
|
empty: {
|
|
90
93
|
default: {
|
|
91
|
-
paddingVertical:
|
|
92
|
-
paddingHorizontal:
|
|
94
|
+
paddingVertical: s.paddingVertical,
|
|
95
|
+
paddingHorizontal: s.paddingHorizontal,
|
|
93
96
|
fontFamily,
|
|
94
|
-
fontSize,
|
|
97
|
+
fontSize: s.fontSize,
|
|
95
98
|
color: colors.mutedForeground,
|
|
96
99
|
textAlign: "center",
|
|
97
100
|
},
|
|
98
101
|
disabled: {},
|
|
99
102
|
},
|
|
100
|
-
}
|
|
101
|
-
);
|
|
103
|
+
};
|
|
104
|
+
});
|
|
102
105
|
}
|
|
@@ -9,14 +9,15 @@ import {
|
|
|
9
9
|
import { useComponentConfig } from "../../themes/provider";
|
|
10
10
|
import type { SvgProps } from "../../types/props.types";
|
|
11
11
|
import { mergeStyles } from "../../utils/calculate-styles";
|
|
12
|
+
import type { Size } from "../../utils/size-scale";
|
|
12
13
|
import type { IconButtonState } from "./types";
|
|
13
14
|
import { IconButtonVariants } from "./variants";
|
|
14
15
|
|
|
15
16
|
export interface IconButtonProps extends Omit<PressableProps, "disabled" | "children"> {
|
|
16
17
|
render: (props: SvgProps) => React.ReactNode;
|
|
17
18
|
variant?: keyof typeof IconButtonVariants;
|
|
19
|
+
size?: Size;
|
|
18
20
|
isDisabled?: boolean;
|
|
19
|
-
size?: number;
|
|
20
21
|
color?: SvgProps["color"];
|
|
21
22
|
strokeWidth?: number;
|
|
22
23
|
style?: StyleProp<ViewStyle>;
|
|
@@ -37,15 +38,15 @@ export function IconButton(props: IconButtonProps) {
|
|
|
37
38
|
const {
|
|
38
39
|
render: IconComponent,
|
|
39
40
|
variant = "default",
|
|
41
|
+
size = "md",
|
|
40
42
|
isDisabled,
|
|
41
|
-
size,
|
|
42
43
|
color,
|
|
43
44
|
strokeWidth,
|
|
44
45
|
style,
|
|
45
46
|
...rest
|
|
46
47
|
} = props;
|
|
47
48
|
|
|
48
|
-
const variantStyles = IconButtonVariants[variant]();
|
|
49
|
+
const variantStyles = IconButtonVariants[variant](size);
|
|
49
50
|
const componentConfig = useComponentConfig("iconButton");
|
|
50
51
|
const mergedStyles = mergeStyles(variantStyles, componentConfig?.styles);
|
|
51
52
|
|
|
@@ -61,10 +62,9 @@ export function IconButton(props: IconButtonProps) {
|
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
const iconProps: SvgProps = {
|
|
64
|
-
size:
|
|
65
|
+
size: mergedStyles.icon?.default?.size,
|
|
65
66
|
color: color ?? mergedStyles.icon?.[state]?.color ?? mergedStyles.icon?.default?.color,
|
|
66
|
-
strokeWidth,
|
|
67
|
-
absoluteStrokeWidth: true,
|
|
67
|
+
strokeWidth: strokeWidth ?? mergedStyles.icon?.default?.strokeWidth,
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
return (
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
2
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
4
|
import type { IconButtonStyles } from "../types";
|
|
4
5
|
|
|
5
|
-
export const useIconButtonVariantDefault = (): IconButtonStyles => {
|
|
6
|
-
return useThemedStyles(
|
|
7
|
-
|
|
6
|
+
export const useIconButtonVariantDefault = (size: Size): IconButtonStyles => {
|
|
7
|
+
return useThemedStyles(({ colors, radius, sizeScale }): IconButtonStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
8
11
|
root: {
|
|
9
12
|
default: {
|
|
10
13
|
alignItems: "center",
|
|
11
14
|
justifyContent: "center",
|
|
12
|
-
|
|
15
|
+
height: s.height,
|
|
16
|
+
width: s.height,
|
|
13
17
|
borderRadius: radius,
|
|
14
18
|
backgroundColor: colors.primary,
|
|
15
19
|
borderWidth: 1,
|
|
@@ -25,8 +29,10 @@ export const useIconButtonVariantDefault = (): IconButtonStyles => {
|
|
|
25
29
|
icon: {
|
|
26
30
|
default: {
|
|
27
31
|
color: colors.primaryForeground,
|
|
32
|
+
size: s.iconSize,
|
|
33
|
+
strokeWidth: s.strokeWidth,
|
|
28
34
|
},
|
|
29
35
|
},
|
|
30
|
-
}
|
|
31
|
-
);
|
|
36
|
+
};
|
|
37
|
+
});
|
|
32
38
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
2
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
4
|
import type { IconButtonStyles } from "../types";
|
|
4
5
|
|
|
5
|
-
export const useIconButtonVariantGhost = (): IconButtonStyles => {
|
|
6
|
-
return useThemedStyles(
|
|
7
|
-
|
|
6
|
+
export const useIconButtonVariantGhost = (size: Size): IconButtonStyles => {
|
|
7
|
+
return useThemedStyles(({ colors, radius, sizeScale }): IconButtonStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
8
11
|
root: {
|
|
9
12
|
default: {
|
|
10
13
|
alignItems: "center",
|
|
11
14
|
justifyContent: "center",
|
|
12
|
-
|
|
15
|
+
height: s.height,
|
|
16
|
+
width: s.height,
|
|
13
17
|
borderRadius: radius,
|
|
14
18
|
backgroundColor: "transparent",
|
|
15
19
|
},
|
|
@@ -23,11 +27,13 @@ export const useIconButtonVariantGhost = (): IconButtonStyles => {
|
|
|
23
27
|
icon: {
|
|
24
28
|
default: {
|
|
25
29
|
color: colors.foreground,
|
|
30
|
+
size: s.iconSize,
|
|
31
|
+
strokeWidth: s.strokeWidth,
|
|
26
32
|
},
|
|
27
33
|
disabled: {
|
|
28
34
|
color: colors.mutedForeground,
|
|
29
35
|
},
|
|
30
36
|
},
|
|
31
|
-
}
|
|
32
|
-
);
|
|
37
|
+
};
|
|
38
|
+
});
|
|
33
39
|
};
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { hslaSetRelativeLightness } from "../../../utils/hsla-utils";
|
|
2
|
+
import type { Size } from "../../../utils/size-scale";
|
|
2
3
|
import { useThemedStyles } from "../../../utils/use-themed-styles";
|
|
3
4
|
import type { IconButtonStyles } from "../types";
|
|
4
5
|
|
|
5
|
-
export const useIconButtonVariantSecondary = (): IconButtonStyles => {
|
|
6
|
-
return useThemedStyles(
|
|
7
|
-
|
|
6
|
+
export const useIconButtonVariantSecondary = (size: Size): IconButtonStyles => {
|
|
7
|
+
return useThemedStyles(({ colors, radius, sizeScale }): IconButtonStyles => {
|
|
8
|
+
const s = sizeScale(size);
|
|
9
|
+
|
|
10
|
+
return {
|
|
8
11
|
root: {
|
|
9
12
|
default: {
|
|
10
13
|
alignItems: "center",
|
|
11
14
|
justifyContent: "center",
|
|
12
|
-
|
|
15
|
+
height: s.height,
|
|
16
|
+
width: s.height,
|
|
13
17
|
borderRadius: radius,
|
|
14
18
|
borderWidth: 1,
|
|
15
19
|
borderColor: colors.border,
|
|
@@ -25,11 +29,13 @@ export const useIconButtonVariantSecondary = (): IconButtonStyles => {
|
|
|
25
29
|
icon: {
|
|
26
30
|
default: {
|
|
27
31
|
color: colors.secondaryForeground,
|
|
32
|
+
size: s.iconSize,
|
|
33
|
+
strokeWidth: s.strokeWidth,
|
|
28
34
|
},
|
|
29
35
|
disabled: {
|
|
30
36
|
color: colors.mutedForeground,
|
|
31
37
|
},
|
|
32
38
|
},
|
|
33
|
-
}
|
|
34
|
-
);
|
|
39
|
+
};
|
|
40
|
+
});
|
|
35
41
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { StyleSheet, TextInput, type TextInputProps } from "react-native";
|
|
|
3
3
|
import { useComponentConfig } from "../../themes/provider";
|
|
4
4
|
import type { TextInputRef } from "../../types/element.types";
|
|
5
5
|
import { mergeStyles } from "../../utils/calculate-styles";
|
|
6
|
+
import type { Size } from "../../utils/size-scale";
|
|
6
7
|
import { useFieldOptional } from "../field/context";
|
|
7
8
|
import type { InputState } from "./types";
|
|
8
9
|
import { InputVariants } from "./variants";
|
|
9
10
|
|
|
10
11
|
export type InputProps = Omit<TextInputProps, "onChange" | "onChangeText"> & {
|
|
11
12
|
variant?: keyof typeof InputVariants;
|
|
13
|
+
size?: Size;
|
|
12
14
|
|
|
13
15
|
ref?: React.Ref<TextInputRef>;
|
|
14
16
|
onChange?: TextInputProps["onChangeText"];
|
|
@@ -26,7 +28,7 @@ const calculateState = (props: InputProps, isFocused: boolean): InputState => {
|
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
export const Input = forwardRef<TextInputRef, InputProps>((props, ref) => {
|
|
29
|
-
const variantStyles = InputVariants[props.variant || "default"]();
|
|
31
|
+
const variantStyles = InputVariants[props.variant || "default"](props.size ?? "md");
|
|
30
32
|
const componentConfig = useComponentConfig("input");
|
|
31
33
|
const mergedStyles = mergeStyles(variantStyles, componentConfig?.styles);
|
|
32
34
|
const [isFocused, setIsFocused] = useState(false);
|