@khanacademy/wonder-blocks-grid 1.0.24 → 1.0.28
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 +6 -0
- package/dist/es/index.js +16 -14
- package/dist/index.js +972 -397
- package/package.json +8 -9
- package/src/components/__tests__/row.test.js +1 -0
- package/src/components/row.js +28 -26
- package/LICENSE +0 -21
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 = 9);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -93,436 +93,910 @@ module.exports = require("react");
|
|
|
93
93
|
|
|
94
94
|
/***/ }),
|
|
95
95
|
/* 1 */
|
|
96
|
-
/***/ (function(module, exports) {
|
|
96
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
97
97
|
|
|
98
|
-
module.exports =
|
|
98
|
+
module.exports =
|
|
99
|
+
/******/
|
|
100
|
+
function (modules) {
|
|
101
|
+
// webpackBootstrap
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/***/ (function(module, exports) {
|
|
103
|
+
/******/
|
|
104
|
+
// The module cache
|
|
103
105
|
|
|
104
|
-
|
|
106
|
+
/******/
|
|
107
|
+
var installedModules = {};
|
|
108
|
+
/******/
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
/***/ (function(module, exports) {
|
|
110
|
+
/******/
|
|
111
|
+
// The require function
|
|
109
112
|
|
|
110
|
-
|
|
113
|
+
/******/
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
/***/ (function(module, exports) {
|
|
115
|
+
function __webpack_require__(moduleId) {
|
|
116
|
+
/******/
|
|
115
117
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
119
|
-
var source = arguments[i];
|
|
118
|
+
/******/
|
|
119
|
+
// Check if module is in cache
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
/******/
|
|
122
|
+
if (installedModules[moduleId]) {
|
|
123
|
+
/******/
|
|
124
|
+
return installedModules[moduleId].exports;
|
|
125
|
+
/******/
|
|
126
126
|
}
|
|
127
|
+
/******/
|
|
128
|
+
// Create a new module (and put it into the cache)
|
|
129
|
+
|
|
130
|
+
/******/
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
var module = installedModules[moduleId] = {
|
|
134
|
+
/******/
|
|
135
|
+
i: moduleId,
|
|
136
|
+
|
|
137
|
+
/******/
|
|
138
|
+
l: false,
|
|
139
|
+
|
|
140
|
+
/******/
|
|
141
|
+
exports: {}
|
|
142
|
+
/******/
|
|
143
|
+
|
|
144
|
+
};
|
|
145
|
+
/******/
|
|
146
|
+
|
|
147
|
+
/******/
|
|
148
|
+
// Execute the module function
|
|
149
|
+
|
|
150
|
+
/******/
|
|
151
|
+
|
|
152
|
+
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
153
|
+
/******/
|
|
154
|
+
|
|
155
|
+
/******/
|
|
156
|
+
// Flag the module as loaded
|
|
157
|
+
|
|
158
|
+
/******/
|
|
159
|
+
|
|
160
|
+
module.l = true;
|
|
161
|
+
/******/
|
|
162
|
+
|
|
163
|
+
/******/
|
|
164
|
+
// Return the exports of the module
|
|
165
|
+
|
|
166
|
+
/******/
|
|
167
|
+
|
|
168
|
+
return module.exports;
|
|
169
|
+
/******/
|
|
170
|
+
}
|
|
171
|
+
/******/
|
|
172
|
+
|
|
173
|
+
/******/
|
|
174
|
+
|
|
175
|
+
/******/
|
|
176
|
+
// expose the modules object (__webpack_modules__)
|
|
177
|
+
|
|
178
|
+
/******/
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
__webpack_require__.m = modules;
|
|
182
|
+
/******/
|
|
183
|
+
|
|
184
|
+
/******/
|
|
185
|
+
// expose the module cache
|
|
186
|
+
|
|
187
|
+
/******/
|
|
188
|
+
|
|
189
|
+
__webpack_require__.c = installedModules;
|
|
190
|
+
/******/
|
|
191
|
+
|
|
192
|
+
/******/
|
|
193
|
+
// define getter function for harmony exports
|
|
194
|
+
|
|
195
|
+
/******/
|
|
196
|
+
|
|
197
|
+
__webpack_require__.d = function (exports, name, getter) {
|
|
198
|
+
/******/
|
|
199
|
+
if (!__webpack_require__.o(exports, name)) {
|
|
200
|
+
/******/
|
|
201
|
+
Object.defineProperty(exports, name, {
|
|
202
|
+
enumerable: true,
|
|
203
|
+
get: getter
|
|
204
|
+
});
|
|
205
|
+
/******/
|
|
206
|
+
}
|
|
207
|
+
/******/
|
|
127
208
|
|
|
128
|
-
return target;
|
|
129
209
|
};
|
|
210
|
+
/******/
|
|
130
211
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
212
|
+
/******/
|
|
213
|
+
// define __esModule on exports
|
|
134
214
|
|
|
135
|
-
|
|
136
|
-
module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
215
|
+
/******/
|
|
137
216
|
|
|
138
|
-
/***/ }),
|
|
139
|
-
/* 5 */
|
|
140
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
141
217
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
218
|
+
__webpack_require__.r = function (exports) {
|
|
219
|
+
/******/
|
|
220
|
+
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
221
|
+
/******/
|
|
222
|
+
Object.defineProperty(exports, Symbol.toStringTag, {
|
|
223
|
+
value: 'Module'
|
|
224
|
+
});
|
|
225
|
+
/******/
|
|
226
|
+
}
|
|
227
|
+
/******/
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
Object.defineProperty(exports, '__esModule', {
|
|
231
|
+
value: true
|
|
232
|
+
});
|
|
233
|
+
/******/
|
|
234
|
+
};
|
|
235
|
+
/******/
|
|
145
236
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
__webpack_require__.d(__webpack_exports__, "Row", function() { return /* reexport */ row_Row; });
|
|
237
|
+
/******/
|
|
238
|
+
// create a fake namespace object
|
|
149
239
|
|
|
150
|
-
|
|
151
|
-
|
|
240
|
+
/******/
|
|
241
|
+
// mode & 1: value is a module id, require it
|
|
152
242
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var extends_default = /*#__PURE__*/__webpack_require__.n(helpers_extends);
|
|
243
|
+
/******/
|
|
244
|
+
// mode & 2: merge all properties of value into the ns
|
|
156
245
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
var wonder_blocks_spacing_default = /*#__PURE__*/__webpack_require__.n(wonder_blocks_spacing_);
|
|
246
|
+
/******/
|
|
247
|
+
// mode & 4: return value when already ns object
|
|
160
248
|
|
|
161
|
-
|
|
162
|
-
|
|
249
|
+
/******/
|
|
250
|
+
// mode & 8|1: behave like require
|
|
163
251
|
|
|
164
|
-
|
|
165
|
-
var wonder_blocks_core_ = __webpack_require__(2);
|
|
252
|
+
/******/
|
|
166
253
|
|
|
167
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-layout/dist/es/index.js
|
|
168
254
|
|
|
255
|
+
__webpack_require__.t = function (value, mode) {
|
|
256
|
+
/******/
|
|
257
|
+
if (mode & 1) value = __webpack_require__(value);
|
|
258
|
+
/******/
|
|
169
259
|
|
|
260
|
+
if (mode & 8) return value;
|
|
261
|
+
/******/
|
|
170
262
|
|
|
263
|
+
if (mode & 4 && typeof value === 'object' && value && value.__esModule) return value;
|
|
264
|
+
/******/
|
|
171
265
|
|
|
172
|
-
|
|
266
|
+
var ns = Object.create(null);
|
|
267
|
+
/******/
|
|
173
268
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
// three different settings (roughly mobile, tablet, and desktop).
|
|
269
|
+
__webpack_require__.r(ns);
|
|
270
|
+
/******/
|
|
177
271
|
|
|
178
|
-
const MEDIA_DEFAULT_SPEC = {
|
|
179
|
-
small: {
|
|
180
|
-
query: "(max-width: 767px)",
|
|
181
|
-
totalColumns: 4,
|
|
182
|
-
gutterWidth: wonder_blocks_spacing_default.a.medium_16,
|
|
183
|
-
marginWidth: wonder_blocks_spacing_default.a.medium_16
|
|
184
|
-
},
|
|
185
|
-
medium: {
|
|
186
|
-
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
187
|
-
totalColumns: 8,
|
|
188
|
-
gutterWidth: wonder_blocks_spacing_default.a.xLarge_32,
|
|
189
|
-
marginWidth: wonder_blocks_spacing_default.a.large_24
|
|
190
|
-
},
|
|
191
|
-
large: {
|
|
192
|
-
query: "(min-width: 1024px)",
|
|
193
|
-
totalColumns: 12,
|
|
194
|
-
gutterWidth: wonder_blocks_spacing_default.a.xLarge_32,
|
|
195
|
-
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
196
|
-
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
197
|
-
}
|
|
198
|
-
}; // Used for internal tools
|
|
199
|
-
|
|
200
|
-
const MEDIA_INTERNAL_SPEC = {
|
|
201
|
-
large: {
|
|
202
|
-
query: "(min-width: 1px)",
|
|
203
|
-
totalColumns: 12,
|
|
204
|
-
gutterWidth: wonder_blocks_spacing_default.a.xLarge_32,
|
|
205
|
-
marginWidth: wonder_blocks_spacing_default.a.medium_16
|
|
206
|
-
}
|
|
207
|
-
}; // The default used for modals
|
|
208
|
-
|
|
209
|
-
const MEDIA_MODAL_SPEC = {
|
|
210
|
-
small: {
|
|
211
|
-
query: "(max-width: 767px)",
|
|
212
|
-
totalColumns: 4,
|
|
213
|
-
gutterWidth: wonder_blocks_spacing_default.a.medium_16,
|
|
214
|
-
marginWidth: wonder_blocks_spacing_default.a.medium_16
|
|
215
|
-
},
|
|
216
|
-
large: {
|
|
217
|
-
query: "(min-width: 768px)",
|
|
218
|
-
totalColumns: 12,
|
|
219
|
-
gutterWidth: wonder_blocks_spacing_default.a.xLarge_32,
|
|
220
|
-
marginWidth: wonder_blocks_spacing_default.a.xxLarge_48
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
const defaultContext = {
|
|
224
|
-
ssrSize: "large",
|
|
225
|
-
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
226
|
-
};
|
|
227
|
-
var MediaLayoutContext = /*#__PURE__*/Object(external_react_["createContext"])(defaultContext);
|
|
228
|
-
const queries = [].concat(Object.values(MEDIA_DEFAULT_SPEC).map(spec => spec.query), Object.values(MEDIA_INTERNAL_SPEC).map(spec => spec.query), Object.values(MEDIA_MODAL_SPEC).map(spec => spec.query));
|
|
229
|
-
const mediaQueryLists = {}; // eslint-disable-next-line flowtype/require-exact-type
|
|
230
|
-
// If for some reason we're not able to resolve the current media size we
|
|
231
|
-
// fall back to this state.
|
|
232
272
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
273
|
+
Object.defineProperty(ns, 'default', {
|
|
274
|
+
enumerable: true,
|
|
275
|
+
value: value
|
|
276
|
+
});
|
|
277
|
+
/******/
|
|
278
|
+
|
|
279
|
+
if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) {
|
|
280
|
+
return value[key];
|
|
281
|
+
}.bind(null, key));
|
|
282
|
+
/******/
|
|
240
283
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
284
|
+
return ns;
|
|
285
|
+
/******/
|
|
286
|
+
};
|
|
287
|
+
/******/
|
|
288
|
+
|
|
289
|
+
/******/
|
|
290
|
+
// getDefaultExport function for compatibility with non-harmony modules
|
|
291
|
+
|
|
292
|
+
/******/
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
__webpack_require__.n = function (module) {
|
|
296
|
+
/******/
|
|
297
|
+
var getter = module && module.__esModule ?
|
|
298
|
+
/******/
|
|
299
|
+
function getDefault() {
|
|
300
|
+
return module['default'];
|
|
301
|
+
} :
|
|
302
|
+
/******/
|
|
303
|
+
function getModuleExports() {
|
|
304
|
+
return module;
|
|
248
305
|
};
|
|
249
|
-
|
|
250
|
-
}
|
|
306
|
+
/******/
|
|
251
307
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const entries = Object.entries(this.props.mediaSpec);
|
|
308
|
+
__webpack_require__.d(getter, 'a', getter);
|
|
309
|
+
/******/
|
|
255
310
|
|
|
256
|
-
for (const [size, spec] of entries) {
|
|
257
|
-
const mql = mediaQueryLists[spec.query]; // during SSR there are no MediaQueryLists
|
|
258
311
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
312
|
+
return getter;
|
|
313
|
+
/******/
|
|
314
|
+
};
|
|
315
|
+
/******/
|
|
262
316
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
317
|
+
/******/
|
|
318
|
+
// Object.prototype.hasOwnProperty.call
|
|
319
|
+
|
|
320
|
+
/******/
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
__webpack_require__.o = function (object, property) {
|
|
324
|
+
return Object.prototype.hasOwnProperty.call(object, property);
|
|
325
|
+
};
|
|
326
|
+
/******/
|
|
327
|
+
|
|
328
|
+
/******/
|
|
329
|
+
// __webpack_public_path__
|
|
330
|
+
|
|
331
|
+
/******/
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
__webpack_require__.p = "";
|
|
335
|
+
/******/
|
|
336
|
+
|
|
337
|
+
/******/
|
|
338
|
+
|
|
339
|
+
/******/
|
|
340
|
+
// Load entry module and return exports
|
|
341
|
+
|
|
342
|
+
/******/
|
|
343
|
+
|
|
344
|
+
return __webpack_require__(__webpack_require__.s = 10);
|
|
345
|
+
/******/
|
|
346
|
+
}
|
|
347
|
+
/************************************************************************/
|
|
348
|
+
|
|
349
|
+
/******/
|
|
350
|
+
([
|
|
351
|
+
/* 0 */
|
|
352
|
+
|
|
353
|
+
/***/
|
|
354
|
+
function (module, exports) {
|
|
355
|
+
module.exports = __webpack_require__(0);
|
|
356
|
+
/***/
|
|
357
|
+
},
|
|
358
|
+
/* 1 */
|
|
359
|
+
|
|
360
|
+
/***/
|
|
361
|
+
function (module, exports) {
|
|
362
|
+
module.exports = __webpack_require__(10);
|
|
363
|
+
/***/
|
|
364
|
+
},
|
|
365
|
+
/* 2 */
|
|
366
|
+
|
|
367
|
+
/***/
|
|
368
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
369
|
+
"use strict";
|
|
370
|
+
/* harmony export (binding) */
|
|
371
|
+
|
|
372
|
+
__webpack_require__.d(__webpack_exports__, "d", function () {
|
|
373
|
+
return VALID_MEDIA_SIZES;
|
|
374
|
+
});
|
|
375
|
+
/* harmony export (binding) */
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
379
|
+
return MEDIA_DEFAULT_SPEC;
|
|
380
|
+
});
|
|
381
|
+
/* harmony export (binding) */
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
__webpack_require__.d(__webpack_exports__, "b", function () {
|
|
385
|
+
return MEDIA_INTERNAL_SPEC;
|
|
386
|
+
});
|
|
387
|
+
/* harmony export (binding) */
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
__webpack_require__.d(__webpack_exports__, "c", function () {
|
|
391
|
+
return MEDIA_MODAL_SPEC;
|
|
392
|
+
});
|
|
393
|
+
/* harmony import */
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
397
|
+
/* harmony import */
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__); // All possible valid media sizes
|
|
270
401
|
|
|
271
|
-
|
|
272
|
-
|
|
402
|
+
|
|
403
|
+
const VALID_MEDIA_SIZES = ["small", "medium", "large"];
|
|
404
|
+
const mediaDefaultSpecLargeMarginWidth = _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.large_24; // The default spec for media layout, currently available in
|
|
405
|
+
// three different settings (roughly mobile, tablet, and desktop).
|
|
406
|
+
|
|
407
|
+
const MEDIA_DEFAULT_SPEC = {
|
|
408
|
+
small: {
|
|
409
|
+
query: "(max-width: 767px)",
|
|
410
|
+
totalColumns: 4,
|
|
411
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16,
|
|
412
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
413
|
+
},
|
|
414
|
+
medium: {
|
|
415
|
+
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
416
|
+
totalColumns: 8,
|
|
417
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
418
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.large_24
|
|
419
|
+
},
|
|
420
|
+
large: {
|
|
421
|
+
query: "(min-width: 1024px)",
|
|
422
|
+
totalColumns: 12,
|
|
423
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
424
|
+
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
425
|
+
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
273
426
|
}
|
|
274
|
-
}
|
|
427
|
+
}; // Used for internal tools
|
|
428
|
+
|
|
429
|
+
const MEDIA_INTERNAL_SPEC = {
|
|
430
|
+
large: {
|
|
431
|
+
query: "(min-width: 1px)",
|
|
432
|
+
totalColumns: 12,
|
|
433
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
434
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
435
|
+
}
|
|
436
|
+
}; // The default used for modals
|
|
437
|
+
|
|
438
|
+
const MEDIA_MODAL_SPEC = {
|
|
439
|
+
small: {
|
|
440
|
+
query: "(max-width: 767px)",
|
|
441
|
+
totalColumns: 4,
|
|
442
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16,
|
|
443
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
444
|
+
},
|
|
445
|
+
large: {
|
|
446
|
+
query: "(min-width: 768px)",
|
|
447
|
+
totalColumns: 12,
|
|
448
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
449
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xxLarge_48
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
/***/
|
|
453
|
+
},
|
|
454
|
+
/* 3 */
|
|
455
|
+
|
|
456
|
+
/***/
|
|
457
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
458
|
+
"use strict";
|
|
459
|
+
/* harmony import */
|
|
460
|
+
|
|
461
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
462
|
+
/* harmony import */
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
466
|
+
/* harmony import */
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
var _util_specs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
470
|
+
|
|
471
|
+
const defaultContext = {
|
|
472
|
+
ssrSize: "large",
|
|
473
|
+
mediaSpec: _util_specs_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
474
|
+
/* MEDIA_DEFAULT_SPEC */
|
|
475
|
+
"a"]
|
|
476
|
+
};
|
|
477
|
+
/* harmony default export */
|
|
478
|
+
|
|
479
|
+
__webpack_exports__["a"] = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createContext"](defaultContext);
|
|
480
|
+
/***/
|
|
481
|
+
},
|
|
482
|
+
/* 4 */
|
|
483
|
+
|
|
484
|
+
/***/
|
|
485
|
+
function (module, exports) {
|
|
486
|
+
module.exports = __webpack_require__(3);
|
|
487
|
+
/***/
|
|
488
|
+
},
|
|
489
|
+
/* 5 */
|
|
490
|
+
|
|
491
|
+
/***/
|
|
492
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
493
|
+
"use strict";
|
|
494
|
+
/* harmony export (binding) */
|
|
495
|
+
|
|
496
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
497
|
+
return MediaLayout;
|
|
498
|
+
});
|
|
499
|
+
/* harmony import */
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
503
|
+
/* harmony import */
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
507
|
+
/* harmony import */
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
var _media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
511
|
+
/* harmony import */
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
var _util_specs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
275
515
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
516
|
+
function _extends() {
|
|
517
|
+
_extends = Object.assign || function (target) {
|
|
518
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
519
|
+
var source = arguments[i];
|
|
520
|
+
|
|
521
|
+
for (var key in source) {
|
|
522
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
523
|
+
target[key] = source[key];
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return target;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
return _extends.apply(this, arguments);
|
|
279
532
|
}
|
|
280
533
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
534
|
+
const queries = [].concat(Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
535
|
+
/* MEDIA_DEFAULT_SPEC */
|
|
536
|
+
"a"]).map(spec => spec.query), Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
537
|
+
/* MEDIA_INTERNAL_SPEC */
|
|
538
|
+
"b"]).map(spec => spec.query), Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[
|
|
539
|
+
/* MEDIA_MODAL_SPEC */
|
|
540
|
+
"c"]).map(spec => spec.query));
|
|
541
|
+
const mediaQueryLists = {}; // eslint-disable-next-line flowtype/require-exact-type
|
|
542
|
+
// If for some reason we're not able to resolve the current media size we
|
|
543
|
+
// fall back to this state.
|
|
544
|
+
|
|
545
|
+
const DEFAULT_SIZE = "large";
|
|
546
|
+
/**
|
|
547
|
+
* `MediaLayout` is responsible for changing the rendering of contents at
|
|
548
|
+
* differently sized viewports. `MediaLayoutContext.Provider` can be used
|
|
549
|
+
* to specify different breakpoint configurations. By default it uses
|
|
550
|
+
* `MEDIA_DEFAULT_SPEC`. See media-layout-context.js for additiional options.
|
|
551
|
+
*/
|
|
552
|
+
|
|
553
|
+
class MediaLayoutInternal extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
554
|
+
// A collection of thunks that's used to clean up event listeners
|
|
555
|
+
// when the component is unmounted.
|
|
556
|
+
constructor(props) {
|
|
557
|
+
super(props);
|
|
558
|
+
this.state = {
|
|
559
|
+
size: undefined
|
|
560
|
+
};
|
|
561
|
+
this.cleanupThunks = [];
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
componentDidMount() {
|
|
565
|
+
// TODO(WB-534): handle changes to mediaSpec prop
|
|
288
566
|
const entries = Object.entries(this.props.mediaSpec);
|
|
289
567
|
|
|
290
|
-
for (const [size,
|
|
291
|
-
const mql = mediaQueryLists[
|
|
568
|
+
for (const [size, spec] of entries) {
|
|
569
|
+
const mql = mediaQueryLists[spec.query]; // during SSR there are no MediaQueryLists
|
|
292
570
|
|
|
293
|
-
if (mql
|
|
294
|
-
|
|
571
|
+
if (!mql) {
|
|
572
|
+
continue;
|
|
295
573
|
}
|
|
574
|
+
|
|
575
|
+
const listener = e => {
|
|
576
|
+
if (e.matches) {
|
|
577
|
+
this.setState({
|
|
578
|
+
size
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
mql.addListener(listener);
|
|
584
|
+
this.cleanupThunks.push(() => mql.removeListener(listener));
|
|
296
585
|
}
|
|
297
586
|
}
|
|
298
587
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
588
|
+
componentWillUnmount() {
|
|
589
|
+
// Remove our listeners.
|
|
590
|
+
this.cleanupThunks.forEach(cleaup => cleaup());
|
|
591
|
+
}
|
|
303
592
|
|
|
593
|
+
getCurrentSize(spec) {
|
|
594
|
+
// If we have a state with the current size in it then we always want
|
|
595
|
+
// to use that. This will happen if the viewport changes sizes after
|
|
596
|
+
// we've already initialized.
|
|
597
|
+
if (this.state.size) {
|
|
598
|
+
return this.state.size;
|
|
599
|
+
} else {
|
|
600
|
+
const entries = Object.entries(this.props.mediaSpec);
|
|
601
|
+
|
|
602
|
+
for (const [size, spec] of entries) {
|
|
603
|
+
const mql = mediaQueryLists[spec.query];
|
|
604
|
+
|
|
605
|
+
if (mql.matches) {
|
|
606
|
+
return size;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
304
610
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
// styleSheets prop and then all of the individual styles. We merge the
|
|
310
|
-
// styles together
|
|
311
|
-
// TODO(WB-533): move to util.js to make it easier to test
|
|
611
|
+
return DEFAULT_SIZE;
|
|
612
|
+
} // We assume that we're running on the server (or, at least, an unsupported
|
|
613
|
+
// environment) if there is no window object or matchMedia function
|
|
614
|
+
// available.
|
|
312
615
|
|
|
313
616
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
617
|
+
isServerSide() {
|
|
618
|
+
return typeof window === "undefined" || !window.matchMedia;
|
|
619
|
+
} // Generate a mock Aphrodite StyleSheet based upon the current mediaSize
|
|
620
|
+
// We do this by looking at all of the stylesheets specified in the
|
|
621
|
+
// styleSheets prop and then all of the individual styles. We merge the
|
|
622
|
+
// styles together
|
|
623
|
+
// TODO(WB-533): move to util.js to make it easier to test
|
|
319
624
|
|
|
320
|
-
if (!styleSheets) {
|
|
321
|
-
return mockStyleSheet;
|
|
322
|
-
} // Go through all of the stylesheets that were specified
|
|
323
625
|
|
|
626
|
+
getMockStyleSheet(mediaSize) {
|
|
627
|
+
const {
|
|
628
|
+
styleSheets
|
|
629
|
+
} = this.props;
|
|
630
|
+
const mockStyleSheet = {}; // If no stylesheets were specified then we just return an empty object
|
|
324
631
|
|
|
325
|
-
|
|
326
|
-
|
|
632
|
+
if (!styleSheets) {
|
|
633
|
+
return mockStyleSheet;
|
|
634
|
+
} // Go through all of the stylesheets that were specified
|
|
327
635
|
|
|
328
|
-
if (!styleSheet) {
|
|
329
|
-
continue;
|
|
330
|
-
} // And then through each key of each stylesheet
|
|
331
636
|
|
|
637
|
+
for (const styleSize of Object.keys(styleSheets)) {
|
|
638
|
+
const styleSheet = styleSheets[styleSize];
|
|
332
639
|
|
|
333
|
-
|
|
334
|
-
if ( // $FlowIgnore[method-unbinding]
|
|
335
|
-
Object.prototype.hasOwnProperty.call(mockStyleSheet, name)) {
|
|
640
|
+
if (!styleSheet) {
|
|
336
641
|
continue;
|
|
337
|
-
} //
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
642
|
+
} // And then through each key of each stylesheet
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
for (const name of Object.keys(styleSheet)) {
|
|
646
|
+
if ( // $FlowIgnore[method-unbinding]
|
|
647
|
+
Object.prototype.hasOwnProperty.call(mockStyleSheet, name)) {
|
|
648
|
+
continue;
|
|
649
|
+
} // We create an entry that combines the values from all of
|
|
650
|
+
// the stylesheets together in least-specific to most-specific
|
|
651
|
+
// priority (thus small/medium/large styles will always have
|
|
652
|
+
// precedence over "all" or mdOrSmaller/mdOrLarger/etc.).
|
|
341
653
|
|
|
342
654
|
|
|
343
|
-
|
|
655
|
+
mockStyleSheet[name] = [styleSheets.all && styleSheets.all[name], mediaSize === "small" && [styleSheets.mdOrSmaller && styleSheets.mdOrSmaller[name], styleSheets.small && styleSheets.small[name]], mediaSize === "medium" && [styleSheets.mdOrSmaller && styleSheets.mdOrSmaller[name], styleSheets.mdOrLarger && styleSheets.mdOrLarger[name], styleSheets.medium && styleSheets.medium[name]], mediaSize === "large" && [styleSheets.mdOrLarger && styleSheets.mdOrLarger[name], styleSheets.large && styleSheets.large[name]]];
|
|
656
|
+
}
|
|
344
657
|
}
|
|
658
|
+
|
|
659
|
+
return mockStyleSheet;
|
|
345
660
|
}
|
|
346
661
|
|
|
347
|
-
|
|
348
|
-
|
|
662
|
+
render() {
|
|
663
|
+
const {
|
|
664
|
+
children,
|
|
665
|
+
mediaSpec,
|
|
666
|
+
ssrSize,
|
|
667
|
+
overrideSize
|
|
668
|
+
} = this.props; // We need to create the MediaQueryLists during the first render in order
|
|
669
|
+
// to query whether any of them match.
|
|
670
|
+
|
|
671
|
+
if (!this.isServerSide()) {
|
|
672
|
+
for (const query of queries.filter(query => !mediaQueryLists[query])) {
|
|
673
|
+
mediaQueryLists[query] = window.matchMedia(query);
|
|
674
|
+
}
|
|
675
|
+
} // We need to figure out what the current media size is
|
|
676
|
+
// If an override has been specified, we use that.
|
|
677
|
+
// If we're rendering on the server then we use the default
|
|
678
|
+
// SSR rendering size.
|
|
679
|
+
// Otherwise we attempt to get the current size based on
|
|
680
|
+
// the current MediaSpec.
|
|
349
681
|
|
|
350
|
-
render() {
|
|
351
|
-
const {
|
|
352
|
-
children,
|
|
353
|
-
mediaSpec,
|
|
354
|
-
ssrSize,
|
|
355
|
-
overrideSize
|
|
356
|
-
} = this.props; // We need to create the MediaQueryLists during the first render in order
|
|
357
|
-
// to query whether any of them match.
|
|
358
|
-
|
|
359
|
-
if (!this.isServerSide()) {
|
|
360
|
-
for (const query of queries.filter(query => !mediaQueryLists[query])) {
|
|
361
|
-
mediaQueryLists[query] = window.matchMedia(query);
|
|
362
|
-
}
|
|
363
|
-
} // We need to figure out what the current media size is
|
|
364
|
-
// If an override has been specified, we use that.
|
|
365
|
-
// If we're rendering on the server then we use the default
|
|
366
|
-
// SSR rendering size.
|
|
367
|
-
// Otherwise we attempt to get the current size based on
|
|
368
|
-
// the current MediaSpec.
|
|
369
682
|
|
|
683
|
+
const mediaSize = overrideSize || this.isServerSide() && ssrSize || this.getCurrentSize(mediaSpec); // Generate a mock stylesheet
|
|
370
684
|
|
|
371
|
-
|
|
685
|
+
const styles = this.getMockStyleSheet(mediaSize);
|
|
686
|
+
return children({
|
|
687
|
+
mediaSize,
|
|
688
|
+
mediaSpec,
|
|
689
|
+
styles
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
} // gen-snapshot-tests.js only understands `export default class ...`
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
class MediaLayout extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
697
|
+
render() {
|
|
698
|
+
// We listen to the MediaLayoutContext to see what defaults we're
|
|
699
|
+
// being given (this can be overriden by wrapping this component in
|
|
700
|
+
// a MediaLayoutContext.Consumer).
|
|
701
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__[
|
|
702
|
+
/* default */
|
|
703
|
+
"a"].Consumer, null, ({
|
|
704
|
+
overrideSize,
|
|
705
|
+
ssrSize,
|
|
706
|
+
mediaSpec
|
|
707
|
+
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](MediaLayoutInternal, _extends({}, this.props, {
|
|
708
|
+
overrideSize: overrideSize,
|
|
709
|
+
ssrSize: ssrSize,
|
|
710
|
+
mediaSpec: mediaSpec
|
|
711
|
+
})));
|
|
712
|
+
}
|
|
372
713
|
|
|
373
|
-
const styles = this.getMockStyleSheet(mediaSize);
|
|
374
|
-
return children({
|
|
375
|
-
mediaSize,
|
|
376
|
-
mediaSpec,
|
|
377
|
-
styles
|
|
378
|
-
});
|
|
379
714
|
}
|
|
715
|
+
/***/
|
|
380
716
|
|
|
381
|
-
}
|
|
717
|
+
},
|
|
718
|
+
/* 6 */
|
|
382
719
|
|
|
720
|
+
/***/
|
|
721
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
722
|
+
"use strict";
|
|
723
|
+
/* harmony export (binding) */
|
|
383
724
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
// a MediaLayoutContext.Consumer).
|
|
389
|
-
return /*#__PURE__*/Object(external_react_["createElement"])(MediaLayoutContext.Consumer, null, ({
|
|
390
|
-
overrideSize,
|
|
391
|
-
ssrSize,
|
|
392
|
-
mediaSpec
|
|
393
|
-
}) => /*#__PURE__*/Object(external_react_["createElement"])(es_MediaLayoutInternal, extends_default()({}, this.props, {
|
|
394
|
-
overrideSize: overrideSize,
|
|
395
|
-
ssrSize: ssrSize,
|
|
396
|
-
mediaSpec: mediaSpec
|
|
397
|
-
})));
|
|
398
|
-
}
|
|
725
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
726
|
+
return Spring;
|
|
727
|
+
});
|
|
728
|
+
/* harmony import */
|
|
399
729
|
|
|
400
|
-
}
|
|
401
|
-
/**
|
|
402
|
-
* Expands to fill space between sibling components.
|
|
403
|
-
*
|
|
404
|
-
* Assumes parent is a View.
|
|
405
|
-
*/
|
|
406
730
|
|
|
731
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
732
|
+
/* harmony import */
|
|
407
733
|
|
|
408
|
-
class es_Spring extends external_react_["Component"] {
|
|
409
|
-
render() {
|
|
410
|
-
const {
|
|
411
|
-
style
|
|
412
|
-
} = this.props;
|
|
413
|
-
return /*#__PURE__*/Object(external_react_["createElement"])(wonder_blocks_core_["View"], {
|
|
414
|
-
"aria-hidden": "true",
|
|
415
|
-
style: [styles.grow, style]
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
734
|
|
|
419
|
-
|
|
735
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
736
|
+
/* harmony import */
|
|
420
737
|
|
|
421
|
-
const styles = external_aphrodite_["StyleSheet"].create({
|
|
422
|
-
grow: {
|
|
423
|
-
flexGrow: 1
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
/**
|
|
427
|
-
* A component for inserting fixed space between components.
|
|
428
|
-
*
|
|
429
|
-
* Assumes parent is a View.
|
|
430
|
-
*/
|
|
431
738
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
739
|
+
var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
740
|
+
/* harmony import */
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
|
|
744
|
+
/* harmony import */
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
|
748
|
+
/* harmony import */
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__);
|
|
752
|
+
/**
|
|
753
|
+
* Expands to fill space between sibling components.
|
|
754
|
+
*
|
|
755
|
+
* Assumes parent is a View.
|
|
756
|
+
*/
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
class Spring extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
760
|
+
render() {
|
|
761
|
+
const {
|
|
762
|
+
style
|
|
763
|
+
} = this.props;
|
|
764
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__["View"], {
|
|
765
|
+
"aria-hidden": "true",
|
|
766
|
+
style: [styles.grow, style]
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
|
|
442
770
|
}
|
|
443
771
|
|
|
444
|
-
|
|
772
|
+
const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
|
|
773
|
+
grow: {
|
|
774
|
+
flexGrow: 1
|
|
775
|
+
}
|
|
776
|
+
});
|
|
777
|
+
/***/
|
|
778
|
+
},
|
|
779
|
+
/* 7 */
|
|
445
780
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
MsFlexPreferredSize: size,
|
|
451
|
-
WebkitFlexBasis: size,
|
|
452
|
-
flexBasis: size,
|
|
453
|
-
flexShrink: 0
|
|
454
|
-
};
|
|
455
|
-
};
|
|
456
|
-
/**
|
|
457
|
-
* Return where a media size matches a media query.
|
|
458
|
-
*
|
|
459
|
-
* examples:
|
|
460
|
-
* - `queryMatchesSize("all", "small")` returns `true`
|
|
461
|
-
* - `queryMatchesSize("mdOrLarger", "small")` returns `false`
|
|
462
|
-
*
|
|
463
|
-
* @param {MediaQuery} mediaQuery
|
|
464
|
-
* @param {MediaSize} mediaSize
|
|
465
|
-
*/
|
|
781
|
+
/***/
|
|
782
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
783
|
+
"use strict";
|
|
784
|
+
/* harmony export (binding) */
|
|
466
785
|
|
|
786
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
787
|
+
return Strut;
|
|
788
|
+
});
|
|
789
|
+
/* harmony import */
|
|
467
790
|
|
|
468
|
-
const queryMatchesSize = (mediaQuery, mediaSize) => {
|
|
469
|
-
switch (mediaQuery) {
|
|
470
|
-
case "all":
|
|
471
|
-
return true;
|
|
472
791
|
|
|
473
|
-
|
|
474
|
-
|
|
792
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
793
|
+
/* harmony import */
|
|
475
794
|
|
|
476
|
-
case "mdOrSmaller":
|
|
477
|
-
return mediaSize === "medium" || mediaSize === "small";
|
|
478
795
|
|
|
479
|
-
|
|
480
|
-
|
|
796
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
797
|
+
/* harmony import */
|
|
481
798
|
|
|
482
|
-
case "mdOrLarger":
|
|
483
|
-
return mediaSize === "medium" || mediaSize === "large";
|
|
484
799
|
|
|
485
|
-
|
|
486
|
-
|
|
800
|
+
var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
801
|
+
/* harmony import */
|
|
487
802
|
|
|
488
|
-
default:
|
|
489
|
-
throw new Error(`Unsupported mediaSize: ${mediaSize}`);
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
803
|
|
|
804
|
+
var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
805
|
+
/**
|
|
806
|
+
* A component for inserting fixed space between components.
|
|
807
|
+
*
|
|
808
|
+
* Assumes parent is a View.
|
|
809
|
+
*/
|
|
493
810
|
|
|
494
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-grid/src/util/styles.js
|
|
495
811
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
812
|
+
class Strut extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
813
|
+
render() {
|
|
814
|
+
const {
|
|
815
|
+
size,
|
|
816
|
+
style
|
|
817
|
+
} = this.props;
|
|
818
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__["View"], {
|
|
819
|
+
"aria-hidden": "true",
|
|
820
|
+
style: [strutStyle(size), style]
|
|
821
|
+
});
|
|
506
822
|
}
|
|
507
|
-
|
|
508
|
-
cellGrow: {
|
|
509
|
-
flexGrow: 1
|
|
510
|
-
},
|
|
511
|
-
cellFixed: {
|
|
512
|
-
flexShrink: 0
|
|
823
|
+
|
|
513
824
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
825
|
+
|
|
826
|
+
const strutStyle = size => {
|
|
827
|
+
return {
|
|
828
|
+
width: size,
|
|
829
|
+
MsFlexBasis: size,
|
|
830
|
+
MsFlexPreferredSize: size,
|
|
831
|
+
WebkitFlexBasis: size,
|
|
832
|
+
flexBasis: size,
|
|
833
|
+
flexShrink: 0
|
|
834
|
+
};
|
|
523
835
|
};
|
|
524
|
-
|
|
525
|
-
|
|
836
|
+
/***/
|
|
837
|
+
|
|
838
|
+
},
|
|
839
|
+
/* 8 */
|
|
840
|
+
|
|
841
|
+
/***/
|
|
842
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
843
|
+
"use strict";
|
|
844
|
+
/* harmony export (binding) */
|
|
845
|
+
|
|
846
|
+
__webpack_require__.d(__webpack_exports__, "a", function () {
|
|
847
|
+
return queryMatchesSize;
|
|
848
|
+
});
|
|
849
|
+
/**
|
|
850
|
+
* Return where a media size matches a media query.
|
|
851
|
+
*
|
|
852
|
+
* examples:
|
|
853
|
+
* - `queryMatchesSize("all", "small")` returns `true`
|
|
854
|
+
* - `queryMatchesSize("mdOrLarger", "small")` returns `false`
|
|
855
|
+
*
|
|
856
|
+
* @param {MediaQuery} mediaQuery
|
|
857
|
+
* @param {MediaSize} mediaSize
|
|
858
|
+
*/
|
|
859
|
+
|
|
860
|
+
|
|
861
|
+
const queryMatchesSize = (mediaQuery, mediaSize) => {
|
|
862
|
+
switch (mediaQuery) {
|
|
863
|
+
case "all":
|
|
864
|
+
return true;
|
|
865
|
+
|
|
866
|
+
case "small":
|
|
867
|
+
return mediaSize === "small";
|
|
868
|
+
|
|
869
|
+
case "mdOrSmaller":
|
|
870
|
+
return mediaSize === "medium" || mediaSize === "small";
|
|
871
|
+
|
|
872
|
+
case "medium":
|
|
873
|
+
return mediaSize === "medium";
|
|
874
|
+
|
|
875
|
+
case "mdOrLarger":
|
|
876
|
+
return mediaSize === "medium" || mediaSize === "large";
|
|
877
|
+
|
|
878
|
+
case "large":
|
|
879
|
+
return mediaSize === "large";
|
|
880
|
+
|
|
881
|
+
default:
|
|
882
|
+
throw new Error(`Unsupported mediaSize: ${mediaSize}`);
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
/***/
|
|
886
|
+
|
|
887
|
+
},
|
|
888
|
+
/* 9 */
|
|
889
|
+
|
|
890
|
+
/***/
|
|
891
|
+
function (module, exports) {
|
|
892
|
+
module.exports = __webpack_require__(5);
|
|
893
|
+
/***/
|
|
894
|
+
},
|
|
895
|
+
/* 10 */
|
|
896
|
+
|
|
897
|
+
/***/
|
|
898
|
+
function (module, __webpack_exports__, __webpack_require__) {
|
|
899
|
+
"use strict";
|
|
900
|
+
|
|
901
|
+
__webpack_require__.r(__webpack_exports__);
|
|
902
|
+
/* harmony import */
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
var _components_media_layout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
906
|
+
/* harmony reexport (safe) */
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
__webpack_require__.d(__webpack_exports__, "MediaLayout", function () {
|
|
910
|
+
return _components_media_layout_js__WEBPACK_IMPORTED_MODULE_0__["a"];
|
|
911
|
+
});
|
|
912
|
+
/* harmony import */
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
var _components_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
916
|
+
/* harmony reexport (safe) */
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
__webpack_require__.d(__webpack_exports__, "MediaLayoutContext", function () {
|
|
920
|
+
return _components_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__["a"];
|
|
921
|
+
});
|
|
922
|
+
/* harmony import */
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
var _components_spring_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
|
|
926
|
+
/* harmony reexport (safe) */
|
|
927
|
+
|
|
928
|
+
|
|
929
|
+
__webpack_require__.d(__webpack_exports__, "Spring", function () {
|
|
930
|
+
return _components_spring_js__WEBPACK_IMPORTED_MODULE_2__["a"];
|
|
931
|
+
});
|
|
932
|
+
/* harmony import */
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
var _components_strut_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
|
|
936
|
+
/* harmony reexport (safe) */
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
__webpack_require__.d(__webpack_exports__, "Strut", function () {
|
|
940
|
+
return _components_strut_js__WEBPACK_IMPORTED_MODULE_3__["a"];
|
|
941
|
+
});
|
|
942
|
+
/* harmony import */
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
var _util_specs_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
|
|
946
|
+
/* harmony reexport (safe) */
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
__webpack_require__.d(__webpack_exports__, "VALID_MEDIA_SIZES", function () {
|
|
950
|
+
return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["d"];
|
|
951
|
+
});
|
|
952
|
+
/* harmony reexport (safe) */
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
__webpack_require__.d(__webpack_exports__, "MEDIA_DEFAULT_SPEC", function () {
|
|
956
|
+
return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["a"];
|
|
957
|
+
});
|
|
958
|
+
/* harmony reexport (safe) */
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
__webpack_require__.d(__webpack_exports__, "MEDIA_INTERNAL_SPEC", function () {
|
|
962
|
+
return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["b"];
|
|
963
|
+
});
|
|
964
|
+
/* harmony reexport (safe) */
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
__webpack_require__.d(__webpack_exports__, "MEDIA_MODAL_SPEC", function () {
|
|
968
|
+
return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["c"];
|
|
969
|
+
});
|
|
970
|
+
/* harmony import */
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
var _util_util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
|
|
974
|
+
/* harmony reexport (safe) */
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
__webpack_require__.d(__webpack_exports__, "queryMatchesSize", function () {
|
|
978
|
+
return _util_util_js__WEBPACK_IMPORTED_MODULE_5__["a"];
|
|
979
|
+
});
|
|
980
|
+
/***/
|
|
981
|
+
|
|
982
|
+
}
|
|
983
|
+
/******/
|
|
984
|
+
]);
|
|
985
|
+
|
|
986
|
+
/***/ }),
|
|
987
|
+
/* 2 */
|
|
988
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
989
|
+
|
|
990
|
+
"use strict";
|
|
991
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Cell; });
|
|
992
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
993
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
994
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
995
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__);
|
|
996
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
|
|
997
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__);
|
|
998
|
+
/* harmony import */ var _util_styles_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
999
|
+
/* harmony import */ var _util_utils_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7);
|
|
526
1000
|
|
|
527
1001
|
|
|
528
1002
|
|
|
@@ -545,7 +1019,7 @@ const flexBasis = size => {
|
|
|
545
1019
|
* `cols` props then the component will only be shown at those grid sizes and
|
|
546
1020
|
* using the specified column width.
|
|
547
1021
|
*/
|
|
548
|
-
class
|
|
1022
|
+
class Cell extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
549
1023
|
static isClassOf(instance) {
|
|
550
1024
|
return instance && instance.type && instance.type.__IS_CELL__;
|
|
551
1025
|
}
|
|
@@ -577,7 +1051,7 @@ class cell_Cell extends external_react_["Component"] {
|
|
|
577
1051
|
|
|
578
1052
|
|
|
579
1053
|
static shouldDisplay(props, mediaSize) {
|
|
580
|
-
const cols =
|
|
1054
|
+
const cols = Cell.getCols(props, mediaSize);
|
|
581
1055
|
return cols !== null && cols !== 0;
|
|
582
1056
|
}
|
|
583
1057
|
|
|
@@ -586,7 +1060,7 @@ class cell_Cell extends external_react_["Component"] {
|
|
|
586
1060
|
children,
|
|
587
1061
|
style
|
|
588
1062
|
} = this.props;
|
|
589
|
-
return /*#__PURE__*/
|
|
1063
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__["MediaLayout"], null, ({
|
|
590
1064
|
mediaSize,
|
|
591
1065
|
mediaSpec
|
|
592
1066
|
}) => {
|
|
@@ -602,7 +1076,7 @@ class cell_Cell extends external_react_["Component"] {
|
|
|
602
1076
|
gutterWidth,
|
|
603
1077
|
marginWidth
|
|
604
1078
|
} = spec;
|
|
605
|
-
const cols =
|
|
1079
|
+
const cols = Cell.getCols(this.props, mediaSize); // If no columns are specified then we just don't render this cell
|
|
606
1080
|
|
|
607
1081
|
if (cols === undefined || cols === null || cols === 0) {
|
|
608
1082
|
return null;
|
|
@@ -634,68 +1108,77 @@ class cell_Cell extends external_react_["Component"] {
|
|
|
634
1108
|
}) : children; // Render a fixed-width cell (flex-basis: size, flex-shrink: 0)
|
|
635
1109
|
// that matches the intended width of the cell
|
|
636
1110
|
|
|
637
|
-
return /*#__PURE__*/
|
|
638
|
-
style: [
|
|
1111
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__["View"], {
|
|
1112
|
+
style: [_util_styles_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].cellFixed, Object(_util_utils_js__WEBPACK_IMPORTED_MODULE_4__[/* flexBasis */ "a"])(calcWidth), style]
|
|
639
1113
|
}, contents);
|
|
640
1114
|
});
|
|
641
1115
|
}
|
|
642
1116
|
|
|
643
1117
|
}
|
|
644
|
-
|
|
1118
|
+
Cell.defaultProps = {
|
|
645
1119
|
smallCols: 0,
|
|
646
1120
|
mediumCols: 0,
|
|
647
1121
|
largeCols: 0,
|
|
648
1122
|
cols: 0
|
|
649
1123
|
};
|
|
650
|
-
|
|
651
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-grid/src/components/gutter.js
|
|
1124
|
+
Cell.__IS_CELL__ = true;
|
|
652
1125
|
|
|
1126
|
+
/***/ }),
|
|
1127
|
+
/* 3 */
|
|
1128
|
+
/***/ (function(module, exports) {
|
|
653
1129
|
|
|
1130
|
+
module.exports = require("@khanacademy/wonder-blocks-core");
|
|
654
1131
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
* itself doesn't hold any content, it just spaces it out.
|
|
659
|
-
*
|
|
660
|
-
* Gutters are inserted automatically inside of a [Row](#row) in-between Cells.
|
|
661
|
-
* You may only need to use Gutters if you're manually building your own
|
|
662
|
-
* sub-grid, or some-such (this should be relatively rare).
|
|
663
|
-
*
|
|
664
|
-
* By default (with no properties specified) it will display at all
|
|
665
|
-
* grid sizes. If you specify the `small`, `medium`, or `large`
|
|
666
|
-
* props then the component will only be shown at those grid sizes.
|
|
667
|
-
*/
|
|
668
|
-
class gutter_Gutter extends external_react_["Component"] {
|
|
669
|
-
render() {
|
|
670
|
-
return /*#__PURE__*/external_react_["createElement"](es_MediaLayout, null, ({
|
|
671
|
-
mediaSize,
|
|
672
|
-
mediaSpec
|
|
673
|
-
}) => {
|
|
674
|
-
const spec = mediaSpec[mediaSize];
|
|
1132
|
+
/***/ }),
|
|
1133
|
+
/* 4 */
|
|
1134
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
675
1135
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
1136
|
+
"use strict";
|
|
1137
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
1138
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_0__);
|
|
679
1139
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
1140
|
+
const WIDE_SCREEN = "@media (min-width: 1168px)";
|
|
1141
|
+
const styles = aphrodite__WEBPACK_IMPORTED_MODULE_0__["StyleSheet"].create({
|
|
1142
|
+
row: {
|
|
1143
|
+
flexDirection: "row",
|
|
1144
|
+
alignItems: "center",
|
|
1145
|
+
width: "100%"
|
|
1146
|
+
},
|
|
1147
|
+
rowMaxWidth: {
|
|
1148
|
+
[WIDE_SCREEN]: {
|
|
1149
|
+
margin: "0 auto"
|
|
1150
|
+
}
|
|
1151
|
+
},
|
|
1152
|
+
cellGrow: {
|
|
1153
|
+
flexGrow: 1
|
|
1154
|
+
},
|
|
1155
|
+
cellFixed: {
|
|
1156
|
+
flexShrink: 0
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
/* harmony default export */ __webpack_exports__["a"] = (styles);
|
|
683
1160
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
1161
|
+
/***/ }),
|
|
1162
|
+
/* 5 */
|
|
1163
|
+
/***/ (function(module, exports) {
|
|
687
1164
|
|
|
688
|
-
|
|
689
|
-
size: gutterWidth
|
|
690
|
-
});
|
|
691
|
-
});
|
|
692
|
-
}
|
|
1165
|
+
module.exports = require("aphrodite");
|
|
693
1166
|
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
1167
|
+
/***/ }),
|
|
1168
|
+
/* 6 */
|
|
1169
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1170
|
+
|
|
1171
|
+
"use strict";
|
|
1172
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Row; });
|
|
1173
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
1174
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1175
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
1176
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
1177
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1);
|
|
1178
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__);
|
|
1179
|
+
/* harmony import */ var _util_styles_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(4);
|
|
1180
|
+
/* harmony import */ var _gutter_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(8);
|
|
1181
|
+
/* harmony import */ var _cell_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
|
|
699
1182
|
|
|
700
1183
|
|
|
701
1184
|
|
|
@@ -721,13 +1204,13 @@ gutter_Gutter.defaultProps = {
|
|
|
721
1204
|
* grid sizes. If you specify the `small`, `medium`, or `large`
|
|
722
1205
|
* props then the component will only be shown at those grid sizes.
|
|
723
1206
|
*/
|
|
724
|
-
class
|
|
1207
|
+
class Row extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
725
1208
|
render() {
|
|
726
1209
|
const {
|
|
727
1210
|
style,
|
|
728
1211
|
children
|
|
729
1212
|
} = this.props;
|
|
730
|
-
return /*#__PURE__*/
|
|
1213
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__["MediaLayout"], null, ({
|
|
731
1214
|
mediaSize,
|
|
732
1215
|
mediaSpec
|
|
733
1216
|
}) => {
|
|
@@ -742,7 +1225,7 @@ class row_Row extends external_react_["Component"] {
|
|
|
742
1225
|
maxWidth,
|
|
743
1226
|
totalColumns
|
|
744
1227
|
} = spec;
|
|
745
|
-
const shouldDisplay = queryMatchesSize(this.props.mediaQuery, mediaSize); // Don't render the row if it's been disabled at this size
|
|
1228
|
+
const shouldDisplay = Object(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__["queryMatchesSize"])(this.props.mediaQuery, mediaSize); // Don't render the row if it's been disabled at this size
|
|
746
1229
|
|
|
747
1230
|
if (!shouldDisplay) {
|
|
748
1231
|
return null;
|
|
@@ -754,34 +1237,126 @@ class row_Row extends external_react_["Component"] {
|
|
|
754
1237
|
mediaSize,
|
|
755
1238
|
totalColumns
|
|
756
1239
|
}) : children;
|
|
757
|
-
const filteredContents =
|
|
1240
|
+
const filteredContents = react__WEBPACK_IMPORTED_MODULE_0__["Children"].toArray(contents) // Go through all of the contents and pre-emptively remove anything
|
|
1241
|
+
// that shouldn't be rendered.
|
|
1242
|
+
.filter( // Flow doesn't let us check .type on a non-null React.Node so
|
|
758
1243
|
// we have to cast it to any.
|
|
759
|
-
item =>
|
|
760
|
-
.reduce((acc, elem, index) => [].concat(acc, [elem, /*#__PURE__*/
|
|
1244
|
+
item => _cell_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].isClassOf(item) ? _cell_js__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].shouldDisplay(item.props, mediaSize) : true) // Intersperse Gutter elements between the cells.
|
|
1245
|
+
.reduce((acc, elem, index) => [].concat(acc, [elem, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_gutter_js__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"], {
|
|
761
1246
|
key: `gutter-${index}`
|
|
762
1247
|
})]), []) // We only want gutters between each cell in the row. The reduce
|
|
763
1248
|
// adds a gutter after every cell so we need to remove the last
|
|
764
1249
|
// element which is an unnecessary gutteer.
|
|
765
1250
|
.slice(0, -1);
|
|
766
|
-
return /*#__PURE__*/
|
|
767
|
-
style: [
|
|
1251
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__["View"], {
|
|
1252
|
+
style: [_util_styles_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].row, !!maxWidth && _util_styles_js__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].rowMaxWidth, !!maxWidth && {
|
|
768
1253
|
maxWidth
|
|
769
1254
|
}, style]
|
|
770
|
-
}, /*#__PURE__*/
|
|
1255
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__["Strut"], {
|
|
771
1256
|
size: marginWidth
|
|
772
|
-
}), filteredContents, /*#__PURE__*/
|
|
1257
|
+
}), filteredContents, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_2__["Strut"], {
|
|
773
1258
|
size: marginWidth
|
|
774
1259
|
}));
|
|
775
1260
|
});
|
|
776
1261
|
}
|
|
777
1262
|
|
|
778
1263
|
}
|
|
779
|
-
|
|
1264
|
+
Row.defaultProps = {
|
|
1265
|
+
mediaQuery: "all"
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1268
|
+
/***/ }),
|
|
1269
|
+
/* 7 */
|
|
1270
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1271
|
+
|
|
1272
|
+
"use strict";
|
|
1273
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return flexBasis; });
|
|
1274
|
+
const flexBasis = size => {
|
|
1275
|
+
return {
|
|
1276
|
+
MsFlexBasis: size,
|
|
1277
|
+
MsFlexPreferredSize: size,
|
|
1278
|
+
WebkitFlexBasis: size,
|
|
1279
|
+
flexBasis: size
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
/***/ }),
|
|
1284
|
+
/* 8 */
|
|
1285
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1286
|
+
|
|
1287
|
+
"use strict";
|
|
1288
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Gutter; });
|
|
1289
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
1290
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
1291
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1);
|
|
1292
|
+
/* harmony import */ var _khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__);
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* Gutter is a component whose width is set based on the size of grid currently
|
|
1298
|
+
* being displayed. Used for spacing out cells from each other. The gutter
|
|
1299
|
+
* itself doesn't hold any content, it just spaces it out.
|
|
1300
|
+
*
|
|
1301
|
+
* Gutters are inserted automatically inside of a [Row](#row) in-between Cells.
|
|
1302
|
+
* You may only need to use Gutters if you're manually building your own
|
|
1303
|
+
* sub-grid, or some-such (this should be relatively rare).
|
|
1304
|
+
*
|
|
1305
|
+
* By default (with no properties specified) it will display at all
|
|
1306
|
+
* grid sizes. If you specify the `small`, `medium`, or `large`
|
|
1307
|
+
* props then the component will only be shown at those grid sizes.
|
|
1308
|
+
*/
|
|
1309
|
+
class Gutter extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
1310
|
+
render() {
|
|
1311
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__["MediaLayout"], null, ({
|
|
1312
|
+
mediaSize,
|
|
1313
|
+
mediaSpec
|
|
1314
|
+
}) => {
|
|
1315
|
+
const spec = mediaSpec[mediaSize];
|
|
1316
|
+
|
|
1317
|
+
if (!spec) {
|
|
1318
|
+
throw new Error(`mediaSpec.${mediaSize} is undefined`);
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
const {
|
|
1322
|
+
gutterWidth
|
|
1323
|
+
} = spec;
|
|
1324
|
+
|
|
1325
|
+
if (!Object(_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__["queryMatchesSize"])(this.props.mediaQuery, mediaSize)) {
|
|
1326
|
+
return null;
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_layout__WEBPACK_IMPORTED_MODULE_1__["Strut"], {
|
|
1330
|
+
size: gutterWidth
|
|
1331
|
+
});
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
}
|
|
1336
|
+
Gutter.defaultProps = {
|
|
780
1337
|
mediaQuery: "all"
|
|
781
1338
|
};
|
|
782
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-grid/src/index.js
|
|
783
1339
|
|
|
1340
|
+
/***/ }),
|
|
1341
|
+
/* 9 */
|
|
1342
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1343
|
+
|
|
1344
|
+
"use strict";
|
|
1345
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1346
|
+
/* harmony import */ var _components_cell_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
|
1347
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Cell", function() { return _components_cell_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
|
|
1348
|
+
|
|
1349
|
+
/* harmony import */ var _components_row_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6);
|
|
1350
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Row", function() { return _components_row_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
|
|
784
1351
|
|
|
785
1352
|
|
|
1353
|
+
|
|
1354
|
+
|
|
1355
|
+
/***/ }),
|
|
1356
|
+
/* 10 */
|
|
1357
|
+
/***/ (function(module, exports) {
|
|
1358
|
+
|
|
1359
|
+
module.exports = require("@khanacademy/wonder-blocks-spacing");
|
|
1360
|
+
|
|
786
1361
|
/***/ })
|
|
787
1362
|
/******/ ]);
|