@dvrd/dvr-controls 1.0.63 → 1.0.64
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
|
@@ -84,12 +84,12 @@ export default function DvrdCheckbox(props: Props) {
|
|
|
84
84
|
}
|
|
85
85
|
return {borderColor: convertColor(color)};
|
|
86
86
|
}, [error, useDarkestColor, isHovered, disabled, baseColor, contrastColor]);
|
|
87
|
-
const checkStyle: CSSProperties = useMemo(() => {
|
|
87
|
+
const [checkStyle, partialCheckStyle]: [CSSProperties, CSSProperties] = useMemo(() => {
|
|
88
88
|
let color: string = baseColor;
|
|
89
89
|
if (!!error) color = 'red';
|
|
90
90
|
else if (disabled) color = 'color-gray-4';
|
|
91
91
|
else if (useDarkestColor) color = findDarkestColor(baseColor, contrastColor);
|
|
92
|
-
return {color: convertColor(color)};
|
|
92
|
+
return [{color: convertColor(color)}, {backgroundColor: convertColor(color)}];
|
|
93
93
|
}, [error, disabled, useDarkestColor, baseColor, contrastColor]);
|
|
94
94
|
const mainColor = useMemo(() => {
|
|
95
95
|
return useDarkestColor ? findDarkestColor(baseColor, contrastColor) : baseColor;
|
|
@@ -114,11 +114,15 @@ export default function DvrdCheckbox(props: Props) {
|
|
|
114
114
|
className: classNames(checkIcon.props.className, checkClassName),
|
|
115
115
|
style: {...checkIcon.props.style, ...checkStyle}
|
|
116
116
|
});
|
|
117
|
+
else if (checked === 'partial') return (
|
|
118
|
+
<div className={classNames(checkClassName, 'partial-icon')} style={partialCheckStyle}/>
|
|
119
|
+
);
|
|
117
120
|
let checkName: IconName = 'check';
|
|
118
|
-
|
|
121
|
+
let additionalClassName: string | null = null;
|
|
122
|
+
if (typeof checkIcon === 'string') checkName = checkIcon as IconName;
|
|
119
123
|
else if (asRadio) checkName = 'circle';
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
return <AwesomeIcon name={checkName} className={classNames(checkClassName, additionalClassName)}
|
|
125
|
+
style={checkStyle}/>;
|
|
122
126
|
}
|
|
123
127
|
|
|
124
128
|
function renderError() {
|