@bitrise/bitkit 12.71.0 → 12.71.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/package.json +1 -1
- package/src/Components/AccordionLegacy/Accordion.theme.ts +4 -5
- package/src/Components/Filter/FilterAdd/FilterAdd.tsx +6 -1
- package/src/{Components → Foundations}/Icons/figmaIcons.ts +1 -1
- package/src/tsconfig.json +3 -3
- package/tsconfig.json +2 -2
- package/src/Components/Icons/Icons.tsx +0 -363
- package/src/Foundations/Colors/DesignTokens.tsx +0 -67
- package/src/Foundations/Colors/Palette.tsx +0 -146
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { StyleFunctionProps } from '@chakra-ui/styled-system';
|
|
1
|
+
import { StyleFunctionProps, SystemStyleObject } from '@chakra-ui/styled-system';
|
|
2
2
|
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
3
|
-
import { CSSObject } from '@emotion/react';
|
|
4
3
|
|
|
5
4
|
type ColorObj = {
|
|
6
5
|
[key: string]: {
|
|
@@ -74,10 +73,10 @@ const variants: VariantObj = {
|
|
|
74
73
|
},
|
|
75
74
|
};
|
|
76
75
|
|
|
77
|
-
const LegacyBaseStyle: ({
|
|
76
|
+
const LegacyBaseStyle: ({
|
|
78
77
|
colorScheme,
|
|
79
78
|
variant,
|
|
80
|
-
}) => ({
|
|
79
|
+
}: Pick<StyleFunctionProps, 'colorScheme' | 'variant'>) => SystemStyleObject = ({ colorScheme, variant }) => ({
|
|
81
80
|
item: {
|
|
82
81
|
border: variants[variant].border ?? '1px solid',
|
|
83
82
|
borderColor: colors[colorScheme].border,
|
|
@@ -122,7 +121,7 @@ const LegacyBaseStyle: ({ colorScheme, variant }: Pick<StyleFunctionProps, 'colo
|
|
|
122
121
|
},
|
|
123
122
|
});
|
|
124
123
|
|
|
125
|
-
const BaseStyle: () =>
|
|
124
|
+
const BaseStyle: () => SystemStyleObject = () => ({
|
|
126
125
|
item: {
|
|
127
126
|
borderTop: '1px solid',
|
|
128
127
|
borderTopColor: 'neutral.90',
|
|
@@ -69,7 +69,12 @@ const FilterAdd = (props: FilterAddProps) => {
|
|
|
69
69
|
zIndex={isOpen ? 'dialog' : undefined}
|
|
70
70
|
>
|
|
71
71
|
{selectedCategory ? (
|
|
72
|
-
<FilterForm
|
|
72
|
+
<FilterForm
|
|
73
|
+
category={selectedCategory}
|
|
74
|
+
categoryName={data[selectedCategory].categoryName}
|
|
75
|
+
onChange={onFilterChange}
|
|
76
|
+
onCancel={onClose}
|
|
77
|
+
/>
|
|
73
78
|
) : (
|
|
74
79
|
categoryList.map((category) => {
|
|
75
80
|
const { categoryName, dependsOn } = data[category];
|
package/src/tsconfig.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,363 +0,0 @@
|
|
|
1
|
-
import { Fragment, useState } from 'react';
|
|
2
|
-
import { Grid, GridItem, SystemStyleObject, Tooltip, useClipboard, useToast } from '@chakra-ui/react';
|
|
3
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
4
|
-
import { Unstyled } from '@storybook/blocks';
|
|
5
|
-
import Box from '../Box/Box';
|
|
6
|
-
import Card from '../Card/Card';
|
|
7
|
-
import Icon, { TypeIconName } from '../Icon/Icon';
|
|
8
|
-
import Text from '../Text/Text';
|
|
9
|
-
import Table from '../Table/Table';
|
|
10
|
-
import Tbody from '../Table/Tbody';
|
|
11
|
-
import Td from '../Table/Td';
|
|
12
|
-
import Tr from '../Table/Tr';
|
|
13
|
-
import Th from '../Table/Th';
|
|
14
|
-
import Thead from '../Table/Thead';
|
|
15
|
-
import Provider from '../Provider/Provider';
|
|
16
|
-
import Input from '../Form/Input/Input';
|
|
17
|
-
import FilterSwitchGroup from '../Filter/FilterSwitch/FilterSwitchGroup';
|
|
18
|
-
import FilterSwitch from '../Filter/FilterSwitch/FilterSwitch';
|
|
19
|
-
import * as bigIcons from './24x24';
|
|
20
|
-
import { FigmaIcon, figmaIcons } from './figmaIcons';
|
|
21
|
-
|
|
22
|
-
const iconSizeTooltipSytle: SystemStyleObject = {
|
|
23
|
-
backgroundColor: 'purple.50',
|
|
24
|
-
color: 'neutral.100',
|
|
25
|
-
borderRadius: '3px',
|
|
26
|
-
position: 'absolute',
|
|
27
|
-
fontSize: '8px',
|
|
28
|
-
padding: '2px 4px',
|
|
29
|
-
lineHeight: '8px',
|
|
30
|
-
display: 'none',
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const iconSizeTooltipHoverStyle: SystemStyleObject = {
|
|
34
|
-
svg: {
|
|
35
|
-
border: '1px dotted transparent',
|
|
36
|
-
},
|
|
37
|
-
'&:hover svg.icon-preview': {
|
|
38
|
-
borderColor: 'purple.50',
|
|
39
|
-
},
|
|
40
|
-
'&:hover .icon-size-tooltip': {
|
|
41
|
-
display: 'block',
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const IconSizeTooltip = ({ size }: { size: '24' | '16' }) => {
|
|
46
|
-
return (
|
|
47
|
-
<Box
|
|
48
|
-
className="icon-size-tooltip"
|
|
49
|
-
sx={{
|
|
50
|
-
...iconSizeTooltipSytle,
|
|
51
|
-
marginLeft: size === '24' ? '-1px' : '-5px',
|
|
52
|
-
marginTop: size === '24' ? '2px' : '0px',
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
{`${size}px`}
|
|
56
|
-
</Box>
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const IconCard = ({ figmaIcon, sx }: { figmaIcon: FigmaIcon; sx?: SystemStyleObject }) => {
|
|
61
|
-
const { onCopy } = useClipboard(figmaIcon.iconName, {});
|
|
62
|
-
const toast = useToast();
|
|
63
|
-
const name = (figmaIcon.iconName === '' ? 'WarningColored' : figmaIcon.iconName) as TypeIconName;
|
|
64
|
-
return (
|
|
65
|
-
<Tooltip
|
|
66
|
-
label={
|
|
67
|
-
<Text textAlign="center">
|
|
68
|
-
{figmaIcon.iconName || 'Missing!'}
|
|
69
|
-
<br />
|
|
70
|
-
click to copy <Icon size="16" color="white" name="Duplicate" />
|
|
71
|
-
</Text>
|
|
72
|
-
}
|
|
73
|
-
>
|
|
74
|
-
<Card
|
|
75
|
-
float="left"
|
|
76
|
-
width={150}
|
|
77
|
-
marginRight={8}
|
|
78
|
-
marginBottom={8}
|
|
79
|
-
color={name.match(/White$/) ? 'neutral.100' : 'text.body'}
|
|
80
|
-
background={name.match(/White$/) ? 'brand.primary' : 'neutral.100'}
|
|
81
|
-
sx={{
|
|
82
|
-
'&:hover': {
|
|
83
|
-
borderColor: 'purple.50',
|
|
84
|
-
},
|
|
85
|
-
...iconSizeTooltipHoverStyle,
|
|
86
|
-
...sx,
|
|
87
|
-
}}
|
|
88
|
-
>
|
|
89
|
-
<Grid
|
|
90
|
-
onClick={() => {
|
|
91
|
-
onCopy();
|
|
92
|
-
toast.closeAll();
|
|
93
|
-
toast({
|
|
94
|
-
title: (
|
|
95
|
-
<>
|
|
96
|
-
Copied <code>{figmaIcon.iconName}</code>!
|
|
97
|
-
</>
|
|
98
|
-
),
|
|
99
|
-
});
|
|
100
|
-
}}
|
|
101
|
-
cursor="pointer"
|
|
102
|
-
alignContent="space-around"
|
|
103
|
-
gridTemplateColumns="1f 1f"
|
|
104
|
-
padding={8}
|
|
105
|
-
paddingTop={16}
|
|
106
|
-
gap="16"
|
|
107
|
-
alignItems="center"
|
|
108
|
-
>
|
|
109
|
-
<Box marginX="auto" opacity={figmaIcon.iconName === '' ? 0 : 1}>
|
|
110
|
-
<Icon className="icon-preview" name={name} size="24" />
|
|
111
|
-
<IconSizeTooltip size="24" />
|
|
112
|
-
</Box>
|
|
113
|
-
<Box marginX="auto" opacity={figmaIcon.iconName === '' ? 0 : 1}>
|
|
114
|
-
<Icon className="icon-preview" name={name} size="16" />
|
|
115
|
-
<IconSizeTooltip size="16" />
|
|
116
|
-
</Box>
|
|
117
|
-
<GridItem as={Text} hasEllipsis textAlign="center" fontSize="2" lineHeight="1.25rem" colSpan={2}>
|
|
118
|
-
{figmaIcon.iconName || '???'}
|
|
119
|
-
{figmaIcon.figmaToken && (
|
|
120
|
-
<>
|
|
121
|
-
<br />
|
|
122
|
-
<Box as="span" textAlign="center" fontSize="2" lineHeight="1.25rem" opacity={0.5}>
|
|
123
|
-
{figmaIcon.figmaToken}
|
|
124
|
-
</Box>
|
|
125
|
-
</>
|
|
126
|
-
)}
|
|
127
|
-
</GridItem>
|
|
128
|
-
</Grid>
|
|
129
|
-
</Card>
|
|
130
|
-
</Tooltip>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const IconGrid = ({ categoryName, icons }: { categoryName: string; icons: FigmaIcon[] }) => (
|
|
135
|
-
<>
|
|
136
|
-
<Box fontSize="small" opacity={0.5}>
|
|
137
|
-
{categoryName}
|
|
138
|
-
</Box>
|
|
139
|
-
<Box marginBottom="16" overflow="auto">
|
|
140
|
-
{icons.map((figmaIcon) => {
|
|
141
|
-
return (
|
|
142
|
-
<Fragment key={figmaIcon.figmaToken !== '???' ? figmaIcon.figmaToken : figmaIcon.iconName}>
|
|
143
|
-
<IconCard figmaIcon={figmaIcon} sx={figmaIcon.css || {}} />
|
|
144
|
-
</Fragment>
|
|
145
|
-
);
|
|
146
|
-
})}
|
|
147
|
-
</Box>
|
|
148
|
-
</>
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
const IconRow = ({ figmaIcon, sx }: { figmaIcon: FigmaIcon; sx?: SystemStyleObject }) => {
|
|
152
|
-
const { onCopy } = useClipboard(figmaIcon.iconName, {});
|
|
153
|
-
const toast = useToast();
|
|
154
|
-
const name = (figmaIcon.iconName === '' ? 'WarningColored' : figmaIcon.iconName) as TypeIconName;
|
|
155
|
-
|
|
156
|
-
const cellStyle = {
|
|
157
|
-
color: name.match(/White$/) ? 'neutral.100' : 'text.body',
|
|
158
|
-
backgroundColor: name.match(/White$/) ? 'purple.10' : 'neutral.100',
|
|
159
|
-
...sx,
|
|
160
|
-
};
|
|
161
|
-
const cellStyleHover = {
|
|
162
|
-
backgroundColor: name.match(/White$/) ? 'purple.20' : 'neutral.95',
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
return (
|
|
166
|
-
<Tr
|
|
167
|
-
className="icon-row"
|
|
168
|
-
sx={{
|
|
169
|
-
...iconSizeTooltipHoverStyle,
|
|
170
|
-
'&.icon-row:hover td': cellStyleHover,
|
|
171
|
-
}}
|
|
172
|
-
>
|
|
173
|
-
<Td sx={cellStyle} width={32}>
|
|
174
|
-
<Icon className="icon-preview" name={name} size="24" opacity={figmaIcon.iconName === '' ? 0 : 1} />
|
|
175
|
-
{figmaIcon.iconName !== '' && <IconSizeTooltip size="24" />}
|
|
176
|
-
</Td>
|
|
177
|
-
<Td sx={cellStyle} width={32}>
|
|
178
|
-
<Icon className="icon-preview" name={name} size="16" opacity={figmaIcon.iconName === '' ? 0 : 1} />
|
|
179
|
-
{figmaIcon.iconName !== '' && <IconSizeTooltip size="16" />}
|
|
180
|
-
</Td>
|
|
181
|
-
<Td sx={cellStyle} width="20%">
|
|
182
|
-
{figmaIcon.iconName || '???'}
|
|
183
|
-
<Icon
|
|
184
|
-
cursor="pointer"
|
|
185
|
-
onClick={() => {
|
|
186
|
-
onCopy();
|
|
187
|
-
toast.closeAll();
|
|
188
|
-
toast({
|
|
189
|
-
title: (
|
|
190
|
-
<>
|
|
191
|
-
Copied <code>{figmaIcon.iconName}</code>!
|
|
192
|
-
</>
|
|
193
|
-
),
|
|
194
|
-
});
|
|
195
|
-
}}
|
|
196
|
-
marginLeft="8"
|
|
197
|
-
name="Duplicate"
|
|
198
|
-
size="16"
|
|
199
|
-
sx={{
|
|
200
|
-
path: {
|
|
201
|
-
fill: 'neutral.80',
|
|
202
|
-
},
|
|
203
|
-
}}
|
|
204
|
-
/>
|
|
205
|
-
</Td>
|
|
206
|
-
<Td sx={cellStyle} width="20%">
|
|
207
|
-
<Box opacity={0.5}>{figmaIcon.figmaToken || '???'}</Box>
|
|
208
|
-
</Td>
|
|
209
|
-
<Td fontSize={2} sx={cellStyle}>
|
|
210
|
-
{figmaIcon.tags || ''}
|
|
211
|
-
</Td>
|
|
212
|
-
</Tr>
|
|
213
|
-
);
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
const IconTable = ({ categoryName, icons }: { categoryName: string; icons: FigmaIcon[] }) => (
|
|
217
|
-
<Fragment key={categoryName}>
|
|
218
|
-
<Thead>
|
|
219
|
-
<Tr>
|
|
220
|
-
<Th colSpan={5}>
|
|
221
|
-
<Box fontSize="small" opacity={0.5}>
|
|
222
|
-
{categoryName}
|
|
223
|
-
</Box>
|
|
224
|
-
</Th>
|
|
225
|
-
</Tr>
|
|
226
|
-
</Thead>
|
|
227
|
-
<Tbody>
|
|
228
|
-
{icons.map((figmaIcon) => {
|
|
229
|
-
return (
|
|
230
|
-
<Fragment key={figmaIcon.figmaToken !== '???' ? figmaIcon.figmaToken : figmaIcon.iconName}>
|
|
231
|
-
<IconRow figmaIcon={figmaIcon} sx={figmaIcon.css || {}} />
|
|
232
|
-
</Fragment>
|
|
233
|
-
);
|
|
234
|
-
})}
|
|
235
|
-
</Tbody>
|
|
236
|
-
</Fragment>
|
|
237
|
-
);
|
|
238
|
-
|
|
239
|
-
const findToken = (iconName: TypeIconName) => {
|
|
240
|
-
const filteredIcons = Object.values(figmaIcons)
|
|
241
|
-
.reduce((accumulator, value) => accumulator.concat(value), [])
|
|
242
|
-
.filter((icon) => icon.iconName === iconName);
|
|
243
|
-
if (filteredIcons.length > 0) return filteredIcons[0];
|
|
244
|
-
return null;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const getOldIcons = () =>
|
|
248
|
-
Object.keys(bigIcons)
|
|
249
|
-
.filter((icon) => {
|
|
250
|
-
const iconName = icon as TypeIconName;
|
|
251
|
-
const figmaToken = findToken(iconName);
|
|
252
|
-
if (figmaToken) return false;
|
|
253
|
-
return true;
|
|
254
|
-
})
|
|
255
|
-
.map((icon) => {
|
|
256
|
-
const iconName = icon as TypeIconName;
|
|
257
|
-
return {
|
|
258
|
-
iconName,
|
|
259
|
-
figmaToken: '???',
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
const searchIcons = (search: string) => {
|
|
264
|
-
const searchRegExp = new RegExp(`${search}`, 'im');
|
|
265
|
-
return Object.values(figmaIcons)
|
|
266
|
-
.reduce((accumulator, value) => accumulator.concat(value), [])
|
|
267
|
-
.concat(getOldIcons())
|
|
268
|
-
.filter((icon) => {
|
|
269
|
-
if (icon.iconName.match(searchRegExp)) return true;
|
|
270
|
-
if (icon.figmaToken.match(searchRegExp)) return true;
|
|
271
|
-
if (icon.tags && icon.tags.match(searchRegExp)) return true;
|
|
272
|
-
return false;
|
|
273
|
-
});
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
export const GridView = (args: { search: string }) => {
|
|
277
|
-
const { search } = args;
|
|
278
|
-
|
|
279
|
-
if (search) {
|
|
280
|
-
return <IconGrid key="Search" categoryName="Search results" icons={searchIcons(search)} />;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const figmaIconGrids = Object.keys(figmaIcons).map((categoryName) => (
|
|
284
|
-
<IconGrid key={categoryName} categoryName={categoryName} icons={figmaIcons[categoryName]} />
|
|
285
|
-
));
|
|
286
|
-
const oldIconGrid = <IconGrid key="Uncategorized" categoryName="Uncategorized" icons={getOldIcons()} />;
|
|
287
|
-
|
|
288
|
-
return (
|
|
289
|
-
<>
|
|
290
|
-
{figmaIconGrids}
|
|
291
|
-
{oldIconGrid}
|
|
292
|
-
</>
|
|
293
|
-
);
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
export const TableView = (args: { search: string }) => {
|
|
297
|
-
const { search } = args;
|
|
298
|
-
|
|
299
|
-
if (search) {
|
|
300
|
-
return (
|
|
301
|
-
<Table>
|
|
302
|
-
<IconTable key="Search" categoryName="Search results" icons={searchIcons(search)} />
|
|
303
|
-
</Table>
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const figmaIconTable = Object.keys(figmaIcons).map((categoryName) => (
|
|
308
|
-
<IconTable key={categoryName} categoryName={categoryName} icons={figmaIcons[categoryName]} />
|
|
309
|
-
));
|
|
310
|
-
const oldIconTable = <IconTable key="Uncategorized" categoryName="Uncategorized" icons={getOldIcons()} />;
|
|
311
|
-
|
|
312
|
-
return (
|
|
313
|
-
<Table>
|
|
314
|
-
{figmaIconTable}
|
|
315
|
-
{oldIconTable}
|
|
316
|
-
</Table>
|
|
317
|
-
);
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
export const Icons = () => {
|
|
321
|
-
const [search, setSearch] = useState('');
|
|
322
|
-
const [layout, setLayout] = useState('grid');
|
|
323
|
-
|
|
324
|
-
const textWrapperStyle = {
|
|
325
|
-
marginBottom: '32',
|
|
326
|
-
maxWidth: '31.25rem',
|
|
327
|
-
};
|
|
328
|
-
return (
|
|
329
|
-
<Unstyled>
|
|
330
|
-
<Provider>
|
|
331
|
-
<Box sx={textWrapperStyle}>
|
|
332
|
-
<Text as="h2" size="8" sx={{ marginBottom: '24' }}>
|
|
333
|
-
Icons
|
|
334
|
-
</Text>
|
|
335
|
-
</Box>
|
|
336
|
-
<Box display="flex" alignItems="top">
|
|
337
|
-
<Box>
|
|
338
|
-
<FilterSwitchGroup value={layout} onChange={setLayout}>
|
|
339
|
-
<FilterSwitch value="grid">
|
|
340
|
-
<Icon name="MenuGrid" size="16" />
|
|
341
|
-
</FilterSwitch>
|
|
342
|
-
<FilterSwitch value="table">
|
|
343
|
-
<Icon name="MenuHamburger" size="16" />
|
|
344
|
-
</FilterSwitch>
|
|
345
|
-
</FilterSwitchGroup>
|
|
346
|
-
</Box>
|
|
347
|
-
<Box width="100%" marginLeft={16}>
|
|
348
|
-
<Input
|
|
349
|
-
leftIconName="Magnifier"
|
|
350
|
-
placeholder="Search icons..."
|
|
351
|
-
value={search}
|
|
352
|
-
inputHeight={38}
|
|
353
|
-
onChange={(event) => setSearch(event.target.value)}
|
|
354
|
-
/>
|
|
355
|
-
</Box>
|
|
356
|
-
</Box>
|
|
357
|
-
<br />
|
|
358
|
-
{layout === 'grid' ? <GridView search={search} /> : null}
|
|
359
|
-
{layout === 'table' ? <TableView search={search} /> : null}
|
|
360
|
-
</Provider>
|
|
361
|
-
</Unstyled>
|
|
362
|
-
);
|
|
363
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import { Unstyled } from '@storybook/blocks';
|
|
3
|
-
import { HStack, VStack } from '@chakra-ui/react';
|
|
4
|
-
import Box from '../../Components/Box/Box';
|
|
5
|
-
import Card from '../../Components/Card/Card';
|
|
6
|
-
import Provider from '../../Components/Provider/Provider';
|
|
7
|
-
import Text from '../../Components/Text/Text';
|
|
8
|
-
|
|
9
|
-
const TOKENS = {
|
|
10
|
-
'brand.primary': 'Primary brand color',
|
|
11
|
-
'text.body': 'Default body text color',
|
|
12
|
-
'text.secondary': 'Secondary text color, for inline help and less important text',
|
|
13
|
-
'text.link': 'Default text link color',
|
|
14
|
-
'text.linkHover': 'Default text link hover color',
|
|
15
|
-
'separator.primary': 'Default color for separator lines',
|
|
16
|
-
} as any;
|
|
17
|
-
|
|
18
|
-
const DesignTokens = () => {
|
|
19
|
-
const textWrapperStyle = {
|
|
20
|
-
marginBottom: '32',
|
|
21
|
-
maxWidth: '31.25rem',
|
|
22
|
-
};
|
|
23
|
-
return (
|
|
24
|
-
<Unstyled>
|
|
25
|
-
<Provider>
|
|
26
|
-
<Box sx={textWrapperStyle}>
|
|
27
|
-
<Text as="h2" size="8" sx={{ marginBottom: '24' }}>
|
|
28
|
-
Design tokens
|
|
29
|
-
</Text>
|
|
30
|
-
<Text>
|
|
31
|
-
Most of our color usage is defined in the Bitkit components themselves, but we also have some additional
|
|
32
|
-
colors that we frequently re-use outside of components too. We have defined these colors as design tokens.
|
|
33
|
-
</Text>
|
|
34
|
-
<Text color="secondary" size="2" sx={{ marginTop: '16' }}>
|
|
35
|
-
Design tokens are implemented as styles, which reference the color styles. They are managed by the Figma
|
|
36
|
-
plugin called “Theemo”.
|
|
37
|
-
</Text>
|
|
38
|
-
</Box>
|
|
39
|
-
<Card boxShadow="medium" marginBottom="96" padding="24">
|
|
40
|
-
<VStack align="flex-start" as="ul" spacing="32">
|
|
41
|
-
{Object.keys(TOKENS).map((token: string) => (
|
|
42
|
-
<HStack as="li" key={token} spacing="32">
|
|
43
|
-
<Box
|
|
44
|
-
sx={{
|
|
45
|
-
backgroundColor: token,
|
|
46
|
-
height: '64',
|
|
47
|
-
width: '10rem',
|
|
48
|
-
}}
|
|
49
|
-
/>
|
|
50
|
-
<VStack align="flex-start">
|
|
51
|
-
<Text fontWeight="bold" size="4">
|
|
52
|
-
{token}
|
|
53
|
-
</Text>
|
|
54
|
-
<Text color="secondary" size="2">
|
|
55
|
-
{TOKENS[token]}
|
|
56
|
-
</Text>
|
|
57
|
-
</VStack>
|
|
58
|
-
</HStack>
|
|
59
|
-
))}
|
|
60
|
-
</VStack>
|
|
61
|
-
</Card>
|
|
62
|
-
</Provider>
|
|
63
|
-
</Unstyled>
|
|
64
|
-
);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default DesignTokens;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { Unstyled } from '@storybook/blocks';
|
|
4
|
-
import { HStack, SystemStyleObject, VStack } from '@chakra-ui/react';
|
|
5
|
-
import Box from '../../Components/Box/Box';
|
|
6
|
-
import Card from '../../Components/Card/Card';
|
|
7
|
-
import Divider from '../../Components/Divider/Divider';
|
|
8
|
-
import Provider from '../../Components/Provider/Provider';
|
|
9
|
-
import Text from '../../Components/Text/Text';
|
|
10
|
-
import colors from './Colors';
|
|
11
|
-
|
|
12
|
-
const paletteKeys = ['neutral', 'purple', 'red', 'orange', 'yellow', 'green', 'turquoise', 'blue'] as Array<
|
|
13
|
-
keyof typeof colors
|
|
14
|
-
>;
|
|
15
|
-
|
|
16
|
-
const getTextColorFromShade = (backgroundColor: string, darkColor = 'text.body', lightColor = 'neutral.100') => {
|
|
17
|
-
const shade = Number(backgroundColor.split('.')[1]);
|
|
18
|
-
return shade < 70 ? lightColor : darkColor;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const Shade = ({ children }: { children: number }) => {
|
|
22
|
-
const style = { paddingRight: '24', width: '6rem', height: '6rem', lineHeight: '6rem' };
|
|
23
|
-
return (
|
|
24
|
-
<Text align="right" sx={style}>
|
|
25
|
-
{children}
|
|
26
|
-
</Text>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
type InfoHeaderProps = { description: string; shades: number[]; style?: any; title: string };
|
|
31
|
-
|
|
32
|
-
const InfoHeader = ({ description, shades, style, title }: InfoHeaderProps) => (
|
|
33
|
-
<HStack
|
|
34
|
-
sx={{
|
|
35
|
-
color: getTextColorFromShade(style.backgroundColor),
|
|
36
|
-
...style,
|
|
37
|
-
}}
|
|
38
|
-
>
|
|
39
|
-
<Box sx={{ paddingLeft: '24' }}>
|
|
40
|
-
<Text fontWeight="bold" size="4" sx={{ marginBottom: '8' }}>
|
|
41
|
-
{title}
|
|
42
|
-
</Text>
|
|
43
|
-
<Text
|
|
44
|
-
size="3"
|
|
45
|
-
sx={{ color: getTextColorFromShade(style.backgroundColor, 'text.secondary'), maxWidth: '11.875rem' }}
|
|
46
|
-
>
|
|
47
|
-
{description}
|
|
48
|
-
</Text>
|
|
49
|
-
</Box>
|
|
50
|
-
<VStack spacing="0">
|
|
51
|
-
{shades.map((s) => (
|
|
52
|
-
<Shade key={s}>{s}</Shade>
|
|
53
|
-
))}
|
|
54
|
-
</VStack>
|
|
55
|
-
</HStack>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
const Item = ({ backgroundColor, children }: { backgroundColor: string; children: ReactNode }) => {
|
|
59
|
-
const style = {
|
|
60
|
-
backgroundColor,
|
|
61
|
-
color: 'transparent',
|
|
62
|
-
padding: '8',
|
|
63
|
-
height: '6rem',
|
|
64
|
-
width: '6rem',
|
|
65
|
-
_hover: { boxShadow: 'large', color: getTextColorFromShade(backgroundColor), transform: 'scale(1.1)' },
|
|
66
|
-
} as SystemStyleObject;
|
|
67
|
-
return (
|
|
68
|
-
<Box sx={style}>
|
|
69
|
-
<Text size="2" textTransform="lowercase">
|
|
70
|
-
{children}
|
|
71
|
-
</Text>
|
|
72
|
-
</Box>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const Palette = () => (
|
|
77
|
-
<Unstyled>
|
|
78
|
-
<Provider>
|
|
79
|
-
<Text as="h2" size="8">
|
|
80
|
-
Full palette
|
|
81
|
-
</Text>
|
|
82
|
-
<Card boxShadow="medium" marginTop="24" padding="24">
|
|
83
|
-
<HStack spacing="0" sx={{ alignItems: 'flex-start', marginBottom: '16' }}>
|
|
84
|
-
<VStack spacing="0">
|
|
85
|
-
<InfoHeader
|
|
86
|
-
description="These colors have sufficient contrast with any dark color."
|
|
87
|
-
shades={[100, 95, 93]}
|
|
88
|
-
style={{ backgroundColor: 'neutral.95', marginTop: '1.75rem' }}
|
|
89
|
-
title="Light colors"
|
|
90
|
-
/>
|
|
91
|
-
<InfoHeader
|
|
92
|
-
description="Avoid using these colors for text. If you do, check if they have a high enough contrast."
|
|
93
|
-
shades={[90, 80, 70, 60, 50]}
|
|
94
|
-
style={{ backgroundColor: 'neutral.100' }}
|
|
95
|
-
title="Decorative colors"
|
|
96
|
-
/>
|
|
97
|
-
<InfoHeader
|
|
98
|
-
description="These colors have sufficient contrast with any light color."
|
|
99
|
-
shades={[40, 30, 20, 10]}
|
|
100
|
-
style={{ backgroundColor: 'neutral.10' }}
|
|
101
|
-
title="Dark colors"
|
|
102
|
-
/>
|
|
103
|
-
</VStack>
|
|
104
|
-
{paletteKeys.map((colorName) => (
|
|
105
|
-
<VStack key={colorName} spacing="0">
|
|
106
|
-
<Text
|
|
107
|
-
as="span"
|
|
108
|
-
size="1"
|
|
109
|
-
sx={{
|
|
110
|
-
color: 'text.primary',
|
|
111
|
-
marginBottom: '12',
|
|
112
|
-
}}
|
|
113
|
-
textTransform="uppercase"
|
|
114
|
-
>
|
|
115
|
-
{colorName}
|
|
116
|
-
</Text>
|
|
117
|
-
<Divider
|
|
118
|
-
size="1"
|
|
119
|
-
sx={{
|
|
120
|
-
borderColor: 'neutral.95',
|
|
121
|
-
}}
|
|
122
|
-
/>
|
|
123
|
-
{Object.keys(colors[colorName])
|
|
124
|
-
.reverse()
|
|
125
|
-
.map((shade) => {
|
|
126
|
-
const backgroundColor = `${colorName}.${shade}`;
|
|
127
|
-
return (
|
|
128
|
-
<Item backgroundColor={backgroundColor} key={backgroundColor}>
|
|
129
|
-
{backgroundColor}
|
|
130
|
-
<br />
|
|
131
|
-
<br />
|
|
132
|
-
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
|
|
133
|
-
{/* @ts-ignore */}
|
|
134
|
-
{colors[colorName][shade]}
|
|
135
|
-
</Item>
|
|
136
|
-
);
|
|
137
|
-
})}
|
|
138
|
-
</VStack>
|
|
139
|
-
))}
|
|
140
|
-
</HStack>
|
|
141
|
-
</Card>
|
|
142
|
-
</Provider>
|
|
143
|
-
</Unstyled>
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
export default Palette;
|