@cleartrip/ct-design-theme 4.0.0-TEST.1 → 4.0.0-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ThemeProvider/ThemeProvider.d.ts +2 -7
- package/dist/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/dist/ThemeProvider/ThemeProvider.native.d.ts +5 -0
- package/dist/ThemeProvider/ThemeProvider.native.d.ts.map +1 -0
- package/dist/ct-design-theme.browser.cjs.js +1 -1
- package/dist/ct-design-theme.browser.cjs.js.map +1 -1
- package/dist/ct-design-theme.browser.esm.js +1 -1
- package/dist/ct-design-theme.browser.esm.js.map +1 -1
- package/dist/ct-design-theme.cjs.js +114 -128
- package/dist/ct-design-theme.cjs.js.map +1 -1
- package/dist/ct-design-theme.esm.js +114 -128
- package/dist/ct-design-theme.esm.js.map +1 -1
- package/dist/ct-design-theme.umd.js +148 -192
- package/dist/ct-design-theme.umd.js.map +1 -1
- package/dist/themes/B2CTheme.d.ts +6 -64
- package/dist/themes/B2CTheme.d.ts.map +1 -1
- package/dist/themes/BaseTheme.d.ts.map +1 -1
- package/dist/themes/type.d.ts +3 -4
- package/dist/themes/type.d.ts.map +1 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/ThemeProvider/ThemeProvider.native.tsx +20 -0
- package/src/ThemeProvider/ThemeProvider.tsx +29 -0
- package/src/ThemeProvider/index.ts +3 -0
- package/src/ThemeProvider/type.ts +15 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useTheme.ts +11 -0
- package/src/hooks/useThemeContext.ts +8 -0
- package/src/index.ts +5 -0
- package/src/themes/B2BTheme.ts +94 -0
- package/src/themes/B2CTheme.ts +5 -0
- package/src/themes/BaseTheme.ts +308 -0
- package/src/themes/SMTheme.ts +86 -0
- package/src/themes/UltraFkTheme.ts +93 -0
- package/src/themes/index.ts +7 -0
- package/src/themes/type.ts +233 -0
- package/src/utils/ThemeManager.ts +36 -0
- package/src/utils/index.ts +21 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@cleartrip/ct-design-tokens'), require('react'), require('react
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@cleartrip/ct-design-tokens', 'react', 'react
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemTheme = {}, global.ctDesignTokens, global.
|
|
5
|
-
})(this, (function (exports, ctDesignTokens,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@cleartrip/ct-design-tokens'), require('react/jsx-runtime'), require('react')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@cleartrip/ct-design-tokens', 'react/jsx-runtime', 'react'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemTheme = {}, global.ctDesignTokens, global.jsxRuntime, global.React));
|
|
5
|
+
})(this, (function (exports, ctDesignTokens, jsxRuntime, React) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -24,38 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
Copyright (c) Microsoft Corporation.
|
|
29
|
-
|
|
30
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
31
|
-
purpose with or without fee is hereby granted.
|
|
32
|
-
|
|
33
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
34
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
35
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
36
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
37
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
38
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
39
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
40
|
-
***************************************************************************** */
|
|
41
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
42
|
-
|
|
43
|
-
var __assign = function () {
|
|
44
|
-
__assign = Object.assign || function __assign(t) {
|
|
45
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
46
|
-
s = arguments[i];
|
|
47
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
48
|
-
}
|
|
49
|
-
return t;
|
|
50
|
-
};
|
|
51
|
-
return __assign.apply(this, arguments);
|
|
52
|
-
};
|
|
53
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
54
|
-
var e = new Error(message);
|
|
55
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
var duration = {
|
|
27
|
+
const duration = {
|
|
59
28
|
shortest: 150,
|
|
60
29
|
shorter: 200,
|
|
61
30
|
short: 250,
|
|
@@ -64,7 +33,7 @@
|
|
|
64
33
|
enteringScreen: 225,
|
|
65
34
|
leavingScreen: 195,
|
|
66
35
|
};
|
|
67
|
-
|
|
36
|
+
const easing = {
|
|
68
37
|
easeInOut: 'cubic-bezier(0.4, 0, 0.2, 1)',
|
|
69
38
|
easeOut: 'cubic-bezier(0.0, 0, 0.2, 1)',
|
|
70
39
|
easeIn: 'cubic-bezier(0.4, 0, 1, 1)',
|
|
@@ -74,41 +43,36 @@
|
|
|
74
43
|
if (!height) {
|
|
75
44
|
return 0;
|
|
76
45
|
}
|
|
77
|
-
|
|
78
|
-
return Math.round((4 + 15 *
|
|
46
|
+
const constant = height / 36;
|
|
47
|
+
return Math.round((4 + 15 * constant ** 0.25 + constant / 5) * 10);
|
|
79
48
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (options === void 0) { options = {}; }
|
|
83
|
-
var _a = options.duration, durationOption = _a === void 0 ? duration.standard : _a, _b = options.easing, easingOption = _b === void 0 ? easing.easeInOut : _b, _c = options.delay, delay = _c === void 0 ? 0 : _c;
|
|
49
|
+
const create = (props = ['all'], options = {}) => {
|
|
50
|
+
const { duration: durationOption = duration.standard, easing: easingOption = easing.easeInOut, delay = 0 } = options;
|
|
84
51
|
return (Array.isArray(props) ? props : [props])
|
|
85
|
-
.map(
|
|
86
|
-
return "".concat(animatedProp, " ").concat(typeof durationOption === 'string' ? durationOption : "".concat(durationOption, "ms"), " ").concat(easingOption, " ").concat(typeof delay === 'string' ? delay : "".concat(delay, "ms"));
|
|
87
|
-
})
|
|
52
|
+
.map((animatedProp) => `${animatedProp} ${typeof durationOption === 'string' ? durationOption : `${durationOption}ms`} ${easingOption} ${typeof delay === 'string' ? delay : `${delay}ms`}`)
|
|
88
53
|
.join(',');
|
|
89
54
|
};
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
_a);
|
|
55
|
+
const hover$3 = (key) => {
|
|
56
|
+
const bg = {
|
|
57
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
58
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
59
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
60
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
61
|
+
[ctDesignTokens.colors.brand]: ctDesignTokens.colors.bgPrimaryHover,
|
|
62
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
63
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
64
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
65
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
66
|
+
[ctDesignTokens.colors.link2]: ctDesignTokens.colors.link2Hover,
|
|
67
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
68
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
69
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
70
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
71
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
72
|
+
};
|
|
109
73
|
return bg[key];
|
|
110
74
|
};
|
|
111
|
-
|
|
75
|
+
const zIndex = {
|
|
112
76
|
drawer: 1200,
|
|
113
77
|
modal: 1300,
|
|
114
78
|
popOver: 1300,
|
|
@@ -117,7 +81,7 @@
|
|
|
117
81
|
toolbar: 50,
|
|
118
82
|
bottomSheet: 100,
|
|
119
83
|
};
|
|
120
|
-
|
|
84
|
+
const counter$1 = {
|
|
121
85
|
enabled: {
|
|
122
86
|
stroke: ctDesignTokens.colors.neutral900,
|
|
123
87
|
},
|
|
@@ -125,7 +89,7 @@
|
|
|
125
89
|
stroke: ctDesignTokens.colors.neutral500,
|
|
126
90
|
},
|
|
127
91
|
};
|
|
128
|
-
|
|
92
|
+
const BaseTheme = {
|
|
129
93
|
color: {
|
|
130
94
|
text: {
|
|
131
95
|
primary: ctDesignTokens.colors.neutral900,
|
|
@@ -297,16 +261,16 @@
|
|
|
297
261
|
selected: ctDesignTokens.colors.neutral900,
|
|
298
262
|
},
|
|
299
263
|
},
|
|
300
|
-
elevation:
|
|
301
|
-
border:
|
|
302
|
-
spacing:
|
|
303
|
-
typography:
|
|
304
|
-
size:
|
|
264
|
+
elevation: Object.assign({}, ctDesignTokens.elevation),
|
|
265
|
+
border: Object.assign({}, ctDesignTokens.border),
|
|
266
|
+
spacing: Object.assign({}, ctDesignTokens.spacing),
|
|
267
|
+
typography: Object.assign({}, ctDesignTokens.typography),
|
|
268
|
+
size: Object.assign({}, ctDesignTokens.size),
|
|
305
269
|
transitions: {
|
|
306
|
-
duration
|
|
307
|
-
easing
|
|
308
|
-
create
|
|
309
|
-
getAutoHeightDuration
|
|
270
|
+
duration,
|
|
271
|
+
easing,
|
|
272
|
+
create,
|
|
273
|
+
getAutoHeightDuration,
|
|
310
274
|
},
|
|
311
275
|
underline: {
|
|
312
276
|
link: '',
|
|
@@ -326,33 +290,32 @@
|
|
|
326
290
|
pinaColada750: '',
|
|
327
291
|
alert: '',
|
|
328
292
|
},
|
|
329
|
-
zIndex
|
|
293
|
+
zIndex,
|
|
330
294
|
};
|
|
331
295
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
_a);
|
|
296
|
+
const B2CTheme = Object.assign({}, BaseTheme);
|
|
297
|
+
|
|
298
|
+
const hover$2 = (key) => {
|
|
299
|
+
const bg = {
|
|
300
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
301
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
302
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
303
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
304
|
+
[ctDesignTokens.colors.brand]: ctDesignTokens.colors.bgPrimaryHover,
|
|
305
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
306
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
307
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
308
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
309
|
+
[ctDesignTokens.colors.link2]: ctDesignTokens.colors.link2Hover,
|
|
310
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
311
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
312
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
313
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
314
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
315
|
+
};
|
|
353
316
|
return bg[key];
|
|
354
317
|
};
|
|
355
|
-
|
|
318
|
+
const B2BTheme = Object.assign(Object.assign({}, BaseTheme), { color: Object.assign(Object.assign({}, BaseTheme.color), { text: Object.assign(Object.assign({}, BaseTheme.color.text), { secondary: ctDesignTokens.colors.link2, tertiary: ctDesignTokens.colors.neutral500 }), button: Object.assign(Object.assign({}, BaseTheme.color.button), { outlinedPrimaryLabel: ctDesignTokens.colors.link2, outlinedPrimaryBorder: ctDesignTokens.colors.link2, outlinedPrimaryBg: ctDesignTokens.colors.neutral100, outlinedSecondaryLabel: ctDesignTokens.colors.neutral900, outlinedSecondaryBorder: ctDesignTokens.colors.neutral900, outlinedSecondaryBg: ctDesignTokens.colors.neutral100, outlinedTertiaryLabel: ctDesignTokens.colors.brand, outlinedTertiaryBorder: ctDesignTokens.colors.brand, outlinedTertiaryBg: ctDesignTokens.colors.neutral100, outlinedDisabledLabel: ctDesignTokens.colors.disabledText, outlinedDisabledBg: ctDesignTokens.colors.neutral300, containedPrimaryLabel: ctDesignTokens.colors.neutral100, containedPrimaryBg: ctDesignTokens.colors.link2, containedSecondaryLabel: ctDesignTokens.colors.neutral100, containedSecondaryBg: ctDesignTokens.colors.neutral900, containedTertiaryLabel: ctDesignTokens.colors.neutral100, containedTertiaryBg: ctDesignTokens.colors.brand, containedDisabledLabel: ctDesignTokens.colors.disabledText, containedDisabledBg: ctDesignTokens.colors.neutral300, hover: hover$2 }), chip: Object.assign(Object.assign({}, BaseTheme.color.chip), { selectedPrimaryLabel: ctDesignTokens.colors.link2, selectedPrimaryBorder: ctDesignTokens.colors.link2, selectedPrimaryBg: ctDesignTokens.colors.linkBg }), tab: Object.assign(Object.assign({}, BaseTheme.color.tab), { nonSelectedPrimaryLabel: ctDesignTokens.colors.neutral900, selectedPrimaryLabel: ctDesignTokens.colors.link2 }), background: Object.assign(Object.assign({}, BaseTheme.color.background), { primary: ctDesignTokens.colors.link2, secondary: ctDesignTokens.colors.neutral900, tertiary: ctDesignTokens.colors.brand }), border: Object.assign(Object.assign({}, BaseTheme.color.border), { primary: ctDesignTokens.colors.link2, secondary: ctDesignTokens.colors.neutral900, tertiary: ctDesignTokens.colors.brand, divider: ctDesignTokens.colors.line }), spinner: {
|
|
356
319
|
primary: ctDesignTokens.colors.link2,
|
|
357
320
|
primaryBg: ctDesignTokens.colors.alertBg,
|
|
358
321
|
}, calendar: {
|
|
@@ -361,30 +324,29 @@
|
|
|
361
324
|
selected: ctDesignTokens.colors.link2,
|
|
362
325
|
} }) });
|
|
363
326
|
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
_a);
|
|
327
|
+
const hover$1 = (key) => {
|
|
328
|
+
const bg = {
|
|
329
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
330
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
331
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
332
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
333
|
+
[ctDesignTokens.colors.brand]: ctDesignTokens.colors.bgPrimaryHover,
|
|
334
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
335
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
336
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
337
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
338
|
+
[ctDesignTokens.colors.link2]: ctDesignTokens.colors.link2Hover,
|
|
339
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
340
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
341
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
342
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
343
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
344
|
+
[ctDesignTokens.colors.bluePrimary500]: ctDesignTokens.colors.bluePrimary500,
|
|
345
|
+
[ctDesignTokens.colors.yellowSecondary]: ctDesignTokens.colors.yellowSecondary,
|
|
346
|
+
};
|
|
385
347
|
return bg[key];
|
|
386
348
|
};
|
|
387
|
-
|
|
349
|
+
const counter = {
|
|
388
350
|
enabled: {
|
|
389
351
|
stroke: ctDesignTokens.colors.bluePrimary500,
|
|
390
352
|
},
|
|
@@ -392,43 +354,32 @@
|
|
|
392
354
|
stroke: ctDesignTokens.colors.neutral500,
|
|
393
355
|
},
|
|
394
356
|
};
|
|
395
|
-
|
|
357
|
+
const FKTheme = Object.assign(Object.assign({}, BaseTheme), { color: Object.assign(Object.assign({}, BaseTheme.color), { text: Object.assign(Object.assign({}, BaseTheme.color.text), { link: ctDesignTokens.colors.bluePrimary500 }), button: Object.assign(Object.assign({}, BaseTheme.color.button), { outlinedPrimaryLabel: ctDesignTokens.colors.primaryNeutral900, outlinedPrimaryBg: ctDesignTokens.colors.neutral100, containedPrimaryLabel: ctDesignTokens.colors.neutral100, containedPrimaryBg: ctDesignTokens.colors.bluePrimary500, containedSecondaryLabel: ctDesignTokens.colors.primaryNeutral900, containedSecondaryBg: ctDesignTokens.colors.yellowSecondary, hover: hover$1 }), chip: Object.assign(Object.assign({}, BaseTheme.color.chip), { selectedPrimaryLabel: ctDesignTokens.colors.link2, selectedPrimaryBorder: ctDesignTokens.colors.link2, selectedPrimaryBg: ctDesignTokens.colors.linkBg, nonSelectedPrimaryLabel: ctDesignTokens.colors.neutral900 }), tab: Object.assign(Object.assign({}, BaseTheme.color.tab), { nonSelectedPrimaryLabel: ctDesignTokens.colors.neutral900, selectedPrimaryLabel: ctDesignTokens.colors.bluePrimary500 }), background: Object.assign(Object.assign({}, BaseTheme.color.background), { primary: ctDesignTokens.colors.bluePrimary500, secondary: ctDesignTokens.colors.neutral900, tertiary: ctDesignTokens.colors.brand, linkLightBg: ctDesignTokens.colors.blueSecondary }), border: Object.assign(Object.assign({}, BaseTheme.color.border), { primary: ctDesignTokens.colors.bluePrimary500, brand: ctDesignTokens.colors.bluePrimary500 }), spinner: {
|
|
396
358
|
primary: ctDesignTokens.colors.link2,
|
|
397
359
|
primaryBg: ctDesignTokens.colors.alertBg,
|
|
398
|
-
}, counter
|
|
360
|
+
}, counter, calendar: {
|
|
399
361
|
accent: ctDesignTokens.colors.bluePrimary500,
|
|
400
362
|
background: ctDesignTokens.colors.blueSecondary,
|
|
401
363
|
selected: ctDesignTokens.colors.bluePrimary500,
|
|
402
364
|
} }) });
|
|
403
365
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
_a);
|
|
366
|
+
const hover = (key) => {
|
|
367
|
+
const bg = {
|
|
368
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
369
|
+
[ctDesignTokens.colors.brand]: ctDesignTokens.colors.bgPrimaryHover,
|
|
370
|
+
[ctDesignTokens.colors.disabledText]: ctDesignTokens.colors.disabledText,
|
|
371
|
+
[ctDesignTokens.colors.neutral300]: ctDesignTokens.colors.neutral300,
|
|
372
|
+
[ctDesignTokens.colors.link2]: ctDesignTokens.colors.link2Hover,
|
|
373
|
+
[ctDesignTokens.colors.neutral100]: ctDesignTokens.colors.neutral100,
|
|
374
|
+
[ctDesignTokens.colors.neutral900]: ctDesignTokens.colors.neutral900,
|
|
375
|
+
[ctDesignTokens.colors.superGrey700]: ctDesignTokens.colors.superGrey700,
|
|
376
|
+
[ctDesignTokens.colors.superGrey300]: ctDesignTokens.colors.superGrey300,
|
|
377
|
+
[ctDesignTokens.colors.superGrey800]: ctDesignTokens.colors.superGrey800,
|
|
378
|
+
[ctDesignTokens.colors.superGreen500]: ctDesignTokens.colors.superGreen500,
|
|
379
|
+
};
|
|
419
380
|
return bg[key];
|
|
420
381
|
};
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
function _extends$1() {
|
|
424
|
-
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
425
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
426
|
-
var t = arguments[e];
|
|
427
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
428
|
-
}
|
|
429
|
-
return n;
|
|
430
|
-
}, _extends$1.apply(null, arguments);
|
|
431
|
-
}
|
|
382
|
+
const SMTheme = Object.assign(Object.assign({}, BaseTheme), { color: Object.assign(Object.assign({}, BaseTheme.color), { text: Object.assign(Object.assign({}, BaseTheme.color.text), { primary: ctDesignTokens.colors.superGrey800, secondary: ctDesignTokens.colors.superGrey500, tertiary: ctDesignTokens.colors.superGrey400, warning: ctDesignTokens.colors.systemRed500, disabled: ctDesignTokens.colors.superGrey400, subHeading: ctDesignTokens.colors.superGrey400, success: ctDesignTokens.colors.systemGreen500, link: ctDesignTokens.colors.superBlue500, link2: ctDesignTokens.colors.superBlue500 }), button: Object.assign(Object.assign({}, BaseTheme.color.button), { outlinedPrimaryLabel: ctDesignTokens.colors.superGrey700, outlinedPrimaryBorder: ctDesignTokens.colors.superGrey300, outlinedTertiaryLabel: ctDesignTokens.colors.superGrey700, outlinedTertiaryBorder: ctDesignTokens.colors.superGrey300, outlinedDisabledLabel: ctDesignTokens.colors.disabledText, containedSecondaryLabel: ctDesignTokens.colors.superGrey800, containedPrimaryBg: ctDesignTokens.colors.superBlue500, containedSecondaryBg: ctDesignTokens.colors.superGreen500, containedTertiaryLabel: ctDesignTokens.colors.superGrey300, containedDisabledLabel: ctDesignTokens.colors.disabledText, containedPrimaryLabel: ctDesignTokens.colors.neutral100, hover: hover }), chip: Object.assign(Object.assign({}, BaseTheme.color.chip), { selectedPrimaryLabel: ctDesignTokens.colors.superBlue500, selectedPrimaryBorder: ctDesignTokens.colors.superBlue500, selectedPrimaryBg: ctDesignTokens.colors.superBlue25, disabledPrimaryLabel: ctDesignTokens.colors.superGrey400, nonSelectedPrimaryLabel: ctDesignTokens.colors.superGrey700, disabledPrimaryBg: ctDesignTokens.colors.superGrey200 }), tab: Object.assign(Object.assign({}, BaseTheme.color.tab), { nonSelectedPrimaryLabel: ctDesignTokens.colors.superGrey500, selectedPrimaryLabel: ctDesignTokens.colors.superBlue500 }), background: Object.assign(Object.assign({}, BaseTheme.color.background), { primary: ctDesignTokens.colors.superBlue500, disabled: ctDesignTokens.colors.superGrey50, disabledDark: ctDesignTokens.colors.superGrey300, warning: ctDesignTokens.colors.systemRed500 }), border: Object.assign(Object.assign({}, BaseTheme.color.border), { primary: ctDesignTokens.colors.superBlue500, secondary: ctDesignTokens.colors.neutral900, disabledDark: ctDesignTokens.colors.superGrey300, defaultDark: ctDesignTokens.colors.superGrey400, default: ctDesignTokens.colors.superGrey300, disabled: ctDesignTokens.colors.superGrey200 }) }) });
|
|
432
383
|
|
|
433
384
|
var isDevelopment$3 = false;
|
|
434
385
|
|
|
@@ -1635,6 +1586,16 @@
|
|
|
1635
1586
|
return cache;
|
|
1636
1587
|
};
|
|
1637
1588
|
|
|
1589
|
+
function _extends$1() {
|
|
1590
|
+
return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
|
|
1591
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
1592
|
+
var t = arguments[e];
|
|
1593
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1594
|
+
}
|
|
1595
|
+
return n;
|
|
1596
|
+
}, _extends$1.apply(null, arguments);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1638
1599
|
var reactIsExports = {};
|
|
1639
1600
|
var reactIs$1 = {
|
|
1640
1601
|
get exports(){ return reactIsExports; },
|
|
@@ -2301,8 +2262,28 @@
|
|
|
2301
2262
|
(function (_JSX) {})(JSX || (JSX = _jsx.JSX || (_jsx.JSX = {})));
|
|
2302
2263
|
})(jsx || (jsx = {}));
|
|
2303
2264
|
|
|
2265
|
+
const getTheme = (themeType) => {
|
|
2266
|
+
switch (themeType) {
|
|
2267
|
+
case 'B2C': {
|
|
2268
|
+
return B2CTheme;
|
|
2269
|
+
}
|
|
2270
|
+
case 'B2B': {
|
|
2271
|
+
return B2BTheme;
|
|
2272
|
+
}
|
|
2273
|
+
case 'FK': {
|
|
2274
|
+
return FKTheme;
|
|
2275
|
+
}
|
|
2276
|
+
case 'SM': {
|
|
2277
|
+
return SMTheme;
|
|
2278
|
+
}
|
|
2279
|
+
default: {
|
|
2280
|
+
return B2CTheme;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2304
2285
|
// eslint-disable-next-line no-undef
|
|
2305
|
-
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
2286
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
2306
2287
|
|
|
2307
2288
|
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
2308
2289
|
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
@@ -2464,58 +2445,34 @@
|
|
|
2464
2445
|
styled[tagName] = styled(tagName);
|
|
2465
2446
|
});
|
|
2466
2447
|
|
|
2467
|
-
|
|
2468
|
-
switch (themeType) {
|
|
2469
|
-
case 'B2C': {
|
|
2470
|
-
return B2CTheme;
|
|
2471
|
-
}
|
|
2472
|
-
case 'B2B': {
|
|
2473
|
-
return B2BTheme;
|
|
2474
|
-
}
|
|
2475
|
-
case 'FK': {
|
|
2476
|
-
return FKTheme;
|
|
2477
|
-
}
|
|
2478
|
-
case 'SM': {
|
|
2479
|
-
return SMTheme;
|
|
2480
|
-
}
|
|
2481
|
-
default: {
|
|
2482
|
-
return B2CTheme;
|
|
2483
|
-
}
|
|
2484
|
-
}
|
|
2485
|
-
};
|
|
2486
|
-
|
|
2487
|
-
var ThemeContext = React.createContext({
|
|
2448
|
+
const ThemeContext = React.createContext({
|
|
2488
2449
|
theme: B2CTheme,
|
|
2489
2450
|
platform: 'mobile',
|
|
2490
2451
|
});
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
return (jsxRuntime.jsx(ThemeContext.Provider, __assign({ value: { theme: theme, platform: platform } }, { children: jsxRuntime.jsx(ThemeProvider$1, __assign({ theme: theme }, { children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: children }) })) })));
|
|
2495
|
-
};
|
|
2496
|
-
ThemeProvider.defaultProps = {
|
|
2497
|
-
children: null,
|
|
2452
|
+
const ThemeProvider = ({ children, theme: themeType = 'B2C', platform = 'mobile', }) => {
|
|
2453
|
+
const theme = getTheme(themeType);
|
|
2454
|
+
return (jsxRuntime.jsx(ThemeContext.Provider, { value: { theme, platform }, children: jsxRuntime.jsx(ThemeProvider$1, { theme: theme, children: jsxRuntime.jsx(jsxRuntime.Fragment, { children: children }) }) }));
|
|
2498
2455
|
};
|
|
2499
2456
|
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2457
|
+
const useTheme = () => {
|
|
2458
|
+
const themeContext = React.useContext(ThemeContext);
|
|
2459
|
+
const { theme } = themeContext || { theme: B2CTheme };
|
|
2503
2460
|
return theme;
|
|
2504
2461
|
};
|
|
2505
2462
|
|
|
2506
|
-
|
|
2463
|
+
const useThemeContext = () => {
|
|
2507
2464
|
return React.useContext(ThemeContext);
|
|
2508
2465
|
};
|
|
2509
2466
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2467
|
+
class ThemeManagerClass {
|
|
2468
|
+
constructor() {
|
|
2512
2469
|
if (ThemeManagerClass.instance) {
|
|
2513
2470
|
throw new Error('You can only create one instance!');
|
|
2514
2471
|
}
|
|
2515
2472
|
ThemeManagerClass.instance = this;
|
|
2516
2473
|
this.theme = B2CTheme;
|
|
2517
2474
|
}
|
|
2518
|
-
|
|
2475
|
+
set(theme) {
|
|
2519
2476
|
switch (theme) {
|
|
2520
2477
|
case 'B2C':
|
|
2521
2478
|
default: {
|
|
@@ -2523,13 +2480,12 @@
|
|
|
2523
2480
|
break;
|
|
2524
2481
|
}
|
|
2525
2482
|
}
|
|
2526
|
-
}
|
|
2527
|
-
|
|
2483
|
+
}
|
|
2484
|
+
get() {
|
|
2528
2485
|
return this.theme;
|
|
2529
|
-
}
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
var ThemeManager = Object.freeze(new ThemeManagerClass());
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
const ThemeManager = Object.freeze(new ThemeManagerClass());
|
|
2533
2489
|
|
|
2534
2490
|
exports.B2BTheme = B2BTheme;
|
|
2535
2491
|
exports.B2CTheme = B2CTheme;
|