@particle-network/ui-react 0.5.1-beta.0 → 0.5.1-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ProgressWrapper/index.d.ts +2 -2
- package/dist/components/ProgressWrapper/index.js +1 -1
- package/dist/components/UXAutocomplete/index.js +1 -2
- package/dist/components/UXButton/button-theme.js +38 -2
- package/dist/components/UXButton/button.js +1 -1
- package/dist/components/UXCheckbox/checkbox.extend.js +16 -13
- package/dist/components/UXChip/chip.extend.d.ts +2 -1
- package/dist/components/UXChip/index.d.ts +1 -1
- package/dist/components/UXColorPicker/color-fields.d.ts +3 -0
- package/dist/components/UXColorPicker/color-fields.js +142 -0
- package/dist/components/UXColorPicker/color-input.d.ts +7 -0
- package/dist/components/UXColorPicker/color-input.js +12 -0
- package/dist/components/UXColorPicker/color-picker.d.ts +3 -0
- package/dist/components/UXColorPicker/color-picker.js +228 -0
- package/dist/components/UXColorPicker/index.d.ts +5 -0
- package/dist/components/UXColorPicker/index.js +3 -0
- package/dist/components/UXColorPicker/types.d.ts +51 -0
- package/dist/components/UXColorPicker/types.js +0 -0
- package/dist/components/UXColorPicker/utils.d.ts +7 -0
- package/dist/components/UXColorPicker/utils.js +6 -0
- package/dist/components/UXCopy/index.js +2 -2
- package/dist/components/UXEmpty/index.js +2 -2
- package/dist/components/UXHint/index.js +1 -1
- package/dist/components/UXInput/index.d.ts +6 -6
- package/dist/components/UXInput/input.extend.d.ts +6 -6
- package/dist/components/UXRadio/radio.extend.js +3 -3
- package/dist/components/UXSlider/use-slider.d.ts +1 -1
- package/dist/components/UXSlider/use-slider.js +1 -1
- package/dist/components/UXSpinner/spinner.d.ts +1 -5
- package/dist/components/UXSpinner/spinner.js +3 -4
- package/dist/components/UXSwitch/index.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.d.ts +2 -2
- package/dist/components/UXSwitch/switch.extend.js +6 -6
- package/dist/components/UXTabs/tabs.classes.js +4 -4
- package/dist/components/UXThemeSwitch/constants.d.ts +9 -0
- package/dist/components/UXThemeSwitch/constants.js +3 -0
- package/dist/components/UXThemeSwitch/custom-theme-config.d.ts +2 -0
- package/dist/components/UXThemeSwitch/custom-theme-config.js +171 -0
- package/dist/components/UXThemeSwitch/theme-item.js +94 -15
- package/dist/components/UXThemeSwitch/theme-switch.js +26 -5
- package/dist/components/UXThemeSwitch/use-color-scheme.js +11 -8
- package/dist/components/UXThemeSwitch/use-theme-color.d.ts +1 -22
- package/dist/components/UXThemeSwitch/use-theme-color.js +3 -7
- package/dist/components/UXThemeSwitch/use-theme-store.d.ts +5 -0
- package/dist/components/UXThemeSwitch/use-theme-store.js +9 -3
- package/dist/components/UXThemeSwitch/use-theme.d.ts +2 -0
- package/dist/components/UXThemeSwitch/use-theme.js +10 -53
- package/dist/components/UXThemeSwitch/utils.d.ts +28 -0
- package/dist/components/UXThemeSwitch/utils.js +222 -0
- package/dist/components/UXToast/index.js +4 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/layout/Box/box-theme.d.ts +2225 -0
- package/dist/components/layout/Box/box-theme.js +348 -0
- package/dist/components/layout/Box/box.d.ts +14 -0
- package/dist/components/layout/Box/box.js +99 -0
- package/dist/components/layout/Circle.js +2 -3
- package/dist/components/layout/Flex.d.ts +3 -27
- package/dist/components/layout/Flex.js +6 -19
- package/dist/components/layout/HStack.d.ts +1 -1
- package/dist/components/layout/Square.js +3 -3
- package/dist/components/layout/VStack.d.ts +1 -1
- package/dist/components/layout/VStack.js +2 -2
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/layout/index.js +1 -0
- package/dist/components/typography/Text.js +22 -7
- package/dist/components/typography/Text.type.d.ts +3 -26
- package/dist/components/typography/Text.type.js +0 -47
- package/dist/components/typography/text-theme.d.ts +178 -0
- package/dist/components/typography/text-theme.js +79 -0
- package/dist/heroui/constants.d.ts +18 -0
- package/dist/heroui/constants.js +98 -0
- package/dist/heroui/types.d.ts +91 -0
- package/dist/heroui/types.js +0 -0
- package/dist/heroui/utils/colors.d.ts +34 -0
- package/dist/heroui/utils/colors.js +121 -0
- package/dist/heroui/utils/object.d.ts +1 -0
- package/dist/heroui/utils/object.js +17 -0
- package/dist/hooks/useI18n.d.ts +133 -25
- package/dist/hooks/useI18n.js +84 -2
- package/dist/hooks/useLang.d.ts +5 -1
- package/dist/hooks/useLang.js +13 -1
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +258 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -1
- package/dist/utils/input-classes.js +2 -2
- package/package.json +8 -5
- package/tailwind-preset.js +84 -160
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
const textClasses = {
|
|
2
|
-
variant: {
|
|
3
|
-
h1: 'text-[1.5rem] leading-[1.75rem] font-semibold',
|
|
4
|
-
h2: 'text-[1.25rem] leading-[1.5rem] font-semibold',
|
|
5
|
-
h3: 'text-[1rem] leading-[1.25rem] font-semibold',
|
|
6
|
-
body1Bold: 'text-[0.875rem] leading-[1.125rem] font-medium',
|
|
7
|
-
body1: 'text-[0.875rem] leading-[1.125rem] font-normal',
|
|
8
|
-
body2Bold: 'text-[0.75rem] leading-[1rem] font-medium',
|
|
9
|
-
body2: 'text-[0.75rem] leading-[1rem] font-normal',
|
|
10
|
-
body3Bold: 'text-[0.6875rem] leading-[1rem] font-medium',
|
|
11
|
-
body3: 'text-[0.6875rem] leading-[1rem] font-normal',
|
|
12
|
-
caption1Bold: 'text-[0.625rem] leading-[0.875rem] font-medium',
|
|
13
|
-
caption1: 'text-[0.625rem] leading-[0.875rem] font-normal'
|
|
14
|
-
},
|
|
15
|
-
color: {
|
|
16
|
-
default: '',
|
|
17
|
-
foreground: 'text-foreground',
|
|
18
|
-
secondary: 'text-foreground-300',
|
|
19
|
-
white: 'text-white',
|
|
20
|
-
tertiary: 'text-foreground-100',
|
|
21
|
-
primary: 'text-primary',
|
|
22
|
-
success: 'text-success',
|
|
23
|
-
danger: 'text-danger',
|
|
24
|
-
alert: 'text-alert',
|
|
25
|
-
warning: 'text-warning',
|
|
26
|
-
gold: 'text-gold',
|
|
27
|
-
bullish: 'text-bullish',
|
|
28
|
-
bearish: 'text-bearish'
|
|
29
|
-
},
|
|
30
|
-
fontWeight: {
|
|
31
|
-
normal: 'font-normal',
|
|
32
|
-
medium: 'font-medium',
|
|
33
|
-
semibold: 'font-semibold',
|
|
34
|
-
bold: 'font-bold',
|
|
35
|
-
extrabold: 'font-extrabold'
|
|
36
|
-
},
|
|
37
|
-
lineHeight: {
|
|
38
|
-
1: 'leading-none',
|
|
39
|
-
'1.4': 'leading-[1.4]'
|
|
40
|
-
},
|
|
41
|
-
align: {
|
|
42
|
-
left: 'text-left',
|
|
43
|
-
center: 'text-center',
|
|
44
|
-
right: 'text-right'
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export { textClasses };
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
export declare const textVariants: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
variant: {
|
|
3
|
+
h1: string;
|
|
4
|
+
h2: string;
|
|
5
|
+
h3: string;
|
|
6
|
+
body1Bold: string;
|
|
7
|
+
body1: string;
|
|
8
|
+
body2Bold: string;
|
|
9
|
+
body2: string;
|
|
10
|
+
body3Bold: string;
|
|
11
|
+
body3: string;
|
|
12
|
+
caption1Bold: string;
|
|
13
|
+
caption1: string;
|
|
14
|
+
};
|
|
15
|
+
h1: {
|
|
16
|
+
true: string;
|
|
17
|
+
};
|
|
18
|
+
h2: {
|
|
19
|
+
true: string;
|
|
20
|
+
};
|
|
21
|
+
h3: {
|
|
22
|
+
true: string;
|
|
23
|
+
};
|
|
24
|
+
body1Bold: {
|
|
25
|
+
true: string;
|
|
26
|
+
};
|
|
27
|
+
body1: {
|
|
28
|
+
true: string;
|
|
29
|
+
};
|
|
30
|
+
body2Bold: {
|
|
31
|
+
true: string;
|
|
32
|
+
};
|
|
33
|
+
body2: {
|
|
34
|
+
true: string;
|
|
35
|
+
};
|
|
36
|
+
body3Bold: {
|
|
37
|
+
true: string;
|
|
38
|
+
};
|
|
39
|
+
body3: {
|
|
40
|
+
true: string;
|
|
41
|
+
};
|
|
42
|
+
caption1Bold: {
|
|
43
|
+
true: string;
|
|
44
|
+
};
|
|
45
|
+
caption1: {
|
|
46
|
+
true: string;
|
|
47
|
+
};
|
|
48
|
+
fontWeight: {
|
|
49
|
+
normal: string;
|
|
50
|
+
medium: string;
|
|
51
|
+
semibold: string;
|
|
52
|
+
bold: string;
|
|
53
|
+
extrabold: string;
|
|
54
|
+
};
|
|
55
|
+
lineHeight: {
|
|
56
|
+
none: string;
|
|
57
|
+
'1': string;
|
|
58
|
+
'1.4': string;
|
|
59
|
+
};
|
|
60
|
+
}, undefined, "ux-text-base", {
|
|
61
|
+
variant: {
|
|
62
|
+
h1: string;
|
|
63
|
+
h2: string;
|
|
64
|
+
h3: string;
|
|
65
|
+
body1Bold: string;
|
|
66
|
+
body1: string;
|
|
67
|
+
body2Bold: string;
|
|
68
|
+
body2: string;
|
|
69
|
+
body3Bold: string;
|
|
70
|
+
body3: string;
|
|
71
|
+
caption1Bold: string;
|
|
72
|
+
caption1: string;
|
|
73
|
+
};
|
|
74
|
+
h1: {
|
|
75
|
+
true: string;
|
|
76
|
+
};
|
|
77
|
+
h2: {
|
|
78
|
+
true: string;
|
|
79
|
+
};
|
|
80
|
+
h3: {
|
|
81
|
+
true: string;
|
|
82
|
+
};
|
|
83
|
+
body1Bold: {
|
|
84
|
+
true: string;
|
|
85
|
+
};
|
|
86
|
+
body1: {
|
|
87
|
+
true: string;
|
|
88
|
+
};
|
|
89
|
+
body2Bold: {
|
|
90
|
+
true: string;
|
|
91
|
+
};
|
|
92
|
+
body2: {
|
|
93
|
+
true: string;
|
|
94
|
+
};
|
|
95
|
+
body3Bold: {
|
|
96
|
+
true: string;
|
|
97
|
+
};
|
|
98
|
+
body3: {
|
|
99
|
+
true: string;
|
|
100
|
+
};
|
|
101
|
+
caption1Bold: {
|
|
102
|
+
true: string;
|
|
103
|
+
};
|
|
104
|
+
caption1: {
|
|
105
|
+
true: string;
|
|
106
|
+
};
|
|
107
|
+
fontWeight: {
|
|
108
|
+
normal: string;
|
|
109
|
+
medium: string;
|
|
110
|
+
semibold: string;
|
|
111
|
+
bold: string;
|
|
112
|
+
extrabold: string;
|
|
113
|
+
};
|
|
114
|
+
lineHeight: {
|
|
115
|
+
none: string;
|
|
116
|
+
'1': string;
|
|
117
|
+
'1.4': string;
|
|
118
|
+
};
|
|
119
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
120
|
+
variant: {
|
|
121
|
+
h1: string;
|
|
122
|
+
h2: string;
|
|
123
|
+
h3: string;
|
|
124
|
+
body1Bold: string;
|
|
125
|
+
body1: string;
|
|
126
|
+
body2Bold: string;
|
|
127
|
+
body2: string;
|
|
128
|
+
body3Bold: string;
|
|
129
|
+
body3: string;
|
|
130
|
+
caption1Bold: string;
|
|
131
|
+
caption1: string;
|
|
132
|
+
};
|
|
133
|
+
h1: {
|
|
134
|
+
true: string;
|
|
135
|
+
};
|
|
136
|
+
h2: {
|
|
137
|
+
true: string;
|
|
138
|
+
};
|
|
139
|
+
h3: {
|
|
140
|
+
true: string;
|
|
141
|
+
};
|
|
142
|
+
body1Bold: {
|
|
143
|
+
true: string;
|
|
144
|
+
};
|
|
145
|
+
body1: {
|
|
146
|
+
true: string;
|
|
147
|
+
};
|
|
148
|
+
body2Bold: {
|
|
149
|
+
true: string;
|
|
150
|
+
};
|
|
151
|
+
body2: {
|
|
152
|
+
true: string;
|
|
153
|
+
};
|
|
154
|
+
body3Bold: {
|
|
155
|
+
true: string;
|
|
156
|
+
};
|
|
157
|
+
body3: {
|
|
158
|
+
true: string;
|
|
159
|
+
};
|
|
160
|
+
caption1Bold: {
|
|
161
|
+
true: string;
|
|
162
|
+
};
|
|
163
|
+
caption1: {
|
|
164
|
+
true: string;
|
|
165
|
+
};
|
|
166
|
+
fontWeight: {
|
|
167
|
+
normal: string;
|
|
168
|
+
medium: string;
|
|
169
|
+
semibold: string;
|
|
170
|
+
bold: string;
|
|
171
|
+
extrabold: string;
|
|
172
|
+
};
|
|
173
|
+
lineHeight: {
|
|
174
|
+
none: string;
|
|
175
|
+
'1': string;
|
|
176
|
+
'1.4': string;
|
|
177
|
+
};
|
|
178
|
+
}, undefined, "ux-text-base", unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { tv } from "@heroui/theme";
|
|
2
|
+
const h1 = 'text-[1.5rem] leading-[1.75rem] font-semibold';
|
|
3
|
+
const h2 = 'text-[1.25rem] leading-[1.5rem] font-semibold';
|
|
4
|
+
const h3 = 'text-[1rem] leading-[1.25rem] font-semibold';
|
|
5
|
+
const body1Bold = 'text-[0.875rem] leading-[1.125rem] font-medium';
|
|
6
|
+
const body1 = 'text-[0.875rem] leading-[1.125rem] font-normal';
|
|
7
|
+
const body2Bold = 'text-[0.75rem] leading-[1rem] font-medium';
|
|
8
|
+
const body2 = 'text-[0.75rem] leading-[1rem] font-normal';
|
|
9
|
+
const body3Bold = 'text-[0.6875rem] leading-[1rem] font-medium';
|
|
10
|
+
const body3 = 'text-[0.6875rem] leading-[1rem] font-normal';
|
|
11
|
+
const caption1Bold = 'text-[0.625rem] leading-[0.875rem] font-medium';
|
|
12
|
+
const caption1 = 'text-[0.625rem] leading-[0.875rem] font-normal';
|
|
13
|
+
const textVariants = tv({
|
|
14
|
+
base: 'ux-text-base',
|
|
15
|
+
variants: {
|
|
16
|
+
variant: {
|
|
17
|
+
h1,
|
|
18
|
+
h2,
|
|
19
|
+
h3,
|
|
20
|
+
body1Bold,
|
|
21
|
+
body1,
|
|
22
|
+
body2Bold,
|
|
23
|
+
body2,
|
|
24
|
+
body3Bold,
|
|
25
|
+
body3,
|
|
26
|
+
caption1Bold,
|
|
27
|
+
caption1
|
|
28
|
+
},
|
|
29
|
+
h1: {
|
|
30
|
+
true: h1
|
|
31
|
+
},
|
|
32
|
+
h2: {
|
|
33
|
+
true: h2
|
|
34
|
+
},
|
|
35
|
+
h3: {
|
|
36
|
+
true: h3
|
|
37
|
+
},
|
|
38
|
+
body1Bold: {
|
|
39
|
+
true: body1Bold
|
|
40
|
+
},
|
|
41
|
+
body1: {
|
|
42
|
+
true: body1
|
|
43
|
+
},
|
|
44
|
+
body2Bold: {
|
|
45
|
+
true: body2Bold
|
|
46
|
+
},
|
|
47
|
+
body2: {
|
|
48
|
+
true: body2
|
|
49
|
+
},
|
|
50
|
+
body3Bold: {
|
|
51
|
+
true: body3Bold
|
|
52
|
+
},
|
|
53
|
+
body3: {
|
|
54
|
+
true: body3
|
|
55
|
+
},
|
|
56
|
+
caption1Bold: {
|
|
57
|
+
true: caption1Bold
|
|
58
|
+
},
|
|
59
|
+
caption1: {
|
|
60
|
+
true: caption1
|
|
61
|
+
},
|
|
62
|
+
fontWeight: {
|
|
63
|
+
normal: 'font-normal',
|
|
64
|
+
medium: 'font-medium',
|
|
65
|
+
semibold: 'font-semibold',
|
|
66
|
+
bold: 'font-bold',
|
|
67
|
+
extrabold: 'font-extrabold'
|
|
68
|
+
},
|
|
69
|
+
lineHeight: {
|
|
70
|
+
none: 'leading-none',
|
|
71
|
+
1: 'leading-none',
|
|
72
|
+
'1.4': 'leading-[1.4]'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
variant: 'body2Bold'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export { textVariants };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Config, ConfigColors, ConfigLayout } from './types';
|
|
2
|
+
export declare const defaultDarkColorWeight = 20;
|
|
3
|
+
export declare const defaultLightColorWeight = 17.5;
|
|
4
|
+
export declare const colorWeight = 17.5;
|
|
5
|
+
export declare const floatNumberPattern: RegExp;
|
|
6
|
+
export declare const colorsId = "th-colors";
|
|
7
|
+
export declare const defaultColorsId = "th-default-colors";
|
|
8
|
+
export declare const baseColorsId = "th-base-colors";
|
|
9
|
+
export declare const otherColorsId = "th-other-colors";
|
|
10
|
+
export declare const showcaseId = "th-showcase";
|
|
11
|
+
export declare const contentShowcaseId = "th-content-showcase";
|
|
12
|
+
export declare const contentColorsId = "th-content-colors";
|
|
13
|
+
export declare const configKey = "config";
|
|
14
|
+
export declare const syncThemesKey = "sync-themes";
|
|
15
|
+
export declare const initialLightTheme: ConfigColors;
|
|
16
|
+
export declare const initialDarkTheme: ConfigColors;
|
|
17
|
+
export declare const initialLayout: ConfigLayout;
|
|
18
|
+
export declare const initialConfig: Config;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { colors } from "@heroui/theme";
|
|
2
|
+
const defaultDarkColorWeight = 20;
|
|
3
|
+
const defaultLightColorWeight = 17.5;
|
|
4
|
+
const colorWeight = 17.5;
|
|
5
|
+
const floatNumberPattern = /^\d+(\.\d*)?$/;
|
|
6
|
+
const colorsId = 'th-colors';
|
|
7
|
+
const defaultColorsId = 'th-default-colors';
|
|
8
|
+
const baseColorsId = 'th-base-colors';
|
|
9
|
+
const otherColorsId = 'th-other-colors';
|
|
10
|
+
const showcaseId = 'th-showcase';
|
|
11
|
+
const contentShowcaseId = 'th-content-showcase';
|
|
12
|
+
const contentColorsId = 'th-content-colors';
|
|
13
|
+
const configKey = 'config';
|
|
14
|
+
const syncThemesKey = 'sync-themes';
|
|
15
|
+
const initialLightTheme = {
|
|
16
|
+
defaultColor: {
|
|
17
|
+
default: '#d4d4d8'
|
|
18
|
+
},
|
|
19
|
+
baseColor: {
|
|
20
|
+
primary: colors.blue["500"],
|
|
21
|
+
secondary: colors.purple["500"],
|
|
22
|
+
success: colors.green["500"],
|
|
23
|
+
warning: colors.yellow["500"],
|
|
24
|
+
danger: colors.red["500"]
|
|
25
|
+
},
|
|
26
|
+
layoutColor: {
|
|
27
|
+
foreground: colors.black,
|
|
28
|
+
background: colors.white,
|
|
29
|
+
focus: colors.blue["500"],
|
|
30
|
+
overlay: colors.white
|
|
31
|
+
},
|
|
32
|
+
contentColor: {
|
|
33
|
+
content1: colors.white,
|
|
34
|
+
content2: colors.zinc["100"],
|
|
35
|
+
content3: colors.zinc["200"],
|
|
36
|
+
content4: colors.zinc["300"]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const initialDarkTheme = {
|
|
40
|
+
defaultColor: {
|
|
41
|
+
default: colors.zinc["700"]
|
|
42
|
+
},
|
|
43
|
+
baseColor: {
|
|
44
|
+
primary: colors.blue["500"],
|
|
45
|
+
secondary: colors.purple["500"],
|
|
46
|
+
success: colors.green["500"],
|
|
47
|
+
warning: colors.yellow["500"],
|
|
48
|
+
danger: colors.red["500"]
|
|
49
|
+
},
|
|
50
|
+
layoutColor: {
|
|
51
|
+
foreground: colors.white,
|
|
52
|
+
background: colors.black,
|
|
53
|
+
focus: colors.blue["500"],
|
|
54
|
+
overlay: colors.black
|
|
55
|
+
},
|
|
56
|
+
contentColor: {
|
|
57
|
+
content1: colors.zinc["900"],
|
|
58
|
+
content2: colors.zinc["800"],
|
|
59
|
+
content3: colors.zinc["700"],
|
|
60
|
+
content4: colors.zinc["600"]
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const initialLayout = {
|
|
64
|
+
fontSize: {
|
|
65
|
+
tiny: '0.75',
|
|
66
|
+
small: '0.875',
|
|
67
|
+
medium: '1',
|
|
68
|
+
large: '1.125'
|
|
69
|
+
},
|
|
70
|
+
lineHeight: {
|
|
71
|
+
tiny: '1',
|
|
72
|
+
small: '1.25',
|
|
73
|
+
medium: '1.5',
|
|
74
|
+
large: '1.75'
|
|
75
|
+
},
|
|
76
|
+
radius: {
|
|
77
|
+
small: '0.5',
|
|
78
|
+
medium: '0.75',
|
|
79
|
+
large: '0.875'
|
|
80
|
+
},
|
|
81
|
+
borderWidth: {
|
|
82
|
+
small: '1',
|
|
83
|
+
medium: '2',
|
|
84
|
+
large: '3'
|
|
85
|
+
},
|
|
86
|
+
otherParams: {
|
|
87
|
+
disabledOpacity: '0.5',
|
|
88
|
+
dividerWeight: '1',
|
|
89
|
+
hoverOpacity: '0.9'
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const initialConfig = {
|
|
93
|
+
name: 'heroui',
|
|
94
|
+
light: initialLightTheme,
|
|
95
|
+
dark: initialDarkTheme,
|
|
96
|
+
layout: initialLayout
|
|
97
|
+
};
|
|
98
|
+
export { baseColorsId, colorWeight, colorsId, configKey, contentColorsId, contentShowcaseId, defaultColorsId, defaultDarkColorWeight, defaultLightColorWeight, floatNumberPattern, initialConfig, initialDarkTheme, initialLayout, initialLightTheme, otherColorsId, showcaseId, syncThemesKey };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export interface ColorShades {
|
|
2
|
+
50: string;
|
|
3
|
+
100: string;
|
|
4
|
+
200: string;
|
|
5
|
+
300: string;
|
|
6
|
+
400: string;
|
|
7
|
+
500: string;
|
|
8
|
+
600: string;
|
|
9
|
+
700: string;
|
|
10
|
+
800: string;
|
|
11
|
+
900: string;
|
|
12
|
+
}
|
|
13
|
+
export type ColorPickerType = 'background' | 'content1' | 'content2' | 'content3' | 'content4' | 'danger' | 'default' | 'divider' | 'focus' | 'foreground' | 'overlay' | 'primary' | 'secondary' | 'success' | 'warning';
|
|
14
|
+
export type Color = 'default' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
|
|
15
|
+
export type Size = 'sm' | 'md' | 'lg';
|
|
16
|
+
export type Variant = 'dot' | 'solid' | 'faded' | 'bordered' | 'light' | 'flat' | 'ghost' | 'shadow' | 'underlined';
|
|
17
|
+
export type Radius = 'none' | 'sm' | 'md' | 'lg' | 'full';
|
|
18
|
+
export type HeroUIScaling = 90 | 95 | 100 | 105 | 110;
|
|
19
|
+
export type Border = 'thin' | 'medium' | 'thick';
|
|
20
|
+
export type FontName = 'Inter' | 'Roboto' | 'Outfit' | 'Lora';
|
|
21
|
+
export type ThemeType = 'light' | 'dark';
|
|
22
|
+
export interface ThemeColor extends ColorShades {
|
|
23
|
+
foreground: string;
|
|
24
|
+
DEFAULT: string;
|
|
25
|
+
}
|
|
26
|
+
export interface Config {
|
|
27
|
+
name: TemplateType;
|
|
28
|
+
light: ConfigColors;
|
|
29
|
+
dark: ConfigColors;
|
|
30
|
+
layout: ConfigLayout;
|
|
31
|
+
}
|
|
32
|
+
export interface ConfigColors {
|
|
33
|
+
defaultColor: {
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
baseColor: {
|
|
37
|
+
primary: string;
|
|
38
|
+
secondary: string;
|
|
39
|
+
success: string;
|
|
40
|
+
warning: string;
|
|
41
|
+
danger: string;
|
|
42
|
+
};
|
|
43
|
+
layoutColor: {
|
|
44
|
+
foreground: string;
|
|
45
|
+
background: string;
|
|
46
|
+
focus: string;
|
|
47
|
+
overlay: string;
|
|
48
|
+
};
|
|
49
|
+
contentColor: {
|
|
50
|
+
content1: string;
|
|
51
|
+
content2: string;
|
|
52
|
+
content3: string;
|
|
53
|
+
content4: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export interface ConfigLayout {
|
|
57
|
+
fontSize: {
|
|
58
|
+
tiny: string;
|
|
59
|
+
small: string;
|
|
60
|
+
medium: string;
|
|
61
|
+
large: string;
|
|
62
|
+
};
|
|
63
|
+
lineHeight: {
|
|
64
|
+
tiny: string;
|
|
65
|
+
small: string;
|
|
66
|
+
medium: string;
|
|
67
|
+
large: string;
|
|
68
|
+
};
|
|
69
|
+
radius: {
|
|
70
|
+
small: string;
|
|
71
|
+
medium: string;
|
|
72
|
+
large: string;
|
|
73
|
+
};
|
|
74
|
+
borderWidth: {
|
|
75
|
+
small: string;
|
|
76
|
+
medium: string;
|
|
77
|
+
large: string;
|
|
78
|
+
};
|
|
79
|
+
otherParams: {
|
|
80
|
+
disabledOpacity: string;
|
|
81
|
+
dividerWeight: string;
|
|
82
|
+
hoverOpacity: string;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
export interface Template {
|
|
86
|
+
label: string;
|
|
87
|
+
name: TemplateType;
|
|
88
|
+
value: Config;
|
|
89
|
+
}
|
|
90
|
+
export type TemplateType = 'coffee' | 'emerald' | 'heroui' | 'elegant' | 'modern' | 'retro';
|
|
91
|
+
export type FontType = 'Inter' | 'Roboto' | 'Outfit' | 'Lora';
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ColorPickerType, ThemeType } from '../types';
|
|
2
|
+
import Values from 'values.js';
|
|
3
|
+
/**
|
|
4
|
+
* Convert color values to RGB
|
|
5
|
+
*/
|
|
6
|
+
export declare function colorValuesToRgb(value: Values): string;
|
|
7
|
+
/**
|
|
8
|
+
* Convert hex color to HSL
|
|
9
|
+
*/
|
|
10
|
+
export declare function hexToHsl(hex: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the color weight
|
|
13
|
+
*/
|
|
14
|
+
export declare function getColorWeight(colorType: ColorPickerType, theme: ThemeType): 20 | 17.5;
|
|
15
|
+
/**
|
|
16
|
+
* Generate theme color
|
|
17
|
+
*/
|
|
18
|
+
export declare function generateThemeColor(color: string, type: ColorPickerType, theme: ThemeType): {
|
|
19
|
+
twTheme: {
|
|
20
|
+
foreground: string;
|
|
21
|
+
DEFAULT: string;
|
|
22
|
+
50: string;
|
|
23
|
+
100: string;
|
|
24
|
+
200: string;
|
|
25
|
+
300: string;
|
|
26
|
+
400: string;
|
|
27
|
+
500: string;
|
|
28
|
+
600: string;
|
|
29
|
+
700: string;
|
|
30
|
+
800: string;
|
|
31
|
+
900: string;
|
|
32
|
+
};
|
|
33
|
+
cssVariables: string[][];
|
|
34
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { readableColor } from "color2k";
|
|
2
|
+
import { colorWeight as external_constants_js_colorWeight, defaultDarkColorWeight, defaultLightColorWeight } from "../constants.js";
|
|
3
|
+
import { swapColorValues } from "./object.js";
|
|
4
|
+
import values_0 from "values.js";
|
|
5
|
+
function colorValuesToRgb(value) {
|
|
6
|
+
return `rgba(${value.rgb.join(', ')}, ${value.alpha})`;
|
|
7
|
+
}
|
|
8
|
+
function hexToRgb(hex) {
|
|
9
|
+
let r = 0, g = 0, b = 0;
|
|
10
|
+
if (4 === hex.length || 5 === hex.length) {
|
|
11
|
+
r = parseInt(hex[1] + hex[1], 16);
|
|
12
|
+
g = parseInt(hex[2] + hex[2], 16);
|
|
13
|
+
b = parseInt(hex[3] + hex[3], 16);
|
|
14
|
+
} else if (7 === hex.length || 9 === hex.length) {
|
|
15
|
+
r = parseInt(hex.slice(1, 3), 16);
|
|
16
|
+
g = parseInt(hex.slice(3, 5), 16);
|
|
17
|
+
b = parseInt(hex.slice(5, 7), 16);
|
|
18
|
+
} else throw new Error('Invalid hex color format');
|
|
19
|
+
return [
|
|
20
|
+
r,
|
|
21
|
+
g,
|
|
22
|
+
b
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
function hexToHsl(hex) {
|
|
26
|
+
const [r, g, b] = hexToRgb(hex);
|
|
27
|
+
const normalizedR = r / 255;
|
|
28
|
+
const normalizedG = g / 255;
|
|
29
|
+
const normalizedB = b / 255;
|
|
30
|
+
const max = Math.max(normalizedR, normalizedG, normalizedB);
|
|
31
|
+
const min = Math.min(normalizedR, normalizedG, normalizedB);
|
|
32
|
+
const lightness = (max + min) / 2;
|
|
33
|
+
if (max === min) return `0 0% ${100 * lightness}%`;
|
|
34
|
+
let saturation = 0;
|
|
35
|
+
saturation = lightness < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);
|
|
36
|
+
let hue;
|
|
37
|
+
hue = max === normalizedR ? (normalizedG - normalizedB) / (max - min) : max === normalizedG ? 2 + (normalizedB - normalizedR) / (max - min) : 4 + (normalizedR - normalizedG) / (max - min);
|
|
38
|
+
hue *= 60;
|
|
39
|
+
if (hue < 0) hue += 360;
|
|
40
|
+
return `${hue.toFixed(2)} ${(100 * saturation).toFixed(2)}% ${(100 * lightness).toFixed(2)}%`;
|
|
41
|
+
}
|
|
42
|
+
function getColorWeight(colorType, theme) {
|
|
43
|
+
if ('default' === colorType) return 'dark' === theme ? defaultDarkColorWeight : defaultLightColorWeight;
|
|
44
|
+
return external_constants_js_colorWeight;
|
|
45
|
+
}
|
|
46
|
+
function rgbValueToHex(c) {
|
|
47
|
+
const hex = c.toString(16);
|
|
48
|
+
return 1 === hex.length ? `0${hex}` : hex;
|
|
49
|
+
}
|
|
50
|
+
function rgbToHex([r, g, b]) {
|
|
51
|
+
return `#${rgbValueToHex(r)}${rgbValueToHex(g)}${rgbValueToHex(b)}`;
|
|
52
|
+
}
|
|
53
|
+
function generateThemeColor(color, type, theme) {
|
|
54
|
+
const values = new values_0(color);
|
|
55
|
+
const colorWeight = getColorWeight(type, theme);
|
|
56
|
+
const colorValues = values.all(colorWeight);
|
|
57
|
+
const shades = colorValues.slice(0, colorValues.length - 1).reduce((acc, shadeValue, index)=>{
|
|
58
|
+
acc[0 === index ? 50 : 100 * index] = rgbToHex(shadeValue.rgb);
|
|
59
|
+
return acc;
|
|
60
|
+
}, {});
|
|
61
|
+
const twTheme = {
|
|
62
|
+
...'light' === theme ? shades : swapColorValues(shades),
|
|
63
|
+
foreground: readableColor(shades[500]),
|
|
64
|
+
DEFAULT: shades[500]
|
|
65
|
+
};
|
|
66
|
+
const cssVariables = [
|
|
67
|
+
[
|
|
68
|
+
`--heroui-${type}-50`,
|
|
69
|
+
twTheme[50]
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
`--heroui-${type}-100`,
|
|
73
|
+
twTheme[100]
|
|
74
|
+
],
|
|
75
|
+
[
|
|
76
|
+
`--heroui-${type}-200`,
|
|
77
|
+
twTheme[200]
|
|
78
|
+
],
|
|
79
|
+
[
|
|
80
|
+
`--heroui-${type}-300`,
|
|
81
|
+
twTheme[300]
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
`--heroui-${type}-400`,
|
|
85
|
+
twTheme[400]
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
`--heroui-${type}-500`,
|
|
89
|
+
twTheme[500]
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
`--heroui-${type}-600`,
|
|
93
|
+
twTheme[600]
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
`--heroui-${type}-700`,
|
|
97
|
+
twTheme[700]
|
|
98
|
+
],
|
|
99
|
+
[
|
|
100
|
+
`--heroui-${type}-800`,
|
|
101
|
+
twTheme[800]
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
`--heroui-${type}-900`,
|
|
105
|
+
twTheme[900]
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
`--heroui-${type}-foreground`,
|
|
109
|
+
twTheme.foreground
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
`--heroui-${type}`,
|
|
113
|
+
twTheme.DEFAULT
|
|
114
|
+
]
|
|
115
|
+
];
|
|
116
|
+
return {
|
|
117
|
+
twTheme,
|
|
118
|
+
cssVariables
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
export { colorValuesToRgb, generateThemeColor, getColorWeight, hexToHsl };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function swapColorValues<T extends Object>(colors: T): {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function swapColorValues(colors) {
|
|
2
|
+
const swappedColors = {};
|
|
3
|
+
const keys = Object.keys(colors);
|
|
4
|
+
const { length } = keys;
|
|
5
|
+
for(let i = 0; i < length / 2; i++){
|
|
6
|
+
const key1 = keys[i];
|
|
7
|
+
const key2 = keys[length - 1 - i];
|
|
8
|
+
swappedColors[key1] = colors[key2];
|
|
9
|
+
swappedColors[key2] = colors[key1];
|
|
10
|
+
}
|
|
11
|
+
if (length % 2 !== 0) {
|
|
12
|
+
const middleKey = keys[Math.floor(length / 2)];
|
|
13
|
+
swappedColors[middleKey] = colors[middleKey];
|
|
14
|
+
}
|
|
15
|
+
return swappedColors;
|
|
16
|
+
}
|
|
17
|
+
export { swapColorValues };
|