@akinon/ui-theme 0.1.0 → 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/dist/colors.js +162 -0
- package/dist/index.cjs +1 -37
- package/dist/index.js +17 -1962
- package/dist/theme.js +143 -0
- package/package.json +5 -4
package/dist/theme.js
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCssVariables = exports.useToken = exports.theme = exports.fontSize = void 0;
|
|
4
|
+
const antd_1 = require("antd");
|
|
5
|
+
const colors_1 = require("./colors");
|
|
6
|
+
// antd works with numbers. use this to convert px to rem.
|
|
7
|
+
exports.fontSize = 16;
|
|
8
|
+
const colors = {
|
|
9
|
+
akinon: colors_1.akinon,
|
|
10
|
+
azure: colors_1.azure,
|
|
11
|
+
orange: colors_1.orange,
|
|
12
|
+
red: colors_1.red,
|
|
13
|
+
green: colors_1.green,
|
|
14
|
+
purple: colors_1.purple,
|
|
15
|
+
gray: colors_1.gray,
|
|
16
|
+
ebonyClay: colors_1.ebonyClay,
|
|
17
|
+
neutral: colors_1.neutral
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Non-editable akinon theme object.
|
|
21
|
+
* This object contains both our theme values and
|
|
22
|
+
* antd's default theme values.
|
|
23
|
+
*
|
|
24
|
+
* You can use https://ant.design/theme-editor tool
|
|
25
|
+
* to learn about properties and their effects.
|
|
26
|
+
*/
|
|
27
|
+
exports.theme = {
|
|
28
|
+
// We use dark algorithm from antd by default,
|
|
29
|
+
// since our applications are dark themed.
|
|
30
|
+
algorithm: antd_1.theme.darkAlgorithm,
|
|
31
|
+
colors,
|
|
32
|
+
// We also need to override antd styles with
|
|
33
|
+
// our current color palette.
|
|
34
|
+
token: {
|
|
35
|
+
colorTextBase: colors.neutral['100'],
|
|
36
|
+
colorText: colors.neutral['100'],
|
|
37
|
+
colorTextSecondary: colors.gray['500'],
|
|
38
|
+
colorTextPlaceholder: colors.gray['500'],
|
|
39
|
+
colorPrimary: colors.azure['500'],
|
|
40
|
+
colorError: colors.red['500'],
|
|
41
|
+
colorBgLayout: colors.ebonyClay['500'], // effects layout bg
|
|
42
|
+
colorBgContainer: colors.ebonyClay['600'], // effects card bg, table bg, input bg
|
|
43
|
+
colorBgElevated: colors.ebonyClay['400'], // effects dropdown bg, select bg, notification bg
|
|
44
|
+
controlItemBgHover: colors.ebonyClay['200'], // effects item bg in dropdown item when hovered
|
|
45
|
+
controlItemBgActive: colors.ebonyClay['300'], // effects active item bg such in dropdown item
|
|
46
|
+
controlItemBgActiveHover: colors.ebonyClay['300'], // effects active item bg such in dropdown item when hovered
|
|
47
|
+
colorBgSpotlight: colors.ebonyClay['600'], //TODO: bg color of tooltip?
|
|
48
|
+
colorBorder: colors.ebonyClay['700'],
|
|
49
|
+
fontFamily: "'Jost Variable'," + antd_1.theme.getDesignToken().fontFamily,
|
|
50
|
+
fontSize: exports.fontSize * 0.875
|
|
51
|
+
},
|
|
52
|
+
components: {
|
|
53
|
+
Layout: {
|
|
54
|
+
headerBg: colors.ebonyClay['500'],
|
|
55
|
+
siderBg: colors.ebonyClay['500']
|
|
56
|
+
},
|
|
57
|
+
Dropdown: {
|
|
58
|
+
colorPrimary: colors.neutral['100'], // primary color (azure500) doesn't work well with dropdown bg
|
|
59
|
+
controlPaddingHorizontal: exports.fontSize
|
|
60
|
+
},
|
|
61
|
+
Menu: {
|
|
62
|
+
darkItemBg: colors.ebonyClay['500'],
|
|
63
|
+
darkSubMenuItemBg: colors.ebonyClay['600'],
|
|
64
|
+
darkItemSelectedBg: colors.ebonyClay['700'],
|
|
65
|
+
itemBorderRadius: 0,
|
|
66
|
+
itemMarginBlock: 0,
|
|
67
|
+
itemMarginInline: 0,
|
|
68
|
+
darkItemColor: colors.gray['500'],
|
|
69
|
+
itemHeight: exports.fontSize * 3.25
|
|
70
|
+
},
|
|
71
|
+
Breadcrumb: {
|
|
72
|
+
fontSize: exports.fontSize * 0.625,
|
|
73
|
+
lastItemColor: colors.azure['500']
|
|
74
|
+
},
|
|
75
|
+
Card: {
|
|
76
|
+
colorBgContainer: colors.ebonyClay['450'],
|
|
77
|
+
colorTextDescription: colors.neutral['100'],
|
|
78
|
+
headerFontSize: exports.fontSize * 1.25,
|
|
79
|
+
fontSize: exports.fontSize * 0.875
|
|
80
|
+
},
|
|
81
|
+
Collapse: {
|
|
82
|
+
headerPadding: '0 0 12px',
|
|
83
|
+
// because of ghost prop, we need to use important
|
|
84
|
+
contentPadding: '0 0 24px !important',
|
|
85
|
+
fontSizeIcon: exports.fontSize * 1.65,
|
|
86
|
+
fontSize: exports.fontSize
|
|
87
|
+
},
|
|
88
|
+
Form: {
|
|
89
|
+
itemMarginBottom: 16,
|
|
90
|
+
labelColor: colors.neutral['100'],
|
|
91
|
+
verticalLabelPadding: 4
|
|
92
|
+
},
|
|
93
|
+
Select: {
|
|
94
|
+
colorTextDisabled: colors.ebonyClay['350'],
|
|
95
|
+
colorBgContainerDisabled: colors.gray['925'],
|
|
96
|
+
colorBgContainer: colors.ebonyClay['475'],
|
|
97
|
+
fontSizeLG: exports.fontSize * 0.875,
|
|
98
|
+
colorBorder: colors.ebonyClay['550'],
|
|
99
|
+
lineWidth: 2
|
|
100
|
+
},
|
|
101
|
+
Input: {
|
|
102
|
+
colorBgContainer: colors.ebonyClay['475'],
|
|
103
|
+
fontSizeLG: exports.fontSize * 0.875,
|
|
104
|
+
colorBorder: colors.ebonyClay['550'],
|
|
105
|
+
lineWidth: 2
|
|
106
|
+
},
|
|
107
|
+
InputNumber: {
|
|
108
|
+
colorBgContainer: colors.ebonyClay['475'],
|
|
109
|
+
fontSizeLG: exports.fontSize * 0.875,
|
|
110
|
+
colorBorder: colors.ebonyClay['550'],
|
|
111
|
+
lineWidth: 2
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Used to access antd's token values from react components.
|
|
117
|
+
* For detailed usage see,
|
|
118
|
+
* https://ant.design/docs/react/customize-theme#consume-design-token
|
|
119
|
+
*/
|
|
120
|
+
exports.useToken = antd_1.theme.useToken;
|
|
121
|
+
/**
|
|
122
|
+
* Returns css variable objects for our
|
|
123
|
+
* theme's custom color palette.
|
|
124
|
+
*
|
|
125
|
+
* Outputs css variables like:
|
|
126
|
+
* --color-primary-100: #f0f8ff;
|
|
127
|
+
* --color-body-fg: #ffffff;
|
|
128
|
+
* --color-success-500: #52c41a;
|
|
129
|
+
* --color-{object_key}-{object_key}: {color_value};
|
|
130
|
+
*/
|
|
131
|
+
const getCssVariables = () => {
|
|
132
|
+
const { colors } = exports.theme;
|
|
133
|
+
const prefix = '--color';
|
|
134
|
+
const result = {};
|
|
135
|
+
for (const [colorType, colorObject] of Object.entries(colors)) {
|
|
136
|
+
for (const [colorShade, colorValue] of Object.entries(colorObject)) {
|
|
137
|
+
const variableName = `${prefix}-${colorType}-${colorShade}`;
|
|
138
|
+
result[variableName] = colorValue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
};
|
|
143
|
+
exports.getCssVariables = getCssVariables;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/ui-theme",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Akinon UI's default theme values.",
|
|
6
6
|
"type": "module",
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"clean-package": "2.2.0",
|
|
17
|
-
"
|
|
17
|
+
"typescript": "^5.2.2",
|
|
18
|
+
"@akinon/vite-config": "^0.1.1",
|
|
18
19
|
"@akinon/eslint-config": "0.1.0",
|
|
19
|
-
"@akinon/
|
|
20
|
+
"@akinon/typescript-config": "0.0.0"
|
|
20
21
|
},
|
|
21
22
|
"peerDependencies": {
|
|
22
23
|
"react": ">=18",
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
"./package.json": "./package.json"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
+
"build": "tsc && tsc --module commonjs --outDir dist",
|
|
37
38
|
"lint": "eslint *.ts*",
|
|
38
39
|
"test": "vitest run",
|
|
39
40
|
"test:ui": "vitest --ui",
|