@quen-ui/theme 0.0.13

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.
Files changed (42) hide show
  1. package/README.md +61 -0
  2. package/dist/QuenUIProvider.cjs.js +16 -0
  3. package/dist/QuenUIProvider.d.ts +6 -0
  4. package/dist/QuenUIProvider.es.js +16 -0
  5. package/dist/colors/index.cjs.js +162 -0
  6. package/dist/colors/index.d.ts +3 -0
  7. package/dist/colors/index.es.js +162 -0
  8. package/dist/colors/types.cjs.js +4 -0
  9. package/dist/colors/types.d.ts +14 -0
  10. package/dist/colors/types.es.js +4 -0
  11. package/dist/constants/control.cjs.js +14 -0
  12. package/dist/constants/control.d.ts +2 -0
  13. package/dist/constants/control.es.js +14 -0
  14. package/dist/constants/font.cjs.js +42 -0
  15. package/dist/constants/font.d.ts +2 -0
  16. package/dist/constants/font.es.js +42 -0
  17. package/dist/constants/space.cjs.js +10 -0
  18. package/dist/constants/space.d.ts +2 -0
  19. package/dist/constants/space.es.js +10 -0
  20. package/dist/createTheme.cjs.js +8 -0
  21. package/dist/createTheme.d.ts +3 -0
  22. package/dist/createTheme.es.js +8 -0
  23. package/dist/index.cjs.js +26 -0
  24. package/dist/index.d.ts +16 -0
  25. package/dist/index.es.js +26 -0
  26. package/dist/injectCssVarsFromTheme.cjs.js +33 -0
  27. package/dist/injectCssVarsFromTheme.d.ts +3 -0
  28. package/dist/injectCssVarsFromTheme.es.js +33 -0
  29. package/dist/theme/darkTheme.cjs.js +19 -0
  30. package/dist/theme/darkTheme.d.ts +2 -0
  31. package/dist/theme/darkTheme.es.js +19 -0
  32. package/dist/theme/lightTheme.cjs.js +19 -0
  33. package/dist/theme/lightTheme.d.ts +2 -0
  34. package/dist/theme/lightTheme.es.js +19 -0
  35. package/dist/theme/types.d.ts +15 -0
  36. package/dist/types/control.d.ts +10 -0
  37. package/dist/types/fonts.d.ts +38 -0
  38. package/dist/types/space.d.ts +6 -0
  39. package/dist/useTheme.cjs.js +12 -0
  40. package/dist/useTheme.d.ts +2 -0
  41. package/dist/useTheme.es.js +12 -0
  42. package/package.json +61 -0
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @quen-ui/theme
2
+
3
+ Design system theme: tokens, variables, and a provider for use in React applications.
4
+ Provides a consistent visual style for components from `@quen-ui/components`.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm install @quen-ui/theme
10
+ ```
11
+
12
+ ## Quick Start
13
+
14
+ Wrap your app in `QuenUIProvider` so that all design system components have access to tokens and CSS variables:
15
+
16
+ ```tsx
17
+ import { QuenUIProvider, QuenUIDarkTheme } from '@design-system/theme';
18
+ import { Button } from '@design-system/components';
19
+
20
+ export function App() {
21
+ return (
22
+ <QuenUIProvider theme={QuenUIDarkTheme}>
23
+ <Button view="primary">Example</Button>
24
+ </QuenUIProvider>
25
+ );
26
+ }
27
+ ```
28
+
29
+ ## Tokens
30
+
31
+ The package defines design tokens: colors, typography, padding, sizes, etc.
32
+ They are available as CSS variables and JavaScript objects.
33
+
34
+
35
+ Example: using a CSS Variable
36
+
37
+ ```css
38
+ .my-class {
39
+ color: var(--quen-ui-primary-color);
40
+ background: var(--quen-ui-color-body);
41
+ }
42
+ ```
43
+
44
+ Example: using a token in code
45
+
46
+ ```tsx
47
+ import { useTheme } from '@design-system/theme';
48
+
49
+ function Example() {
50
+ const theme = useTheme();
51
+ return <div style={{ color: theme.textColor }}>Текст</div>;
52
+ }
53
+ ```
54
+
55
+ Example: using with styled-components
56
+
57
+ ```ts
58
+ const Container = styled.div`
59
+ background: ${({ theme }) => theme.colors.gray[9]}
60
+ `
61
+ ```
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const styledComponents = require("styled-components");
5
+ const react = require("react");
6
+ const injectCssVarsFromTheme = require("./injectCssVarsFromTheme.cjs.js");
7
+ const QuenUIProvider = ({
8
+ theme,
9
+ children
10
+ }) => {
11
+ react.useEffect(() => {
12
+ injectCssVarsFromTheme.injectCssVarsFromTheme(theme);
13
+ }, [theme]);
14
+ return /* @__PURE__ */ jsxRuntime.jsx(styledComponents.ThemeProvider, { theme, children });
15
+ };
16
+ exports.QuenUIProvider = QuenUIProvider;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { IQuenUITheme } from './theme/types';
3
+ export declare const QuenUIProvider: ({ theme, children }: {
4
+ theme: IQuenUITheme;
5
+ children: React.ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { ThemeProvider } from "styled-components";
3
+ import { useEffect } from "react";
4
+ import { injectCssVarsFromTheme } from "./injectCssVarsFromTheme.es.js";
5
+ const QuenUIProvider = ({
6
+ theme,
7
+ children
8
+ }) => {
9
+ useEffect(() => {
10
+ injectCssVarsFromTheme(theme);
11
+ }, [theme]);
12
+ return /* @__PURE__ */ jsx(ThemeProvider, { theme, children });
13
+ };
14
+ export {
15
+ QuenUIProvider
16
+ };
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const QUEN_UI_LIGHT_COLORS = {
4
+ violet: {
5
+ 1: "#edeafc",
6
+ 2: "#dcd5fa",
7
+ 3: "#cac1f8",
8
+ 4: "#b9acf5",
9
+ 5: "#a798f3",
10
+ 6: "#9683f1",
11
+ 7: "#846fee",
12
+ 8: "#735aec",
13
+ 9: "#6246ea"
14
+ },
15
+ gray: {
16
+ 1: "#fffffe",
17
+ 2: "#e2e2e1",
18
+ 3: "#c6c6c5",
19
+ 4: "#aaaaa9",
20
+ 5: "#8d8d8d",
21
+ 6: "#717170",
22
+ 7: "#555554",
23
+ 8: "#383838",
24
+ 9: "#1c1c1c"
25
+ },
26
+ grayViolet: {
27
+ 1: "#f9f9fc",
28
+ 2: "#f4f4fa",
29
+ 3: "#efeff7",
30
+ 4: "#eaeaf5",
31
+ 5: "#e5e5f2",
32
+ 6: "#e0e0f0",
33
+ 7: "#dbdbed",
34
+ 8: "#d6d6eb",
35
+ 9: "#d1d1e9"
36
+ },
37
+ green: {
38
+ 1: "#e2f5f0",
39
+ 2: "#c6ebe2",
40
+ 3: "#aae1d4",
41
+ 4: "#8dd7c6",
42
+ 5: "#71ceb8",
43
+ 6: "#55c4aa",
44
+ 7: "#38ba9c",
45
+ 8: "#1cb08e",
46
+ 9: "#00a780"
47
+ },
48
+ red: {
49
+ 1: "#fcecec",
50
+ 2: "#f9d9d9",
51
+ 3: "#f6c7c7",
52
+ 4: "#f3b4b4",
53
+ 5: "#f0a2a2",
54
+ 6: "#ed8f8f",
55
+ 7: "#ea7d7d",
56
+ 8: "#e76a6a",
57
+ 9: "#e45858"
58
+ },
59
+ yellow: {
60
+ 1: "#fefeef",
61
+ 2: "#fdfddf",
62
+ 3: "#fdfccf",
63
+ 4: "#fcfbbf",
64
+ 5: "#fbfbb0",
65
+ 6: "#fbfaa0",
66
+ 7: "#faf990",
67
+ 8: "#f9f880",
68
+ 9: "#f9f871"
69
+ },
70
+ orange: {
71
+ 1: "#fff8eb",
72
+ 2: "#fff1d7",
73
+ 3: "#ffeac3",
74
+ 4: "#ffe3af",
75
+ 5: "#ffdd9c",
76
+ 6: "#ffd688",
77
+ 7: "#ffcf74",
78
+ 8: "#ffc860",
79
+ 9: "#ffc24d"
80
+ }
81
+ };
82
+ const QUEN_UI_DARK_COLORS = {
83
+ violet: {
84
+ 1: "#0a071a",
85
+ 2: "#150f34",
86
+ 3: "#20174e",
87
+ 4: "#2b1f68",
88
+ 5: "#362682",
89
+ 6: "#412e9c",
90
+ 7: "#4c36b6",
91
+ 8: "#573ed0",
92
+ 9: "#6246ea"
93
+ },
94
+ gray: {
95
+ 1: "#1c1c1c",
96
+ 2: "#383838",
97
+ 3: "#555554",
98
+ 4: "#717170",
99
+ 5: "#8d8d8d",
100
+ 6: "#aaaaa9",
101
+ 7: "#c6c6c5",
102
+ 8: "#e2e2e1",
103
+ 9: "#fffffe"
104
+ },
105
+ grayViolet: {
106
+ 1: "#171719",
107
+ 2: "#2e2e33",
108
+ 3: "#45454d",
109
+ 4: "#5c5c67",
110
+ 5: "#747481",
111
+ 6: "#8b8b9b",
112
+ 7: "#a2a2b5",
113
+ 8: "#b9b9cf",
114
+ 9: "#d1d1e9"
115
+ },
116
+ green: {
117
+ 1: "#00120e",
118
+ 2: "#00251c",
119
+ 3: "#00372a",
120
+ 4: "#004a38",
121
+ 5: "#005c47",
122
+ 6: "#006f55",
123
+ 7: "#008163",
124
+ 8: "#009471",
125
+ 9: "#00a780"
126
+ },
127
+ red: {
128
+ 1: "#190909",
129
+ 2: "#321313",
130
+ 3: "#4c1d1d",
131
+ 4: "#652727",
132
+ 5: "#7e3030",
133
+ 6: "#983a3a",
134
+ 7: "#b14444",
135
+ 8: "#ca4e4e",
136
+ 9: "#e45858"
137
+ },
138
+ yellow: {
139
+ 1: "#1b1b0c",
140
+ 2: "#373719",
141
+ 3: "#535225",
142
+ 4: "#6e6e32",
143
+ 5: "#8a893e",
144
+ 6: "#a6a54b",
145
+ 7: "#c1c057",
146
+ 8: "#dddc64",
147
+ 9: "#f9f871"
148
+ },
149
+ orange: {
150
+ 1: "#1c1508",
151
+ 2: "#382b11",
152
+ 3: "#554019",
153
+ 4: "#715622",
154
+ 5: "#8d6b2a",
155
+ 6: "#aa8133",
156
+ 7: "#c6963b",
157
+ 8: "#e2ac44",
158
+ 9: "#ffc24d"
159
+ }
160
+ };
161
+ exports.QUEN_UI_DARK_COLORS = QUEN_UI_DARK_COLORS;
162
+ exports.QUEN_UI_LIGHT_COLORS = QUEN_UI_LIGHT_COLORS;
@@ -0,0 +1,3 @@
1
+ import { TQuenUIColors } from './types';
2
+ export declare const QUEN_UI_LIGHT_COLORS: TQuenUIColors;
3
+ export declare const QUEN_UI_DARK_COLORS: TQuenUIColors;
@@ -0,0 +1,162 @@
1
+ const QUEN_UI_LIGHT_COLORS = {
2
+ violet: {
3
+ 1: "#edeafc",
4
+ 2: "#dcd5fa",
5
+ 3: "#cac1f8",
6
+ 4: "#b9acf5",
7
+ 5: "#a798f3",
8
+ 6: "#9683f1",
9
+ 7: "#846fee",
10
+ 8: "#735aec",
11
+ 9: "#6246ea"
12
+ },
13
+ gray: {
14
+ 1: "#fffffe",
15
+ 2: "#e2e2e1",
16
+ 3: "#c6c6c5",
17
+ 4: "#aaaaa9",
18
+ 5: "#8d8d8d",
19
+ 6: "#717170",
20
+ 7: "#555554",
21
+ 8: "#383838",
22
+ 9: "#1c1c1c"
23
+ },
24
+ grayViolet: {
25
+ 1: "#f9f9fc",
26
+ 2: "#f4f4fa",
27
+ 3: "#efeff7",
28
+ 4: "#eaeaf5",
29
+ 5: "#e5e5f2",
30
+ 6: "#e0e0f0",
31
+ 7: "#dbdbed",
32
+ 8: "#d6d6eb",
33
+ 9: "#d1d1e9"
34
+ },
35
+ green: {
36
+ 1: "#e2f5f0",
37
+ 2: "#c6ebe2",
38
+ 3: "#aae1d4",
39
+ 4: "#8dd7c6",
40
+ 5: "#71ceb8",
41
+ 6: "#55c4aa",
42
+ 7: "#38ba9c",
43
+ 8: "#1cb08e",
44
+ 9: "#00a780"
45
+ },
46
+ red: {
47
+ 1: "#fcecec",
48
+ 2: "#f9d9d9",
49
+ 3: "#f6c7c7",
50
+ 4: "#f3b4b4",
51
+ 5: "#f0a2a2",
52
+ 6: "#ed8f8f",
53
+ 7: "#ea7d7d",
54
+ 8: "#e76a6a",
55
+ 9: "#e45858"
56
+ },
57
+ yellow: {
58
+ 1: "#fefeef",
59
+ 2: "#fdfddf",
60
+ 3: "#fdfccf",
61
+ 4: "#fcfbbf",
62
+ 5: "#fbfbb0",
63
+ 6: "#fbfaa0",
64
+ 7: "#faf990",
65
+ 8: "#f9f880",
66
+ 9: "#f9f871"
67
+ },
68
+ orange: {
69
+ 1: "#fff8eb",
70
+ 2: "#fff1d7",
71
+ 3: "#ffeac3",
72
+ 4: "#ffe3af",
73
+ 5: "#ffdd9c",
74
+ 6: "#ffd688",
75
+ 7: "#ffcf74",
76
+ 8: "#ffc860",
77
+ 9: "#ffc24d"
78
+ }
79
+ };
80
+ const QUEN_UI_DARK_COLORS = {
81
+ violet: {
82
+ 1: "#0a071a",
83
+ 2: "#150f34",
84
+ 3: "#20174e",
85
+ 4: "#2b1f68",
86
+ 5: "#362682",
87
+ 6: "#412e9c",
88
+ 7: "#4c36b6",
89
+ 8: "#573ed0",
90
+ 9: "#6246ea"
91
+ },
92
+ gray: {
93
+ 1: "#1c1c1c",
94
+ 2: "#383838",
95
+ 3: "#555554",
96
+ 4: "#717170",
97
+ 5: "#8d8d8d",
98
+ 6: "#aaaaa9",
99
+ 7: "#c6c6c5",
100
+ 8: "#e2e2e1",
101
+ 9: "#fffffe"
102
+ },
103
+ grayViolet: {
104
+ 1: "#171719",
105
+ 2: "#2e2e33",
106
+ 3: "#45454d",
107
+ 4: "#5c5c67",
108
+ 5: "#747481",
109
+ 6: "#8b8b9b",
110
+ 7: "#a2a2b5",
111
+ 8: "#b9b9cf",
112
+ 9: "#d1d1e9"
113
+ },
114
+ green: {
115
+ 1: "#00120e",
116
+ 2: "#00251c",
117
+ 3: "#00372a",
118
+ 4: "#004a38",
119
+ 5: "#005c47",
120
+ 6: "#006f55",
121
+ 7: "#008163",
122
+ 8: "#009471",
123
+ 9: "#00a780"
124
+ },
125
+ red: {
126
+ 1: "#190909",
127
+ 2: "#321313",
128
+ 3: "#4c1d1d",
129
+ 4: "#652727",
130
+ 5: "#7e3030",
131
+ 6: "#983a3a",
132
+ 7: "#b14444",
133
+ 8: "#ca4e4e",
134
+ 9: "#e45858"
135
+ },
136
+ yellow: {
137
+ 1: "#1b1b0c",
138
+ 2: "#373719",
139
+ 3: "#535225",
140
+ 4: "#6e6e32",
141
+ 5: "#8a893e",
142
+ 6: "#a6a54b",
143
+ 7: "#c1c057",
144
+ 8: "#dddc64",
145
+ 9: "#f9f871"
146
+ },
147
+ orange: {
148
+ 1: "#1c1508",
149
+ 2: "#382b11",
150
+ 3: "#554019",
151
+ 4: "#715622",
152
+ 5: "#8d6b2a",
153
+ 6: "#aa8133",
154
+ 7: "#c6963b",
155
+ 8: "#e2ac44",
156
+ 9: "#ffc24d"
157
+ }
158
+ };
159
+ export {
160
+ QUEN_UI_DARK_COLORS,
161
+ QUEN_UI_LIGHT_COLORS
162
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const QUENUI_COlORS_PALETTE = ["violet", "gray", "grayViolet", "red", "yellow", "green", "orange"];
4
+ exports.QUENUI_COlORS_PALETTE = QUENUI_COlORS_PALETTE;
@@ -0,0 +1,14 @@
1
+ export declare const QUENUI_COlORS_PALETTE: readonly ["violet", "gray", "grayViolet", "red", "yellow", "green", "orange"];
2
+ export interface IQuenUIColor {
3
+ 1: string;
4
+ 2: string;
5
+ 3: string;
6
+ 4: string;
7
+ 5: string;
8
+ 6: string;
9
+ 7: string;
10
+ 8: string;
11
+ 9: string;
12
+ }
13
+ export type TDefaultQuenUIColors = typeof QUENUI_COlORS_PALETTE[number];
14
+ export type TQuenUIColors = Record<TDefaultQuenUIColors, IQuenUIColor>;
@@ -0,0 +1,4 @@
1
+ const QUENUI_COlORS_PALETTE = ["violet", "gray", "grayViolet", "red", "yellow", "green", "orange"];
2
+ export {
3
+ QUENUI_COlORS_PALETTE
4
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const polished = require("polished");
4
+ const QUENUI_DEFAULT_CONTROL = {
5
+ radius: polished.rem(4),
6
+ borderWidth: polished.rem(1),
7
+ height: {
8
+ l: polished.rem(48),
9
+ m: polished.rem(40),
10
+ s: polished.rem(32),
11
+ xs: polished.rem(24)
12
+ }
13
+ };
14
+ exports.QUENUI_DEFAULT_CONTROL = QUENUI_DEFAULT_CONTROL;
@@ -0,0 +1,2 @@
1
+ import { IQuenUIThemeControl } from '../types/control';
2
+ export declare const QUENUI_DEFAULT_CONTROL: IQuenUIThemeControl;
@@ -0,0 +1,14 @@
1
+ import { rem } from "polished";
2
+ const QUENUI_DEFAULT_CONTROL = {
3
+ radius: rem(4),
4
+ borderWidth: rem(1),
5
+ height: {
6
+ l: rem(48),
7
+ m: rem(40),
8
+ s: rem(32),
9
+ xs: rem(24)
10
+ }
11
+ };
12
+ export {
13
+ QUENUI_DEFAULT_CONTROL
14
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const polished = require("polished");
4
+ const QUENUI_DEFAULT_FONT = {
5
+ header: {
6
+ size: {
7
+ "2xl": polished.rem(56),
8
+ xl: polished.rem(40),
9
+ l: polished.rem(32),
10
+ m: polished.rem(28),
11
+ s: polished.rem(24),
12
+ xs: polished.rem(16)
13
+ },
14
+ lineHeight: {
15
+ "2xl": polished.rem(64),
16
+ xl: polished.rem(48),
17
+ l: polished.rem(40),
18
+ m: polished.rem(32),
19
+ s: polished.rem(24),
20
+ xs: polished.rem(16)
21
+ },
22
+ weight: 700
23
+ },
24
+ text: {
25
+ size: {
26
+ xl: polished.rem(24),
27
+ l: polished.rem(20),
28
+ m: polished.rem(16),
29
+ s: polished.rem(14),
30
+ xs: polished.rem(12)
31
+ },
32
+ lineHeight: {
33
+ xl: polished.rem(32),
34
+ l: polished.rem(28),
35
+ m: polished.rem(24),
36
+ s: polished.rem(20),
37
+ xs: polished.rem(16)
38
+ },
39
+ weight: 400
40
+ }
41
+ };
42
+ exports.QUENUI_DEFAULT_FONT = QUENUI_DEFAULT_FONT;
@@ -0,0 +1,2 @@
1
+ import { IQuenUIFont } from '../types/fonts';
2
+ export declare const QUENUI_DEFAULT_FONT: IQuenUIFont;
@@ -0,0 +1,42 @@
1
+ import { rem } from "polished";
2
+ const QUENUI_DEFAULT_FONT = {
3
+ header: {
4
+ size: {
5
+ "2xl": rem(56),
6
+ xl: rem(40),
7
+ l: rem(32),
8
+ m: rem(28),
9
+ s: rem(24),
10
+ xs: rem(16)
11
+ },
12
+ lineHeight: {
13
+ "2xl": rem(64),
14
+ xl: rem(48),
15
+ l: rem(40),
16
+ m: rem(32),
17
+ s: rem(24),
18
+ xs: rem(16)
19
+ },
20
+ weight: 700
21
+ },
22
+ text: {
23
+ size: {
24
+ xl: rem(24),
25
+ l: rem(20),
26
+ m: rem(16),
27
+ s: rem(14),
28
+ xs: rem(12)
29
+ },
30
+ lineHeight: {
31
+ xl: rem(32),
32
+ l: rem(28),
33
+ m: rem(24),
34
+ s: rem(20),
35
+ xs: rem(16)
36
+ },
37
+ weight: 400
38
+ }
39
+ };
40
+ export {
41
+ QUENUI_DEFAULT_FONT
42
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const polished = require("polished");
4
+ const QUENUI_DEFAULT_SPACE = {
5
+ l: polished.rem(24),
6
+ m: polished.rem(16),
7
+ s: polished.rem(12),
8
+ xs: polished.rem(8)
9
+ };
10
+ exports.QUENUI_DEFAULT_SPACE = QUENUI_DEFAULT_SPACE;
@@ -0,0 +1,2 @@
1
+ import { IQuenUIThemeSpace } from '../types/space';
2
+ export declare const QUENUI_DEFAULT_SPACE: IQuenUIThemeSpace;
@@ -0,0 +1,10 @@
1
+ import { rem } from "polished";
2
+ const QUENUI_DEFAULT_SPACE = {
3
+ l: rem(24),
4
+ m: rem(16),
5
+ s: rem(12),
6
+ xs: rem(8)
7
+ };
8
+ export {
9
+ QUENUI_DEFAULT_SPACE
10
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const helpers = require("@quen-ui/helpers");
4
+ const lightTheme = require("./theme/lightTheme.cjs.js");
5
+ const createTheme = (newTheme, defaultTheme = lightTheme.QuenUILightTheme) => {
6
+ return helpers.deepMerge(defaultTheme, newTheme);
7
+ };
8
+ exports.createTheme = createTheme;
@@ -0,0 +1,3 @@
1
+ import { TDeepPartial } from '@quen-ui/helpers';
2
+ import { IQuenUITheme } from './theme/types';
3
+ export declare const createTheme: (newTheme: TDeepPartial<IQuenUITheme>, defaultTheme?: IQuenUITheme) => IQuenUITheme<import('./colors/types').TQuenUIColors> & TDeepPartial<IQuenUITheme<import('./colors/types').TQuenUIColors>>;
@@ -0,0 +1,8 @@
1
+ import { deepMerge } from "@quen-ui/helpers";
2
+ import { QuenUILightTheme } from "./theme/lightTheme.es.js";
3
+ const createTheme = (newTheme, defaultTheme = QuenUILightTheme) => {
4
+ return deepMerge(defaultTheme, newTheme);
5
+ };
6
+ export {
7
+ createTheme
8
+ };
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const font = require("./constants/font.cjs.js");
4
+ const space = require("./constants/space.cjs.js");
5
+ const control = require("./constants/control.cjs.js");
6
+ const index = require("./colors/index.cjs.js");
7
+ const darkTheme = require("./theme/darkTheme.cjs.js");
8
+ const lightTheme = require("./theme/lightTheme.cjs.js");
9
+ const types = require("./colors/types.cjs.js");
10
+ const QuenUIProvider = require("./QuenUIProvider.cjs.js");
11
+ const useTheme = require("./useTheme.cjs.js");
12
+ const createTheme = require("./createTheme.cjs.js");
13
+ const injectCssVarsFromTheme = require("./injectCssVarsFromTheme.cjs.js");
14
+ exports.QUENUI_DEFAULT_FONT = font.QUENUI_DEFAULT_FONT;
15
+ exports.QUENUI_DEFAULT_SPACE = space.QUENUI_DEFAULT_SPACE;
16
+ exports.QUENUI_DEFAULT_CONTROL = control.QUENUI_DEFAULT_CONTROL;
17
+ exports.QUEN_UI_DARK_COLORS = index.QUEN_UI_DARK_COLORS;
18
+ exports.QUEN_UI_LIGHT_COLORS = index.QUEN_UI_LIGHT_COLORS;
19
+ exports.QuenUIDarkTheme = darkTheme.QuenUIDarkTheme;
20
+ exports.QuenUILightTheme = lightTheme.QuenUILightTheme;
21
+ exports.QUENUI_COlORS_PALETTE = types.QUENUI_COlORS_PALETTE;
22
+ exports.QuenUIProvider = QuenUIProvider.QuenUIProvider;
23
+ exports.useTheme = useTheme.useTheme;
24
+ exports.createTheme = createTheme.createTheme;
25
+ exports.getVariables = injectCssVarsFromTheme.getVariables;
26
+ exports.injectCssVarsFromTheme = injectCssVarsFromTheme.injectCssVarsFromTheme;
@@ -0,0 +1,16 @@
1
+ export { QUENUI_DEFAULT_FONT } from './constants/font';
2
+ export { QUENUI_DEFAULT_SPACE } from './constants/space';
3
+ export { QUENUI_DEFAULT_CONTROL } from './constants/control';
4
+ export { QUEN_UI_DARK_COLORS, QUEN_UI_LIGHT_COLORS } from './colors';
5
+ export { QuenUIDarkTheme } from './theme/darkTheme';
6
+ export { QuenUILightTheme } from './theme/lightTheme';
7
+ export { QUENUI_COlORS_PALETTE } from './colors/types';
8
+ export { QuenUIProvider } from './QuenUIProvider';
9
+ export type { IQuenUIFont } from './types/fonts';
10
+ export type { IQuenUIThemeControl } from './types/control';
11
+ export type { IQuenUIThemeSpace } from './types/space';
12
+ export type { IQuenUITheme } from './theme/types';
13
+ export type { IQuenUIColor, TDefaultQuenUIColors } from './colors/types';
14
+ export { useTheme } from './useTheme';
15
+ export { createTheme } from './createTheme';
16
+ export { injectCssVarsFromTheme, getVariables } from './injectCssVarsFromTheme';
@@ -0,0 +1,26 @@
1
+ import { QUENUI_DEFAULT_FONT } from "./constants/font.es.js";
2
+ import { QUENUI_DEFAULT_SPACE } from "./constants/space.es.js";
3
+ import { QUENUI_DEFAULT_CONTROL } from "./constants/control.es.js";
4
+ import { QUEN_UI_DARK_COLORS, QUEN_UI_LIGHT_COLORS } from "./colors/index.es.js";
5
+ import { QuenUIDarkTheme } from "./theme/darkTheme.es.js";
6
+ import { QuenUILightTheme } from "./theme/lightTheme.es.js";
7
+ import { QUENUI_COlORS_PALETTE } from "./colors/types.es.js";
8
+ import { QuenUIProvider } from "./QuenUIProvider.es.js";
9
+ import { useTheme } from "./useTheme.es.js";
10
+ import { createTheme } from "./createTheme.es.js";
11
+ import { getVariables, injectCssVarsFromTheme } from "./injectCssVarsFromTheme.es.js";
12
+ export {
13
+ QUENUI_COlORS_PALETTE,
14
+ QUENUI_DEFAULT_CONTROL,
15
+ QUENUI_DEFAULT_FONT,
16
+ QUENUI_DEFAULT_SPACE,
17
+ QUEN_UI_DARK_COLORS,
18
+ QUEN_UI_LIGHT_COLORS,
19
+ QuenUIDarkTheme,
20
+ QuenUILightTheme,
21
+ QuenUIProvider,
22
+ createTheme,
23
+ getVariables,
24
+ injectCssVarsFromTheme,
25
+ useTheme
26
+ };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const toCssVarName = (path) => `--quen-ui-${path.join("-")}`;
4
+ const extractVars = (obj, path = []) => {
5
+ return Object.entries(obj).flatMap(([key, value]) => {
6
+ const currentPath = [...path, key];
7
+ if (typeof value === "object" && value !== null) {
8
+ return extractVars(value, currentPath);
9
+ }
10
+ return [[toCssVarName(currentPath), value]];
11
+ });
12
+ };
13
+ const getVariables = (theme) => {
14
+ const entries = [];
15
+ entries.push(["--quen-ui-font-family", theme.fontFamily]);
16
+ entries.push(["--quen-ui-text-color", theme.textColor]);
17
+ entries.push(["--quen-ui-color-body", theme.colorBody]);
18
+ entries.push(["--quen-ui-primary-color", theme.primaryColor]);
19
+ entries.push(...extractVars(theme.colors, ["color"]));
20
+ entries.push(...extractVars(theme.control, ["control"]));
21
+ entries.push(...extractVars(theme.space, ["space"]));
22
+ if (theme.fonts) {
23
+ entries.push(...extractVars(theme.fonts, ["fonts"]));
24
+ }
25
+ return entries;
26
+ };
27
+ const injectCssVarsFromTheme = (theme, root = document.documentElement) => {
28
+ for (const [key, value] of getVariables(theme)) {
29
+ root.style.setProperty(key, value);
30
+ }
31
+ };
32
+ exports.getVariables = getVariables;
33
+ exports.injectCssVarsFromTheme = injectCssVarsFromTheme;
@@ -0,0 +1,3 @@
1
+ import { IQuenUITheme } from './theme/types';
2
+ export declare const getVariables: (theme: IQuenUITheme) => [string, string][];
3
+ export declare const injectCssVarsFromTheme: (theme: IQuenUITheme, root?: HTMLElement) => void;
@@ -0,0 +1,33 @@
1
+ const toCssVarName = (path) => `--quen-ui-${path.join("-")}`;
2
+ const extractVars = (obj, path = []) => {
3
+ return Object.entries(obj).flatMap(([key, value]) => {
4
+ const currentPath = [...path, key];
5
+ if (typeof value === "object" && value !== null) {
6
+ return extractVars(value, currentPath);
7
+ }
8
+ return [[toCssVarName(currentPath), value]];
9
+ });
10
+ };
11
+ const getVariables = (theme) => {
12
+ const entries = [];
13
+ entries.push(["--quen-ui-font-family", theme.fontFamily]);
14
+ entries.push(["--quen-ui-text-color", theme.textColor]);
15
+ entries.push(["--quen-ui-color-body", theme.colorBody]);
16
+ entries.push(["--quen-ui-primary-color", theme.primaryColor]);
17
+ entries.push(...extractVars(theme.colors, ["color"]));
18
+ entries.push(...extractVars(theme.control, ["control"]));
19
+ entries.push(...extractVars(theme.space, ["space"]));
20
+ if (theme.fonts) {
21
+ entries.push(...extractVars(theme.fonts, ["fonts"]));
22
+ }
23
+ return entries;
24
+ };
25
+ const injectCssVarsFromTheme = (theme, root = document.documentElement) => {
26
+ for (const [key, value] of getVariables(theme)) {
27
+ root.style.setProperty(key, value);
28
+ }
29
+ };
30
+ export {
31
+ getVariables,
32
+ injectCssVarsFromTheme
33
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("../colors/index.cjs.js");
4
+ const control = require("../constants/control.cjs.js");
5
+ const space = require("../constants/space.cjs.js");
6
+ const font = require("../constants/font.cjs.js");
7
+ const DEFAULT_FONT_FAMILY = "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji";
8
+ const QuenUIDarkTheme = {
9
+ colors: index.QUEN_UI_DARK_COLORS,
10
+ primaryColor: "violet",
11
+ textColor: index.QUEN_UI_DARK_COLORS.gray["9"],
12
+ fontFamily: DEFAULT_FONT_FAMILY,
13
+ control: control.QUENUI_DEFAULT_CONTROL,
14
+ space: space.QUENUI_DEFAULT_SPACE,
15
+ fonts: font.QUENUI_DEFAULT_FONT,
16
+ colorBody: "#1c1c1c",
17
+ components: {}
18
+ };
19
+ exports.QuenUIDarkTheme = QuenUIDarkTheme;
@@ -0,0 +1,2 @@
1
+ import { IQuenUITheme } from './types';
2
+ export declare const QuenUIDarkTheme: IQuenUITheme;
@@ -0,0 +1,19 @@
1
+ import { QUEN_UI_DARK_COLORS } from "../colors/index.es.js";
2
+ import { QUENUI_DEFAULT_CONTROL } from "../constants/control.es.js";
3
+ import { QUENUI_DEFAULT_SPACE } from "../constants/space.es.js";
4
+ import { QUENUI_DEFAULT_FONT } from "../constants/font.es.js";
5
+ const DEFAULT_FONT_FAMILY = "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji";
6
+ const QuenUIDarkTheme = {
7
+ colors: QUEN_UI_DARK_COLORS,
8
+ primaryColor: "violet",
9
+ textColor: QUEN_UI_DARK_COLORS.gray["9"],
10
+ fontFamily: DEFAULT_FONT_FAMILY,
11
+ control: QUENUI_DEFAULT_CONTROL,
12
+ space: QUENUI_DEFAULT_SPACE,
13
+ fonts: QUENUI_DEFAULT_FONT,
14
+ colorBody: "#1c1c1c",
15
+ components: {}
16
+ };
17
+ export {
18
+ QuenUIDarkTheme
19
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index = require("../colors/index.cjs.js");
4
+ const control = require("../constants/control.cjs.js");
5
+ const space = require("../constants/space.cjs.js");
6
+ const font = require("../constants/font.cjs.js");
7
+ const DEFAULT_FONT_FAMILY = "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji";
8
+ const QuenUILightTheme = {
9
+ colors: index.QUEN_UI_LIGHT_COLORS,
10
+ primaryColor: "violet",
11
+ textColor: index.QUEN_UI_LIGHT_COLORS.gray["9"],
12
+ fontFamily: DEFAULT_FONT_FAMILY,
13
+ control: control.QUENUI_DEFAULT_CONTROL,
14
+ space: space.QUENUI_DEFAULT_SPACE,
15
+ fonts: font.QUENUI_DEFAULT_FONT,
16
+ colorBody: "#fffffe",
17
+ components: {}
18
+ };
19
+ exports.QuenUILightTheme = QuenUILightTheme;
@@ -0,0 +1,2 @@
1
+ import { IQuenUITheme } from './types';
2
+ export declare const QuenUILightTheme: IQuenUITheme;
@@ -0,0 +1,19 @@
1
+ import { QUEN_UI_LIGHT_COLORS } from "../colors/index.es.js";
2
+ import { QUENUI_DEFAULT_CONTROL } from "../constants/control.es.js";
3
+ import { QUENUI_DEFAULT_SPACE } from "../constants/space.es.js";
4
+ import { QUENUI_DEFAULT_FONT } from "../constants/font.es.js";
5
+ const DEFAULT_FONT_FAMILY = "-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji";
6
+ const QuenUILightTheme = {
7
+ colors: QUEN_UI_LIGHT_COLORS,
8
+ primaryColor: "violet",
9
+ textColor: QUEN_UI_LIGHT_COLORS.gray["9"],
10
+ fontFamily: DEFAULT_FONT_FAMILY,
11
+ control: QUENUI_DEFAULT_CONTROL,
12
+ space: QUENUI_DEFAULT_SPACE,
13
+ fonts: QUENUI_DEFAULT_FONT,
14
+ colorBody: "#fffffe",
15
+ components: {}
16
+ };
17
+ export {
18
+ QuenUILightTheme
19
+ };
@@ -0,0 +1,15 @@
1
+ import { TQuenUIColors } from '../colors/types';
2
+ import { IQuenUIThemeControl } from '../types/control';
3
+ import { IQuenUIThemeSpace } from '../types/space';
4
+ import { IQuenUIFont } from '../types/fonts';
5
+ export interface IQuenUITheme<C extends TQuenUIColors = TQuenUIColors> {
6
+ colors: C;
7
+ primaryColor: keyof TQuenUIColors;
8
+ colorBody: string;
9
+ textColor: string;
10
+ fontFamily: string;
11
+ control: IQuenUIThemeControl;
12
+ space: IQuenUIThemeSpace;
13
+ fonts: IQuenUIFont;
14
+ components: Record<string, any>;
15
+ }
@@ -0,0 +1,10 @@
1
+ export interface IQuenUIThemeControl {
2
+ radius: string;
3
+ borderWidth: string;
4
+ height: {
5
+ l: string;
6
+ m: string;
7
+ s: string;
8
+ xs: string;
9
+ };
10
+ }
@@ -0,0 +1,38 @@
1
+ export interface IQuenUIFont {
2
+ header: {
3
+ size: {
4
+ "2xl": string;
5
+ xl: string;
6
+ l: string;
7
+ m: string;
8
+ s: string;
9
+ xs: string;
10
+ };
11
+ lineHeight: {
12
+ "2xl": string;
13
+ xl: string;
14
+ l: string;
15
+ m: string;
16
+ s: string;
17
+ xs: string;
18
+ };
19
+ weight: number;
20
+ };
21
+ text: {
22
+ size: {
23
+ xl: string;
24
+ l: string;
25
+ m: string;
26
+ s: string;
27
+ xs: string;
28
+ };
29
+ lineHeight: {
30
+ xl: string;
31
+ l: string;
32
+ m: string;
33
+ s: string;
34
+ xs: string;
35
+ };
36
+ weight: number;
37
+ };
38
+ }
@@ -0,0 +1,6 @@
1
+ export interface IQuenUIThemeSpace {
2
+ xs: string;
3
+ s: string;
4
+ m: string;
5
+ l: string;
6
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const react = require("react");
4
+ const styledComponents = require("styled-components");
5
+ const useTheme = () => {
6
+ const theme = react.useContext(styledComponents.ThemeContext);
7
+ if (!theme) {
8
+ throw new Error("useTheme must be used within a QuenUIProvider");
9
+ }
10
+ return theme;
11
+ };
12
+ exports.useTheme = useTheme;
@@ -0,0 +1,2 @@
1
+ import { IQuenUITheme } from './theme/types';
2
+ export declare const useTheme: () => IQuenUITheme;
@@ -0,0 +1,12 @@
1
+ import { useContext } from "react";
2
+ import { ThemeContext } from "styled-components";
3
+ const useTheme = () => {
4
+ const theme = useContext(ThemeContext);
5
+ if (!theme) {
6
+ throw new Error("useTheme must be used within a QuenUIProvider");
7
+ }
8
+ return theme;
9
+ };
10
+ export {
11
+ useTheme
12
+ };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@quen-ui/theme",
3
+ "private": false,
4
+ "version": "0.0.13",
5
+ "type": "module",
6
+ "homepage": "https://quen-ui.github.io/quen-ui/",
7
+ "author": "QuenUI",
8
+ "scripts": {
9
+ "dev": "vite",
10
+ "build": "tsc -b && vite build",
11
+ "lint": "eslint .",
12
+ "preview": "vite preview"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "main": "./dist/index.cjs.js",
18
+ "module": "./dist/index.es.js",
19
+ "types": "./dist/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.es.js",
24
+ "require": "./dist/index.cjs.js"
25
+ }
26
+ },
27
+ "dependencies": {
28
+ "@quen-ui/helpers": "*",
29
+ "styled-components": "^6.1.15"
30
+ },
31
+ "devDependencies": {
32
+ "@types/react": "^19.1.12",
33
+ "@types/react-dom": "^19.1.9",
34
+ "@vitejs/plugin-react": "^4.3.4",
35
+ "globals": "^15.15.0",
36
+ "typescript": "~5.7.2",
37
+ "typescript-eslint": "^8.24.1",
38
+ "vite": "^6.2.0"
39
+ },
40
+ "peerDependencies": {
41
+ "react": ">=18.0.0",
42
+ "react-dom": ">=18.0.0"
43
+ },
44
+ "directories": {
45
+ "lib": "lib"
46
+ },
47
+ "sideEffects": false,
48
+ "keywords": [
49
+ "components",
50
+ "react",
51
+ "react-components",
52
+ "design",
53
+ "frontend",
54
+ "library",
55
+ "ui",
56
+ "ui-kit",
57
+ "theme",
58
+ "styled-components"
59
+ ],
60
+ "license": "MIT"
61
+ }