@patternfly/react-icons 5.0.0-alpha.2 → 5.0.0-alpha.20
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/CHANGELOG.md +90 -0
- package/dist/esm/createIcon.d.ts +2 -11
- package/dist/esm/createIcon.d.ts.map +1 -1
- package/dist/esm/createIcon.js +3 -31
- package/dist/esm/createIcon.js.map +1 -1
- package/dist/esm/icons/index.d.ts +1 -0
- package/dist/esm/icons/index.js +1 -0
- package/dist/esm/icons/multicluster-icon.d.ts +12 -0
- package/dist/esm/icons/multicluster-icon.js +14 -0
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/js/createIcon.d.ts +2 -11
- package/dist/js/createIcon.d.ts.map +1 -1
- package/dist/js/createIcon.js +4 -33
- package/dist/js/createIcon.js.map +1 -1
- package/dist/js/icons/index.d.ts +1 -0
- package/dist/js/icons/index.js +1 -0
- package/dist/js/icons/multicluster-icon.d.ts +12 -0
- package/dist/js/icons/multicluster-icon.js +12 -0
- package/dist/js/index.d.ts +0 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +0 -3
- package/dist/js/index.js.map +1 -1
- package/package.json +8 -8
- package/scripts/generateIcons.mjs +14 -0
- package/scripts/icons/{patternflyIcons.js → patternflyIcons.mjs} +3 -2
- package/scripts/{writeIcons.js → writeIcons.mjs} +6 -3
- package/src/__tests__/createIcon.test.tsx +2 -10
- package/src/createIcon.tsx +6 -39
- package/src/index.ts +0 -1
- package/scripts/generateIcons.js +0 -18
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,96 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 5.0.0-alpha.20 (2023-05-31)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
9
|
+
|
|
10
|
+
# 5.0.0-alpha.19 (2023-05-19)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
13
|
+
|
|
14
|
+
# 5.0.0-alpha.18 (2023-05-18)
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
- **Flex:** add plain gap spacing ([#9143](https://github.com/patternfly/patternfly-react/issues/9143)) ([eceb265](https://github.com/patternfly/patternfly-react/commit/eceb265a5318d4c533a4c54484311bbd9810aa7d))
|
|
19
|
+
|
|
20
|
+
# 5.0.0-alpha.17 (2023-05-18)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- **Table:** added class names for table elements ([#9133](https://github.com/patternfly/patternfly-react/issues/9133)) ([51d6d2b](https://github.com/patternfly/patternfly-react/commit/51d6d2b1a92af7bbfb0075361b375a4d881e110b))
|
|
25
|
+
|
|
26
|
+
# 5.0.0-alpha.16 (2023-05-18)
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- **FormControls:** updated logic for rendering icons ([#9132](https://github.com/patternfly/patternfly-react/issues/9132)) ([9f4863f](https://github.com/patternfly/patternfly-react/commit/9f4863f3251e365142c44aace2c1aeba57ba6b3a))
|
|
31
|
+
|
|
32
|
+
# 5.0.0-alpha.15 (2023-05-16)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
35
|
+
|
|
36
|
+
# [5.0.0-alpha.14](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-icons@5.0.0-alpha.13...@patternfly/react-icons@5.0.0-alpha.14) (2023-05-05)
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
- **deps:** updated Core for v5 versioning ([#9075](https://github.com/patternfly/patternfly-react/issues/9075)) ([3879fc7](https://github.com/patternfly/patternfly-react/commit/3879fc757aefeed80b0694365aa20d5ca856a797))
|
|
41
|
+
|
|
42
|
+
# 5.0.0-alpha.13 (2023-05-05)
|
|
43
|
+
|
|
44
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
45
|
+
|
|
46
|
+
# 5.0.0-alpha.12 (2023-04-27)
|
|
47
|
+
|
|
48
|
+
### Bug Fixes
|
|
49
|
+
|
|
50
|
+
- **createIcon:** Spread className to svg to fix broken images ([#8954](https://github.com/patternfly/patternfly-react/issues/8954)) ([8073115](https://github.com/patternfly/patternfly-react/commit/80731151f6d91299330f580262cb7e0d2ee670b8))
|
|
51
|
+
|
|
52
|
+
# 5.0.0-alpha.11 (2023-04-25)
|
|
53
|
+
|
|
54
|
+
### Bug Fixes
|
|
55
|
+
|
|
56
|
+
- bump dependencies and remove ssl option ([#8984](https://github.com/patternfly/patternfly-react/issues/8984)) ([f8f77d2](https://github.com/patternfly/patternfly-react/commit/f8f77d232b386ad8676af609273d9adff5a5feae))
|
|
57
|
+
|
|
58
|
+
# 5.0.0-alpha.10 (2023-04-11)
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
- **icons:** fixed pficons naming overrides ([#8932](https://github.com/patternfly/patternfly-react/issues/8932)) ([1c9c9cb](https://github.com/patternfly/patternfly-react/commit/1c9c9cb7909a26d3bc4ad340d0656c0ec31d9e58))
|
|
63
|
+
|
|
64
|
+
# 5.0.0-alpha.9 (2023-04-06)
|
|
65
|
+
|
|
66
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
67
|
+
|
|
68
|
+
# 5.0.0-alpha.8 (2023-04-03)
|
|
69
|
+
|
|
70
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
71
|
+
|
|
72
|
+
# 5.0.0-alpha.7 (2023-03-27)
|
|
73
|
+
|
|
74
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
75
|
+
|
|
76
|
+
# 5.0.0-alpha.6 (2023-03-18)
|
|
77
|
+
|
|
78
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
79
|
+
|
|
80
|
+
# 5.0.0-alpha.5 (2023-03-17)
|
|
81
|
+
|
|
82
|
+
**Note:** Version bump only for package @patternfly/react-icons
|
|
83
|
+
|
|
84
|
+
# 5.0.0-alpha.4 (2023-03-02)
|
|
85
|
+
|
|
86
|
+
### Bug Fixes
|
|
87
|
+
|
|
88
|
+
- **core:** update core to alpha.24 ([#8768](https://github.com/patternfly/patternfly-react/issues/8768)) ([6dd5e01](https://github.com/patternfly/patternfly-react/commit/6dd5e01e16bc94fe4b954b79ba67adaaab9c7135))
|
|
89
|
+
|
|
90
|
+
# 5.0.0-alpha.3 (2023-02-15)
|
|
91
|
+
|
|
92
|
+
### Bug Fixes
|
|
93
|
+
|
|
94
|
+
- **deps:** updated to the latest core alpha ([#8688](https://github.com/patternfly/patternfly-react/issues/8688)) ([5f81928](https://github.com/patternfly/patternfly-react/commit/5f819288d7baaa3806b23c0da8fb26dd4ec12d6b))
|
|
95
|
+
|
|
6
96
|
# 5.0.0-alpha.2 (2023-02-08)
|
|
7
97
|
|
|
8
98
|
**Note:** Version bump only for package @patternfly/react-icons
|
package/dist/esm/createIcon.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare enum IconSize {
|
|
3
|
-
sm = "sm",
|
|
4
|
-
md = "md",
|
|
5
|
-
lg = "lg",
|
|
6
|
-
xl = "xl"
|
|
7
|
-
}
|
|
8
|
-
export declare const getSize: (size: IconSize | keyof typeof IconSize) => "1em" | "1.5em" | "2em" | "3em";
|
|
9
2
|
export interface IconDefinition {
|
|
10
3
|
name?: string;
|
|
11
4
|
width: number;
|
|
@@ -14,11 +7,9 @@ export interface IconDefinition {
|
|
|
14
7
|
xOffset?: number;
|
|
15
8
|
yOffset?: number;
|
|
16
9
|
}
|
|
17
|
-
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, '
|
|
18
|
-
color?: string;
|
|
19
|
-
size?: IconSize | keyof typeof IconSize;
|
|
10
|
+
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, 'ref'> {
|
|
20
11
|
title?: string;
|
|
21
|
-
|
|
12
|
+
className?: string;
|
|
22
13
|
}
|
|
23
14
|
/**
|
|
24
15
|
* Factory to create Icon class components for consumers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,
|
|
1
|
+
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAW,EACX,OAAW,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACR,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CA6BrD"}
|
package/dist/esm/createIcon.js
CHANGED
|
@@ -1,26 +1,5 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
export var IconSize;
|
|
4
|
-
(function (IconSize) {
|
|
5
|
-
IconSize["sm"] = "sm";
|
|
6
|
-
IconSize["md"] = "md";
|
|
7
|
-
IconSize["lg"] = "lg";
|
|
8
|
-
IconSize["xl"] = "xl";
|
|
9
|
-
})(IconSize || (IconSize = {}));
|
|
10
|
-
export const getSize = (size) => {
|
|
11
|
-
switch (size) {
|
|
12
|
-
case IconSize.sm:
|
|
13
|
-
return '1em';
|
|
14
|
-
case IconSize.md:
|
|
15
|
-
return '1.5em';
|
|
16
|
-
case IconSize.lg:
|
|
17
|
-
return '2em';
|
|
18
|
-
case IconSize.xl:
|
|
19
|
-
return '3em';
|
|
20
|
-
default:
|
|
21
|
-
return '1em';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
3
|
let currentId = 0;
|
|
25
4
|
/**
|
|
26
5
|
* Factory to create Icon class components for consumers
|
|
@@ -33,23 +12,16 @@ export function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgP
|
|
|
33
12
|
this.id = `icon-title-${currentId++}`;
|
|
34
13
|
}
|
|
35
14
|
render() {
|
|
36
|
-
const _a = this.props, {
|
|
15
|
+
const _a = this.props, { title, className } = _a, props = __rest(_a, ["title", "className"]);
|
|
16
|
+
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
37
17
|
const hasTitle = Boolean(title);
|
|
38
|
-
const heightWidth = getSize(size);
|
|
39
|
-
const baseAlign = -0.125 * Number.parseFloat(heightWidth);
|
|
40
|
-
const style = noVerticalAlign ? null : { verticalAlign: `${baseAlign}em` };
|
|
41
18
|
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
42
|
-
return (React.createElement("svg", Object.assign({
|
|
19
|
+
return (React.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img" }, props),
|
|
43
20
|
hasTitle && React.createElement("title", { id: this.id }, title),
|
|
44
21
|
React.createElement("path", { d: svgPath })));
|
|
45
22
|
}
|
|
46
23
|
},
|
|
47
24
|
_a.displayName = name,
|
|
48
|
-
_a.defaultProps = {
|
|
49
|
-
color: 'currentColor',
|
|
50
|
-
size: IconSize.sm,
|
|
51
|
-
noVerticalAlign: false
|
|
52
|
-
},
|
|
53
25
|
_a;
|
|
54
26
|
}
|
|
55
27
|
//# sourceMappingURL=createIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIcon.js","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"createIcon.js","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAgB/B,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACQ;;IACf,YAAO,MAAM,OAAQ,SAAQ,KAAK,CAAC,SAAuB;YAAnD;;gBAGL,OAAE,GAAG,cAAc,SAAS,EAAE,EAAE,CAAC;YAwBnC,CAAC;YAtBC,MAAM;gBACJ,MAAM,KAAiC,IAAI,CAAC,KAAK,EAA3C,EAAE,KAAK,EAAE,SAAS,OAAyB,EAApB,KAAK,cAA5B,sBAA8B,CAAa,CAAC;gBAClD,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;gBAEnE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAE5D,OAAO,CACL,2CACE,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,cAAc,qBACF,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,iBAC7B,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACnC,IAAI,EAAC,KAAK,IACL,KAAiD;oBAErD,QAAQ,IAAI,+BAAO,EAAE,EAAE,IAAI,CAAC,EAAE,IAAG,KAAK,CAAS;oBAChD,8BAAM,CAAC,EAAE,OAAO,GAAI,CAChB,CACP,CAAC;YACJ,CAAC;SACF;QA1BQ,cAAW,GAAG,IAAK;WA0B1B;AACJ,CAAC"}
|
|
@@ -919,6 +919,7 @@ export { MountainIcon, MountainIconConfig } from './mountain-icon';
|
|
|
919
919
|
export { MouseIcon, MouseIconConfig } from './mouse-icon';
|
|
920
920
|
export { MousePointerIcon, MousePointerIconConfig } from './mouse-pointer-icon';
|
|
921
921
|
export { MugHotIcon, MugHotIconConfig } from './mug-hot-icon';
|
|
922
|
+
export { MulticlusterIcon, MulticlusterIconConfig } from './multicluster-icon';
|
|
922
923
|
export { MusicIcon, MusicIconConfig } from './music-icon';
|
|
923
924
|
export { NamespacesIcon, NamespacesIconConfig } from './namespaces-icon';
|
|
924
925
|
export { NapsterIcon, NapsterIconConfig } from './napster-icon';
|
package/dist/esm/icons/index.js
CHANGED
|
@@ -919,6 +919,7 @@ export { MountainIcon, MountainIconConfig } from './mountain-icon';
|
|
|
919
919
|
export { MouseIcon, MouseIconConfig } from './mouse-icon';
|
|
920
920
|
export { MousePointerIcon, MousePointerIconConfig } from './mouse-pointer-icon';
|
|
921
921
|
export { MugHotIcon, MugHotIconConfig } from './mug-hot-icon';
|
|
922
|
+
export { MulticlusterIcon, MulticlusterIconConfig } from './multicluster-icon';
|
|
922
923
|
export { MusicIcon, MusicIconConfig } from './music-icon';
|
|
923
924
|
export { NamespacesIcon, NamespacesIconConfig } from './namespaces-icon';
|
|
924
925
|
export { NapsterIcon, NapsterIconConfig } from './napster-icon';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SVGIconProps } from '../createIcon';
|
|
3
|
+
export declare const MulticlusterIconConfig: {
|
|
4
|
+
name: 'MulticlusterIcon',
|
|
5
|
+
height: 1024,
|
|
6
|
+
width: 896,
|
|
7
|
+
svgPath: 'M768,768 C732.654,768 704,739.346 704,704 C704,668.654 732.654,640 768,640 C803.346,640 832,668.654 832,704 C832,739.346 803.346,768 768,768 L768,768 Z M768,576 C697.308,576 640,633.308 640,704 C640,774.692 697.308,832 768,832 C838.692,832 896,774.692 896,704 C896,633.308 838.692,576 768,576 L768,576 Z M128,384 C92.654,384 64,355.346 64,320 C64,284.654 92.654,256 128,256 C163.346,256 192,284.654 192,320 C192,355.346 163.346,384 128,384 L128,384 Z M128,192 C57.308,192 0,249.308 0,320 C0,390.692 57.308,448 128,448 C198.692,448 256,390.692 256,320 C256,249.308 198.692,192 128,192 L128,192 Z M658.229,769.862 L448,896 L128,704 L128,448 C151.315,448 173.172,441.763 192,430.872 L192,665.7 L448,819.2 L640.001,704.074 C640.015,728.135 646.671,750.64 658.229,769.862 L658.229,769.862 Z M704,358.7 L551.526,267.275 C564.619,249.299 573.145,227.788 575.397,204.438 L768,320 L768,576 C744.685,576 722.828,582.237 704,593.128 L704,358.7 Z M237.771,254.138 L320.603,204.438 C322.855,227.788 331.381,249.3 344.474,267.275 L255.996,320.328 C255.996,320.218 256,320.109 256,320 C256,295.911 249.341,273.38 237.771,254.138 L237.771,254.138 Z M448,256 C412.654,256 384,227.346 384,192 C384,156.654 412.654,128 448,128 C483.346,128 512,156.654 512,192 C512,227.346 483.346,256 448,256 L448,256 Z M448,64 C377.308,64 320,121.308 320,192 C320,262.692 377.308,320 448,320 C518.692,320 576,262.692 576,192 C576,121.308 518.692,64 448,64 L448,64 Z',
|
|
8
|
+
yOffset: 0,
|
|
9
|
+
xOffset: 0,
|
|
10
|
+
};
|
|
11
|
+
export declare const MulticlusterIcon: React.ComponentClass<SVGIconProps>;
|
|
12
|
+
export default MulticlusterIcon;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createIcon } from '../createIcon';
|
|
2
|
+
|
|
3
|
+
export const MulticlusterIconConfig = {
|
|
4
|
+
name: 'MulticlusterIcon',
|
|
5
|
+
height: 1024,
|
|
6
|
+
width: 896,
|
|
7
|
+
svgPath: 'M768,768 C732.654,768 704,739.346 704,704 C704,668.654 732.654,640 768,640 C803.346,640 832,668.654 832,704 C832,739.346 803.346,768 768,768 L768,768 Z M768,576 C697.308,576 640,633.308 640,704 C640,774.692 697.308,832 768,832 C838.692,832 896,774.692 896,704 C896,633.308 838.692,576 768,576 L768,576 Z M128,384 C92.654,384 64,355.346 64,320 C64,284.654 92.654,256 128,256 C163.346,256 192,284.654 192,320 C192,355.346 163.346,384 128,384 L128,384 Z M128,192 C57.308,192 0,249.308 0,320 C0,390.692 57.308,448 128,448 C198.692,448 256,390.692 256,320 C256,249.308 198.692,192 128,192 L128,192 Z M658.229,769.862 L448,896 L128,704 L128,448 C151.315,448 173.172,441.763 192,430.872 L192,665.7 L448,819.2 L640.001,704.074 C640.015,728.135 646.671,750.64 658.229,769.862 L658.229,769.862 Z M704,358.7 L551.526,267.275 C564.619,249.299 573.145,227.788 575.397,204.438 L768,320 L768,576 C744.685,576 722.828,582.237 704,593.128 L704,358.7 Z M237.771,254.138 L320.603,204.438 C322.855,227.788 331.381,249.3 344.474,267.275 L255.996,320.328 C255.996,320.218 256,320.109 256,320 C256,295.911 249.341,273.38 237.771,254.138 L237.771,254.138 Z M448,256 C412.654,256 384,227.346 384,192 C384,156.654 412.654,128 448,128 C483.346,128 512,156.654 512,192 C512,227.346 483.346,256 448,256 L448,256 Z M448,64 C377.308,64 320,121.308 320,192 C320,262.692 377.308,320 448,320 C518.692,320 576,262.692 576,192 C576,121.308 518.692,64 448,64 L448,64 Z',
|
|
8
|
+
yOffset: 0,
|
|
9
|
+
xOffset: 0,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const MulticlusterIcon = createIcon(MulticlusterIconConfig);
|
|
13
|
+
|
|
14
|
+
export default MulticlusterIcon;
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/js/createIcon.d.ts
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare enum IconSize {
|
|
3
|
-
sm = "sm",
|
|
4
|
-
md = "md",
|
|
5
|
-
lg = "lg",
|
|
6
|
-
xl = "xl"
|
|
7
|
-
}
|
|
8
|
-
export declare const getSize: (size: IconSize | keyof typeof IconSize) => "1em" | "1.5em" | "2em" | "3em";
|
|
9
2
|
export interface IconDefinition {
|
|
10
3
|
name?: string;
|
|
11
4
|
width: number;
|
|
@@ -14,11 +7,9 @@ export interface IconDefinition {
|
|
|
14
7
|
xOffset?: number;
|
|
15
8
|
yOffset?: number;
|
|
16
9
|
}
|
|
17
|
-
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, '
|
|
18
|
-
color?: string;
|
|
19
|
-
size?: IconSize | keyof typeof IconSize;
|
|
10
|
+
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, 'ref'> {
|
|
20
11
|
title?: string;
|
|
21
|
-
|
|
12
|
+
className?: string;
|
|
22
13
|
}
|
|
23
14
|
/**
|
|
24
15
|
* Factory to create Icon class components for consumers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,
|
|
1
|
+
{"version":3,"file":"createIcon.d.ts","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAW,EACX,OAAW,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACR,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CA6BrD"}
|
package/dist/js/createIcon.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createIcon =
|
|
3
|
+
exports.createIcon = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
|
-
var IconSize;
|
|
7
|
-
(function (IconSize) {
|
|
8
|
-
IconSize["sm"] = "sm";
|
|
9
|
-
IconSize["md"] = "md";
|
|
10
|
-
IconSize["lg"] = "lg";
|
|
11
|
-
IconSize["xl"] = "xl";
|
|
12
|
-
})(IconSize = exports.IconSize || (exports.IconSize = {}));
|
|
13
|
-
const getSize = (size) => {
|
|
14
|
-
switch (size) {
|
|
15
|
-
case IconSize.sm:
|
|
16
|
-
return '1em';
|
|
17
|
-
case IconSize.md:
|
|
18
|
-
return '1.5em';
|
|
19
|
-
case IconSize.lg:
|
|
20
|
-
return '2em';
|
|
21
|
-
case IconSize.xl:
|
|
22
|
-
return '3em';
|
|
23
|
-
default:
|
|
24
|
-
return '1em';
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
exports.getSize = getSize;
|
|
28
6
|
let currentId = 0;
|
|
29
7
|
/**
|
|
30
8
|
* Factory to create Icon class components for consumers
|
|
@@ -37,23 +15,16 @@ function createIcon({ name, xOffset = 0, yOffset = 0, width, height, svgPath })
|
|
|
37
15
|
this.id = `icon-title-${currentId++}`;
|
|
38
16
|
}
|
|
39
17
|
render() {
|
|
40
|
-
const _a = this.props, {
|
|
18
|
+
const _a = this.props, { title, className } = _a, props = tslib_1.__rest(_a, ["title", "className"]);
|
|
19
|
+
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
41
20
|
const hasTitle = Boolean(title);
|
|
42
|
-
const heightWidth = (0, exports.getSize)(size);
|
|
43
|
-
const baseAlign = -0.125 * Number.parseFloat(heightWidth);
|
|
44
|
-
const style = noVerticalAlign ? null : { verticalAlign: `${baseAlign}em` };
|
|
45
21
|
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
46
|
-
return (React.createElement("svg", Object.assign({
|
|
22
|
+
return (React.createElement("svg", Object.assign({ className: classes, viewBox: viewBox, fill: "currentColor", "aria-labelledby": hasTitle ? this.id : null, "aria-hidden": hasTitle ? null : true, role: "img" }, props),
|
|
47
23
|
hasTitle && React.createElement("title", { id: this.id }, title),
|
|
48
24
|
React.createElement("path", { d: svgPath })));
|
|
49
25
|
}
|
|
50
26
|
},
|
|
51
27
|
_a.displayName = name,
|
|
52
|
-
_a.defaultProps = {
|
|
53
|
-
color: 'currentColor',
|
|
54
|
-
size: IconSize.sm,
|
|
55
|
-
noVerticalAlign: false
|
|
56
|
-
},
|
|
57
28
|
_a;
|
|
58
29
|
}
|
|
59
30
|
exports.createIcon = createIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIcon.js","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;
|
|
1
|
+
{"version":3,"file":"createIcon.js","sourceRoot":"","sources":["../../src/createIcon.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAgB/B,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;GAEG;AACH,SAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,GAAG,CAAC,EACX,OAAO,GAAG,CAAC,EACX,KAAK,EACL,MAAM,EACN,OAAO,EACQ;;IACf,YAAO,MAAM,OAAQ,SAAQ,KAAK,CAAC,SAAuB;YAAnD;;gBAGL,OAAE,GAAG,cAAc,SAAS,EAAE,EAAE,CAAC;YAwBnC,CAAC;YAtBC,MAAM;gBACJ,MAAM,KAAiC,IAAI,CAAC,KAAK,EAA3C,EAAE,KAAK,EAAE,SAAS,OAAyB,EAApB,KAAK,sBAA5B,sBAA8B,CAAa,CAAC;gBAClD,MAAM,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC;gBAEnE,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;gBAChC,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAE5D,OAAO,CACL,2CACE,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAC,cAAc,qBACF,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,iBAC7B,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EACnC,IAAI,EAAC,KAAK,IACL,KAAiD;oBAErD,QAAQ,IAAI,+BAAO,EAAE,EAAE,IAAI,CAAC,EAAE,IAAG,KAAK,CAAS;oBAChD,8BAAM,CAAC,EAAE,OAAO,GAAI,CAChB,CACP,CAAC;YACJ,CAAC;SACF;QA1BQ,cAAW,GAAG,IAAK;WA0B1B;AACJ,CAAC;AApCD,gCAoCC"}
|
package/dist/js/icons/index.d.ts
CHANGED
|
@@ -919,6 +919,7 @@ export { MountainIcon, MountainIconConfig } from './mountain-icon';
|
|
|
919
919
|
export { MouseIcon, MouseIconConfig } from './mouse-icon';
|
|
920
920
|
export { MousePointerIcon, MousePointerIconConfig } from './mouse-pointer-icon';
|
|
921
921
|
export { MugHotIcon, MugHotIconConfig } from './mug-hot-icon';
|
|
922
|
+
export { MulticlusterIcon, MulticlusterIconConfig } from './multicluster-icon';
|
|
922
923
|
export { MusicIcon, MusicIconConfig } from './music-icon';
|
|
923
924
|
export { NamespacesIcon, NamespacesIconConfig } from './namespaces-icon';
|
|
924
925
|
export { NapsterIcon, NapsterIconConfig } from './napster-icon';
|
package/dist/js/icons/index.js
CHANGED
|
@@ -924,6 +924,7 @@ __export(require('./mountain-icon'));
|
|
|
924
924
|
__export(require('./mouse-icon'));
|
|
925
925
|
__export(require('./mouse-pointer-icon'));
|
|
926
926
|
__export(require('./mug-hot-icon'));
|
|
927
|
+
__export(require('./multicluster-icon'));
|
|
927
928
|
__export(require('./music-icon'));
|
|
928
929
|
__export(require('./namespaces-icon'));
|
|
929
930
|
__export(require('./napster-icon'));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SVGIconProps } from '../createIcon';
|
|
3
|
+
export declare const MulticlusterIconConfig: {
|
|
4
|
+
name: 'MulticlusterIcon',
|
|
5
|
+
height: 1024,
|
|
6
|
+
width: 896,
|
|
7
|
+
svgPath: 'M768,768 C732.654,768 704,739.346 704,704 C704,668.654 732.654,640 768,640 C803.346,640 832,668.654 832,704 C832,739.346 803.346,768 768,768 L768,768 Z M768,576 C697.308,576 640,633.308 640,704 C640,774.692 697.308,832 768,832 C838.692,832 896,774.692 896,704 C896,633.308 838.692,576 768,576 L768,576 Z M128,384 C92.654,384 64,355.346 64,320 C64,284.654 92.654,256 128,256 C163.346,256 192,284.654 192,320 C192,355.346 163.346,384 128,384 L128,384 Z M128,192 C57.308,192 0,249.308 0,320 C0,390.692 57.308,448 128,448 C198.692,448 256,390.692 256,320 C256,249.308 198.692,192 128,192 L128,192 Z M658.229,769.862 L448,896 L128,704 L128,448 C151.315,448 173.172,441.763 192,430.872 L192,665.7 L448,819.2 L640.001,704.074 C640.015,728.135 646.671,750.64 658.229,769.862 L658.229,769.862 Z M704,358.7 L551.526,267.275 C564.619,249.299 573.145,227.788 575.397,204.438 L768,320 L768,576 C744.685,576 722.828,582.237 704,593.128 L704,358.7 Z M237.771,254.138 L320.603,204.438 C322.855,227.788 331.381,249.3 344.474,267.275 L255.996,320.328 C255.996,320.218 256,320.109 256,320 C256,295.911 249.341,273.38 237.771,254.138 L237.771,254.138 Z M448,256 C412.654,256 384,227.346 384,192 C384,156.654 412.654,128 448,128 C483.346,128 512,156.654 512,192 C512,227.346 483.346,256 448,256 L448,256 Z M448,64 C377.308,64 320,121.308 320,192 C320,262.692 377.308,320 448,320 C518.692,320 576,262.692 576,192 C576,121.308 518.692,64 448,64 L448,64 Z',
|
|
8
|
+
yOffset: 0,
|
|
9
|
+
xOffset: 0,
|
|
10
|
+
};
|
|
11
|
+
export declare const MulticlusterIcon: React.ComponentClass<SVGIconProps>;
|
|
12
|
+
export default MulticlusterIcon;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict"
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.MulticlusterIconConfig = {
|
|
4
|
+
name: 'MulticlusterIcon',
|
|
5
|
+
height: 1024,
|
|
6
|
+
width: 896,
|
|
7
|
+
svgPath: 'M768,768 C732.654,768 704,739.346 704,704 C704,668.654 732.654,640 768,640 C803.346,640 832,668.654 832,704 C832,739.346 803.346,768 768,768 L768,768 Z M768,576 C697.308,576 640,633.308 640,704 C640,774.692 697.308,832 768,832 C838.692,832 896,774.692 896,704 C896,633.308 838.692,576 768,576 L768,576 Z M128,384 C92.654,384 64,355.346 64,320 C64,284.654 92.654,256 128,256 C163.346,256 192,284.654 192,320 C192,355.346 163.346,384 128,384 L128,384 Z M128,192 C57.308,192 0,249.308 0,320 C0,390.692 57.308,448 128,448 C198.692,448 256,390.692 256,320 C256,249.308 198.692,192 128,192 L128,192 Z M658.229,769.862 L448,896 L128,704 L128,448 C151.315,448 173.172,441.763 192,430.872 L192,665.7 L448,819.2 L640.001,704.074 C640.015,728.135 646.671,750.64 658.229,769.862 L658.229,769.862 Z M704,358.7 L551.526,267.275 C564.619,249.299 573.145,227.788 575.397,204.438 L768,320 L768,576 C744.685,576 722.828,582.237 704,593.128 L704,358.7 Z M237.771,254.138 L320.603,204.438 C322.855,227.788 331.381,249.3 344.474,267.275 L255.996,320.328 C255.996,320.218 256,320.109 256,320 C256,295.911 249.341,273.38 237.771,254.138 L237.771,254.138 Z M448,256 C412.654,256 384,227.346 384,192 C384,156.654 412.654,128 448,128 C483.346,128 512,156.654 512,192 C512,227.346 483.346,256 448,256 L448,256 Z M448,64 C377.308,64 320,121.308 320,192 C320,262.692 377.308,320 448,320 C518.692,320 576,262.692 576,192 C576,121.308 518.692,64 448,64 L448,64 Z',
|
|
8
|
+
yOffset: 0,
|
|
9
|
+
xOffset: 0,
|
|
10
|
+
};
|
|
11
|
+
exports.MulticlusterIcon = require('../createIcon').createIcon(exports.MulticlusterIconConfig);
|
|
12
|
+
exports["default"] = exports.MulticlusterIcon;
|
package/dist/js/index.d.ts
CHANGED
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
package/dist/js/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IconSize = void 0;
|
|
4
3
|
const tslib_1 = require("tslib");
|
|
5
|
-
var createIcon_1 = require("./createIcon");
|
|
6
|
-
Object.defineProperty(exports, "IconSize", { enumerable: true, get: function () { return createIcon_1.IconSize; } });
|
|
7
4
|
tslib_1.__exportStar(require("./icons/index"), exports);
|
|
8
5
|
//# sourceMappingURL=index.js.map
|
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAA8B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-icons",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.20",
|
|
4
4
|
"description": "PatternFly 4 Icons as React Components",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/patternfly/patternfly-react#readme",
|
|
27
27
|
"scripts": {
|
|
28
|
-
"generate": "rimraf dist/esm/icons dist/js/icons && node scripts/writeIcons.
|
|
28
|
+
"generate": "rimraf dist/esm/icons dist/js/icons && node scripts/writeIcons.mjs",
|
|
29
29
|
"clean": "rimraf dist src/icons src/index.js src/index.d.ts"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@fortawesome/free-brands-svg-icons": "^5.14.0",
|
|
33
33
|
"@fortawesome/free-regular-svg-icons": "^5.14.0",
|
|
34
34
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
35
|
-
"@patternfly/patternfly": "5.0.0-alpha.
|
|
36
|
-
"fs-extra": "^
|
|
35
|
+
"@patternfly/patternfly": "5.0.0-alpha.69",
|
|
36
|
+
"fs-extra": "^11.1.1",
|
|
37
37
|
"glob": "^7.1.2",
|
|
38
38
|
"rimraf": "^2.6.2",
|
|
39
|
-
"tslib": "^2.
|
|
39
|
+
"tslib": "^2.5.0",
|
|
40
40
|
"typescript": "^4.7.4"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-dom": "^
|
|
43
|
+
"react": "^17 || ^18",
|
|
44
|
+
"react-dom": "^17 || ^18"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "0f4a1d04e19c94a00f2174fb5e063e4cc516819f"
|
|
47
47
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import faIcons from './icons/fontawesomeIcons.js';
|
|
2
|
+
import patternflyIcons from './icons/patternflyIcons.mjs';
|
|
3
|
+
import customIcons from './icons/customIcons.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Generates icons from FontAwesome, PatternFly CSS, and custom icons in this repo.
|
|
7
|
+
*/
|
|
8
|
+
export function generateIcons() {
|
|
9
|
+
return {
|
|
10
|
+
...faIcons,
|
|
11
|
+
...patternflyIcons,
|
|
12
|
+
...customIcons
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { pfIcons } from '@patternfly/patternfly/icons/pficons.mjs';
|
|
2
2
|
|
|
3
3
|
const renaming = {
|
|
4
4
|
save: 'save-alt',
|
|
@@ -29,4 +29,5 @@ function convertIcons(icons) {
|
|
|
29
29
|
return icons;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const patternflyIcons = convertIcons(pfIcons)
|
|
33
|
+
export default patternflyIcons;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { join } from 'path';
|
|
2
|
+
import { outputFileSync } from 'fs-extra/esm';
|
|
3
|
+
import { generateIcons } from './generateIcons.mjs';
|
|
4
|
+
|
|
5
|
+
import * as url from 'url';
|
|
6
|
+
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
4
7
|
|
|
5
8
|
const outDir = join(__dirname, '../dist');
|
|
6
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { createIcon
|
|
3
|
+
import { createIcon } from '../createIcon';
|
|
4
4
|
|
|
5
5
|
const iconDef = {
|
|
6
6
|
name: 'IconName',
|
|
@@ -28,14 +28,6 @@ test('sets correct svgPath', () => {
|
|
|
28
28
|
).toHaveAttribute('d', iconDef.svgPath);
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
test('height and width are set from size', () => {
|
|
32
|
-
render(<SVGIcon size={IconSize.sm} />);
|
|
33
|
-
|
|
34
|
-
const svg = screen.getByRole('img', { hidden: true });
|
|
35
|
-
expect(svg).toHaveAttribute('width', '1em');
|
|
36
|
-
expect(svg).toHaveAttribute('height', '1em');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
31
|
test('aria-hidden is true if no title is specified', () => {
|
|
40
32
|
render(<SVGIcon />);
|
|
41
33
|
expect(screen.getByRole('img', { hidden: true })).toHaveAttribute('aria-hidden', 'true');
|
|
@@ -63,7 +55,7 @@ test('aria-labelledby matches title id', () => {
|
|
|
63
55
|
|
|
64
56
|
const svg = screen.getByRole('img', { hidden: true });
|
|
65
57
|
const labelledby = svg.getAttribute('aria-labelledby');
|
|
66
|
-
const titleId = svg.querySelector('title')
|
|
58
|
+
const titleId = svg.querySelector('title')?.getAttribute('id');
|
|
67
59
|
|
|
68
60
|
expect(labelledby).toEqual(titleId);
|
|
69
61
|
});
|
package/src/createIcon.tsx
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export enum IconSize {
|
|
4
|
-
sm = 'sm',
|
|
5
|
-
md = 'md',
|
|
6
|
-
lg = 'lg',
|
|
7
|
-
xl = 'xl'
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const getSize = (size: IconSize | keyof typeof IconSize) => {
|
|
11
|
-
switch (size) {
|
|
12
|
-
case IconSize.sm:
|
|
13
|
-
return '1em';
|
|
14
|
-
case IconSize.md:
|
|
15
|
-
return '1.5em';
|
|
16
|
-
case IconSize.lg:
|
|
17
|
-
return '2em';
|
|
18
|
-
case IconSize.xl:
|
|
19
|
-
return '3em';
|
|
20
|
-
default:
|
|
21
|
-
return '1em';
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
3
|
export interface IconDefinition {
|
|
26
4
|
name?: string;
|
|
27
5
|
width: number;
|
|
@@ -31,11 +9,9 @@ export interface IconDefinition {
|
|
|
31
9
|
yOffset?: number;
|
|
32
10
|
}
|
|
33
11
|
|
|
34
|
-
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, '
|
|
35
|
-
color?: string;
|
|
36
|
-
size?: IconSize | keyof typeof IconSize;
|
|
12
|
+
export interface SVGIconProps extends Omit<React.HTMLProps<SVGElement>, 'ref'> {
|
|
37
13
|
title?: string;
|
|
38
|
-
|
|
14
|
+
className?: string;
|
|
39
15
|
}
|
|
40
16
|
|
|
41
17
|
let currentId = 0;
|
|
@@ -53,30 +29,21 @@ export function createIcon({
|
|
|
53
29
|
}: IconDefinition): React.ComponentClass<SVGIconProps> {
|
|
54
30
|
return class SVGIcon extends React.Component<SVGIconProps> {
|
|
55
31
|
static displayName = name;
|
|
56
|
-
static defaultProps = {
|
|
57
|
-
color: 'currentColor',
|
|
58
|
-
size: IconSize.sm,
|
|
59
|
-
noVerticalAlign: false
|
|
60
|
-
};
|
|
61
32
|
|
|
62
33
|
id = `icon-title-${currentId++}`;
|
|
63
34
|
|
|
64
35
|
render() {
|
|
65
|
-
const {
|
|
36
|
+
const { title, className, ...props } = this.props;
|
|
37
|
+
const classes = className ? `pf-v5-svg ${className}` : 'pf-v5-svg';
|
|
66
38
|
|
|
67
39
|
const hasTitle = Boolean(title);
|
|
68
|
-
const heightWidth = getSize(size);
|
|
69
|
-
const baseAlign = -0.125 * Number.parseFloat(heightWidth);
|
|
70
|
-
const style = noVerticalAlign ? null : { verticalAlign: `${baseAlign}em` };
|
|
71
40
|
const viewBox = [xOffset, yOffset, width, height].join(' ');
|
|
72
41
|
|
|
73
42
|
return (
|
|
74
43
|
<svg
|
|
75
|
-
|
|
76
|
-
fill={color}
|
|
77
|
-
height={heightWidth}
|
|
78
|
-
width={heightWidth}
|
|
44
|
+
className={classes}
|
|
79
45
|
viewBox={viewBox}
|
|
46
|
+
fill="currentColor"
|
|
80
47
|
aria-labelledby={hasTitle ? this.id : null}
|
|
81
48
|
aria-hidden={hasTitle ? null : true}
|
|
82
49
|
role="img"
|
package/src/index.ts
CHANGED
package/scripts/generateIcons.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const faIcons = require('./icons/fontawesomeIcons');
|
|
2
|
-
const patternflyIcons = require('./icons/patternflyIcons');
|
|
3
|
-
const customIcons = require('./icons/customIcons');
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generates icons from FontAwesome, PatternFly CSS, and custom icons in this repo.
|
|
7
|
-
*/
|
|
8
|
-
function generateIcons() {
|
|
9
|
-
return {
|
|
10
|
-
...faIcons,
|
|
11
|
-
...patternflyIcons,
|
|
12
|
-
...customIcons
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
module.exports = {
|
|
17
|
-
generateIcons
|
|
18
|
-
};
|