@mohammadsalman/storybook-custom-ui 1.0.0 → 1.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/README.md +60 -176
- package/dist/assets/index-BWMuc5b_.js +9 -0
- package/dist/assets/index-COcDBgFa.css +1 -0
- package/dist/assets/react-CHdo91hT.svg +1 -0
- package/dist/index.html +14 -0
- package/dist/vite.svg +1 -0
- package/package.json +50 -39
- package/src/components/Button/Button.stories.tsx +0 -109
- package/src/components/Button/Button.tsx +0 -144
- package/src/components/Button/index.ts +0 -1
- package/src/components/index.ts +0 -1
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useFormInput.stories.tsx +0 -126
- package/src/hooks/useFormInput.ts +0 -114
- package/src/index.ts +0 -0
- package/src/theme/ThemeProvider.tsx +0 -34
- package/src/theme/defaultTheme.ts +0 -182
- package/src/theme/index.ts +0 -3
- package/src/theme/types.ts +0 -106
- package/src/utils/styles.ts +0 -15
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { Theme, PaletteColor } from './types';
|
|
2
|
-
|
|
3
|
-
const createPaletteColor = (main: string, light: string, dark: string): PaletteColor => ({
|
|
4
|
-
50: light,
|
|
5
|
-
100: light,
|
|
6
|
-
200: light,
|
|
7
|
-
300: main,
|
|
8
|
-
400: main,
|
|
9
|
-
500: main,
|
|
10
|
-
600: main,
|
|
11
|
-
700: dark,
|
|
12
|
-
800: dark,
|
|
13
|
-
900: dark,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const defaultTheme: Theme = {
|
|
17
|
-
mode: 'light',
|
|
18
|
-
palette: {
|
|
19
|
-
primary: createPaletteColor('#1976d2', '#42a5f5', '#1565c0'),
|
|
20
|
-
secondary: createPaletteColor('#9c27b0', '#ba68c8', '#7b1fa2'),
|
|
21
|
-
success: createPaletteColor('#2e7d32', '#66bb6a', '#1b5e20'),
|
|
22
|
-
error: createPaletteColor('#d32f2f', '#ef5350', '#c62828'),
|
|
23
|
-
warning: createPaletteColor('#ed6c02', '#ff9800', '#e65100'),
|
|
24
|
-
info: createPaletteColor('#0288d1', '#42a5f5', '#01579b'),
|
|
25
|
-
grey: {
|
|
26
|
-
50: '#fafafa',
|
|
27
|
-
100: '#f5f5f5',
|
|
28
|
-
200: '#eeeeee',
|
|
29
|
-
300: '#e0e0e0',
|
|
30
|
-
400: '#bdbdbd',
|
|
31
|
-
500: '#9e9e9e',
|
|
32
|
-
600: '#757575',
|
|
33
|
-
700: '#616161',
|
|
34
|
-
800: '#424242',
|
|
35
|
-
900: '#212121',
|
|
36
|
-
},
|
|
37
|
-
text: {
|
|
38
|
-
primary: 'rgba(0, 0, 0, 0.87)',
|
|
39
|
-
secondary: 'rgba(0, 0, 0, 0.6)',
|
|
40
|
-
disabled: 'rgba(0, 0, 0, 0.38)',
|
|
41
|
-
},
|
|
42
|
-
background: {
|
|
43
|
-
default: '#ffffff',
|
|
44
|
-
paper: '#ffffff',
|
|
45
|
-
},
|
|
46
|
-
divider: 'rgba(0, 0, 0, 0.12)',
|
|
47
|
-
action: {
|
|
48
|
-
active: 'rgba(0, 0, 0, 0.54)',
|
|
49
|
-
hover: 'rgba(0, 0, 0, 0.04)',
|
|
50
|
-
selected: 'rgba(0, 0, 0, 0.08)',
|
|
51
|
-
disabled: 'rgba(0, 0, 0, 0.26)',
|
|
52
|
-
disabledBackground: 'rgba(0, 0, 0, 0.12)',
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
typography: {
|
|
56
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
57
|
-
fontSize: 14,
|
|
58
|
-
fontWeightLight: 300,
|
|
59
|
-
fontWeightRegular: 400,
|
|
60
|
-
fontWeightMedium: 500,
|
|
61
|
-
fontWeightBold: 700,
|
|
62
|
-
h1: {
|
|
63
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
64
|
-
fontWeight: 300,
|
|
65
|
-
fontSize: '6rem',
|
|
66
|
-
lineHeight: '1.167',
|
|
67
|
-
letterSpacing: '-0.01562em',
|
|
68
|
-
},
|
|
69
|
-
h2: {
|
|
70
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
71
|
-
fontWeight: 300,
|
|
72
|
-
fontSize: '3.75rem',
|
|
73
|
-
lineHeight: '1.2',
|
|
74
|
-
letterSpacing: '-0.00833em',
|
|
75
|
-
},
|
|
76
|
-
h3: {
|
|
77
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
78
|
-
fontWeight: 400,
|
|
79
|
-
fontSize: '3rem',
|
|
80
|
-
lineHeight: '1.167',
|
|
81
|
-
letterSpacing: '0em',
|
|
82
|
-
},
|
|
83
|
-
h4: {
|
|
84
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
85
|
-
fontWeight: 400,
|
|
86
|
-
fontSize: '2.125rem',
|
|
87
|
-
lineHeight: '1.235',
|
|
88
|
-
letterSpacing: '0.00735em',
|
|
89
|
-
},
|
|
90
|
-
h5: {
|
|
91
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
92
|
-
fontWeight: 400,
|
|
93
|
-
fontSize: '1.5rem',
|
|
94
|
-
lineHeight: '1.334',
|
|
95
|
-
letterSpacing: '0em',
|
|
96
|
-
},
|
|
97
|
-
h6: {
|
|
98
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
99
|
-
fontWeight: 500,
|
|
100
|
-
fontSize: '1.25rem',
|
|
101
|
-
lineHeight: '1.6',
|
|
102
|
-
letterSpacing: '0.0075em',
|
|
103
|
-
},
|
|
104
|
-
subtitle1: {
|
|
105
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
106
|
-
fontWeight: 400,
|
|
107
|
-
fontSize: '1rem',
|
|
108
|
-
lineHeight: '1.75',
|
|
109
|
-
letterSpacing: '0.00938em',
|
|
110
|
-
},
|
|
111
|
-
subtitle2: {
|
|
112
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
113
|
-
fontWeight: 500,
|
|
114
|
-
fontSize: '0.875rem',
|
|
115
|
-
lineHeight: '1.57',
|
|
116
|
-
letterSpacing: '0.00714em',
|
|
117
|
-
},
|
|
118
|
-
body1: {
|
|
119
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
120
|
-
fontWeight: 400,
|
|
121
|
-
fontSize: '1rem',
|
|
122
|
-
lineHeight: '1.5',
|
|
123
|
-
letterSpacing: '0.00938em',
|
|
124
|
-
},
|
|
125
|
-
body2: {
|
|
126
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
127
|
-
fontWeight: 400,
|
|
128
|
-
fontSize: '0.875rem',
|
|
129
|
-
lineHeight: '1.43',
|
|
130
|
-
letterSpacing: '0.01071em',
|
|
131
|
-
},
|
|
132
|
-
button: {
|
|
133
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
134
|
-
fontWeight: 500,
|
|
135
|
-
fontSize: '0.875rem',
|
|
136
|
-
lineHeight: '1.75',
|
|
137
|
-
letterSpacing: '0.02857em',
|
|
138
|
-
},
|
|
139
|
-
caption: {
|
|
140
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
141
|
-
fontWeight: 400,
|
|
142
|
-
fontSize: '0.75rem',
|
|
143
|
-
lineHeight: '1.66',
|
|
144
|
-
letterSpacing: '0.03333em',
|
|
145
|
-
},
|
|
146
|
-
overline: {
|
|
147
|
-
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
|
|
148
|
-
fontWeight: 400,
|
|
149
|
-
fontSize: '0.75rem',
|
|
150
|
-
lineHeight: '2.66',
|
|
151
|
-
letterSpacing: '0.08333em',
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
spacing: {
|
|
155
|
-
unit: 8,
|
|
156
|
-
},
|
|
157
|
-
shape: {
|
|
158
|
-
borderRadius: 4,
|
|
159
|
-
},
|
|
160
|
-
shadows: {
|
|
161
|
-
0: 'none',
|
|
162
|
-
1: '0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12)',
|
|
163
|
-
2: '0px 3px 1px -2px rgba(0,0,0,0.2), 0px 2px 2px 0px rgba(0,0,0,0.14), 0px 1px 5px 0px rgba(0,0,0,0.12)',
|
|
164
|
-
3: '0px 3px 3px -2px rgba(0,0,0,0.2), 0px 3px 4px 0px rgba(0,0,0,0.14), 0px 1px 8px 0px rgba(0,0,0,0.12)',
|
|
165
|
-
4: '0px 2px 4px -1px rgba(0,0,0,0.2), 0px 4px 5px 0px rgba(0,0,0,0.14), 0px 1px 10px 0px rgba(0,0,0,0.12)',
|
|
166
|
-
5: '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 5px 8px 0px rgba(0,0,0,0.14), 0px 1px 14px 0px rgba(0,0,0,0.12)',
|
|
167
|
-
6: '0px 3px 5px -1px rgba(0,0,0,0.2), 0px 6px 10px 0px rgba(0,0,0,0.14), 0px 1px 18px 0px rgba(0,0,0,0.12)',
|
|
168
|
-
8: '0px 5px 5px -3px rgba(0,0,0,0.2), 0px 8px 10px 1px rgba(0,0,0,0.14), 0px 3px 14px 2px rgba(0,0,0,0.12)',
|
|
169
|
-
12: '0px 7px 8px -4px rgba(0,0,0,0.2), 0px 12px 17px 2px rgba(0,0,0,0.14), 0px 5px 22px 4px rgba(0,0,0,0.12)',
|
|
170
|
-
16: '0px 8px 10px -5px rgba(0,0,0,0.2), 0px 16px 24px 2px rgba(0,0,0,0.14), 0px 6px 30px 5px rgba(0,0,0,0.12)',
|
|
171
|
-
24: '0px 11px 15px -7px rgba(0,0,0,0.2), 0px 24px 38px 3px rgba(0,0,0,0.14), 0px 9px 46px 8px rgba(0,0,0,0.12)',
|
|
172
|
-
},
|
|
173
|
-
zIndex: {
|
|
174
|
-
mobileStepper: 1000,
|
|
175
|
-
speedDial: 1050,
|
|
176
|
-
appBar: 1100,
|
|
177
|
-
drawer: 1200,
|
|
178
|
-
modal: 1300,
|
|
179
|
-
snackbar: 1400,
|
|
180
|
-
tooltip: 1500,
|
|
181
|
-
},
|
|
182
|
-
};
|
package/src/theme/index.ts
DELETED
package/src/theme/types.ts
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
export type ThemeMode = 'light' | 'dark';
|
|
2
|
-
|
|
3
|
-
export interface PaletteColor {
|
|
4
|
-
50: string;
|
|
5
|
-
100: string;
|
|
6
|
-
200: string;
|
|
7
|
-
300: string;
|
|
8
|
-
400: string;
|
|
9
|
-
500: string;
|
|
10
|
-
600: string;
|
|
11
|
-
700: string;
|
|
12
|
-
800: string;
|
|
13
|
-
900: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface Palette {
|
|
17
|
-
primary: PaletteColor;
|
|
18
|
-
secondary: PaletteColor;
|
|
19
|
-
success: PaletteColor;
|
|
20
|
-
error: PaletteColor;
|
|
21
|
-
warning: PaletteColor;
|
|
22
|
-
info: PaletteColor;
|
|
23
|
-
grey: PaletteColor;
|
|
24
|
-
text: {
|
|
25
|
-
primary: string;
|
|
26
|
-
secondary: string;
|
|
27
|
-
disabled: string;
|
|
28
|
-
};
|
|
29
|
-
background: {
|
|
30
|
-
default: string;
|
|
31
|
-
paper: string;
|
|
32
|
-
};
|
|
33
|
-
divider: string;
|
|
34
|
-
action: {
|
|
35
|
-
active: string;
|
|
36
|
-
hover: string;
|
|
37
|
-
selected: string;
|
|
38
|
-
disabled: string;
|
|
39
|
-
disabledBackground: string;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface Typography {
|
|
44
|
-
fontFamily: string;
|
|
45
|
-
fontSize: number;
|
|
46
|
-
fontWeightLight: number;
|
|
47
|
-
fontWeightRegular: number;
|
|
48
|
-
fontWeightMedium: number;
|
|
49
|
-
fontWeightBold: number;
|
|
50
|
-
h1: TypographyVariant;
|
|
51
|
-
h2: TypographyVariant;
|
|
52
|
-
h3: TypographyVariant;
|
|
53
|
-
h4: TypographyVariant;
|
|
54
|
-
h5: TypographyVariant;
|
|
55
|
-
h6: TypographyVariant;
|
|
56
|
-
subtitle1: TypographyVariant;
|
|
57
|
-
subtitle2: TypographyVariant;
|
|
58
|
-
body1: TypographyVariant;
|
|
59
|
-
body2: TypographyVariant;
|
|
60
|
-
button: TypographyVariant;
|
|
61
|
-
caption: TypographyVariant;
|
|
62
|
-
overline: TypographyVariant;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface TypographyVariant {
|
|
66
|
-
fontFamily: string;
|
|
67
|
-
fontWeight: number;
|
|
68
|
-
fontSize: string;
|
|
69
|
-
lineHeight: string;
|
|
70
|
-
letterSpacing: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export interface Spacing {
|
|
74
|
-
unit: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface Shape {
|
|
78
|
-
borderRadius: number;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface Shadows {
|
|
82
|
-
[key: number]: string;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface Theme {
|
|
86
|
-
mode: ThemeMode;
|
|
87
|
-
palette: Palette;
|
|
88
|
-
typography: Typography;
|
|
89
|
-
spacing: Spacing;
|
|
90
|
-
shape: Shape;
|
|
91
|
-
shadows: Shadows;
|
|
92
|
-
zIndex: {
|
|
93
|
-
mobileStepper: number;
|
|
94
|
-
speedDial: number;
|
|
95
|
-
appBar: number;
|
|
96
|
-
drawer: number;
|
|
97
|
-
modal: number;
|
|
98
|
-
snackbar: number;
|
|
99
|
-
tooltip: number;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export type ThemeProviderProps = {
|
|
104
|
-
theme: Theme;
|
|
105
|
-
children: React.ReactNode;
|
|
106
|
-
};
|
package/src/utils/styles.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Theme } from '../theme/types';
|
|
2
|
-
|
|
3
|
-
export const spacing = (theme: Theme, ...values: number[]): string => {
|
|
4
|
-
return values.map(value => `${value * theme.spacing.unit}px`).join(' ');
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const getColor = (
|
|
8
|
-
theme: Theme,
|
|
9
|
-
color: 'primary' | 'secondary' | 'success' | 'error' | 'warning' | 'info',
|
|
10
|
-
shade: keyof Theme['palette']['primary'] = 500
|
|
11
|
-
): string => {
|
|
12
|
-
return theme.palette[color][shade];
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export const css = (styles: React.CSSProperties): React.CSSProperties => styles;
|