@nuskin/foundation-ui-components 1.25.1 → 1.25.2
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,13 +1,6 @@
|
|
|
1
1
|
import { styled } from '@nuskin/foundation-theme';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
AccordionVariant,
|
|
5
|
-
AccordionVariantType,
|
|
6
|
-
NsAccordionHeaderProps,
|
|
7
|
-
NsIcon,
|
|
8
|
-
NsIconProps,
|
|
9
|
-
NsTypography,
|
|
10
|
-
} from '../';
|
|
3
|
+
import { AccordionVariant, AccordionVariantType, NsAccordionHeaderProps, NsIcon, NsIconProps, NsTypography } from '../';
|
|
11
4
|
import { isValidIconName } from '../icon/NsIconVariants';
|
|
12
5
|
import { getAccordionColor } from './colorMap';
|
|
13
6
|
|
|
@@ -62,7 +55,7 @@ const NsAccordionHeader = ({
|
|
|
62
55
|
onClick={onClick}
|
|
63
56
|
variant={variant}
|
|
64
57
|
>
|
|
65
|
-
<HeaderIcon {...startIcon} />
|
|
58
|
+
<HeaderIcon {...startIcon} invert={invert} />
|
|
66
59
|
{typeof title === 'string' ? (
|
|
67
60
|
<NsTypography variant={headerTypographyVariant ?? 'h4'} weight="bold" {...(cslp?.header ?? {})}>
|
|
68
61
|
{title}
|
|
@@ -72,7 +65,10 @@ const NsAccordionHeader = ({
|
|
|
72
65
|
)}
|
|
73
66
|
{content || showEndIconWhenEmpty ? (
|
|
74
67
|
<span className="header-icon">
|
|
75
|
-
<NsIcon
|
|
68
|
+
<NsIcon
|
|
69
|
+
{...(invert ? { color: 'secondary' } : {})}
|
|
70
|
+
name={isOpen ? openedIconName ?? 'arrowUp' : closedIconName ?? 'arrowDown'}
|
|
71
|
+
/>
|
|
76
72
|
</span>
|
|
77
73
|
) : null}
|
|
78
74
|
</StyledHeader>
|
|
@@ -80,8 +76,8 @@ const NsAccordionHeader = ({
|
|
|
80
76
|
};
|
|
81
77
|
export default NsAccordionHeader;
|
|
82
78
|
|
|
83
|
-
const HeaderIcon = (props: Partial<NsIconProps>) => {
|
|
79
|
+
const HeaderIcon = (props: Partial<NsIconProps> & { invert: boolean }) => {
|
|
84
80
|
const hasIcon = props?.name ? isValidIconName(props?.name) : false;
|
|
85
81
|
if (!hasIcon) return <span />;
|
|
86
|
-
return <NsIcon {...(props as NsIconProps)} />;
|
|
82
|
+
return <NsIcon {...(props as NsIconProps)} {...(props.invert ? { color: 'secondary' } : {})} />;
|
|
87
83
|
};
|