@khanacademy/wonder-blocks-icon 1.2.20 → 1.2.24
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/es/index.js +49 -233
- package/dist/index.js +142 -177
- package/package.json +6 -5
- package/src/components/__tests__/icon.test.js +2 -4
- package/src/util/icon-assets.js +29 -58
- package/src/__tests__/index.test.js +0 -13
package/dist/es/index.js
CHANGED
|
@@ -1,189 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
2
|
+
import _objectWithoutPropertiesLoose from '@babel/runtime/helpers/objectWithoutPropertiesLoose';
|
|
3
|
+
import { PureComponent, createElement } from 'react';
|
|
2
4
|
import { StyleSheet } from 'aphrodite';
|
|
3
5
|
import { addStyle } from '@khanacademy/wonder-blocks-core';
|
|
4
6
|
|
|
5
|
-
function _classCallCheck(instance, Constructor) {
|
|
6
|
-
if (!(instance instanceof Constructor)) {
|
|
7
|
-
throw new TypeError("Cannot call a class as a function");
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function _defineProperties(target, props) {
|
|
12
|
-
for (var i = 0; i < props.length; i++) {
|
|
13
|
-
var descriptor = props[i];
|
|
14
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
15
|
-
descriptor.configurable = true;
|
|
16
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
17
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
22
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
23
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
24
|
-
return Constructor;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function _defineProperty(obj, key, value) {
|
|
28
|
-
if (key in obj) {
|
|
29
|
-
Object.defineProperty(obj, key, {
|
|
30
|
-
value: value,
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true
|
|
34
|
-
});
|
|
35
|
-
} else {
|
|
36
|
-
obj[key] = value;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function _extends() {
|
|
43
|
-
_extends = Object.assign || function (target) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var source = arguments[i];
|
|
46
|
-
|
|
47
|
-
for (var key in source) {
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
49
|
-
target[key] = source[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return target;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return _extends.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _inherits(subClass, superClass) {
|
|
61
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
62
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
66
|
-
constructor: {
|
|
67
|
-
value: subClass,
|
|
68
|
-
writable: true,
|
|
69
|
-
configurable: true
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _getPrototypeOf(o) {
|
|
76
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
77
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
78
|
-
};
|
|
79
|
-
return _getPrototypeOf(o);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function _setPrototypeOf(o, p) {
|
|
83
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
84
|
-
o.__proto__ = p;
|
|
85
|
-
return o;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
return _setPrototypeOf(o, p);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function _isNativeReflectConstruct() {
|
|
92
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
93
|
-
if (Reflect.construct.sham) return false;
|
|
94
|
-
if (typeof Proxy === "function") return true;
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
|
|
98
|
-
return true;
|
|
99
|
-
} catch (e) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
105
|
-
if (source == null) return {};
|
|
106
|
-
var target = {};
|
|
107
|
-
var sourceKeys = Object.keys(source);
|
|
108
|
-
var key, i;
|
|
109
|
-
|
|
110
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
111
|
-
key = sourceKeys[i];
|
|
112
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
113
|
-
target[key] = source[key];
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
return target;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function _objectWithoutProperties(source, excluded) {
|
|
120
|
-
if (source == null) return {};
|
|
121
|
-
|
|
122
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
123
|
-
|
|
124
|
-
var key, i;
|
|
125
|
-
|
|
126
|
-
if (Object.getOwnPropertySymbols) {
|
|
127
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
128
|
-
|
|
129
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
130
|
-
key = sourceSymbolKeys[i];
|
|
131
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
132
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
133
|
-
target[key] = source[key];
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
return target;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function _assertThisInitialized(self) {
|
|
141
|
-
if (self === void 0) {
|
|
142
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return self;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function _possibleConstructorReturn(self, call) {
|
|
149
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
150
|
-
return call;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return _assertThisInitialized(self);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function _createSuper(Derived) {
|
|
157
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
158
|
-
|
|
159
|
-
return function _createSuperInternal() {
|
|
160
|
-
var Super = _getPrototypeOf(Derived),
|
|
161
|
-
result;
|
|
162
|
-
|
|
163
|
-
if (hasNativeReflectConstruct) {
|
|
164
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
165
|
-
|
|
166
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
167
|
-
} else {
|
|
168
|
-
result = Super.apply(this, arguments);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return _possibleConstructorReturn(this, result);
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
7
|
/**
|
|
176
8
|
* A simple function that tells us how many viewport pixels each icon size
|
|
177
9
|
* corresponds to.
|
|
178
10
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}[size];
|
|
186
|
-
};
|
|
11
|
+
const viewportPixelsForSize = size => ({
|
|
12
|
+
small: 16,
|
|
13
|
+
medium: 24,
|
|
14
|
+
large: 48,
|
|
15
|
+
xlarge: 96
|
|
16
|
+
})[size];
|
|
187
17
|
/**
|
|
188
18
|
* A utility to find the right asset from an IconAsset to display in an icon
|
|
189
19
|
* at a given IconSize. We're looking for, in the following order:
|
|
@@ -196,7 +26,7 @@ var viewportPixelsForSize = function viewportPixelsForSize(size) {
|
|
|
196
26
|
* rather blow up a smaller, simpler icon than scrunch down a more complex one.
|
|
197
27
|
*/
|
|
198
28
|
|
|
199
|
-
|
|
29
|
+
const getPathForIcon = (icon, size) => {
|
|
200
30
|
if (icon[size]) {
|
|
201
31
|
// Great, we have the IconSize we actually requested
|
|
202
32
|
return {
|
|
@@ -207,19 +37,17 @@ var getPathForIcon = function getPathForIcon(icon, size) {
|
|
|
207
37
|
// Oh, no, we don't have the right IconSize! Let's find the next best
|
|
208
38
|
// one...we prefer to find a smaller icon and blow it up instead of
|
|
209
39
|
// using a larger icon and shrinking it such that detail may be lost.
|
|
210
|
-
|
|
211
|
-
|
|
40
|
+
const desiredPixelSize = viewportPixelsForSize(size);
|
|
41
|
+
const availableSizes = Object.keys(icon);
|
|
212
42
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
43
|
+
const sortFn = availableSize => {
|
|
44
|
+
const availablePixelSize = viewportPixelsForSize(availableSize);
|
|
45
|
+
const tooLargeByPixels = availablePixelSize - desiredPixelSize;
|
|
216
46
|
return tooLargeByPixels > 0 ? Number.POSITIVE_INFINITY : Math.abs(tooLargeByPixels);
|
|
217
47
|
};
|
|
218
48
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
});
|
|
222
|
-
var bestAssetSize = assetSizes[0];
|
|
49
|
+
const assetSizes = availableSizes.sort((a, b) => sortFn(a) - sortFn(b));
|
|
50
|
+
const bestAssetSize = assetSizes[0];
|
|
223
51
|
|
|
224
52
|
if (bestAssetSize && icon[bestAssetSize]) {
|
|
225
53
|
return {
|
|
@@ -232,7 +60,8 @@ var getPathForIcon = function getPathForIcon(icon, size) {
|
|
|
232
60
|
}
|
|
233
61
|
};
|
|
234
62
|
|
|
235
|
-
|
|
63
|
+
const _excluded = ["color", "icon", "size", "style"];
|
|
64
|
+
const StyledSVG = addStyle("svg");
|
|
236
65
|
/**
|
|
237
66
|
* An Icon displays a small informational or decorative image as an SVG.
|
|
238
67
|
*
|
|
@@ -269,53 +98,40 @@ var StyledSVG = addStyle("svg");
|
|
|
269
98
|
* respectively.
|
|
270
99
|
*/
|
|
271
100
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
101
|
+
class Icon extends PureComponent {
|
|
102
|
+
render() {
|
|
103
|
+
const _this$props = this.props,
|
|
104
|
+
{
|
|
105
|
+
color,
|
|
106
|
+
icon,
|
|
107
|
+
size,
|
|
108
|
+
style
|
|
109
|
+
} = _this$props,
|
|
110
|
+
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
111
|
+
|
|
112
|
+
const {
|
|
113
|
+
assetSize,
|
|
114
|
+
path
|
|
115
|
+
} = getPathForIcon(icon, size);
|
|
116
|
+
const pixelSize = viewportPixelsForSize(size);
|
|
117
|
+
const viewboxPixelSize = viewportPixelsForSize(assetSize);
|
|
118
|
+
return /*#__PURE__*/createElement(StyledSVG, _extends({}, sharedProps, {
|
|
119
|
+
style: [styles.svg, style],
|
|
120
|
+
width: pixelSize,
|
|
121
|
+
height: pixelSize,
|
|
122
|
+
viewBox: `0 0 ${viewboxPixelSize} ${viewboxPixelSize}`
|
|
123
|
+
}), /*#__PURE__*/createElement("path", {
|
|
124
|
+
fill: color,
|
|
125
|
+
d: path
|
|
126
|
+
}));
|
|
281
127
|
}
|
|
282
128
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
value: function render() {
|
|
286
|
-
var _this$props = this.props,
|
|
287
|
-
color = _this$props.color,
|
|
288
|
-
icon = _this$props.icon,
|
|
289
|
-
size = _this$props.size,
|
|
290
|
-
style = _this$props.style,
|
|
291
|
-
sharedProps = _objectWithoutProperties(_this$props, ["color", "icon", "size", "style"]);
|
|
292
|
-
|
|
293
|
-
var _getPathForIcon = getPathForIcon(icon, size),
|
|
294
|
-
assetSize = _getPathForIcon.assetSize,
|
|
295
|
-
path = _getPathForIcon.path;
|
|
296
|
-
|
|
297
|
-
var pixelSize = viewportPixelsForSize(size);
|
|
298
|
-
var viewboxPixelSize = viewportPixelsForSize(assetSize);
|
|
299
|
-
return /*#__PURE__*/createElement(StyledSVG, _extends({}, sharedProps, {
|
|
300
|
-
style: [styles.svg, style],
|
|
301
|
-
width: pixelSize,
|
|
302
|
-
height: pixelSize,
|
|
303
|
-
viewBox: "0 0 ".concat(viewboxPixelSize, " ").concat(viewboxPixelSize)
|
|
304
|
-
}), /*#__PURE__*/createElement("path", {
|
|
305
|
-
fill: color,
|
|
306
|
-
d: path
|
|
307
|
-
}));
|
|
308
|
-
}
|
|
309
|
-
}]);
|
|
310
|
-
|
|
311
|
-
return Icon;
|
|
312
|
-
}(PureComponent);
|
|
313
|
-
|
|
314
|
-
_defineProperty(Icon, "defaultProps", {
|
|
129
|
+
}
|
|
130
|
+
Icon.defaultProps = {
|
|
315
131
|
color: "currentColor",
|
|
316
132
|
size: "small"
|
|
317
|
-
}
|
|
318
|
-
|
|
133
|
+
};
|
|
134
|
+
const styles = StyleSheet.create({
|
|
319
135
|
svg: {
|
|
320
136
|
display: "inline-block",
|
|
321
137
|
verticalAlign: "text-bottom",
|
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ module.exports =
|
|
|
82
82
|
/******/
|
|
83
83
|
/******/
|
|
84
84
|
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s =
|
|
85
|
+
/******/ return __webpack_require__(__webpack_require__.s = 6);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -93,49 +93,21 @@ module.exports = require("react");
|
|
|
93
93
|
|
|
94
94
|
/***/ }),
|
|
95
95
|
/* 1 */
|
|
96
|
-
/***/ (function(module, exports) {
|
|
97
|
-
|
|
98
|
-
module.exports = require("aphrodite");
|
|
99
|
-
|
|
100
|
-
/***/ }),
|
|
101
|
-
/* 2 */
|
|
102
|
-
/***/ (function(module, exports) {
|
|
103
|
-
|
|
104
|
-
module.exports = require("@khanacademy/wonder-blocks-core");
|
|
105
|
-
|
|
106
|
-
/***/ }),
|
|
107
|
-
/* 3 */
|
|
108
96
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
109
97
|
|
|
110
98
|
"use strict";
|
|
111
|
-
|
|
112
|
-
__webpack_require__.
|
|
113
|
-
|
|
114
|
-
// EXPORTS
|
|
115
|
-
__webpack_require__.d(__webpack_exports__, "icons", function() { return /* reexport */ icon_assets; });
|
|
116
|
-
|
|
117
|
-
// EXTERNAL MODULE: external "react"
|
|
118
|
-
var external_react_ = __webpack_require__(0);
|
|
119
|
-
|
|
120
|
-
// EXTERNAL MODULE: external "aphrodite"
|
|
121
|
-
var external_aphrodite_ = __webpack_require__(1);
|
|
122
|
-
|
|
123
|
-
// EXTERNAL MODULE: external "@khanacademy/wonder-blocks-core"
|
|
124
|
-
var wonder_blocks_core_ = __webpack_require__(2);
|
|
125
|
-
|
|
126
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-icon/src/util/icon-util.js
|
|
99
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return viewportPixelsForSize; });
|
|
100
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getPathForIcon; });
|
|
127
101
|
/**
|
|
128
102
|
* A simple function that tells us how many viewport pixels each icon size
|
|
129
103
|
* corresponds to.
|
|
130
104
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}[size];
|
|
138
|
-
};
|
|
105
|
+
const viewportPixelsForSize = size => ({
|
|
106
|
+
small: 16,
|
|
107
|
+
medium: 24,
|
|
108
|
+
large: 48,
|
|
109
|
+
xlarge: 96
|
|
110
|
+
})[size];
|
|
139
111
|
/**
|
|
140
112
|
* A utility to find the right asset from an IconAsset to display in an icon
|
|
141
113
|
* at a given IconSize. We're looking for, in the following order:
|
|
@@ -148,7 +120,7 @@ var viewportPixelsForSize = function viewportPixelsForSize(size) {
|
|
|
148
120
|
* rather blow up a smaller, simpler icon than scrunch down a more complex one.
|
|
149
121
|
*/
|
|
150
122
|
|
|
151
|
-
|
|
123
|
+
const getPathForIcon = (icon, size) => {
|
|
152
124
|
if (icon[size]) {
|
|
153
125
|
// Great, we have the IconSize we actually requested
|
|
154
126
|
return {
|
|
@@ -159,19 +131,17 @@ var getPathForIcon = function getPathForIcon(icon, size) {
|
|
|
159
131
|
// Oh, no, we don't have the right IconSize! Let's find the next best
|
|
160
132
|
// one...we prefer to find a smaller icon and blow it up instead of
|
|
161
133
|
// using a larger icon and shrinking it such that detail may be lost.
|
|
162
|
-
|
|
163
|
-
|
|
134
|
+
const desiredPixelSize = viewportPixelsForSize(size);
|
|
135
|
+
const availableSizes = Object.keys(icon);
|
|
164
136
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
137
|
+
const sortFn = availableSize => {
|
|
138
|
+
const availablePixelSize = viewportPixelsForSize(availableSize);
|
|
139
|
+
const tooLargeByPixels = availablePixelSize - desiredPixelSize;
|
|
168
140
|
return tooLargeByPixels > 0 ? Number.POSITIVE_INFINITY : Math.abs(tooLargeByPixels);
|
|
169
141
|
};
|
|
170
142
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
});
|
|
174
|
-
var bestAssetSize = assetSizes[0];
|
|
143
|
+
const assetSizes = availableSizes.sort((a, b) => sortFn(a) - sortFn(b));
|
|
144
|
+
const bestAssetSize = assetSizes[0];
|
|
175
145
|
|
|
176
146
|
if (bestAssetSize && icon[bestAssetSize]) {
|
|
177
147
|
return {
|
|
@@ -183,139 +153,16 @@ var getPathForIcon = function getPathForIcon(icon, size) {
|
|
|
183
153
|
}
|
|
184
154
|
}
|
|
185
155
|
};
|
|
186
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-icon/src/components/icon.js
|
|
187
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
188
|
-
|
|
189
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
190
|
-
|
|
191
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
192
|
-
|
|
193
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
194
|
-
|
|
195
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
196
|
-
|
|
197
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
198
|
-
|
|
199
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
200
|
-
|
|
201
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
202
|
-
|
|
203
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
204
|
-
|
|
205
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
206
|
-
|
|
207
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
208
|
-
|
|
209
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
210
|
-
|
|
211
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
212
|
-
|
|
213
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
214
|
-
|
|
215
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
var StyledSVG = Object(wonder_blocks_core_["addStyle"])("svg");
|
|
222
|
-
/**
|
|
223
|
-
* An Icon displays a small informational or decorative image as an SVG.
|
|
224
|
-
*
|
|
225
|
-
* ```js
|
|
226
|
-
* import Icon, {icons} from "@khanacademy/wonder-blocks-icon";
|
|
227
|
-
*
|
|
228
|
-
* <Icon
|
|
229
|
-
* icon={icons.search}
|
|
230
|
-
* color={Color.white}
|
|
231
|
-
* size="medium"
|
|
232
|
-
* style={{margin: 4}}
|
|
233
|
-
* />
|
|
234
|
-
* ```
|
|
235
|
-
*
|
|
236
|
-
* Wonder Blocks comes with a fixed set of icons available by importing `icons`,
|
|
237
|
-
* but you can also provide your own `IconAsset`.
|
|
238
|
-
*
|
|
239
|
-
* ```js
|
|
240
|
-
* import Icon from "@khanacademy/wonder-blocks-icon";
|
|
241
|
-
* import type {IconAsset} from "@khanacademy/wonder-blocks-icon";
|
|
242
|
-
*
|
|
243
|
-
* // Easter egg: what shape am I?
|
|
244
|
-
* const customIcon: IconAsset = {
|
|
245
|
-
* small: "M6.92820 0L13.85640 4L13.85640 12L6.92820 16L0 12L0 4Z",
|
|
246
|
-
* };
|
|
247
|
-
* ```
|
|
248
|
-
*
|
|
249
|
-
* `IconAsset` should be in the following format:
|
|
250
|
-
* ```js
|
|
251
|
-
* {small?: string, medium?: string, large?: string, xlarge?: string}
|
|
252
|
-
* ```
|
|
253
|
-
*
|
|
254
|
-
* These icons should fit into a viewport of 16, 24, 48, and 96 pixels,
|
|
255
|
-
* respectively.
|
|
256
|
-
*/
|
|
257
|
-
|
|
258
|
-
var icon_Icon = /*#__PURE__*/function (_React$PureComponent) {
|
|
259
|
-
_inherits(Icon, _React$PureComponent);
|
|
260
|
-
|
|
261
|
-
var _super = _createSuper(Icon);
|
|
262
|
-
|
|
263
|
-
function Icon() {
|
|
264
|
-
_classCallCheck(this, Icon);
|
|
265
|
-
|
|
266
|
-
return _super.apply(this, arguments);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
_createClass(Icon, [{
|
|
270
|
-
key: "render",
|
|
271
|
-
value: function render() {
|
|
272
|
-
var _this$props = this.props,
|
|
273
|
-
color = _this$props.color,
|
|
274
|
-
icon = _this$props.icon,
|
|
275
|
-
size = _this$props.size,
|
|
276
|
-
style = _this$props.style,
|
|
277
|
-
sharedProps = _objectWithoutProperties(_this$props, ["color", "icon", "size", "style"]);
|
|
278
|
-
|
|
279
|
-
var _getPathForIcon = getPathForIcon(icon, size),
|
|
280
|
-
assetSize = _getPathForIcon.assetSize,
|
|
281
|
-
path = _getPathForIcon.path;
|
|
282
|
-
|
|
283
|
-
var pixelSize = viewportPixelsForSize(size);
|
|
284
|
-
var viewboxPixelSize = viewportPixelsForSize(assetSize);
|
|
285
|
-
return /*#__PURE__*/external_react_["createElement"](StyledSVG, _extends({}, sharedProps, {
|
|
286
|
-
style: [styles.svg, style],
|
|
287
|
-
width: pixelSize,
|
|
288
|
-
height: pixelSize,
|
|
289
|
-
viewBox: "0 0 ".concat(viewboxPixelSize, " ").concat(viewboxPixelSize)
|
|
290
|
-
}), /*#__PURE__*/external_react_["createElement"]("path", {
|
|
291
|
-
fill: color,
|
|
292
|
-
d: path
|
|
293
|
-
}));
|
|
294
|
-
}
|
|
295
|
-
}]);
|
|
296
|
-
|
|
297
|
-
return Icon;
|
|
298
|
-
}(external_react_["PureComponent"]);
|
|
299
|
-
|
|
300
|
-
_defineProperty(icon_Icon, "defaultProps", {
|
|
301
|
-
color: "currentColor",
|
|
302
|
-
size: "small"
|
|
303
|
-
});
|
|
304
156
|
|
|
157
|
+
/***/ }),
|
|
158
|
+
/* 2 */
|
|
159
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
305
160
|
|
|
306
|
-
|
|
307
|
-
svg: {
|
|
308
|
-
display: "inline-block",
|
|
309
|
-
verticalAlign: "text-bottom",
|
|
310
|
-
flexShrink: 0,
|
|
311
|
-
flexGrow: 0
|
|
312
|
-
}
|
|
313
|
-
});
|
|
314
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-icon/src/util/icon-assets.js
|
|
161
|
+
"use strict";
|
|
315
162
|
/**
|
|
316
163
|
* The source SVG paths for our icons at various sizes
|
|
317
164
|
*/
|
|
318
|
-
/* harmony default export */
|
|
165
|
+
/* harmony default export */ __webpack_exports__["a"] = ({
|
|
319
166
|
add: {
|
|
320
167
|
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"
|
|
321
168
|
},
|
|
@@ -386,11 +233,129 @@ var styles = external_aphrodite_["StyleSheet"].create({
|
|
|
386
233
|
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"
|
|
387
234
|
}
|
|
388
235
|
});
|
|
389
|
-
|
|
236
|
+
|
|
237
|
+
/***/ }),
|
|
238
|
+
/* 3 */
|
|
239
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
240
|
+
|
|
241
|
+
"use strict";
|
|
242
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Icon; });
|
|
243
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
244
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
245
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
246
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
|
|
247
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5);
|
|
248
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__);
|
|
249
|
+
/* harmony import */ var _util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1);
|
|
250
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
const StyledSVG = Object(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__["addStyle"])("svg");
|
|
257
|
+
/**
|
|
258
|
+
* An Icon displays a small informational or decorative image as an SVG.
|
|
259
|
+
*
|
|
260
|
+
* ```js
|
|
261
|
+
* import Icon, {icons} from "@khanacademy/wonder-blocks-icon";
|
|
262
|
+
*
|
|
263
|
+
* <Icon
|
|
264
|
+
* icon={icons.search}
|
|
265
|
+
* color={Color.white}
|
|
266
|
+
* size="medium"
|
|
267
|
+
* style={{margin: 4}}
|
|
268
|
+
* />
|
|
269
|
+
* ```
|
|
270
|
+
*
|
|
271
|
+
* Wonder Blocks comes with a fixed set of icons available by importing `icons`,
|
|
272
|
+
* but you can also provide your own `IconAsset`.
|
|
273
|
+
*
|
|
274
|
+
* ```js
|
|
275
|
+
* import Icon from "@khanacademy/wonder-blocks-icon";
|
|
276
|
+
* import type {IconAsset} from "@khanacademy/wonder-blocks-icon";
|
|
277
|
+
*
|
|
278
|
+
* // Easter egg: what shape am I?
|
|
279
|
+
* const customIcon: IconAsset = {
|
|
280
|
+
* small: "M6.92820 0L13.85640 4L13.85640 12L6.92820 16L0 12L0 4Z",
|
|
281
|
+
* };
|
|
282
|
+
* ```
|
|
283
|
+
*
|
|
284
|
+
* `IconAsset` should be in the following format:
|
|
285
|
+
* ```js
|
|
286
|
+
* {small?: string, medium?: string, large?: string, xlarge?: string}
|
|
287
|
+
* ```
|
|
288
|
+
*
|
|
289
|
+
* These icons should fit into a viewport of 16, 24, 48, and 96 pixels,
|
|
290
|
+
* respectively.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
class Icon extends react__WEBPACK_IMPORTED_MODULE_0__["PureComponent"] {
|
|
294
|
+
render() {
|
|
295
|
+
const {
|
|
296
|
+
color,
|
|
297
|
+
icon,
|
|
298
|
+
size,
|
|
299
|
+
style,
|
|
300
|
+
...sharedProps
|
|
301
|
+
} = this.props;
|
|
302
|
+
const {
|
|
303
|
+
assetSize,
|
|
304
|
+
path
|
|
305
|
+
} = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* getPathForIcon */ "a"])(icon, size);
|
|
306
|
+
const pixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* viewportPixelsForSize */ "b"])(size);
|
|
307
|
+
const viewboxPixelSize = Object(_util_icon_util_js__WEBPACK_IMPORTED_MODULE_3__[/* viewportPixelsForSize */ "b"])(assetSize);
|
|
308
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](StyledSVG, _extends({}, sharedProps, {
|
|
309
|
+
style: [styles.svg, style],
|
|
310
|
+
width: pixelSize,
|
|
311
|
+
height: pixelSize,
|
|
312
|
+
viewBox: `0 0 ${viewboxPixelSize} ${viewboxPixelSize}`
|
|
313
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"]("path", {
|
|
314
|
+
fill: color,
|
|
315
|
+
d: path
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
}
|
|
320
|
+
Icon.defaultProps = {
|
|
321
|
+
color: "currentColor",
|
|
322
|
+
size: "small"
|
|
323
|
+
};
|
|
324
|
+
const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
|
|
325
|
+
svg: {
|
|
326
|
+
display: "inline-block",
|
|
327
|
+
verticalAlign: "text-bottom",
|
|
328
|
+
flexShrink: 0,
|
|
329
|
+
flexGrow: 0
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
/***/ }),
|
|
334
|
+
/* 4 */
|
|
335
|
+
/***/ (function(module, exports) {
|
|
336
|
+
|
|
337
|
+
module.exports = require("aphrodite");
|
|
338
|
+
|
|
339
|
+
/***/ }),
|
|
340
|
+
/* 5 */
|
|
341
|
+
/***/ (function(module, exports) {
|
|
342
|
+
|
|
343
|
+
module.exports = require("@khanacademy/wonder-blocks-core");
|
|
344
|
+
|
|
345
|
+
/***/ }),
|
|
346
|
+
/* 6 */
|
|
347
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
348
|
+
|
|
349
|
+
"use strict";
|
|
350
|
+
__webpack_require__.r(__webpack_exports__);
|
|
351
|
+
/* harmony import */ var _components_icon_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
|
|
352
|
+
/* harmony import */ var _util_icon_assets_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
353
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "icons", function() { return _util_icon_assets_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
|
|
354
|
+
|
|
390
355
|
|
|
391
356
|
|
|
392
357
|
|
|
393
|
-
/* harmony default export */
|
|
358
|
+
/* harmony default export */ __webpack_exports__["default"] = (_components_icon_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]);
|
|
394
359
|
|
|
395
360
|
/***/ })
|
|
396
361
|
/******/ ]);
|
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.24",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,14 +15,15 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "MIT",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@
|
|
18
|
+
"@babel/runtime": "^7.16.3",
|
|
19
|
+
"@khanacademy/wonder-blocks-core": "^4.0.0"
|
|
19
20
|
},
|
|
20
21
|
"devDependencies": {
|
|
21
|
-
"wb-dev-build-settings": "^0.0
|
|
22
|
+
"wb-dev-build-settings": "^0.2.0"
|
|
22
23
|
},
|
|
23
24
|
"peerDependencies": {
|
|
24
25
|
"aphrodite": "^1.2.5",
|
|
25
|
-
"react": "
|
|
26
|
+
"react": "16.14.0"
|
|
26
27
|
},
|
|
27
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "9ebea88533e702011165072f090a377e02fa3f0f"
|
|
28
29
|
}
|
|
@@ -24,10 +24,8 @@ const mockStyledSVGComponent: JestMockFn<any, any> = (Core: any)
|
|
|
24
24
|
|
|
25
25
|
// Also, let's type up a couple of other mocks to shut flow up.
|
|
26
26
|
const mockGetPathForIcon: JestMockFn<any, any> = (getPathForIcon: any);
|
|
27
|
-
const mockViewportPixelsForSize: JestMockFn<
|
|
28
|
-
any
|
|
29
|
-
any,
|
|
30
|
-
> = (viewportPixelsForSize: any);
|
|
27
|
+
const mockViewportPixelsForSize: JestMockFn<any, any> =
|
|
28
|
+
(viewportPixelsForSize: any);
|
|
31
29
|
|
|
32
30
|
jest.mock("../../util/icon-util.js", () => ({
|
|
33
31
|
getPathForIcon: jest.fn(() => ({})),
|
package/src/util/icon-assets.js
CHANGED
|
@@ -14,101 +14,72 @@ export type IconSize = $Keys<IconAsset>;
|
|
|
14
14
|
|
|
15
15
|
export default ({
|
|
16
16
|
add: {
|
|
17
|
-
medium:
|
|
18
|
-
"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",
|
|
17
|
+
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",
|
|
19
18
|
},
|
|
20
19
|
caretDown: {
|
|
21
|
-
small:
|
|
22
|
-
|
|
23
|
-
medium:
|
|
24
|
-
"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",
|
|
20
|
+
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",
|
|
21
|
+
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",
|
|
25
22
|
},
|
|
26
23
|
caretLeft: {
|
|
27
|
-
small:
|
|
28
|
-
|
|
29
|
-
medium:
|
|
30
|
-
"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",
|
|
24
|
+
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",
|
|
25
|
+
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",
|
|
31
26
|
},
|
|
32
27
|
caretRight: {
|
|
33
|
-
small:
|
|
34
|
-
|
|
35
|
-
medium:
|
|
36
|
-
"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",
|
|
28
|
+
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",
|
|
29
|
+
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",
|
|
37
30
|
},
|
|
38
31
|
caretUp: {
|
|
39
|
-
small:
|
|
40
|
-
|
|
41
|
-
medium:
|
|
42
|
-
"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",
|
|
32
|
+
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",
|
|
33
|
+
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",
|
|
43
34
|
},
|
|
44
35
|
check: {
|
|
45
|
-
small:
|
|
46
|
-
"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",
|
|
36
|
+
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",
|
|
47
37
|
},
|
|
48
38
|
contentArticle: {
|
|
49
|
-
small:
|
|
50
|
-
|
|
51
|
-
medium:
|
|
52
|
-
"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",
|
|
39
|
+
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",
|
|
40
|
+
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",
|
|
53
41
|
},
|
|
54
42
|
contentExercise: {
|
|
55
|
-
small:
|
|
56
|
-
|
|
57
|
-
medium:
|
|
58
|
-
"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",
|
|
43
|
+
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",
|
|
44
|
+
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",
|
|
59
45
|
},
|
|
60
46
|
contentVideo: {
|
|
61
|
-
small:
|
|
62
|
-
|
|
63
|
-
medium:
|
|
64
|
-
"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",
|
|
47
|
+
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",
|
|
48
|
+
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",
|
|
65
49
|
},
|
|
66
50
|
correct: {
|
|
67
|
-
medium:
|
|
68
|
-
"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",
|
|
51
|
+
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",
|
|
69
52
|
},
|
|
70
53
|
delete: {
|
|
71
|
-
medium:
|
|
72
|
-
"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",
|
|
54
|
+
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",
|
|
73
55
|
},
|
|
74
56
|
dismiss: {
|
|
75
|
-
small:
|
|
76
|
-
|
|
77
|
-
medium:
|
|
78
|
-
"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",
|
|
57
|
+
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",
|
|
58
|
+
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",
|
|
79
59
|
},
|
|
80
60
|
hint: {
|
|
81
|
-
medium:
|
|
82
|
-
"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",
|
|
61
|
+
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",
|
|
83
62
|
},
|
|
84
63
|
incorrect: {
|
|
85
|
-
medium:
|
|
86
|
-
"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",
|
|
64
|
+
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",
|
|
87
65
|
},
|
|
88
66
|
info: {
|
|
89
|
-
small:
|
|
90
|
-
"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",
|
|
67
|
+
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",
|
|
91
68
|
},
|
|
92
69
|
search: {
|
|
93
|
-
small:
|
|
94
|
-
|
|
95
|
-
medium:
|
|
96
|
-
"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",
|
|
70
|
+
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",
|
|
71
|
+
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",
|
|
97
72
|
},
|
|
98
73
|
sortableArrowDown: {
|
|
99
|
-
small:
|
|
100
|
-
"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",
|
|
74
|
+
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",
|
|
101
75
|
},
|
|
102
76
|
sortableArrowUp: {
|
|
103
|
-
small:
|
|
104
|
-
"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",
|
|
77
|
+
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",
|
|
105
78
|
},
|
|
106
79
|
zoomIn: {
|
|
107
|
-
medium:
|
|
108
|
-
"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",
|
|
80
|
+
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",
|
|
109
81
|
},
|
|
110
82
|
zoomOut: {
|
|
111
|
-
medium:
|
|
112
|
-
"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",
|
|
83
|
+
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",
|
|
113
84
|
},
|
|
114
85
|
}: {[string]: IconAsset, ...});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
// @flow
|
|
2
|
-
describe("@khanacademy/wonder-blocks-icon", () => {
|
|
3
|
-
test("package exports default", async () => {
|
|
4
|
-
// Arrange
|
|
5
|
-
const importedModule = import("../index.js");
|
|
6
|
-
|
|
7
|
-
// Act
|
|
8
|
-
const result = await importedModule;
|
|
9
|
-
|
|
10
|
-
// Assert
|
|
11
|
-
expect(Object.keys(result).sort()).toEqual(["default", "icons"].sort());
|
|
12
|
-
});
|
|
13
|
-
});
|