@khanacademy/wonder-blocks-icon 1.2.34 → 1.2.36
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 +13 -0
- package/dist/es/index.js +2 -4
- package/dist/index.js +212 -0
- package/package.json +5 -5
- package/src/components/__docs__/icon.stories.js +19 -13
- package/src/index.js +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-icon
|
|
2
2
|
|
|
3
|
+
## 1.2.36
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1a5624d4: Update wonder-stuff dependencies to use newly published packages after migrating wonder-stuff to TypeScript
|
|
8
|
+
|
|
9
|
+
## 1.2.35
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [496119f2]
|
|
14
|
+
- @khanacademy/wonder-blocks-core@4.6.2
|
|
15
|
+
|
|
3
16
|
## 1.2.34
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
2
1
|
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { StyleSheet } from 'aphrodite';
|
|
5
5
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
@@ -180,6 +180,4 @@ var iconAssets = /*#__PURE__*/Object.freeze({
|
|
|
180
180
|
zoomOut: zoomOut
|
|
181
181
|
});
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
export { Icon as default, icons };
|
|
183
|
+
export { Icon as default, iconAssets as icons };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
6
|
+
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var aphrodite = require('aphrodite');
|
|
9
|
+
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
|
+
|
|
13
|
+
function _interopNamespace(e) {
|
|
14
|
+
if (e && e.__esModule) return e;
|
|
15
|
+
var n = Object.create(null);
|
|
16
|
+
if (e) {
|
|
17
|
+
Object.keys(e).forEach(function (k) {
|
|
18
|
+
if (k !== 'default') {
|
|
19
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return e[k]; }
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
n["default"] = e;
|
|
28
|
+
return Object.freeze(n);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
32
|
+
var _objectWithoutPropertiesLoose__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutPropertiesLoose);
|
|
33
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
34
|
+
|
|
35
|
+
const viewportPixelsForSize = size => ({
|
|
36
|
+
small: 16,
|
|
37
|
+
medium: 24,
|
|
38
|
+
large: 48,
|
|
39
|
+
xlarge: 96
|
|
40
|
+
})[size];
|
|
41
|
+
const getPathForIcon = (icon, size) => {
|
|
42
|
+
if (icon[size]) {
|
|
43
|
+
return {
|
|
44
|
+
assetSize: size,
|
|
45
|
+
path: icon[size]
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
const desiredPixelSize = viewportPixelsForSize(size);
|
|
49
|
+
const availableSizes = Object.keys(icon);
|
|
50
|
+
|
|
51
|
+
const sortFn = availableSize => {
|
|
52
|
+
const availablePixelSize = viewportPixelsForSize(availableSize);
|
|
53
|
+
const tooLargeByPixels = availablePixelSize - desiredPixelSize;
|
|
54
|
+
return tooLargeByPixels > 0 ? Number.POSITIVE_INFINITY : Math.abs(tooLargeByPixels);
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const assetSizes = availableSizes.sort((a, b) => sortFn(a) - sortFn(b));
|
|
58
|
+
const bestAssetSize = assetSizes[0];
|
|
59
|
+
|
|
60
|
+
if (bestAssetSize && icon[bestAssetSize]) {
|
|
61
|
+
return {
|
|
62
|
+
assetSize: bestAssetSize,
|
|
63
|
+
path: icon[bestAssetSize]
|
|
64
|
+
};
|
|
65
|
+
} else {
|
|
66
|
+
throw new Error("Icon does not contain any valid asset sizes!");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const _excluded = ["color", "icon", "size", "style", "testId"];
|
|
72
|
+
const StyledSVG = wonderBlocksCore.addStyle("svg");
|
|
73
|
+
class Icon extends React__namespace.PureComponent {
|
|
74
|
+
render() {
|
|
75
|
+
const _this$props = this.props,
|
|
76
|
+
{
|
|
77
|
+
color,
|
|
78
|
+
icon,
|
|
79
|
+
size,
|
|
80
|
+
style,
|
|
81
|
+
testId
|
|
82
|
+
} = _this$props,
|
|
83
|
+
sharedProps = _objectWithoutPropertiesLoose__default["default"](_this$props, _excluded);
|
|
84
|
+
|
|
85
|
+
const {
|
|
86
|
+
assetSize,
|
|
87
|
+
path
|
|
88
|
+
} = getPathForIcon(icon, size);
|
|
89
|
+
const pixelSize = viewportPixelsForSize(size);
|
|
90
|
+
const viewboxPixelSize = viewportPixelsForSize(assetSize);
|
|
91
|
+
return React__namespace.createElement(StyledSVG, _extends__default["default"]({}, sharedProps, {
|
|
92
|
+
style: [styles.svg, style],
|
|
93
|
+
width: pixelSize,
|
|
94
|
+
height: pixelSize,
|
|
95
|
+
viewBox: `0 0 ${viewboxPixelSize} ${viewboxPixelSize}`,
|
|
96
|
+
"data-test-id": testId
|
|
97
|
+
}), React__namespace.createElement("path", {
|
|
98
|
+
fill: color,
|
|
99
|
+
d: path
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
Icon.defaultProps = {
|
|
105
|
+
color: "currentColor",
|
|
106
|
+
size: "small"
|
|
107
|
+
};
|
|
108
|
+
const styles = aphrodite.StyleSheet.create({
|
|
109
|
+
svg: {
|
|
110
|
+
display: "inline-block",
|
|
111
|
+
verticalAlign: "text-bottom",
|
|
112
|
+
flexShrink: 0,
|
|
113
|
+
flexGrow: 0
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const add = {
|
|
118
|
+
medium: "M11 11V7a1 1 0 0 1 2 0v4h4a1 1 0 0 1 0 2h-4v4a1 1 0 0 1-2 0v-4H7a1 1 0 0 1 0-2h4zm1 13C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"
|
|
119
|
+
};
|
|
120
|
+
const caretDown = {
|
|
121
|
+
small: "M8 8.586l3.293-3.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L8 8.586z",
|
|
122
|
+
medium: "M17.293 8.293a1 1 0 0 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 1.414-1.414L12 13.586l5.293-5.293z"
|
|
123
|
+
};
|
|
124
|
+
const caretLeft = {
|
|
125
|
+
small: "M7.414 8l3.293 3.293a1 1 0 0 1-1.414 1.414l-4-4a1 1 0 0 1 0-1.414l4-4a1 1 0 0 1 1.414 1.414L7.414 8z",
|
|
126
|
+
medium: "M15.707 17.293a1 1 0 0 1-1.414 1.414l-6-6a1 1 0 0 1 0-1.414l6-6a1 1 0 0 1 1.414 1.414L10.414 12l5.293 5.293z"
|
|
127
|
+
};
|
|
128
|
+
const caretRight = {
|
|
129
|
+
small: "M8.586 8L5.293 4.707a1 1 0 0 1 1.414-1.414l4 4a1 1 0 0 1 0 1.414l-4 4a1 1 0 0 1-1.414-1.414L8.586 8z",
|
|
130
|
+
medium: "M8.293 17.293a1 1 0 0 0 1.414 1.414l6-6a1 1 0 0 0 0-1.414l-6-6a1 1 0 0 0-1.414 1.414L13.586 12l-5.293 5.293z"
|
|
131
|
+
};
|
|
132
|
+
const caretUp = {
|
|
133
|
+
small: "M8 7.414l-3.293 3.293a1 1 0 0 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0l4 4a1 1 0 0 1-1.414 1.414L8 7.414z",
|
|
134
|
+
medium: "M17.293 15.707a1 1 0 0 0 1.414-1.414l-6-6a1 1 0 0 0-1.414 0l-6 6a1 1 0 0 0 1.414 1.414L12 10.414l5.293 5.293z"
|
|
135
|
+
};
|
|
136
|
+
const check = {
|
|
137
|
+
small: "M6.072 10.4l6.175-7.058a1 1 0 1 1 1.506 1.317L6.769 12.64a1 1 0 0 1-1.55-.054L2.203 8.604a1 1 0 1 1 1.594-1.208L6.072 10.4z"
|
|
138
|
+
};
|
|
139
|
+
const contentArticle = {
|
|
140
|
+
small: "M11 12V8h2v5a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1h3v2H5v8h6zM9.5 6a.5.5 0 0 1-.5-.5V2l4 4H9.5z",
|
|
141
|
+
medium: "M12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm3-6v-4h2v5a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h3v2H9v8h6zm-1.5-6a.5.5 0 0 1-.5-.5V6l4 4h-3.5z"
|
|
142
|
+
};
|
|
143
|
+
const contentExercise = {
|
|
144
|
+
small: "M7.5 6.914L5 9.414V11h1.586l2.5-2.5L7.5 6.914zM8.914 5.5L10.5 7.086 11.586 6 10 4.414 8.914 5.5zM3 9a1 1 0 0 1 .293-.707l6-6a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-6 6A1 1 0 0 1 7 13H4a1 1 0 0 1-1-1V9z",
|
|
145
|
+
medium: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm-.5-11.086l1.586 1.586-2.5 2.5H9v-1.586l2.5-2.5zM12.914 9.5L14 8.414 15.586 10 14.5 11.086 12.914 9.5zM12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zM7 13v3a1 1 0 0 0 1 1h3a1 1 0 0 0 .707-.293l6-6a1 1 0 0 0 0-1.414l-3-3a1 1 0 0 0-1.414 0l-6 6A1 1 0 0 0 7 13z"
|
|
146
|
+
};
|
|
147
|
+
const contentVideo = {
|
|
148
|
+
small: "M6 5.87v4.263l3.197-2.131L6 5.87zm-.445-2.7l6 4a1 1 0 0 1 0 1.664l-6 4A1 1 0 0 1 4 12.002v-8a1 1 0 0 1 1.555-.832z",
|
|
149
|
+
medium: "M12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM10.555 7.17l6 4a1 1 0 0 1 0 1.664l-6 4A1 1 0 0 1 9 16.002v-8a1 1 0 0 1 1.555-.832zM11 14.133l3.197-2.131L11 9.87v4.263z"
|
|
150
|
+
};
|
|
151
|
+
const correct = {
|
|
152
|
+
medium: "M12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm-1.928-7.6l6.175-7.058a1 1 0 1 1 1.506 1.317l-6.984 7.981a1 1 0 0 1-1.55-.054l-3.016-3.982a1 1 0 0 1 1.594-1.208l2.275 3.003z"
|
|
153
|
+
};
|
|
154
|
+
const _delete = {
|
|
155
|
+
medium: "M12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zm-5-9a1 1 0 0 1 0-2h10a1 1 0 0 1 0 2H7z"
|
|
156
|
+
};
|
|
157
|
+
const dismiss = {
|
|
158
|
+
small: "M8 6.586l3.293-3.293a1 1 0 0 1 1.414 1.414L9.414 8l3.293 3.293a1 1 0 0 1-1.414 1.414L8 9.414l-3.293 3.293a1 1 0 1 1-1.414-1.414L6.586 8 3.293 4.707a1 1 0 0 1 1.414-1.414L8 6.586z",
|
|
159
|
+
medium: "M12 10.586L7.706 6.293a1 1 0 1 0-1.413 1.413L10.586 12l-4.293 4.294a1 1 0 0 0 1.413 1.413L12 13.414l4.294 4.293a1 1 0 0 0 1.413-1.413L13.414 12l4.293-4.294a1 1 0 1 0-1.413-1.413L12 10.586z"
|
|
160
|
+
};
|
|
161
|
+
const hint = {
|
|
162
|
+
medium: "M10.835 15.993a1 1 0 0 1 1.008-.247 5.5 5.5 0 1 0-3.59-3.59 1 1 0 0 1-.246 1.009L6.172 15 9 17.828l1.835-1.835zm-.78 3.61a1.496 1.496 0 0 1-2.11 0l-3.548-3.549a1.496 1.496 0 0 1 0-2.108l1.787-1.787a7.5 7.5 0 1 1 5.657 5.657l-1.787 1.787zm-6.762.104a1 1 0 0 1 1.414-1.414l1 1a1 1 0 0 1-1.414 1.414l-1-1z"
|
|
163
|
+
};
|
|
164
|
+
const incorrect = {
|
|
165
|
+
medium: "M12 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414L13.414 12l3.293 3.293a1 1 0 0 1-1.414 1.414L12 13.414l-3.293 3.293a1 1 0 1 1-1.414-1.414L10.586 12 7.293 8.707a1 1 0 0 1 1.414-1.414L12 10.586zM12 24C5.373 24 0 18.627 0 12S5.373 0 12 0s12 5.373 12 12-5.373 12-12 12zm0-2c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z"
|
|
166
|
+
};
|
|
167
|
+
const info = {
|
|
168
|
+
small: "M8 16A8 8 0 1 1 8 0a8 8 0 0 1 0 16zm0-2A6 6 0 1 0 8 2a6 6 0 0 0 0 12zM7 8a1 1 0 1 1 2 0v3a1 1 0 0 1-2 0V8zm1-2a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"
|
|
169
|
+
};
|
|
170
|
+
const search = {
|
|
171
|
+
small: "M11.172 9.757l2.535 2.536a1 1 0 0 1-1.414 1.414l-2.536-2.535a5 5 0 1 1 1.414-1.414zM7 10a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",
|
|
172
|
+
medium: "M11 17a6 6 0 1 0 0-12 6 6 0 0 0 0 12zm6.32-1.094l3.387 3.387a1 1 0 0 1-1.414 1.414l-3.387-3.387a8 8 0 1 1 1.414-1.414z"
|
|
173
|
+
};
|
|
174
|
+
const sortableArrowDown = {
|
|
175
|
+
small: "M7 9.586V4a1 1 0 1 1 2 0v5.586l2.293-2.293a1 1 0 0 1 1.414 1.414l-4 4a1 1 0 0 1-1.414 0l-4-4a1 1 0 0 1 1.414-1.414L7 9.586z"
|
|
176
|
+
};
|
|
177
|
+
const sortableArrowUp = {
|
|
178
|
+
small: "M9 6.414l2.293 2.293a1 1 0 0 0 1.414-1.414l-4-4a1 1 0 0 0-1.414 0l-4 4a1 1 0 0 0 1.414 1.414L7 6.414V12a1 1 0 1 0 2 0V6.414z"
|
|
179
|
+
};
|
|
180
|
+
const zoomIn = {
|
|
181
|
+
medium: "M17.32 15.906l3.387 3.387a1 1 0 0 1-1.414 1.414l-3.387-3.387a8 8 0 1 1 1.414-1.414zM12 10h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 0v-2H8a1 1 0 0 1 0-2h2V8a1 1 0 0 1 2 0v2zm-1 7a6 6 0 1 0 0-12 6 6 0 0 0 0 12z"
|
|
182
|
+
};
|
|
183
|
+
const zoomOut = {
|
|
184
|
+
medium: "M17.32 15.906l3.387 3.387a1 1 0 0 1-1.414 1.414l-3.387-3.387a8 8 0 1 1 1.414-1.414zM11 17a6 6 0 1 0 0-12 6 6 0 0 0 0 12zm-3-5a1 1 0 0 1 0-2h6a1 1 0 0 1 0 2H8z"
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
var iconAssets = /*#__PURE__*/Object.freeze({
|
|
188
|
+
__proto__: null,
|
|
189
|
+
add: add,
|
|
190
|
+
caretDown: caretDown,
|
|
191
|
+
caretLeft: caretLeft,
|
|
192
|
+
caretRight: caretRight,
|
|
193
|
+
caretUp: caretUp,
|
|
194
|
+
check: check,
|
|
195
|
+
contentArticle: contentArticle,
|
|
196
|
+
contentExercise: contentExercise,
|
|
197
|
+
contentVideo: contentVideo,
|
|
198
|
+
correct: correct,
|
|
199
|
+
'delete': _delete,
|
|
200
|
+
dismiss: dismiss,
|
|
201
|
+
hint: hint,
|
|
202
|
+
incorrect: incorrect,
|
|
203
|
+
info: info,
|
|
204
|
+
search: search,
|
|
205
|
+
sortableArrowDown: sortableArrowDown,
|
|
206
|
+
sortableArrowUp: sortableArrowUp,
|
|
207
|
+
zoomIn: zoomIn,
|
|
208
|
+
zoomOut: zoomOut
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
exports["default"] = Icon;
|
|
212
|
+
exports.icons = iconAssets;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-icon",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.36",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-core": "^4.6.
|
|
19
|
+
"@khanacademy/wonder-blocks-core": "^4.6.2"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@khanacademy/wonder-stuff-core": "^1.0
|
|
23
|
-
"wb-dev-build-settings": "^0.
|
|
22
|
+
"@khanacademy/wonder-stuff-core": "^1.2.0",
|
|
23
|
+
"wb-dev-build-settings": "^0.7.0"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"aphrodite": "^1.2.5",
|
|
27
27
|
"react": "16.14.0"
|
|
28
28
|
}
|
|
29
|
-
}
|
|
29
|
+
}
|
|
@@ -5,8 +5,9 @@ import {entries} from "@khanacademy/wonder-stuff-core";
|
|
|
5
5
|
|
|
6
6
|
import Color from "@khanacademy/wonder-blocks-color";
|
|
7
7
|
import {View} from "@khanacademy/wonder-blocks-core";
|
|
8
|
-
import Icon, {icons
|
|
8
|
+
import Icon, {icons} from "@khanacademy/wonder-blocks-icon";
|
|
9
9
|
import {LabelMedium} from "@khanacademy/wonder-blocks-typography";
|
|
10
|
+
import type {IconAsset} from "@khanacademy/wonder-blocks-icon";
|
|
10
11
|
|
|
11
12
|
import ComponentInfo from "../../../../../.storybook/components/component-info.js";
|
|
12
13
|
import {name, version} from "../../../package.json";
|
|
@@ -96,18 +97,23 @@ Sizes.parameters = {
|
|
|
96
97
|
};
|
|
97
98
|
|
|
98
99
|
export const Variants: StoryComponentType = () => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
100
|
+
// TODO(FEI-5018): Replace with Object.entries() after TS migration and get rid of
|
|
101
|
+
// `any` in callback. We may need to specify `IconAsset` as a type param. This
|
|
102
|
+
// doesn't work with Flow + Storybook for some reason.
|
|
103
|
+
const iconsWithLabels = entries(icons).map(
|
|
104
|
+
([name, icon]: [string, any]) => {
|
|
105
|
+
return (
|
|
106
|
+
<tr>
|
|
107
|
+
<td>
|
|
108
|
+
<Icon icon={icon} />
|
|
109
|
+
</td>
|
|
110
|
+
<td>
|
|
111
|
+
<LabelMedium>{name}</LabelMedium>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
);
|
|
115
|
+
},
|
|
116
|
+
);
|
|
111
117
|
|
|
112
118
|
return <table>{iconsWithLabels}</table>;
|
|
113
119
|
};
|
package/src/index.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import Icon from "./components/icon.js";
|
|
3
|
-
import * as iconAssets from "./util/icon-assets.js";
|
|
4
3
|
import type {IconAsset, IconSize} from "./util/icon-assets.js";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
const {__esModule: _, ...icons} = iconAssets;
|
|
5
|
+
export * as icons from "./util/icon-assets.js";
|
|
8
6
|
|
|
9
7
|
export type {IconAsset, IconSize};
|
|
10
|
-
export {icons};
|
|
11
8
|
export default Icon;
|