@cleartrip/ct-design-modal 4.0.0-TEST.3 → 5.0.0
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/README.md +100 -0
- package/dist/Backdrop/Backdrop.d.ts +8 -4
- package/dist/Backdrop/Backdrop.d.ts.map +1 -1
- package/dist/Backdrop/style.d.ts +18 -0
- package/dist/Backdrop/style.d.ts.map +1 -0
- package/dist/Backdrop/type.d.ts +9 -8
- package/dist/Backdrop/type.d.ts.map +1 -1
- package/dist/Modal.d.ts +4 -4
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.native.d.ts +5 -0
- package/dist/Modal.native.d.ts.map +1 -0
- package/dist/ModalAction/ModalAction.d.ts +7 -5
- package/dist/ModalAction/ModalAction.d.ts.map +1 -1
- package/dist/ModalContainer/ModalContainer.d.ts +7 -7
- package/dist/ModalContainer/ModalContainer.d.ts.map +1 -1
- package/dist/ModalContent/ModalContent.d.ts +9 -6
- package/dist/ModalContent/ModalContent.d.ts.map +1 -1
- package/dist/ModalContext.d.ts +0 -1
- package/dist/ModalContext.d.ts.map +1 -1
- package/dist/ModalTitle/ModalTitle.d.ts +12 -5
- package/dist/ModalTitle/ModalTitle.d.ts.map +1 -1
- package/dist/ModalsUsableComponents/ModalWithCloseOverlay.d.ts +3 -2
- package/dist/ModalsUsableComponents/ModalWithCloseOverlay.d.ts.map +1 -1
- package/dist/ModalsUsableComponents/type.d.ts +10 -4
- package/dist/ModalsUsableComponents/type.d.ts.map +1 -1
- package/dist/constants.d.ts +28 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/ct-design-modal.browser.cjs.js +1 -1
- package/dist/ct-design-modal.browser.cjs.js.map +1 -1
- package/dist/ct-design-modal.browser.esm.js +1 -1
- package/dist/ct-design-modal.browser.esm.js.map +1 -1
- package/dist/ct-design-modal.cjs.js +233 -130
- package/dist/ct-design-modal.cjs.js.map +1 -1
- package/dist/ct-design-modal.esm.js +235 -132
- package/dist/ct-design-modal.esm.js.map +1 -1
- package/dist/ct-design-modal.umd.js +1881 -140
- package/dist/ct-design-modal.umd.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.native.d.ts +5 -0
- package/dist/index.native.d.ts.map +1 -0
- package/dist/modalUtils.d.ts +2 -0
- package/dist/modalUtils.d.ts.map +1 -0
- package/dist/style.d.ts +18 -0
- package/dist/style.d.ts.map +1 -0
- package/dist/style.native.d.ts +29 -0
- package/dist/style.native.d.ts.map +1 -0
- package/dist/type.d.ts +38 -40
- package/dist/type.d.ts.map +1 -1
- package/package.json +38 -17
- package/src/Backdrop/Backdrop.tsx +39 -0
- package/src/Backdrop/index.ts +1 -0
- package/src/Backdrop/style.ts +18 -0
- package/src/Backdrop/type.ts +17 -0
- package/src/Handler.ts +78 -0
- package/src/Modal.native.tsx +210 -0
- package/src/Modal.tsx +234 -0
- package/src/ModalAction/ModalAction.tsx +42 -0
- package/src/ModalAction/index.ts +1 -0
- package/src/ModalContainer/ModalContainer.tsx +40 -0
- package/src/ModalContainer/index.ts +1 -0
- package/src/ModalContent/ModalContent.tsx +44 -0
- package/src/ModalContent/index.ts +1 -0
- package/src/ModalContext.ts +14 -0
- package/src/ModalTitle/ModalTitle.tsx +70 -0
- package/src/ModalTitle/index.ts +1 -0
- package/src/ModalsUsableComponents/ModalWithCloseOverlay.tsx +92 -0
- package/src/ModalsUsableComponents/index.ts +2 -0
- package/src/ModalsUsableComponents/type.ts +40 -0
- package/src/constants.ts +31 -0
- package/src/index.native.ts +4 -0
- package/src/index.ts +10 -0
- package/src/modalUtils.ts +1 -0
- package/src/style.native.ts +83 -0
- package/src/style.ts +44 -0
- package/src/type.ts +72 -0
- package/dist/ModalsUsableComponents/style.d.ts +0 -11
- package/dist/ModalsUsableComponents/style.d.ts.map +0 -1
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemModal = {}, global.jsxRuntime, global.React, global.
|
|
5
|
-
})(this, (function (exports, jsxRuntime, React,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-portal'), require('@cleartrip/ct-design-focus-lock'), require('@cleartrip/ct-design-transition'), require('@cleartrip/ct-design-style-manager'), require('@cleartrip/ct-design-use-merge-refs'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-box'), require('@cleartrip/ct-design-icons'), require('@cleartrip/ct-design-theme'), require('@cleartrip/ct-design-typography')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-portal', '@cleartrip/ct-design-focus-lock', '@cleartrip/ct-design-transition', '@cleartrip/ct-design-style-manager', '@cleartrip/ct-design-use-merge-refs', '@cleartrip/ct-design-container', '@cleartrip/ct-design-box', '@cleartrip/ct-design-icons', '@cleartrip/ct-design-theme', '@cleartrip/ct-design-typography'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemModal = {}, global.jsxRuntime, global.React, global.ctDesignPortal, global.ctDesignFocusLock, global.ctDesignTransition, global.ctDesignStyleManager, global.useMergeRefs, global.ctDesignContainer, global.ctDesignBox, global.ctDesignIcons, global.ctDesignTheme, global.ctDesignTypography));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, React, ctDesignPortal, ctDesignFocusLock, ctDesignTransition, ctDesignStyleManager, useMergeRefs, ctDesignContainer, ctDesignBox, ctDesignIcons, ctDesignTheme, ctDesignTypography) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
10
|
-
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
11
10
|
var useMergeRefs__default = /*#__PURE__*/_interopDefault(useMergeRefs);
|
|
12
11
|
|
|
13
12
|
/******************************************************************************
|
|
@@ -26,16 +25,6 @@
|
|
|
26
25
|
***************************************************************************** */
|
|
27
26
|
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
28
27
|
|
|
29
|
-
var __assign = function () {
|
|
30
|
-
__assign = Object.assign || function __assign(t) {
|
|
31
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
32
|
-
s = arguments[i];
|
|
33
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
34
|
-
}
|
|
35
|
-
return t;
|
|
36
|
-
};
|
|
37
|
-
return __assign.apply(this, arguments);
|
|
38
|
-
};
|
|
39
28
|
function __rest(s, e) {
|
|
40
29
|
var t = {};
|
|
41
30
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -69,8 +58,20 @@
|
|
|
69
58
|
ModalPlacement["CENTER"] = "center";
|
|
70
59
|
ModalPlacement["BOTTOM"] = "bottom";
|
|
71
60
|
})(exports.ModalPlacement || (exports.ModalPlacement = {}));
|
|
61
|
+
exports.ActionButtonVariant = void 0;
|
|
62
|
+
(function (ActionButtonVariant) {
|
|
63
|
+
ActionButtonVariant["BACK"] = "back";
|
|
64
|
+
ActionButtonVariant["CLOSE"] = "close";
|
|
65
|
+
ActionButtonVariant["NONE"] = "none";
|
|
66
|
+
})(exports.ActionButtonVariant || (exports.ActionButtonVariant = {}));
|
|
67
|
+
exports.ActionButtonAlignment = void 0;
|
|
68
|
+
(function (ActionButtonAlignment) {
|
|
69
|
+
ActionButtonAlignment["CENTER"] = "center";
|
|
70
|
+
ActionButtonAlignment["LEFT"] = "left";
|
|
71
|
+
ActionButtonAlignment["RIGHT"] = "right";
|
|
72
|
+
})(exports.ActionButtonAlignment || (exports.ActionButtonAlignment = {}));
|
|
72
73
|
|
|
73
|
-
|
|
74
|
+
const getModalSizeStyles = (size) => {
|
|
74
75
|
switch (size) {
|
|
75
76
|
case exports.ModalSize.SMALL: {
|
|
76
77
|
return {
|
|
@@ -111,137 +112,1828 @@
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
|
|
116
|
+
var isDevelopment$1 = false;
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
|
|
120
|
+
Based off glamor's StyleSheet, thanks Sunil ❤️
|
|
121
|
+
|
|
122
|
+
high performance StyleSheet for css-in-js systems
|
|
123
|
+
|
|
124
|
+
- uses multiple style tags behind the scenes for millions of rules
|
|
125
|
+
- uses `insertRule` for appending in production for *much* faster performance
|
|
126
|
+
|
|
127
|
+
// usage
|
|
128
|
+
|
|
129
|
+
import { StyleSheet } from '@emotion/sheet'
|
|
130
|
+
|
|
131
|
+
let styleSheet = new StyleSheet({ key: '', container: document.head })
|
|
132
|
+
|
|
133
|
+
styleSheet.insert('#box { border: 1px solid red; }')
|
|
134
|
+
- appends a css rule into the stylesheet
|
|
135
|
+
|
|
136
|
+
styleSheet.flush()
|
|
137
|
+
- empties the stylesheet of all its contents
|
|
138
|
+
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
function sheetForTag(tag) {
|
|
142
|
+
if (tag.sheet) {
|
|
143
|
+
return tag.sheet;
|
|
144
|
+
} // this weirdness brought to you by firefox
|
|
145
|
+
|
|
146
|
+
/* istanbul ignore next */
|
|
147
|
+
|
|
148
|
+
for (var i = 0; i < document.styleSheets.length; i++) {
|
|
149
|
+
if (document.styleSheets[i].ownerNode === tag) {
|
|
150
|
+
return document.styleSheets[i];
|
|
151
|
+
}
|
|
152
|
+
} // this function should always return with a value
|
|
153
|
+
// TS can't understand it though so we make it stop complaining here
|
|
154
|
+
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
function createStyleElement(options) {
|
|
158
|
+
var tag = document.createElement('style');
|
|
159
|
+
tag.setAttribute('data-emotion', options.key);
|
|
160
|
+
if (options.nonce !== undefined) {
|
|
161
|
+
tag.setAttribute('nonce', options.nonce);
|
|
162
|
+
}
|
|
163
|
+
tag.appendChild(document.createTextNode(''));
|
|
164
|
+
tag.setAttribute('data-s', '');
|
|
165
|
+
return tag;
|
|
166
|
+
}
|
|
167
|
+
var StyleSheet = /*#__PURE__*/function () {
|
|
168
|
+
// Using Node instead of HTMLElement since container may be a ShadowRoot
|
|
169
|
+
function StyleSheet(options) {
|
|
170
|
+
var _this = this;
|
|
171
|
+
this._insertTag = function (tag) {
|
|
172
|
+
var before;
|
|
173
|
+
if (_this.tags.length === 0) {
|
|
174
|
+
if (_this.insertionPoint) {
|
|
175
|
+
before = _this.insertionPoint.nextSibling;
|
|
176
|
+
} else if (_this.prepend) {
|
|
177
|
+
before = _this.container.firstChild;
|
|
178
|
+
} else {
|
|
179
|
+
before = _this.before;
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
before = _this.tags[_this.tags.length - 1].nextSibling;
|
|
183
|
+
}
|
|
184
|
+
_this.container.insertBefore(tag, before);
|
|
185
|
+
_this.tags.push(tag);
|
|
186
|
+
};
|
|
187
|
+
this.isSpeedy = options.speedy === undefined ? !isDevelopment$1 : options.speedy;
|
|
188
|
+
this.tags = [];
|
|
189
|
+
this.ctr = 0;
|
|
190
|
+
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
|
|
191
|
+
|
|
192
|
+
this.key = options.key;
|
|
193
|
+
this.container = options.container;
|
|
194
|
+
this.prepend = options.prepend;
|
|
195
|
+
this.insertionPoint = options.insertionPoint;
|
|
196
|
+
this.before = null;
|
|
197
|
+
}
|
|
198
|
+
var _proto = StyleSheet.prototype;
|
|
199
|
+
_proto.hydrate = function hydrate(nodes) {
|
|
200
|
+
nodes.forEach(this._insertTag);
|
|
201
|
+
};
|
|
202
|
+
_proto.insert = function insert(rule) {
|
|
203
|
+
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
|
|
204
|
+
// it's 1 in dev because we insert source maps that map a single rule to a location
|
|
205
|
+
// and you can only have one source map per style tag
|
|
206
|
+
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
|
|
207
|
+
this._insertTag(createStyleElement(this));
|
|
208
|
+
}
|
|
209
|
+
var tag = this.tags[this.tags.length - 1];
|
|
210
|
+
if (this.isSpeedy) {
|
|
211
|
+
var sheet = sheetForTag(tag);
|
|
212
|
+
try {
|
|
213
|
+
// this is the ultrafast version, works across browsers
|
|
214
|
+
// the big drawback is that the css won't be editable in devtools
|
|
215
|
+
sheet.insertRule(rule, sheet.cssRules.length);
|
|
216
|
+
} catch (e) {}
|
|
217
|
+
} else {
|
|
218
|
+
tag.appendChild(document.createTextNode(rule));
|
|
219
|
+
}
|
|
220
|
+
this.ctr++;
|
|
221
|
+
};
|
|
222
|
+
_proto.flush = function flush() {
|
|
223
|
+
this.tags.forEach(function (tag) {
|
|
224
|
+
var _tag$parentNode;
|
|
225
|
+
return (_tag$parentNode = tag.parentNode) == null ? void 0 : _tag$parentNode.removeChild(tag);
|
|
226
|
+
});
|
|
227
|
+
this.tags = [];
|
|
228
|
+
this.ctr = 0;
|
|
229
|
+
};
|
|
230
|
+
return StyleSheet;
|
|
231
|
+
}();
|
|
232
|
+
|
|
233
|
+
var stylisExports = {};
|
|
234
|
+
var stylis = {
|
|
235
|
+
get exports(){ return stylisExports; },
|
|
236
|
+
set exports(v){ stylisExports = v; },
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
(function (module, exports) {
|
|
240
|
+
(function (e, r) {
|
|
241
|
+
r(exports) ;
|
|
242
|
+
})(this, function (e) {
|
|
243
|
+
|
|
244
|
+
var r = "-ms-";
|
|
245
|
+
var a = "-moz-";
|
|
246
|
+
var c = "-webkit-";
|
|
247
|
+
var n = "comm";
|
|
248
|
+
var t = "rule";
|
|
249
|
+
var s = "decl";
|
|
250
|
+
var i = "@page";
|
|
251
|
+
var u = "@media";
|
|
252
|
+
var o = "@import";
|
|
253
|
+
var f = "@charset";
|
|
254
|
+
var l = "@viewport";
|
|
255
|
+
var p = "@supports";
|
|
256
|
+
var h = "@document";
|
|
257
|
+
var v = "@namespace";
|
|
258
|
+
var d = "@keyframes";
|
|
259
|
+
var b = "@font-face";
|
|
260
|
+
var w = "@counter-style";
|
|
261
|
+
var m = "@font-feature-values";
|
|
262
|
+
var g = "@layer";
|
|
263
|
+
var k = Math.abs;
|
|
264
|
+
var $ = String.fromCharCode;
|
|
265
|
+
var x = Object.assign;
|
|
266
|
+
function E(e, r) {
|
|
267
|
+
return M(e, 0) ^ 45 ? (((r << 2 ^ M(e, 0)) << 2 ^ M(e, 1)) << 2 ^ M(e, 2)) << 2 ^ M(e, 3) : 0;
|
|
268
|
+
}
|
|
269
|
+
function y(e) {
|
|
270
|
+
return e.trim();
|
|
271
|
+
}
|
|
272
|
+
function T(e, r) {
|
|
273
|
+
return (e = r.exec(e)) ? e[0] : e;
|
|
274
|
+
}
|
|
275
|
+
function A(e, r, a) {
|
|
276
|
+
return e.replace(r, a);
|
|
277
|
+
}
|
|
278
|
+
function O(e, r) {
|
|
279
|
+
return e.indexOf(r);
|
|
280
|
+
}
|
|
281
|
+
function M(e, r) {
|
|
282
|
+
return e.charCodeAt(r) | 0;
|
|
283
|
+
}
|
|
284
|
+
function C(e, r, a) {
|
|
285
|
+
return e.slice(r, a);
|
|
286
|
+
}
|
|
287
|
+
function R(e) {
|
|
288
|
+
return e.length;
|
|
289
|
+
}
|
|
290
|
+
function S(e) {
|
|
291
|
+
return e.length;
|
|
292
|
+
}
|
|
293
|
+
function z(e, r) {
|
|
294
|
+
return r.push(e), e;
|
|
295
|
+
}
|
|
296
|
+
function N(e, r) {
|
|
297
|
+
return e.map(r).join("");
|
|
298
|
+
}
|
|
299
|
+
e.line = 1;
|
|
300
|
+
e.column = 1;
|
|
301
|
+
e.length = 0;
|
|
302
|
+
e.position = 0;
|
|
303
|
+
e.character = 0;
|
|
304
|
+
e.characters = "";
|
|
305
|
+
function P(r, a, c, n, t, s, i) {
|
|
306
|
+
return {
|
|
307
|
+
value: r,
|
|
308
|
+
root: a,
|
|
309
|
+
parent: c,
|
|
310
|
+
type: n,
|
|
311
|
+
props: t,
|
|
312
|
+
children: s,
|
|
313
|
+
line: e.line,
|
|
314
|
+
column: e.column,
|
|
315
|
+
length: i,
|
|
316
|
+
return: ""
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
function j(e, r) {
|
|
320
|
+
return x(P("", null, null, "", null, null, 0), e, {
|
|
321
|
+
length: -e.length
|
|
322
|
+
}, r);
|
|
323
|
+
}
|
|
324
|
+
function U() {
|
|
325
|
+
return e.character;
|
|
326
|
+
}
|
|
327
|
+
function _() {
|
|
328
|
+
e.character = e.position > 0 ? M(e.characters, --e.position) : 0;
|
|
329
|
+
if (e.column--, e.character === 10) e.column = 1, e.line--;
|
|
330
|
+
return e.character;
|
|
331
|
+
}
|
|
332
|
+
function F() {
|
|
333
|
+
e.character = e.position < e.length ? M(e.characters, e.position++) : 0;
|
|
334
|
+
if (e.column++, e.character === 10) e.column = 1, e.line++;
|
|
335
|
+
return e.character;
|
|
336
|
+
}
|
|
337
|
+
function I() {
|
|
338
|
+
return M(e.characters, e.position);
|
|
339
|
+
}
|
|
340
|
+
function L() {
|
|
341
|
+
return e.position;
|
|
342
|
+
}
|
|
343
|
+
function D(r, a) {
|
|
344
|
+
return C(e.characters, r, a);
|
|
345
|
+
}
|
|
346
|
+
function Y(e) {
|
|
347
|
+
switch (e) {
|
|
348
|
+
case 0:
|
|
349
|
+
case 9:
|
|
350
|
+
case 10:
|
|
351
|
+
case 13:
|
|
352
|
+
case 32:
|
|
353
|
+
return 5;
|
|
354
|
+
case 33:
|
|
355
|
+
case 43:
|
|
356
|
+
case 44:
|
|
357
|
+
case 47:
|
|
358
|
+
case 62:
|
|
359
|
+
case 64:
|
|
360
|
+
case 126:
|
|
361
|
+
case 59:
|
|
362
|
+
case 123:
|
|
363
|
+
case 125:
|
|
364
|
+
return 4;
|
|
365
|
+
case 58:
|
|
366
|
+
return 3;
|
|
367
|
+
case 34:
|
|
368
|
+
case 39:
|
|
369
|
+
case 40:
|
|
370
|
+
case 91:
|
|
371
|
+
return 2;
|
|
372
|
+
case 41:
|
|
373
|
+
case 93:
|
|
374
|
+
return 1;
|
|
375
|
+
}
|
|
376
|
+
return 0;
|
|
377
|
+
}
|
|
378
|
+
function K(r) {
|
|
379
|
+
return e.line = e.column = 1, e.length = R(e.characters = r), e.position = 0, [];
|
|
380
|
+
}
|
|
381
|
+
function V(r) {
|
|
382
|
+
return e.characters = "", r;
|
|
383
|
+
}
|
|
384
|
+
function W(r) {
|
|
385
|
+
return y(D(e.position - 1, q(r === 91 ? r + 2 : r === 40 ? r + 1 : r)));
|
|
386
|
+
}
|
|
387
|
+
function B(e) {
|
|
388
|
+
return V(H(K(e)));
|
|
389
|
+
}
|
|
390
|
+
function G(r) {
|
|
391
|
+
while (e.character = I()) if (e.character < 33) F();else break;
|
|
392
|
+
return Y(r) > 2 || Y(e.character) > 3 ? "" : " ";
|
|
393
|
+
}
|
|
394
|
+
function H(r) {
|
|
395
|
+
while (F()) switch (Y(e.character)) {
|
|
396
|
+
case 0:
|
|
397
|
+
z(Q(e.position - 1), r);
|
|
398
|
+
break;
|
|
399
|
+
case 2:
|
|
400
|
+
z(W(e.character), r);
|
|
401
|
+
break;
|
|
402
|
+
default:
|
|
403
|
+
z($(e.character), r);
|
|
404
|
+
}
|
|
405
|
+
return r;
|
|
406
|
+
}
|
|
407
|
+
function Z(r, a) {
|
|
408
|
+
while (--a && F()) if (e.character < 48 || e.character > 102 || e.character > 57 && e.character < 65 || e.character > 70 && e.character < 97) break;
|
|
409
|
+
return D(r, L() + (a < 6 && I() == 32 && F() == 32));
|
|
410
|
+
}
|
|
411
|
+
function q(r) {
|
|
412
|
+
while (F()) switch (e.character) {
|
|
413
|
+
case r:
|
|
414
|
+
return e.position;
|
|
415
|
+
case 34:
|
|
416
|
+
case 39:
|
|
417
|
+
if (r !== 34 && r !== 39) q(e.character);
|
|
418
|
+
break;
|
|
419
|
+
case 40:
|
|
420
|
+
if (r === 41) q(r);
|
|
421
|
+
break;
|
|
422
|
+
case 92:
|
|
423
|
+
F();
|
|
424
|
+
break;
|
|
425
|
+
}
|
|
426
|
+
return e.position;
|
|
427
|
+
}
|
|
428
|
+
function J(r, a) {
|
|
429
|
+
while (F()) if (r + e.character === 47 + 10) break;else if (r + e.character === 42 + 42 && I() === 47) break;
|
|
430
|
+
return "/*" + D(a, e.position - 1) + "*" + $(r === 47 ? r : F());
|
|
431
|
+
}
|
|
432
|
+
function Q(r) {
|
|
433
|
+
while (!Y(I())) F();
|
|
434
|
+
return D(r, e.position);
|
|
435
|
+
}
|
|
436
|
+
function X(e) {
|
|
437
|
+
return V(ee("", null, null, null, [""], e = K(e), 0, [0], e));
|
|
438
|
+
}
|
|
439
|
+
function ee(e, r, a, c, n, t, s, i, u) {
|
|
440
|
+
var o = 0;
|
|
441
|
+
var f = 0;
|
|
442
|
+
var l = s;
|
|
443
|
+
var p = 0;
|
|
444
|
+
var h = 0;
|
|
445
|
+
var v = 0;
|
|
446
|
+
var d = 1;
|
|
447
|
+
var b = 1;
|
|
448
|
+
var w = 1;
|
|
449
|
+
var m = 0;
|
|
450
|
+
var g = "";
|
|
451
|
+
var k = n;
|
|
452
|
+
var x = t;
|
|
453
|
+
var E = c;
|
|
454
|
+
var y = g;
|
|
455
|
+
while (b) switch (v = m, m = F()) {
|
|
456
|
+
case 40:
|
|
457
|
+
if (v != 108 && M(y, l - 1) == 58) {
|
|
458
|
+
if (O(y += A(W(m), "&", "&\f"), "&\f") != -1) w = -1;
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
case 34:
|
|
462
|
+
case 39:
|
|
463
|
+
case 91:
|
|
464
|
+
y += W(m);
|
|
465
|
+
break;
|
|
466
|
+
case 9:
|
|
467
|
+
case 10:
|
|
468
|
+
case 13:
|
|
469
|
+
case 32:
|
|
470
|
+
y += G(v);
|
|
471
|
+
break;
|
|
472
|
+
case 92:
|
|
473
|
+
y += Z(L() - 1, 7);
|
|
474
|
+
continue;
|
|
475
|
+
case 47:
|
|
476
|
+
switch (I()) {
|
|
477
|
+
case 42:
|
|
478
|
+
case 47:
|
|
479
|
+
z(ae(J(F(), L()), r, a), u);
|
|
480
|
+
break;
|
|
481
|
+
default:
|
|
482
|
+
y += "/";
|
|
483
|
+
}
|
|
484
|
+
break;
|
|
485
|
+
case 123 * d:
|
|
486
|
+
i[o++] = R(y) * w;
|
|
487
|
+
case 125 * d:
|
|
488
|
+
case 59:
|
|
489
|
+
case 0:
|
|
490
|
+
switch (m) {
|
|
491
|
+
case 0:
|
|
492
|
+
case 125:
|
|
493
|
+
b = 0;
|
|
494
|
+
case 59 + f:
|
|
495
|
+
if (w == -1) y = A(y, /\f/g, "");
|
|
496
|
+
if (h > 0 && R(y) - l) z(h > 32 ? ce(y + ";", c, a, l - 1) : ce(A(y, " ", "") + ";", c, a, l - 2), u);
|
|
497
|
+
break;
|
|
498
|
+
case 59:
|
|
499
|
+
y += ";";
|
|
500
|
+
default:
|
|
501
|
+
z(E = re(y, r, a, o, f, n, i, g, k = [], x = [], l), t);
|
|
502
|
+
if (m === 123) if (f === 0) ee(y, r, E, E, k, t, l, i, x);else switch (p === 99 && M(y, 3) === 110 ? 100 : p) {
|
|
503
|
+
case 100:
|
|
504
|
+
case 108:
|
|
505
|
+
case 109:
|
|
506
|
+
case 115:
|
|
507
|
+
ee(e, E, E, c && z(re(e, E, E, 0, 0, n, i, g, n, k = [], l), x), n, x, l, i, c ? k : x);
|
|
508
|
+
break;
|
|
509
|
+
default:
|
|
510
|
+
ee(y, E, E, E, [""], x, 0, i, x);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
o = f = h = 0, d = w = 1, g = y = "", l = s;
|
|
514
|
+
break;
|
|
515
|
+
case 58:
|
|
516
|
+
l = 1 + R(y), h = v;
|
|
517
|
+
default:
|
|
518
|
+
if (d < 1) if (m == 123) --d;else if (m == 125 && d++ == 0 && _() == 125) continue;
|
|
519
|
+
switch (y += $(m), m * d) {
|
|
520
|
+
case 38:
|
|
521
|
+
w = f > 0 ? 1 : (y += "\f", -1);
|
|
522
|
+
break;
|
|
523
|
+
case 44:
|
|
524
|
+
i[o++] = (R(y) - 1) * w, w = 1;
|
|
525
|
+
break;
|
|
526
|
+
case 64:
|
|
527
|
+
if (I() === 45) y += W(F());
|
|
528
|
+
p = I(), f = l = R(g = y += Q(L())), m++;
|
|
529
|
+
break;
|
|
530
|
+
case 45:
|
|
531
|
+
if (v === 45 && R(y) == 2) d = 0;
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
return t;
|
|
535
|
+
}
|
|
536
|
+
function re(e, r, a, c, n, s, i, u, o, f, l) {
|
|
537
|
+
var p = n - 1;
|
|
538
|
+
var h = n === 0 ? s : [""];
|
|
539
|
+
var v = S(h);
|
|
540
|
+
for (var d = 0, b = 0, w = 0; d < c; ++d) for (var m = 0, g = C(e, p + 1, p = k(b = i[d])), $ = e; m < v; ++m) if ($ = y(b > 0 ? h[m] + " " + g : A(g, /&\f/g, h[m]))) o[w++] = $;
|
|
541
|
+
return P(e, r, a, n === 0 ? t : u, o, f, l);
|
|
542
|
+
}
|
|
543
|
+
function ae(e, r, a) {
|
|
544
|
+
return P(e, r, a, n, $(U()), C(e, 2, -2), 0);
|
|
545
|
+
}
|
|
546
|
+
function ce(e, r, a, c) {
|
|
547
|
+
return P(e, r, a, s, C(e, 0, c), C(e, c + 1, -1), c);
|
|
548
|
+
}
|
|
549
|
+
function ne(e, n, t) {
|
|
550
|
+
switch (E(e, n)) {
|
|
551
|
+
case 5103:
|
|
552
|
+
return c + "print-" + e + e;
|
|
553
|
+
case 5737:
|
|
554
|
+
case 4201:
|
|
555
|
+
case 3177:
|
|
556
|
+
case 3433:
|
|
557
|
+
case 1641:
|
|
558
|
+
case 4457:
|
|
559
|
+
case 2921:
|
|
560
|
+
case 5572:
|
|
561
|
+
case 6356:
|
|
562
|
+
case 5844:
|
|
563
|
+
case 3191:
|
|
564
|
+
case 6645:
|
|
565
|
+
case 3005:
|
|
566
|
+
case 6391:
|
|
567
|
+
case 5879:
|
|
568
|
+
case 5623:
|
|
569
|
+
case 6135:
|
|
570
|
+
case 4599:
|
|
571
|
+
case 4855:
|
|
572
|
+
case 4215:
|
|
573
|
+
case 6389:
|
|
574
|
+
case 5109:
|
|
575
|
+
case 5365:
|
|
576
|
+
case 5621:
|
|
577
|
+
case 3829:
|
|
578
|
+
return c + e + e;
|
|
579
|
+
case 4789:
|
|
580
|
+
return a + e + e;
|
|
581
|
+
case 5349:
|
|
582
|
+
case 4246:
|
|
583
|
+
case 4810:
|
|
584
|
+
case 6968:
|
|
585
|
+
case 2756:
|
|
586
|
+
return c + e + a + e + r + e + e;
|
|
587
|
+
case 5936:
|
|
588
|
+
switch (M(e, n + 11)) {
|
|
589
|
+
case 114:
|
|
590
|
+
return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb") + e;
|
|
591
|
+
case 108:
|
|
592
|
+
return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "tb-rl") + e;
|
|
593
|
+
case 45:
|
|
594
|
+
return c + e + r + A(e, /[svh]\w+-[tblr]{2}/, "lr") + e;
|
|
595
|
+
}
|
|
596
|
+
case 6828:
|
|
597
|
+
case 4268:
|
|
598
|
+
case 2903:
|
|
599
|
+
return c + e + r + e + e;
|
|
600
|
+
case 6165:
|
|
601
|
+
return c + e + r + "flex-" + e + e;
|
|
602
|
+
case 5187:
|
|
603
|
+
return c + e + A(e, /(\w+).+(:[^]+)/, c + "box-$1$2" + r + "flex-$1$2") + e;
|
|
604
|
+
case 5443:
|
|
605
|
+
return c + e + r + "flex-item-" + A(e, /flex-|-self/g, "") + (!T(e, /flex-|baseline/) ? r + "grid-row-" + A(e, /flex-|-self/g, "") : "") + e;
|
|
606
|
+
case 4675:
|
|
607
|
+
return c + e + r + "flex-line-pack" + A(e, /align-content|flex-|-self/g, "") + e;
|
|
608
|
+
case 5548:
|
|
609
|
+
return c + e + r + A(e, "shrink", "negative") + e;
|
|
610
|
+
case 5292:
|
|
611
|
+
return c + e + r + A(e, "basis", "preferred-size") + e;
|
|
612
|
+
case 6060:
|
|
613
|
+
return c + "box-" + A(e, "-grow", "") + c + e + r + A(e, "grow", "positive") + e;
|
|
614
|
+
case 4554:
|
|
615
|
+
return c + A(e, /([^-])(transform)/g, "$1" + c + "$2") + e;
|
|
616
|
+
case 6187:
|
|
617
|
+
return A(A(A(e, /(zoom-|grab)/, c + "$1"), /(image-set)/, c + "$1"), e, "") + e;
|
|
618
|
+
case 5495:
|
|
619
|
+
case 3959:
|
|
620
|
+
return A(e, /(image-set\([^]*)/, c + "$1" + "$`$1");
|
|
621
|
+
case 4968:
|
|
622
|
+
return A(A(e, /(.+:)(flex-)?(.*)/, c + "box-pack:$3" + r + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + c + e + e;
|
|
623
|
+
case 4200:
|
|
624
|
+
if (!T(e, /flex-|baseline/)) return r + "grid-column-align" + C(e, n) + e;
|
|
625
|
+
break;
|
|
626
|
+
case 2592:
|
|
627
|
+
case 3360:
|
|
628
|
+
return r + A(e, "template-", "") + e;
|
|
629
|
+
case 4384:
|
|
630
|
+
case 3616:
|
|
631
|
+
if (t && t.some(function (e, r) {
|
|
632
|
+
return n = r, T(e.props, /grid-\w+-end/);
|
|
633
|
+
})) {
|
|
634
|
+
return ~O(e + (t = t[n].value), "span") ? e : r + A(e, "-start", "") + e + r + "grid-row-span:" + (~O(t, "span") ? T(t, /\d+/) : +T(t, /\d+/) - +T(e, /\d+/)) + ";";
|
|
635
|
+
}
|
|
636
|
+
return r + A(e, "-start", "") + e;
|
|
637
|
+
case 4896:
|
|
638
|
+
case 4128:
|
|
639
|
+
return t && t.some(function (e) {
|
|
640
|
+
return T(e.props, /grid-\w+-start/);
|
|
641
|
+
}) ? e : r + A(A(e, "-end", "-span"), "span ", "") + e;
|
|
642
|
+
case 4095:
|
|
643
|
+
case 3583:
|
|
644
|
+
case 4068:
|
|
645
|
+
case 2532:
|
|
646
|
+
return A(e, /(.+)-inline(.+)/, c + "$1$2") + e;
|
|
647
|
+
case 8116:
|
|
648
|
+
case 7059:
|
|
649
|
+
case 5753:
|
|
650
|
+
case 5535:
|
|
651
|
+
case 5445:
|
|
652
|
+
case 5701:
|
|
653
|
+
case 4933:
|
|
654
|
+
case 4677:
|
|
655
|
+
case 5533:
|
|
656
|
+
case 5789:
|
|
657
|
+
case 5021:
|
|
658
|
+
case 4765:
|
|
659
|
+
if (R(e) - 1 - n > 6) switch (M(e, n + 1)) {
|
|
660
|
+
case 109:
|
|
661
|
+
if (M(e, n + 4) !== 45) break;
|
|
662
|
+
case 102:
|
|
663
|
+
return A(e, /(.+:)(.+)-([^]+)/, "$1" + c + "$2-$3" + "$1" + a + (M(e, n + 3) == 108 ? "$3" : "$2-$3")) + e;
|
|
664
|
+
case 115:
|
|
665
|
+
return ~O(e, "stretch") ? ne(A(e, "stretch", "fill-available"), n, t) + e : e;
|
|
666
|
+
}
|
|
667
|
+
break;
|
|
668
|
+
case 5152:
|
|
669
|
+
case 5920:
|
|
670
|
+
return A(e, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function (a, c, n, t, s, i, u) {
|
|
671
|
+
return r + c + ":" + n + u + (t ? r + c + "-span:" + (s ? i : +i - +n) + u : "") + e;
|
|
672
|
+
});
|
|
673
|
+
case 4949:
|
|
674
|
+
if (M(e, n + 6) === 121) return A(e, ":", ":" + c) + e;
|
|
675
|
+
break;
|
|
676
|
+
case 6444:
|
|
677
|
+
switch (M(e, M(e, 14) === 45 ? 18 : 11)) {
|
|
678
|
+
case 120:
|
|
679
|
+
return A(e, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + c + (M(e, 14) === 45 ? "inline-" : "") + "box$3" + "$1" + c + "$2$3" + "$1" + r + "$2box$3") + e;
|
|
680
|
+
case 100:
|
|
681
|
+
return A(e, ":", ":" + r) + e;
|
|
682
|
+
}
|
|
683
|
+
break;
|
|
684
|
+
case 5719:
|
|
685
|
+
case 2647:
|
|
686
|
+
case 2135:
|
|
687
|
+
case 3927:
|
|
688
|
+
case 2391:
|
|
689
|
+
return A(e, "scroll-", "scroll-snap-") + e;
|
|
690
|
+
}
|
|
691
|
+
return e;
|
|
692
|
+
}
|
|
693
|
+
function te(e, r) {
|
|
694
|
+
var a = "";
|
|
695
|
+
var c = S(e);
|
|
696
|
+
for (var n = 0; n < c; n++) a += r(e[n], n, e, r) || "";
|
|
697
|
+
return a;
|
|
698
|
+
}
|
|
699
|
+
function se(e, r, a, c) {
|
|
700
|
+
switch (e.type) {
|
|
701
|
+
case g:
|
|
702
|
+
if (e.children.length) break;
|
|
703
|
+
case o:
|
|
704
|
+
case s:
|
|
705
|
+
return e.return = e.return || e.value;
|
|
706
|
+
case n:
|
|
707
|
+
return "";
|
|
708
|
+
case d:
|
|
709
|
+
return e.return = e.value + "{" + te(e.children, c) + "}";
|
|
710
|
+
case t:
|
|
711
|
+
e.value = e.props.join(",");
|
|
712
|
+
}
|
|
713
|
+
return R(a = te(e.children, c)) ? e.return = e.value + "{" + a + "}" : "";
|
|
714
|
+
}
|
|
715
|
+
function ie(e) {
|
|
716
|
+
var r = S(e);
|
|
717
|
+
return function (a, c, n, t) {
|
|
718
|
+
var s = "";
|
|
719
|
+
for (var i = 0; i < r; i++) s += e[i](a, c, n, t) || "";
|
|
720
|
+
return s;
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
function ue(e) {
|
|
724
|
+
return function (r) {
|
|
725
|
+
if (!r.root) if (r = r.return) e(r);
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
function oe(e, n, i, u) {
|
|
729
|
+
if (e.length > -1) if (!e.return) switch (e.type) {
|
|
730
|
+
case s:
|
|
731
|
+
e.return = ne(e.value, e.length, i);
|
|
732
|
+
return;
|
|
733
|
+
case d:
|
|
734
|
+
return te([j(e, {
|
|
735
|
+
value: A(e.value, "@", "@" + c)
|
|
736
|
+
})], u);
|
|
737
|
+
case t:
|
|
738
|
+
if (e.length) return N(e.props, function (n) {
|
|
739
|
+
switch (T(n, /(::plac\w+|:read-\w+)/)) {
|
|
740
|
+
case ":read-only":
|
|
741
|
+
case ":read-write":
|
|
742
|
+
return te([j(e, {
|
|
743
|
+
props: [A(n, /:(read-\w+)/, ":" + a + "$1")]
|
|
744
|
+
})], u);
|
|
745
|
+
case "::placeholder":
|
|
746
|
+
return te([j(e, {
|
|
747
|
+
props: [A(n, /:(plac\w+)/, ":" + c + "input-$1")]
|
|
748
|
+
}), j(e, {
|
|
749
|
+
props: [A(n, /:(plac\w+)/, ":" + a + "$1")]
|
|
750
|
+
}), j(e, {
|
|
751
|
+
props: [A(n, /:(plac\w+)/, r + "input-$1")]
|
|
752
|
+
})], u);
|
|
753
|
+
}
|
|
754
|
+
return "";
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
function fe(e) {
|
|
759
|
+
switch (e.type) {
|
|
760
|
+
case t:
|
|
761
|
+
e.props = e.props.map(function (r) {
|
|
762
|
+
return N(B(r), function (r, a, c) {
|
|
763
|
+
switch (M(r, 0)) {
|
|
764
|
+
case 12:
|
|
765
|
+
return C(r, 1, R(r));
|
|
766
|
+
case 0:
|
|
767
|
+
case 40:
|
|
768
|
+
case 43:
|
|
769
|
+
case 62:
|
|
770
|
+
case 126:
|
|
771
|
+
return r;
|
|
772
|
+
case 58:
|
|
773
|
+
if (c[++a] === "global") c[a] = "", c[++a] = "\f" + C(c[a], a = 1, -1);
|
|
774
|
+
case 32:
|
|
775
|
+
return a === 1 ? "" : r;
|
|
776
|
+
default:
|
|
777
|
+
switch (a) {
|
|
778
|
+
case 0:
|
|
779
|
+
e = r;
|
|
780
|
+
return S(c) > 1 ? "" : r;
|
|
781
|
+
case a = S(c) - 1:
|
|
782
|
+
case 2:
|
|
783
|
+
return a === 2 ? r + e + e : r + e;
|
|
784
|
+
default:
|
|
785
|
+
return r;
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
});
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
e.CHARSET = f;
|
|
793
|
+
e.COMMENT = n;
|
|
794
|
+
e.COUNTER_STYLE = w;
|
|
795
|
+
e.DECLARATION = s;
|
|
796
|
+
e.DOCUMENT = h;
|
|
797
|
+
e.FONT_FACE = b;
|
|
798
|
+
e.FONT_FEATURE_VALUES = m;
|
|
799
|
+
e.IMPORT = o;
|
|
800
|
+
e.KEYFRAMES = d;
|
|
801
|
+
e.LAYER = g;
|
|
802
|
+
e.MEDIA = u;
|
|
803
|
+
e.MOZ = a;
|
|
804
|
+
e.MS = r;
|
|
805
|
+
e.NAMESPACE = v;
|
|
806
|
+
e.PAGE = i;
|
|
807
|
+
e.RULESET = t;
|
|
808
|
+
e.SUPPORTS = p;
|
|
809
|
+
e.VIEWPORT = l;
|
|
810
|
+
e.WEBKIT = c;
|
|
811
|
+
e.abs = k;
|
|
812
|
+
e.alloc = K;
|
|
813
|
+
e.append = z;
|
|
814
|
+
e.assign = x;
|
|
815
|
+
e.caret = L;
|
|
816
|
+
e.char = U;
|
|
817
|
+
e.charat = M;
|
|
818
|
+
e.combine = N;
|
|
819
|
+
e.comment = ae;
|
|
820
|
+
e.commenter = J;
|
|
821
|
+
e.compile = X;
|
|
822
|
+
e.copy = j;
|
|
823
|
+
e.dealloc = V;
|
|
824
|
+
e.declaration = ce;
|
|
825
|
+
e.delimit = W;
|
|
826
|
+
e.delimiter = q;
|
|
827
|
+
e.escaping = Z;
|
|
828
|
+
e.from = $;
|
|
829
|
+
e.hash = E;
|
|
830
|
+
e.identifier = Q;
|
|
831
|
+
e.indexof = O;
|
|
832
|
+
e.match = T;
|
|
833
|
+
e.middleware = ie;
|
|
834
|
+
e.namespace = fe;
|
|
835
|
+
e.next = F;
|
|
836
|
+
e.node = P;
|
|
837
|
+
e.parse = ee;
|
|
838
|
+
e.peek = I;
|
|
839
|
+
e.prefix = ne;
|
|
840
|
+
e.prefixer = oe;
|
|
841
|
+
e.prev = _;
|
|
842
|
+
e.replace = A;
|
|
843
|
+
e.ruleset = re;
|
|
844
|
+
e.rulesheet = ue;
|
|
845
|
+
e.serialize = te;
|
|
846
|
+
e.sizeof = S;
|
|
847
|
+
e.slice = D;
|
|
848
|
+
e.stringify = se;
|
|
849
|
+
e.strlen = R;
|
|
850
|
+
e.substr = C;
|
|
851
|
+
e.token = Y;
|
|
852
|
+
e.tokenize = B;
|
|
853
|
+
e.tokenizer = H;
|
|
854
|
+
e.trim = y;
|
|
855
|
+
e.whitespace = G;
|
|
856
|
+
Object.defineProperty(e, "__esModule", {
|
|
857
|
+
value: true
|
|
858
|
+
});
|
|
859
|
+
});
|
|
860
|
+
})(stylis, stylisExports);
|
|
861
|
+
|
|
862
|
+
var weakMemoize = function weakMemoize(func) {
|
|
863
|
+
var cache = new WeakMap();
|
|
864
|
+
return function (arg) {
|
|
865
|
+
if (cache.has(arg)) {
|
|
866
|
+
// Use non-null assertion because we just checked that the cache `has` it
|
|
867
|
+
// This allows us to remove `undefined` from the return value
|
|
868
|
+
return cache.get(arg);
|
|
869
|
+
}
|
|
870
|
+
var ret = func(arg);
|
|
871
|
+
cache.set(arg, ret);
|
|
872
|
+
return ret;
|
|
873
|
+
};
|
|
874
|
+
};
|
|
875
|
+
|
|
876
|
+
function memoize(fn) {
|
|
877
|
+
var cache = Object.create(null);
|
|
878
|
+
return function (arg) {
|
|
879
|
+
if (cache[arg] === undefined) cache[arg] = fn(arg);
|
|
880
|
+
return cache[arg];
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
var isBrowser$1 = typeof document !== 'undefined';
|
|
885
|
+
var identifierWithPointTracking = function identifierWithPointTracking(begin, points, index) {
|
|
886
|
+
var previous = 0;
|
|
887
|
+
var character = 0;
|
|
888
|
+
while (true) {
|
|
889
|
+
previous = character;
|
|
890
|
+
character = stylisExports.peek(); // &\f
|
|
891
|
+
|
|
892
|
+
if (previous === 38 && character === 12) {
|
|
893
|
+
points[index] = 1;
|
|
894
|
+
}
|
|
895
|
+
if (stylisExports.token(character)) {
|
|
896
|
+
break;
|
|
897
|
+
}
|
|
898
|
+
stylisExports.next();
|
|
899
|
+
}
|
|
900
|
+
return stylisExports.slice(begin, stylisExports.position);
|
|
901
|
+
};
|
|
902
|
+
var toRules = function toRules(parsed, points) {
|
|
903
|
+
// pretend we've started with a comma
|
|
904
|
+
var index = -1;
|
|
905
|
+
var character = 44;
|
|
906
|
+
do {
|
|
907
|
+
switch (stylisExports.token(character)) {
|
|
908
|
+
case 0:
|
|
909
|
+
// &\f
|
|
910
|
+
if (character === 38 && stylisExports.peek() === 12) {
|
|
911
|
+
// this is not 100% correct, we don't account for literal sequences here - like for example quoted strings
|
|
912
|
+
// stylis inserts \f after & to know when & where it should replace this sequence with the context selector
|
|
913
|
+
// and when it should just concatenate the outer and inner selectors
|
|
914
|
+
// it's very unlikely for this sequence to actually appear in a different context, so we just leverage this fact here
|
|
915
|
+
points[index] = 1;
|
|
916
|
+
}
|
|
917
|
+
parsed[index] += identifierWithPointTracking(stylisExports.position - 1, points, index);
|
|
918
|
+
break;
|
|
919
|
+
case 2:
|
|
920
|
+
parsed[index] += stylisExports.delimit(character);
|
|
921
|
+
break;
|
|
922
|
+
case 4:
|
|
923
|
+
// comma
|
|
924
|
+
if (character === 44) {
|
|
925
|
+
// colon
|
|
926
|
+
parsed[++index] = stylisExports.peek() === 58 ? '&\f' : '';
|
|
927
|
+
points[index] = parsed[index].length;
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
// fallthrough
|
|
932
|
+
|
|
933
|
+
default:
|
|
934
|
+
parsed[index] += stylisExports.from(character);
|
|
935
|
+
}
|
|
936
|
+
} while (character = stylisExports.next());
|
|
937
|
+
return parsed;
|
|
938
|
+
};
|
|
939
|
+
var getRules = function getRules(value, points) {
|
|
940
|
+
return stylisExports.dealloc(toRules(stylisExports.alloc(value), points));
|
|
941
|
+
}; // WeakSet would be more appropriate, but only WeakMap is supported in IE11
|
|
942
|
+
|
|
943
|
+
var fixedElements = /* #__PURE__ */new WeakMap();
|
|
944
|
+
var compat = function compat(element) {
|
|
945
|
+
if (element.type !== 'rule' || !element.parent ||
|
|
946
|
+
// positive .length indicates that this rule contains pseudo
|
|
947
|
+
// negative .length indicates that this rule has been already prefixed
|
|
948
|
+
element.length < 1) {
|
|
949
|
+
return;
|
|
950
|
+
}
|
|
951
|
+
var value = element.value;
|
|
952
|
+
var parent = element.parent;
|
|
953
|
+
var isImplicitRule = element.column === parent.column && element.line === parent.line;
|
|
954
|
+
while (parent.type !== 'rule') {
|
|
955
|
+
parent = parent.parent;
|
|
956
|
+
if (!parent) return;
|
|
957
|
+
} // short-circuit for the simplest case
|
|
958
|
+
|
|
959
|
+
if (element.props.length === 1 && value.charCodeAt(0) !== 58
|
|
960
|
+
/* colon */ && !fixedElements.get(parent)) {
|
|
961
|
+
return;
|
|
962
|
+
} // if this is an implicitly inserted rule (the one eagerly inserted at the each new nested level)
|
|
963
|
+
// then the props has already been manipulated beforehand as they that array is shared between it and its "rule parent"
|
|
964
|
+
|
|
965
|
+
if (isImplicitRule) {
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
fixedElements.set(element, true);
|
|
969
|
+
var points = [];
|
|
970
|
+
var rules = getRules(value, points);
|
|
971
|
+
var parentRules = parent.props;
|
|
972
|
+
for (var i = 0, k = 0; i < rules.length; i++) {
|
|
973
|
+
for (var j = 0; j < parentRules.length; j++, k++) {
|
|
974
|
+
element.props[k] = points[i] ? rules[i].replace(/&\f/g, parentRules[j]) : parentRules[j] + " " + rules[i];
|
|
975
|
+
}
|
|
976
|
+
}
|
|
119
977
|
};
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
978
|
+
var removeLabel = function removeLabel(element) {
|
|
979
|
+
if (element.type === 'decl') {
|
|
980
|
+
var value = element.value;
|
|
981
|
+
if (
|
|
982
|
+
// charcode for l
|
|
983
|
+
value.charCodeAt(0) === 108 &&
|
|
984
|
+
// charcode for b
|
|
985
|
+
value.charCodeAt(2) === 98) {
|
|
986
|
+
// this ignores label
|
|
987
|
+
element["return"] = '';
|
|
988
|
+
element.value = '';
|
|
989
|
+
}
|
|
990
|
+
}
|
|
123
991
|
};
|
|
124
992
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
993
|
+
/* eslint-disable no-fallthrough */
|
|
994
|
+
|
|
995
|
+
function prefix(value, length) {
|
|
996
|
+
switch (stylisExports.hash(value, length)) {
|
|
997
|
+
// color-adjust
|
|
998
|
+
case 5103:
|
|
999
|
+
return stylisExports.WEBKIT + 'print-' + value + value;
|
|
1000
|
+
// animation, animation-(delay|direction|duration|fill-mode|iteration-count|name|play-state|timing-function)
|
|
1001
|
+
|
|
1002
|
+
case 5737:
|
|
1003
|
+
case 4201:
|
|
1004
|
+
case 3177:
|
|
1005
|
+
case 3433:
|
|
1006
|
+
case 1641:
|
|
1007
|
+
case 4457:
|
|
1008
|
+
case 2921: // text-decoration, filter, clip-path, backface-visibility, column, box-decoration-break
|
|
1009
|
+
|
|
1010
|
+
case 5572:
|
|
1011
|
+
case 6356:
|
|
1012
|
+
case 5844:
|
|
1013
|
+
case 3191:
|
|
1014
|
+
case 6645:
|
|
1015
|
+
case 3005: // mask, mask-image, mask-(mode|clip|size), mask-(repeat|origin), mask-position, mask-composite,
|
|
1016
|
+
|
|
1017
|
+
case 6391:
|
|
1018
|
+
case 5879:
|
|
1019
|
+
case 5623:
|
|
1020
|
+
case 6135:
|
|
1021
|
+
case 4599:
|
|
1022
|
+
case 4855: // background-clip, columns, column-(count|fill|gap|rule|rule-color|rule-style|rule-width|span|width)
|
|
1023
|
+
|
|
1024
|
+
case 4215:
|
|
1025
|
+
case 6389:
|
|
1026
|
+
case 5109:
|
|
1027
|
+
case 5365:
|
|
1028
|
+
case 5621:
|
|
1029
|
+
case 3829:
|
|
1030
|
+
return stylisExports.WEBKIT + value + value;
|
|
1031
|
+
// appearance, user-select, transform, hyphens, text-size-adjust
|
|
1032
|
+
|
|
1033
|
+
case 5349:
|
|
1034
|
+
case 4246:
|
|
1035
|
+
case 4810:
|
|
1036
|
+
case 6968:
|
|
1037
|
+
case 2756:
|
|
1038
|
+
return stylisExports.WEBKIT + value + stylisExports.MOZ + value + stylisExports.MS + value + value;
|
|
1039
|
+
// flex, flex-direction
|
|
1040
|
+
|
|
1041
|
+
case 6828:
|
|
1042
|
+
case 4268:
|
|
1043
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
|
|
1044
|
+
// order
|
|
1045
|
+
|
|
1046
|
+
case 6165:
|
|
1047
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-' + value + value;
|
|
1048
|
+
// align-items
|
|
1049
|
+
|
|
1050
|
+
case 5187:
|
|
1051
|
+
return stylisExports.WEBKIT + value + stylisExports.replace(value, /(\w+).+(:[^]+)/, stylisExports.WEBKIT + 'box-$1$2' + stylisExports.MS + 'flex-$1$2') + value;
|
|
1052
|
+
// align-self
|
|
1053
|
+
|
|
1054
|
+
case 5443:
|
|
1055
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-item-' + stylisExports.replace(value, /flex-|-self/, '') + value;
|
|
1056
|
+
// align-content
|
|
1057
|
+
|
|
1058
|
+
case 4675:
|
|
1059
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + 'flex-line-pack' + stylisExports.replace(value, /align-content|flex-|-self/, '') + value;
|
|
1060
|
+
// flex-shrink
|
|
1061
|
+
|
|
1062
|
+
case 5548:
|
|
1063
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'shrink', 'negative') + value;
|
|
1064
|
+
// flex-basis
|
|
1065
|
+
|
|
1066
|
+
case 5292:
|
|
1067
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'basis', 'preferred-size') + value;
|
|
1068
|
+
// flex-grow
|
|
1069
|
+
|
|
1070
|
+
case 6060:
|
|
1071
|
+
return stylisExports.WEBKIT + 'box-' + stylisExports.replace(value, '-grow', '') + stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, 'grow', 'positive') + value;
|
|
1072
|
+
// transition
|
|
1073
|
+
|
|
1074
|
+
case 4554:
|
|
1075
|
+
return stylisExports.WEBKIT + stylisExports.replace(value, /([^-])(transform)/g, '$1' + stylisExports.WEBKIT + '$2') + value;
|
|
1076
|
+
// cursor
|
|
1077
|
+
|
|
1078
|
+
case 6187:
|
|
1079
|
+
return stylisExports.replace(stylisExports.replace(stylisExports.replace(value, /(zoom-|grab)/, stylisExports.WEBKIT + '$1'), /(image-set)/, stylisExports.WEBKIT + '$1'), value, '') + value;
|
|
1080
|
+
// background, background-image
|
|
1081
|
+
|
|
1082
|
+
case 5495:
|
|
1083
|
+
case 3959:
|
|
1084
|
+
return stylisExports.replace(value, /(image-set\([^]*)/, stylisExports.WEBKIT + '$1' + '$`$1');
|
|
1085
|
+
// justify-content
|
|
1086
|
+
|
|
1087
|
+
case 4968:
|
|
1088
|
+
return stylisExports.replace(stylisExports.replace(value, /(.+:)(flex-)?(.*)/, stylisExports.WEBKIT + 'box-pack:$3' + stylisExports.MS + 'flex-pack:$3'), /s.+-b[^;]+/, 'justify') + stylisExports.WEBKIT + value + value;
|
|
1089
|
+
// (margin|padding)-inline-(start|end)
|
|
1090
|
+
|
|
1091
|
+
case 4095:
|
|
1092
|
+
case 3583:
|
|
1093
|
+
case 4068:
|
|
1094
|
+
case 2532:
|
|
1095
|
+
return stylisExports.replace(value, /(.+)-inline(.+)/, stylisExports.WEBKIT + '$1$2') + value;
|
|
1096
|
+
// (min|max)?(width|height|inline-size|block-size)
|
|
1097
|
+
|
|
1098
|
+
case 8116:
|
|
1099
|
+
case 7059:
|
|
1100
|
+
case 5753:
|
|
1101
|
+
case 5535:
|
|
1102
|
+
case 5445:
|
|
1103
|
+
case 5701:
|
|
1104
|
+
case 4933:
|
|
1105
|
+
case 4677:
|
|
1106
|
+
case 5533:
|
|
1107
|
+
case 5789:
|
|
1108
|
+
case 5021:
|
|
1109
|
+
case 4765:
|
|
1110
|
+
// stretch, max-content, min-content, fill-available
|
|
1111
|
+
if (stylisExports.strlen(value) - 1 - length > 6) switch (stylisExports.charat(value, length + 1)) {
|
|
1112
|
+
// (m)ax-content, (m)in-content
|
|
1113
|
+
case 109:
|
|
1114
|
+
// -
|
|
1115
|
+
if (stylisExports.charat(value, length + 4) !== 45) break;
|
|
1116
|
+
// (f)ill-available, (f)it-content
|
|
1117
|
+
|
|
1118
|
+
case 102:
|
|
1119
|
+
return stylisExports.replace(value, /(.+:)(.+)-([^]+)/, '$1' + stylisExports.WEBKIT + '$2-$3' + '$1' + stylisExports.MOZ + (stylisExports.charat(value, length + 3) == 108 ? '$3' : '$2-$3')) + value;
|
|
1120
|
+
// (s)tretch
|
|
1121
|
+
|
|
1122
|
+
case 115:
|
|
1123
|
+
return ~stylisExports.indexof(value, 'stretch') ? prefix(stylisExports.replace(value, 'stretch', 'fill-available'), length) + value : value;
|
|
1124
|
+
}
|
|
1125
|
+
break;
|
|
1126
|
+
// position: sticky
|
|
1127
|
+
|
|
1128
|
+
case 4949:
|
|
1129
|
+
// (s)ticky?
|
|
1130
|
+
if (stylisExports.charat(value, length + 1) !== 115) break;
|
|
1131
|
+
// display: (flex|inline-flex)
|
|
1132
|
+
|
|
1133
|
+
case 6444:
|
|
1134
|
+
switch (stylisExports.charat(value, stylisExports.strlen(value) - 3 - (~stylisExports.indexof(value, '!important') && 10))) {
|
|
1135
|
+
// stic(k)y
|
|
1136
|
+
case 107:
|
|
1137
|
+
return stylisExports.replace(value, ':', ':' + stylisExports.WEBKIT) + value;
|
|
1138
|
+
// (inline-)?fl(e)x
|
|
1139
|
+
|
|
1140
|
+
case 101:
|
|
1141
|
+
return stylisExports.replace(value, /(.+:)([^;!]+)(;|!.+)?/, '$1' + stylisExports.WEBKIT + (stylisExports.charat(value, 14) === 45 ? 'inline-' : '') + 'box$3' + '$1' + stylisExports.WEBKIT + '$2$3' + '$1' + stylisExports.MS + '$2box$3') + value;
|
|
1142
|
+
}
|
|
1143
|
+
break;
|
|
1144
|
+
// writing-mode
|
|
1145
|
+
|
|
1146
|
+
case 5936:
|
|
1147
|
+
switch (stylisExports.charat(value, length + 11)) {
|
|
1148
|
+
// vertical-l(r)
|
|
1149
|
+
case 114:
|
|
1150
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb') + value;
|
|
1151
|
+
// vertical-r(l)
|
|
1152
|
+
|
|
1153
|
+
case 108:
|
|
1154
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'tb-rl') + value;
|
|
1155
|
+
// horizontal(-)tb
|
|
1156
|
+
|
|
1157
|
+
case 45:
|
|
1158
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + stylisExports.replace(value, /[svh]\w+-[tblr]{2}/, 'lr') + value;
|
|
1159
|
+
}
|
|
1160
|
+
return stylisExports.WEBKIT + value + stylisExports.MS + value + value;
|
|
1161
|
+
}
|
|
1162
|
+
return value;
|
|
1163
|
+
}
|
|
1164
|
+
var prefixer = function prefixer(element, index, children, callback) {
|
|
1165
|
+
if (element.length > -1) if (!element["return"]) switch (element.type) {
|
|
1166
|
+
case stylisExports.DECLARATION:
|
|
1167
|
+
element["return"] = prefix(element.value, element.length);
|
|
1168
|
+
break;
|
|
1169
|
+
case stylisExports.KEYFRAMES:
|
|
1170
|
+
return stylisExports.serialize([stylisExports.copy(element, {
|
|
1171
|
+
value: stylisExports.replace(element.value, '@', '@' + stylisExports.WEBKIT)
|
|
1172
|
+
})], callback);
|
|
1173
|
+
case stylisExports.RULESET:
|
|
1174
|
+
if (element.length) return stylisExports.combine(element.props, function (value) {
|
|
1175
|
+
switch (stylisExports.match(value, /(::plac\w+|:read-\w+)/)) {
|
|
1176
|
+
// :read-(only|write)
|
|
1177
|
+
case ':read-only':
|
|
1178
|
+
case ':read-write':
|
|
1179
|
+
return stylisExports.serialize([stylisExports.copy(element, {
|
|
1180
|
+
props: [stylisExports.replace(value, /:(read-\w+)/, ':' + stylisExports.MOZ + '$1')]
|
|
1181
|
+
})], callback);
|
|
1182
|
+
// :placeholder
|
|
1183
|
+
|
|
1184
|
+
case '::placeholder':
|
|
1185
|
+
return stylisExports.serialize([stylisExports.copy(element, {
|
|
1186
|
+
props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.WEBKIT + 'input-$1')]
|
|
1187
|
+
}), stylisExports.copy(element, {
|
|
1188
|
+
props: [stylisExports.replace(value, /:(plac\w+)/, ':' + stylisExports.MOZ + '$1')]
|
|
1189
|
+
}), stylisExports.copy(element, {
|
|
1190
|
+
props: [stylisExports.replace(value, /:(plac\w+)/, stylisExports.MS + 'input-$1')]
|
|
1191
|
+
})], callback);
|
|
1192
|
+
}
|
|
1193
|
+
return '';
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
var getServerStylisCache = isBrowser$1 ? undefined : weakMemoize(function () {
|
|
1198
|
+
return memoize(function () {
|
|
1199
|
+
return {};
|
|
1200
|
+
});
|
|
1201
|
+
});
|
|
1202
|
+
var defaultStylisPlugins = [prefixer];
|
|
1203
|
+
var createCache = function createCache(options) {
|
|
1204
|
+
var key = options.key;
|
|
1205
|
+
if (isBrowser$1 && key === 'css') {
|
|
1206
|
+
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])"); // get SSRed styles out of the way of React's hydration
|
|
1207
|
+
// document.head is a safe place to move them to(though note document.head is not necessarily the last place they will be)
|
|
1208
|
+
// note this very very intentionally targets all style elements regardless of the key to ensure
|
|
1209
|
+
// that creating a cache works inside of render of a React component
|
|
1210
|
+
|
|
1211
|
+
Array.prototype.forEach.call(ssrStyles, function (node) {
|
|
1212
|
+
// we want to only move elements which have a space in the data-emotion attribute value
|
|
1213
|
+
// because that indicates that it is an Emotion 11 server-side rendered style elements
|
|
1214
|
+
// while we will already ignore Emotion 11 client-side inserted styles because of the :not([data-s]) part in the selector
|
|
1215
|
+
// Emotion 10 client-side inserted styles did not have data-s (but importantly did not have a space in their data-emotion attributes)
|
|
1216
|
+
// so checking for the space ensures that loading Emotion 11 after Emotion 10 has inserted some styles
|
|
1217
|
+
// will not result in the Emotion 10 styles being destroyed
|
|
1218
|
+
var dataEmotionAttribute = node.getAttribute('data-emotion');
|
|
1219
|
+
if (dataEmotionAttribute.indexOf(' ') === -1) {
|
|
1220
|
+
return;
|
|
1221
|
+
}
|
|
1222
|
+
document.head.appendChild(node);
|
|
1223
|
+
node.setAttribute('data-s', '');
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
var stylisPlugins = options.stylisPlugins || defaultStylisPlugins;
|
|
1227
|
+
var inserted = {};
|
|
1228
|
+
var container;
|
|
1229
|
+
var nodesToHydrate = [];
|
|
1230
|
+
if (isBrowser$1) {
|
|
1231
|
+
container = options.container || document.head;
|
|
1232
|
+
Array.prototype.forEach.call(
|
|
1233
|
+
// this means we will ignore elements which don't have a space in them which
|
|
1234
|
+
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
|
1235
|
+
document.querySelectorAll("style[data-emotion^=\"" + key + " \"]"), function (node) {
|
|
1236
|
+
var attrib = node.getAttribute("data-emotion").split(' ');
|
|
1237
|
+
for (var i = 1; i < attrib.length; i++) {
|
|
1238
|
+
inserted[attrib[i]] = true;
|
|
1239
|
+
}
|
|
1240
|
+
nodesToHydrate.push(node);
|
|
1241
|
+
});
|
|
1242
|
+
}
|
|
1243
|
+
var _insert;
|
|
1244
|
+
var omnipresentPlugins = [compat, removeLabel];
|
|
1245
|
+
if (!getServerStylisCache) {
|
|
1246
|
+
var currentSheet;
|
|
1247
|
+
var finalizingPlugins = [stylisExports.stringify, stylisExports.rulesheet(function (rule) {
|
|
1248
|
+
currentSheet.insert(rule);
|
|
1249
|
+
})];
|
|
1250
|
+
var serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, finalizingPlugins));
|
|
1251
|
+
var stylis = function stylis(styles) {
|
|
1252
|
+
return stylisExports.serialize(stylisExports.compile(styles), serializer);
|
|
1253
|
+
};
|
|
1254
|
+
_insert = function insert(selector, serialized, sheet, shouldCache) {
|
|
1255
|
+
currentSheet = sheet;
|
|
1256
|
+
stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
1257
|
+
if (shouldCache) {
|
|
1258
|
+
cache.inserted[serialized.name] = true;
|
|
1259
|
+
}
|
|
1260
|
+
};
|
|
1261
|
+
} else {
|
|
1262
|
+
var _finalizingPlugins = [stylisExports.stringify];
|
|
1263
|
+
var _serializer = stylisExports.middleware(omnipresentPlugins.concat(stylisPlugins, _finalizingPlugins));
|
|
1264
|
+
var _stylis = function _stylis(styles) {
|
|
1265
|
+
return stylisExports.serialize(stylisExports.compile(styles), _serializer);
|
|
1266
|
+
};
|
|
1267
|
+
var serverStylisCache = getServerStylisCache(stylisPlugins)(key);
|
|
1268
|
+
var getRules = function getRules(selector, serialized) {
|
|
1269
|
+
var name = serialized.name;
|
|
1270
|
+
if (serverStylisCache[name] === undefined) {
|
|
1271
|
+
serverStylisCache[name] = _stylis(selector ? selector + "{" + serialized.styles + "}" : serialized.styles);
|
|
1272
|
+
}
|
|
1273
|
+
return serverStylisCache[name];
|
|
1274
|
+
};
|
|
1275
|
+
_insert = function _insert(selector, serialized, sheet, shouldCache) {
|
|
1276
|
+
var name = serialized.name;
|
|
1277
|
+
var rules = getRules(selector, serialized);
|
|
1278
|
+
if (cache.compat === undefined) {
|
|
1279
|
+
// in regular mode, we don't set the styles on the inserted cache
|
|
1280
|
+
// since we don't need to and that would be wasting memory
|
|
1281
|
+
// we return them so that they are rendered in a style tag
|
|
1282
|
+
if (shouldCache) {
|
|
1283
|
+
cache.inserted[name] = true;
|
|
1284
|
+
}
|
|
1285
|
+
return rules;
|
|
1286
|
+
} else {
|
|
1287
|
+
// in compat mode, we put the styles on the inserted cache so
|
|
1288
|
+
// that emotion-server can pull out the styles
|
|
1289
|
+
// except when we don't want to cache it which was in Global but now
|
|
1290
|
+
// is nowhere but we don't want to do a major right now
|
|
1291
|
+
// and just in case we're going to leave the case here
|
|
1292
|
+
// it's also not affecting client side bundle size
|
|
1293
|
+
// so it's really not a big deal
|
|
1294
|
+
if (shouldCache) {
|
|
1295
|
+
cache.inserted[name] = rules;
|
|
1296
|
+
} else {
|
|
1297
|
+
return rules;
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
}
|
|
1302
|
+
var cache = {
|
|
1303
|
+
key: key,
|
|
1304
|
+
sheet: new StyleSheet({
|
|
1305
|
+
key: key,
|
|
1306
|
+
container: container,
|
|
1307
|
+
nonce: options.nonce,
|
|
1308
|
+
speedy: options.speedy,
|
|
1309
|
+
prepend: options.prepend,
|
|
1310
|
+
insertionPoint: options.insertionPoint
|
|
1311
|
+
}),
|
|
1312
|
+
nonce: options.nonce,
|
|
1313
|
+
inserted: inserted,
|
|
1314
|
+
registered: {},
|
|
1315
|
+
insert: _insert
|
|
1316
|
+
};
|
|
1317
|
+
cache.sheet.hydrate(nodesToHydrate);
|
|
1318
|
+
return cache;
|
|
1319
|
+
};
|
|
1320
|
+
|
|
1321
|
+
/* eslint-disable */
|
|
1322
|
+
// Inspired by https://github.com/garycourt/murmurhash-js
|
|
1323
|
+
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
|
|
1324
|
+
function murmur2(str) {
|
|
1325
|
+
// 'm' and 'r' are mixing constants generated offline.
|
|
1326
|
+
// They're not really 'magic', they just happen to work well.
|
|
1327
|
+
// const m = 0x5bd1e995;
|
|
1328
|
+
// const r = 24;
|
|
1329
|
+
// Initialize the hash
|
|
1330
|
+
var h = 0; // Mix 4 bytes at a time into the hash
|
|
1331
|
+
|
|
1332
|
+
var k,
|
|
1333
|
+
i = 0,
|
|
1334
|
+
len = str.length;
|
|
1335
|
+
for (; len >= 4; ++i, len -= 4) {
|
|
1336
|
+
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
|
|
1337
|
+
k = /* Math.imul(k, m): */
|
|
1338
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
|
|
1339
|
+
k ^= /* k >>> r: */
|
|
1340
|
+
k >>> 24;
|
|
1341
|
+
h = /* Math.imul(k, m): */
|
|
1342
|
+
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^ /* Math.imul(h, m): */
|
|
1343
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
1344
|
+
} // Handle the last few bytes of the input array
|
|
1345
|
+
|
|
1346
|
+
switch (len) {
|
|
1347
|
+
case 3:
|
|
1348
|
+
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
|
|
1349
|
+
case 2:
|
|
1350
|
+
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
|
|
1351
|
+
case 1:
|
|
1352
|
+
h ^= str.charCodeAt(i) & 0xff;
|
|
1353
|
+
h = /* Math.imul(h, m): */
|
|
1354
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
1355
|
+
} // Do a few final mixes of the hash to ensure the last few
|
|
1356
|
+
// bytes are well-incorporated.
|
|
1357
|
+
|
|
1358
|
+
h ^= h >>> 13;
|
|
1359
|
+
h = /* Math.imul(h, m): */
|
|
1360
|
+
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
|
|
1361
|
+
return ((h ^ h >>> 15) >>> 0).toString(36);
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
var unitlessKeys = {
|
|
1365
|
+
animationIterationCount: 1,
|
|
1366
|
+
aspectRatio: 1,
|
|
1367
|
+
borderImageOutset: 1,
|
|
1368
|
+
borderImageSlice: 1,
|
|
1369
|
+
borderImageWidth: 1,
|
|
1370
|
+
boxFlex: 1,
|
|
1371
|
+
boxFlexGroup: 1,
|
|
1372
|
+
boxOrdinalGroup: 1,
|
|
1373
|
+
columnCount: 1,
|
|
1374
|
+
columns: 1,
|
|
1375
|
+
flex: 1,
|
|
1376
|
+
flexGrow: 1,
|
|
1377
|
+
flexPositive: 1,
|
|
1378
|
+
flexShrink: 1,
|
|
1379
|
+
flexNegative: 1,
|
|
1380
|
+
flexOrder: 1,
|
|
1381
|
+
gridRow: 1,
|
|
1382
|
+
gridRowEnd: 1,
|
|
1383
|
+
gridRowSpan: 1,
|
|
1384
|
+
gridRowStart: 1,
|
|
1385
|
+
gridColumn: 1,
|
|
1386
|
+
gridColumnEnd: 1,
|
|
1387
|
+
gridColumnSpan: 1,
|
|
1388
|
+
gridColumnStart: 1,
|
|
1389
|
+
msGridRow: 1,
|
|
1390
|
+
msGridRowSpan: 1,
|
|
1391
|
+
msGridColumn: 1,
|
|
1392
|
+
msGridColumnSpan: 1,
|
|
1393
|
+
fontWeight: 1,
|
|
1394
|
+
lineHeight: 1,
|
|
1395
|
+
opacity: 1,
|
|
1396
|
+
order: 1,
|
|
1397
|
+
orphans: 1,
|
|
1398
|
+
scale: 1,
|
|
1399
|
+
tabSize: 1,
|
|
1400
|
+
widows: 1,
|
|
1401
|
+
zIndex: 1,
|
|
1402
|
+
zoom: 1,
|
|
1403
|
+
WebkitLineClamp: 1,
|
|
1404
|
+
// SVG-related properties
|
|
1405
|
+
fillOpacity: 1,
|
|
1406
|
+
floodOpacity: 1,
|
|
1407
|
+
stopOpacity: 1,
|
|
1408
|
+
strokeDasharray: 1,
|
|
1409
|
+
strokeDashoffset: 1,
|
|
1410
|
+
strokeMiterlimit: 1,
|
|
1411
|
+
strokeOpacity: 1,
|
|
1412
|
+
strokeWidth: 1
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
var isDevelopment = false;
|
|
1416
|
+
var hyphenateRegex = /[A-Z]|^ms/g;
|
|
1417
|
+
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
|
|
1418
|
+
var isCustomProperty = function isCustomProperty(property) {
|
|
1419
|
+
return property.charCodeAt(1) === 45;
|
|
1420
|
+
};
|
|
1421
|
+
var isProcessableValue = function isProcessableValue(value) {
|
|
1422
|
+
return value != null && typeof value !== 'boolean';
|
|
1423
|
+
};
|
|
1424
|
+
var processStyleName = /* #__PURE__ */memoize(function (styleName) {
|
|
1425
|
+
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
|
|
1426
|
+
});
|
|
1427
|
+
var processStyleValue = function processStyleValue(key, value) {
|
|
1428
|
+
switch (key) {
|
|
1429
|
+
case 'animation':
|
|
1430
|
+
case 'animationName':
|
|
1431
|
+
{
|
|
1432
|
+
if (typeof value === 'string') {
|
|
1433
|
+
return value.replace(animationRegex, function (match, p1, p2) {
|
|
1434
|
+
cursor = {
|
|
1435
|
+
name: p1,
|
|
1436
|
+
styles: p2,
|
|
1437
|
+
next: cursor
|
|
1438
|
+
};
|
|
1439
|
+
return p1;
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1444
|
+
if (unitlessKeys[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
|
|
1445
|
+
return value + 'px';
|
|
1446
|
+
}
|
|
1447
|
+
return value;
|
|
1448
|
+
};
|
|
1449
|
+
var noComponentSelectorMessage = 'Component selectors can only be used in conjunction with ' + '@emotion/babel-plugin, the swc Emotion plugin, or another Emotion-aware ' + 'compiler transform.';
|
|
1450
|
+
function handleInterpolation(mergedProps, registered, interpolation) {
|
|
1451
|
+
if (interpolation == null) {
|
|
1452
|
+
return '';
|
|
1453
|
+
}
|
|
1454
|
+
var componentSelector = interpolation;
|
|
1455
|
+
if (componentSelector.__emotion_styles !== undefined) {
|
|
1456
|
+
return componentSelector;
|
|
1457
|
+
}
|
|
1458
|
+
switch (typeof interpolation) {
|
|
1459
|
+
case 'boolean':
|
|
1460
|
+
{
|
|
1461
|
+
return '';
|
|
1462
|
+
}
|
|
1463
|
+
case 'object':
|
|
1464
|
+
{
|
|
1465
|
+
var keyframes = interpolation;
|
|
1466
|
+
if (keyframes.anim === 1) {
|
|
1467
|
+
cursor = {
|
|
1468
|
+
name: keyframes.name,
|
|
1469
|
+
styles: keyframes.styles,
|
|
1470
|
+
next: cursor
|
|
1471
|
+
};
|
|
1472
|
+
return keyframes.name;
|
|
1473
|
+
}
|
|
1474
|
+
var serializedStyles = interpolation;
|
|
1475
|
+
if (serializedStyles.styles !== undefined) {
|
|
1476
|
+
var next = serializedStyles.next;
|
|
1477
|
+
if (next !== undefined) {
|
|
1478
|
+
// not the most efficient thing ever but this is a pretty rare case
|
|
1479
|
+
// and there will be very few iterations of this generally
|
|
1480
|
+
while (next !== undefined) {
|
|
1481
|
+
cursor = {
|
|
1482
|
+
name: next.name,
|
|
1483
|
+
styles: next.styles,
|
|
1484
|
+
next: cursor
|
|
1485
|
+
};
|
|
1486
|
+
next = next.next;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
var styles = serializedStyles.styles + ";";
|
|
1490
|
+
return styles;
|
|
1491
|
+
}
|
|
1492
|
+
return createStringFromObject(mergedProps, registered, interpolation);
|
|
1493
|
+
}
|
|
1494
|
+
case 'function':
|
|
1495
|
+
{
|
|
1496
|
+
if (mergedProps !== undefined) {
|
|
1497
|
+
var previousCursor = cursor;
|
|
1498
|
+
var result = interpolation(mergedProps);
|
|
1499
|
+
cursor = previousCursor;
|
|
1500
|
+
return handleInterpolation(mergedProps, registered, result);
|
|
1501
|
+
}
|
|
1502
|
+
break;
|
|
1503
|
+
}
|
|
1504
|
+
} // finalize string values (regular strings and functions interpolated into css calls)
|
|
1505
|
+
|
|
1506
|
+
var asString = interpolation;
|
|
1507
|
+
if (registered == null) {
|
|
1508
|
+
return asString;
|
|
1509
|
+
}
|
|
1510
|
+
var cached = registered[asString];
|
|
1511
|
+
return cached !== undefined ? cached : asString;
|
|
1512
|
+
}
|
|
1513
|
+
function createStringFromObject(mergedProps, registered, obj) {
|
|
1514
|
+
var string = '';
|
|
1515
|
+
if (Array.isArray(obj)) {
|
|
1516
|
+
for (var i = 0; i < obj.length; i++) {
|
|
1517
|
+
string += handleInterpolation(mergedProps, registered, obj[i]) + ";";
|
|
1518
|
+
}
|
|
1519
|
+
} else {
|
|
1520
|
+
for (var key in obj) {
|
|
1521
|
+
var value = obj[key];
|
|
1522
|
+
if (typeof value !== 'object') {
|
|
1523
|
+
var asString = value;
|
|
1524
|
+
if (registered != null && registered[asString] !== undefined) {
|
|
1525
|
+
string += key + "{" + registered[asString] + "}";
|
|
1526
|
+
} else if (isProcessableValue(asString)) {
|
|
1527
|
+
string += processStyleName(key) + ":" + processStyleValue(key, asString) + ";";
|
|
1528
|
+
}
|
|
1529
|
+
} else {
|
|
1530
|
+
if (key === 'NO_COMPONENT_SELECTOR' && isDevelopment) {
|
|
1531
|
+
throw new Error(noComponentSelectorMessage);
|
|
1532
|
+
}
|
|
1533
|
+
if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
|
|
1534
|
+
for (var _i = 0; _i < value.length; _i++) {
|
|
1535
|
+
if (isProcessableValue(value[_i])) {
|
|
1536
|
+
string += processStyleName(key) + ":" + processStyleValue(key, value[_i]) + ";";
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
} else {
|
|
1540
|
+
var interpolated = handleInterpolation(mergedProps, registered, value);
|
|
1541
|
+
switch (key) {
|
|
1542
|
+
case 'animation':
|
|
1543
|
+
case 'animationName':
|
|
1544
|
+
{
|
|
1545
|
+
string += processStyleName(key) + ":" + interpolated + ";";
|
|
1546
|
+
break;
|
|
1547
|
+
}
|
|
1548
|
+
default:
|
|
1549
|
+
{
|
|
1550
|
+
string += key + "{" + interpolated + "}";
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
return string;
|
|
1558
|
+
}
|
|
1559
|
+
var labelPattern = /label:\s*([^\s;{]+)\s*(;|$)/g; // this is the cursor for keyframes
|
|
1560
|
+
// keyframes are stored on the SerializedStyles object as a linked list
|
|
1561
|
+
|
|
1562
|
+
var cursor;
|
|
1563
|
+
function serializeStyles(args, registered, mergedProps) {
|
|
1564
|
+
if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
|
|
1565
|
+
return args[0];
|
|
1566
|
+
}
|
|
1567
|
+
var stringMode = true;
|
|
1568
|
+
var styles = '';
|
|
1569
|
+
cursor = undefined;
|
|
1570
|
+
var strings = args[0];
|
|
1571
|
+
if (strings == null || strings.raw === undefined) {
|
|
1572
|
+
stringMode = false;
|
|
1573
|
+
styles += handleInterpolation(mergedProps, registered, strings);
|
|
1574
|
+
} else {
|
|
1575
|
+
var asTemplateStringsArr = strings;
|
|
1576
|
+
styles += asTemplateStringsArr[0];
|
|
1577
|
+
} // we start at 1 since we've already handled the first arg
|
|
1578
|
+
|
|
1579
|
+
for (var i = 1; i < args.length; i++) {
|
|
1580
|
+
styles += handleInterpolation(mergedProps, registered, args[i]);
|
|
1581
|
+
if (stringMode) {
|
|
1582
|
+
var templateStringsArr = strings;
|
|
1583
|
+
styles += templateStringsArr[i];
|
|
1584
|
+
}
|
|
1585
|
+
} // using a global regex with .exec is stateful so lastIndex has to be reset each time
|
|
1586
|
+
|
|
1587
|
+
labelPattern.lastIndex = 0;
|
|
1588
|
+
var identifierName = '';
|
|
1589
|
+
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
|
|
1590
|
+
|
|
1591
|
+
while ((match = labelPattern.exec(styles)) !== null) {
|
|
1592
|
+
identifierName += '-' + match[1];
|
|
1593
|
+
}
|
|
1594
|
+
var name = murmur2(styles) + identifierName;
|
|
1595
|
+
return {
|
|
1596
|
+
name: name,
|
|
1597
|
+
styles: styles,
|
|
1598
|
+
next: cursor
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
var isBrowser = typeof document !== 'undefined';
|
|
1603
|
+
function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
1604
|
+
var rawClassName = '';
|
|
1605
|
+
classNames.split(' ').forEach(function (className) {
|
|
1606
|
+
if (registered[className] !== undefined) {
|
|
1607
|
+
registeredStyles.push(registered[className] + ";");
|
|
1608
|
+
} else if (className) {
|
|
1609
|
+
rawClassName += className + " ";
|
|
1610
|
+
}
|
|
1611
|
+
});
|
|
1612
|
+
return rawClassName;
|
|
1613
|
+
}
|
|
1614
|
+
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
|
|
1615
|
+
var className = cache.key + "-" + serialized.name;
|
|
1616
|
+
if (
|
|
1617
|
+
// we only need to add the styles to the registered cache if the
|
|
1618
|
+
// class name could be used further down
|
|
1619
|
+
// the tree but if it's a string tag, we know it won't
|
|
1620
|
+
// so we don't have to add it to registered cache.
|
|
1621
|
+
// this improves memory usage since we can avoid storing the whole style string
|
|
1622
|
+
(isStringTag === false ||
|
|
1623
|
+
// we need to always store it if we're in compat mode and
|
|
1624
|
+
// in node since emotion-server relies on whether a style is in
|
|
1625
|
+
// the registered cache to know whether a style is global or not
|
|
1626
|
+
// also, note that this check will be dead code eliminated in the browser
|
|
1627
|
+
isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
|
|
1628
|
+
cache.registered[className] = serialized.styles;
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
1632
|
+
registerStyles(cache, serialized, isStringTag);
|
|
1633
|
+
var className = cache.key + "-" + serialized.name;
|
|
1634
|
+
if (cache.inserted[serialized.name] === undefined) {
|
|
1635
|
+
var stylesForSSR = '';
|
|
1636
|
+
var current = serialized;
|
|
1637
|
+
do {
|
|
1638
|
+
var maybeStyles = cache.insert(serialized === current ? "." + className : '', current, cache.sheet, true);
|
|
1639
|
+
if (!isBrowser && maybeStyles !== undefined) {
|
|
1640
|
+
stylesForSSR += maybeStyles;
|
|
1641
|
+
}
|
|
1642
|
+
current = current.next;
|
|
1643
|
+
} while (current !== undefined);
|
|
1644
|
+
if (!isBrowser && stylesForSSR.length !== 0) {
|
|
1645
|
+
return stylesForSSR;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
function insertWithoutScoping(cache, serialized) {
|
|
1651
|
+
if (cache.inserted[serialized.name] === undefined) {
|
|
1652
|
+
return cache.insert('', serialized, cache.sheet, true);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
function merge(registered, css, className) {
|
|
1656
|
+
var registeredStyles = [];
|
|
1657
|
+
var rawClassName = getRegisteredStyles(registered, registeredStyles, className);
|
|
1658
|
+
if (registeredStyles.length < 2) {
|
|
1659
|
+
return className;
|
|
1660
|
+
}
|
|
1661
|
+
return rawClassName + css(registeredStyles);
|
|
1662
|
+
}
|
|
1663
|
+
var createEmotion = function createEmotion(options) {
|
|
1664
|
+
var cache = createCache(options);
|
|
1665
|
+
cache.sheet.speedy = function (value) {
|
|
1666
|
+
this.isSpeedy = value;
|
|
1667
|
+
};
|
|
1668
|
+
cache.compat = true;
|
|
1669
|
+
var css = function css() {
|
|
1670
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1671
|
+
args[_key] = arguments[_key];
|
|
1672
|
+
}
|
|
1673
|
+
var serialized = serializeStyles(args, cache.registered, undefined);
|
|
1674
|
+
insertStyles(cache, serialized, false);
|
|
1675
|
+
return cache.key + "-" + serialized.name;
|
|
1676
|
+
};
|
|
1677
|
+
var keyframes = function keyframes() {
|
|
1678
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
1679
|
+
args[_key2] = arguments[_key2];
|
|
1680
|
+
}
|
|
1681
|
+
var serialized = serializeStyles(args, cache.registered);
|
|
1682
|
+
var animation = "animation-" + serialized.name;
|
|
1683
|
+
insertWithoutScoping(cache, {
|
|
1684
|
+
name: serialized.name,
|
|
1685
|
+
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
|
|
1686
|
+
});
|
|
1687
|
+
return animation;
|
|
1688
|
+
};
|
|
1689
|
+
var injectGlobal = function injectGlobal() {
|
|
1690
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
1691
|
+
args[_key3] = arguments[_key3];
|
|
1692
|
+
}
|
|
1693
|
+
var serialized = serializeStyles(args, cache.registered);
|
|
1694
|
+
insertWithoutScoping(cache, serialized);
|
|
1695
|
+
};
|
|
1696
|
+
var cx = function cx() {
|
|
1697
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
1698
|
+
args[_key4] = arguments[_key4];
|
|
1699
|
+
}
|
|
1700
|
+
return merge(cache.registered, css, classnames(args));
|
|
1701
|
+
};
|
|
1702
|
+
return {
|
|
1703
|
+
css: css,
|
|
1704
|
+
cx: cx,
|
|
1705
|
+
injectGlobal: injectGlobal,
|
|
1706
|
+
keyframes: keyframes,
|
|
1707
|
+
hydrate: function hydrate(ids) {
|
|
1708
|
+
ids.forEach(function (key) {
|
|
1709
|
+
cache.inserted[key] = true;
|
|
1710
|
+
});
|
|
1711
|
+
},
|
|
1712
|
+
flush: function flush() {
|
|
1713
|
+
cache.registered = {};
|
|
1714
|
+
cache.inserted = {};
|
|
1715
|
+
cache.sheet.flush();
|
|
1716
|
+
},
|
|
1717
|
+
sheet: cache.sheet,
|
|
1718
|
+
cache: cache,
|
|
1719
|
+
getRegisteredStyles: getRegisteredStyles.bind(null, cache.registered),
|
|
1720
|
+
merge: merge.bind(null, cache.registered, css)
|
|
1721
|
+
};
|
|
1722
|
+
};
|
|
1723
|
+
var classnames = function classnames(args) {
|
|
1724
|
+
var cls = '';
|
|
1725
|
+
for (var i = 0; i < args.length; i++) {
|
|
1726
|
+
var arg = args[i];
|
|
1727
|
+
if (arg == null) continue;
|
|
1728
|
+
var toAdd = void 0;
|
|
1729
|
+
switch (typeof arg) {
|
|
1730
|
+
case 'boolean':
|
|
1731
|
+
break;
|
|
1732
|
+
case 'object':
|
|
1733
|
+
{
|
|
1734
|
+
if (Array.isArray(arg)) {
|
|
1735
|
+
toAdd = classnames(arg);
|
|
1736
|
+
} else {
|
|
1737
|
+
toAdd = '';
|
|
1738
|
+
for (var k in arg) {
|
|
1739
|
+
if (arg[k] && k) {
|
|
1740
|
+
toAdd && (toAdd += ' ');
|
|
1741
|
+
toAdd += k;
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
default:
|
|
1748
|
+
{
|
|
1749
|
+
toAdd = arg;
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
if (toAdd) {
|
|
1753
|
+
cls && (cls += ' ');
|
|
1754
|
+
cls += toAdd;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
return cls;
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
var _createEmotion = createEmotion({
|
|
1761
|
+
key: 'css'
|
|
1762
|
+
}),
|
|
1763
|
+
css = _createEmotion.css;
|
|
1764
|
+
|
|
1765
|
+
const staticBackdropStyles = ctDesignStyleManager.makeStyles(() => ({
|
|
1766
|
+
root: {
|
|
129
1767
|
display: 'flex',
|
|
130
1768
|
alignItems: 'center',
|
|
131
1769
|
justifyContent: 'center',
|
|
132
|
-
background: blur ? 'rgba(26, 26, 26, 0.6);' : '',
|
|
133
|
-
backdropFilter: variant !== exports.ModalVariant.DARK && blur ? '(1px)' : 'none',
|
|
134
1770
|
zIndex: -1,
|
|
135
1771
|
inset: 0,
|
|
136
|
-
}
|
|
137
|
-
};
|
|
1772
|
+
},
|
|
1773
|
+
}));
|
|
1774
|
+
const getBackdropDynamicStyles = ({ blur, variant }) => ({
|
|
1775
|
+
backgroundColor: blur ? 'rgba(26, 26, 26, 0.6)' : '',
|
|
1776
|
+
backdropFilter: variant !== exports.ModalVariant.DARK && blur ? 'blur(1px)' : 'none',
|
|
1777
|
+
});
|
|
138
1778
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return (__assign(__assign({}, getBackdropStyles({ blur: blur, theme: theme, variant: variant })), css));
|
|
1779
|
+
const webStyle = css({
|
|
1780
|
+
position: 'fixed',
|
|
142
1781
|
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
|
|
1782
|
+
const Backdrop = React.forwardRef((_a, forwardedRef) => {
|
|
1783
|
+
var _b;
|
|
1784
|
+
var { children, open, transitionDuration, styleConfig, blur, variant = exports.ModalVariant.NEUTRAL } = _a, rest = __rest(_a, ["children", "open", "transitionDuration", "styleConfig", "blur", "variant"]);
|
|
1785
|
+
const dynamicStyles = ctDesignStyleManager.useStyles(() => ({ root: getBackdropDynamicStyles({ blur, variant }) }), [blur, variant]);
|
|
1786
|
+
const className = ctDesignStyleManager.useWebMergeStyles([staticBackdropStyles.root, dynamicStyles.root, webStyle, ...((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _b !== void 0 ? _b : [])], [dynamicStyles.root, styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root]);
|
|
1787
|
+
return (jsxRuntime.jsx(ctDesignTransition.Transition, { in: open, timeout: transitionDuration, type: 'fade', children: jsxRuntime.jsx("div", Object.assign({ ref: forwardedRef, className: className }, rest, { children: children })) }));
|
|
147
1788
|
});
|
|
1789
|
+
Backdrop.displayName = 'Backdrop';
|
|
148
1790
|
|
|
149
|
-
|
|
1791
|
+
const ModalContext = React.createContext({
|
|
150
1792
|
footerAlignment: 'end',
|
|
151
1793
|
hideCrossIcon: false,
|
|
152
|
-
onClose:
|
|
1794
|
+
onClose: () => {
|
|
1795
|
+
return;
|
|
1796
|
+
},
|
|
153
1797
|
size: 'MEDIUM',
|
|
154
1798
|
});
|
|
155
1799
|
|
|
156
|
-
|
|
157
|
-
|
|
1800
|
+
class Handler {
|
|
1801
|
+
constructor() {
|
|
158
1802
|
this.parent = [];
|
|
159
1803
|
}
|
|
160
|
-
|
|
1804
|
+
static handleStyle(parentNode) {
|
|
161
1805
|
if (parentNode.ref) {
|
|
162
|
-
parentNode.prevStyle =
|
|
1806
|
+
parentNode.prevStyle = Object.assign({}, parentNode.ref.style);
|
|
163
1807
|
parentNode.ref.style.overflow = 'hidden';
|
|
164
1808
|
}
|
|
165
|
-
}
|
|
166
|
-
|
|
1809
|
+
}
|
|
1810
|
+
static restoreStyle(parentNode) {
|
|
167
1811
|
if (parentNode.ref && parentNode.prevStyle) {
|
|
168
1812
|
parentNode.ref.style.overflow = parentNode.prevStyle.overflow || '';
|
|
169
1813
|
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (parentNode === void 0) { parentNode = { ref: null }; }
|
|
1814
|
+
}
|
|
1815
|
+
mount(modal, parentNode = { ref: null }) {
|
|
173
1816
|
if (parentNode.ref) {
|
|
174
|
-
|
|
1817
|
+
const parentIndex = this.parent.findIndex((node) => node.parentNode === parentNode);
|
|
175
1818
|
if (parentIndex !== -1) {
|
|
176
1819
|
this.parent[parentIndex].modals.push(modal);
|
|
177
1820
|
}
|
|
178
1821
|
else {
|
|
179
1822
|
this.parent.push({
|
|
180
|
-
parentNode
|
|
1823
|
+
parentNode,
|
|
181
1824
|
modals: [modal],
|
|
182
1825
|
});
|
|
183
1826
|
}
|
|
184
1827
|
Handler.handleStyle(parentNode);
|
|
185
1828
|
}
|
|
186
1829
|
else {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
Handler.handleStyle(
|
|
190
|
-
if (
|
|
1830
|
+
const parent = this.getTopModal();
|
|
1831
|
+
parent.modals.push(modal);
|
|
1832
|
+
Handler.handleStyle(parent.parentNode);
|
|
1833
|
+
if (parent.parentNode.ref !== document.body) {
|
|
191
1834
|
this.parent.push({
|
|
192
1835
|
parentNode: modal,
|
|
193
1836
|
modals: [],
|
|
194
1837
|
});
|
|
195
1838
|
}
|
|
196
1839
|
else {
|
|
197
|
-
this.parent.push(
|
|
1840
|
+
this.parent.push(parent);
|
|
198
1841
|
}
|
|
199
1842
|
}
|
|
200
|
-
}
|
|
201
|
-
|
|
1843
|
+
}
|
|
1844
|
+
getTopModal() {
|
|
202
1845
|
if (this.parent.length) {
|
|
203
1846
|
return this.parent[this.parent.length - 1];
|
|
204
1847
|
}
|
|
205
1848
|
else {
|
|
206
1849
|
return { parentNode: { ref: document.body, prevStyle: document.body.style }, modals: [] };
|
|
207
1850
|
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
1851
|
+
}
|
|
1852
|
+
remove(modal) {
|
|
1853
|
+
const parentNode = this.parent.find((node) => node.modals.find((_modal) => _modal.ref === modal.ref));
|
|
211
1854
|
if (parentNode) {
|
|
212
1855
|
Handler.restoreStyle(parentNode.parentNode);
|
|
213
1856
|
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
}());
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
217
1859
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1860
|
+
const staticModalStyles = ctDesignStyleManager.makeStyles(() => ({
|
|
1861
|
+
modalContainer: {
|
|
1862
|
+
position: 'relative',
|
|
1863
|
+
display: 'flex',
|
|
1864
|
+
flexDirection: 'column',
|
|
1865
|
+
margin: 'auto',
|
|
1866
|
+
height: '100%',
|
|
1867
|
+
width: '100%',
|
|
1868
|
+
alignItems: 'center',
|
|
1869
|
+
},
|
|
1870
|
+
outerContainer: {
|
|
1871
|
+
position: 'absolute',
|
|
1872
|
+
top: 0,
|
|
1873
|
+
left: 0,
|
|
1874
|
+
right: 0,
|
|
1875
|
+
bottom: 0,
|
|
1876
|
+
},
|
|
1877
|
+
}));
|
|
1878
|
+
const handler = new Handler();
|
|
1879
|
+
const DEFAULT_ANIMATION_TIME = 350;
|
|
1880
|
+
const Modal = React.forwardRef((_a, forwardedRef) => {
|
|
1881
|
+
var { children, insidePortal = true, open = false, onClose, onKeyDown, hideCrossIcon, footerAlignment, size = 'MEDIUM', allowBackdropClose = true, blur = true, backDropComponent, animationDuration = DEFAULT_ANIMATION_TIME, placement = 'center', bottomMargin, variant, styleConfig = {} } = _a, rest = __rest(_a, ["children", "insidePortal", "open", "onClose", "onKeyDown", "hideCrossIcon", "footerAlignment", "size", "allowBackdropClose", "blur", "backDropComponent", "animationDuration", "placement", "bottomMargin", "variant", "styleConfig"]);
|
|
1882
|
+
const { backdropStyles = [], modalContentStyles = [], root: rootStyles = [] } = styleConfig;
|
|
1883
|
+
const overflowY = 'auto';
|
|
1884
|
+
const isFullScreen = size === exports.ModalSize.FULL_SCREEN;
|
|
1885
|
+
const dynamicStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
1886
|
+
modalContainer: {
|
|
1887
|
+
position: 'relative',
|
|
1888
|
+
zIndex: theme.zIndex.modal,
|
|
1889
|
+
overflowY,
|
|
1890
|
+
display: 'flex',
|
|
1891
|
+
flexDirection: 'column',
|
|
1892
|
+
margin: 'auto',
|
|
1893
|
+
height: '100%',
|
|
1894
|
+
width: '100%',
|
|
1895
|
+
justifyContent: placement === exports.ModalPlacement.BOTTOM ? 'flex-end' : exports.ModalPlacement.CENTER,
|
|
1896
|
+
alignItems: exports.ModalPlacement.CENTER,
|
|
1897
|
+
paddingBottom: placement === exports.ModalPlacement.BOTTOM ? bottomMargin || 188 : 0,
|
|
1898
|
+
},
|
|
1899
|
+
outerContainer: Object.assign({ zIndex: theme.zIndex.modal }, (isFullScreen ? { height: '100vh', width: '100vw' } : {})),
|
|
1900
|
+
childContainer: {
|
|
1901
|
+
boxSizing: 'content-box',
|
|
1902
|
+
borderRadius: size === exports.ModalSize.FULL_SCREEN ? 0 : theme.spacing['3'],
|
|
1903
|
+
borderBottomLeftRadius: size === exports.ModalSize.FULL_SCREEN ? 0 : theme.spacing['3'],
|
|
1904
|
+
borderBottomRightRadius: size === exports.ModalSize.FULL_SCREEN ? 0 : theme.spacing['3'],
|
|
1905
|
+
backgroundColor: variant === exports.ModalVariant.DARK ? theme.color.background.defaultDarkest : theme.color.background.neutral,
|
|
1906
|
+
overflowY,
|
|
1907
|
+
maxHeight: size === exports.ModalSize.FULL_SCREEN
|
|
1908
|
+
? '100vh'
|
|
1909
|
+
: `calc(100vh - 64px)`,
|
|
1910
|
+
boxShadow: blur
|
|
1911
|
+
? `${theme.elevation.modalBlurLight}, ${theme.elevation.modalBlurMedium}, ${theme.elevation.modalBlurHeavy}`
|
|
1912
|
+
: 'none',
|
|
1913
|
+
},
|
|
1914
|
+
}), [size, overflowY, placement, bottomMargin, isFullScreen, blur, variant]);
|
|
1915
|
+
const webDynamicStyles = React.useMemo(() => {
|
|
1916
|
+
const styles = getModalSizeStyles(size);
|
|
1917
|
+
return css(styles);
|
|
1918
|
+
}, [size]);
|
|
1919
|
+
const modalContainerClass = ctDesignStyleManager.useWebMergeStyles([staticModalStyles.modalContainer, dynamicStyles.modalContainer, webDynamicStyles, ...rootStyles], [dynamicStyles.modalContainer, rootStyles, webDynamicStyles]);
|
|
1920
|
+
const modalRef = React.useRef(null);
|
|
1921
|
+
const containerRef = React.useRef({});
|
|
1922
|
+
const [isOpen, setIsOpen] = React.useState(open);
|
|
1923
|
+
const handleRef = useMergeRefs__default.default(forwardedRef, modalRef);
|
|
1924
|
+
React.useLayoutEffect(() => {
|
|
1925
|
+
let timeoutId = null;
|
|
234
1926
|
if (!open) {
|
|
235
|
-
timeoutId = setTimeout(
|
|
1927
|
+
timeoutId = setTimeout(() => setIsOpen(false), animationDuration);
|
|
236
1928
|
}
|
|
237
1929
|
else {
|
|
238
1930
|
setIsOpen(true);
|
|
239
1931
|
}
|
|
240
|
-
return
|
|
1932
|
+
return () => {
|
|
241
1933
|
timeoutId && clearTimeout(timeoutId);
|
|
242
1934
|
};
|
|
243
1935
|
}, [open, animationDuration]);
|
|
244
|
-
React.useEffect(
|
|
1936
|
+
React.useEffect(() => {
|
|
245
1937
|
if (modalRef.current) {
|
|
246
1938
|
modalRef.current.scrollTop = 0;
|
|
247
1939
|
}
|
|
@@ -249,22 +1941,22 @@
|
|
|
249
1941
|
containerRef.current.modalRef = modalRef.current;
|
|
250
1942
|
handler.mount({ ref: containerRef.current.modalRef });
|
|
251
1943
|
}
|
|
252
|
-
return
|
|
1944
|
+
return () => {
|
|
253
1945
|
if (open) {
|
|
254
1946
|
handler.remove({ ref: containerRef.current.modalRef || null });
|
|
255
1947
|
containerRef.current.modalRef = modalRef.current;
|
|
256
1948
|
}
|
|
257
1949
|
};
|
|
258
1950
|
}, [open]);
|
|
259
|
-
|
|
1951
|
+
const handleBackdropClick = (event) => {
|
|
260
1952
|
if (event.target !== event.currentTarget) {
|
|
261
1953
|
return;
|
|
262
1954
|
}
|
|
263
1955
|
if (allowBackdropClose && onClose) {
|
|
264
|
-
onClose(
|
|
1956
|
+
onClose();
|
|
265
1957
|
}
|
|
266
1958
|
};
|
|
267
|
-
|
|
1959
|
+
const handleKeyDown = (event) => {
|
|
268
1960
|
if (onKeyDown) {
|
|
269
1961
|
onKeyDown(event);
|
|
270
1962
|
}
|
|
@@ -273,82 +1965,131 @@
|
|
|
273
1965
|
}
|
|
274
1966
|
event.stopPropagation();
|
|
275
1967
|
if (onClose) {
|
|
276
|
-
onClose(
|
|
1968
|
+
onClose();
|
|
277
1969
|
}
|
|
278
1970
|
};
|
|
279
1971
|
if (!isOpen || !React__default.default.isValidElement(children)) {
|
|
280
1972
|
return null;
|
|
281
1973
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
1974
|
+
const modalElement = (jsxRuntime.jsx(ctDesignFocusLock.FocusLock, { children: jsxRuntime.jsx(ctDesignContainer.Container, Object.assign({ styleConfig: {
|
|
1975
|
+
root: [staticModalStyles.outerContainer, dynamicStyles.outerContainer],
|
|
1976
|
+
} }, rest, { children: jsxRuntime.jsxs("div", { className: modalContainerClass, onKeyDown: handleKeyDown, ref: handleRef, children: [backDropComponent || (jsxRuntime.jsx(Backdrop, { open: open, blur: blur, transitionDuration: 350, onClick: handleBackdropClick, variant: variant, styleConfig: { root: backdropStyles } })), jsxRuntime.jsx(ctDesignTransition.Transition, { type: isFullScreen ? 'slide' : 'fade', slideDirection: 'up', in: open, timeout: animationDuration, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: {
|
|
1977
|
+
root: [dynamicStyles.childContainer, ...modalContentStyles],
|
|
1978
|
+
}, children: jsxRuntime.jsx(ModalContext.Provider, { value: { footerAlignment, hideCrossIcon, onClose, size }, children: React__default.default.cloneElement(children, Object.assign(Object.assign({}, children.props), { onClose })) }) }) })] }) })) }));
|
|
1979
|
+
if (insidePortal) {
|
|
1980
|
+
return jsxRuntime.jsx(ctDesignPortal.Portal, { id: 'global_modal', children: modalElement });
|
|
1981
|
+
}
|
|
1982
|
+
return modalElement;
|
|
291
1983
|
});
|
|
1984
|
+
Modal.displayName = 'Modal';
|
|
292
1985
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
start: 'flex-start',
|
|
298
|
-
end: 'flex-end',
|
|
299
|
-
center: 'center',
|
|
300
|
-
}[footerAlignment];
|
|
301
|
-
var theme = ctDesignTheme.useTheme();
|
|
302
|
-
return (jsxRuntime.jsx(ctDesignContainer.Container, __assign({ display: 'flex', justifyContent: alignment, className: className, css: __assign(__assign({}, css), { padding: '16px 24px 16px 24px', boxShadow: theme.elevation.topE1 }) }, { children: children })));
|
|
1986
|
+
const alignmentMap = {
|
|
1987
|
+
start: 'flex-start',
|
|
1988
|
+
end: 'flex-end',
|
|
1989
|
+
center: 'center',
|
|
303
1990
|
};
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
1991
|
+
const ModalAction = ({ children, styleConfig }) => {
|
|
1992
|
+
var _a;
|
|
1993
|
+
const { footerAlignment = 'end' } = React.useContext(ModalContext);
|
|
1994
|
+
const rootStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
1995
|
+
root: {
|
|
1996
|
+
display: 'flex',
|
|
1997
|
+
justifyContent: alignmentMap[footerAlignment],
|
|
1998
|
+
paddingTop: theme.spacing[6],
|
|
1999
|
+
paddingBottom: theme.spacing[6],
|
|
2000
|
+
paddingLeft: theme.spacing[4],
|
|
2001
|
+
paddingRight: theme.spacing[4],
|
|
2002
|
+
boxShadow: theme.elevation.topE1,
|
|
2003
|
+
},
|
|
2004
|
+
}), [footerAlignment]);
|
|
2005
|
+
return jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [rootStyles.root, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: children });
|
|
309
2006
|
};
|
|
310
2007
|
|
|
311
|
-
|
|
312
|
-
var
|
|
313
|
-
|
|
314
|
-
|
|
2008
|
+
const ModalContainer = ({ children, styleConfig }) => {
|
|
2009
|
+
var _a;
|
|
2010
|
+
const { size } = React.useContext(ModalContext);
|
|
2011
|
+
const isFullScreen = size === exports.ModalSize.FULL_SCREEN;
|
|
2012
|
+
const rootStyles = ctDesignStyleManager.useStyles(() => ({
|
|
2013
|
+
root: {
|
|
2014
|
+
maxHeight: isFullScreen ? '100%' : 'calc(100vh - 128px)',
|
|
2015
|
+
overflowY: 'auto',
|
|
2016
|
+
height: isFullScreen ? '100%' : undefined,
|
|
2017
|
+
},
|
|
2018
|
+
}), [isFullScreen]);
|
|
2019
|
+
return (jsxRuntime.jsx(ctDesignBox.Box, { boxSize: 'zero', styleConfig: { root: [rootStyles.root, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: children }));
|
|
315
2020
|
};
|
|
316
2021
|
|
|
317
|
-
|
|
318
|
-
var
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
2022
|
+
const ModalContent = ({ children, styleConfig }) => {
|
|
2023
|
+
var _a, _b;
|
|
2024
|
+
const staticStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
2025
|
+
root: {
|
|
2026
|
+
overflowY: 'auto',
|
|
2027
|
+
flex: 1,
|
|
2028
|
+
},
|
|
2029
|
+
innerBox: {
|
|
2030
|
+
paddingTop: theme.spacing[6],
|
|
2031
|
+
paddingBottom: theme.spacing[6],
|
|
2032
|
+
paddingLeft: theme.spacing[4],
|
|
2033
|
+
paddingRight: theme.spacing[4],
|
|
2034
|
+
width: '100%',
|
|
2035
|
+
},
|
|
2036
|
+
}), []);
|
|
2037
|
+
return (jsxRuntime.jsx(ctDesignBox.Box, { boxSize: 'zero', styleConfig: { root: [staticStyles.root, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: jsxRuntime.jsx(ctDesignBox.Box, { boxSize: 'xLarge', styleConfig: { root: [staticStyles.innerBox, ...((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.innerBox) !== null && _b !== void 0 ? _b : [])] }, children: children }) }));
|
|
324
2038
|
};
|
|
325
2039
|
|
|
326
|
-
|
|
327
|
-
var
|
|
328
|
-
|
|
2040
|
+
const ModalTitle = ({ children, styleConfig }) => {
|
|
2041
|
+
var _a, _b;
|
|
2042
|
+
const theme = ctDesignTheme.useTheme();
|
|
2043
|
+
const { hideCrossIcon, onClose, size } = React.useContext(ModalContext);
|
|
2044
|
+
const isFullScreen = size === exports.ModalSize.FULL_SCREEN;
|
|
2045
|
+
const rootStyles = ctDesignStyleManager.useStyles((t) => ({
|
|
2046
|
+
root: {
|
|
2047
|
+
display: 'flex',
|
|
2048
|
+
justifyContent: 'space-between',
|
|
2049
|
+
paddingTop: isFullScreen ? t.spacing[5] : t.spacing[6],
|
|
2050
|
+
paddingBottom: isFullScreen ? t.spacing[5] : t.spacing[4],
|
|
2051
|
+
paddingLeft: isFullScreen ? t.spacing[7] : t.spacing[6],
|
|
2052
|
+
paddingRight: isFullScreen ? t.spacing[7] : t.spacing[6],
|
|
2053
|
+
boxShadow: t.elevation.bottomE1,
|
|
2054
|
+
},
|
|
2055
|
+
iconContainer: {
|
|
2056
|
+
cursor: 'pointer',
|
|
2057
|
+
marginTop: t.spacing[1],
|
|
2058
|
+
marginRight: t.spacing[1],
|
|
2059
|
+
},
|
|
2060
|
+
}), [isFullScreen]);
|
|
2061
|
+
return (jsxRuntime.jsxs(ctDesignContainer.Container, { styleConfig: { root: [rootStyles.root, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: [jsxRuntime.jsx(ctDesignTypography.Typography, { variant: 'HM2', styleConfig: styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.childrenTypography, children: children }), !hideCrossIcon && (jsxRuntime.jsx(ctDesignContainer.Container, { onClick: onClose, styleConfig: {
|
|
2062
|
+
root: [rootStyles.iconContainer, ...((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.iconContainer) !== null && _b !== void 0 ? _b : [])],
|
|
2063
|
+
}, children: jsxRuntime.jsx(ctDesignIcons.Cross, Object.assign({ height: 24, width: 24, crossColor: theme.color.text.heading }, styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.crossIcon)) }))] }));
|
|
329
2064
|
};
|
|
330
2065
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
2066
|
+
const staticStyles = ctDesignStyleManager.makeStyles(() => ({
|
|
2067
|
+
root: {
|
|
2068
|
+
position: 'relative',
|
|
2069
|
+
},
|
|
2070
|
+
}));
|
|
2071
|
+
const getCloseIcon = (isBack = false, variant = exports.ModalVariant.NEUTRAL) => {
|
|
334
2072
|
if (isBack) {
|
|
335
2073
|
return jsxRuntime.jsx(ctDesignIcons.ModalBack, {});
|
|
336
2074
|
}
|
|
337
2075
|
return variant === exports.ModalVariant.DARK ? (jsxRuntime.jsx(ctDesignIcons.Cross, { height: 24, width: 24, crossColor: 'rgba(255, 255, 255, 1)' })) : (jsxRuntime.jsx(ctDesignIcons.Cross, { height: 24, width: 24, crossColor: '#1A1A1A' }));
|
|
338
2076
|
};
|
|
339
|
-
|
|
340
|
-
var _a
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
};
|
|
348
|
-
return (jsxRuntime.jsx(Modal, __assign({ ref: forwardedRef, blur: true, size: 'NONE', insidePortal: true, variant: variant, overflowY: 'unset' }, rest, { children: jsxRuntime.jsxs(ctDesignContainer.Container, __assign({ className: 'p-relative' }, { children: [jsxRuntime.jsx(ctDesignContainer.Container, __assign({ css: __assign({}, wrapperCss) }, { children: jsxRuntime.jsx(ctDesignContainer.Container, __assign({ css: __assign({}, closeButtonStyles), onClick: onCloseClick }, { children: CloseIcon })) })), children] })) })));
|
|
2077
|
+
const ModalWithCloseOverlay = React.forwardRef((props, forwardedRef) => {
|
|
2078
|
+
var _a, _b, _c;
|
|
2079
|
+
const _d = props || {}, { isBack = false, isCenter, isTop = true, variant = exports.ModalVariant.NEUTRAL, children, styleConfig, wrapperStyles } = _d, rest = __rest(_d, ["isBack", "isCenter", "isTop", "variant", "children", "styleConfig", "wrapperStyles"]);
|
|
2080
|
+
const { onClose } = rest;
|
|
2081
|
+
const closeButtonStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
2082
|
+
root: Object.assign({ position: 'absolute', right: (isCenter ? '50%' : isBack ? 'unset' : 0), transform: isCenter ? 'translateX(50%)' : 'none', backgroundColor: variant === exports.ModalVariant.DARK ? theme.color.background.defaultDarkest : theme.color.background.neutral, height: 32, width: 32, display: 'flex', alignItems: 'center', padding: theme.spacing[1], borderRadius: 40, cursor: 'pointer' }, (isTop ? { top: -42 } : { bottom: -42 })),
|
|
2083
|
+
}), [isBack, variant, isCenter, isTop]);
|
|
2084
|
+
const CloseIcon = getCloseIcon(isBack, variant);
|
|
2085
|
+
return (jsxRuntime.jsx(Modal, Object.assign({ ref: forwardedRef, blur: true, size: 'NONE', insidePortal: true, variant: variant }, rest, { children: jsxRuntime.jsxs(ctDesignContainer.Container, { styleConfig: { root: [staticStyles.root, ...((_a = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.root) !== null && _a !== void 0 ? _a : [])] }, children: [jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [...(wrapperStyles !== null && wrapperStyles !== void 0 ? wrapperStyles : []), ...((_b = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.wrapper) !== null && _b !== void 0 ? _b : [])] }, children: jsxRuntime.jsx(ctDesignContainer.Container, { styleConfig: { root: [closeButtonStyles.root, ...((_c = styleConfig === null || styleConfig === void 0 ? void 0 : styleConfig.closeButton) !== null && _c !== void 0 ? _c : [])] }, onClick: () => onClose === null || onClose === void 0 ? void 0 : onClose(), children: CloseIcon }) }), children] }) })));
|
|
349
2086
|
});
|
|
2087
|
+
ModalWithCloseOverlay.displayName = 'ModalWithCloseOverlay';
|
|
2088
|
+
|
|
2089
|
+
const MODAL_ANIMATION_DURATION = 350;
|
|
350
2090
|
|
|
351
2091
|
exports.Backdrop = Backdrop;
|
|
2092
|
+
exports.MODAL_ANIMATION_DURATION = MODAL_ANIMATION_DURATION;
|
|
352
2093
|
exports.Modal = Modal;
|
|
353
2094
|
exports.ModalAction = ModalAction;
|
|
354
2095
|
exports.ModalContainer = ModalContainer;
|