@nuskin/foundation-ui-components 1.19.4 → 1.20.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/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { NsTypography, NsIcon, NsAccordionHeaderProps, AccordionVariant, NsIconProps, AccordionVariantType } from '..';
|
|
2
1
|
import { styled } from '@nuskin/foundation-theme';
|
|
2
|
+
|
|
3
|
+
import { AccordionVariant, AccordionVariantType, NsAccordionHeaderProps, NsIcon, NsIconProps, NsTypography } from '..';
|
|
3
4
|
import { isValidIconName } from '../icon/NsIconVariants';
|
|
4
5
|
import { getAccordionColor } from './colorMap';
|
|
5
6
|
|
|
@@ -1,101 +1,38 @@
|
|
|
1
|
-
import {Themed} from '../common.types';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Themed } from '../common.types';
|
|
2
|
+
import { ColorUtils } from '@nuskin/foundation-theme';
|
|
3
|
+
import { AllColorKeyType } from '@nuskin/foundation-theme/src/common/themes/genome-colors/AllColors';
|
|
4
|
+
|
|
5
|
+
import { AccordionVariant, AccordionVariantType } from './enums';
|
|
6
|
+
|
|
7
|
+
const { getGenomeColor } = ColorUtils;
|
|
5
8
|
const compKeys = ['contentBg', 'contentText', 'headBg', 'headText'];
|
|
6
9
|
type CompKeys = (typeof compKeys)[number];
|
|
7
|
-
type VariantColors = Record<
|
|
8
|
-
CompKeys,
|
|
9
|
-
{
|
|
10
|
-
light: [FoundationTheme.AppColors, string];
|
|
11
|
-
dark: [FoundationTheme.AppColors, string];
|
|
12
|
-
}
|
|
13
|
-
>;
|
|
10
|
+
type VariantColors = Record<CompKeys, AllColorKeyType>;
|
|
14
11
|
|
|
15
|
-
const colorObject: Record<string, [FoundationTheme.AppColors, string]> = {
|
|
16
|
-
n10: ['primary', 'dark'], // #121212
|
|
17
|
-
n20: ['primary', 'black'], // #252525
|
|
18
|
-
n40: ['neutral', '80'], // #444444
|
|
19
|
-
n45: ['neutral', '70'], // #5f5f5f
|
|
20
|
-
n50: ['neutral', '60'], // #8c8c8c
|
|
21
|
-
n80: ['neutral', '50'], // #b2b2b2
|
|
22
|
-
n85: ['neutral', '40'], // #e0e0e0
|
|
23
|
-
n90: ['neutral', '30'], // #ededed
|
|
24
|
-
n95: ['primary', 'gray'], // #f5f5f5
|
|
25
|
-
n100: ['primary', 'white'], // #fff
|
|
26
|
-
};
|
|
27
12
|
export const colorMap: Record<AccordionVariantType, VariantColors> = {
|
|
28
13
|
basic: {
|
|
29
|
-
contentBg:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
contentText: {
|
|
34
|
-
light: colorObject.n10,
|
|
35
|
-
dark: colorObject.n95,
|
|
36
|
-
},
|
|
37
|
-
headBg: {
|
|
38
|
-
light: colorObject.n100,
|
|
39
|
-
dark: colorObject.n20,
|
|
40
|
-
},
|
|
41
|
-
headText: {
|
|
42
|
-
light: colorObject.n10,
|
|
43
|
-
dark: colorObject.n95,
|
|
44
|
-
},
|
|
14
|
+
contentBg: 'N20',
|
|
15
|
+
contentText: 'N90',
|
|
16
|
+
headBg: 'N10',
|
|
17
|
+
headText: 'N90',
|
|
45
18
|
},
|
|
46
19
|
compact: {
|
|
47
|
-
contentBg:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
contentText: {
|
|
52
|
-
light: colorObject.n10,
|
|
53
|
-
dark: colorObject.n90,
|
|
54
|
-
},
|
|
55
|
-
headBg: {
|
|
56
|
-
light: colorObject.n100,
|
|
57
|
-
dark: colorObject.n10,
|
|
58
|
-
},
|
|
59
|
-
headText: {
|
|
60
|
-
light: colorObject.n10,
|
|
61
|
-
dark: colorObject.n90,
|
|
62
|
-
},
|
|
20
|
+
contentBg: 'N10',
|
|
21
|
+
contentText: 'N90',
|
|
22
|
+
headBg: 'N10',
|
|
23
|
+
headText: 'N90',
|
|
63
24
|
},
|
|
64
25
|
gray: {
|
|
65
|
-
contentBg:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
contentText: {
|
|
70
|
-
light: colorObject.n40,
|
|
71
|
-
dark: colorObject.n85,
|
|
72
|
-
},
|
|
73
|
-
headBg: {
|
|
74
|
-
light: colorObject.n90,
|
|
75
|
-
dark: colorObject.n45,
|
|
76
|
-
},
|
|
77
|
-
headText: {
|
|
78
|
-
light: colorObject.n45,
|
|
79
|
-
dark: colorObject.n90,
|
|
80
|
-
},
|
|
26
|
+
contentBg: 'N40',
|
|
27
|
+
contentText: 'N80',
|
|
28
|
+
headBg: 'N30',
|
|
29
|
+
headText: 'N70',
|
|
81
30
|
},
|
|
82
31
|
stripe: {
|
|
83
|
-
contentBg:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
contentText: {
|
|
88
|
-
light: colorObject.n45,
|
|
89
|
-
dark: colorObject.n90,
|
|
90
|
-
},
|
|
91
|
-
headBg: {
|
|
92
|
-
light: colorObject.n100,
|
|
93
|
-
dark: colorObject.n40,
|
|
94
|
-
},
|
|
95
|
-
headText: {
|
|
96
|
-
light: colorObject.n40,
|
|
97
|
-
dark: colorObject.n100,
|
|
98
|
-
},
|
|
32
|
+
contentBg: 'N30',
|
|
33
|
+
contentText: 'N70',
|
|
34
|
+
headBg: 'N10',
|
|
35
|
+
headText: 'N80',
|
|
99
36
|
},
|
|
100
37
|
};
|
|
101
38
|
|
|
@@ -104,13 +41,14 @@ type GetAccordionColor = {
|
|
|
104
41
|
invert: boolean;
|
|
105
42
|
keys: CompKeys[];
|
|
106
43
|
} & Themed;
|
|
107
|
-
export const getAccordionColor = ({theme, variant, invert, keys}: GetAccordionColor): Record<CompKeys, string> => {
|
|
108
|
-
const isDark = invert ? !isDarkMode({theme}) : isDarkMode({theme});
|
|
109
|
-
const darkLabel = isDark ? 'dark' : 'light';
|
|
44
|
+
export const getAccordionColor = ({ theme, variant, invert, keys }: GetAccordionColor): Record<CompKeys, string> => {
|
|
110
45
|
const result: Record<string, string> = {};
|
|
46
|
+
if (!Object.values(AccordionVariant).includes(variant)) {
|
|
47
|
+
throw new Error(`Invalid variant ${variant}`);
|
|
48
|
+
}
|
|
111
49
|
for (const colorKey of keys) {
|
|
112
|
-
const
|
|
113
|
-
const colorValue =
|
|
50
|
+
const appColorKey = colorMap[variant][colorKey];
|
|
51
|
+
const colorValue = getGenomeColor(theme, appColorKey, invert ? 'dark' : 'light');
|
|
114
52
|
result[colorKey] = colorValue;
|
|
115
53
|
}
|
|
116
54
|
return result;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { styled } from '@nuskin/foundation-theme';
|
|
1
2
|
import React, { useMemo } from 'react';
|
|
2
3
|
import Slider from 'react-slick';
|
|
4
|
+
|
|
3
5
|
import { NsScrollingCarousalProps } from '../';
|
|
4
|
-
import { styled } from '@nuskin/foundation-theme';
|
|
5
6
|
|
|
6
7
|
type StyledType = {
|
|
7
8
|
dotsBottomPixel?: number;
|
|
@@ -35,7 +36,7 @@ const NsScrollingCarousal = ({
|
|
|
35
36
|
adaptiveHeight: true,
|
|
36
37
|
arrows: true,
|
|
37
38
|
draggable: true,
|
|
38
|
-
dots:
|
|
39
|
+
dots: false,
|
|
39
40
|
infinite: true,
|
|
40
41
|
speed: scrollSeconds * 1000 || 500, // speed = animation speed in milliseconds
|
|
41
42
|
slidesToShow: 1,
|