sesame-components-testing 2.0.1 → 2.0.2
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/Button/Button.d.ts +14 -0
- package/dist/Button/Button.js +22 -0
- package/dist/Button/Button.styles.d.ts +10 -0
- package/{src/Button/Button.styles.ts → dist/Button/Button.styles.js} +30 -53
- package/dist/Common/FlexCenter.d.ts +4 -0
- package/dist/Common/FlexCenter.js +12 -0
- package/dist/SesameComponent.d.ts +5 -0
- package/dist/SesameComponent.js +17 -0
- package/dist/index.js +7 -0
- package/dist/theme/ThemeProvider.d.ts +7 -0
- package/dist/theme/ThemeProvider.js +19 -0
- package/dist/theme/colors/darkColors.d.ts +2 -0
- package/dist/theme/colors/darkColors.js +224 -0
- package/dist/theme/colors/lightColors.d.ts +2 -0
- package/dist/theme/colors/lightColors.js +224 -0
- package/dist/theme/colors/primitiveColors.d.ts +19 -0
- package/dist/theme/colors/primitiveColors.js +259 -0
- package/dist/theme/extendTheme.d.ts +2 -0
- package/dist/theme/extendTheme.js +23 -0
- package/{src/theme/index.ts → dist/theme/index.d.ts} +2 -4
- package/dist/theme/index.js +22 -0
- package/dist/theme/sizes/breakpoints.d.ts +2 -0
- package/dist/theme/sizes/breakpoints.js +732 -0
- package/dist/theme/sizes/dpiToRem.d.ts +2 -0
- package/dist/theme/sizes/dpiToRem.js +9 -0
- package/dist/theme/sizes/getSizedTheme.d.ts +3 -0
- package/dist/theme/sizes/getSizedTheme.js +8 -0
- package/dist/theme/theme.d.ts +7 -0
- package/dist/theme/theme.js +32 -0
- package/dist/theme/types.d.ts +169 -0
- package/dist/theme/types.js +2 -0
- package/dist/theme/useBreakpointSize.d.ts +3 -0
- package/dist/theme/useBreakpointSize.js +35 -0
- package/package.json +7 -12
- package/src/Button/Button.tsx +0 -37
- package/src/Common/FlexCenter.tsx +0 -7
- package/src/SesameComponent.tsx +0 -16
- package/src/theme/ThemeProvider.tsx +0 -23
- package/src/theme/colors/darkColors.ts +0 -223
- package/src/theme/colors/lightColors.ts +0 -223
- package/src/theme/colors/primitiveColors.ts +0 -297
- package/src/theme/extendTheme.ts +0 -26
- package/src/theme/reset.css +0 -21
- package/src/theme/sizes/breakpoints.ts +0 -751
- package/src/theme/sizes/dpiToRem.ts +0 -8
- package/src/theme/sizes/getSizedTheme.ts +0 -8
- package/src/theme/theme.ts +0 -32
- package/src/theme/types.ts +0 -205
- package/src/theme/useBreakpointSize.ts +0 -38
- package/tsconfig.json +0 -13
- package/vite-env.d.ts +0 -8
- package/vite.config.ts +0 -55
- package/vitest.config.ts +0 -76
- package/vitest.shims.d.ts +0 -1
- /package/{src/index.ts → dist/index.d.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dpiToRem = void 0;
|
|
4
|
+
const BASE_SIZE = 16;
|
|
5
|
+
const dpiToRem = (dpi, base) => {
|
|
6
|
+
base = base !== null && base !== void 0 ? base : BASE_SIZE;
|
|
7
|
+
return `${Math.round((dpi / base) * 1000) / 1000}rem`;
|
|
8
|
+
};
|
|
9
|
+
exports.dpiToRem = dpiToRem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSizedTheme = void 0;
|
|
4
|
+
const getSizedTheme = (theme, size) => {
|
|
5
|
+
const breakpoint = theme.breakpoints[size !== null && size !== void 0 ? size : 'large'];
|
|
6
|
+
return Object.assign(Object.assign({}, theme), breakpoint);
|
|
7
|
+
};
|
|
8
|
+
exports.getSizedTheme = getSizedTheme;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './reset.css';
|
|
2
|
+
import '@fontsource/inter/400';
|
|
3
|
+
import '@fontsource/inter/500';
|
|
4
|
+
import '@fontsource/inter/600';
|
|
5
|
+
import '@fontsource/inter/700';
|
|
6
|
+
export declare const lightTheme: import("./types").Theme;
|
|
7
|
+
export declare const darkTheme: import("./types").Theme;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.darkTheme = exports.lightTheme = void 0;
|
|
4
|
+
require("./reset.css");
|
|
5
|
+
require("@fontsource/inter/400");
|
|
6
|
+
require("@fontsource/inter/500");
|
|
7
|
+
require("@fontsource/inter/600");
|
|
8
|
+
require("@fontsource/inter/700");
|
|
9
|
+
const darkColors_1 = require("./colors/darkColors");
|
|
10
|
+
const lightColors_1 = require("./colors/lightColors");
|
|
11
|
+
const breakpoints_1 = require("./sizes/breakpoints");
|
|
12
|
+
const getSizedTheme_1 = require("./sizes/getSizedTheme");
|
|
13
|
+
const baseTheme = {
|
|
14
|
+
letterSpacing: {
|
|
15
|
+
normal: '-0.15px',
|
|
16
|
+
},
|
|
17
|
+
boxShadow: {
|
|
18
|
+
inset: {
|
|
19
|
+
s: '0px 4px 4px 0px rgba(0, 0, 0, 0.6) inset',
|
|
20
|
+
m: '2px 4px 4px 0px rgba(0, 0, 0, 0.6) inset',
|
|
21
|
+
},
|
|
22
|
+
dropdown: {
|
|
23
|
+
m: '4px 4px 24px 0px rgba(0, 0, 0, 0.25)',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
transition: {
|
|
27
|
+
default: '0.2s ease',
|
|
28
|
+
},
|
|
29
|
+
breakpoints: breakpoints_1.breakpoints,
|
|
30
|
+
};
|
|
31
|
+
exports.lightTheme = (0, getSizedTheme_1.getSizedTheme)(Object.assign({ colors: lightColors_1.lightColors }, baseTheme), 'large');
|
|
32
|
+
exports.darkTheme = (0, getSizedTheme_1.getSizedTheme)(Object.assign({ colors: darkColors_1.darkColors }, baseTheme), 'large');
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
export type Rem = `${number}rem`;
|
|
2
|
+
export type Sizes<T extends string> = {
|
|
3
|
+
[K in T]: Rem;
|
|
4
|
+
};
|
|
5
|
+
export type SizeGroup<T extends string, V extends string> = {
|
|
6
|
+
[K in T]: Sizes<V>;
|
|
7
|
+
};
|
|
8
|
+
export type Rgba = `rgba(${number}, ${number}, ${number}, ${number})`;
|
|
9
|
+
export type ColorValues<T extends string> = {
|
|
10
|
+
[K in T]: Rgba;
|
|
11
|
+
};
|
|
12
|
+
export type ColorValueGroup<T extends string, V extends string> = {
|
|
13
|
+
[K in T]: ColorValues<V>;
|
|
14
|
+
};
|
|
15
|
+
export interface TypographySizes<T extends string> {
|
|
16
|
+
size: Sizes<T>;
|
|
17
|
+
lineHeight: Sizes<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface HeightConfig {
|
|
20
|
+
button: {
|
|
21
|
+
posButton: SizeGroup<'l' | 'm' | 's', 'min' | 'fixed' | 'max'>;
|
|
22
|
+
keypadButton: SizeGroup<'l', 'fixed'>;
|
|
23
|
+
};
|
|
24
|
+
badge: SizeGroup<'xl' | 'l' | 'm' | 's' | 'xs', 'fixed'>;
|
|
25
|
+
image: Sizes<'l' | 'm'>;
|
|
26
|
+
input: Sizes<'fixed'>;
|
|
27
|
+
keypad: {
|
|
28
|
+
panel: Sizes<'fixed'>;
|
|
29
|
+
};
|
|
30
|
+
list: {
|
|
31
|
+
listItemCart: {
|
|
32
|
+
caret: Sizes<'fixed'>;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
page: {
|
|
36
|
+
pos: Sizes<'standard'>;
|
|
37
|
+
};
|
|
38
|
+
selection: {
|
|
39
|
+
checkbox: Sizes<'fixed'>;
|
|
40
|
+
radio: Sizes<'fixed'>;
|
|
41
|
+
};
|
|
42
|
+
tile: {
|
|
43
|
+
customizationTile: {
|
|
44
|
+
multiAddContent: Sizes<'fixed'>;
|
|
45
|
+
default: Sizes<'fixed'>;
|
|
46
|
+
};
|
|
47
|
+
selectionTile: Sizes<'fixed'>;
|
|
48
|
+
menuTile: {
|
|
49
|
+
default: Sizes<'fixed'>;
|
|
50
|
+
mealContent: Sizes<'fixed'>;
|
|
51
|
+
meal: Sizes<'fixed'>;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
toggle: {
|
|
55
|
+
container: Sizes<'fixed'>;
|
|
56
|
+
handle: Sizes<'fixed'>;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface WidthConfig {
|
|
60
|
+
button: {
|
|
61
|
+
posButton: SizeGroup<'l', 'min'>;
|
|
62
|
+
keypadButton: SizeGroup<'l', 'fixed'>;
|
|
63
|
+
};
|
|
64
|
+
list: {
|
|
65
|
+
listItemCart: {
|
|
66
|
+
caret: Sizes<'fixed'>;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
modal: Sizes<'fixed'>;
|
|
70
|
+
page: {
|
|
71
|
+
pos: Sizes<'standard'>;
|
|
72
|
+
};
|
|
73
|
+
panel: SizeGroup<'l' | 'm', 'fixed'>;
|
|
74
|
+
sidebar: Sizes<'fixed'>;
|
|
75
|
+
tile: {
|
|
76
|
+
customizationTile: Sizes<'imageContainer'>;
|
|
77
|
+
menuTile: Sizes<'imageContainer'>;
|
|
78
|
+
};
|
|
79
|
+
toggle: {
|
|
80
|
+
container: Sizes<'fixed'>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export type BreakpointSize = 'large' | 'medium' | 'small';
|
|
84
|
+
export interface Typography {
|
|
85
|
+
fontWeight: {
|
|
86
|
+
regular: number;
|
|
87
|
+
medium: number;
|
|
88
|
+
semibold: number;
|
|
89
|
+
bold: number;
|
|
90
|
+
};
|
|
91
|
+
title: TypographySizes<'2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl'>;
|
|
92
|
+
body: TypographySizes<'2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl'>;
|
|
93
|
+
label: TypographySizes<'2xs' | 'xs' | 's' | 'm' | 'l' | 'xl'>;
|
|
94
|
+
}
|
|
95
|
+
export interface Breakpoint {
|
|
96
|
+
typography: Typography;
|
|
97
|
+
space: Sizes<'zero' | '3xs' | '2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl'>;
|
|
98
|
+
border: Sizes<'zero' | 's' | 'm' | 'l' | 'xl' | '2xl'>;
|
|
99
|
+
radii: Sizes<'0' | '2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | 'full'>;
|
|
100
|
+
icon: Sizes<'4xs' | '3xs' | '2xs' | 'xs' | 's' | 'm' | 'l' | 'xl' | '2xl' | '3xl'>;
|
|
101
|
+
height: HeightConfig;
|
|
102
|
+
width: WidthConfig;
|
|
103
|
+
}
|
|
104
|
+
export type Breakpoints = {
|
|
105
|
+
[K in BreakpointSize]: Breakpoint;
|
|
106
|
+
};
|
|
107
|
+
export interface Colors {
|
|
108
|
+
fill: {
|
|
109
|
+
icon: {
|
|
110
|
+
common: ColorValues<'highEmphasis' | 'mediumEmphasis' | 'active' | 'disabled'>;
|
|
111
|
+
inverse: ColorValues<'highEmphasis' | 'mediumEmphasis' | 'disabled' | 'error'>;
|
|
112
|
+
constantDark: ColorValues<'highEmphasis' | 'mediumEmphasis' | 'disabled'>;
|
|
113
|
+
constantLight: ColorValues<'highEmphasis' | 'mediumEmphasis' | 'disabled'>;
|
|
114
|
+
constantColor: ColorValues<'purple' | 'red' | 'yellow' | 'green' | 'brown' | 'orange' | 'lightBlue' | 'lightGreen' | 'lightYellow' | 'lightPink' | 'lightGrey'>;
|
|
115
|
+
notification: ColorValues<'success' | 'info' | 'error' | 'warning'>;
|
|
116
|
+
link: ColorValues<'default' | 'hover' | 'pressed'>;
|
|
117
|
+
};
|
|
118
|
+
cta: ColorValueGroup<'primary' | 'secondary' | 'tertiary' | 'critical', 'default' | 'pressed' | 'disabled'> & {
|
|
119
|
+
ghost: ColorValues<'default' | 'pressed'>;
|
|
120
|
+
success: ColorValues<'default'>;
|
|
121
|
+
};
|
|
122
|
+
notification: ColorValues<'general' | 'success' | 'info' | 'error' | 'warning'>;
|
|
123
|
+
surface: ColorValues<'default' | 'raised' | 'sunken' | 'disabled' | 'highEmphasis' | 'overlay' | 'status' | 'success' | 'critical' | 'warning'> & {
|
|
124
|
+
brand: ColorValues<'gold' | 'red' | 'gray'>;
|
|
125
|
+
constant: ColorValues<'dark' | 'light'>;
|
|
126
|
+
constantColor: ColorValues<'blue' | 'red' | 'purple' | 'yellow' | 'green' | 'gold'>;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
border: {
|
|
130
|
+
cta: ColorValueGroup<'primary' | 'secondary' | 'tertiary' | 'critical', 'default' | 'pressed' | 'disabled'> & {
|
|
131
|
+
success: ColorValues<'default'>;
|
|
132
|
+
};
|
|
133
|
+
fields: ColorValues<'default' | 'active' | 'filled' | 'disabled' | 'error' | 'success'>;
|
|
134
|
+
elements: {
|
|
135
|
+
divider: ColorValues<'highEmphasis' | 'mediumEmphasis'>;
|
|
136
|
+
};
|
|
137
|
+
states: ColorValues<'focus' | 'selected' | 'disabled'>;
|
|
138
|
+
container: ColorValues<'highEmphasis' | 'mediumEmphasis' | 'lowEmphasis' | 'inverseHigh' | 'inverseMedium' | 'constantLight' | 'constantDark'> & {
|
|
139
|
+
constantColor: ColorValues<'blue' | 'purple' | 'red' | 'yellow' | 'green' | 'gold'>;
|
|
140
|
+
};
|
|
141
|
+
common: ColorValues<'highEmphasis' | 'mediumEmphasis'>;
|
|
142
|
+
};
|
|
143
|
+
text: {
|
|
144
|
+
common: ColorValues<'highContrast' | 'highEmphasis' | 'mediumEmphasis' | 'disabled' | 'success' | 'info' | 'error' | 'warning'>;
|
|
145
|
+
inverse: ColorValues<'highContrast' | 'highEmphasis' | 'mediumEmphasis' | 'disabled'>;
|
|
146
|
+
constantDark: ColorValues<'highContrast' | 'highEmphasis' | 'mediumEmphasis' | 'disabled'>;
|
|
147
|
+
constantLight: ColorValues<'highContrast' | 'highEmphasis' | 'mediumEmphasis' | 'disabled'>;
|
|
148
|
+
link: ColorValues<'default' | 'hover' | 'pressed' | 'inactive'>;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export interface Theme extends Breakpoint {
|
|
152
|
+
colors: Colors;
|
|
153
|
+
letterSpacing: {
|
|
154
|
+
normal: string;
|
|
155
|
+
};
|
|
156
|
+
boxShadow: {
|
|
157
|
+
inset: {
|
|
158
|
+
s: string;
|
|
159
|
+
m: string;
|
|
160
|
+
};
|
|
161
|
+
dropdown: {
|
|
162
|
+
m: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
transition: {
|
|
166
|
+
default: string;
|
|
167
|
+
};
|
|
168
|
+
breakpoints: Breakpoints;
|
|
169
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBreakpointSize = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const getBreakpointSize = (width) => {
|
|
6
|
+
if (width >= 1600)
|
|
7
|
+
return 'large';
|
|
8
|
+
if (width >= 1100)
|
|
9
|
+
return 'medium';
|
|
10
|
+
return 'small';
|
|
11
|
+
};
|
|
12
|
+
const useBreakpointSize = () => {
|
|
13
|
+
const [breakpointSize, setBreakpointSize] = (0, react_1.useState)(() => {
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
return getBreakpointSize(window.innerWidth);
|
|
16
|
+
}
|
|
17
|
+
return 'large';
|
|
18
|
+
});
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
const handleResize = () => {
|
|
21
|
+
const newBreakpoint = getBreakpointSize(window.innerWidth);
|
|
22
|
+
if (newBreakpoint !== breakpointSize) {
|
|
23
|
+
setBreakpointSize(newBreakpoint);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const initialBreakpoint = getBreakpointSize(window.innerWidth);
|
|
27
|
+
setBreakpointSize(initialBreakpoint);
|
|
28
|
+
window.addEventListener('resize', handleResize);
|
|
29
|
+
return () => {
|
|
30
|
+
window.removeEventListener('resize', handleResize);
|
|
31
|
+
};
|
|
32
|
+
}, [breakpointSize]);
|
|
33
|
+
return breakpointSize;
|
|
34
|
+
};
|
|
35
|
+
exports.useBreakpointSize = useBreakpointSize;
|
package/package.json
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sesame-components-testing",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A reusable npm component package.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
5
7
|
"scripts": {
|
|
6
|
-
"build": "
|
|
8
|
+
"build": "tsc",
|
|
7
9
|
"test": "echo \"No tests yet\""
|
|
8
10
|
},
|
|
9
11
|
"author": "",
|
|
10
12
|
"license": "MIT",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"import": "./dist/sesame-components.es.js",
|
|
18
|
-
"require": "./dist/sesame-components.cjs.js"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
21
16
|
"keywords": [
|
|
22
17
|
"component",
|
|
23
18
|
"npm",
|
package/src/Button/Button.tsx
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ButtonHTMLAttributes, FC, ReactNode } from 'react';
|
|
2
|
-
import type { Theme } from '../theme';
|
|
3
|
-
import { FlexCenter } from '../Common/FlexCenter';
|
|
4
|
-
import { StyledButton } from './Button.styles';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'ghost' | 'error' | 'success' | 'keypad';
|
|
8
|
-
|
|
9
|
-
export type ButtonSize = keyof Theme['height']['button']['posButton'];
|
|
10
|
-
|
|
11
|
-
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
|
-
children: ReactNode;
|
|
13
|
-
variant?: ButtonVariant;
|
|
14
|
-
size?: ButtonSize;
|
|
15
|
-
selected?: boolean;
|
|
16
|
-
leftIcon?: ReactNode;
|
|
17
|
-
rightIcon?: ReactNode;
|
|
18
|
-
stretch?: boolean;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const Button: FC<ButtonProps> = ({
|
|
22
|
-
variant = 'primary',
|
|
23
|
-
size = 'm',
|
|
24
|
-
selected,
|
|
25
|
-
children,
|
|
26
|
-
leftIcon,
|
|
27
|
-
rightIcon,
|
|
28
|
-
stretch = false,
|
|
29
|
-
type = 'button',
|
|
30
|
-
...rest
|
|
31
|
-
}) => (
|
|
32
|
-
<StyledButton type={type} $variant={variant} $size={size} $selected={selected} $stretch={stretch} {...rest}>
|
|
33
|
-
{leftIcon && <FlexCenter>{leftIcon}</FlexCenter>}
|
|
34
|
-
<FlexCenter>{children}</FlexCenter>
|
|
35
|
-
{rightIcon && <FlexCenter>{rightIcon}</FlexCenter>}
|
|
36
|
-
</StyledButton>
|
|
37
|
-
);
|
package/src/SesameComponent.tsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
|
|
4
|
-
export interface SesameComponentProps {
|
|
5
|
-
message?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const StyledDiv = styled.div`
|
|
9
|
-
background-color: red;
|
|
10
|
-
font-weight: bold;
|
|
11
|
-
font-size: 33px;
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const SesameComponent: React.FC<SesameComponentProps> = ({ message = "Hello, Sesame!" }) => {
|
|
15
|
-
return <StyledDiv>{message}</StyledDiv>;
|
|
16
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ThemeProvider as EmotionThemeProvider } from '@emotion/react';
|
|
2
|
-
import { type FC, type ReactNode, useMemo } from 'react';
|
|
3
|
-
import { getSizedTheme } from './sizes/getSizedTheme';
|
|
4
|
-
import type { Theme } from './types';
|
|
5
|
-
import { useBreakpointSize } from './useBreakpointSize';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
export interface ThemeProviderProps {
|
|
9
|
-
theme: Theme;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const useSizedTheme = (theme: Theme): Theme => {
|
|
14
|
-
const size = useBreakpointSize();
|
|
15
|
-
return useMemo(() => {
|
|
16
|
-
return getSizedTheme(theme, size);
|
|
17
|
-
}, [size, theme]);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export const ThemeProvider: FC<ThemeProviderProps> = ({ theme, children }) => {
|
|
21
|
-
const sizedTheme = useSizedTheme(theme);
|
|
22
|
-
return <EmotionThemeProvider theme={sizedTheme}>{children}</EmotionThemeProvider>;
|
|
23
|
-
};
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import type { Colors } from '../types';
|
|
2
|
-
import { primitiveColors } from './primitiveColors';
|
|
3
|
-
|
|
4
|
-
export const darkColors: Colors = {
|
|
5
|
-
fill: {
|
|
6
|
-
icon: {
|
|
7
|
-
common: {
|
|
8
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
9
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['03'],
|
|
10
|
-
active: primitiveColors.solids.gold['500'],
|
|
11
|
-
disabled: 'rgba(238, 232, 224, 0.6)',
|
|
12
|
-
},
|
|
13
|
-
inverse: {
|
|
14
|
-
highEmphasis: primitiveColors.grayscale.neutral['08'],
|
|
15
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['06'],
|
|
16
|
-
disabled: primitiveColors.transparencies.black['60%'],
|
|
17
|
-
error: primitiveColors.solids.red['600'],
|
|
18
|
-
},
|
|
19
|
-
constantDark: {
|
|
20
|
-
highEmphasis: primitiveColors.grayscale.neutral['08'],
|
|
21
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['06'],
|
|
22
|
-
disabled: primitiveColors.transparencies.black['60%'],
|
|
23
|
-
},
|
|
24
|
-
constantLight: {
|
|
25
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
26
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['03'],
|
|
27
|
-
disabled: 'rgba(252, 250, 247, 0.8)',
|
|
28
|
-
},
|
|
29
|
-
constantColor: {
|
|
30
|
-
purple: primitiveColors.solids.purple['400'],
|
|
31
|
-
red: primitiveColors.solids.red['500'],
|
|
32
|
-
yellow: primitiveColors.solids.yellow['500'],
|
|
33
|
-
green: primitiveColors.solids.greenDark['600'],
|
|
34
|
-
brown: primitiveColors.solids.brownWarm['600'],
|
|
35
|
-
orange: primitiveColors.solids.orange['500'],
|
|
36
|
-
lightBlue: primitiveColors.solids.blue['100'],
|
|
37
|
-
lightGreen: primitiveColors.solids.yellowGreen['300'],
|
|
38
|
-
lightYellow: primitiveColors.solids.gold['400'],
|
|
39
|
-
lightPink: primitiveColors.solids.fuchsia['100'],
|
|
40
|
-
lightGrey: primitiveColors.grayscale.neutral['02'],
|
|
41
|
-
},
|
|
42
|
-
notification: {
|
|
43
|
-
success: primitiveColors.solids.green['200'],
|
|
44
|
-
info: primitiveColors.solids.cyan['200'],
|
|
45
|
-
error: primitiveColors.solids.red['200'],
|
|
46
|
-
warning: primitiveColors.solids.orange['200'],
|
|
47
|
-
},
|
|
48
|
-
link: {
|
|
49
|
-
default: primitiveColors.solids.blue['300'],
|
|
50
|
-
hover: primitiveColors.solids.blue['200'],
|
|
51
|
-
pressed: primitiveColors.solids.blue['500'],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
cta: {
|
|
55
|
-
primary: {
|
|
56
|
-
default: primitiveColors.solids.gold['500'],
|
|
57
|
-
pressed: primitiveColors.solids.gold['600'],
|
|
58
|
-
disabled: 'rgba(214, 155, 0, 0.4)',
|
|
59
|
-
},
|
|
60
|
-
secondary: {
|
|
61
|
-
default: primitiveColors.grayscale.neutral['09'],
|
|
62
|
-
pressed: primitiveColors.grayscale.neutral['10'],
|
|
63
|
-
disabled: 'rgba(33, 29, 23, 0.8)',
|
|
64
|
-
},
|
|
65
|
-
tertiary: {
|
|
66
|
-
default: primitiveColors.grayscale.neutral['10'],
|
|
67
|
-
pressed: primitiveColors.grayscale.neutral['11'],
|
|
68
|
-
disabled: 'rgba(9, 9, 9, 0.9)',
|
|
69
|
-
},
|
|
70
|
-
ghost: {
|
|
71
|
-
default: primitiveColors.transparencies.white['0%'],
|
|
72
|
-
pressed: primitiveColors.grayscale.neutral['09'],
|
|
73
|
-
},
|
|
74
|
-
critical: {
|
|
75
|
-
default: primitiveColors.solids.red['500'],
|
|
76
|
-
pressed: primitiveColors.solids.red['700'],
|
|
77
|
-
disabled: 'rgba(219, 0, 7, 0.4)',
|
|
78
|
-
},
|
|
79
|
-
success: {
|
|
80
|
-
default: primitiveColors.solids.green['600'],
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
notification: {
|
|
84
|
-
general: 'rgba(238, 232, 224, 0.8)',
|
|
85
|
-
success: 'rgba(6, 143, 29, 0.8)',
|
|
86
|
-
info: 'rgba(27, 106, 136, 0.8)',
|
|
87
|
-
error: 'rgba(219, 0, 7, 0.8)',
|
|
88
|
-
warning: 'rgba(232, 114, 10, 0.8)',
|
|
89
|
-
},
|
|
90
|
-
surface: {
|
|
91
|
-
default: primitiveColors.grayscale.neutral['09'],
|
|
92
|
-
raised: primitiveColors.grayscale.neutral['08'],
|
|
93
|
-
sunken: primitiveColors.grayscale.neutral['10'],
|
|
94
|
-
disabled: 'rgba(33, 29, 23, 0.4)',
|
|
95
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
96
|
-
overlay: 'rgba(33, 29, 23, 0.8)',
|
|
97
|
-
status: primitiveColors.solids.cyan['600'],
|
|
98
|
-
success: primitiveColors.solids.greenDark['600'],
|
|
99
|
-
critical: primitiveColors.solids.red['400'],
|
|
100
|
-
warning: primitiveColors.solids.gold['600'],
|
|
101
|
-
brand: {
|
|
102
|
-
gold: primitiveColors.solids.gold['500'],
|
|
103
|
-
red: primitiveColors.solids.red['500'],
|
|
104
|
-
gray: primitiveColors.grayscale.neutral['06'],
|
|
105
|
-
},
|
|
106
|
-
constant: {
|
|
107
|
-
dark: primitiveColors.grayscale.neutral['08'],
|
|
108
|
-
light: primitiveColors.grayscale.neutral['01'],
|
|
109
|
-
},
|
|
110
|
-
constantColor: {
|
|
111
|
-
blue: primitiveColors.solids.blueDark['400'],
|
|
112
|
-
red: primitiveColors.solids.red['600'],
|
|
113
|
-
purple: primitiveColors.solids.indigo['400'],
|
|
114
|
-
yellow: primitiveColors.solids.gold['600'],
|
|
115
|
-
green: primitiveColors.solids.yellowGreen['600'],
|
|
116
|
-
gold: primitiveColors.solids.gold['400'],
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
border: {
|
|
121
|
-
cta: {
|
|
122
|
-
primary: {
|
|
123
|
-
default: primitiveColors.solids.gold['400'],
|
|
124
|
-
pressed: primitiveColors.solids.gold['400'],
|
|
125
|
-
disabled: 'rgba(133, 96, 0, 0.4)',
|
|
126
|
-
},
|
|
127
|
-
secondary: {
|
|
128
|
-
default: primitiveColors.solids.grey['700'],
|
|
129
|
-
pressed: primitiveColors.grayscale.neutral['06'],
|
|
130
|
-
disabled: 'rgba(61, 61, 61, 0.8)',
|
|
131
|
-
},
|
|
132
|
-
tertiary: {
|
|
133
|
-
default: primitiveColors.solids.grey['600'],
|
|
134
|
-
pressed: primitiveColors.solids.grey['500'],
|
|
135
|
-
disabled: primitiveColors.solids.grey['700'],
|
|
136
|
-
},
|
|
137
|
-
critical: {
|
|
138
|
-
default: primitiveColors.solids.red['400'],
|
|
139
|
-
pressed: primitiveColors.solids.red['300'],
|
|
140
|
-
disabled: 'rgba(236, 49, 55, 0.4)',
|
|
141
|
-
},
|
|
142
|
-
success: {
|
|
143
|
-
default: primitiveColors.solids.greenDark['500'],
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
fields: {
|
|
147
|
-
default: primitiveColors.grayscale.neutral['05'],
|
|
148
|
-
active: primitiveColors.grayscale.neutral['04'],
|
|
149
|
-
filled: primitiveColors.grayscale.neutral['05'],
|
|
150
|
-
disabled: 'rgba(107, 98, 89, 0.5)',
|
|
151
|
-
error: primitiveColors.solids.red['500'],
|
|
152
|
-
success: primitiveColors.solids.green['200'],
|
|
153
|
-
},
|
|
154
|
-
elements: {
|
|
155
|
-
divider: {
|
|
156
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
157
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['07'],
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
states: {
|
|
161
|
-
focus: primitiveColors.grayscale.neutral['00'],
|
|
162
|
-
selected: primitiveColors.solids.gold['500'],
|
|
163
|
-
disabled: primitiveColors.grayscale.neutral['06'],
|
|
164
|
-
},
|
|
165
|
-
container: {
|
|
166
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
167
|
-
mediumEmphasis: primitiveColors.solids.grey['700'],
|
|
168
|
-
lowEmphasis: primitiveColors.grayscale.neutral['08'],
|
|
169
|
-
inverseHigh: primitiveColors.grayscale.neutral['08'],
|
|
170
|
-
inverseMedium: primitiveColors.solids.tan['300'],
|
|
171
|
-
constantLight: primitiveColors.grayscale.neutral['02'],
|
|
172
|
-
constantDark: primitiveColors.grayscale.neutral['08'],
|
|
173
|
-
constantColor: {
|
|
174
|
-
blue: primitiveColors.solids.blueDark['500'],
|
|
175
|
-
purple: primitiveColors.solids.indigo['600'],
|
|
176
|
-
red: primitiveColors.solids.red['700'],
|
|
177
|
-
yellow: primitiveColors.solids.gold['700'],
|
|
178
|
-
green: primitiveColors.solids.yellowGreen['700'],
|
|
179
|
-
gold: primitiveColors.solids.gold['400'],
|
|
180
|
-
},
|
|
181
|
-
},
|
|
182
|
-
common: {
|
|
183
|
-
highEmphasis: primitiveColors.grayscale.neutral['04'],
|
|
184
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['06'],
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
text: {
|
|
188
|
-
common: {
|
|
189
|
-
highContrast: primitiveColors.grayscale.neutral['00'],
|
|
190
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
191
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['03'],
|
|
192
|
-
disabled: 'rgba(238, 232, 224, 0.6)',
|
|
193
|
-
success: primitiveColors.solids.green['300'],
|
|
194
|
-
info: primitiveColors.solids.cyan['100'],
|
|
195
|
-
error: primitiveColors.solids.red['100'],
|
|
196
|
-
warning: primitiveColors.solids.orange['300'],
|
|
197
|
-
},
|
|
198
|
-
inverse: {
|
|
199
|
-
highContrast: primitiveColors.grayscale.neutral['11'],
|
|
200
|
-
highEmphasis: primitiveColors.grayscale.neutral['08'],
|
|
201
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['07'],
|
|
202
|
-
disabled: 'rgba(13, 12, 12, 0.7)',
|
|
203
|
-
},
|
|
204
|
-
constantDark: {
|
|
205
|
-
highContrast: primitiveColors.grayscale.neutral['11'],
|
|
206
|
-
highEmphasis: primitiveColors.grayscale.neutral['08'],
|
|
207
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['07'],
|
|
208
|
-
disabled: primitiveColors.transparencies.black['70%'],
|
|
209
|
-
},
|
|
210
|
-
constantLight: {
|
|
211
|
-
highContrast: primitiveColors.grayscale.neutral['00'],
|
|
212
|
-
highEmphasis: primitiveColors.grayscale.neutral['02'],
|
|
213
|
-
mediumEmphasis: primitiveColors.grayscale.neutral['03'],
|
|
214
|
-
disabled: 'rgba(252, 250, 247, 0.8)',
|
|
215
|
-
},
|
|
216
|
-
link: {
|
|
217
|
-
default: primitiveColors.solids.blue['300'],
|
|
218
|
-
hover: primitiveColors.solids.blue['200'],
|
|
219
|
-
pressed: primitiveColors.solids.blue['500'],
|
|
220
|
-
inactive: primitiveColors.grayscale.neutral['04'],
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
};
|