@khanacademy/wonder-blocks-layout 1.4.2 → 1.4.6
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 +164 -528
- package/dist/index.js +264 -408
- package/package.json +7 -6
- package/src/components/media-layout.js +2 -3
- package/src/components/spring.stories.js +8 -12
- package/src/components/strut.stories.js +8 -12
- package/src/__tests__/index.test.js +0 -25
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 = 10);
|
|
86
86
|
/******/ })
|
|
87
87
|
/************************************************************************/
|
|
88
88
|
/******/ ([
|
|
@@ -99,166 +99,110 @@ module.exports = require("@khanacademy/wonder-blocks-spacing");
|
|
|
99
99
|
|
|
100
100
|
/***/ }),
|
|
101
101
|
/* 2 */
|
|
102
|
-
/***/ (function(module, exports) {
|
|
103
|
-
|
|
104
|
-
module.exports = require("@khanacademy/wonder-blocks-core");
|
|
105
|
-
|
|
106
|
-
/***/ }),
|
|
107
|
-
/* 3 */
|
|
108
|
-
/***/ (function(module, exports) {
|
|
109
|
-
|
|
110
|
-
module.exports = require("aphrodite");
|
|
111
|
-
|
|
112
|
-
/***/ }),
|
|
113
|
-
/* 4 */
|
|
114
102
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
115
103
|
|
|
116
104
|
"use strict";
|
|
117
|
-
|
|
118
|
-
__webpack_require__.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
__webpack_require__.d(__webpack_exports__, "Spring", function() { return /* reexport */ spring_Spring; });
|
|
124
|
-
__webpack_require__.d(__webpack_exports__, "Strut", function() { return /* reexport */ strut_Strut; });
|
|
125
|
-
__webpack_require__.d(__webpack_exports__, "VALID_MEDIA_SIZES", function() { return /* reexport */ VALID_MEDIA_SIZES; });
|
|
126
|
-
__webpack_require__.d(__webpack_exports__, "MEDIA_DEFAULT_SPEC", function() { return /* reexport */ MEDIA_DEFAULT_SPEC; });
|
|
127
|
-
__webpack_require__.d(__webpack_exports__, "MEDIA_INTERNAL_SPEC", function() { return /* reexport */ MEDIA_INTERNAL_SPEC; });
|
|
128
|
-
__webpack_require__.d(__webpack_exports__, "MEDIA_MODAL_SPEC", function() { return /* reexport */ MEDIA_MODAL_SPEC; });
|
|
129
|
-
__webpack_require__.d(__webpack_exports__, "queryMatchesSize", function() { return /* reexport */ queryMatchesSize; });
|
|
130
|
-
|
|
131
|
-
// EXTERNAL MODULE: external "react"
|
|
132
|
-
var external_react_ = __webpack_require__(0);
|
|
133
|
-
|
|
134
|
-
// EXTERNAL MODULE: external "@khanacademy/wonder-blocks-spacing"
|
|
135
|
-
var wonder_blocks_spacing_ = __webpack_require__(1);
|
|
136
|
-
var wonder_blocks_spacing_default = /*#__PURE__*/__webpack_require__.n(wonder_blocks_spacing_);
|
|
137
|
-
|
|
138
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-layout/src/util/specs.js
|
|
105
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return VALID_MEDIA_SIZES; });
|
|
106
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MEDIA_DEFAULT_SPEC; });
|
|
107
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MEDIA_INTERNAL_SPEC; });
|
|
108
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return MEDIA_MODAL_SPEC; });
|
|
109
|
+
/* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
|
110
|
+
/* harmony import */ var _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0__);
|
|
139
111
|
|
|
140
112
|
// All possible valid media sizes
|
|
141
|
-
|
|
142
|
-
|
|
113
|
+
const VALID_MEDIA_SIZES = ["small", "medium", "large"];
|
|
114
|
+
const mediaDefaultSpecLargeMarginWidth = _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.large_24; // The default spec for media layout, currently available in
|
|
143
115
|
// three different settings (roughly mobile, tablet, and desktop).
|
|
144
116
|
|
|
145
|
-
|
|
117
|
+
const MEDIA_DEFAULT_SPEC = {
|
|
146
118
|
small: {
|
|
147
119
|
query: "(max-width: 767px)",
|
|
148
120
|
totalColumns: 4,
|
|
149
|
-
gutterWidth:
|
|
150
|
-
marginWidth:
|
|
121
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16,
|
|
122
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
151
123
|
},
|
|
152
124
|
medium: {
|
|
153
125
|
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
154
126
|
totalColumns: 8,
|
|
155
|
-
gutterWidth:
|
|
156
|
-
marginWidth:
|
|
127
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
128
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.large_24
|
|
157
129
|
},
|
|
158
130
|
large: {
|
|
159
131
|
query: "(min-width: 1024px)",
|
|
160
132
|
totalColumns: 12,
|
|
161
|
-
gutterWidth:
|
|
133
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
162
134
|
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
163
135
|
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
164
136
|
}
|
|
165
137
|
}; // Used for internal tools
|
|
166
138
|
|
|
167
|
-
|
|
139
|
+
const MEDIA_INTERNAL_SPEC = {
|
|
168
140
|
large: {
|
|
169
141
|
query: "(min-width: 1px)",
|
|
170
142
|
totalColumns: 12,
|
|
171
|
-
gutterWidth:
|
|
172
|
-
marginWidth:
|
|
143
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
144
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
173
145
|
}
|
|
174
146
|
}; // The default used for modals
|
|
175
147
|
|
|
176
|
-
|
|
148
|
+
const MEDIA_MODAL_SPEC = {
|
|
177
149
|
small: {
|
|
178
150
|
query: "(max-width: 767px)",
|
|
179
151
|
totalColumns: 4,
|
|
180
|
-
gutterWidth:
|
|
181
|
-
marginWidth:
|
|
152
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16,
|
|
153
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.medium_16
|
|
182
154
|
},
|
|
183
155
|
large: {
|
|
184
156
|
query: "(min-width: 768px)",
|
|
185
157
|
totalColumns: 12,
|
|
186
|
-
gutterWidth:
|
|
187
|
-
marginWidth:
|
|
158
|
+
gutterWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xLarge_32,
|
|
159
|
+
marginWidth: _khanacademy_wonder_blocks_spacing__WEBPACK_IMPORTED_MODULE_0___default.a.xxLarge_48
|
|
188
160
|
}
|
|
189
161
|
};
|
|
190
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-layout/src/components/media-layout-context.js
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
var defaultContext = {
|
|
194
|
-
ssrSize: "large",
|
|
195
|
-
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
196
|
-
};
|
|
197
|
-
/* harmony default export */ var media_layout_context = (external_react_["createContext"](defaultContext));
|
|
198
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-layout/src/components/media-layout.js
|
|
199
|
-
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); }
|
|
200
|
-
|
|
201
|
-
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); }
|
|
202
|
-
|
|
203
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
204
|
-
|
|
205
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
206
|
-
|
|
207
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
208
|
-
|
|
209
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
210
|
-
|
|
211
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
212
|
-
|
|
213
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
214
|
-
|
|
215
|
-
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); } }
|
|
216
|
-
|
|
217
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
218
|
-
|
|
219
|
-
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); }
|
|
220
|
-
|
|
221
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
222
|
-
|
|
223
|
-
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); }; }
|
|
224
|
-
|
|
225
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
226
|
-
|
|
227
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
228
162
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
163
|
+
/***/ }),
|
|
164
|
+
/* 3 */
|
|
165
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
232
166
|
|
|
233
|
-
|
|
167
|
+
"use strict";
|
|
168
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
169
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
170
|
+
/* harmony import */ var _util_specs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
|
234
171
|
|
|
235
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
236
172
|
|
|
237
|
-
|
|
173
|
+
const defaultContext = {
|
|
174
|
+
ssrSize: "large",
|
|
175
|
+
mediaSpec: _util_specs_js__WEBPACK_IMPORTED_MODULE_1__[/* MEDIA_DEFAULT_SPEC */ "a"]
|
|
176
|
+
};
|
|
177
|
+
/* harmony default export */ __webpack_exports__["a"] = (/*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createContext"](defaultContext));
|
|
238
178
|
|
|
239
|
-
|
|
179
|
+
/***/ }),
|
|
180
|
+
/* 4 */
|
|
181
|
+
/***/ (function(module, exports) {
|
|
240
182
|
|
|
241
|
-
|
|
183
|
+
module.exports = require("@khanacademy/wonder-blocks-core");
|
|
242
184
|
|
|
243
|
-
|
|
185
|
+
/***/ }),
|
|
186
|
+
/* 5 */
|
|
187
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
244
188
|
|
|
245
|
-
|
|
189
|
+
"use strict";
|
|
190
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MediaLayout; });
|
|
191
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
192
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
193
|
+
/* harmony import */ var _media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
194
|
+
/* harmony import */ var _util_specs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2);
|
|
195
|
+
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); }
|
|
246
196
|
|
|
247
197
|
|
|
248
198
|
|
|
249
199
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
})), _toConsumableArray(Object.values(MEDIA_INTERNAL_SPEC).map(function (spec) {
|
|
253
|
-
return spec.query;
|
|
254
|
-
})), _toConsumableArray(Object.values(MEDIA_MODAL_SPEC).map(function (spec) {
|
|
255
|
-
return spec.query;
|
|
256
|
-
})));
|
|
257
|
-
var mediaQueryLists = {}; // eslint-disable-next-line flowtype/require-exact-type
|
|
200
|
+
const queries = [].concat(Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[/* MEDIA_DEFAULT_SPEC */ "a"]).map(spec => spec.query), Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[/* MEDIA_INTERNAL_SPEC */ "b"]).map(spec => spec.query), Object.values(_util_specs_js__WEBPACK_IMPORTED_MODULE_2__[/* MEDIA_MODAL_SPEC */ "c"]).map(spec => spec.query));
|
|
201
|
+
const mediaQueryLists = {}; // eslint-disable-next-line flowtype/require-exact-type
|
|
258
202
|
|
|
259
203
|
// If for some reason we're not able to resolve the current media size we
|
|
260
204
|
// fall back to this state.
|
|
261
|
-
|
|
205
|
+
const DEFAULT_SIZE = "large";
|
|
262
206
|
|
|
263
207
|
/**
|
|
264
208
|
* `MediaLayout` is responsible for changing the rendering of contents at
|
|
@@ -266,268 +210,179 @@ var DEFAULT_SIZE = "large";
|
|
|
266
210
|
* to specify different breakpoint configurations. By default it uses
|
|
267
211
|
* `MEDIA_DEFAULT_SPEC`. See media-layout-context.js for additiional options.
|
|
268
212
|
*/
|
|
269
|
-
|
|
270
|
-
_inherits(MediaLayoutInternal, _React$Component);
|
|
271
|
-
|
|
272
|
-
var _super = _createSuper(MediaLayoutInternal);
|
|
273
|
-
|
|
213
|
+
class MediaLayoutInternal extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
274
214
|
// A collection of thunks that's used to clean up event listeners
|
|
275
215
|
// when the component is unmounted.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
_classCallCheck(this, MediaLayoutInternal);
|
|
280
|
-
|
|
281
|
-
_this = _super.call(this, props);
|
|
282
|
-
|
|
283
|
-
_defineProperty(_assertThisInitialized(_this), "cleanupThunks", void 0);
|
|
284
|
-
|
|
285
|
-
_this.state = {
|
|
216
|
+
constructor(props) {
|
|
217
|
+
super(props);
|
|
218
|
+
this.state = {
|
|
286
219
|
size: undefined
|
|
287
220
|
};
|
|
288
|
-
|
|
289
|
-
return _this;
|
|
221
|
+
this.cleanupThunks = [];
|
|
290
222
|
}
|
|
291
223
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
var _this2 = this;
|
|
224
|
+
componentDidMount() {
|
|
225
|
+
// TODO(WB-534): handle changes to mediaSpec prop
|
|
226
|
+
const entries = Object.entries(this.props.mediaSpec);
|
|
296
227
|
|
|
297
|
-
|
|
298
|
-
|
|
228
|
+
for (const [size, spec] of entries) {
|
|
229
|
+
const mql = mediaQueryLists[spec.query]; // during SSR there are no MediaQueryLists
|
|
299
230
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
spec = _entries$_i[1];
|
|
304
|
-
|
|
305
|
-
var mql = mediaQueryLists[spec.query]; // during SSR there are no MediaQueryLists
|
|
231
|
+
if (!mql) {
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
306
234
|
|
|
307
|
-
|
|
308
|
-
|
|
235
|
+
const listener = e => {
|
|
236
|
+
if (e.matches) {
|
|
237
|
+
this.setState({
|
|
238
|
+
size
|
|
239
|
+
});
|
|
309
240
|
}
|
|
310
|
-
|
|
311
|
-
var listener = function listener(e) {
|
|
312
|
-
if (e.matches) {
|
|
313
|
-
_this2.setState({
|
|
314
|
-
size: size
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
mql.addListener(listener);
|
|
320
|
-
|
|
321
|
-
_this2.cleanupThunks.push(function () {
|
|
322
|
-
return mql.removeListener(listener);
|
|
323
|
-
});
|
|
324
241
|
};
|
|
325
242
|
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
if (_ret === "continue") continue;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}, {
|
|
333
|
-
key: "componentWillUnmount",
|
|
334
|
-
value: function componentWillUnmount() {
|
|
335
|
-
// Remove our listeners.
|
|
336
|
-
this.cleanupThunks.forEach(function (cleaup) {
|
|
337
|
-
return cleaup();
|
|
338
|
-
});
|
|
243
|
+
mql.addListener(listener);
|
|
244
|
+
this.cleanupThunks.push(() => mql.removeListener(listener));
|
|
339
245
|
}
|
|
340
|
-
}
|
|
341
|
-
key: "getCurrentSize",
|
|
342
|
-
value: function getCurrentSize(spec) {
|
|
343
|
-
// If we have a state with the current size in it then we always want
|
|
344
|
-
// to use that. This will happen if the viewport changes sizes after
|
|
345
|
-
// we've already initialized.
|
|
346
|
-
if (this.state.size) {
|
|
347
|
-
return this.state.size;
|
|
348
|
-
} else {
|
|
349
|
-
var entries = Object.entries(this.props.mediaSpec);
|
|
350
|
-
|
|
351
|
-
for (var _i2 = 0, _entries2 = entries; _i2 < _entries2.length; _i2++) {
|
|
352
|
-
var _entries2$_i = _slicedToArray(_entries2[_i2], 2),
|
|
353
|
-
size = _entries2$_i[0],
|
|
354
|
-
_spec = _entries2$_i[1];
|
|
355
|
-
|
|
356
|
-
var mql = mediaQueryLists[_spec.query];
|
|
357
|
-
|
|
358
|
-
if (mql.matches) {
|
|
359
|
-
return size;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
return DEFAULT_SIZE;
|
|
365
|
-
} // We assume that we're running on the server (or, at least, an unsupported
|
|
366
|
-
// environment) if there is no window object or matchMedia function
|
|
367
|
-
// available.
|
|
368
|
-
|
|
369
|
-
}, {
|
|
370
|
-
key: "isServerSide",
|
|
371
|
-
value: function isServerSide() {
|
|
372
|
-
return typeof window === "undefined" || !window.matchMedia;
|
|
373
|
-
} // Generate a mock Aphrodite StyleSheet based upon the current mediaSize
|
|
374
|
-
// We do this by looking at all of the stylesheets specified in the
|
|
375
|
-
// styleSheets prop and then all of the individual styles. We merge the
|
|
376
|
-
// styles together
|
|
377
|
-
// TODO(WB-533): move to util.js to make it easier to test
|
|
378
|
-
|
|
379
|
-
}, {
|
|
380
|
-
key: "getMockStyleSheet",
|
|
381
|
-
value: function getMockStyleSheet(mediaSize) {
|
|
382
|
-
var styleSheets = this.props.styleSheets;
|
|
383
|
-
var mockStyleSheet = {}; // If no stylesheets were specified then we just return an empty object
|
|
384
|
-
|
|
385
|
-
if (!styleSheets) {
|
|
386
|
-
return mockStyleSheet;
|
|
387
|
-
} // Go through all of the stylesheets that were specified
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
for (var _i3 = 0, _Object$keys = Object.keys(styleSheets); _i3 < _Object$keys.length; _i3++) {
|
|
391
|
-
var styleSize = _Object$keys[_i3];
|
|
392
|
-
var styleSheet = styleSheets[styleSize];
|
|
393
|
-
|
|
394
|
-
if (!styleSheet) {
|
|
395
|
-
continue;
|
|
396
|
-
} // And then through each key of each stylesheet
|
|
397
|
-
|
|
246
|
+
}
|
|
398
247
|
|
|
399
|
-
|
|
400
|
-
|
|
248
|
+
componentWillUnmount() {
|
|
249
|
+
// Remove our listeners.
|
|
250
|
+
this.cleanupThunks.forEach(cleaup => cleaup());
|
|
251
|
+
}
|
|
401
252
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
253
|
+
getCurrentSize(spec) {
|
|
254
|
+
// If we have a state with the current size in it then we always want
|
|
255
|
+
// to use that. This will happen if the viewport changes sizes after
|
|
256
|
+
// we've already initialized.
|
|
257
|
+
if (this.state.size) {
|
|
258
|
+
return this.state.size;
|
|
259
|
+
} else {
|
|
260
|
+
const entries = Object.entries(this.props.mediaSpec);
|
|
409
261
|
|
|
262
|
+
for (const [size, spec] of entries) {
|
|
263
|
+
const mql = mediaQueryLists[spec.query];
|
|
410
264
|
|
|
411
|
-
|
|
265
|
+
if (mql.matches) {
|
|
266
|
+
return size;
|
|
412
267
|
}
|
|
413
268
|
}
|
|
414
|
-
|
|
415
|
-
return mockStyleSheet;
|
|
416
269
|
}
|
|
417
|
-
}, {
|
|
418
|
-
key: "render",
|
|
419
|
-
value: function render() {
|
|
420
|
-
var _this$props = this.props,
|
|
421
|
-
children = _this$props.children,
|
|
422
|
-
mediaSpec = _this$props.mediaSpec,
|
|
423
|
-
ssrSize = _this$props.ssrSize,
|
|
424
|
-
overrideSize = _this$props.overrideSize; // We need to create the MediaQueryLists during the first render in order
|
|
425
|
-
// to query whether any of them match.
|
|
426
|
-
|
|
427
|
-
if (!this.isServerSide()) {
|
|
428
|
-
var _iterator = _createForOfIteratorHelper(queries.filter(function (query) {
|
|
429
|
-
return !mediaQueryLists[query];
|
|
430
|
-
})),
|
|
431
|
-
_step;
|
|
432
|
-
|
|
433
|
-
try {
|
|
434
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
435
|
-
var query = _step.value;
|
|
436
|
-
mediaQueryLists[query] = window.matchMedia(query);
|
|
437
|
-
}
|
|
438
|
-
} catch (err) {
|
|
439
|
-
_iterator.e(err);
|
|
440
|
-
} finally {
|
|
441
|
-
_iterator.f();
|
|
442
|
-
}
|
|
443
|
-
} // We need to figure out what the current media size is
|
|
444
|
-
// If an override has been specified, we use that.
|
|
445
|
-
// If we're rendering on the server then we use the default
|
|
446
|
-
// SSR rendering size.
|
|
447
|
-
// Otherwise we attempt to get the current size based on
|
|
448
|
-
// the current MediaSpec.
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
var mediaSize = overrideSize || this.isServerSide() && ssrSize || this.getCurrentSize(mediaSpec); // Generate a mock stylesheet
|
|
452
|
-
|
|
453
|
-
var styles = this.getMockStyleSheet(mediaSize);
|
|
454
|
-
return children({
|
|
455
|
-
mediaSize: mediaSize,
|
|
456
|
-
mediaSpec: mediaSpec,
|
|
457
|
-
styles: styles
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
}]);
|
|
461
|
-
|
|
462
|
-
return MediaLayoutInternal;
|
|
463
|
-
}(external_react_["Component"]); // gen-snapshot-tests.js only understands `export default class ...`
|
|
464
270
|
|
|
271
|
+
return DEFAULT_SIZE;
|
|
272
|
+
} // We assume that we're running on the server (or, at least, an unsupported
|
|
273
|
+
// environment) if there is no window object or matchMedia function
|
|
274
|
+
// available.
|
|
465
275
|
|
|
466
|
-
var media_layout_MediaLayout = /*#__PURE__*/function (_React$Component2) {
|
|
467
|
-
_inherits(MediaLayout, _React$Component2);
|
|
468
|
-
|
|
469
|
-
var _super2 = _createSuper(MediaLayout);
|
|
470
|
-
|
|
471
|
-
function MediaLayout() {
|
|
472
|
-
_classCallCheck(this, MediaLayout);
|
|
473
|
-
|
|
474
|
-
return _super2.apply(this, arguments);
|
|
475
|
-
}
|
|
476
276
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
// a MediaLayoutContext.Consumer).
|
|
485
|
-
return /*#__PURE__*/external_react_["createElement"](media_layout_context.Consumer, null, function (_ref) {
|
|
486
|
-
var overrideSize = _ref.overrideSize,
|
|
487
|
-
ssrSize = _ref.ssrSize,
|
|
488
|
-
mediaSpec = _ref.mediaSpec;
|
|
489
|
-
return /*#__PURE__*/external_react_["createElement"](MediaLayoutInternal, _extends({}, _this3.props, {
|
|
490
|
-
overrideSize: overrideSize,
|
|
491
|
-
ssrSize: ssrSize,
|
|
492
|
-
mediaSpec: mediaSpec
|
|
493
|
-
}));
|
|
494
|
-
});
|
|
495
|
-
}
|
|
496
|
-
}]);
|
|
277
|
+
isServerSide() {
|
|
278
|
+
return typeof window === "undefined" || !window.matchMedia;
|
|
279
|
+
} // Generate a mock Aphrodite StyleSheet based upon the current mediaSize
|
|
280
|
+
// We do this by looking at all of the stylesheets specified in the
|
|
281
|
+
// styleSheets prop and then all of the individual styles. We merge the
|
|
282
|
+
// styles together
|
|
283
|
+
// TODO(WB-533): move to util.js to make it easier to test
|
|
497
284
|
|
|
498
|
-
return MediaLayout;
|
|
499
|
-
}(external_react_["Component"]);
|
|
500
285
|
|
|
286
|
+
getMockStyleSheet(mediaSize) {
|
|
287
|
+
const {
|
|
288
|
+
styleSheets
|
|
289
|
+
} = this.props;
|
|
290
|
+
const mockStyleSheet = {}; // If no stylesheets were specified then we just return an empty object
|
|
501
291
|
|
|
502
|
-
|
|
503
|
-
|
|
292
|
+
if (!styleSheets) {
|
|
293
|
+
return mockStyleSheet;
|
|
294
|
+
} // Go through all of the stylesheets that were specified
|
|
504
295
|
|
|
505
|
-
// EXTERNAL MODULE: external "@khanacademy/wonder-blocks-core"
|
|
506
|
-
var wonder_blocks_core_ = __webpack_require__(2);
|
|
507
296
|
|
|
508
|
-
|
|
509
|
-
|
|
297
|
+
for (const styleSize of Object.keys(styleSheets)) {
|
|
298
|
+
const styleSheet = styleSheets[styleSize];
|
|
510
299
|
|
|
511
|
-
|
|
300
|
+
if (!styleSheet) {
|
|
301
|
+
continue;
|
|
302
|
+
} // And then through each key of each stylesheet
|
|
512
303
|
|
|
513
|
-
function spring_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); } }
|
|
514
304
|
|
|
515
|
-
|
|
305
|
+
for (const name of Object.keys(styleSheet)) {
|
|
306
|
+
if ( // $FlowIgnore[method-unbinding]
|
|
307
|
+
Object.prototype.hasOwnProperty.call(mockStyleSheet, name)) {
|
|
308
|
+
continue;
|
|
309
|
+
} // We create an entry that combines the values from all of
|
|
310
|
+
// the stylesheets together in least-specific to most-specific
|
|
311
|
+
// priority (thus small/medium/large styles will always have
|
|
312
|
+
// precedence over "all" or mdOrSmaller/mdOrLarger/etc.).
|
|
516
313
|
|
|
517
|
-
function spring_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) spring_setPrototypeOf(subClass, superClass); }
|
|
518
314
|
|
|
519
|
-
|
|
315
|
+
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]]];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
520
318
|
|
|
521
|
-
|
|
319
|
+
return mockStyleSheet;
|
|
320
|
+
}
|
|
522
321
|
|
|
523
|
-
|
|
322
|
+
render() {
|
|
323
|
+
const {
|
|
324
|
+
children,
|
|
325
|
+
mediaSpec,
|
|
326
|
+
ssrSize,
|
|
327
|
+
overrideSize
|
|
328
|
+
} = this.props; // We need to create the MediaQueryLists during the first render in order
|
|
329
|
+
// to query whether any of them match.
|
|
330
|
+
|
|
331
|
+
if (!this.isServerSide()) {
|
|
332
|
+
for (const query of queries.filter(query => !mediaQueryLists[query])) {
|
|
333
|
+
mediaQueryLists[query] = window.matchMedia(query);
|
|
334
|
+
}
|
|
335
|
+
} // We need to figure out what the current media size is
|
|
336
|
+
// If an override has been specified, we use that.
|
|
337
|
+
// If we're rendering on the server then we use the default
|
|
338
|
+
// SSR rendering size.
|
|
339
|
+
// Otherwise we attempt to get the current size based on
|
|
340
|
+
// the current MediaSpec.
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
const mediaSize = overrideSize || this.isServerSide() && ssrSize || this.getCurrentSize(mediaSpec); // Generate a mock stylesheet
|
|
344
|
+
|
|
345
|
+
const styles = this.getMockStyleSheet(mediaSize);
|
|
346
|
+
return children({
|
|
347
|
+
mediaSize,
|
|
348
|
+
mediaSpec,
|
|
349
|
+
styles
|
|
350
|
+
});
|
|
351
|
+
}
|
|
524
352
|
|
|
525
|
-
|
|
353
|
+
} // gen-snapshot-tests.js only understands `export default class ...`
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class MediaLayout extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
357
|
+
render() {
|
|
358
|
+
// We listen to the MediaLayoutContext to see what defaults we're
|
|
359
|
+
// being given (this can be overriden by wrapping this component in
|
|
360
|
+
// a MediaLayoutContext.Consumer).
|
|
361
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].Consumer, null, ({
|
|
362
|
+
overrideSize,
|
|
363
|
+
ssrSize,
|
|
364
|
+
mediaSpec
|
|
365
|
+
}) => /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](MediaLayoutInternal, _extends({}, this.props, {
|
|
366
|
+
overrideSize: overrideSize,
|
|
367
|
+
ssrSize: ssrSize,
|
|
368
|
+
mediaSpec: mediaSpec
|
|
369
|
+
})));
|
|
370
|
+
}
|
|
526
371
|
|
|
527
|
-
|
|
372
|
+
}
|
|
528
373
|
|
|
529
|
-
|
|
374
|
+
/***/ }),
|
|
375
|
+
/* 6 */
|
|
376
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
530
377
|
|
|
378
|
+
"use strict";
|
|
379
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Spring; });
|
|
380
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
381
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
382
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
|
383
|
+
/* harmony import */ var aphrodite__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(aphrodite__WEBPACK_IMPORTED_MODULE_1__);
|
|
384
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4);
|
|
385
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__);
|
|
531
386
|
|
|
532
387
|
|
|
533
388
|
|
|
@@ -537,60 +392,34 @@ function spring_getPrototypeOf(o) { spring_getPrototypeOf = Object.setPrototypeO
|
|
|
537
392
|
*
|
|
538
393
|
* Assumes parent is a View.
|
|
539
394
|
*/
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
395
|
+
class Spring extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
396
|
+
render() {
|
|
397
|
+
const {
|
|
398
|
+
style
|
|
399
|
+
} = this.props;
|
|
400
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_2__["View"], {
|
|
401
|
+
"aria-hidden": "true",
|
|
402
|
+
style: [styles.grow, style]
|
|
403
|
+
});
|
|
549
404
|
}
|
|
550
405
|
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
value: function render() {
|
|
554
|
-
var style = this.props.style;
|
|
555
|
-
return /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
|
|
556
|
-
"aria-hidden": "true",
|
|
557
|
-
style: [styles.grow, style]
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
}]);
|
|
561
|
-
|
|
562
|
-
return Spring;
|
|
563
|
-
}(external_react_["Component"]);
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
var styles = external_aphrodite_["StyleSheet"].create({
|
|
406
|
+
}
|
|
407
|
+
const styles = aphrodite__WEBPACK_IMPORTED_MODULE_1__["StyleSheet"].create({
|
|
567
408
|
grow: {
|
|
568
409
|
flexGrow: 1
|
|
569
410
|
}
|
|
570
411
|
});
|
|
571
|
-
// CONCATENATED MODULE: ./packages/wonder-blocks-layout/src/components/strut.js
|
|
572
|
-
function strut_typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { strut_typeof = function _typeof(obj) { return typeof obj; }; } else { strut_typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return strut_typeof(obj); }
|
|
573
|
-
|
|
574
|
-
function strut_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
575
|
-
|
|
576
|
-
function strut_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); } }
|
|
577
|
-
|
|
578
|
-
function strut_createClass(Constructor, protoProps, staticProps) { if (protoProps) strut_defineProperties(Constructor.prototype, protoProps); if (staticProps) strut_defineProperties(Constructor, staticProps); return Constructor; }
|
|
579
|
-
|
|
580
|
-
function strut_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) strut_setPrototypeOf(subClass, superClass); }
|
|
581
|
-
|
|
582
|
-
function strut_setPrototypeOf(o, p) { strut_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return strut_setPrototypeOf(o, p); }
|
|
583
|
-
|
|
584
|
-
function strut_createSuper(Derived) { var hasNativeReflectConstruct = strut_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = strut_getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = strut_getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return strut_possibleConstructorReturn(this, result); }; }
|
|
585
|
-
|
|
586
|
-
function strut_possibleConstructorReturn(self, call) { if (call && (strut_typeof(call) === "object" || typeof call === "function")) { return call; } return strut_assertThisInitialized(self); }
|
|
587
|
-
|
|
588
|
-
function strut_assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
589
412
|
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
413
|
+
/***/ }),
|
|
414
|
+
/* 7 */
|
|
415
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
593
416
|
|
|
417
|
+
"use strict";
|
|
418
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Strut; });
|
|
419
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
|
|
420
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
421
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
|
422
|
+
/* harmony import */ var _khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__);
|
|
594
423
|
|
|
595
424
|
|
|
596
425
|
|
|
@@ -599,36 +428,21 @@ function strut_getPrototypeOf(o) { strut_getPrototypeOf = Object.setPrototypeOf
|
|
|
599
428
|
*
|
|
600
429
|
* Assumes parent is a View.
|
|
601
430
|
*/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
431
|
+
class Strut extends react__WEBPACK_IMPORTED_MODULE_0__["Component"] {
|
|
432
|
+
render() {
|
|
433
|
+
const {
|
|
434
|
+
size,
|
|
435
|
+
style
|
|
436
|
+
} = this.props;
|
|
437
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__["createElement"](_khanacademy_wonder_blocks_core__WEBPACK_IMPORTED_MODULE_1__["View"], {
|
|
438
|
+
"aria-hidden": "true",
|
|
439
|
+
style: [strutStyle(size), style]
|
|
440
|
+
});
|
|
611
441
|
}
|
|
612
442
|
|
|
613
|
-
|
|
614
|
-
key: "render",
|
|
615
|
-
value: function render() {
|
|
616
|
-
var _this$props = this.props,
|
|
617
|
-
size = _this$props.size,
|
|
618
|
-
style = _this$props.style;
|
|
619
|
-
return /*#__PURE__*/external_react_["createElement"](wonder_blocks_core_["View"], {
|
|
620
|
-
"aria-hidden": "true",
|
|
621
|
-
style: [strutStyle(size), style]
|
|
622
|
-
});
|
|
623
|
-
}
|
|
624
|
-
}]);
|
|
625
|
-
|
|
626
|
-
return Strut;
|
|
627
|
-
}(external_react_["Component"]);
|
|
443
|
+
}
|
|
628
444
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
var strutStyle = function strutStyle(size) {
|
|
445
|
+
const strutStyle = size => {
|
|
632
446
|
return {
|
|
633
447
|
width: size,
|
|
634
448
|
MsFlexBasis: size,
|
|
@@ -638,7 +452,13 @@ var strutStyle = function strutStyle(size) {
|
|
|
638
452
|
flexShrink: 0
|
|
639
453
|
};
|
|
640
454
|
};
|
|
641
|
-
|
|
455
|
+
|
|
456
|
+
/***/ }),
|
|
457
|
+
/* 8 */
|
|
458
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
459
|
+
|
|
460
|
+
"use strict";
|
|
461
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return queryMatchesSize; });
|
|
642
462
|
/**
|
|
643
463
|
* Return where a media size matches a media query.
|
|
644
464
|
*
|
|
@@ -649,7 +469,7 @@ var strutStyle = function strutStyle(size) {
|
|
|
649
469
|
* @param {MediaQuery} mediaQuery
|
|
650
470
|
* @param {MediaSize} mediaSize
|
|
651
471
|
*/
|
|
652
|
-
|
|
472
|
+
const queryMatchesSize = (mediaQuery, mediaSize) => {
|
|
653
473
|
switch (mediaQuery) {
|
|
654
474
|
case "all":
|
|
655
475
|
return true;
|
|
@@ -670,10 +490,46 @@ var queryMatchesSize = function queryMatchesSize(mediaQuery, mediaSize) {
|
|
|
670
490
|
return mediaSize === "large";
|
|
671
491
|
|
|
672
492
|
default:
|
|
673
|
-
throw new Error(
|
|
493
|
+
throw new Error(`Unsupported mediaSize: ${mediaSize}`);
|
|
674
494
|
}
|
|
675
495
|
};
|
|
676
|
-
|
|
496
|
+
|
|
497
|
+
/***/ }),
|
|
498
|
+
/* 9 */
|
|
499
|
+
/***/ (function(module, exports) {
|
|
500
|
+
|
|
501
|
+
module.exports = require("aphrodite");
|
|
502
|
+
|
|
503
|
+
/***/ }),
|
|
504
|
+
/* 10 */
|
|
505
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
506
|
+
|
|
507
|
+
"use strict";
|
|
508
|
+
__webpack_require__.r(__webpack_exports__);
|
|
509
|
+
/* harmony import */ var _components_media_layout_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5);
|
|
510
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaLayout", function() { return _components_media_layout_js__WEBPACK_IMPORTED_MODULE_0__["a"]; });
|
|
511
|
+
|
|
512
|
+
/* harmony import */ var _components_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3);
|
|
513
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaLayoutContext", function() { return _components_media_layout_context_js__WEBPACK_IMPORTED_MODULE_1__["a"]; });
|
|
514
|
+
|
|
515
|
+
/* harmony import */ var _components_spring_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(6);
|
|
516
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Spring", function() { return _components_spring_js__WEBPACK_IMPORTED_MODULE_2__["a"]; });
|
|
517
|
+
|
|
518
|
+
/* harmony import */ var _components_strut_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7);
|
|
519
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Strut", function() { return _components_strut_js__WEBPACK_IMPORTED_MODULE_3__["a"]; });
|
|
520
|
+
|
|
521
|
+
/* harmony import */ var _util_specs_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2);
|
|
522
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VALID_MEDIA_SIZES", function() { return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["d"]; });
|
|
523
|
+
|
|
524
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MEDIA_DEFAULT_SPEC", function() { return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["a"]; });
|
|
525
|
+
|
|
526
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MEDIA_INTERNAL_SPEC", function() { return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["b"]; });
|
|
527
|
+
|
|
528
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MEDIA_MODAL_SPEC", function() { return _util_specs_js__WEBPACK_IMPORTED_MODULE_4__["c"]; });
|
|
529
|
+
|
|
530
|
+
/* harmony import */ var _util_util_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8);
|
|
531
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "queryMatchesSize", function() { return _util_util_js__WEBPACK_IMPORTED_MODULE_5__["a"]; });
|
|
532
|
+
|
|
677
533
|
|
|
678
534
|
|
|
679
535
|
|