@douyinfe/semi-foundation 2.76.1 → 2.77.0-beta.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/inputNumber/foundation.ts +176 -10
- package/lib/cjs/inputNumber/foundation.d.ts +15 -1
- package/lib/cjs/inputNumber/foundation.js +169 -8
- package/lib/cjs/userGuide/animation.scss +2 -0
- package/lib/cjs/userGuide/constants.d.ts +15 -0
- package/lib/cjs/userGuide/constants.js +21 -0
- package/lib/cjs/userGuide/foundation.d.ts +24 -0
- package/lib/cjs/userGuide/foundation.js +82 -0
- package/lib/cjs/userGuide/userGuide.css +109 -0
- package/lib/cjs/userGuide/userGuide.scss +143 -0
- package/lib/cjs/userGuide/variables.scss +48 -0
- package/lib/es/inputNumber/foundation.d.ts +15 -1
- package/lib/es/inputNumber/foundation.js +169 -8
- package/lib/es/userGuide/animation.scss +2 -0
- package/lib/es/userGuide/constants.d.ts +15 -0
- package/lib/es/userGuide/constants.js +16 -0
- package/lib/es/userGuide/foundation.d.ts +24 -0
- package/lib/es/userGuide/foundation.js +74 -0
- package/lib/es/userGuide/userGuide.css +109 -0
- package/lib/es/userGuide/userGuide.scss +143 -0
- package/lib/es/userGuide/variables.scss +48 -0
- package/package.json +4 -4
- package/userGuide/animation.scss +2 -0
- package/userGuide/constants.ts +35 -0
- package/userGuide/foundation.ts +87 -0
- package/userGuide/userGuide.scss +143 -0
- package/userGuide/variables.scss +48 -0
|
@@ -7,7 +7,15 @@ import keyCode from '../utils/keyCode';
|
|
|
7
7
|
import { numbers } from './constants';
|
|
8
8
|
import { minus as numberMinus } from '../utils/number';
|
|
9
9
|
class InputNumberFoundation extends BaseFoundation {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
12
|
+
this._decimalPointSymbol = undefined;
|
|
13
|
+
this._currencySymbol = '';
|
|
14
|
+
}
|
|
10
15
|
init() {
|
|
16
|
+
if (this._isCurrency()) {
|
|
17
|
+
this._setCurrencySymbol();
|
|
18
|
+
}
|
|
11
19
|
this._setInitValue();
|
|
12
20
|
}
|
|
13
21
|
destroy() {
|
|
@@ -18,6 +26,18 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
18
26
|
isControlled() {
|
|
19
27
|
return this._isControlledComponent('value');
|
|
20
28
|
}
|
|
29
|
+
_isCurrency() {
|
|
30
|
+
const {
|
|
31
|
+
currency
|
|
32
|
+
} = this.getProps();
|
|
33
|
+
return currency === true || typeof currency === 'string' && currency.trim() !== '';
|
|
34
|
+
}
|
|
35
|
+
_getFinalCurrency() {
|
|
36
|
+
const {
|
|
37
|
+
currency
|
|
38
|
+
} = this.getProps();
|
|
39
|
+
return currency === true ? this.getProp('defaultCurrency') : currency;
|
|
40
|
+
}
|
|
21
41
|
_doInput() {
|
|
22
42
|
let v = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
23
43
|
let event = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
@@ -79,6 +99,29 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
79
99
|
this._timer = null;
|
|
80
100
|
}
|
|
81
101
|
}
|
|
102
|
+
_setCurrencySymbol() {
|
|
103
|
+
const {
|
|
104
|
+
localeCode,
|
|
105
|
+
currencyDisplay
|
|
106
|
+
} = this.getProps();
|
|
107
|
+
const parts = new Intl.NumberFormat(localeCode, {
|
|
108
|
+
style: 'currency',
|
|
109
|
+
currency: this._getFinalCurrency() || this.getCurrencyByLocaleCode(),
|
|
110
|
+
currencyDisplay
|
|
111
|
+
}).formatToParts(1234.5);
|
|
112
|
+
for (const part of parts) {
|
|
113
|
+
if (part.type === 'decimal') {
|
|
114
|
+
this._decimalPointSymbol = part.value;
|
|
115
|
+
console.log('this._decimalPointSymbol: ', this._decimalPointSymbol);
|
|
116
|
+
}
|
|
117
|
+
// if (part.type === 'group') {
|
|
118
|
+
// groupSeparator = part.value;
|
|
119
|
+
// }
|
|
120
|
+
if (part.type === 'currency') {
|
|
121
|
+
this._currencySymbol = part.value;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
82
125
|
handleInputFocus(e) {
|
|
83
126
|
const value = this.getState('value');
|
|
84
127
|
if (value !== '') {
|
|
@@ -149,7 +192,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
149
192
|
if (!this.isControlled() && (num === null || typeof num === 'number' && !isNaN(num))) {
|
|
150
193
|
this._adapter.setNumber(num);
|
|
151
194
|
}
|
|
152
|
-
this._adapter.setValue(this.isControlled() ? formattedNum : this.doFormat(valueAfterParser, false), () => {
|
|
195
|
+
this._adapter.setValue(this.isControlled() && !this._isCurrency() ? formattedNum : this.doFormat(valueAfterParser, false), () => {
|
|
153
196
|
this._adapter.restoreCursor();
|
|
154
197
|
});
|
|
155
198
|
this.notifyChange(notifyVal, event);
|
|
@@ -182,7 +225,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
182
225
|
}
|
|
183
226
|
numHasChanged = true;
|
|
184
227
|
}
|
|
185
|
-
const currentFormattedNum = this.doFormat(currentNumber, true);
|
|
228
|
+
const currentFormattedNum = this.doFormat(currentNumber, true, true);
|
|
186
229
|
if (currentFormattedNum !== currentValue) {
|
|
187
230
|
willSetVal = currentFormattedNum;
|
|
188
231
|
strHasChanged = true;
|
|
@@ -296,12 +339,12 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
296
339
|
value
|
|
297
340
|
} = this.getProps();
|
|
298
341
|
const propsValue = this._isControlledComponent('value') ? value : defaultValue;
|
|
299
|
-
const tmpNumber = this.doParse(_toString(propsValue), false, true, true);
|
|
342
|
+
const tmpNumber = this.doParse(this._isCurrency() ? propsValue : _toString(propsValue), false, true, true);
|
|
300
343
|
let number = null;
|
|
301
344
|
if (typeof tmpNumber === 'number' && !isNaN(tmpNumber)) {
|
|
302
345
|
number = tmpNumber;
|
|
303
346
|
}
|
|
304
|
-
const formattedValue = typeof number === 'number' ? this.doFormat(number, true) : '';
|
|
347
|
+
const formattedValue = typeof number === 'number' ? this.doFormat(number, true, true) : '';
|
|
305
348
|
this._adapter.setNumber(number);
|
|
306
349
|
this._adapter.setValue(formattedValue);
|
|
307
350
|
if (_isString(formattedValue) && formattedValue !== String(propsValue !== null && propsValue !== void 0 ? propsValue : '')) {
|
|
@@ -339,7 +382,7 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
339
382
|
curNum = max;
|
|
340
383
|
}
|
|
341
384
|
// console.log('scale: ', scale, 'curNum: ', curNum);
|
|
342
|
-
return this.doFormat(curNum, true);
|
|
385
|
+
return this.doFormat(curNum, true, true);
|
|
343
386
|
}
|
|
344
387
|
minus(step, event) {
|
|
345
388
|
const pressShift = event && event.shiftKey;
|
|
@@ -366,6 +409,29 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
366
409
|
}
|
|
367
410
|
return _toString(num);
|
|
368
411
|
}
|
|
412
|
+
formatCurrency(value) {
|
|
413
|
+
const {
|
|
414
|
+
localeCode,
|
|
415
|
+
minimumFractionDigits,
|
|
416
|
+
precision,
|
|
417
|
+
maximumFractionDigits,
|
|
418
|
+
currencyDisplay,
|
|
419
|
+
showCurrencySymbol
|
|
420
|
+
} = this.getProps();
|
|
421
|
+
let formattedValue = value;
|
|
422
|
+
if (typeof value === 'string' && Number.isNaN(Number(value))) {
|
|
423
|
+
formattedValue = this.parseInternationalCurrency(value);
|
|
424
|
+
}
|
|
425
|
+
const formatter = new Intl.NumberFormat(localeCode, {
|
|
426
|
+
style: 'currency',
|
|
427
|
+
currency: this._getFinalCurrency() || this.getCurrencyByLocaleCode(),
|
|
428
|
+
currencyDisplay: currencyDisplay,
|
|
429
|
+
minimumFractionDigits: minimumFractionDigits || precision || undefined,
|
|
430
|
+
maximumFractionDigits: maximumFractionDigits || precision || undefined
|
|
431
|
+
});
|
|
432
|
+
const formatted = formatter.format(Number(formattedValue));
|
|
433
|
+
return showCurrencySymbol ? formatted : formatted.replace(this._currencySymbol, '').trim();
|
|
434
|
+
}
|
|
369
435
|
/**
|
|
370
436
|
* format number to string
|
|
371
437
|
* @param {string|number} value
|
|
@@ -375,12 +441,18 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
375
441
|
doFormat() {
|
|
376
442
|
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
377
443
|
let needAdjustPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
444
|
+
let needAdjustCurrency = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
378
445
|
// if (typeof value === 'string') {
|
|
379
446
|
// return value;
|
|
380
447
|
// }
|
|
448
|
+
const {
|
|
449
|
+
formatter
|
|
450
|
+
} = this.getProps();
|
|
381
451
|
let str;
|
|
382
|
-
|
|
383
|
-
if (
|
|
452
|
+
// AdjustCurrency conversion is done only in blur situation, otherwise it is just converted to normal string
|
|
453
|
+
if (this._isCurrency() && needAdjustCurrency) {
|
|
454
|
+
str = this.formatCurrency(value);
|
|
455
|
+
} else if (needAdjustPrec) {
|
|
384
456
|
str = this._adjustPrec(value);
|
|
385
457
|
} else {
|
|
386
458
|
str = _toString(value);
|
|
@@ -407,6 +479,18 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
407
479
|
}
|
|
408
480
|
return current;
|
|
409
481
|
}
|
|
482
|
+
// 将货币模式的货币转化为纯数字
|
|
483
|
+
// Convert currency in currency mode to pure numbers
|
|
484
|
+
// eg:¥123456.78 to 123456.78
|
|
485
|
+
// eg:123456.78 to 123456.78
|
|
486
|
+
parseInternationalCurrency(currencyString) {
|
|
487
|
+
let cleaned = currencyString.replace(this._currencySymbol, '').replace(new RegExp(`[^\\d${this._decimalPointSymbol}\\-]`, 'g'), '');
|
|
488
|
+
// Convert the localized decimal point to the standard decimal point
|
|
489
|
+
if (this._decimalPointSymbol && this._decimalPointSymbol !== '.') {
|
|
490
|
+
cleaned = cleaned.replace(this._decimalPointSymbol, '.');
|
|
491
|
+
}
|
|
492
|
+
return parseFloat(cleaned);
|
|
493
|
+
}
|
|
410
494
|
/**
|
|
411
495
|
* parse to number
|
|
412
496
|
* @param {string|number} value
|
|
@@ -419,6 +503,9 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
419
503
|
let needCheckPrec = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
420
504
|
let needAdjustPrec = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
421
505
|
let needAdjustMaxMin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
506
|
+
if (this._isCurrency() && typeof value === 'string') {
|
|
507
|
+
value = this.parseInternationalCurrency(value);
|
|
508
|
+
}
|
|
422
509
|
if (typeof value === 'number') {
|
|
423
510
|
if (needAdjustMaxMin) {
|
|
424
511
|
value = this.fetchMinOrMax(value);
|
|
@@ -467,7 +554,12 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
467
554
|
return value;
|
|
468
555
|
}
|
|
469
556
|
if (typeof value === 'string') {
|
|
470
|
-
const
|
|
557
|
+
const {
|
|
558
|
+
parser
|
|
559
|
+
} = this.getProps();
|
|
560
|
+
if (this._isCurrency()) {
|
|
561
|
+
value = this.parseInternationalCurrency(value);
|
|
562
|
+
}
|
|
471
563
|
if (typeof parser === 'function') {
|
|
472
564
|
value = parser(value);
|
|
473
565
|
}
|
|
@@ -535,5 +627,74 @@ class InputNumberFoundation extends BaseFoundation {
|
|
|
535
627
|
updateStates(states, callback) {
|
|
536
628
|
this._adapter.updateStates(states, callback);
|
|
537
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* Get currency by locale code
|
|
632
|
+
* @param {string} localeCode
|
|
633
|
+
* @returns {string}
|
|
634
|
+
*/
|
|
635
|
+
getCurrencyByLocaleCode() {
|
|
636
|
+
const {
|
|
637
|
+
localeCode
|
|
638
|
+
} = this.getProps();
|
|
639
|
+
// Mapping table of region codes to currency codes
|
|
640
|
+
const localeToCurrency = {
|
|
641
|
+
// Asia
|
|
642
|
+
'zh-CN': 'CNY',
|
|
643
|
+
'zh-HK': 'HKD',
|
|
644
|
+
'zh-TW': 'TWD',
|
|
645
|
+
'ja-JP': 'JPY',
|
|
646
|
+
'ko-KR': 'KRW',
|
|
647
|
+
'th-TH': 'THB',
|
|
648
|
+
'vi-VN': 'VND',
|
|
649
|
+
'ms-MY': 'MYR',
|
|
650
|
+
'id-ID': 'IDR',
|
|
651
|
+
'hi-IN': 'INR',
|
|
652
|
+
'ar-SA': 'SAR',
|
|
653
|
+
// Europe
|
|
654
|
+
'en-GB': 'GBP',
|
|
655
|
+
'de-DE': 'EUR',
|
|
656
|
+
'fr-FR': 'EUR',
|
|
657
|
+
'it-IT': 'EUR',
|
|
658
|
+
'es-ES': 'EUR',
|
|
659
|
+
'pt-PT': 'EUR',
|
|
660
|
+
'ru-RU': 'RUB',
|
|
661
|
+
// North America
|
|
662
|
+
'en-US': 'USD',
|
|
663
|
+
'en-CA': 'CAD',
|
|
664
|
+
'es-MX': 'MXN',
|
|
665
|
+
// South America
|
|
666
|
+
'pt-BR': 'BRL',
|
|
667
|
+
'es-AR': 'ARS',
|
|
668
|
+
// Oceania
|
|
669
|
+
'en-AU': 'AUD',
|
|
670
|
+
'en-NZ': 'NZD',
|
|
671
|
+
// Africa
|
|
672
|
+
'en-ZA': 'ZAR',
|
|
673
|
+
'ar-EG': 'EGP' // Egypt
|
|
674
|
+
};
|
|
675
|
+
// Try to match the full region code directly
|
|
676
|
+
if (localeToCurrency[localeCode]) {
|
|
677
|
+
return localeToCurrency[localeCode];
|
|
678
|
+
}
|
|
679
|
+
// If no direct match, try to match the language part (the first two characters)
|
|
680
|
+
const languageCode = localeCode.split('-')[0];
|
|
681
|
+
const fallbackMap = {
|
|
682
|
+
'en': 'USD',
|
|
683
|
+
'zh': 'CNY',
|
|
684
|
+
'es': 'EUR',
|
|
685
|
+
'fr': 'EUR',
|
|
686
|
+
'de': 'EUR',
|
|
687
|
+
'it': 'EUR',
|
|
688
|
+
'ja': 'JPY',
|
|
689
|
+
'ko': 'KRW',
|
|
690
|
+
'ru': 'RUB',
|
|
691
|
+
'ar': 'SAR' // Arabic defaults to SAR
|
|
692
|
+
};
|
|
693
|
+
if (fallbackMap[languageCode]) {
|
|
694
|
+
return fallbackMap[languageCode];
|
|
695
|
+
}
|
|
696
|
+
// If no match, return USD as the default value
|
|
697
|
+
return 'USD';
|
|
698
|
+
}
|
|
538
699
|
}
|
|
539
700
|
export default InputNumberFoundation;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const cssClasses: {
|
|
2
|
+
PREFIX: string;
|
|
3
|
+
PREFIX_MODAL: string;
|
|
4
|
+
};
|
|
5
|
+
declare const strings: {
|
|
6
|
+
MODE: string[];
|
|
7
|
+
POSITION_SET: string[];
|
|
8
|
+
THEME: string[];
|
|
9
|
+
};
|
|
10
|
+
declare const numbers: {
|
|
11
|
+
DEFAULT_CURRENT: number;
|
|
12
|
+
DEFAULT_SPOTLIGHT_PADDING: number;
|
|
13
|
+
DEFAULT_Z_INDEX: number;
|
|
14
|
+
};
|
|
15
|
+
export { cssClasses, strings, numbers };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
|
+
const cssClasses = {
|
|
3
|
+
PREFIX: `${BASE_CLASS_PREFIX}-userGuide`,
|
|
4
|
+
PREFIX_MODAL: `${BASE_CLASS_PREFIX}-userGuide-modal`
|
|
5
|
+
};
|
|
6
|
+
const strings = {
|
|
7
|
+
MODE: ['popup', 'modal'],
|
|
8
|
+
POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver'],
|
|
9
|
+
THEME: ['default', 'primary']
|
|
10
|
+
};
|
|
11
|
+
const numbers = {
|
|
12
|
+
DEFAULT_CURRENT: 0,
|
|
13
|
+
DEFAULT_SPOTLIGHT_PADDING: 5,
|
|
14
|
+
DEFAULT_Z_INDEX: 1030
|
|
15
|
+
};
|
|
16
|
+
export { cssClasses, strings, numbers };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
2
|
+
export interface UserGuideAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
|
+
notifyChange: (current: number) => void;
|
|
4
|
+
notifyPrev: (current: number) => void;
|
|
5
|
+
notifyNext: (current: number) => void;
|
|
6
|
+
notifySkip: () => void;
|
|
7
|
+
notifyFinish: () => void;
|
|
8
|
+
setCurrent: (current: number) => void;
|
|
9
|
+
disabledBodyScroll: () => void;
|
|
10
|
+
enabledBodyScroll: () => void;
|
|
11
|
+
}
|
|
12
|
+
export default class UserGuideFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<UserGuideAdapter<P, S>, P, S> {
|
|
13
|
+
constructor(adapter: UserGuideAdapter<P, S>);
|
|
14
|
+
init(): void;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
_notifyChange(current: number): void;
|
|
17
|
+
getIsControlledComponent(): boolean;
|
|
18
|
+
beforeShow(): void;
|
|
19
|
+
afterHide(): void;
|
|
20
|
+
getFinalPaading(): number;
|
|
21
|
+
handlePrev: () => void;
|
|
22
|
+
handleNext: () => void;
|
|
23
|
+
handleSkip: () => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import BaseFoundation from '../base/foundation';
|
|
2
|
+
import { numbers } from './constants';
|
|
3
|
+
export default class UserGuideFoundation extends BaseFoundation {
|
|
4
|
+
constructor(adapter) {
|
|
5
|
+
super(Object.assign({}, adapter));
|
|
6
|
+
this.handlePrev = () => {
|
|
7
|
+
const {
|
|
8
|
+
current
|
|
9
|
+
} = this.getStates();
|
|
10
|
+
const newCurrent = current - 1;
|
|
11
|
+
if (!this.getIsControlledComponent()) {
|
|
12
|
+
this._adapter.setCurrent(newCurrent);
|
|
13
|
+
}
|
|
14
|
+
this._notifyChange(newCurrent);
|
|
15
|
+
this._adapter.notifyPrev(newCurrent);
|
|
16
|
+
};
|
|
17
|
+
this.handleNext = () => {
|
|
18
|
+
const {
|
|
19
|
+
steps
|
|
20
|
+
} = this.getProps();
|
|
21
|
+
const {
|
|
22
|
+
current
|
|
23
|
+
} = this.getStates();
|
|
24
|
+
const isLastStep = current === steps.length - 1;
|
|
25
|
+
const newCurrent = isLastStep ? current : current + 1;
|
|
26
|
+
if (isLastStep) {
|
|
27
|
+
this._adapter.notifyFinish();
|
|
28
|
+
} else {
|
|
29
|
+
this._notifyChange(newCurrent);
|
|
30
|
+
this._adapter.notifyNext(newCurrent);
|
|
31
|
+
if (!this.getIsControlledComponent()) {
|
|
32
|
+
this._adapter.setCurrent(newCurrent);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.handleSkip = () => {
|
|
37
|
+
this._adapter.notifySkip();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
init() {}
|
|
41
|
+
destroy() {
|
|
42
|
+
this._adapter.enabledBodyScroll();
|
|
43
|
+
}
|
|
44
|
+
_notifyChange(current) {
|
|
45
|
+
const {
|
|
46
|
+
current: stateCurrent
|
|
47
|
+
} = this.getStates();
|
|
48
|
+
if (stateCurrent !== current) {
|
|
49
|
+
this._adapter.notifyChange(current);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getIsControlledComponent() {
|
|
53
|
+
return this._isInProps('current');
|
|
54
|
+
}
|
|
55
|
+
beforeShow() {
|
|
56
|
+
this._adapter.disabledBodyScroll();
|
|
57
|
+
}
|
|
58
|
+
afterHide() {
|
|
59
|
+
this._adapter.enabledBodyScroll();
|
|
60
|
+
}
|
|
61
|
+
getFinalPaading() {
|
|
62
|
+
var _a;
|
|
63
|
+
const {
|
|
64
|
+
spotlightPadding,
|
|
65
|
+
steps
|
|
66
|
+
} = this.getProps();
|
|
67
|
+
const {
|
|
68
|
+
current
|
|
69
|
+
} = this.getStates();
|
|
70
|
+
const stepPadding = (_a = steps[current]) === null || _a === void 0 ? void 0 : _a.spotlightPadding;
|
|
71
|
+
const padding = typeof stepPadding === 'number' ? stepPadding : typeof spotlightPadding === 'number' ? spotlightPadding : numbers.DEFAULT_SPOTLIGHT_PADDING;
|
|
72
|
+
return padding;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/* shadow */
|
|
2
|
+
/* sizing */
|
|
3
|
+
/* spacing */
|
|
4
|
+
.semi-userGuide-spotlight {
|
|
5
|
+
position: fixed;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
width: 100vw;
|
|
9
|
+
height: 100vh;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
.semi-userGuide-spotlight-rect {
|
|
13
|
+
transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
14
|
+
}
|
|
15
|
+
.semi-userGuide-popover {
|
|
16
|
+
max-width: fit-content;
|
|
17
|
+
width: 400px;
|
|
18
|
+
}
|
|
19
|
+
.semi-userGuide-popup-content {
|
|
20
|
+
color: var(--semi-color-text-0);
|
|
21
|
+
}
|
|
22
|
+
.semi-userGuide-popup-content-primary {
|
|
23
|
+
color: var(--semi-color-tertiary-light-default);
|
|
24
|
+
}
|
|
25
|
+
.semi-userGuide-popup-content-cover img {
|
|
26
|
+
display: block;
|
|
27
|
+
height: 200px;
|
|
28
|
+
width: 100%;
|
|
29
|
+
border-radius: var(--semi-border-radius-medium) var(--semi-border-radius-medium) 0 0;
|
|
30
|
+
}
|
|
31
|
+
.semi-userGuide-popup-content-body {
|
|
32
|
+
padding: 24px;
|
|
33
|
+
}
|
|
34
|
+
.semi-userGuide-popup-content-title {
|
|
35
|
+
font-size: 18px;
|
|
36
|
+
font-weight: 600;
|
|
37
|
+
line-height: 24px;
|
|
38
|
+
margin-bottom: 8px;
|
|
39
|
+
}
|
|
40
|
+
.semi-userGuide-popup-content-description {
|
|
41
|
+
font-size: 14px;
|
|
42
|
+
line-height: 20px;
|
|
43
|
+
margin-bottom: 48px;
|
|
44
|
+
}
|
|
45
|
+
.semi-userGuide-popup-content-footer {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
.semi-userGuide-popup-content-buttons {
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 12px;
|
|
53
|
+
margin-left: 120px;
|
|
54
|
+
}
|
|
55
|
+
.semi-userGuide-popup-content-indicator {
|
|
56
|
+
font-size: 14px;
|
|
57
|
+
line-height: 20px;
|
|
58
|
+
}
|
|
59
|
+
.semi-userGuide-modal .semi-modal-small {
|
|
60
|
+
width: fit-content;
|
|
61
|
+
}
|
|
62
|
+
.semi-userGuide-modal .semi-modal-content {
|
|
63
|
+
padding: 0;
|
|
64
|
+
width: 600px;
|
|
65
|
+
max-width: fit-content;
|
|
66
|
+
}
|
|
67
|
+
.semi-userGuide-modal-cover {
|
|
68
|
+
height: 300px;
|
|
69
|
+
}
|
|
70
|
+
.semi-userGuide-modal-indicator {
|
|
71
|
+
height: 30px;
|
|
72
|
+
display: flex;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
align-items: center;
|
|
75
|
+
column-gap: 8px;
|
|
76
|
+
}
|
|
77
|
+
.semi-userGuide-modal-indicator-item {
|
|
78
|
+
width: 6px;
|
|
79
|
+
height: 6px;
|
|
80
|
+
border-radius: var(--semi-border-radius-large);
|
|
81
|
+
background-color: var(--semi-color-primary-light-active);
|
|
82
|
+
}
|
|
83
|
+
.semi-userGuide-modal-indicator-item-active {
|
|
84
|
+
background: var(--semi-color-primary);
|
|
85
|
+
}
|
|
86
|
+
.semi-userGuide-modal-body {
|
|
87
|
+
display: flex;
|
|
88
|
+
justify-content: center;
|
|
89
|
+
align-items: center;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
padding: 24px 48px;
|
|
92
|
+
}
|
|
93
|
+
.semi-userGuide-modal-body-title {
|
|
94
|
+
font-size: 18px;
|
|
95
|
+
font-weight: 600;
|
|
96
|
+
line-height: 24px;
|
|
97
|
+
margin-bottom: 8px;
|
|
98
|
+
}
|
|
99
|
+
.semi-userGuide-modal-body-description {
|
|
100
|
+
font-size: 14px;
|
|
101
|
+
line-height: 20px;
|
|
102
|
+
}
|
|
103
|
+
.semi-userGuide-modal-footer {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
align-items: center;
|
|
107
|
+
padding: 24px;
|
|
108
|
+
column-gap: 12px;
|
|
109
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
@import './variables.scss';
|
|
2
|
+
@import './animation.scss';
|
|
3
|
+
|
|
4
|
+
$module: #{$prefix}-userGuide;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
.#{$module} {
|
|
8
|
+
|
|
9
|
+
&-spotlight {
|
|
10
|
+
position: fixed;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
width: 100vw;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
|
|
17
|
+
&-rect {
|
|
18
|
+
transition: all $transition_duration-userGuide_spotLight $transition_function-userGuide_spotLight;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&-popover {
|
|
23
|
+
max-width: fit-content;
|
|
24
|
+
width: $width-userGuide_popover-default;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&-popup-content {
|
|
28
|
+
color: $color-userGuide_popup-text-default;
|
|
29
|
+
|
|
30
|
+
&-primary {
|
|
31
|
+
color: $color-userGuide_popup-text-primary;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-cover {
|
|
35
|
+
img {
|
|
36
|
+
display: block;
|
|
37
|
+
height: $height-userGuide_popup_content_cover-default;
|
|
38
|
+
width: 100%;
|
|
39
|
+
border-radius: $radius-userGuide_popup_content_cover;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&-body {
|
|
44
|
+
padding: $spacing-userGuide_popup_content_body-padding;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-title {
|
|
48
|
+
font-size: $font-userGuide_popup_content_title-fontSize;
|
|
49
|
+
font-weight: $font-userGuide_popup_content_title-fontWeight;
|
|
50
|
+
line-height: $font-userGuide_popup_content_title-lineHeight;
|
|
51
|
+
margin-bottom: $spacing-userGuide_popup_content_title-marginBottom;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&-description {
|
|
55
|
+
font-size: $font-userGuide_popup_content_description-fontSize;
|
|
56
|
+
line-height: $font-userGuide_popup_content_description-lineHeight;
|
|
57
|
+
margin-bottom: $spacing-userGuide_popup_content_description-marginBottom;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&-footer {
|
|
61
|
+
display: flex;
|
|
62
|
+
justify-content: space-between;
|
|
63
|
+
align-items: center;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&-buttons {
|
|
67
|
+
display: flex;
|
|
68
|
+
gap: $spacing-userGuide_popup_content_button-gap;
|
|
69
|
+
margin-left: $spacing-userGuide_popup_content_button-marginLeft;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&-indicator {
|
|
73
|
+
font-size: $font-size-regular;
|
|
74
|
+
line-height: $font-userGuide_popup_content_indicator-lineHeight;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
&-modal {
|
|
79
|
+
|
|
80
|
+
.#{$prefix}-modal-small {
|
|
81
|
+
width: fit-content;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Override the modal's original padding
|
|
85
|
+
.#{$prefix}-modal-content {
|
|
86
|
+
padding: 0;
|
|
87
|
+
width: $width-userGuide_modal_content_cover-default;
|
|
88
|
+
max-width: fit-content;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&-cover {
|
|
92
|
+
height: $height-userGuide_modal_content_cover-default;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&-indicator {
|
|
96
|
+
height: $height-userGuide_modal_content_indicator-default;
|
|
97
|
+
display: flex;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
align-items: center;
|
|
100
|
+
column-gap: $spacing-userGuide_popup_content_indicator-gap;
|
|
101
|
+
|
|
102
|
+
&-item {
|
|
103
|
+
width: $width-userGuide_modal_content_indicator_item-default;
|
|
104
|
+
height: $height-userGuide_modal_content_indicator_item-default;
|
|
105
|
+
border-radius: $radius-userGuide_modal_content_indicator;
|
|
106
|
+
background-color: $color-userGuide_modal_content_indicator-bg;
|
|
107
|
+
|
|
108
|
+
&-active {
|
|
109
|
+
background: $color-userGuide_modal_content_indicator-bg-active
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&-body {
|
|
115
|
+
display: flex;
|
|
116
|
+
justify-content: center;
|
|
117
|
+
align-items: center;
|
|
118
|
+
flex-direction: column;
|
|
119
|
+
padding: $spacing-userGuide_modal_content_body-padding;
|
|
120
|
+
|
|
121
|
+
&-title {
|
|
122
|
+
font-size: $font-userGuide_modal_content_title-fontSize;
|
|
123
|
+
font-weight: $font-userGuide_modal_content_title-fontWeight;
|
|
124
|
+
line-height:$font-userGuide_modal_content_title-lineHeight;
|
|
125
|
+
margin-bottom: $spacing-userGuide_modal_content_title-marginBottom;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&-description {
|
|
129
|
+
font-size: $font-userGuide_modal_content_description-fontSize;
|
|
130
|
+
line-height: $font-userGuide_modal_content_description-lineHeight;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&-footer {
|
|
135
|
+
display: flex;
|
|
136
|
+
justify-content: center;
|
|
137
|
+
align-items: center;
|
|
138
|
+
padding: $spacing-userGuide_modal_content_footer-padding;
|
|
139
|
+
column-gap: $spacing-userGuide_modal_content_button-gap
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|