diff --git a/component-library/src/components/Checkbox/Checkbox.jsx b/component-library/src/components/Checkbox/Checkbox.jsx
index f8e348eae..ffc160ef6 100644
--- a/component-library/src/components/Checkbox/Checkbox.jsx
+++ b/component-library/src/components/Checkbox/Checkbox.jsx
@@ -1,10 +1,9 @@
import React from 'react'
import PropTypes from 'prop-types'
import styled, { css } from 'styled-components';
-import { variant as styledVariant } from 'styled-system';
import theme from '../../theme';
-import { get } from '../../utils/utils';
-import { COMMON } from '../../utils/constants';
+import { lodashGet, get } from '../../utils';
+import { COMMON } from '../../constants';
const verticalStyle = css`
display: block;
@@ -22,12 +21,23 @@ const LabelBase = styled.label`
${(props) => props.vertical && verticalStyle}
& input:checked ~ span {
- ${styledVariant({
- prop: 'error',
- scale: 'checkbox.checked',
- })};
- border-radius: 3px;
- display: block;s
+ ${get('checkbox.checked')}
+ display: block;
+ }
+
+ & input:indeterminate ~ span {
+ ${get('checkbox.indeterminate')}
+ display: block;
+ }
+
+ & input:hover ~ span {
+ ${get('checkbox.hover')}
+ display: block;
+ }
+
+ & input:disabled ~ span {
+ ${get('checkbox.disabled')}
+ display: block;
}
& input:checked ~ span svg {
@@ -69,67 +79,65 @@ const CheckboxBase = styled.span`
}
`;
-const StyledSVG = styled.svg`
- &[disabled] {
- stroke: ${get('colors.lightGrey')};
- }
-`
-
const Checkbox = ({
checked,
children,
defaultChecked,
disabled,
id,
- intermediate,
+ indeterminate,
name,
onChange,
theme: propTheme,
value,
vertical,
...props
-}) => (
-
- {children}
- {
+ const checkmarkColor = disabled ? lodashGet(theme, 'colors.disabled', '#FAFBFC') : lodashGet(theme, 'colors.white', '#FFFFFF')
+ return (
+
-
- {intermediate ?
- :
-
- }
-
-
-);
+ theme={propTheme}
+ vertical={vertical}
+ {...props}
+ >
+ {children}
+
+
+ {indeterminate ?
+ :
+
+ }
+
+
+ )
+};
Checkbox.defaultProps = { theme };
@@ -139,6 +147,7 @@ Checkbox.propTypes = {
defaultChecked: PropTypes.bool,
disabled: PropTypes.bool,
id: PropTypes.string,
+ indeterminate: PropTypes.bool,
name: PropTypes.string,
onChange: PropTypes.func,
theme: PropTypes.object,
diff --git a/component-library/src/stories/Checkbox.stories.jsx b/component-library/src/stories/Checkbox.stories.jsx
index 01160d5b1..ca16cd440 100644
--- a/component-library/src/stories/Checkbox.stories.jsx
+++ b/component-library/src/stories/Checkbox.stories.jsx
@@ -7,13 +7,13 @@ export default {
title: 'Components/Checkbox',
component: Checkbox,
argTypes: {
- children: {
- type: {
- summary: 'string',
- detail: 'checkbox label'
- }
- },
- },
+ children: {
+ control: {type: 'text'}
+ },
+ indeterminate: {
+ control: {type: 'boolean'}
+ }
+ },
parameters : {
design: {
type: "figma",
@@ -22,7 +22,7 @@ export default {
}
};
-const Template = (args) => ;
+const Template = (args) => ;
export const Primary = Template.bind({});
Primary.args = {};
\ No newline at end of file
diff --git a/component-library/src/theme.js b/component-library/src/theme.js
index bc938b229..2335d203f 100644
--- a/component-library/src/theme.js
+++ b/component-library/src/theme.js
@@ -407,17 +407,16 @@ const button = {
const checkbox = {
border: `1px solid ${colors.lightPalette[500]}`,
borderRadius: '4px',
- hover: {
- background: `${colors.lightGray}`,
- border: `1px solid ${colors.midnightPalette[300]}`,
+ checked: {
+ background: `${colors.midnightPalette[500]}`,
+ border: `1px solid ${colors.midnightPalette[500]}`,
},
disabled: {
background: `${colors.lightGray}`,
border: `1px solid ${colors.lightPalette[500]}`,
},
- checked: {
- background: `${colors.midnightPalette[500]}`,
- border: `1px solid ${colors.midnightPalette[500]}`,
+ hover: {
+ border: `1px solid ${colors.midnightPalette[300]}`,
},
};