@zidian-ui/core 0.1.4 → 0.2.0
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/esm/assets/packages/@zidian-ui/core/src/components/collection/List/List.css.ts.vanilla-BeW6Frwm.css +27 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/common/Button/Button.css.ts.vanilla-BgimV8hB.css +183 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/common/Tag/Tag.css.ts.vanilla-lf0HgPmO.css +103 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/input/SelectWrapper/SelectWrapper.css.ts.vanilla-C2qmBkSh.css +17 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/input/components/inputInner/InputInner.css.ts.vanilla-Dylafkkf.css +150 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/modal/Drawer/Drawer.css.ts.vanilla-g4GnhXaQ.css +45 -0
- package/esm/assets/packages/@zidian-ui/core/src/components/other/Cascader/Cascader.css.ts.vanilla-Bp7URCRM.css +49 -0
- package/esm/components/collection/List/List.css.js +9 -0
- package/esm/components/collection/List/List.js +71 -0
- package/esm/components/collection/List/components/DefaultContentPlace.js +63 -0
- package/esm/components/collection/List/components/DefaultItemPlace.js +50 -0
- package/esm/components/common/Button/Button.css.js +6 -0
- package/esm/components/common/Button/Button.js +42 -0
- package/esm/components/common/Tag/Tag.css.js +6 -0
- package/esm/components/common/Tag/Tag.js +29 -0
- package/esm/components/input/SelectWrapper/SelectWrapper.css.js +6 -0
- package/esm/components/input/SelectWrapper/SelectWrapper.js +51 -0
- package/esm/components/input/SelectWrapper/components/SelectWrapperPortal/SelectWrapperPortal.js +23 -0
- package/esm/components/input/SelectWrapper/components/SelectWrapperValue/SelectWrapperValue.js +22 -0
- package/esm/components/input/components/inputInner/InputInner.css.js +8 -0
- package/esm/components/input/components/inputInner/InputInner.js +21 -0
- package/esm/components/modal/Drawer/Drawer.css.js +7 -0
- package/esm/components/modal/Drawer/Drawer.js +54 -0
- package/esm/components/other/Cascader/Cascader.css.js +10 -0
- package/esm/components/other/Cascader/Cascader.js +109 -0
- package/esm/external/.pnpm/@vanilla-extract_recipes@0.5.7_@vanilla-extract_css@1.18.0/node_modules/@vanilla-extract/recipes/dist/createRuntimeFn-62c9670f.esm.js +111 -0
- package/esm/index.js +13 -0
- package/esm/theme/provider/ThemeProvider.js +34 -0
- package/esm/theme/token/contract.js +128 -0
- package/esm/theme/token/tokenMap.js +52 -0
- package/esm/theme/token/tokenSetup.js +87 -0
- package/esm/theme/utils/color.js +42 -0
- package/esm/theme/utils/contract.js +15 -0
- package/esm/theme/utils/token.js +39 -0
- package/lib/components/collection/List/List.css.d.ts +5 -0
- package/lib/components/collection/List/List.d.ts +1 -0
- package/lib/components/collection/List/List.prop.d.ts +13 -0
- package/lib/components/collection/List/components/DefaultContentPlace.d.ts +1 -0
- package/lib/components/collection/List/components/DefaultItemPlace.d.ts +1 -0
- package/lib/components/collection/List/index.d.ts +2 -0
- package/lib/components/collection/index.d.ts +1 -0
- package/lib/components/common/Button/Button.css.d.ts +137 -0
- package/lib/components/common/Button/Button.d.ts +2 -0
- package/lib/components/common/Button/Button.props.d.ts +10 -0
- package/lib/components/common/Button/index.d.ts +2 -0
- package/lib/components/common/Tag/Tag.css.d.ts +67 -0
- package/lib/components/common/Tag/Tag.d.ts +2 -0
- package/lib/components/common/Tag/Tag.props.d.ts +8 -0
- package/lib/components/common/Tag/index.d.ts +2 -0
- package/lib/components/common/index.d.ts +2 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/components/input/SelectWrapper/SelectWrapper.css.d.ts +2 -0
- package/lib/components/input/SelectWrapper/SelectWrapper.d.ts +2 -0
- package/lib/components/input/SelectWrapper/SelectWrapper.props.d.ts +32 -0
- package/lib/components/input/SelectWrapper/components/SelectWrapperPortal/SelectWrapperPortal.d.ts +10 -0
- package/lib/components/input/SelectWrapper/components/SelectWrapperValue/SelectWrapperValue.d.ts +7 -0
- package/lib/components/input/SelectWrapper/index.d.ts +2 -0
- package/lib/components/input/components/inputInner/InputInner.css.d.ts +92 -0
- package/lib/components/input/components/inputInner/InputInner.d.ts +2 -0
- package/lib/components/input/components/inputInner/inputInner.props.d.ts +11 -0
- package/lib/components/input/index.d.ts +1 -0
- package/lib/components/modal/Drawer/Drawer.css.d.ts +34 -0
- package/lib/components/modal/Drawer/Drawer.d.ts +2 -0
- package/lib/components/modal/Drawer/Drawer.props.d.ts +10 -0
- package/lib/components/modal/Drawer/index.d.ts +2 -0
- package/lib/components/modal/index.d.ts +1 -0
- package/lib/components/other/Cascader/Cascader.css.d.ts +6 -0
- package/lib/components/other/Cascader/Cascader.d.ts +2 -0
- package/lib/components/other/Cascader/Cascader.props.d.ts +17 -0
- package/lib/components/other/Cascader/index.d.ts +2 -0
- package/lib/components/other/index.d.ts +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/theme/common/common.css.d.ts +1 -0
- package/lib/theme/common/motion.d.ts +0 -0
- package/lib/theme/contract/colorContract.css.d.ts +8 -0
- package/lib/theme/contract/themeContract.css.d.ts +134 -0
- package/lib/theme/index.d.ts +8 -0
- package/lib/theme/provider/ThemeProvider.d.ts +9 -0
- package/lib/theme/token/contract.d.ts +169 -0
- package/lib/theme/token/tokenMap.d.ts +90 -0
- package/lib/theme/token/tokenSetup.d.ts +85 -0
- package/lib/theme/types/token.d.ts +41 -0
- package/lib/theme/utils/color.d.ts +37 -0
- package/lib/theme/utils/contract.d.ts +2 -0
- package/lib/theme/utils/token.d.ts +19 -0
- package/package.json +5 -5
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createContext, useEffect, useContext } from 'react';
|
|
3
|
+
import { createSemanticTokenVars } from '../utils/token.js';
|
|
4
|
+
|
|
5
|
+
const createGlobalTheme = (token, themeId = "theme-vars") => {
|
|
6
|
+
const cssVars = Object.entries(token).map(([key, value]) => `--sys-${key}: ${value};`).join("\n");
|
|
7
|
+
const cssContent = `:root {
|
|
8
|
+
${cssVars}
|
|
9
|
+
}`;
|
|
10
|
+
let styleTag = document.getElementById(themeId);
|
|
11
|
+
if (!styleTag) {
|
|
12
|
+
styleTag = document.createElement("style");
|
|
13
|
+
styleTag.id = themeId;
|
|
14
|
+
document.head.appendChild(styleTag);
|
|
15
|
+
}
|
|
16
|
+
styleTag.textContent = cssContent;
|
|
17
|
+
};
|
|
18
|
+
const ThemeContext = createContext(null);
|
|
19
|
+
const ThemeProvider = ({ children, tokens }) => {
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const semanticVars = createSemanticTokenVars(tokens);
|
|
22
|
+
createGlobalTheme(semanticVars);
|
|
23
|
+
}, [tokens]);
|
|
24
|
+
return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: tokens, children });
|
|
25
|
+
};
|
|
26
|
+
const useTheme = () => {
|
|
27
|
+
const context = useContext(ThemeContext);
|
|
28
|
+
if (!context) {
|
|
29
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
30
|
+
}
|
|
31
|
+
return context;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { ThemeProvider, useTheme };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { colorSetup } from './tokenSetup.js';
|
|
2
|
+
|
|
3
|
+
const mainColorContractStruct = {
|
|
4
|
+
main: null,
|
|
5
|
+
onMain: null,
|
|
6
|
+
container: null,
|
|
7
|
+
onContainer: null
|
|
8
|
+
};
|
|
9
|
+
const neutralColorContractStruct = {
|
|
10
|
+
dim: null,
|
|
11
|
+
main: null,
|
|
12
|
+
bright: null,
|
|
13
|
+
onMain: null,
|
|
14
|
+
containerHighest: null,
|
|
15
|
+
containerHigh: null,
|
|
16
|
+
container: null,
|
|
17
|
+
containerLow: null,
|
|
18
|
+
containerLowest: null
|
|
19
|
+
};
|
|
20
|
+
const neutralVariantColorContractStruct = {
|
|
21
|
+
main: null,
|
|
22
|
+
variant: null,
|
|
23
|
+
onSurfaceVariant: null,
|
|
24
|
+
outlineVariant: null
|
|
25
|
+
};
|
|
26
|
+
const inverseColorContractStruct = {
|
|
27
|
+
surface: null,
|
|
28
|
+
onSurface: null,
|
|
29
|
+
primary: null
|
|
30
|
+
};
|
|
31
|
+
const elevationColorContractStruct = {
|
|
32
|
+
scrim: null,
|
|
33
|
+
shadow: null
|
|
34
|
+
};
|
|
35
|
+
const colorStyleContractStruct = {
|
|
36
|
+
...Object.keys(colorSetup.main).reduce((res, key) => {
|
|
37
|
+
res[key] = mainColorContractStruct;
|
|
38
|
+
return res;
|
|
39
|
+
}, {}),
|
|
40
|
+
...Object.keys(colorSetup.other).reduce((res, key) => {
|
|
41
|
+
res[key] = mainColorContractStruct;
|
|
42
|
+
return res;
|
|
43
|
+
}, {}),
|
|
44
|
+
...Object.keys(colorSetup.neutral).reduce((res, key) => {
|
|
45
|
+
res[key] = neutralColorContractStruct;
|
|
46
|
+
return res;
|
|
47
|
+
}, {}),
|
|
48
|
+
...Object.keys(colorSetup.neutralVariant).reduce((res, key) => {
|
|
49
|
+
res[key] = neutralVariantColorContractStruct;
|
|
50
|
+
return res;
|
|
51
|
+
}, {}),
|
|
52
|
+
inverse: inverseColorContractStruct,
|
|
53
|
+
elevation: {
|
|
54
|
+
scrim: null,
|
|
55
|
+
shadow: null
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const otherStyleContractStruct = {
|
|
59
|
+
font: {
|
|
60
|
+
size: {
|
|
61
|
+
title: {
|
|
62
|
+
xs: null,
|
|
63
|
+
sm: null,
|
|
64
|
+
md: null,
|
|
65
|
+
lg: null,
|
|
66
|
+
xl: null
|
|
67
|
+
},
|
|
68
|
+
label: {
|
|
69
|
+
xs: null,
|
|
70
|
+
sm: null,
|
|
71
|
+
md: null,
|
|
72
|
+
lg: null,
|
|
73
|
+
xl: null
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
weight: {
|
|
77
|
+
lighter: null,
|
|
78
|
+
light: null,
|
|
79
|
+
normal: null,
|
|
80
|
+
medium: null,
|
|
81
|
+
bold: null,
|
|
82
|
+
bolder: null
|
|
83
|
+
},
|
|
84
|
+
lineHeight: {
|
|
85
|
+
xs: null,
|
|
86
|
+
sm: null,
|
|
87
|
+
md: null,
|
|
88
|
+
lg: null,
|
|
89
|
+
xl: null
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
spacing: {
|
|
93
|
+
layout: {
|
|
94
|
+
xs: null,
|
|
95
|
+
sm: null,
|
|
96
|
+
md: null,
|
|
97
|
+
lg: null,
|
|
98
|
+
xl: null
|
|
99
|
+
},
|
|
100
|
+
content: {
|
|
101
|
+
xs: null,
|
|
102
|
+
sm: null,
|
|
103
|
+
md: null,
|
|
104
|
+
lg: null,
|
|
105
|
+
xl: null
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
radius: {
|
|
109
|
+
sm: null,
|
|
110
|
+
md: null,
|
|
111
|
+
lg: null,
|
|
112
|
+
xl: null,
|
|
113
|
+
full: null
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const stateContractStruct = {
|
|
117
|
+
hover: null,
|
|
118
|
+
focus: null,
|
|
119
|
+
pressed: null,
|
|
120
|
+
dragged: null
|
|
121
|
+
};
|
|
122
|
+
const tokenContractStruct = {
|
|
123
|
+
state: stateContractStruct,
|
|
124
|
+
color: colorStyleContractStruct,
|
|
125
|
+
...otherStyleContractStruct
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export { elevationColorContractStruct, inverseColorContractStruct, mainColorContractStruct, neutralColorContractStruct, neutralVariantColorContractStruct, tokenContractStruct };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const defaultColorMap = {
|
|
2
|
+
main: {
|
|
3
|
+
main: { light: 40, dark: 80 },
|
|
4
|
+
// primary
|
|
5
|
+
onMain: { light: 100, dark: 20 },
|
|
6
|
+
// onPrimary
|
|
7
|
+
container: { light: 90, dark: 30 },
|
|
8
|
+
// primaryContainer
|
|
9
|
+
onContainer: { light: 10, dark: 90 }
|
|
10
|
+
// onPrimaryContainer
|
|
11
|
+
},
|
|
12
|
+
neutral: {
|
|
13
|
+
dim: { light: 87, dark: 6 },
|
|
14
|
+
// surfaceDim
|
|
15
|
+
main: { light: 98, dark: 6 },
|
|
16
|
+
// surface
|
|
17
|
+
bright: { light: 98, dark: 24 },
|
|
18
|
+
// surfaceBright
|
|
19
|
+
onMain: { light: 10, dark: 90 },
|
|
20
|
+
// onSurface
|
|
21
|
+
containerLowest: { light: 100, dark: 4 },
|
|
22
|
+
// surfaceContainerLowest
|
|
23
|
+
containerLow: { light: 96, dark: 10 },
|
|
24
|
+
// surfaceContainerLow
|
|
25
|
+
container: { light: 94, dark: 12 },
|
|
26
|
+
// surfaceContainer
|
|
27
|
+
containerHigh: { light: 92, dark: 17 },
|
|
28
|
+
// surfaceContainerHigh
|
|
29
|
+
containerHighest: { light: 90, dark: 22 }
|
|
30
|
+
// surfaceContainerHighest
|
|
31
|
+
},
|
|
32
|
+
neutralVariant: {
|
|
33
|
+
main: { light: 50, dark: 60 },
|
|
34
|
+
// outline (M3 规范: Light 50, Dark 60)
|
|
35
|
+
variant: { light: 90, dark: 30 },
|
|
36
|
+
// surfaceVariant
|
|
37
|
+
onSurfaceVariant: { light: 30, dark: 80 },
|
|
38
|
+
// onSurfaceVariant
|
|
39
|
+
outlineVariant: { light: 80, dark: 30 }
|
|
40
|
+
// outlineVariant (补充:常用于分割线)
|
|
41
|
+
},
|
|
42
|
+
inverse: {
|
|
43
|
+
primary: { light: 80, dark: 40 },
|
|
44
|
+
// inversePrimary
|
|
45
|
+
surface: { light: 20, dark: 90 },
|
|
46
|
+
// inverseSurface
|
|
47
|
+
onSurface: { light: 95, dark: 20 }
|
|
48
|
+
// inverseOnSurface
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { defaultColorMap };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const colorSetup = {
|
|
2
|
+
main: {
|
|
3
|
+
primary: "#00B872",
|
|
4
|
+
secondary: "#F3A81A",
|
|
5
|
+
tertiary: "#3B6470"
|
|
6
|
+
},
|
|
7
|
+
other: {
|
|
8
|
+
info: "#93CCFF",
|
|
9
|
+
error: "#FFB4AB",
|
|
10
|
+
warning: "#FFB870",
|
|
11
|
+
success: "#78DC77"
|
|
12
|
+
},
|
|
13
|
+
neutral: {
|
|
14
|
+
surface: "#111411"
|
|
15
|
+
},
|
|
16
|
+
neutralVariant: {
|
|
17
|
+
outline: "#9e9e9e"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const otherSetup = {
|
|
21
|
+
font: {
|
|
22
|
+
size: {
|
|
23
|
+
title: {
|
|
24
|
+
xs: "16px",
|
|
25
|
+
sm: "20px",
|
|
26
|
+
md: "24px",
|
|
27
|
+
lg: "28px",
|
|
28
|
+
xl: "32px"
|
|
29
|
+
},
|
|
30
|
+
label: {
|
|
31
|
+
xs: "10px",
|
|
32
|
+
sm: "12px",
|
|
33
|
+
md: "14px",
|
|
34
|
+
lg: "16px",
|
|
35
|
+
xl: "18px"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
weight: {
|
|
39
|
+
lighter: 200,
|
|
40
|
+
light: 300,
|
|
41
|
+
normal: 400,
|
|
42
|
+
medium: 500,
|
|
43
|
+
bold: 600,
|
|
44
|
+
bolder: 700
|
|
45
|
+
},
|
|
46
|
+
lineHeight: {
|
|
47
|
+
xs: 1,
|
|
48
|
+
sm: 1.2,
|
|
49
|
+
md: 1.4,
|
|
50
|
+
lg: 1.5,
|
|
51
|
+
xl: 1.6
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
radius: {
|
|
55
|
+
sm: "4px",
|
|
56
|
+
md: "8px",
|
|
57
|
+
lg: "12px",
|
|
58
|
+
xl: "16px",
|
|
59
|
+
full: "9999px"
|
|
60
|
+
},
|
|
61
|
+
spacing: {
|
|
62
|
+
layout: {
|
|
63
|
+
xs: "16px",
|
|
64
|
+
sm: "18px",
|
|
65
|
+
md: "24px",
|
|
66
|
+
lg: "28px",
|
|
67
|
+
xl: "32px"
|
|
68
|
+
},
|
|
69
|
+
content: {
|
|
70
|
+
xs: "4px",
|
|
71
|
+
sm: "8px",
|
|
72
|
+
md: "12px",
|
|
73
|
+
lg: "14px",
|
|
74
|
+
xl: "16px"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const interactionSetup = {
|
|
79
|
+
state: {
|
|
80
|
+
hover: 0.08,
|
|
81
|
+
focus: 0.12,
|
|
82
|
+
pressed: 0.12,
|
|
83
|
+
dragged: 0.16
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { colorSetup, interactionSetup, otherSetup };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { colord } from 'colord';
|
|
2
|
+
import { TonalPalette, argbFromHex, Hct, hexFromArgb } from '@material/material-color-utilities';
|
|
3
|
+
|
|
4
|
+
function createSourceColor(colorName, color) {
|
|
5
|
+
const colorInstance = colord(color);
|
|
6
|
+
if (colorInstance.isValid()) {
|
|
7
|
+
const sourceColor = argbFromHex(colorInstance.toHex());
|
|
8
|
+
const sourceColorHct = Hct.fromInt(sourceColor);
|
|
9
|
+
return {
|
|
10
|
+
name: colorName,
|
|
11
|
+
level: sourceColorHct.tone,
|
|
12
|
+
color: colorInstance.toHex(),
|
|
13
|
+
colorInt: sourceColorHct.toInt()
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
throw new Error("Please provide the correct color value.");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function createTonalPalette(seedColorInt) {
|
|
20
|
+
return TonalPalette.fromInt(seedColorInt);
|
|
21
|
+
}
|
|
22
|
+
function transHctToHex(tonalPalette, level) {
|
|
23
|
+
return colord(hexFromArgb(tonalPalette.tone(level))).toHex();
|
|
24
|
+
}
|
|
25
|
+
function createPalette(levels, seedColorInt, colorType) {
|
|
26
|
+
const tonalPalette = TonalPalette.fromInt(seedColorInt);
|
|
27
|
+
return levels.map((level) => ({
|
|
28
|
+
name: `${level}`,
|
|
29
|
+
level,
|
|
30
|
+
value: transHctToHex(tonalPalette, level)
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
function getTonalRange(colorInt, step = 1) {
|
|
34
|
+
const tonalPalette = TonalPalette.fromInt(colorInt);
|
|
35
|
+
const levels = [];
|
|
36
|
+
for (let i = 0; i <= 100; i += step) {
|
|
37
|
+
levels.push(i);
|
|
38
|
+
}
|
|
39
|
+
return levels.map((level) => transHctToHex(tonalPalette, level));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { createPalette, createSourceColor, createTonalPalette, getTonalRange, transHctToHex };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { unflatten } from 'flat';
|
|
2
|
+
import { handleToken } from './token.js';
|
|
3
|
+
|
|
4
|
+
function createContract(contractStruct) {
|
|
5
|
+
const semanticContract = {};
|
|
6
|
+
const camelToKebab = (str) => str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
7
|
+
handleToken(contractStruct, (key, value) => {
|
|
8
|
+
const parts = key.split(".").map(camelToKebab);
|
|
9
|
+
const varName = parts.join("-");
|
|
10
|
+
semanticContract[key] = varName;
|
|
11
|
+
});
|
|
12
|
+
return unflatten(semanticContract);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { createContract };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { flatten } from 'flat';
|
|
2
|
+
|
|
3
|
+
function handleToken(token, handler) {
|
|
4
|
+
const flattenedToken = flatten(token);
|
|
5
|
+
Object.entries(flattenedToken).forEach(([key, value]) => {
|
|
6
|
+
const path = key.split(".");
|
|
7
|
+
const category = path[0];
|
|
8
|
+
const type = path.length > 1 ? path[1] : "";
|
|
9
|
+
const isColor = category === "color" && path.length >= 2;
|
|
10
|
+
handler(key, value, path, isColor, type);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
function createSemanticTokenVars(semantic) {
|
|
14
|
+
const semanticVars = {};
|
|
15
|
+
const camelToKebab = (str) => str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
16
|
+
handleToken(semantic, (key, value) => {
|
|
17
|
+
const parts = key.split(".").map(camelToKebab);
|
|
18
|
+
const varName = parts.join("-");
|
|
19
|
+
semanticVars[varName] = value;
|
|
20
|
+
});
|
|
21
|
+
return semanticVars;
|
|
22
|
+
}
|
|
23
|
+
function createColorToken(contract, globalContract, colorNames) {
|
|
24
|
+
return colorNames.reduce((res, colorName) => {
|
|
25
|
+
const current = globalContract?.[colorName];
|
|
26
|
+
if (!current) return res;
|
|
27
|
+
res[colorName] = {
|
|
28
|
+
vars: {
|
|
29
|
+
[contract.main]: current.main,
|
|
30
|
+
[contract.onMain]: current.onMain,
|
|
31
|
+
[contract.container]: current.container,
|
|
32
|
+
[contract.onContainer]: current.onContainer
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return res;
|
|
36
|
+
}, {});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { createColorToken, createSemanticTokenVars, handleToken };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const List: import("react").ForwardRefExoticComponent<Omit<any, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ForwardRefRenderFunction } from "react";
|
|
2
|
+
export type ListStatus = "normal" | "empty" | "error" | "loading";
|
|
3
|
+
export interface ListProps {
|
|
4
|
+
list: any[];
|
|
5
|
+
listStatus: {
|
|
6
|
+
status: ListStatus;
|
|
7
|
+
initLoad: boolean;
|
|
8
|
+
};
|
|
9
|
+
onLoadMore: () => Promise<void>;
|
|
10
|
+
itemSlot: ForwardRefRenderFunction<any, any>;
|
|
11
|
+
itemPlaceSlot: ForwardRefRenderFunction<any, any>;
|
|
12
|
+
contentPlaceSlot: ForwardRefRenderFunction<any, any>;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DefaultContentPlace: (props: any, ref: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DefaultItemPlace: (props: any, ref: any) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./List";
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { ComplexStyleRule } from '@vanilla-extract/css';
|
|
2
|
+
import { ColorVariantName } from '../../../theme/contract/colorContract.css';
|
|
3
|
+
export declare const buttonToken: {
|
|
4
|
+
borderColor: `var(--${string})`;
|
|
5
|
+
contentColor: `var(--${string})`;
|
|
6
|
+
backgroundColor: `var(--${string})`;
|
|
7
|
+
stateLayerColor: `var(--${string})`;
|
|
8
|
+
fontSize: `var(--${string})`;
|
|
9
|
+
paddingX: `var(--${string})`;
|
|
10
|
+
paddingY: `var(--${string})`;
|
|
11
|
+
minHeight: `var(--${string})`;
|
|
12
|
+
contentGap: `var(--${string})`;
|
|
13
|
+
borderRadius: `var(--${string})`;
|
|
14
|
+
};
|
|
15
|
+
export declare const buttonRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
16
|
+
color: Record<ColorVariantName, string>;
|
|
17
|
+
size: {
|
|
18
|
+
small: {
|
|
19
|
+
vars: Record<string, string> | undefined;
|
|
20
|
+
minHeight: `var(--${string})`;
|
|
21
|
+
paddingInline: `var(--${string})`;
|
|
22
|
+
paddingBlock: `var(--${string})`;
|
|
23
|
+
fontSize: `var(--${string})`;
|
|
24
|
+
} & ComplexStyleRule;
|
|
25
|
+
normal: {
|
|
26
|
+
vars: Record<string, string> | undefined;
|
|
27
|
+
minHeight: `var(--${string})`;
|
|
28
|
+
paddingInline: `var(--${string})`;
|
|
29
|
+
paddingBlock: `var(--${string})`;
|
|
30
|
+
fontSize: `var(--${string})`;
|
|
31
|
+
} & ComplexStyleRule;
|
|
32
|
+
full: {
|
|
33
|
+
vars: Record<string, string> | undefined;
|
|
34
|
+
minHeight: `var(--${string})`;
|
|
35
|
+
paddingInline: `var(--${string})`;
|
|
36
|
+
paddingBlock: `var(--${string})`;
|
|
37
|
+
fontSize: `var(--${string})`;
|
|
38
|
+
} & ComplexStyleRule;
|
|
39
|
+
};
|
|
40
|
+
shape: {
|
|
41
|
+
round: {
|
|
42
|
+
vars: Record<string, string> | undefined;
|
|
43
|
+
borderRadius: `var(--${string})`;
|
|
44
|
+
} & ComplexStyleRule;
|
|
45
|
+
square: {
|
|
46
|
+
vars: Record<string, string> | undefined;
|
|
47
|
+
borderRadius: `var(--${string})`;
|
|
48
|
+
} & ComplexStyleRule;
|
|
49
|
+
};
|
|
50
|
+
variant: {
|
|
51
|
+
filled: {
|
|
52
|
+
vars: {
|
|
53
|
+
[buttonToken.contentColor]: `var(--${string})`;
|
|
54
|
+
[buttonToken.backgroundColor]: `var(--${string})`;
|
|
55
|
+
};
|
|
56
|
+
selectors: {
|
|
57
|
+
'&:hover::before': {
|
|
58
|
+
vars: {
|
|
59
|
+
[buttonToken.stateLayerColor]: string;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
'&:active::before': {
|
|
63
|
+
vars: {
|
|
64
|
+
[buttonToken.stateLayerColor]: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
tonal: {
|
|
70
|
+
vars: {
|
|
71
|
+
[buttonToken.contentColor]: `var(--${string})`;
|
|
72
|
+
[buttonToken.backgroundColor]: `var(--${string})`;
|
|
73
|
+
};
|
|
74
|
+
selectors: {
|
|
75
|
+
'&:hover::before': {
|
|
76
|
+
vars: {
|
|
77
|
+
[buttonToken.stateLayerColor]: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
'&:active::before': {
|
|
81
|
+
vars: {
|
|
82
|
+
[buttonToken.stateLayerColor]: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
outlined: {
|
|
88
|
+
vars: {
|
|
89
|
+
[buttonToken.contentColor]: `var(--${string})`;
|
|
90
|
+
[buttonToken.borderColor]: `var(--${string})`;
|
|
91
|
+
};
|
|
92
|
+
selectors: {
|
|
93
|
+
'&:hover::before': {
|
|
94
|
+
vars: {
|
|
95
|
+
[buttonToken.stateLayerColor]: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
'&:active::before': {
|
|
99
|
+
vars: {
|
|
100
|
+
[buttonToken.stateLayerColor]: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
plain: {
|
|
106
|
+
vars: {
|
|
107
|
+
[buttonToken.contentColor]: `var(--${string})`;
|
|
108
|
+
};
|
|
109
|
+
selectors: {
|
|
110
|
+
'&:hover::before': {
|
|
111
|
+
vars: {
|
|
112
|
+
[buttonToken.stateLayerColor]: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
'&:active::before': {
|
|
116
|
+
vars: {
|
|
117
|
+
[buttonToken.stateLayerColor]: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
disabled: {
|
|
124
|
+
true: {
|
|
125
|
+
cursor: "not-allowed";
|
|
126
|
+
pointerEvents: "none";
|
|
127
|
+
backgroundColor: `color-mix(in srgb, var(--${string}) 12%, transparent)`;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
loading: {
|
|
131
|
+
true: {
|
|
132
|
+
cursor: "wait";
|
|
133
|
+
pointerEvents: "none";
|
|
134
|
+
color: "transparent !important";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ElementType, ReactElement } from "react";
|
|
2
|
+
import { RecipeVariants } from "@vanilla-extract/recipes";
|
|
3
|
+
import { buttonRecipe } from "./Button.css";
|
|
4
|
+
export interface ButtonProps extends ComponentPropsWithRef<'button'> {
|
|
5
|
+
asChild?: boolean;
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
variants?: Omit<RecipeVariants<typeof buttonRecipe>, "disabled" | "loading">;
|
|
8
|
+
loadingSlot?: ReactElement;
|
|
9
|
+
componentType?: ElementType;
|
|
10
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ComplexStyleRule } from "@vanilla-extract/css";
|
|
2
|
+
import { ColorVariantName } from '../../../theme/contract/colorContract.css';
|
|
3
|
+
export declare const tagToken: {
|
|
4
|
+
borderColor: `var(--${string})`;
|
|
5
|
+
contentColor: `var(--${string})`;
|
|
6
|
+
backgroundColor: `var(--${string})`;
|
|
7
|
+
stateLayerColor: `var(--${string})`;
|
|
8
|
+
fontSize: `var(--${string})`;
|
|
9
|
+
paddingX: `var(--${string})`;
|
|
10
|
+
paddingY: `var(--${string})`;
|
|
11
|
+
minHeight: `var(--${string})`;
|
|
12
|
+
contentGap: `var(--${string})`;
|
|
13
|
+
borderRadius: `var(--${string})`;
|
|
14
|
+
};
|
|
15
|
+
export declare const tagRecipe: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
16
|
+
color: Record<ColorVariantName, string>;
|
|
17
|
+
variant: {
|
|
18
|
+
filled: {
|
|
19
|
+
vars: {
|
|
20
|
+
[tagToken.contentColor]: `var(--${string})`;
|
|
21
|
+
[tagToken.backgroundColor]: `var(--${string})`;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
tonal: {
|
|
25
|
+
vars: {
|
|
26
|
+
[tagToken.contentColor]: `var(--${string})`;
|
|
27
|
+
[tagToken.backgroundColor]: `var(--${string})`;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
outlined: {
|
|
31
|
+
vars: {
|
|
32
|
+
[tagToken.contentColor]: `var(--${string})`;
|
|
33
|
+
[tagToken.borderColor]: `var(--${string})`;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
plain: {
|
|
37
|
+
vars: {
|
|
38
|
+
[tagToken.contentColor]: `var(--${string})`;
|
|
39
|
+
[tagToken.backgroundColor]: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
size: {
|
|
44
|
+
small: {
|
|
45
|
+
vars: Record<string, string> | undefined;
|
|
46
|
+
paddingInline: `var(--${string})`;
|
|
47
|
+
paddingBlock: `var(--${string})`;
|
|
48
|
+
fontSize: `var(--${string})`;
|
|
49
|
+
} & ComplexStyleRule;
|
|
50
|
+
normal: {
|
|
51
|
+
vars: Record<string, string> | undefined;
|
|
52
|
+
paddingInline: `var(--${string})`;
|
|
53
|
+
paddingBlock: `var(--${string})`;
|
|
54
|
+
fontSize: `var(--${string})`;
|
|
55
|
+
} & ComplexStyleRule;
|
|
56
|
+
};
|
|
57
|
+
shape: {
|
|
58
|
+
round: {
|
|
59
|
+
vars: Record<string, string> | undefined;
|
|
60
|
+
borderRadius: `var(--${string})`;
|
|
61
|
+
} & ComplexStyleRule;
|
|
62
|
+
square: {
|
|
63
|
+
vars: Record<string, string> | undefined;
|
|
64
|
+
borderRadius: `var(--${string})`;
|
|
65
|
+
} & ComplexStyleRule;
|
|
66
|
+
};
|
|
67
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from "react";
|
|
2
|
+
import { RecipeVariants } from "@vanilla-extract/recipes";
|
|
3
|
+
import { tagRecipe } from "./Tag.css";
|
|
4
|
+
export interface TagProps extends ComponentPropsWithRef<'div'> {
|
|
5
|
+
color?: string;
|
|
6
|
+
asChild?: boolean;
|
|
7
|
+
variants?: RecipeVariants<typeof tagRecipe>;
|
|
8
|
+
}
|