@cypress-design/icon-registry 0.4.0 → 0.4.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/dist/cjs/compileIcon.js
CHANGED
|
@@ -27,23 +27,31 @@ const compileIcon = (props) => {
|
|
|
27
27
|
return Object.assign(Object.assign({}, props), { size: sizeWithDefault, compiledClasses, body: iconData.data });
|
|
28
28
|
};
|
|
29
29
|
exports.compileIcon = compileIcon;
|
|
30
|
-
const getComponentAttributes = (
|
|
31
|
-
|
|
30
|
+
const getComponentAttributes = (props) => {
|
|
31
|
+
const { size, availableSizes, interactiveColorsOnGroup, name } = props, // not used, just removed from colors
|
|
32
|
+
others = __rest(props, ["size", "availableSizes", "interactiveColorsOnGroup", "name"]);
|
|
32
33
|
const sizeWithDefault = size !== null && size !== void 0 ? size : (availableSizes.length >= 1
|
|
33
34
|
? availableSizes.indexOf('16') > -1
|
|
34
35
|
? '16'
|
|
35
36
|
: availableSizes[0]
|
|
36
37
|
: '');
|
|
38
|
+
const protectedInteractiveColorsOnGroup = interactiveColorsOnGroup === undefined
|
|
39
|
+
? others['interactive-colors-on-group']
|
|
40
|
+
: interactiveColorsOnGroup;
|
|
41
|
+
const colors = others;
|
|
37
42
|
// TODO: when all icons are converted to using the design system,
|
|
38
43
|
// replace dark by stroke and light by fill,
|
|
39
44
|
// both here and in the windi plugins configs.
|
|
40
45
|
const compiledClasses = Object.keys(colors)
|
|
41
46
|
.map((color) => {
|
|
42
|
-
|
|
43
|
-
if (!colorWeight) {
|
|
47
|
+
if (color === 'interactive-colors-on-group') {
|
|
44
48
|
return false;
|
|
45
49
|
}
|
|
46
|
-
const
|
|
50
|
+
const weightedColor = colors[color];
|
|
51
|
+
if (!weightedColor) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
const lowerCaseColor = color.toLowerCase().replace(/-/g, '');
|
|
47
55
|
const colorClass = lowerCaseColor.includes('strokecolor')
|
|
48
56
|
? 'dark'
|
|
49
57
|
: 'light';
|
|
@@ -58,12 +66,12 @@ const getComponentAttributes = (_a) => {
|
|
|
58
66
|
? 'hocus'
|
|
59
67
|
: '';
|
|
60
68
|
const prefix = pseudoClass.length
|
|
61
|
-
?
|
|
62
|
-
|
|
69
|
+
? protectedInteractiveColorsOnGroup !== undefined &&
|
|
70
|
+
protectedInteractiveColorsOnGroup !== false
|
|
63
71
|
? `group-${pseudoClass}:`
|
|
64
72
|
: `icon-${pseudoClass}:`
|
|
65
73
|
: '';
|
|
66
|
-
const finalClass = `${prefix}icon-${colorClass}${secondaryClass}-${
|
|
74
|
+
const finalClass = `${prefix}icon-${colorClass}${secondaryClass}-${weightedColor}`;
|
|
67
75
|
return finalClass;
|
|
68
76
|
})
|
|
69
77
|
.filter((cl) => cl !== false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileIcon.js","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"compileIcon.js","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,mCAKgB;AAChB,2CAAqC;AACrC,yCAAiC;AAE1B,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAE,EAAE;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IACtB,MAAM,EAAE,cAAc,EAAE,GAAG,qBAAa,CAAC,IAAI,CAAC,CAAA;IAE9C,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,IAAA,8BAAsB,kCAC7D,KAAa,KACjB,cAAc,IACd,CAAA;IAEF,MAAM,YAAY,GAAG,IAAA,mBAAS,EAAC,GAAG,IAAI,KAAK,eAAe,EAAE,CAAC,CAAA;IAC7D,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,YAAY,CAAC,CAAA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adata } from './icons';
|
|
12
|
+
import { iconsMetadata, } from './icons';
|
|
13
13
|
import { iconSet } from './iconsList';
|
|
14
14
|
import camelCase from 'camelcase';
|
|
15
15
|
export const compileIcon = (props) => {
|
|
@@ -23,23 +23,31 @@ export const compileIcon = (props) => {
|
|
|
23
23
|
}
|
|
24
24
|
return Object.assign(Object.assign({}, props), { size: sizeWithDefault, compiledClasses, body: iconData.data });
|
|
25
25
|
};
|
|
26
|
-
export const getComponentAttributes = (
|
|
27
|
-
|
|
26
|
+
export const getComponentAttributes = (props) => {
|
|
27
|
+
const { size, availableSizes, interactiveColorsOnGroup, name } = props, // not used, just removed from colors
|
|
28
|
+
others = __rest(props, ["size", "availableSizes", "interactiveColorsOnGroup", "name"]);
|
|
28
29
|
const sizeWithDefault = size !== null && size !== void 0 ? size : (availableSizes.length >= 1
|
|
29
30
|
? availableSizes.indexOf('16') > -1
|
|
30
31
|
? '16'
|
|
31
32
|
: availableSizes[0]
|
|
32
33
|
: '');
|
|
34
|
+
const protectedInteractiveColorsOnGroup = interactiveColorsOnGroup === undefined
|
|
35
|
+
? others['interactive-colors-on-group']
|
|
36
|
+
: interactiveColorsOnGroup;
|
|
37
|
+
const colors = others;
|
|
33
38
|
// TODO: when all icons are converted to using the design system,
|
|
34
39
|
// replace dark by stroke and light by fill,
|
|
35
40
|
// both here and in the windi plugins configs.
|
|
36
41
|
const compiledClasses = Object.keys(colors)
|
|
37
42
|
.map((color) => {
|
|
38
|
-
|
|
39
|
-
if (!colorWeight) {
|
|
43
|
+
if (color === 'interactive-colors-on-group') {
|
|
40
44
|
return false;
|
|
41
45
|
}
|
|
42
|
-
const
|
|
46
|
+
const weightedColor = colors[color];
|
|
47
|
+
if (!weightedColor) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const lowerCaseColor = color.toLowerCase().replace(/-/g, '');
|
|
43
51
|
const colorClass = lowerCaseColor.includes('strokecolor')
|
|
44
52
|
? 'dark'
|
|
45
53
|
: 'light';
|
|
@@ -54,12 +62,12 @@ export const getComponentAttributes = (_a) => {
|
|
|
54
62
|
? 'hocus'
|
|
55
63
|
: '';
|
|
56
64
|
const prefix = pseudoClass.length
|
|
57
|
-
?
|
|
58
|
-
|
|
65
|
+
? protectedInteractiveColorsOnGroup !== undefined &&
|
|
66
|
+
protectedInteractiveColorsOnGroup !== false
|
|
59
67
|
? `group-${pseudoClass}:`
|
|
60
68
|
: `icon-${pseudoClass}:`
|
|
61
69
|
: '';
|
|
62
|
-
const finalClass = `${prefix}icon-${colorClass}${secondaryClass}-${
|
|
70
|
+
const finalClass = `${prefix}icon-${colorClass}${secondaryClass}-${weightedColor}`;
|
|
63
71
|
return finalClass;
|
|
64
72
|
})
|
|
65
73
|
.filter((cl) => cl !== false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileIcon.js","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compileIcon.js","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAGL,aAAa,GAEd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,OAAO,SAAS,MAAM,WAAW,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAgB,EAAE,EAAE;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IACtB,MAAM,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;IAE9C,MAAM,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,sBAAsB,iCAC7D,KAAa,KACjB,cAAc,IACd,CAAA;IAEF,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,IAAI,KAAK,eAAe,EAAE,CAAC,CAAA;IAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CA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AA;SACb;QACD,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAC5D,MAAM,UAAU,GAAG,cAAc,CAAC,QAAQ,CAAC,aAAa,CAAC;YACvD,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,OAAO,CAAA;QACX,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC;YACzD,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,EAAE,CAAA;QAEN,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC;YAClD,CAAC,CAAC,OAAO;YACT,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAClC,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,OAAO,CAAC;oBAClC,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC,EAAE,CAAA;QAEN,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM;YAC/B,CAAC,CAAC,iCAAiC,KAAK,SAAS;gBAC/C,iCAAiC,KAAK,KAAK;gBAC3C,CAAC,CAAC,SAAS,WAAW,GAAG;gBACzB,CAAC,CAAC,QAAQ,WAAW,GAAG;YAC1B,CAAC,CAAC,EAAE,CAAA;QAEN,MAAM,UAAU,GAAG,GAAG,MAAM,QAAQ,UAAU,GAAG,cAAc,IAAI,aAAa,EAAE,CAAA;QAElF,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC;SACD,MAAM,CAAC,CAAC,EAAE,EAAgB,EAAE,CAAC,EAAE,KAAK,KAAK,CAAC,CAAA;IAE7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,CAAA;AAC7C,CAAC,CAAA"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type IconProps, type OpenIconProps } from './icons';
|
|
2
2
|
export declare const compileIcon: (props: IconProps) => any;
|
|
3
|
-
export declare const getComponentAttributes: (
|
|
4
|
-
size: string;
|
|
3
|
+
export declare const getComponentAttributes: (props: {
|
|
5
4
|
availableSizes: readonly string[];
|
|
6
|
-
interactiveColorsOnGroup?: boolean;
|
|
7
5
|
} & OpenIconProps) => {
|
|
8
6
|
compiledClasses: string[];
|
|
9
7
|
sizeWithDefault: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileIcon.d.ts","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"compileIcon.d.ts","sourceRoot":"","sources":["../../src/compileIcon.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAA;AAIhB,eAAO,MAAM,WAAW,UAAW,SAAS,QAoB3C,CAAA;AAED,eAAO,MAAM,sBAAsB,UAC1B;IACL,cAAc,EAAE,SAAS,MAAM,EAAE,CAAA;CAClC,GAAG,aAAa;;;CAkElB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cypress-design/icon-registry",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "All svg files to be exposed to the Icon component",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"camelcase": "^6.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@cypress-design/css": "^0.5.
|
|
28
|
+
"@cypress-design/css": "^0.5.1",
|
|
29
29
|
"dedent": "^0.7.0",
|
|
30
30
|
"globby": "^13.1.1",
|
|
31
31
|
"svg-to-ts": "^8.6.1"
|