akeneo-design-system 0.1.224 → 0.1.225
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/Field/Field.js +3 -0
- package/lib/components/Field/Field.js.map +1 -1
- package/lib/components/Search/Search.js +1 -1
- package/lib/components/Search/Search.js.map +1 -1
- package/lib/components/Tags/Tags.d.ts +1 -1
- package/lib/components/Tags/Tags.js +8 -27
- package/lib/components/Tags/Tags.js.map +1 -1
- package/lib/illustrations/WarningIllustration.d.ts +4 -0
- package/lib/illustrations/WarningIllustration.js +38 -0
- package/lib/illustrations/WarningIllustration.js.map +1 -0
- package/lib/illustrations/index.d.ts +1 -0
- package/lib/illustrations/index.js +1 -0
- package/lib/illustrations/index.js.map +1 -1
- package/lib/theme/common.d.ts +3 -2
- package/lib/theme/common.js +46 -1
- package/lib/theme/common.js.map +1 -1
- package/lib/theme/connector/index.js +1 -0
- package/lib/theme/connector/index.js.map +1 -1
- package/lib/theme/onboarder/index.js +1 -0
- package/lib/theme/onboarder/index.js.map +1 -1
- package/lib/theme/pim/index.js +1 -0
- package/lib/theme/pim/index.js.map +1 -1
- package/lib/theme/shared-catalogs/index.js +1 -0
- package/lib/theme/shared-catalogs/index.js.map +1 -1
- package/lib/theme/theme.d.ts +48 -2
- package/lib/theme/theme.js +8 -1
- package/lib/theme/theme.js.map +1 -1
- package/package.json +1 -1
- package/src/__image_snapshots__/all-visual-tsx-visual-tests-renders-components-field-block-correctly-1-snap.png +0 -0
- package/src/__image_snapshots__/all-visual-tsx-visual-tests-renders-components-tags-standard-correctly-1-snap.png +0 -0
- package/src/components/Field/Field.stories.mdx +19 -1
- package/src/components/Field/Field.tsx +5 -1
- package/src/components/Field/Field.unit.tsx +12 -1
- package/src/components/Search/Search.tsx +1 -1
- package/src/components/Tags/Tags.stories.mdx +8 -2
- package/src/components/Tags/Tags.tsx +27 -32
- package/src/components/Tags/Tags.unit.tsx +2 -2
- package/src/guidelines/Colors.stories.mdx +30 -0
- package/src/illustrations/WarningIllustration.tsx +12 -0
- package/src/illustrations/index.ts +1 -0
- package/src/theme/common.ts +57 -2
- package/src/theme/connector/index.ts +2 -1
- package/src/theme/onboarder/index.ts +2 -1
- package/src/theme/pim/index.ts +2 -1
- package/src/theme/shared-catalogs/index.ts +2 -1
- package/src/theme/theme.ts +53 -2
- package/static/illustrations/Warning.svg +203 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
import React, {Ref, ReactNode, isValidElement} from 'react';
|
2
2
|
import styled from 'styled-components';
|
3
|
-
import {AkeneoThemedProps, getFontSize} from '../../theme';
|
3
|
+
import {AkeneoThemedProps, getColorAlternative, getFontSize} from '../../theme';
|
4
4
|
|
5
5
|
/**
|
6
6
|
* The colors defined in this file are the alternative ones
|
@@ -8,42 +8,37 @@ import {AkeneoThemedProps, getFontSize} from '../../theme';
|
|
8
8
|
* https://www.notion.so/akeneo/Alternative-colors-0f5283c1b02f4fd4a418f1e20f2efa99
|
9
9
|
* Those colors will most likely only be used with the tags components
|
10
10
|
*/
|
11
|
-
type Tint =
|
11
|
+
type Tint =
|
12
|
+
| 'green'
|
13
|
+
| 'blue'
|
14
|
+
| 'dark_blue'
|
15
|
+
| 'purple'
|
16
|
+
| 'dark_purple'
|
17
|
+
| 'yellow'
|
18
|
+
| 'red'
|
19
|
+
| 'dark_cyan'
|
20
|
+
| 'forest_green'
|
21
|
+
| 'olive_green'
|
22
|
+
| 'hot_pink'
|
23
|
+
| 'coral_red'
|
24
|
+
| 'orange'
|
25
|
+
| 'chocolate';
|
26
|
+
|
27
|
+
// Because tints are in snake_case, and colors code are in camelCase
|
28
|
+
const convertTintToColorCode = (str: string) => {
|
29
|
+
return str.replace(/_([a-z])/g, function (g) {
|
30
|
+
return g[1].toUpperCase();
|
31
|
+
});
|
32
|
+
};
|
33
|
+
|
12
34
|
type TagProps = {
|
13
35
|
tint: Tint;
|
14
36
|
} & React.HTMLAttributes<HTMLLIElement>;
|
15
37
|
const Tag = styled.li<TagProps & AkeneoThemedProps>`
|
16
38
|
border: 1px solid;
|
17
|
-
border-color: ${({tint}) =>
|
18
|
-
|
19
|
-
|
20
|
-
blue: '#4ca8e0',
|
21
|
-
dark_blue: '#5e63b6',
|
22
|
-
purple: '#9452ba',
|
23
|
-
dark_purple: '#52267d',
|
24
|
-
yellow: '#fcce76',
|
25
|
-
red: '#f74b64',
|
26
|
-
}[tint])};
|
27
|
-
color: ${({tint}) =>
|
28
|
-
({
|
29
|
-
green: '#5da8a6',
|
30
|
-
blue: '#3278b7',
|
31
|
-
dark_blue: '#3b438c',
|
32
|
-
purple: '#763e9e',
|
33
|
-
dark_purple: '#36145e',
|
34
|
-
yellow: '#ca8411',
|
35
|
-
red: '#c92343',
|
36
|
-
}[tint])};
|
37
|
-
background-color: ${({tint}) =>
|
38
|
-
({
|
39
|
-
green: '#f5fafa',
|
40
|
-
blue: '#f0f7fc',
|
41
|
-
dark_blue: '#efeff8',
|
42
|
-
purple: '#f3eef9',
|
43
|
-
dark_purple: '#eeeaf2',
|
44
|
-
yellow: '#fefbf2',
|
45
|
-
red: '#fdedf0',
|
46
|
-
}[tint])};
|
39
|
+
border-color: ${({tint}) => getColorAlternative(convertTintToColorCode(tint), 100)};
|
40
|
+
color: ${({tint}) => getColorAlternative(convertTintToColorCode(tint), 120)};
|
41
|
+
background-color: ${({tint}) => getColorAlternative(convertTintToColorCode(tint), 10)};
|
47
42
|
height: 16px;
|
48
43
|
line-height: 16px;
|
49
44
|
padding: 0 6px;
|
@@ -5,11 +5,11 @@ import {render, screen} from '../../storybook/test-util';
|
|
5
5
|
test('it renders its children properly', () => {
|
6
6
|
render(
|
7
7
|
<Tags>
|
8
|
-
<Tag
|
8
|
+
<Tag tint="dark_blue">Dark blue Tag</Tag>
|
9
9
|
</Tags>
|
10
10
|
);
|
11
11
|
|
12
|
-
expect(screen.getByText('
|
12
|
+
expect(screen.getByText('Dark blue Tag')).toBeInTheDocument();
|
13
13
|
});
|
14
14
|
|
15
15
|
test('it fails when there are invalid children', () => {
|
@@ -10,6 +10,7 @@ export const ColorContainer = styled(PreviewContainer)`
|
|
10
10
|
`;
|
11
11
|
|
12
12
|
export const colors = ['green', 'blue', 'yellow', 'red', 'grey', 'purple'];
|
13
|
+
export const colorsAlternative = ['green', 'darkCyan', 'forestGreen', 'oliveGreen', 'blue', 'darkBlue', 'purple', 'darkPurple', 'hotPink', 'red', 'coralRed', 'yellow', 'orange', 'chocolate'];
|
13
14
|
|
14
15
|
# Colors
|
15
16
|
|
@@ -68,3 +69,32 @@ Colors enhance the experience by providing visual clues and drawing attention to
|
|
68
69
|
</div>
|
69
70
|
</Story>
|
70
71
|
</Canvas>
|
72
|
+
|
73
|
+
<Canvas>
|
74
|
+
<Story name="Alternative">
|
75
|
+
<div>
|
76
|
+
<h1>Alternative colors</h1>
|
77
|
+
{colorsAlternative.map(colorName => {
|
78
|
+
return (
|
79
|
+
<div key={colorName}>
|
80
|
+
<Subtitle>{colorName}</Subtitle>
|
81
|
+
<PreviewGrid>
|
82
|
+
{Object.keys(themes[0].colorAlternative)
|
83
|
+
.filter(colorCode => 0 === colorCode.indexOf(colorName))
|
84
|
+
.map(colorCode => {
|
85
|
+
const color = themes[0].colorAlternative[colorCode];
|
86
|
+
return (
|
87
|
+
<PreviewCard key={colorCode}>
|
88
|
+
<ColorContainer color={color} />
|
89
|
+
<LabelContainer>{colorCode}</LabelContainer>
|
90
|
+
<LabelContainer>{color}</LabelContainer>
|
91
|
+
</PreviewCard>
|
92
|
+
);
|
93
|
+
})}
|
94
|
+
</PreviewGrid>
|
95
|
+
</div>
|
96
|
+
);
|
97
|
+
})}
|
98
|
+
</div>
|
99
|
+
</Story>
|
100
|
+
</Canvas>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {IllustrationProps} from './IllustrationProps';
|
3
|
+
import Warning from '../../static/illustrations/Warning.svg';
|
4
|
+
|
5
|
+
const WarningIllustration = ({title, size = 256, ...props}: IllustrationProps) => (
|
6
|
+
<svg width={size} height={size} viewBox="0 0 256 256" {...props}>
|
7
|
+
{title && <title>{title}</title>}
|
8
|
+
<image href={Warning} />
|
9
|
+
</svg>
|
10
|
+
);
|
11
|
+
|
12
|
+
export {WarningIllustration};
|
package/src/theme/common.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import styled, {css, keyframes} from 'styled-components';
|
2
|
-
import {Color, FontFamily, FontSize, getColor, getFontSize, Palette} from './theme';
|
2
|
+
import {Color, ColorAlternative, FontFamily, FontSize, getColor, getFontSize, Palette} from './theme';
|
3
3
|
|
4
4
|
const CommonStyle = css`
|
5
5
|
input,
|
@@ -100,6 +100,51 @@ const color: Color = {
|
|
100
100
|
white: '#ffffff',
|
101
101
|
};
|
102
102
|
|
103
|
+
const colorAlternative: ColorAlternative = {
|
104
|
+
blue10: '#F0F7FC',
|
105
|
+
blue100: '#4CA8E0',
|
106
|
+
blue120: '#3278B7',
|
107
|
+
chocolate10: '#EEE9E5',
|
108
|
+
chocolate100: '#512500',
|
109
|
+
chocolate120: '#441F00',
|
110
|
+
coralRed10: '#FDF0EF',
|
111
|
+
coralRed100: '#ED6A5E',
|
112
|
+
coralRed120: '#B72215',
|
113
|
+
darkBlue10: '#EFEFF8',
|
114
|
+
darkBlue100: '#5e63b6',
|
115
|
+
darkBlue120: '#3B438C',
|
116
|
+
darkCyan10: '#E5F3F3',
|
117
|
+
darkCyan100: '#008B8B',
|
118
|
+
darkCyan120: '#007575',
|
119
|
+
darkPurple10: '#EEEAF2',
|
120
|
+
darkPurple100: '#52267D',
|
121
|
+
darkPurple120: '#36145E',
|
122
|
+
forestGreen10: '#EDF1EB',
|
123
|
+
forestGreen100: '#50723C',
|
124
|
+
forestGreen120: '#436032',
|
125
|
+
green10: '#F5FAFA',
|
126
|
+
green100: '#81CCCC',
|
127
|
+
green120: '#5DA8A6',
|
128
|
+
hotPink10: '#FFF0F7',
|
129
|
+
hotPink100: '#FF69B4',
|
130
|
+
hotPink120: '#CC0066',
|
131
|
+
oliveGreen10: '#F0F4E9',
|
132
|
+
oliveGreen100: '#6B8E23',
|
133
|
+
oliveGreen120: '#5A771D',
|
134
|
+
orange10: '#FFF3E5',
|
135
|
+
orange100: '#FF8600',
|
136
|
+
orange120: '#B25E00',
|
137
|
+
purple10: '#F3EEF9',
|
138
|
+
purple100: '#9452BA',
|
139
|
+
purple120: '#763E9E',
|
140
|
+
red10: '#FDEDF0',
|
141
|
+
red100: '#F74B64',
|
142
|
+
red120: '#C92343',
|
143
|
+
yellow10: '#FEFBF2',
|
144
|
+
yellow100: '#FCCE76',
|
145
|
+
yellow120: '#D69A38',
|
146
|
+
};
|
147
|
+
|
103
148
|
const fontSize: FontSize = {
|
104
149
|
big: '15px',
|
105
150
|
bigger: '17px',
|
@@ -129,4 +174,14 @@ const SkeletonPlaceholder = styled.div`
|
|
129
174
|
${placeholderStyle}
|
130
175
|
`;
|
131
176
|
|
132
|
-
export {
|
177
|
+
export {
|
178
|
+
color,
|
179
|
+
colorAlternative,
|
180
|
+
fontFamily,
|
181
|
+
fontSize,
|
182
|
+
palette,
|
183
|
+
CommonStyle,
|
184
|
+
BrandedPath,
|
185
|
+
SkeletonPlaceholder,
|
186
|
+
placeholderStyle,
|
187
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {Theme} from '../theme';
|
2
|
-
import {color, fontSize, palette, fontFamily} from '../common';
|
2
|
+
import {color, fontSize, palette, fontFamily, colorAlternative} from '../common';
|
3
3
|
|
4
4
|
const connectorTheme: Theme = {
|
5
5
|
name: 'Connector',
|
@@ -13,6 +13,7 @@ const connectorTheme: Theme = {
|
|
13
13
|
brand120: '#3b4494',
|
14
14
|
brand140: '#272d62',
|
15
15
|
},
|
16
|
+
colorAlternative,
|
16
17
|
fontSize,
|
17
18
|
palette,
|
18
19
|
fontFamily,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {Theme} from '../theme';
|
2
|
-
import {color, fontSize, palette, fontFamily} from '../common';
|
2
|
+
import {color, fontSize, palette, fontFamily, colorAlternative} from '../common';
|
3
3
|
|
4
4
|
const onboarderTheme: Theme = {
|
5
5
|
name: 'Onboarder',
|
@@ -13,6 +13,7 @@ const onboarderTheme: Theme = {
|
|
13
13
|
brand120: '#3c86b3',
|
14
14
|
brand140: '#2d6486',
|
15
15
|
},
|
16
|
+
colorAlternative,
|
16
17
|
fontSize,
|
17
18
|
palette,
|
18
19
|
fontFamily,
|
package/src/theme/pim/index.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import {Theme} from '../theme';
|
2
|
-
import {color, fontSize, palette, fontFamily} from '../common';
|
2
|
+
import {color, colorAlternative, fontSize, palette, fontFamily} from '../common';
|
3
3
|
|
4
4
|
const pimTheme: Theme = {
|
5
5
|
name: 'PIM',
|
@@ -13,6 +13,7 @@ const pimTheme: Theme = {
|
|
13
13
|
brand120: '#764194',
|
14
14
|
brand140: '#58316f',
|
15
15
|
},
|
16
|
+
colorAlternative,
|
16
17
|
fontSize,
|
17
18
|
palette,
|
18
19
|
fontFamily,
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import {Theme} from '../theme';
|
2
|
-
import {color, fontSize, palette, fontFamily} from '../common';
|
2
|
+
import {color, fontSize, palette, fontFamily, colorAlternative} from '../common';
|
3
3
|
|
4
4
|
const sharedCatalogsTheme: Theme = {
|
5
5
|
name: 'Shared Catalogs',
|
@@ -13,6 +13,7 @@ const sharedCatalogsTheme: Theme = {
|
|
13
13
|
brand120: '#c79032',
|
14
14
|
brand140: '#956c25',
|
15
15
|
},
|
16
|
+
colorAlternative,
|
16
17
|
fontSize,
|
17
18
|
palette,
|
18
19
|
fontFamily,
|
package/src/theme/theme.ts
CHANGED
@@ -65,6 +65,51 @@ type Color = {
|
|
65
65
|
white: string;
|
66
66
|
};
|
67
67
|
|
68
|
+
type ColorAlternative = {
|
69
|
+
blue10: string;
|
70
|
+
blue100: string;
|
71
|
+
blue120: string;
|
72
|
+
chocolate10: string;
|
73
|
+
chocolate100: string;
|
74
|
+
chocolate120: string;
|
75
|
+
coralRed10: string;
|
76
|
+
coralRed100: string;
|
77
|
+
coralRed120: string;
|
78
|
+
darkBlue10: string;
|
79
|
+
darkBlue100: string;
|
80
|
+
darkBlue120: string;
|
81
|
+
darkCyan10: string;
|
82
|
+
darkCyan100: string;
|
83
|
+
darkCyan120: string;
|
84
|
+
darkPurple10: string;
|
85
|
+
darkPurple100: string;
|
86
|
+
darkPurple120: string;
|
87
|
+
forestGreen10: string;
|
88
|
+
forestGreen100: string;
|
89
|
+
forestGreen120: string;
|
90
|
+
green10: string;
|
91
|
+
green100: string;
|
92
|
+
green120: string;
|
93
|
+
hotPink10: string;
|
94
|
+
hotPink100: string;
|
95
|
+
hotPink120: string;
|
96
|
+
oliveGreen10: string;
|
97
|
+
oliveGreen100: string;
|
98
|
+
oliveGreen120: string;
|
99
|
+
orange10: string;
|
100
|
+
orange100: string;
|
101
|
+
orange120: string;
|
102
|
+
purple10: string;
|
103
|
+
purple100: string;
|
104
|
+
purple120: string;
|
105
|
+
red10: string;
|
106
|
+
red100: string;
|
107
|
+
red120: string;
|
108
|
+
yellow10: string;
|
109
|
+
yellow100: string;
|
110
|
+
yellow120: string;
|
111
|
+
};
|
112
|
+
|
68
113
|
type Palette = {
|
69
114
|
primary: string;
|
70
115
|
secondary: string;
|
@@ -78,6 +123,7 @@ type Theme = {
|
|
78
123
|
palette: Palette;
|
79
124
|
fontSize: FontSize;
|
80
125
|
color: Color;
|
126
|
+
colorAlternative: ColorAlternative;
|
81
127
|
fontFamily: FontFamily;
|
82
128
|
};
|
83
129
|
|
@@ -98,6 +144,11 @@ const getColorForLevel =
|
|
98
144
|
({theme}: AkeneoThemedProps): string =>
|
99
145
|
theme.color[`${theme.palette[level]}${gradient}`] as string;
|
100
146
|
|
147
|
+
const getColorAlternative =
|
148
|
+
(color: string, gradient?: number): ((props: AkeneoThemedProps) => string) =>
|
149
|
+
({theme}: AkeneoThemedProps): string =>
|
150
|
+
theme.colorAlternative[`${color}${gradient ?? ''}`] as string;
|
151
|
+
|
101
152
|
const getFontSize =
|
102
153
|
(fontSize: keyof FontSize): ((props: AkeneoThemedProps) => string) =>
|
103
154
|
({theme}: AkeneoThemedProps): string =>
|
@@ -109,5 +160,5 @@ const getFontFamily =
|
|
109
160
|
theme.fontFamily[fontFamilyType];
|
110
161
|
|
111
162
|
export type AkeneoThemedProps<P = Record<string, unknown>> = ThemedStyledProps<P, Theme>;
|
112
|
-
export type {Theme, FontSize, FontFamily, Color, Level, Palette};
|
113
|
-
export {getColor, getFontFamily, getColorForLevel, getFontSize};
|
163
|
+
export type {Theme, FontSize, FontFamily, Color, ColorAlternative, Level, Palette};
|
164
|
+
export {getColor, getFontFamily, getColorForLevel, getColorAlternative, getFontSize};
|