@common-origin/design-system 3.2.0 → 3.3.0
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/client.js +34 -10
- package/dist/client.js.map +1 -1
- package/dist/components/atoms/Icon/Icon.d.mts +1 -1
- package/dist/components/atoms/Icon/Icon.d.ts +1 -1
- package/dist/components/atoms/Icon/Icon.mjs +35 -10
- package/dist/data.js +2460 -7
- package/dist/data.js.map +1 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lib/statusShapes.mjs +1 -1
- package/dist/lib/statusShapes.mjs.map +1 -1
- package/dist/styles/iconSet.json.mjs +2442 -0
- package/dist/styles/iconSet.json.mjs.map +1 -0
- package/dist/types/iconSet.d.mts +6 -0
- package/dist/types/iconSet.d.ts +6 -0
- package/dist/types/iconSet.mjs +12 -0
- package/dist/types/iconSet.mjs.map +1 -0
- package/dist/types/icons.d.mts +58 -6
- package/dist/types/icons.d.ts +58 -6
- package/dist/types/icons.mjs +5 -0
- package/dist/types/icons.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +5 -3
|
@@ -8,7 +8,7 @@ export interface IconProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Makes the icon meaningful: it's announced as an image with this name. Without `aria-label`
|
|
10
10
|
* or `title`, the icon is decorative and hidden from assistive technology (#85). Use a
|
|
11
|
-
* human-readable name, never the internal icon name;
|
|
11
|
+
* human-readable name, never the internal icon name; the icon's `ariaLabelDefault` in `iconSet` is a
|
|
12
12
|
* starting point.
|
|
13
13
|
*/
|
|
14
14
|
'aria-label'?: string;
|
|
@@ -8,7 +8,7 @@ export interface IconProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* Makes the icon meaningful: it's announced as an image with this name. Without `aria-label`
|
|
10
10
|
* or `title`, the icon is decorative and hidden from assistive technology (#85). Use a
|
|
11
|
-
* human-readable name, never the internal icon name;
|
|
11
|
+
* human-readable name, never the internal icon name; the icon's `ariaLabelDefault` in `iconSet` is a
|
|
12
12
|
* starting point.
|
|
13
13
|
*/
|
|
14
14
|
'aria-label'?: string;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { __makeTemplateObject, __assign } from '../../../vendor/tslib/tslib.es6.mjs';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import React from 'react';
|
|
4
5
|
import styled$module from 'styled-components';
|
|
5
6
|
const styled = styled$module.default || styled$module;
|
|
6
7
|
import tokens from '../../../lib/cssTokens.mjs';
|
|
7
|
-
import
|
|
8
|
+
import { iconSet } from '../../../types/iconSet.mjs';
|
|
8
9
|
|
|
9
10
|
var IconStyled = /*#__PURE__*/styled.span.withConfig({
|
|
10
11
|
shouldForwardProp: function shouldForwardProp(prop) {
|
|
@@ -12,7 +13,10 @@ var IconStyled = /*#__PURE__*/styled.span.withConfig({
|
|
|
12
13
|
},
|
|
13
14
|
displayName: "Icon__IconStyled",
|
|
14
15
|
componentId: "sc-1105czq-0"
|
|
15
|
-
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n \n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n \n /* Use semantic icon colors */\n color: ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n \n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n \n /* Use semantic icon colors */\n color: ", ";\n"
|
|
16
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n \n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n \n /* Use semantic icon colors */\n color: ", ";\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: ", ";\n height: ", ";\n \n svg {\n width: 100%;\n height: 100%;\n display: block;\n }\n \n /* Use semantic icon colors */\n color: ", ";\n"
|
|
17
|
+
// How each paint draws, in currentColor. Lines are 2px on the 24px grid, so they scale with the
|
|
18
|
+
// icon (decision 0058).
|
|
19
|
+
])), function (_a) {
|
|
16
20
|
var $size = _a.$size;
|
|
17
21
|
return tokens.semantic.size.icon[$size];
|
|
18
22
|
}, function (_a) {
|
|
@@ -45,6 +49,25 @@ var IconStyled = /*#__PURE__*/styled.span.withConfig({
|
|
|
45
49
|
return tokens.semantic.color.icon["default"];
|
|
46
50
|
}
|
|
47
51
|
});
|
|
52
|
+
// How each paint draws, in currentColor. Lines are 2px on the 24px grid, so they scale with the
|
|
53
|
+
// icon (decision 0058).
|
|
54
|
+
var LINE = {
|
|
55
|
+
stroke: 'currentColor',
|
|
56
|
+
strokeWidth: 2,
|
|
57
|
+
strokeLinecap: 'round',
|
|
58
|
+
strokeLinejoin: 'round'
|
|
59
|
+
};
|
|
60
|
+
var PAINT = {
|
|
61
|
+
stroke: __assign({
|
|
62
|
+
fill: 'none'
|
|
63
|
+
}, LINE),
|
|
64
|
+
fill: {
|
|
65
|
+
fill: 'currentColor'
|
|
66
|
+
},
|
|
67
|
+
both: __assign({
|
|
68
|
+
fill: 'currentColor'
|
|
69
|
+
}, LINE)
|
|
70
|
+
};
|
|
48
71
|
var Icon = function Icon(_a) {
|
|
49
72
|
var name = _a.name,
|
|
50
73
|
_b = _a.size,
|
|
@@ -56,10 +79,9 @@ var Icon = function Icon(_a) {
|
|
|
56
79
|
dataTestId = _a["data-testid"];
|
|
57
80
|
// Decorative unless it's given a name. A blank name is no name, so the icon stays hidden
|
|
58
81
|
var label = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) || (title === null || title === void 0 ? void 0 : title.trim()) || undefined;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
console.warn("Icon \"".concat(name, "\" not found in icons.json"));
|
|
82
|
+
var icon = iconSet[name];
|
|
83
|
+
if (!icon) {
|
|
84
|
+
console.warn("Icon \"".concat(name, "\" not found in iconSet"));
|
|
63
85
|
return jsx(IconStyled, {
|
|
64
86
|
"$size": size,
|
|
65
87
|
"$iconColor": iconColor,
|
|
@@ -72,9 +94,8 @@ var Icon = function Icon(_a) {
|
|
|
72
94
|
"data-testid": dataTestId,
|
|
73
95
|
children: jsxs("svg", __assign({
|
|
74
96
|
viewBox: "0 0 24 24",
|
|
75
|
-
fill: "currentColor",
|
|
76
97
|
xmlns: "http://www.w3.org/2000/svg"
|
|
77
|
-
}, label ? {
|
|
98
|
+
}, PAINT[icon.paint], label ? {
|
|
78
99
|
role: 'img',
|
|
79
100
|
'aria-label': label
|
|
80
101
|
} : {
|
|
@@ -83,8 +104,12 @@ var Icon = function Icon(_a) {
|
|
|
83
104
|
}, {
|
|
84
105
|
children: [(title === null || title === void 0 ? void 0 : title.trim()) && jsx("title", {
|
|
85
106
|
children: title
|
|
86
|
-
}),
|
|
87
|
-
|
|
107
|
+
}), icon.elements.map(function (_a, index) {
|
|
108
|
+
var tag = _a[0],
|
|
109
|
+
attributes = _a[1];
|
|
110
|
+
return /*#__PURE__*/React.createElement(tag, __assign({
|
|
111
|
+
key: index
|
|
112
|
+
}, attributes));
|
|
88
113
|
})]
|
|
89
114
|
}))
|
|
90
115
|
});
|