@ultraviolet/icons 2.6.0 → 2.7.1
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 +0 -1
- package/dist/components/CategoryIcon/index.js +13 -22
- package/dist/components/Icon/index.js +25 -25
- package/dist/components/ProductIcon/index.js +31 -52
- package/dist/index.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -4,31 +4,22 @@ import { jsx } from '@emotion/react/jsx-runtime';
|
|
|
4
4
|
|
|
5
5
|
const StyledIcon = /*#__PURE__*/_styled("svg", {
|
|
6
6
|
target: "e1wwql4e0"
|
|
7
|
-
})(".fill{fill:",
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, ";}.fillStrong{fill:", _ref2 => {
|
|
13
|
-
let {
|
|
14
|
-
theme
|
|
15
|
-
} = _ref2;
|
|
16
|
-
return theme.colors.other.icon.category.primary.fillStrong;
|
|
17
|
-
}, ";}");
|
|
7
|
+
})(".fill{fill:", ({
|
|
8
|
+
theme
|
|
9
|
+
}) => theme.colors.other.icon.category.primary.fill, ";}.fillStrong{fill:", ({
|
|
10
|
+
theme
|
|
11
|
+
}) => theme.colors.other.icon.category.primary.fillStrong, ";}");
|
|
18
12
|
/**
|
|
19
13
|
* CategoryIcon component is used to render category icons, those icons are more complex than system icons
|
|
20
14
|
* as they involve multiple colors that changes depending on theme.
|
|
21
15
|
*/
|
|
22
|
-
const CategoryIcon =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
children: CATEGORY_ICONS[name]
|
|
31
|
-
});
|
|
32
|
-
};
|
|
16
|
+
const CategoryIcon = ({
|
|
17
|
+
name
|
|
18
|
+
}) => jsx(StyledIcon, {
|
|
19
|
+
width: "20",
|
|
20
|
+
height: "20",
|
|
21
|
+
viewBox: "0 0 20 20",
|
|
22
|
+
children: CATEGORY_ICONS[name]
|
|
23
|
+
});
|
|
33
24
|
|
|
34
25
|
export { CategoryIcon };
|
|
@@ -5,6 +5,9 @@ import capitalize from '../../utils/capitalize.js';
|
|
|
5
5
|
import { jsx, jsxs, Fragment } from '@emotion/react/jsx-runtime';
|
|
6
6
|
|
|
7
7
|
const ICONS = {
|
|
8
|
+
address: () => jsx("path", {
|
|
9
|
+
d: "M7.66667 4C8.10869 4 8.53262 4.17559 8.84518 4.48816C9.15774 4.80072 9.33333 5.22464 9.33333 5.66667C9.33333 5.88554 9.29022 6.10226 9.20647 6.30447C9.12271 6.50668 8.99994 6.69041 8.84518 6.84518C8.69041 6.99994 8.50668 7.12271 8.30447 7.20647C8.10226 7.29022 7.88554 7.33333 7.66667 7.33333C7.22464 7.33333 6.80072 7.15774 6.48816 6.84518C6.17559 6.53262 6 6.10869 6 5.66667C6 5.22464 6.17559 4.80072 6.48816 4.48816C6.80072 4.17559 7.22464 4 7.66667 4ZM7.66667 1C8.90434 1 10.0913 1.49167 10.9665 2.36683C11.8417 3.242 12.3333 4.42899 12.3333 5.66667C12.3333 9.16667 7.66667 14.3333 7.66667 14.3333C7.66667 14.3333 3 9.16667 3 5.66667C3 4.42899 3.49167 3.242 4.36683 2.36683C5.242 1.49167 6.42899 1 7.66667 1ZM7.66667 2.33333C6.78261 2.33333 5.93477 2.68452 5.30964 3.30964C4.68452 3.93477 4.33333 4.78261 4.33333 5.66667C4.33333 6.33333 4.33333 7.66667 7.66667 12.14C11 7.66667 11 6.33333 11 5.66667C11 4.78261 10.6488 3.93477 10.0237 3.30964C9.39857 2.68452 8.55072 2.33333 7.66667 2.33333Z"
|
|
10
|
+
}),
|
|
8
11
|
alert: () => jsx("path", {
|
|
9
12
|
d: "M11 15H13V17H11V15ZM11 7H13V13H11V7ZM12 2C6.47 2 2 6.5 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C5.85752 19.9997 6.95991 20.7362 8.17317 21.2388C9.38642 21.7413 10.6868 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 10.6868 21.7413 9.38642 21.2388 8.17317C20.7362 6.95991 19.9997 5.85752 19.0711 4.92893C18.1425 4.00035 17.0401 3.26375 15.8268 2.7612C14.6136 2.25866 13.3132 2 12 2ZM12 20C9.87827 20 7.84344 19.1571 6.34315 17.6569C4.84285 16.1566 4 14.1217 4 12C4 9.87827 4.84285 7.84344 6.34315 6.34315C7.84344 4.84285 9.87827 4 12 4C14.1217 4 16.1566 4.84285 17.6569 6.34315C19.1571 7.84344 20 9.87827 20 12C20 14.1217 19.1571 16.1566 17.6569 17.6569C16.1566 19.1571 14.1217 20 12 20Z"
|
|
10
13
|
}),
|
|
@@ -319,7 +322,7 @@ const ICONS = {
|
|
|
319
322
|
})
|
|
320
323
|
};
|
|
321
324
|
const customViewBoxes = [{
|
|
322
|
-
icons: ['arrow-left-double', 'arrow-right-double', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'credentials', 'logout', 'organization', 'privacy', 'profile', 'support', 'switch_orga', 'credit-card', 'progress-check', 'id', 'reboot'],
|
|
325
|
+
icons: ['address', 'arrow-left-double', 'arrow-right-double', 'arrow-left', 'arrow-right', 'arrow-down', 'arrow-up', 'credentials', 'logout', 'organization', 'privacy', 'profile', 'support', 'switch_orga', 'credit-card', 'progress-check', 'id', 'reboot'],
|
|
323
326
|
viewBox: '0 0 16 16'
|
|
324
327
|
}, {
|
|
325
328
|
icons: ['members'],
|
|
@@ -331,10 +334,9 @@ const customViewBoxes = [{
|
|
|
331
334
|
icons: ['expand'],
|
|
332
335
|
viewBox: '0 0 20 14'
|
|
333
336
|
}];
|
|
334
|
-
const sizeStyles =
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
} = _ref;
|
|
337
|
+
const sizeStyles = ({
|
|
338
|
+
size
|
|
339
|
+
}) => {
|
|
338
340
|
const pxSize = typeof size === 'number' && !Number.isNaN(size) ? `${size}px` : size;
|
|
339
341
|
return /*#__PURE__*/css("height:", pxSize, ";width:", pxSize, ";min-width:", pxSize, ";min-height:", pxSize, ";");
|
|
340
342
|
};
|
|
@@ -347,13 +349,12 @@ const PROMINENCES = {
|
|
|
347
349
|
const StyledIcon = /*#__PURE__*/_styled('svg', {
|
|
348
350
|
shouldForwardProp: prop => !['size', 'color', 'prominence', 'disabled'].includes(prop),
|
|
349
351
|
target: "e1gt4cfo0"
|
|
350
|
-
})("vertical-align:middle;fill:",
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
} = _ref2;
|
|
352
|
+
})("vertical-align:middle;fill:", ({
|
|
353
|
+
theme,
|
|
354
|
+
color,
|
|
355
|
+
prominence,
|
|
356
|
+
disabled
|
|
357
|
+
}) => {
|
|
357
358
|
// stronger is available only for neutral color
|
|
358
359
|
const definedProminence = color !== 'neutral' && prominence === 'stronger' ? capitalize(PROMINENCES.default) : capitalize(PROMINENCES[prominence]);
|
|
359
360
|
theme.colors[color];
|
|
@@ -363,19 +364,18 @@ const StyledIcon = /*#__PURE__*/_styled('svg', {
|
|
|
363
364
|
/**
|
|
364
365
|
* Icon component is our set of system icons in the design system. All of them are SVGs.
|
|
365
366
|
*/
|
|
366
|
-
const Icon = /*#__PURE__*/forwardRef((
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
} = _ref3;
|
|
367
|
+
const Icon = /*#__PURE__*/forwardRef(({
|
|
368
|
+
name = 'alert',
|
|
369
|
+
color = 'currentColor',
|
|
370
|
+
size = '1em',
|
|
371
|
+
prominence = 'default',
|
|
372
|
+
className,
|
|
373
|
+
'data-testid': dataTestId,
|
|
374
|
+
stroke,
|
|
375
|
+
cursor,
|
|
376
|
+
strokeWidth,
|
|
377
|
+
disabled
|
|
378
|
+
}, ref) => {
|
|
379
379
|
const render = ICONS[name] || ICONS.alert;
|
|
380
380
|
const defaultViewBox = useMemo(() => customViewBoxes.find(vB => vB.icons.includes(name))?.viewBox ?? '0 0 24 24', [name]);
|
|
381
381
|
return jsx(StyledIcon, {
|
|
@@ -11,62 +11,41 @@ const SIZES = {
|
|
|
11
11
|
const StyledIcon = /*#__PURE__*/_styled('svg', {
|
|
12
12
|
shouldForwardProp: prop => !['variant', 'disabled'].includes(prop),
|
|
13
13
|
target: "euby9wl0"
|
|
14
|
-
})("&{width:",
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
disabled
|
|
34
|
-
} = _ref4;
|
|
35
|
-
return `${theme.colors.other.icon.product[variant][disabled ? 'fillDisabled' : 'fill']}`;
|
|
36
|
-
}, ";}path[fill].fillStrong,g[fill].fillStrong>*,g.fillStrong>*{fill:", _ref5 => {
|
|
37
|
-
let {
|
|
38
|
-
theme,
|
|
39
|
-
variant,
|
|
40
|
-
disabled
|
|
41
|
-
} = _ref5;
|
|
42
|
-
return `${theme.colors.other.icon.product[variant][disabled ? 'fillStrongDisabled' : 'fillStrong']}`;
|
|
43
|
-
}, ";}path[fill].fillWeak,g[fill].fillWeak>*,g.fillWeak>*{fill:", _ref6 => {
|
|
44
|
-
let {
|
|
45
|
-
theme,
|
|
46
|
-
variant,
|
|
47
|
-
disabled
|
|
48
|
-
} = _ref6;
|
|
49
|
-
return `${theme.colors.other.icon.product[variant][disabled ? 'fillWeakDisabled' : 'fillWeak']}`;
|
|
50
|
-
}, ";}");
|
|
14
|
+
})("&{width:", ({
|
|
15
|
+
size
|
|
16
|
+
}) => `${SIZES[size]}px`, ";min-width:", ({
|
|
17
|
+
size
|
|
18
|
+
}) => `${SIZES[size]}px`, ";height:", ({
|
|
19
|
+
size
|
|
20
|
+
}) => `${SIZES[size]}px`, ";}path[fill].fill,g[fill].fill>*,g.fill>*{fill:", ({
|
|
21
|
+
theme,
|
|
22
|
+
variant,
|
|
23
|
+
disabled
|
|
24
|
+
}) => `${theme.colors.other.icon.product[variant][disabled ? 'fillDisabled' : 'fill']}`, ";}path[fill].fillStrong,g[fill].fillStrong>*,g.fillStrong>*{fill:", ({
|
|
25
|
+
theme,
|
|
26
|
+
variant,
|
|
27
|
+
disabled
|
|
28
|
+
}) => `${theme.colors.other.icon.product[variant][disabled ? 'fillStrongDisabled' : 'fillStrong']}`, ";}path[fill].fillWeak,g[fill].fillWeak>*,g.fillWeak>*{fill:", ({
|
|
29
|
+
theme,
|
|
30
|
+
variant,
|
|
31
|
+
disabled
|
|
32
|
+
}) => `${theme.colors.other.icon.product[variant][disabled ? 'fillWeakDisabled' : 'fillWeak']}`, ";}");
|
|
51
33
|
|
|
52
34
|
/**
|
|
53
35
|
* ProductIcon component is used to render a set of icons that are linked to a product or service.
|
|
54
36
|
* Those icons are made of multiple colors that changes automatically based on the current theme.
|
|
55
37
|
*/
|
|
56
|
-
const ProductIcon =
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
children: PRODUCT_ICONS[name]
|
|
69
|
-
});
|
|
70
|
-
};
|
|
38
|
+
const ProductIcon = ({
|
|
39
|
+
name,
|
|
40
|
+
variant = 'primary',
|
|
41
|
+
disabled,
|
|
42
|
+
size = 'small'
|
|
43
|
+
}) => jsx(StyledIcon, {
|
|
44
|
+
variant: variant,
|
|
45
|
+
disabled: disabled,
|
|
46
|
+
size: size,
|
|
47
|
+
viewBox: "0 0 64 64",
|
|
48
|
+
children: PRODUCT_ICONS[name]
|
|
49
|
+
});
|
|
71
50
|
|
|
72
51
|
export { ProductIcon };
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ type Color = Extract<keyof typeof consoleLightTheme.colors, 'primary' | 'seconda
|
|
|
9
9
|
*/
|
|
10
10
|
declare const Icon: react.ForwardRefExoticComponent<{
|
|
11
11
|
size?: string | number | undefined;
|
|
12
|
-
name?: "alert" | "anchor" | "arrow-down" | "arrow-left" | "arrow-left-double" | "arrow-right" | "arrow-right-bottom" | "arrow-right-double" | "arrow-up" | "asterisk" | "auto-fix" | "bullhorn" | "burger" | "book-open-outline" | "calculator" | "calendar-range" | "cancel" | "id" | "check" | "checkbox-circle-outline" | "clock-outline" | "close" | "close-circle-outline" | "copy-content" | "credentials" | "credit-card" | "database" | "delete" | "detach" | "doc" | "dots-horizontal" | "dots-vertical" | "download" | "drag-variant" | "drag-vertical" | "east" | "email-outline" | "expand" | "eye" | "eye-off" | "filter" | "github" | "help-circle-outline" | "information-outline" | "lock" | "logout" | "members" | "minus" | "moon" | "open-in-new" | "organization" | "pencil" | "play-circle-outline" | "plus" | "privacy" | "profile" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rocket" | "search" | "send" | "settings" | "sort" | "sun" | "support" | "switch_orga" | "unlock" | "upload" | "view" | "weather-night" | "attach" | "phone" | "earth" | "email-remove-outline" | "expand-more" | "console" | "equal" | "youtube" | "x" | "slack" | "rss" | "linkedIn" | "instagram" | undefined;
|
|
12
|
+
name?: "address" | "alert" | "anchor" | "arrow-down" | "arrow-left" | "arrow-left-double" | "arrow-right" | "arrow-right-bottom" | "arrow-right-double" | "arrow-up" | "asterisk" | "auto-fix" | "bullhorn" | "burger" | "book-open-outline" | "calculator" | "calendar-range" | "cancel" | "id" | "check" | "checkbox-circle-outline" | "clock-outline" | "close" | "close-circle-outline" | "copy-content" | "credentials" | "credit-card" | "database" | "delete" | "detach" | "doc" | "dots-horizontal" | "dots-vertical" | "download" | "drag-variant" | "drag-vertical" | "east" | "email-outline" | "expand" | "eye" | "eye-off" | "filter" | "github" | "help-circle-outline" | "information-outline" | "lock" | "logout" | "members" | "minus" | "moon" | "open-in-new" | "organization" | "pencil" | "play-circle-outline" | "plus" | "privacy" | "profile" | "progress-check" | "ray-end-arrow" | "ray-start-arrow" | "ray-start-end" | "ray-top-arrow" | "reboot" | "restore" | "revoke" | "rocket" | "search" | "send" | "settings" | "sort" | "sun" | "support" | "switch_orga" | "unlock" | "upload" | "view" | "weather-night" | "attach" | "phone" | "earth" | "email-remove-outline" | "expand-more" | "console" | "equal" | "youtube" | "x" | "slack" | "rss" | "linkedIn" | "instagram" | undefined;
|
|
13
13
|
prominence?: "strong" | "stronger" | "weak" | "default" | undefined;
|
|
14
14
|
color?: Color | undefined;
|
|
15
15
|
'data-testid'?: string | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultraviolet/icons",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "Ultraviolet Icons",
|
|
5
5
|
"homepage": "https://github.com/scaleway/ultraviolet#readme",
|
|
6
6
|
"repository": {
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"react-dom": "18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@babel/core": "7.23.
|
|
41
|
+
"@babel/core": "7.23.6",
|
|
42
42
|
"@emotion/babel-plugin": "11.11.0",
|
|
43
|
-
"@types/react": "18.2.
|
|
44
|
-
"@types/react-dom": "18.2.
|
|
43
|
+
"@types/react": "18.2.43",
|
|
44
|
+
"@types/react-dom": "18.2.17"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@ultraviolet/themes": "1.5.0"
|